2017-11-08 Fred Gleason <fredg@paravelsystems.com>

* Added a filter widget to the 'RDListLog' dialog.
This commit is contained in:
Fred Gleason 2017-11-08 08:53:40 -05:00
parent 39536e6514
commit 8d690a6296
12 changed files with 119 additions and 52 deletions

View File

@ -16329,3 +16329,5 @@
* Added an 'RDLogFilter' widget.
2017-11-07 Fred Gleason <fredg@paravelsystems.com>
* Removed vestigal remnants of Host Security mode.
2017-11-08 Fred Gleason <fredg@paravelsystems.com>
* Added a filter widget to the 'RDListLog' dialog.

View File

@ -1889,7 +1889,7 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
</message>
<message>
<source>Select Log</source>
<translation>Vybrat zápis</translation>
<translation type="unfinished">Vybrat zápis</translation>
</message>
<message>
<source>NAME</source>
@ -1911,6 +1911,10 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
<source>Cancel</source>
<translation>Zrušit</translation>
</message>
<message>
<source>ALL</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -1880,7 +1880,7 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
</message>
<message>
<source>Select Log</source>
<translation>Log auswählen</translation>
<translation type="unfinished">Log auswählen</translation>
</message>
<message>
<source>NAME</source>
@ -1902,6 +1902,10 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
<message>
<source>ALL</source>
<translation type="unfinished">ALLE</translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -1886,7 +1886,7 @@ Do you still want to proceed?</source>
</message>
<message>
<source>Select Log</source>
<translation>Seleccionar Playlist</translation>
<translation type="unfinished">Seleccionar Playlist</translation>
</message>
<message>
<source>NAME</source>
@ -1908,6 +1908,10 @@ Do you still want to proceed?</source>
<source>Cancel</source>
<translation>Cancelar</translation>
</message>
<message>
<source>ALL</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -1703,10 +1703,6 @@ Do you want to overwrite it?</source>
</context>
<context>
<name>RDListLogs</name>
<message>
<source>Select Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NAME</source>
<translation type="unfinished"></translation>
@ -1727,6 +1723,14 @@ Do you want to overwrite it?</source>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALL</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -1876,10 +1876,6 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
</context>
<context>
<name>RDListLogs</name>
<message>
<source>Select Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NAME</source>
<translation type="unfinished"></translation>
@ -1900,6 +1896,14 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALL</source>
<translation type="unfinished">ALLE</translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -1876,10 +1876,6 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
</context>
<context>
<name>RDListLogs</name>
<message>
<source>Select Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NAME</source>
<translation type="unfinished"></translation>
@ -1900,6 +1896,14 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALL</source>
<translation type="unfinished">ALLE</translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -1884,7 +1884,7 @@ Por Favor, cheque suas configurações e tenbte outra vez.</translation>
</message>
<message>
<source>Select Log</source>
<translation>Selecione Lista</translation>
<translation type="unfinished">Selecione Lista</translation>
</message>
<message>
<source>NAME</source>
@ -1906,6 +1906,10 @@ Por Favor, cheque suas configurações e tenbte outra vez.</translation>
<source>Cancel</source>
<translation>Cancelar</translation>
</message>
<message>
<source>ALL</source>
<translation type="unfinished">TODOS</translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -47,12 +47,28 @@ RDListLogs::RDListLogs(QString *logname,const QString &stationname,
setCaption(tr("Select Log"));
//
// Log Filter
//
list_filter_widget=new RDLogFilter(this);
QString sql=QString("select ")+
"SERVICE_NAME from SERVICE_PERMS where "+
"STATION_NAME=\""+RDEscapeString(list_stationname)+"\"";
RDSqlQuery *q=new RDSqlQuery(sql);
QStringList services_list;
services_list.push_back(tr("ALL"));
while(q->next()) {
services_list.push_back(q->value(0).toString());
}
delete q;
list_filter_widget->setServices(services_list);
connect(list_filter_widget,SIGNAL(filterChanged(const QString &)),
this,SLOT(filterChangedData(const QString &)));
//
// Log List
//
list_log_list=new QListView(this,"list_log_list");
list_log_list->setGeometry(10,10,
sizeHint().width()-20,sizeHint().height()-80);
list_log_list=new QListView(this);
list_log_list->setAllColumnsShowFocus(true);
list_log_list->setItemMargin(5);
list_log_list->setSelectionMode(QListView::Single);
@ -70,21 +86,19 @@ RDListLogs::RDListLogs(QString *logname,const QString &stationname,
//
// OK Button
//
QPushButton *button=new QPushButton(this,"load_button");
button->setGeometry(sizeHint().width()-190,sizeHint().height()-60,80,50);
button->setFont(button_font);
button->setText(tr("OK"));
connect(button,SIGNAL(clicked()),this,SLOT(okButtonData()));
list_ok_button=new QPushButton(this);
list_ok_button->setFont(button_font);
list_ok_button->setText(tr("OK"));
connect(list_ok_button,SIGNAL(clicked()),this,SLOT(okButtonData()));
//
// Cancel Button
//
button=new QPushButton(this,"cancel_button");
button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
button->setFont(button_font);
button->setText(tr("Cancel"));
button->setDefault(true);
connect(button,SIGNAL(clicked()),this,SLOT(cancelButtonData()));
list_cancel_button=new QPushButton(this);
list_cancel_button->setFont(button_font);
list_cancel_button->setText(tr("Cancel"));
list_cancel_button->setDefault(true);
connect(list_cancel_button,SIGNAL(clicked()),this,SLOT(cancelButtonData()));
RefreshList();
}
@ -108,6 +122,12 @@ void RDListLogs::closeEvent(QCloseEvent *e)
}
void RDListLogs::filterChangedData(const QString &where_sql)
{
RefreshList();
}
void RDListLogs::doubleClickedData(QListViewItem *,const QPoint &,int)
{
okButtonData();
@ -131,6 +151,22 @@ void RDListLogs::cancelButtonData()
}
void RDListLogs::resizeEvent(QResizeEvent *e)
{
list_filter_widget->
setGeometry(10,10,size().width()-10,
list_filter_widget->sizeHint().height());
list_log_list->
setGeometry(10,list_filter_widget->sizeHint().height(),
size().width()-20,
size().height()-list_filter_widget->sizeHint().height()-70);
list_ok_button->
setGeometry(size().width()-190,size().height()-60,80,50);
list_cancel_button->
setGeometry(size().width()-90,size().height()-60,80,50);
}
void RDListLogs::RefreshList()
{
RDSqlQuery *q;
@ -138,22 +174,8 @@ void RDListLogs::RefreshList()
QListViewItem *l;
QListViewItem *view_item=NULL;
QDate current_date=QDate::currentDate();
QStringList services_list;
list_log_list->clear();
sql=QString("select ")+
"SERVICE_NAME from SERVICE_PERMS where "+
"STATION_NAME=\""+RDEscapeString(list_stationname)+"\"";
q=new RDSqlQuery(sql);
while(q->next()) {
services_list.append( q->value(0).toString() );
}
delete q;
if(services_list.size()==0) {
return;
}
sql=QString("select NAME,DESCRIPTION,SERVICE from LOGS ")+
"where (TYPE=0)&&(LOG_EXISTS=\"Y\")&&"+
"((START_DATE<=\""+current_date.toString("yyyy-MM-dd")+"\")||"+
@ -161,14 +183,9 @@ void RDListLogs::RefreshList()
"(START_DATE is null))&&"+
"((END_DATE>=\""+current_date.toString("yyyy-MM-dd")+"\")||"+
"(END_DATE=\"0000-00-00\")||"+
"(END_DATE is null))&&(";
for ( QStringList::Iterator it = services_list.begin();
it != services_list.end(); ++it ) {
sql+=QString().sprintf("SERVICE=\"%s\"||",
(const char *)*it);
}
sql=sql.left(sql.length()-2);
sql+=")";
"(END_DATE is null))"+
list_filter_widget->whereSql();
q=new RDSqlQuery(sql);
while(q->next()) {
l=new QListViewItem(list_log_list);

View File

@ -31,6 +31,8 @@
#include <qlistview.h>
#include <qpushbutton.h>
#include <rdlogfilter.h>
class RDListLogs : public QDialog
{
Q_OBJECT
@ -41,16 +43,23 @@ class RDListLogs : public QDialog
QSizePolicy sizePolicy() const;
private slots:
void filterChangedData(const QString &where_sql);
void doubleClickedData(QListViewItem *,const QPoint &,int);
void closeEvent(QCloseEvent *);
void okButtonData();
void cancelButtonData();
protected:
void resizeEvent(QResizeEvent *e);
private:
void RefreshList();
QListView *list_log_list;
QString *list_logname;
QString list_stationname;
QPushButton *list_ok_button;
QPushButton *list_cancel_button;
RDLogFilter *list_filter_widget;
};

View File

@ -116,6 +116,15 @@ RDLogFilter::RDLogFilter(QWidget *parent)
}
void RDLogFilter::setServices(const QStringList &svc_names)
{
filter_service_box->clear();
for(unsigned i=0;i<svc_names.size();i++) {
filter_service_box->insertItem(svc_names[i]);
}
}
void RDLogFilter::filterChangedData(const QString &str)
{
emit filterChanged(whereSql());

View File

@ -26,6 +26,7 @@
#include <qlineedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qstringlist.h>
#include <qwidget.h>
class RDLogFilter : public QWidget
@ -37,6 +38,7 @@ class RDLogFilter : public QWidget
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
QString whereSql() const;
void setServices(const QStringList &svc_names);
signals:
void filterChanged(const QString &where_sql);