2019-10-07 Fred Gleason <fredg@paravelsystems.com>

* Refactored rdmonitor(1) to use the 'RDDialog' and 'RDWidget'
	base classes.
This commit is contained in:
Fred Gleason 2019-10-07 12:18:47 -04:00
parent 6f0fb28c27
commit ecf328eecf
3 changed files with 16 additions and 33 deletions

View File

@ -19154,3 +19154,6 @@
2019-10-04 Fred Gleason <fredg@paravelsystems.com> 2019-10-04 Fred Gleason <fredg@paravelsystems.com>
* Refactored rdlogmanager(1) to use the 'RDDialog' and 'RDWidget' * Refactored rdlogmanager(1) to use the 'RDDialog' and 'RDWidget'
base classes. base classes.
2019-10-07 Fred Gleason <fredg@paravelsystems.com>
* Refactored rdmonitor(1) to use the 'RDDialog' and 'RDWidget'
base classes.

View File

@ -2,7 +2,7 @@
// //
// System Monitor for Rivendell // System Monitor for Rivendell
// //
// (C) Copyright 2012-2018 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2012-2019 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -19,26 +19,15 @@
// //
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <qapplication.h> #include <qapplication.h>
#include <qdir.h> #include <qdir.h>
#include <qfontmetrics.h>
#include <qlabel.h>
#include <qmessagebox.h> #include <qmessagebox.h>
#include <qpainter.h> #include <qpainter.h>
#include <qprocess.h> #include <qprocess.h>
#include <qsqldatabase.h>
#include <qstringlist.h>
#include <qtranslator.h> #include <qtranslator.h>
#include <dbversion.h> #include <dbversion.h>
#include <rd.h>
#include <rdaudioinfo.h>
#include <rdcmd_switch.h>
#include <rdmonitor_config.h>
#include <rdstation.h>
#include <rdstatus.h> #include <rdstatus.h>
#include "rdmonitor.h" #include "rdmonitor.h"
@ -60,9 +49,8 @@ void SigHandler(int signo)
} }
} }
MainWidget::MainWidget(QWidget *parent) MainWidget::MainWidget(RDConfig *c,QWidget *parent)
: QWidget(parent,(Qt::WindowFlags)(Qt::WStyle_Customize|Qt::WStyle_NoBorder|Qt::WStyle_StaysOnTop)) : RDWidget(c,parent,(Qt::WindowFlags)(Qt::WStyle_Customize|Qt::WStyle_NoBorder|Qt::WStyle_StaysOnTop))
// : QWidget(parent,"",(Qt::WindowFlags)(Qt::WStyle_Customize|Qt::WStyle_NoBorder|Qt::WStyle_StaysOnTop|Qt::WX11BypassWM|Qt::WA_AlwaysShowToolTips))
{ {
QString str; QString str;
mon_dialog_x=0; mon_dialog_x=0;
@ -82,11 +70,9 @@ MainWidget::MainWidget(QWidget *parent)
setGeometry(0,0,0,0); setGeometry(0,0,0,0);
// //
// Generate Fonts // Process Fonts
// //
QFont font=QFont("Helvetica",12,QFont::Bold); mon_metrics=new QFontMetrics(font());
font.setPixelSize(12);
mon_metrics=new QFontMetrics(font);
// //
// Create And Set Icon // Create And Set Icon
@ -111,7 +97,7 @@ MainWidget::MainWidget(QWidget *parent)
// Name Label // Name Label
// //
mon_name_label=new QLabel(this); mon_name_label=new QLabel(this);
mon_name_label->setFont(font); mon_name_label->setFont(labelFont());
// //
// Status Icons // Status Icons
@ -516,7 +502,9 @@ int main(int argc,char *argv[])
// //
// Start Event Loop // Start Event Loop
// //
MainWidget *w=new MainWidget(); RDConfig *config=new RDConfig();
config->load();
MainWidget *w=new MainWidget(config);
a.setMainWidget(w); a.setMainWidget(w);
w->show(); w->show();
return a.exec(); return a.exec();

View File

@ -2,7 +2,7 @@
// //
// System Monitor Applet for Rivendell // System Monitor Applet for Rivendell
// //
// (C) Copyright 2012-2018 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2012-2019 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -22,31 +22,23 @@
#ifndef RDMONITOR_H #ifndef RDMONITOR_H
#define RDMONITOR_H #define RDMONITOR_H
#include <vector>
#include <qwidget.h>
#include <qsize.h>
#include <qsizepolicy.h>
#include <qlabel.h>
#include <qtimer.h> #include <qtimer.h>
#include <qdesktopwidget.h>
#include <qfontmetrics.h>
#include <QMouseEvent> #include <QMouseEvent>
#include <rdconfig.h> #include <rdconfig.h>
#include <rdmonitor_config.h> #include <rdmonitor_config.h>
#include <rdwidget.h>
#include "positiondialog.h" #include "positiondialog.h"
//#include "status_tip.h"
#define RDSELECT_WIDTH 400 #define RDSELECT_WIDTH 400
#define RDSELECT_HEIGHT 300 #define RDSELECT_HEIGHT 300
class MainWidget : public QWidget class MainWidget : public RDWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MainWidget(QWidget *parent=0); MainWidget(RDConfig *c,QWidget *parent=0);
QSizePolicy sizePolicy() const; QSizePolicy sizePolicy() const;
private slots: private slots: