mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-29 16:50:13 +01:00
2021-07-20 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'Edit Switcher Event' dialog in rdcatch(1) to improve modularity. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -22079,3 +22079,6 @@
|
|||||||
2021-07-20 Fred Gleason <fredg@paravelsystems.com>
|
2021-07-20 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed a regression in rdadmin(1) that caused the username and
|
* Fixed a regression in rdadmin(1) that caused the username and
|
||||||
description fields to be blank on the main window.
|
description fields to be blank on the main window.
|
||||||
|
2021-07-20 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Refactored the 'Edit Switcher Event' dialog in rdcatch(1) to improve
|
||||||
|
modularity.
|
||||||
|
|||||||
@@ -30,9 +30,6 @@
|
|||||||
EditSwitchEvent::EditSwitchEvent(int id,std::vector<int> *adds,QWidget *parent)
|
EditSwitchEvent::EditSwitchEvent(int id,std::vector<int> *adds,QWidget *parent)
|
||||||
: RDDialog(parent)
|
: RDDialog(parent)
|
||||||
{
|
{
|
||||||
QString sql;
|
|
||||||
RDSqlQuery *q=NULL;
|
|
||||||
QString temp;
|
|
||||||
edit_matrix=NULL;
|
edit_matrix=NULL;
|
||||||
edit_added_events=adds;
|
edit_added_events=adds;
|
||||||
|
|
||||||
@@ -57,63 +54,28 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector<int> *adds,QWidget *parent)
|
|||||||
edit_recording=new RDRecording(id);
|
edit_recording=new RDRecording(id);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Active Button
|
// Event Widget
|
||||||
//
|
//
|
||||||
edit_active_button=new QCheckBox(this);
|
edit_event_widget=new EventWidget(EventWidget::OtherEvent,this);
|
||||||
edit_active_button->setGeometry(10,11,20,20);
|
connect(edit_event_widget,SIGNAL(locationChanged(const QString &)),
|
||||||
QLabel *label=new QLabel(tr("Event Active"),this);
|
|
||||||
label->setGeometry(30,11,125,20);
|
|
||||||
label->setFont(labelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Station
|
|
||||||
//
|
|
||||||
edit_station_box=new RDComboBox(this);
|
|
||||||
//
|
|
||||||
// FIXME: Make this work with a model
|
|
||||||
//
|
|
||||||
// edit_station_model=new RDStationListModel(false,"",this);
|
|
||||||
// edit_station_box->setModel(edit_station_model);
|
|
||||||
edit_station_box->setGeometry(200,10,140,23);
|
|
||||||
label=new QLabel(tr("Location:"),this);
|
|
||||||
label->setGeometry(125,10,70,23);
|
|
||||||
label->setFont(labelFont());
|
|
||||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
|
||||||
connect(edit_station_box,SIGNAL(activated(const QString &)),
|
|
||||||
this,SLOT(activateStationData(const QString &)));
|
this,SLOT(activateStationData(const QString &)));
|
||||||
|
|
||||||
//
|
|
||||||
// Start Time
|
|
||||||
//
|
|
||||||
edit_starttime_edit=new QTimeEdit(this);
|
|
||||||
edit_starttime_edit->setGeometry(sizeHint().width()-90,12,80,20);
|
|
||||||
edit_starttime_edit->setDisplayFormat("hh:mm:ss");
|
|
||||||
label=new QLabel(tr("Start Time:"),this);
|
|
||||||
label->setGeometry(sizeHint().width()-175,12,80,20);
|
|
||||||
label->setFont(labelFont());
|
|
||||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Description
|
// Description
|
||||||
//
|
//
|
||||||
edit_description_edit=new QLineEdit(this);
|
edit_description_edit=new QLineEdit(this);
|
||||||
edit_description_edit->setGeometry(120,43,sizeHint().width()-130,20);
|
|
||||||
edit_description_edit->setValidator(validator);
|
edit_description_edit->setValidator(validator);
|
||||||
label=new QLabel(tr("Description:"),this);
|
edit_description_label=new QLabel(tr("Description:"),this);
|
||||||
label->setGeometry(10,43,105,20);
|
edit_description_label->setFont(labelFont());
|
||||||
label->setFont(labelFont());
|
edit_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Switch Matrix
|
// Switch Matrix
|
||||||
//
|
//
|
||||||
edit_matrix_box=new RDComboBox(this);
|
edit_matrix_box=new RDComboBox(this);
|
||||||
edit_matrix_box->setGeometry(120,70,sizeHint().width()-130,20);
|
edit_matrix_label=new QLabel(tr("Switch Matrix:"),this);
|
||||||
label=new QLabel(tr("Switch Matrix:"),this);
|
edit_matrix_label->setFont(labelFont());
|
||||||
label->setGeometry(10,70,105,20);
|
edit_matrix_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
label->setFont(labelFont());
|
|
||||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
|
||||||
connect(edit_matrix_box,SIGNAL(activated(const QString &)),
|
connect(edit_matrix_box,SIGNAL(activated(const QString &)),
|
||||||
this,SLOT(activateMatrixData(const QString &)));
|
this,SLOT(activateMatrixData(const QString &)));
|
||||||
|
|
||||||
@@ -121,13 +83,10 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector<int> *adds,QWidget *parent)
|
|||||||
// Switch Input
|
// Switch Input
|
||||||
//
|
//
|
||||||
edit_input_box=new RDComboBox(this);
|
edit_input_box=new RDComboBox(this);
|
||||||
edit_input_box->setGeometry(120,100,sizeHint().width()-130,20);
|
edit_input_label=new QLabel(tr("Switch Input:"),this);
|
||||||
label=new QLabel(tr("Switch Input:"),this);
|
edit_input_label->setFont(labelFont());
|
||||||
label->setGeometry(10,100,105,20);
|
edit_input_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
label->setFont(labelFont());
|
|
||||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
|
||||||
edit_input_spin=new QSpinBox(this);
|
edit_input_spin=new QSpinBox(this);
|
||||||
edit_input_spin->setGeometry(140,125,50,20);
|
|
||||||
connect(edit_input_box,SIGNAL(activated(const QString &)),
|
connect(edit_input_box,SIGNAL(activated(const QString &)),
|
||||||
this,SLOT(activateInputData(const QString &)));
|
this,SLOT(activateInputData(const QString &)));
|
||||||
|
|
||||||
@@ -135,158 +94,62 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector<int> *adds,QWidget *parent)
|
|||||||
// Switch Output
|
// Switch Output
|
||||||
//
|
//
|
||||||
edit_output_box=new RDComboBox(this);
|
edit_output_box=new RDComboBox(this);
|
||||||
edit_output_box->setGeometry(120,155,sizeHint().width()-130,20);
|
edit_output_label=new QLabel(tr("Switch Output:"),this);
|
||||||
label=new QLabel(tr("Switch Output:"),this);
|
edit_output_label->setFont(labelFont());
|
||||||
label->setGeometry(10,155,105,20);
|
edit_output_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
label->setFont(labelFont());
|
|
||||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
|
||||||
edit_output_spin=new QSpinBox(this);
|
edit_output_spin=new QSpinBox(this);
|
||||||
edit_output_spin->setGeometry(140,180,50,20);
|
|
||||||
connect(edit_output_box,SIGNAL(activated(const QString &)),
|
connect(edit_output_box,SIGNAL(activated(const QString &)),
|
||||||
this,SLOT(activateOutputData(const QString &)));
|
this,SLOT(activateOutputData(const QString &)));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Button Label
|
// DOW Selector
|
||||||
//
|
//
|
||||||
QGroupBox *groupbox=new QGroupBox(tr("Active Days"),this);
|
edit_dow_selector=new DowSelector(this);
|
||||||
groupbox->setFont(labelFont());
|
|
||||||
groupbox->setGeometry(10,213,sizeHint().width()-20,62);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Monday Button
|
|
||||||
//
|
|
||||||
edit_mon_button=new QCheckBox(this);
|
|
||||||
edit_mon_button->setGeometry(20,228,20,20);
|
|
||||||
label=new QLabel(tr("Monday"),this);
|
|
||||||
label->setGeometry(40,228,115,20);
|
|
||||||
label->setFont(subLabelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Tuesday Button
|
|
||||||
//
|
|
||||||
edit_tue_button=new QCheckBox(this);
|
|
||||||
edit_tue_button->setGeometry(115,228,20,20);
|
|
||||||
label=new QLabel(tr("Tuesday"),this);
|
|
||||||
label->setGeometry(135,228,115,20);
|
|
||||||
label->setFont(subLabelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Wednesday Button
|
|
||||||
//
|
|
||||||
edit_wed_button=new QCheckBox(this);
|
|
||||||
edit_wed_button->setGeometry(215,228,20,20);
|
|
||||||
label=new QLabel(tr("Wednesday"),this);
|
|
||||||
label->setGeometry(235,228,115,20);
|
|
||||||
label->setFont(subLabelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Thursday Button
|
|
||||||
//
|
|
||||||
edit_thu_button=new QCheckBox(this);
|
|
||||||
edit_thu_button->setGeometry(335,228,20,20);
|
|
||||||
label=new QLabel(tr("Thursday"),this);
|
|
||||||
label->setGeometry(355,228,115,20);
|
|
||||||
label->setFont(subLabelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Friday Button
|
|
||||||
//
|
|
||||||
edit_fri_button=new QCheckBox(this);
|
|
||||||
edit_fri_button->setGeometry(440,228,20,20);
|
|
||||||
label=new QLabel(tr("Friday"),this);
|
|
||||||
label->setGeometry(460,228,40,20);
|
|
||||||
label->setFont(subLabelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Saturday Button
|
|
||||||
//
|
|
||||||
edit_sat_button=new QCheckBox(this);
|
|
||||||
edit_sat_button->setGeometry(130,253,20,20);
|
|
||||||
label=new QLabel(tr("Saturday"),this);
|
|
||||||
label->setGeometry(150,253,60,20);
|
|
||||||
label->setFont(subLabelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sunday Button
|
|
||||||
//
|
|
||||||
edit_sun_button=new QCheckBox(this);
|
|
||||||
edit_sun_button->setGeometry(300,253,20,20);
|
|
||||||
label=new QLabel(tr("Sunday"),this);
|
|
||||||
label->setGeometry(320,253,60,20);
|
|
||||||
label->setFont(subLabelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// OneShot Button
|
// OneShot Button
|
||||||
//
|
//
|
||||||
edit_oneshot_box=new QCheckBox(this);
|
edit_oneshot_box=new QCheckBox(this);
|
||||||
edit_oneshot_box->setGeometry(20,290,15,15);
|
edit_oneshot_label=new QLabel(tr("Make OneShot"),this);
|
||||||
label=new QLabel(tr("Make OneShot"),this);
|
edit_oneshot_label->setFont(labelFont());
|
||||||
label->setGeometry(40,288,115,20);
|
edit_oneshot_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||||
label->setFont(labelFont());
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save As Button
|
// Save As Button
|
||||||
//
|
//
|
||||||
QPushButton *button=new QPushButton(this);
|
edit_saveas_button=new QPushButton(this);
|
||||||
button->setGeometry(sizeHint().width()-300,sizeHint().height()-60,80,50);
|
edit_saveas_button->setFont(buttonFont());
|
||||||
button->setFont(buttonFont());
|
edit_saveas_button->setText(tr("Save As\nNew"));
|
||||||
button->setText(tr("Save As\nNew"));
|
connect(edit_saveas_button,SIGNAL(clicked()),this,SLOT(saveasData()));
|
||||||
connect(button,SIGNAL(clicked()),this,SLOT(saveasData()));
|
|
||||||
if(adds==NULL) {
|
if(adds==NULL) {
|
||||||
button->hide();
|
edit_saveas_button->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ok Button
|
// Ok Button
|
||||||
//
|
//
|
||||||
button=new QPushButton(this);
|
edit_ok_button=new QPushButton(this);
|
||||||
button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
|
edit_ok_button->setDefault(true);
|
||||||
button->setDefault(true);
|
edit_ok_button->setFont(buttonFont());
|
||||||
button->setFont(buttonFont());
|
edit_ok_button->setText(tr("OK"));
|
||||||
button->setText(tr("OK"));
|
connect(edit_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
|
||||||
connect(button,SIGNAL(clicked()),this,SLOT(okData()));
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cancel Button
|
// Cancel Button
|
||||||
//
|
//
|
||||||
button=new QPushButton(this);
|
edit_cancel_button=new QPushButton(this);
|
||||||
button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
|
edit_cancel_button->setFont(buttonFont());
|
||||||
button->setFont(buttonFont());
|
edit_cancel_button->setText(tr("Cancel"));
|
||||||
button->setText(tr("Cancel"));
|
connect(edit_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||||
connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Populate Data
|
// Populate Data
|
||||||
//
|
//
|
||||||
edit_active_button->setChecked(edit_recording->isActive());
|
edit_event_widget->fromRecording(edit_recording->id());
|
||||||
q=new RDSqlQuery("select `NAME` from `STATIONS` where `NAME`!='DEFAULT'");
|
|
||||||
while(q->next()) {
|
|
||||||
edit_station_box->insertItem(q->value(0).toString());
|
|
||||||
if(edit_recording->station()==q->value(0).toString()) {
|
|
||||||
edit_station_box->setCurrentIndex(edit_station_box->count()-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete q;
|
|
||||||
// edit_station_box->setCurrentText(edit_recording->station());
|
|
||||||
edit_starttime_edit->setTime(edit_recording->startTime());
|
|
||||||
edit_description_edit->setText(edit_recording->description());
|
edit_description_edit->setText(edit_recording->description());
|
||||||
edit_mon_button->setChecked(edit_recording->mon());
|
edit_dow_selector->fromRecording(edit_recording->id());
|
||||||
edit_tue_button->setChecked(edit_recording->tue());
|
|
||||||
edit_wed_button->setChecked(edit_recording->wed());
|
|
||||||
edit_thu_button->setChecked(edit_recording->thu());
|
|
||||||
edit_fri_button->setChecked(edit_recording->fri());
|
|
||||||
edit_sat_button->setChecked(edit_recording->sat());
|
|
||||||
edit_sun_button->setChecked(edit_recording->sun());
|
|
||||||
edit_oneshot_box->setChecked(edit_recording->oneShot());
|
edit_oneshot_box->setChecked(edit_recording->oneShot());
|
||||||
activateStationData(edit_station_box->currentText());
|
activateStationData(edit_event_widget->stationName());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Input/Output Spin Box Connections
|
// Input/Output Spin Box Connections
|
||||||
@@ -301,7 +164,8 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector<int> *adds,QWidget *parent)
|
|||||||
|
|
||||||
EditSwitchEvent::~EditSwitchEvent()
|
EditSwitchEvent::~EditSwitchEvent()
|
||||||
{
|
{
|
||||||
delete edit_station_box;
|
delete edit_event_widget;
|
||||||
|
delete edit_dow_selector;
|
||||||
if(edit_deck!=NULL) {
|
if(edit_deck!=NULL) {
|
||||||
delete edit_deck;
|
delete edit_deck;
|
||||||
}
|
}
|
||||||
@@ -352,12 +216,12 @@ void EditSwitchEvent::activateMatrixData(const QString &str)
|
|||||||
if(edit_matrix!=NULL) {
|
if(edit_matrix!=NULL) {
|
||||||
delete edit_matrix;
|
delete edit_matrix;
|
||||||
}
|
}
|
||||||
edit_matrix=new RDMatrix(edit_station_box->currentText(),GetMatrix());
|
edit_matrix=new RDMatrix(edit_event_widget->stationName(),GetMatrix());
|
||||||
QString sql=QString("select ")+
|
QString sql=QString("select ")+
|
||||||
"`NAME`,"
|
"`NAME`,"
|
||||||
"`NUMBER` "+
|
"`NUMBER` "+
|
||||||
"from `INPUTS` where "+
|
"from `INPUTS` where "+
|
||||||
"(`STATION_NAME`='"+RDEscapeString(edit_station_box->currentText())+"')&&"+
|
"(`STATION_NAME`='"+RDEscapeString(edit_event_widget->stationName())+"')&&"+
|
||||||
QString().sprintf("(`MATRIX`=%d) ",GetMatrix())+
|
QString().sprintf("(`MATRIX`=%d) ",GetMatrix())+
|
||||||
"order by `NAME`";
|
"order by `NAME`";
|
||||||
edit_input_box->clear();
|
edit_input_box->clear();
|
||||||
@@ -385,7 +249,7 @@ void EditSwitchEvent::activateMatrixData(const QString &str)
|
|||||||
"`NAME`,"+
|
"`NAME`,"+
|
||||||
"`NUMBER` "+
|
"`NUMBER` "+
|
||||||
"from `OUTPUTS` where "+
|
"from `OUTPUTS` where "+
|
||||||
"(`STATION_NAME`='"+RDEscapeString(edit_station_box->currentText())+"')&&"+
|
"(`STATION_NAME`='"+RDEscapeString(edit_event_widget->stationName())+"')&&"+
|
||||||
QString().sprintf("(`MATRIX`=%d) ",GetMatrix())+
|
QString().sprintf("(`MATRIX`=%d) ",GetMatrix())+
|
||||||
"order by `NAME`";
|
"order by `NAME`";
|
||||||
edit_output_box->clear();
|
edit_output_box->clear();
|
||||||
@@ -473,6 +337,37 @@ void EditSwitchEvent::cancelData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EditSwitchEvent::resizeEvent(QResizeEvent *e)
|
||||||
|
{
|
||||||
|
edit_event_widget->setGeometry(10,11,edit_event_widget->sizeHint().width(),
|
||||||
|
edit_event_widget->sizeHint().height());
|
||||||
|
|
||||||
|
edit_description_edit->setGeometry(120,43,size().width()-130,20);
|
||||||
|
edit_description_label->setGeometry(10,43,105,20);
|
||||||
|
|
||||||
|
edit_matrix_box->setGeometry(120,70,size().width()-130,20);
|
||||||
|
edit_matrix_label->setGeometry(10,70,105,20);
|
||||||
|
|
||||||
|
edit_input_box->setGeometry(120,100,size().width()-130,20);
|
||||||
|
edit_input_label->setGeometry(10,100,105,20);
|
||||||
|
edit_input_spin->setGeometry(140,125,50,20);
|
||||||
|
|
||||||
|
edit_output_box->setGeometry(120,155,size().width()-130,20);
|
||||||
|
edit_output_label->setGeometry(10,155,105,20);
|
||||||
|
edit_output_spin->setGeometry(140,180,50,20);
|
||||||
|
|
||||||
|
edit_dow_selector->setGeometry(10,213,edit_dow_selector->sizeHint().width(),
|
||||||
|
edit_dow_selector->sizeHint().height());
|
||||||
|
|
||||||
|
edit_oneshot_box->setGeometry(20,290,15,15);
|
||||||
|
edit_oneshot_label->setGeometry(40,288,115,20);
|
||||||
|
|
||||||
|
edit_saveas_button->setGeometry(size().width()-300,size().height()-60,80,50);
|
||||||
|
edit_ok_button->setGeometry(size().width()-180,size().height()-60,80,50);
|
||||||
|
edit_cancel_button->setGeometry(size().width()-90,size().height()-60,80,50);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EditSwitchEvent::keyPressEvent(QKeyEvent *e)
|
void EditSwitchEvent::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->key()) {
|
switch(e->key()) {
|
||||||
@@ -500,21 +395,13 @@ void EditSwitchEvent::Save()
|
|||||||
int source=GetSource();
|
int source=GetSource();
|
||||||
int dest=GetDestination();
|
int dest=GetDestination();
|
||||||
|
|
||||||
edit_recording->setIsActive(edit_active_button->isChecked());
|
edit_event_widget->toRecording(edit_recording->id());
|
||||||
edit_recording->setStation(edit_station_box->currentText());
|
|
||||||
edit_recording->setType(RDRecording::SwitchEvent);
|
edit_recording->setType(RDRecording::SwitchEvent);
|
||||||
edit_recording->setStartTime(edit_starttime_edit->time());
|
|
||||||
edit_recording->setDescription(edit_description_edit->text());
|
edit_recording->setDescription(edit_description_edit->text());
|
||||||
edit_recording->setChannel(matrix);
|
edit_recording->setChannel(matrix);
|
||||||
edit_recording->setSwitchSource(source);
|
edit_recording->setSwitchSource(source);
|
||||||
edit_recording->setSwitchDestination(dest);
|
edit_recording->setSwitchDestination(dest);
|
||||||
edit_recording->setMon(edit_mon_button->isChecked());
|
edit_dow_selector->toRecording(edit_recording->id());
|
||||||
edit_recording->setTue(edit_tue_button->isChecked());
|
|
||||||
edit_recording->setWed(edit_wed_button->isChecked());
|
|
||||||
edit_recording->setThu(edit_thu_button->isChecked());
|
|
||||||
edit_recording->setFri(edit_fri_button->isChecked());
|
|
||||||
edit_recording->setSat(edit_sat_button->isChecked());
|
|
||||||
edit_recording->setSun(edit_sun_button->isChecked());
|
|
||||||
edit_recording->setOneShot(edit_oneshot_box->isChecked());
|
edit_recording->setOneShot(edit_oneshot_box->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +413,7 @@ int EditSwitchEvent::GetMatrix()
|
|||||||
QString sql=QString("select ")+
|
QString sql=QString("select ")+
|
||||||
"`MATRIX` "+
|
"`MATRIX` "+
|
||||||
"from `MATRICES` where "+
|
"from `MATRICES` where "+
|
||||||
"(`STATION_NAME`='"+RDEscapeString(edit_station_box->currentText())+"')&&"
|
"(`STATION_NAME`='"+RDEscapeString(edit_event_widget->stationName())+"')&&"
|
||||||
"(`NAME`='"+RDEscapeString(edit_matrix_box->currentText())+"')&&"+
|
"(`NAME`='"+RDEscapeString(edit_matrix_box->currentText())+"')&&"+
|
||||||
"(`INPUTS`>0)&&"+
|
"(`INPUTS`>0)&&"+
|
||||||
"(`OUTPUTS`>0)";
|
"(`OUTPUTS`>0)";
|
||||||
@@ -546,7 +433,7 @@ int EditSwitchEvent::GetSource()
|
|||||||
QString sql=QString("select ")+
|
QString sql=QString("select ")+
|
||||||
"`NUMBER` "+
|
"`NUMBER` "+
|
||||||
"from `INPUTS` where "+
|
"from `INPUTS` where "+
|
||||||
"(`STATION_NAME`='"+RDEscapeString(edit_station_box->currentText())+"')&&"+
|
"(`STATION_NAME`='"+RDEscapeString(edit_event_widget->stationName())+"')&&"+
|
||||||
QString().sprintf("(`MATRIX`=%d)&&",GetMatrix())+
|
QString().sprintf("(`MATRIX`=%d)&&",GetMatrix())+
|
||||||
"(`NAME`='"+RDEscapeString(edit_input_box->currentText())+"')";
|
"(`NAME`='"+RDEscapeString(edit_input_box->currentText())+"')";
|
||||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||||
@@ -565,7 +452,7 @@ int EditSwitchEvent::GetDestination()
|
|||||||
QString sql=QString("select ")+
|
QString sql=QString("select ")+
|
||||||
"`NUMBER` "+
|
"`NUMBER` "+
|
||||||
"from `OUTPUTS` where "+
|
"from `OUTPUTS` where "+
|
||||||
"(`STATION_NAME`='"+RDEscapeString(edit_station_box->currentText())+"')&&"+
|
"(`STATION_NAME`='"+RDEscapeString(edit_event_widget->stationName())+"')&&"+
|
||||||
QString().sprintf("(`MATRIX`=%d)&&",GetMatrix())+
|
QString().sprintf("(`MATRIX`=%d)&&",GetMatrix())+
|
||||||
"(`NAME`='"+RDEscapeString(edit_output_box->currentText())+"')";
|
"(`NAME`='"+RDEscapeString(edit_output_box->currentText())+"')";
|
||||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||||
@@ -582,32 +469,32 @@ bool EditSwitchEvent::CheckEvent(bool include_myself)
|
|||||||
QString sql=QString("select ")+
|
QString sql=QString("select ")+
|
||||||
"`ID` "+
|
"`ID` "+
|
||||||
"from `RECORDINGS` where "+
|
"from `RECORDINGS` where "+
|
||||||
"(`STATION_NAME`='"+RDEscapeString(edit_station_box->currentText())+"')&&"+
|
"(`STATION_NAME`='"+RDEscapeString(edit_event_widget->stationName())+"')&&"+
|
||||||
QString().sprintf("(`TYPE`=%d)&&",RDRecording::SwitchEvent)+
|
QString().sprintf("(`TYPE`=%d)&&",RDRecording::SwitchEvent)+
|
||||||
"(`START_TIME`='"+
|
"(`START_TIME`='"+
|
||||||
RDEscapeString(edit_starttime_edit->time().toString("hh:mm:ss"))+"')&&"+
|
RDEscapeString(edit_event_widget->startTime().toString("hh:mm:ss"))+"')&&"+
|
||||||
QString().sprintf("(`CHANNEL`=%d)&&",GetMatrix())+
|
QString().sprintf("(`CHANNEL`=%d)&&",GetMatrix())+
|
||||||
QString().sprintf("(`SWITCH_INPUT`=%d)&&",GetSource())+
|
QString().sprintf("(`SWITCH_INPUT`=%d)&&",GetSource())+
|
||||||
QString().sprintf("(`SWITCH_OUTPUT`=%d)",GetDestination());
|
QString().sprintf("(`SWITCH_OUTPUT`=%d)",GetDestination());
|
||||||
if(edit_sun_button->isChecked()) {
|
if(edit_dow_selector->dayOfWeekEnabled(7)) {
|
||||||
sql+="&&(`SUN`='Y')";
|
sql+="&&(`SUN`='Y')";
|
||||||
}
|
}
|
||||||
if(edit_mon_button->isChecked()) {
|
if(edit_dow_selector->dayOfWeekEnabled(1)) {
|
||||||
sql+="&&(`MON`='Y')";
|
sql+="&&(`MON`='Y')";
|
||||||
}
|
}
|
||||||
if(edit_tue_button->isChecked()) {
|
if(edit_dow_selector->dayOfWeekEnabled(2)) {
|
||||||
sql+="&&(`TUE`='Y')";
|
sql+="&&(`TUE`='Y')";
|
||||||
}
|
}
|
||||||
if(edit_wed_button->isChecked()) {
|
if(edit_dow_selector->dayOfWeekEnabled(3)) {
|
||||||
sql+="&&(`WED`='Y')";
|
sql+="&&(`WED`='Y')";
|
||||||
}
|
}
|
||||||
if(edit_thu_button->isChecked()) {
|
if(edit_dow_selector->dayOfWeekEnabled(4)) {
|
||||||
sql+="&&(`THU`='Y')";
|
sql+="&&(`THU`='Y')";
|
||||||
}
|
}
|
||||||
if(edit_fri_button->isChecked()) {
|
if(edit_dow_selector->dayOfWeekEnabled(5)) {
|
||||||
sql+="&&(`FRI`='Y')";
|
sql+="&&(`FRI`='Y')";
|
||||||
}
|
}
|
||||||
if(edit_sat_button->isChecked()) {
|
if(edit_dow_selector->dayOfWeekEnabled(6)) {
|
||||||
sql+="&&(`SAT`='Y')";
|
sql+="&&(`SAT`='Y')";
|
||||||
}
|
}
|
||||||
if(!include_myself) {
|
if(!include_myself) {
|
||||||
|
|||||||
@@ -32,6 +32,9 @@
|
|||||||
#include <rdrecording.h>
|
#include <rdrecording.h>
|
||||||
#include <rdstationlistmodel.h>
|
#include <rdstationlistmodel.h>
|
||||||
|
|
||||||
|
#include "dowselector.h"
|
||||||
|
#include "eventwidget.h"
|
||||||
|
|
||||||
class EditSwitchEvent : public RDDialog
|
class EditSwitchEvent : public RDDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -53,7 +56,8 @@ class EditSwitchEvent : public RDDialog
|
|||||||
void cancelData();
|
void cancelData();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
void keyPressEvent(QKeyEvent *e);
|
||||||
void closeEvent(QCloseEvent *e);
|
void closeEvent(QCloseEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -65,28 +69,26 @@ class EditSwitchEvent : public RDDialog
|
|||||||
RDMatrix *edit_matrix;
|
RDMatrix *edit_matrix;
|
||||||
RDDeck *edit_deck;
|
RDDeck *edit_deck;
|
||||||
RDRecording *edit_recording;
|
RDRecording *edit_recording;
|
||||||
QCheckBox *edit_active_button;
|
QLabel *edit_description_label;
|
||||||
RDComboBox *edit_station_box;
|
|
||||||
RDStationListModel *edit_station_model;
|
|
||||||
QTimeEdit *edit_starttime_edit;
|
|
||||||
QLineEdit *edit_description_edit;
|
QLineEdit *edit_description_edit;
|
||||||
|
QLabel *edit_matrix_label;
|
||||||
RDComboBox *edit_matrix_box;
|
RDComboBox *edit_matrix_box;
|
||||||
|
QLabel *edit_input_label;
|
||||||
RDComboBox *edit_input_box;
|
RDComboBox *edit_input_box;
|
||||||
QSpinBox *edit_input_spin;
|
QSpinBox *edit_input_spin;
|
||||||
|
QLabel *edit_output_label;
|
||||||
RDComboBox *edit_output_box;
|
RDComboBox *edit_output_box;
|
||||||
QSpinBox *edit_output_spin;
|
QSpinBox *edit_output_spin;
|
||||||
QCheckBox *edit_sun_button;
|
|
||||||
QCheckBox *edit_mon_button;
|
|
||||||
QCheckBox *edit_tue_button;
|
|
||||||
QCheckBox *edit_wed_button;
|
|
||||||
QCheckBox *edit_thu_button;
|
|
||||||
QCheckBox *edit_fri_button;
|
|
||||||
QCheckBox *edit_sat_button;
|
|
||||||
QString *edit_filter;
|
QString *edit_filter;
|
||||||
QCheckBox *edit_oneshot_box;
|
QCheckBox *edit_oneshot_box;
|
||||||
|
QLabel *edit_oneshot_label;
|
||||||
|
QPushButton *edit_saveas_button;
|
||||||
|
QPushButton *edit_ok_button;
|
||||||
|
QPushButton *edit_cancel_button;
|
||||||
|
EventWidget *edit_event_widget;
|
||||||
|
DowSelector *edit_dow_selector;
|
||||||
std::vector<int>*edit_added_events;
|
std::vector<int>*edit_added_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif // EDIT_SWITCHEVENT_H
|
||||||
|
|
||||||
|
|||||||
@@ -583,18 +583,6 @@ New</source>
|
|||||||
<source>Edit Switcher Event</source>
|
<source>Edit Switcher Event</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Event Active</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Location:</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Start Time:</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Description:</source>
|
<source>Description:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
@@ -611,38 +599,6 @@ New</source>
|
|||||||
<source>Switch Output:</source>
|
<source>Switch Output:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Active Days</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Monday</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Tuesday</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Wednesday</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Thursday</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Friday</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Saturday</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Sunday</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Make OneShot</source>
|
<source>Make OneShot</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
|||||||
Reference in New Issue
Block a user