2020-12-27 Fred Gleason <fredg@paravelsystems.com>

* Refactored 'RDListLogs' dialog to use 'RDLogListModel'.
	* Added a 'caption' argument to the constructor of the
	'RDListLogs' dialog.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-12-27 11:37:30 -05:00
parent eb231539f6
commit bb5da3950f
13 changed files with 51 additions and 166 deletions

View File

@ -20747,3 +20747,7 @@
* Removed dependency on 'Q3PointArray' from rdlogedit(1).
2020-12-26 Fred Gleason <fredg@paravelsystems.com>
* Removed dependency on 'Q3PointArray' from 'RDWavePainter'.
2020-12-27 Fred Gleason <fredg@paravelsystems.com>
* Refactored 'RDListLogs' dialog to use 'RDLogListModel'.
* Added a 'caption' argument to the constructor of the
'RDListLogs' dialog.

View File

@ -2529,18 +2529,6 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
<source>Cancel</source>
<translation>Zrušit</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -2524,18 +2524,6 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
<source>ALL</source>
<translation type="obsolete">ALLE</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -2518,18 +2518,6 @@ Do you still want to proceed?</source>
<source>Cancel</source>
<translation>Cancelar</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -2120,18 +2120,6 @@ Do you want to overwrite it?</source>
<source>Select Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -2491,18 +2491,6 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
<source>ALL</source>
<translation type="obsolete">ALLE</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -2491,18 +2491,6 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
<source>ALL</source>
<translation type="obsolete">ALLE</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -2528,18 +2528,6 @@ Por Favor, cheque suas configurações e tenbte outra vez.</translation>
<source>ALL</source>
<translation type="obsolete">TODOS</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDListSelector</name>

View File

@ -2,7 +2,7 @@
//
// Select a Rivendell Log
//
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2020 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
@ -24,7 +24,7 @@
#include "rdlist_logs.h"
RDListLogs::RDListLogs(QString *logname,RDLogFilter::FilterMode mode,
QWidget *parent)
const QString &caption,QWidget *parent)
: RDDialog(parent)
{
list_logname=logname;
@ -34,32 +34,32 @@ RDListLogs::RDListLogs(QString *logname,RDLogFilter::FilterMode mode,
//
setMinimumSize(sizeHint());
setWindowTitle(tr("Select Log"));
setWindowTitle(caption+" - "+tr("Select Log"));
//
// Log Filter
//
list_filter_widget=new RDLogFilter(mode,this);
connect(list_filter_widget,SIGNAL(filterChanged(const QString &)),
this,SLOT(filterChangedData(const QString &)));
//
// Log List
//
list_log_list=new Q3ListView(this);
list_log_list->setAllColumnsShowFocus(true);
list_log_list->setItemMargin(5);
list_log_list->setSelectionMode(Q3ListView::Single);
connect(list_log_list,
SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
this,
SLOT(doubleClickedData(Q3ListViewItem *,const QPoint &,int)));
list_log_list->addColumn(tr("Name"));
list_log_list->setColumnAlignment(0,Qt::AlignLeft);
list_log_list->addColumn(tr("Description"));
list_log_list->setColumnAlignment(1,Qt::AlignLeft);
list_log_list->addColumn(tr("Service"));
list_log_list->setColumnAlignment(2,Qt::AlignLeft);
list_log_view=new QTableView(this);
list_log_view->setSelectionBehavior(QAbstractItemView::SelectRows);
list_log_view->setSelectionMode(QAbstractItemView::SingleSelection);
list_log_view->setShowGrid(false);
list_log_view->setSortingEnabled(false);
list_log_view->setWordWrap(false);
list_log_model=new RDLogListModel(this);
list_log_model->setFont(defaultFont());
list_log_model->setPalette(palette());
list_log_view->setModel(list_log_model);
list_log_view->resizeColumnsToContents();
connect(list_filter_widget,SIGNAL(filterChanged(const QString &)),
list_log_model,SLOT(setFilterSql(const QString &)));
connect(list_log_view,SIGNAL(doubleClicked(const QModelIndex &)),
this,SLOT(doubleClickedData(const QModelIndex &)));
connect(list_log_model,SIGNAL(modelReset()),this,SLOT(modelResetData()));
//
// OK Button
@ -78,13 +78,13 @@ RDListLogs::RDListLogs(QString *logname,RDLogFilter::FilterMode mode,
list_cancel_button->setDefault(true);
connect(list_cancel_button,SIGNAL(clicked()),this,SLOT(cancelButtonData()));
RefreshList();
list_log_model->setFilterSql(list_filter_widget->whereSql());
}
QSize RDListLogs::sizeHint() const
{
return QSize(500,300);
return QSize(600,400);
}
@ -96,29 +96,29 @@ QSizePolicy RDListLogs::sizePolicy() const
void RDListLogs::closeEvent(QCloseEvent *e)
{
done(1);
cancelButtonData();
}
void RDListLogs::filterChangedData(const QString &where_sql)
{
RefreshList();
}
void RDListLogs::doubleClickedData(Q3ListViewItem *,const QPoint &,int)
void RDListLogs::doubleClickedData(const QModelIndex &index)
{
okButtonData();
}
void RDListLogs::modelResetData()
{
list_log_view->resizeColumnsToContents();
}
void RDListLogs::okButtonData()
{
Q3ListViewItem *item=list_log_list->selectedItem();
if(item==NULL) {
if(list_log_view->selectionModel()->selectedRows().size()!=1) {
return;
}
*list_logname=item->text(0);
*list_logname=list_log_model->logName(list_log_view->selectionModel()->selectedRows().at(0).row());
done(true);
}
@ -134,7 +134,7 @@ void RDListLogs::resizeEvent(QResizeEvent *e)
list_filter_widget->
setGeometry(10,10,size().width()-10,
list_filter_widget->sizeHint().height());
list_log_list->
list_log_view->
setGeometry(10,list_filter_widget->sizeHint().height(),
size().width()-20,
size().height()-list_filter_widget->sizeHint().height()-70);
@ -143,40 +143,3 @@ void RDListLogs::resizeEvent(QResizeEvent *e)
list_cancel_button->
setGeometry(size().width()-90,size().height()-60,80,50);
}
void RDListLogs::RefreshList()
{
RDSqlQuery *q;
QString sql;
Q3ListViewItem *l;
Q3ListViewItem *view_item=NULL;
QDate current_date=QDate::currentDate();
list_log_list->clear();
sql=QString("select NAME,DESCRIPTION,SERVICE from LOGS ")+
"where (TYPE=0)&&(LOG_EXISTS=\"Y\")&&"+
"((START_DATE<=\""+current_date.toString("yyyy-MM-dd")+"\")||"+
"(START_DATE=\"0000-00-00\")||"+
"(START_DATE is null))&&"+
"((END_DATE>=\""+current_date.toString("yyyy-MM-dd")+"\")||"+
"(END_DATE=\"0000-00-00\")||"+
"(END_DATE is null))"+
list_filter_widget->whereSql();
q=new RDSqlQuery(sql);
while(q->next()) {
l=new Q3ListViewItem(list_log_list);
l->setText(0,q->value(0).toString());
l->setText(1,q->value(1).toString());
l->setText(2,q->value(2).toString());
if(l->text(0)==*list_logname) {
view_item=l;
}
}
delete q;
if(view_item!=NULL) {
list_log_list->setCurrentItem(view_item);
list_log_list->ensureItemVisible(view_item);
}
}

View File

@ -2,7 +2,7 @@
//
// Select a Rivendell Log
//
// (C) Copyright 2007-2019 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2007-2020 Fred Gleason <fredg@paravelsystems.com>
//
// The RDListLogs class creates a basic dialog that displays a list of logs
// (log name, description, and service) and allows the user to select one. If
@ -26,25 +26,26 @@
#ifndef RDLIST_LOGS_H
#define RDLIST_LOGS_H
#include <q3listview.h>
#include <qpushbutton.h>
#include <QPushButton>
#include <QTableView>
#include <rddialog.h>
#include <rdlogfilter.h>
#include <rdloglistmodel.h>
class RDListLogs : public RDDialog
{
Q_OBJECT
public:
RDListLogs(QString *logname,RDLogFilter::FilterMode mode,QWidget *parent=0);
RDListLogs(QString *logname,RDLogFilter::FilterMode mode,
const QString &caption,QWidget *parent=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
private slots:
void filterChangedData(const QString &where_sql);
void doubleClickedData(Q3ListViewItem *,const QPoint &,int);
void doubleClickedData(const QModelIndex &index);
void closeEvent(QCloseEvent *);
void modelResetData();
void okButtonData();
void cancelButtonData();
@ -52,8 +53,8 @@ class RDListLogs : public RDDialog
void resizeEvent(QResizeEvent *e);
private:
void RefreshList();
Q3ListView *list_log_list;
QTableView *list_log_view;
RDLogListModel *list_log_model;
QString *list_logname;
QPushButton *list_ok_button;
QPushButton *list_cancel_button;

View File

@ -1167,7 +1167,7 @@ void EditRDAirPlay::selectData()
{
QString logname=air_startlog_edit->text();
RDListLogs *ll=new RDListLogs(&logname,RDLogFilter::NoFilter,this);
RDListLogs *ll=new RDListLogs(&logname,RDLogFilter::NoFilter,"RDAdmin",this);
if(ll->exec()) {
air_startlog_edit->setText(logname);
}

View File

@ -306,7 +306,8 @@ void ListCasts::addLogData()
RDFeed::Error err=RDFeed::ErrorOk;
unsigned cast_id=0;
RDListLogs *d=new RDListLogs(&logname,RDLogFilter::UserFilter,this);
RDListLogs *d=
new RDListLogs(&logname,RDLogFilter::UserFilter,"RDCastManager",this);
if(d->exec()) {
RDLogModel *model=new RDLogModel(logname,true,this);
model->load();

View File

@ -92,7 +92,7 @@ void EditChain::selectLogData()
QString logname;
RDListLogs *d=
new RDListLogs(&logname,RDLogFilter::UserFilter,this);
new RDListLogs(&logname,RDLogFilter::UserFilter,"RDLogEdit",this);
if(!d->exec()) {
delete d;
return;