mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-23 16:08:15 +02:00
2014-10-07 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Report' button to RDGpiMon(1) in 'utils/rdgpimon/rdgpimon.cpp' and 'utils/rdgpimon/rdgpimon.h'.
This commit is contained in:
parent
4189ce7bb1
commit
4078d589b1
@ -14521,3 +14521,6 @@
|
||||
'utils/rdgpimon/rdgpimon.cpp' and 'utils/rdgpimon/rdgpimon.h'.
|
||||
* Added code in rdmaint(1) to purge logged GPIO events in
|
||||
'utils/rdmaint/rdmaint.cpp' and 'utils/rdmaint/rdmaint.h'.
|
||||
2014-10-07 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'Report' button to RDGpiMon(1) in
|
||||
'utils/rdgpimon/rdgpimon.cpp' and 'utils/rdgpimon/rdgpimon.h'.
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <rddbheartbeat.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdlistviewitem.h>
|
||||
#include <rdtextfile.h>
|
||||
|
||||
//
|
||||
// Icons
|
||||
@ -184,38 +185,93 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Up Button
|
||||
//
|
||||
gpi_up_button=
|
||||
new RDTransportButton(RDTransportButton::Up,this);
|
||||
gpi_up_button->setGeometry(10,360,80,50);
|
||||
connect(gpi_up_button,SIGNAL(clicked()),this,SLOT(upData()));
|
||||
|
||||
//
|
||||
// Down Button
|
||||
//
|
||||
gpi_down_button=
|
||||
new RDTransportButton(RDTransportButton::Down,this);
|
||||
gpi_down_button->setGeometry(100,360,80,50);
|
||||
connect(gpi_down_button,SIGNAL(clicked()),this,SLOT(downData()));
|
||||
|
||||
//
|
||||
// Color Key
|
||||
//
|
||||
label=new QLabel(tr("Green = ON Cart"),this);
|
||||
label->setGeometry(200,370,300,12);
|
||||
label->setFont(main_font);
|
||||
label->setAlignment(AlignLeft|AlignVCenter);
|
||||
QPalette p=palette();
|
||||
p.setColor(QPalette::Active,QColorGroup::Foreground,darkGreen);
|
||||
p.setColor(QPalette::Inactive,QColorGroup::Foreground,darkGreen);
|
||||
p.setColor(QPalette::Disabled,QColorGroup::Foreground,darkGreen);
|
||||
label->setPalette(p);
|
||||
|
||||
label=new QLabel(tr("Red = OFF Cart"),this);
|
||||
label->setGeometry(200,392,300,12);
|
||||
label->setFont(main_font);
|
||||
label->setAlignment(AlignLeft|AlignVCenter);
|
||||
p.setColor(QPalette::Active,QColorGroup::Foreground,darkRed);
|
||||
p.setColor(QPalette::Inactive,QColorGroup::Foreground,darkRed);
|
||||
p.setColor(QPalette::Disabled,QColorGroup::Foreground,darkRed);
|
||||
label->setPalette(p);
|
||||
|
||||
//
|
||||
// Events Log
|
||||
//
|
||||
label=new QLabel(tr("Events Log"),this);
|
||||
label->setFont(title_font);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
label->setGeometry(110,353,sizeHint().width()-220,30);
|
||||
label->setGeometry(110,423,sizeHint().width()-220,30);
|
||||
|
||||
gpi_events_date_edit=new QDateEdit(this);
|
||||
gpi_events_date_edit->setGeometry(155,383,90,20);
|
||||
gpi_events_date_edit->setGeometry(155,453,90,20);
|
||||
gpi_events_date_edit->setDate(QDate::currentDate());
|
||||
connect(gpi_events_date_edit,SIGNAL(valueChanged(const QDate &)),
|
||||
this,SLOT(eventsDateChangedData(const QDate &)));
|
||||
gpi_events_date_label=new QLabel(gpi_events_date_edit,tr("Date")+":",this);
|
||||
gpi_events_date_label->setGeometry(100,383,50,20);
|
||||
gpi_events_date_label->setGeometry(100,453,50,20);
|
||||
gpi_events_date_label->setFont(main_font);
|
||||
gpi_events_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
|
||||
gpi_events_state_box=new QComboBox(this);
|
||||
gpi_events_state_box->setGeometry(280,383,55,20);
|
||||
gpi_events_state_box->setGeometry(280,453,55,20);
|
||||
gpi_events_state_box->insertItem(tr("On"));
|
||||
gpi_events_state_box->insertItem(tr("Off"));
|
||||
gpi_events_state_box->insertItem(tr("Both"));
|
||||
connect(gpi_events_state_box,SIGNAL(activated(int)),
|
||||
this,SLOT(eventsStateChangedData(int)));
|
||||
gpi_events_state_label=new QLabel(gpi_events_state_box,tr("State")+":",this);
|
||||
gpi_events_state_label->setGeometry(225,383,50,20);
|
||||
gpi_events_state_label->setGeometry(225,453,50,20);
|
||||
gpi_events_state_label->setFont(main_font);
|
||||
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(QListView::NoSelection);
|
||||
|
||||
gpi_events_list->addColumn("Time");
|
||||
gpi_events_list->setColumnAlignment(0,Qt::AlignHCenter);
|
||||
gpi_events_list->setColumnSortType(1,RDListView::TimeSort);
|
||||
|
||||
gpi_events_list->addColumn(tr("Line"));
|
||||
gpi_events_list->setColumnAlignment(1,Qt::AlignHCenter);
|
||||
gpi_events_list->setColumnSortType(1,RDListView::GpioSort);
|
||||
|
||||
gpi_events_list->addColumn(tr("State"));
|
||||
gpi_events_list->setColumnAlignment(2,Qt::AlignHCenter);
|
||||
|
||||
gpi_events_scroll_button=new QPushButton(tr("Scroll"),this);
|
||||
gpi_events_scroll_button->setGeometry(355,380,60,26);
|
||||
gpi_events_scroll_button->setGeometry(sizeHint().width()-100,510,80,50);
|
||||
gpi_events_scroll_button->setFont(main_font);
|
||||
connect(gpi_events_scroll_button,SIGNAL(clicked()),
|
||||
this,SLOT(eventsScrollData()));
|
||||
@ -233,71 +289,11 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
||||
gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::Background,
|
||||
lightGray);
|
||||
|
||||
gpi_events_list=new RDListView(this);
|
||||
gpi_events_list->setFont(main_font);
|
||||
gpi_events_list->setGeometry(110,410,sizeHint().width()-220,170);
|
||||
gpi_events_list->setItemMargin(5);
|
||||
gpi_events_list->setSelectionMode(QListView::NoSelection);
|
||||
|
||||
gpi_events_list->addColumn("Time");
|
||||
gpi_events_list->setColumnAlignment(0,Qt::AlignHCenter);
|
||||
gpi_events_list->setColumnSortType(1,RDListView::TimeSort);
|
||||
|
||||
gpi_events_list->addColumn(tr("Line"));
|
||||
gpi_events_list->setColumnAlignment(1,Qt::AlignHCenter);
|
||||
gpi_events_list->setColumnSortType(1,RDListView::GpioSort);
|
||||
|
||||
gpi_events_list->addColumn(tr("State"));
|
||||
gpi_events_list->setColumnAlignment(2,Qt::AlignHCenter);
|
||||
|
||||
//
|
||||
// Up Button
|
||||
//
|
||||
gpi_up_button=
|
||||
new RDTransportButton(RDTransportButton::Up,this);
|
||||
gpi_up_button->setGeometry(10,sizeHint().height()-60,80,50);
|
||||
connect(gpi_up_button,SIGNAL(clicked()),this,SLOT(upData()));
|
||||
|
||||
//
|
||||
// Down Button
|
||||
//
|
||||
gpi_down_button=
|
||||
new RDTransportButton(RDTransportButton::Down,this);
|
||||
gpi_down_button->setGeometry(100,sizeHint().height()-60,80,50);
|
||||
connect(gpi_down_button,SIGNAL(clicked()),this,SLOT(downData()));
|
||||
|
||||
//
|
||||
// Color Key
|
||||
//
|
||||
label=new QLabel(tr("Green = ON Cart"),this);
|
||||
label->setGeometry(200,sizeHint().height()-50,300,12);
|
||||
label->setFont(main_font);
|
||||
label->setAlignment(AlignLeft|AlignVCenter);
|
||||
QPalette p=palette();
|
||||
p.setColor(QPalette::Active,QColorGroup::Foreground,darkGreen);
|
||||
p.setColor(QPalette::Inactive,QColorGroup::Foreground,darkGreen);
|
||||
p.setColor(QPalette::Disabled,QColorGroup::Foreground,darkGreen);
|
||||
label->setPalette(p);
|
||||
|
||||
label=new QLabel(tr("Red = OFF Cart"),this);
|
||||
label->setGeometry(200,sizeHint().height()-32,300,12);
|
||||
label->setFont(main_font);
|
||||
label->setAlignment(AlignLeft|AlignVCenter);
|
||||
p.setColor(QPalette::Active,QColorGroup::Foreground,darkRed);
|
||||
p.setColor(QPalette::Inactive,QColorGroup::Foreground,darkRed);
|
||||
p.setColor(QPalette::Disabled,QColorGroup::Foreground,darkRed);
|
||||
label->setPalette(p);
|
||||
|
||||
|
||||
//
|
||||
// Close Button
|
||||
//
|
||||
gpi_close_button=new QPushButton(this);
|
||||
gpi_close_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
|
||||
80,50);
|
||||
gpi_close_button->setFont(main_font);
|
||||
gpi_close_button->setText(tr("&Close"));
|
||||
connect(gpi_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget()));
|
||||
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);
|
||||
connect(gpi_events_report_button,SIGNAL(clicked()),
|
||||
this,SLOT(eventsReportData()));
|
||||
|
||||
//
|
||||
// Start Up Timer
|
||||
@ -315,7 +311,7 @@ MainWidget::~MainWidget()
|
||||
|
||||
QSize MainWidget::sizeHint() const
|
||||
{
|
||||
return QSize(528,78*GPIMON_ROWS+340);
|
||||
return QSize(528,78*GPIMON_ROWS+410);
|
||||
}
|
||||
|
||||
|
||||
@ -389,8 +385,9 @@ void MainWidget::eventsScrollData()
|
||||
gpi_scroll_mode=true;
|
||||
RDListViewItem *item=(RDListViewItem *)gpi_events_list->firstChild();
|
||||
RDListViewItem *last=NULL;
|
||||
while((item=(RDListViewItem *)item->nextSibling())!=NULL) {
|
||||
while(item!=NULL) {
|
||||
last=item;
|
||||
item=(RDListViewItem *)item->nextSibling();
|
||||
}
|
||||
if(last!=NULL) {
|
||||
gpi_events_list->ensureItemVisible(last);
|
||||
@ -399,6 +396,52 @@ void MainWidget::eventsScrollData()
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::eventsReportData()
|
||||
{
|
||||
QString report;
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
report=" Rivendell GPIO Event Report\n";
|
||||
report+=" Date: "+gpi_events_date_edit->date().toString("MM/dd/yyyy")+
|
||||
" Station/Matrix: "+gpi_station->name()+":"+
|
||||
QString().sprintf("%d ",gpi_matrix_box->currentItem())+
|
||||
" State Filter: "+gpi_events_state_box->currentText()+"\n";
|
||||
report+="\n";
|
||||
|
||||
sql=QString("select EVENT_DATETIME,NUMBER,EDGE from GPIO_EVENTS where ")+
|
||||
"(STATION_NAME=\""+RDEscapeString(gpi_station->name())+"\")&&"+
|
||||
QString().sprintf("(MATRIX=%d)&&",gpi_matrix_box->currentItem())+
|
||||
QString().sprintf("(TYPE=%d)&&",gpi_type_box->currentItem())+
|
||||
"(EVENT_DATETIME>=\""+gpi_events_date_edit->date().toString("yyyy-MM-dd")+
|
||||
" 00:00:00\")&&"+
|
||||
"(EVENT_DATETIME<\""+gpi_events_date_edit->date().addDays(1).
|
||||
toString("yyyy-MM-dd")+" 00:00:00\")";
|
||||
if(gpi_events_state_box->currentItem()==0) {
|
||||
sql+="&&(EDGE=1)";
|
||||
}
|
||||
if(gpi_events_state_box->currentItem()==1) {
|
||||
sql+="&&(EDGE=0)";
|
||||
}
|
||||
report+=" -- Time -- - Line - - State -\n";
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
report+=" ";
|
||||
report+=q->value(0).toDateTime().toString("hh:mm:ss")+" ";
|
||||
report+=QString().sprintf(" %5d ",q->value(1).toInt());
|
||||
if(q->value(2).toInt()==0) {
|
||||
report+=tr("OFF");
|
||||
}
|
||||
else {
|
||||
report+=tr("ON ");
|
||||
}
|
||||
report+="\n";
|
||||
}
|
||||
delete q;
|
||||
RDTextFile(report);
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::gpiStateChangedData(int matrix,int line,bool state)
|
||||
{
|
||||
// printf("gpiStateChanged(%d,%d,%d)\n",matrix,line,state);
|
||||
|
@ -68,6 +68,7 @@ class MainWidget : public QWidget
|
||||
void eventsDateChangedData(const QDate &date);
|
||||
void eventsStateChangedData(int n);
|
||||
void eventsScrollData();
|
||||
void eventsReportData();
|
||||
void gpiStateChangedData(int matrix,int line,bool state);
|
||||
void gpoStateChangedData(int matrix,int line,bool state);
|
||||
void gpiMaskChangedData(int matrix,int line,bool state);
|
||||
@ -91,7 +92,6 @@ class MainWidget : public QWidget
|
||||
RDMatrix *gpi_matrix;
|
||||
QComboBox *gpi_type_box;
|
||||
QComboBox *gpi_matrix_box;
|
||||
QPushButton *gpi_close_button;
|
||||
QPixmap *gpi_rivendell_map;
|
||||
GpiLabel *gpi_labels[GPIMON_ROWS*GPIMON_COLS];
|
||||
RDTransportButton *gpi_up_button;
|
||||
@ -107,6 +107,7 @@ class MainWidget : public QWidget
|
||||
QTimer *gpi_events_startup_timer;
|
||||
bool gpi_scroll_mode;
|
||||
QPalette gpi_scroll_color;
|
||||
QPushButton *gpi_events_report_button;
|
||||
};
|
||||
|
||||
|
||||
|
@ -42,10 +42,6 @@
|
||||
<source>Red = OFF Cart</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -82,5 +78,17 @@
|
||||
<source>Events Log</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ON </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OFF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>&Close</source>
|
||||
<translation>S&chließen</translation>
|
||||
<translation type="obsolete">S&chließen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDGpiMon - User:</source>
|
||||
@ -86,5 +86,17 @@
|
||||
<source>Events Log</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ON </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OFF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>&Close</source>
|
||||
<translation>&Cerrar</translation>
|
||||
<translation type="obsolete">&Cerrar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDGpiMon - User:</source>
|
||||
@ -86,5 +86,17 @@
|
||||
<source>Events Log</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ON </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OFF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -22,10 +22,6 @@
|
||||
<source>Matrix:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -82,5 +78,17 @@
|
||||
<source>Events Log</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ON </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OFF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>&Close</source>
|
||||
<translation>&Lukk</translation>
|
||||
<translation type="obsolete">&Lukk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDGpiMon - User:</source>
|
||||
@ -86,5 +86,17 @@
|
||||
<source>Events Log</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ON </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OFF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>&Close</source>
|
||||
<translation>&Lukk</translation>
|
||||
<translation type="obsolete">&Lukk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDGpiMon - User:</source>
|
||||
@ -86,5 +86,17 @@
|
||||
<source>Events Log</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ON </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OFF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -42,10 +42,6 @@
|
||||
<source>Red = OFF Cart</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -82,5 +78,17 @@
|
||||
<source>Events Log</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ON </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OFF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
Loading…
x
Reference in New Issue
Block a user