2018-02-06 Fred Gleason <fredg@paravelsystems.com>

* Refactored the RDCutDialog class to use RDApplication.
This commit is contained in:
Fred Gleason 2018-02-05 23:10:18 -05:00
parent e9926053c8
commit fc004e073e
10 changed files with 40 additions and 52 deletions

View File

@ -16679,3 +16679,5 @@
* Converted rdadmin(1) to use RDApplication.
2018-02-06 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDCartDialog class to use RDApplication.
2018-02-06 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDCutDialog class to use RDApplication.

View File

@ -2,7 +2,7 @@
//
// A widget to select a Rivendell Cut.
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -27,13 +27,15 @@
#include <qapplication.h>
#include <qeventloop.h>
#include <rdcut_dialog.h>
#include <rdcart_search_text.h>
#include <rdtextvalidator.h>
#include <rdadd_cart.h>
#include <rdprofile.h>
#include <rddb.h>
#include <rdconf.h>
#include "rdadd_cart.h"
#include "rdapplication.h"
#include "rdcart_search_text.h"
#include "rdconf.h"
#include "rdcut_dialog.h"
#include "rddb.h"
#include "rdescape_string.h"
#include "rdprofile.h"
#include "rdtextvalidator.h"
//
// Icons
@ -42,9 +44,8 @@
#include "../icons/rml5.xpm"
RDCutDialog::RDCutDialog(QString *cutname,RDStation *station,RDSystem *system,
QString *filter,QString *group,QString *schedcode,
QString username,bool show_clear,bool allow_add,
RDCutDialog::RDCutDialog(QString *cutname,QString *filter,QString *group,
QString *schedcode,bool show_clear,bool allow_add,
bool exclude_tracks,QWidget *parent)
: QDialog(parent,"",true)
{
@ -52,10 +53,7 @@ RDCutDialog::RDCutDialog(QString *cutname,RDStation *station,RDSystem *system,
cut_exclude_tracks=exclude_tracks;
cut_group=group;
cut_schedcode=schedcode;
cut_username=username;
cut_allow_clear=show_clear;
cut_filter_mode=station->filterMode();
cut_system=system;
if(filter==NULL) {
cut_filter=new QString();
@ -269,7 +267,7 @@ RDCutDialog::RDCutDialog(QString *cutname,RDStation *station,RDSystem *system,
if(cut_cutname->isEmpty()) {
cut_ok_button->setDisabled(true);
}
switch(cut_filter_mode) {
switch(rda->station()->filterMode()) {
case RDStation::FilterAsynchronous:
cut_search_button->setDefault(true);
cut_filter_edit->setGeometry(100,10,sizeHint().width()-250,20);
@ -318,7 +316,7 @@ int RDCutDialog::exec()
void RDCutDialog::filterChangedData(const QString &str)
{
cut_search_button->setEnabled(true);
switch(cut_filter_mode) {
switch(rda->station()->filterMode()) {
case RDStation::FilterSynchronous:
searchButtonData();
break;
@ -396,7 +394,7 @@ void RDCutDialog::addButtonData()
int cart_num=-1;
RDAddCart *add_cart=new RDAddCart(&cart_group,&cart_type,&cart_title,
cut_username,cut_system,this);
rda->user()->name(),rda->system(),this);
if((cart_num=add_cart->exec())<0) {
delete add_cart;
return;
@ -582,13 +580,13 @@ void RDCutDialog::BuildGroupList()
cut_group_box->clear();
cut_group_box->insertItem(tr("ALL"));
if(cut_username.isEmpty()) {
if(rda->user()->name().isEmpty()) {
sql="select NAME from GROUPS order by NAME desc";
}
else {
sql=QString().sprintf("select GROUP_NAME from USER_PERMS\
where USER_NAME=\"%s\" order by GROUP_NAME desc",
(const char *)cut_username);
sql=QString("select GROUP_NAME from USER_PERMS where ")+
"USER_NAME=\""+RDEscapeString(rda->user()->name())+"\" "+
"order by GROUP_NAME desc";
}
q=new RDSqlQuery(sql);
while(q->next()) {

View File

@ -2,7 +2,7 @@
//
// A widget to select a Rivendell Cut.
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -30,8 +30,6 @@
#include <qcheckbox.h>
#include <rdlistviewitem.h>
#include <rdstation.h>
#include <rdsystem.h>
#define RDCUT_DIALOG_STEP_SIZE 1000
@ -39,10 +37,9 @@ class RDCutDialog : public QDialog
{
Q_OBJECT
public:
RDCutDialog(QString *cutname,RDStation *station,RDSystem *system,
QString *filter=0,QString *group=0,QString *schedcode=NULL,
QString username="",bool show_clear=false,bool allow_add=false,
bool exclude_tracks=false,QWidget *parent=0);
RDCutDialog(QString *cutname,QString *filter=0,QString *group=0,
QString *schedcode=NULL,bool show_clear=false,
bool allow_add=false,bool exclude_tracks=false,QWidget *parent=0);
~RDCutDialog();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
@ -92,11 +89,8 @@ class RDCutDialog : public QDialog
bool local_filter;
QPixmap *cut_playout_map;
QPixmap *cut_macro_map;
QString cut_username;
bool cut_allow_clear;
bool cut_exclude_tracks;
RDStation::FilterMode cut_filter_mode;
RDSystem *cut_system;
QProgressDialog *cut_progress_dialog;
};

View File

@ -247,9 +247,8 @@ QSizePolicy ListCasts::sizePolicy() const
void ListCasts::addCartData()
{
QString cutname;
RDCutDialog *cd=new RDCutDialog(&cutname,rda->station(),rda->system(),
&cast_filter,&cast_group,&cast_schedcode,
rda->ripc()->user());
RDCutDialog *cd=
new RDCutDialog(&cutname,&cast_filter,&cast_group,&cast_schedcode);
if(cd->exec()!=0) {
delete cd;
return;

View File

@ -476,9 +476,8 @@ void EditDownload::selectCartData()
{
QString str;
RDCutDialog *cut=new RDCutDialog(&edit_cutname,rda->station(),rda->system(),
edit_filter,NULL,NULL,rda->user()->name(),
false,true);
RDCutDialog *cut=
new RDCutDialog(&edit_cutname,edit_filter,NULL,NULL,false,true);
switch(cut->exec()) {
case 0:
edit_description_edit->setText(RDCutPath(edit_cutname));

View File

@ -319,9 +319,8 @@ void EditPlayout::activateStationData(int id,bool use_temp)
void EditPlayout::selectCutData()
{
RDCutDialog *cut=new RDCutDialog(&edit_cutname,rda->station(),rda->system(),
edit_filter,NULL,NULL,"",false,false,false,
this);
RDCutDialog *cut=
new RDCutDialog(&edit_cutname,edit_filter,NULL,NULL,false,false,false,this);
switch(cut->exec()) {
case 0:
edit_destination_edit->setText(edit_cutname);

View File

@ -707,9 +707,8 @@ void EditRecording::selectCutData()
{
QString str;
RDCutDialog *cut=new RDCutDialog(&edit_cutname,rda->station(),rda->system(),
edit_filter,NULL,NULL,rda->user()->name(),
false,true);
RDCutDialog *cut=
new RDCutDialog(&edit_cutname,edit_filter,NULL,NULL,false,true);
switch(cut->exec()) {
case 0:
edit_description_edit->setText(RDCutPath(edit_cutname));

View File

@ -491,8 +491,7 @@ void EditUpload::selectCartData()
{
QString str;
RDCutDialog *cut=new RDCutDialog(&edit_cutname,rda->station(),rda->system(),
edit_filter);
RDCutDialog *cut=new RDCutDialog(&edit_cutname,edit_filter);
switch(cut->exec()) {
case 0:
edit_description_edit->setText(RDCutPath(edit_cutname));

View File

@ -536,10 +536,9 @@ void DiskRipper::setCutButtonData()
return;
}
QString cutname=rip_cutnames[item->text(0).toUInt()-1];
RDCutDialog *dialog=new RDCutDialog(&cutname,rda->station(),rda->system(),
rip_filter_text,
rip_group_text,rip_schedcode_text,
rda->user()->name(),true,true,true,this);
RDCutDialog *dialog=
new RDCutDialog(&cutname,rip_filter_text,rip_group_text,rip_schedcode_text,
true,true,true,this);
if(dialog->exec()==0) {
if(cutname.isEmpty()) {
rip_cutnames[item->text(0).toUInt()-1]="";

View File

@ -2,7 +2,7 @@
//
// Render Log Dialog for Rivendell.
//
// (C) Copyright 2017 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2017-2018 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
@ -235,8 +235,8 @@ void RenderDialog::selectData()
}
else {
QString cutname;
RDCutDialog *d=new RDCutDialog(&cutname,render_station,render_system,
NULL,NULL,NULL,"",false,true,true,this);
RDCutDialog *d=
new RDCutDialog(&cutname,NULL,NULL,NULL,false,true,true,this);
if(d->exec()==0) {
render_to_cartnum=RDCut::cartNumber(cutname);
render_to_cutnum=RDCut::cutNumber(cutname);