From c978b45c4fc8f6d0cff3e9feacc185c15c60547f Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Sat, 26 Apr 2025 17:52:45 -0400 Subject: [PATCH] 2025-04-26 Fred Gleason * Cleaned up compiler warnings in 'rdmonitor/'. Signed-off-by: Fred Gleason --- ChangeLog | 2 ++ rdmonitor/positiondialog.cpp | 6 ++++-- rdmonitor/rdmonitor.cpp | 20 +++++++++++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a94ea73e..09afc725 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25000,3 +25000,5 @@ * Cleaned up compiler warnings in 'rdlogin/'. 2025-04-26 Fred Gleason * Cleaned up compiler warnings in 'rdlogmanager/'. +2025-04-26 Fred Gleason + * Cleaned up compiler warnings in 'rdmonitor/'. diff --git a/rdmonitor/positiondialog.cpp b/rdmonitor/positiondialog.cpp index e70404a1..48cd13ae 100644 --- a/rdmonitor/positiondialog.cpp +++ b/rdmonitor/positiondialog.cpp @@ -2,7 +2,7 @@ // // Dialog to set RDMonitor screen position. // -// (C) Copyright 2013-2021 Fred Gleason +// (C) Copyright 2013-2025 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,6 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // +#include + #include "positiondialog.h" PositionDialog::PositionDialog(QDesktopWidget *dw,RDMonitorConfig *mconfig, @@ -101,7 +103,7 @@ QSizePolicy PositionDialog::sizePolicy() const int PositionDialog::exec() { pos_screen_number_box->clear(); - for(int i=0;inumScreens();i++) { + for(int i=0;iinsertItem(i,QString::asprintf("%d",i)); if(i==pos_config->screenNumber()) { pos_screen_number_box->setCurrentIndex(i); diff --git a/rdmonitor/rdmonitor.cpp b/rdmonitor/rdmonitor.cpp index d9ce70f2..07467e8e 100644 --- a/rdmonitor/rdmonitor.cpp +++ b/rdmonitor/rdmonitor.cpp @@ -2,7 +2,7 @@ // // System Monitor for Rivendell // -// (C) Copyright 2012-2022 Fred Gleason +// (C) Copyright 2012-2025 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -22,9 +22,11 @@ #include #include +#include #include #include #include +#include #include #include @@ -59,7 +61,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) mon_rdselect_x=0; mon_rdselect_y=0; - rdt=new RDTranslator("rdmonitor",this); // Load translations + rdt=new RDTranslator("rdmonitor",true,this); // Load translations // // Read Command Options @@ -289,8 +291,16 @@ void MainWidget::SetSummaryState(bool state) void MainWidget::SetPosition() { - int width=mon_metrics->width(mon_name_label->text())+40; - QRect geo=mon_desktop_widget->screenGeometry(mon_config->screenNumber()); + int width=mon_metrics->horizontalAdvance(mon_name_label->text())+40; + // QRect geo=mon_desktop_widget->screenGeometry(mon_config->screenNumber()); + QRect geo; + QList screens=QGuiApplication::screens(); + if(screens.size()>mon_config->screenNumber()) { + geo=screens.at(mon_config->screenNumber())->geometry(); + } + else { + geo=screens.at(0)->geometry(); + } QRect main_geo=mon_desktop_widget->geometry(); int x=0; int dx=mon_config->xOffset(); @@ -435,7 +445,7 @@ void MainWidget::SetStatusPosition() { QFontMetrics *fm=new QFontMetrics(mon_status_label->font()); int h=10+fm->height(); - int w=10+fm->width(mon_status_label->text()); + int w=10+fm->horizontalAdvance(mon_status_label->text()); QRect g=geometry(); switch(mon_config->position()) {