From bdb42837946dd2d323c7bb14bfbe678a5c0fceae Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Mon, 5 Feb 2018 23:31:54 -0500 Subject: [PATCH] 2018-02-06 Fred Gleason * Refactored the RDAddLog class to use RDApplication. --- ChangeLog | 2 ++ lib/rdadd_log.cpp | 17 ++++++++--------- lib/rdadd_log.h | 11 +++-------- rdairplay/list_logs.cpp | 4 ++-- rdlogedit/edit_log.cpp | 4 ++-- rdlogedit/rdlogedit.cpp | 4 ++-- 6 files changed, 19 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 384a7f9f..ac544f99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16681,3 +16681,5 @@ * Refactored the RDCartDialog class to use RDApplication. 2018-02-06 Fred Gleason * Refactored the RDCutDialog class to use RDApplication. +2018-02-06 Fred Gleason + * Refactored the RDAddLog class to use RDApplication. diff --git a/lib/rdadd_log.cpp b/lib/rdadd_log.cpp index eeab4b74..f10b297f 100644 --- a/lib/rdadd_log.cpp +++ b/lib/rdadd_log.cpp @@ -2,7 +2,7 @@ // // Create a Rivendell Log // -// (C) Copyright 2002-2004,2016-2017 Fred Gleason +// (C) Copyright 2002-2004,2016-2018 Fred Gleason // // 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 @@ -22,14 +22,15 @@ #include +#include "rdapplication.h" #include "rddb.h" #include "rdescape_string.h" #include "rdidvalidator.h" #include "rdadd_log.h" RDAddLog::RDAddLog(QString *logname,QString *svcname, - RDLogFilter::FilterMode mode,RDUser *user,RDStation *station, - const QString &caption,QWidget *parent) + RDLogFilter::FilterMode mode,const QString &caption, + QWidget *parent) : QDialog(parent,"",true) { QStringList services_list; @@ -37,7 +38,6 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname, RDSqlQuery *q; log_name=logname; log_svc=svcname; - log_station=station; // // Fix the Window Size @@ -116,15 +116,14 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname, break; case RDLogFilter::UserFilter: - if(user!=NULL) { - sql=QString("select SERVICE_NAME from USER_SERVICE_PERMS where ")+ - "USER_NAME=\""+RDEscapeString(user->name())+"\" order by SERVICE_NAME"; - } + sql=QString("select SERVICE_NAME from USER_SERVICE_PERMS where ")+ + "USER_NAME=\""+RDEscapeString(rda->user()->name())+"\" "+ + "order by SERVICE_NAME"; break; case RDLogFilter::StationFilter: sql=QString("select SERVICE_NAME from SERVICE_PERMS where ")+ - "STATION_NAME=\""+RDEscapeString(station->name())+"\" "+ + "STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\" "+ "order by SERVICE_NAME"; break; } diff --git a/lib/rdadd_log.h b/lib/rdadd_log.h index e85f9d49..fdca7f13 100644 --- a/lib/rdadd_log.h +++ b/lib/rdadd_log.h @@ -5,7 +5,7 @@ // This class creates a basic dialog requesting from the user a name and // corresponding service that is later used to create a new log. // -// (C) Copyright 2002-2003,2016-2017 Fred Gleason +// (C) Copyright 2002-2003,2016-2018 Fred Gleason // // 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 @@ -29,19 +29,15 @@ #include #include -#include #include #include -#include - class RDAddLog : public QDialog { Q_OBJECT public: RDAddLog(QString *logname,QString *svcname,RDLogFilter::FilterMode mode, - RDUser *user,RDStation *station,const QString &caption, - QWidget *parent=0); + const QString &caption,QWidget *parent=0); ~RDAddLog(); QSize sizeHint() const; QSizePolicy sizePolicy() const; @@ -61,9 +57,8 @@ class RDAddLog : public QDialog QPushButton *add_cancel_button; QString *log_name; QString *log_svc; - RDStation *log_station; }; -#endif +#endif // RDADD_LOG_H diff --git a/rdairplay/list_logs.cpp b/rdairplay/list_logs.cpp index efa87b30..e5f27f23 100644 --- a/rdairplay/list_logs.cpp +++ b/rdairplay/list_logs.cpp @@ -203,8 +203,8 @@ void ListLogs::saveAsButtonData() QString logname; QString svcname=*list_svcname; RDAddLog *log; - log=new RDAddLog(&logname,&svcname,RDLogFilter::StationFilter,rda->user(), - rda->station(),tr("Rename Log"),this); + log=new RDAddLog(&logname,&svcname,RDLogFilter::StationFilter, + tr("Rename Log"),this); if(log->exec()<0) { delete log; return; diff --git a/rdlogedit/edit_log.cpp b/rdlogedit/edit_log.cpp index 7694a6c1..396185af 100644 --- a/rdlogedit/edit_log.cpp +++ b/rdlogedit/edit_log.cpp @@ -1117,8 +1117,8 @@ void EditLog::saveasData() QString err_msg; if(rda->user()->createLog()) { - log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter,rda->user(), - rda->station(),tr("Add Log"),this); + log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter, + tr("Add Log"),this); if(log->exec()<0) { return; } diff --git a/rdlogedit/rdlogedit.cpp b/rdlogedit/rdlogedit.cpp index 2079243e..c98d3cf2 100644 --- a/rdlogedit/rdlogedit.cpp +++ b/rdlogedit/rdlogedit.cpp @@ -363,8 +363,8 @@ void MainWidget::addData() RDAddLog *log; if(rda->user()->createLog()) { - log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter,rda->user(), - rda->station(),tr("Add Log"),this); + log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter, + tr("Add Log"),this); if(log->exec()!=0) { delete log; return;