mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-16 08:37:45 +02:00
2019-10-07 Fred Gleason <fredg@paravelsystems.com>
* Refactored rdgpimon(1) to use the 'RDDialog' and 'RDWidget' base classes.
This commit is contained in:
parent
c8ed729c98
commit
2c5c7886e2
@ -19169,3 +19169,6 @@
|
||||
2019-10-07 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored rddbconfig(8) to use the 'RDDialog' and 'RDWidget'
|
||||
base classes.
|
||||
2019-10-07 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored rdgpimon(1) to use the 'RDDialog' and 'RDWidget'
|
||||
base classes.
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for testing general purpose input (GPI) devices.
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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,27 +18,19 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <gpi_label.h>
|
||||
#include "gpi_label.h"
|
||||
|
||||
GpiLabel::GpiLabel(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
: RDWidget(parent)
|
||||
{
|
||||
gpi_line=-1;
|
||||
|
||||
//
|
||||
// Generate Fonts
|
||||
//
|
||||
QFont line_font("Helvetica",18,QFont::Bold);
|
||||
line_font.setPixelSize(18);
|
||||
QFont cart_font("Helvetica",12,QFont::Bold);
|
||||
cart_font.setPixelSize(12);
|
||||
|
||||
//
|
||||
// Line Label
|
||||
//
|
||||
gpi_line_label=new QLabel(this);
|
||||
gpi_line_label->setGeometry(0,0,59,33);
|
||||
gpi_line_label->setFont(line_font);
|
||||
gpi_line_label->setFont(bigButtonFont());
|
||||
gpi_line_label->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
gpi_line_label->setPalette(Qt::gray);
|
||||
gpi_line_label->setStyleSheet("background-color:"+QColor(Qt::gray).name());
|
||||
@ -52,7 +44,7 @@ GpiLabel::GpiLabel(QWidget *parent)
|
||||
p.setColor(QPalette::Disabled,QColorGroup::Foreground,Qt::darkGreen);
|
||||
gpi_oncart_label=new QLabel(this);
|
||||
gpi_oncart_label->setGeometry(0,33,59,16);
|
||||
gpi_oncart_label->setFont(cart_font);
|
||||
gpi_oncart_label->setFont(labelFont());
|
||||
gpi_oncart_label->setAlignment(Qt::AlignHCenter|Qt::AlignTop);
|
||||
gpi_oncart_label->setPalette(p);
|
||||
|
||||
@ -64,7 +56,7 @@ GpiLabel::GpiLabel(QWidget *parent)
|
||||
p.setColor(QPalette::Disabled,QColorGroup::Foreground,Qt::darkRed);
|
||||
gpi_offcart_label=new QLabel(this);
|
||||
gpi_offcart_label->setGeometry(0,49,59,16);
|
||||
gpi_offcart_label->setFont(cart_font);
|
||||
gpi_offcart_label->setFont(labelFont());
|
||||
gpi_offcart_label->setAlignment(Qt::AlignHCenter|Qt::AlignTop);
|
||||
gpi_offcart_label->setPalette(p);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for testing general purpose input (GPI) devices.
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@ -21,10 +21,11 @@
|
||||
#ifndef GPI_LABEL_H
|
||||
#define GPI_LABEL_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
class GpiLabel : public QWidget
|
||||
#include <rdwidget.h>
|
||||
|
||||
class GpiLabel : public RDWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for testing General Purpose Input (GPI) devices.
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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,25 +18,11 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qwindowsstyle.h>
|
||||
#include <qwidget.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qrect.h>
|
||||
#include <qpoint.h>
|
||||
#include <qpainter.h>
|
||||
#include <qstring.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qtranslator.h>
|
||||
|
||||
#include <rdapplication.h>
|
||||
#include <rddb.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdlistviewitem.h>
|
||||
#include <rdreport.h>
|
||||
#include <rdtextfile.h>
|
||||
|
||||
@ -47,8 +33,8 @@
|
||||
//
|
||||
#include "../icons/rivendell-22x22.xpm"
|
||||
|
||||
MainWidget::MainWidget(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
: RDWidget(c,parent)
|
||||
{
|
||||
QString err_msg;
|
||||
|
||||
@ -78,23 +64,8 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
//
|
||||
// Set Window Size
|
||||
//
|
||||
setMinimumWidth(sizeHint().width());
|
||||
setMaximumWidth(sizeHint().width());
|
||||
setMinimumHeight(sizeHint().height());
|
||||
setMaximumHeight(sizeHint().height());
|
||||
|
||||
//
|
||||
// Create Fonts
|
||||
//
|
||||
QFont font("helvetica",10,QFont::Normal);
|
||||
font.setPixelSize(10);
|
||||
setFont(font);
|
||||
QFont list_font("helvetica",12,QFont::Normal);
|
||||
list_font.setPixelSize(12);
|
||||
QFont main_font("helvetica",12,QFont::Bold);
|
||||
main_font.setPixelSize(12);
|
||||
QFont title_font("helvetica",14,QFont::Bold);
|
||||
title_font.setPixelSize(14);
|
||||
setMinimumSize(sizeHint());
|
||||
setMaximumSize(sizeHint());
|
||||
|
||||
//
|
||||
// Create And Set Icon
|
||||
@ -135,7 +106,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
gpi_type_box->insertItem(tr("GPO (Outputs)"));
|
||||
QLabel *label=new QLabel(gpi_type_box,tr("Show:"),this);
|
||||
label->setGeometry(20,10,55,21);
|
||||
label->setFont(main_font);
|
||||
label->setFont(labelFont());
|
||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
connect(gpi_type_box,SIGNAL(activated(int)),
|
||||
this,SLOT(matrixActivatedData(int)));
|
||||
@ -150,7 +121,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
}
|
||||
label=new QLabel(gpi_matrix_box,tr("Matrix:"),this);
|
||||
label->setGeometry(220,10,55,21);
|
||||
label->setFont(main_font);
|
||||
label->setFont(labelFont());
|
||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
connect(gpi_matrix_box,SIGNAL(activated(int)),
|
||||
this,SLOT(matrixActivatedData(int)));
|
||||
@ -190,7 +161,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
//
|
||||
label=new QLabel(tr("Green = ON Cart"),this);
|
||||
label->setGeometry(200,370,300,12);
|
||||
label->setFont(main_font);
|
||||
label->setFont(labelFont());
|
||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||
QPalette p=palette();
|
||||
p.setColor(QPalette::Active,QColorGroup::Foreground,Qt::darkGreen);
|
||||
@ -200,7 +171,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
|
||||
label=new QLabel(tr("Red = OFF Cart"),this);
|
||||
label->setGeometry(200,392,300,12);
|
||||
label->setFont(main_font);
|
||||
label->setFont(labelFont());
|
||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||
p.setColor(QPalette::Active,QColorGroup::Foreground,Qt::darkRed);
|
||||
p.setColor(QPalette::Inactive,QColorGroup::Foreground,Qt::darkRed);
|
||||
@ -211,7 +182,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
// Events Log
|
||||
//
|
||||
label=new QLabel(tr("Events Log"),this);
|
||||
label->setFont(title_font);
|
||||
label->setFont(sectionLabelFont());
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
label->setGeometry(110,423,sizeHint().width()-220,30);
|
||||
|
||||
@ -222,7 +193,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
this,SLOT(eventsDateChangedData(const QDate &)));
|
||||
gpi_events_date_label=new QLabel(gpi_events_date_edit,tr("Date")+":",this);
|
||||
gpi_events_date_label->setGeometry(100,453,50,20);
|
||||
gpi_events_date_label->setFont(main_font);
|
||||
gpi_events_date_label->setFont(labelFont());
|
||||
gpi_events_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
|
||||
gpi_events_state_box=new QComboBox(this);
|
||||
@ -234,11 +205,10 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
this,SLOT(eventsStateChangedData(int)));
|
||||
gpi_events_state_label=new QLabel(gpi_events_state_box,tr("State")+":",this);
|
||||
gpi_events_state_label->setGeometry(275,453,50,20);
|
||||
gpi_events_state_label->setFont(main_font);
|
||||
gpi_events_state_label->setFont(labelFont());
|
||||
gpi_events_state_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
|
||||
gpi_events_list=new RDListView(this);
|
||||
gpi_events_list->setFont(main_font);
|
||||
gpi_events_list->setGeometry(110,480,sizeHint().width()-220,230);
|
||||
gpi_events_list->setItemMargin(5);
|
||||
gpi_events_list->setSelectionMode(Q3ListView::NoSelection);
|
||||
@ -256,7 +226,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
|
||||
gpi_events_scroll_button=new QPushButton(tr("Scroll"),this);
|
||||
gpi_events_scroll_button->setGeometry(sizeHint().width()-100,510,80,50);
|
||||
gpi_events_scroll_button->setFont(main_font);
|
||||
gpi_events_scroll_button->setFont(buttonFont());
|
||||
connect(gpi_events_scroll_button,SIGNAL(clicked()),
|
||||
this,SLOT(eventsScrollData()));
|
||||
gpi_scroll_color=palette();
|
||||
@ -275,7 +245,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
|
||||
gpi_events_report_button=new QPushButton(tr("Report"),this);
|
||||
gpi_events_report_button->setGeometry(sizeHint().width()-100,570,80,50);
|
||||
gpi_events_report_button->setFont(main_font);
|
||||
gpi_events_report_button->setFont(buttonFont());
|
||||
connect(gpi_events_report_button,SIGNAL(clicked()),
|
||||
this,SLOT(eventsReportData()));
|
||||
|
||||
@ -776,7 +746,9 @@ int main(int argc,char *argv[])
|
||||
//
|
||||
// Start Event Loop
|
||||
//
|
||||
MainWidget *w=new MainWidget();
|
||||
RDConfig *config=new RDConfig();
|
||||
config->load();
|
||||
MainWidget *w=new MainWidget(config);
|
||||
a.setMainWidget(w);
|
||||
w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
|
||||
w->show();
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for testing general purpose input (GPI) devices.
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@ -21,23 +21,13 @@
|
||||
#ifndef RDGPIMON_H
|
||||
#define RDGPIMON_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qsize.h>
|
||||
#include <qsizepolicy.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qcolor.h>
|
||||
#include <qstring.h>
|
||||
#include <qsignalmapper.h>
|
||||
#include <qlabel.h>
|
||||
#include <qsqldatabase.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qpixmap.h>
|
||||
#include <q3datetimeedit.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <rdlistview.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
#include <rdmatrix.h>
|
||||
#include <rdtransportbutton.h>
|
||||
#include <rdwidget.h>
|
||||
|
||||
#include "gpi_label.h"
|
||||
|
||||
@ -46,11 +36,11 @@
|
||||
#define GPIMON_COLS 8
|
||||
#define RDGPIMON_USAGE "\n"
|
||||
|
||||
class MainWidget : public QWidget
|
||||
class MainWidget : public RDWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWidget(QWidget *parent=0);
|
||||
MainWidget(RDConfig *c,QWidget *parent=0);
|
||||
~MainWidget();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user