2021-07-27 Fred Gleason <fredg@paravelsystems.com>

* Refactored the 'Edit Recording' dialog in rdcatch(1) to improve
	modularity.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-07-27 12:21:17 -04:00
parent 3a7ff8acf1
commit dae369075e
6 changed files with 245 additions and 351 deletions

View File

@@ -20,7 +20,6 @@
#include <QGroupBox>
#include <QMessageBox>
#include <QRadioButton>
#include <rdcut_path.h>
#include <rdescape_string.h>
@@ -65,23 +64,11 @@ EditRecording::EditRecording(int id,std::vector<int> *adds,QString *filter,
false,true,true,"RDCatch",false,this);
//
// Active Button
// Event Widget
//
edit_active_button=new QCheckBox(tr("Event Active"),this);
edit_active_button->setGeometry(10,11,145,20);
edit_active_button->setFont(labelFont());
//
// Station
//
edit_station_box=new QComboBox(this);
edit_station_box->setGeometry(200,10,140,23);
QLabel * 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(int)),
this,SLOT(activateStationData(int)));
edit_event_widget=new EventWidget(EventWidget::RecordEvent,this);
connect(edit_event_widget,SIGNAL(locationChanged(const QString &,int)),
this,SLOT(locationChangedData(const QString &,int)));
//
// Start Parameters
@@ -90,76 +77,61 @@ EditRecording::EditRecording(int id,std::vector<int> *adds,QString *filter,
connect(edit_starttype_group,SIGNAL(buttonClicked(int)),
this,SLOT(startTypeClickedData(int)));
QGroupBox *groupbox=new QGroupBox(tr("Start Parameters"),this);
groupbox->setFont(labelFont());
groupbox->setGeometry(10,37,sizeHint().width()-20,105);
edit_start_groupbox=new QGroupBox(tr("Start Parameters"),this);
edit_start_groupbox->setFont(labelFont());
QRadioButton *rbutton=new QRadioButton(tr("Use Hard Time"),this);
rbutton->setGeometry(20,57,110,15);
edit_starttype_group->addButton(rbutton,RDRecording::HardStart);
rbutton->setFont(subLabelFont());
edit_start_hardtime_radio=new QRadioButton(tr("Use Hard Time"),this);
edit_starttype_group->
addButton(edit_start_hardtime_radio,RDRecording::HardStart);
edit_start_hardtime_radio->setFont(subLabelFont());
edit_starttime_edit=new QTimeEdit(this);
edit_starttime_edit->setGeometry(255,53,80,20);
edit_starttime_edit->setDisplayFormat("hh:mm:ss");
edit_starttime_label=new QLabel(tr("Record Start Time:"),this);
edit_starttime_label->setGeometry(135,57,115,15);
edit_starttime_label->setFont(subLabelFont());
edit_starttime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
rbutton=new QRadioButton(tr("Use GPI"),this);
rbutton->setGeometry(20,81,100,15);
rbutton->setFont(subLabelFont());
edit_start_gpi_radio=new QRadioButton(tr("Use GPI"),this);
edit_start_gpi_radio->setFont(subLabelFont());
edit_start_startwindow_edit=new QTimeEdit(this);
edit_start_startwindow_edit->setGeometry(255,77,80,20);
edit_start_startwindow_edit->setDisplayFormat("hh:mm:ss");
edit_start_startwindow_label=new QLabel(tr("Window Start Time:"),this);
edit_start_startwindow_label->setGeometry(135,81,115,15);
edit_start_startwindow_label->setFont(subLabelFont());
edit_start_startwindow_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_start_endwindow_edit=new QTimeEdit(this);
edit_start_endwindow_edit->setGeometry(455,77,80,20);
edit_start_endwindow_edit->setDisplayFormat("hh:mm:ss");
edit_start_endwindow_label=new QLabel(tr("Window End Time:"),this);
edit_start_endwindow_label->setGeometry(345,81,105,15);
edit_start_endwindow_label->setFont(subLabelFont());
edit_start_endwindow_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_startmatrix_spin=new QSpinBox(this);
edit_startmatrix_spin->setGeometry(185,99,30,20);
edit_startmatrix_spin->setRange(0,MAX_MATRICES-1);
edit_startmatrix_label=new QLabel(tr("GPI Matrix:"),this);
edit_startmatrix_label->setGeometry(100,100,80,20);
edit_startmatrix_label->setFont(subLabelFont());
edit_startmatrix_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_startline_spin=new QSpinBox(this);
edit_startline_spin->setGeometry(305,99,30,20);
edit_startline_spin->setRange(1,MAX_GPIO_PINS);
edit_startline_label=new QLabel(tr("GPI Line:"),this);
edit_startline_label->setGeometry(240,100,60,20);
edit_startline_label->setFont(subLabelFont());
edit_startline_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_startoffset_edit=new QTimeEdit(this);
edit_startoffset_edit->setGeometry(455,99,80,20);
edit_startoffset_edit->setDisplayFormat("hh:mm:ss");
edit_startoffset_label=new QLabel(tr("Start Delay:"),this);
edit_startoffset_label->setGeometry(345,100,105,20);
edit_startoffset_label->setFont(subLabelFont());
edit_startoffset_label->
edit_startoffset_time_label=new QLabel(tr("Start Delay:"),this);
edit_startoffset_time_label->setFont(subLabelFont());
edit_startoffset_time_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_multirec_box=
new QCheckBox(tr("Allow Multiple Recordings within this Window"),this);
edit_multirec_box->setGeometry(140,124,sizeHint().width()-170,15);
edit_multirec_box->setFont(subLabelFont());
edit_starttype_group->addButton(rbutton,RDRecording::GpiStart);
edit_starttype_group->addButton(edit_start_gpi_radio,RDRecording::GpiStart);
//
// End Parameters
@@ -168,147 +140,116 @@ EditRecording::EditRecording(int id,std::vector<int> *adds,QString *filter,
connect(edit_endtype_group,SIGNAL(buttonClicked(int)),
this,SLOT(endTypeClickedData(int)));
groupbox=new QGroupBox(tr("End Parameters"),this);
groupbox->setFont(labelFont());
groupbox->setGeometry(10,160,sizeHint().width()-20,112);
rbutton=new QRadioButton(tr("Use Length"),this);
rbutton->setGeometry(20,205,100,15);
edit_endtype_group->addButton(rbutton,RDRecording::LengthEnd);
rbutton->setFont(subLabelFont());
edit_end_groupbox=new QGroupBox(tr("End Parameters"),this);
edit_end_groupbox->setFont(labelFont());
edit_end_length_radio=new QRadioButton(tr("Use Length"),this);
edit_endtype_group->addButton(edit_end_length_radio,RDRecording::LengthEnd);
edit_end_length_radio->setFont(subLabelFont());
edit_endlength_edit=new QTimeEdit(this);
edit_endlength_edit->setGeometry(245,201,80,20);
edit_endlength_edit->setDisplayFormat("hh:mm:ss");
edit_endlength_label=new QLabel(tr("Record Length:"),this);
edit_endlength_label->setGeometry(125,205,115,15);
edit_endlength_label->setFont(subLabelFont());
edit_endlength_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
rbutton=new QRadioButton(tr("Use Hard Time"),this);
rbutton->setGeometry(20,181,1100,15);
edit_endtype_group->addButton(rbutton,RDRecording::HardEnd);
rbutton->setFont(subLabelFont());
edit_end_hardtime_radio=new QRadioButton(tr("Use Hard Time"),this);
edit_endtype_group->addButton(edit_end_hardtime_radio,RDRecording::HardEnd);
edit_end_hardtime_radio->setFont(subLabelFont());
edit_endtime_edit=new QTimeEdit(this);
edit_endtime_edit->setGeometry(245,177,80,20);
edit_endtime_edit->setDisplayFormat("hh:mm:ss");
edit_endtime_label=new QLabel(tr("Record End Time:"),this);
edit_endtime_label->setGeometry(125,181,115,15);
edit_endtime_label->setFont(subLabelFont());
edit_endtime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
rbutton=new QRadioButton(tr("Use GPI"),this);
rbutton->setGeometry(20,229,100,15);
rbutton->setFont(subLabelFont());
edit_end_gpi_radio=new QRadioButton(tr("Use GPI"),this);
edit_end_gpi_radio->setFont(subLabelFont());
edit_end_startwindow_edit=new QTimeEdit(this);
edit_end_startwindow_edit->setGeometry(245,225,80,20);
edit_end_startwindow_edit->setDisplayFormat("hh:mm:ss");
edit_end_startwindow_label=new QLabel(tr("Window Start Time:"),this);
edit_end_startwindow_label->setGeometry(125,229,115,15);
edit_end_startwindow_label->setFont(subLabelFont());
edit_end_startwindow_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_end_endwindow_edit=new QTimeEdit(this);
edit_end_endwindow_edit->setGeometry(455,225,80,20);
edit_end_endwindow_edit->setDisplayFormat("hh:mm:ss");
edit_end_endwindow_label=new QLabel(tr("Window End Time:"),this);
edit_end_endwindow_label->setGeometry(345,229,105,15);
edit_end_endwindow_label->setFont(subLabelFont());
edit_end_endwindow_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_endmatrix_spin=new QSpinBox(this);
edit_endmatrix_spin->setGeometry(185,247,30,20);
edit_endmatrix_spin->setRange(0,MAX_MATRICES-1);
edit_endmatrix_label=new QLabel(tr("GPI Matrix:"),this);
edit_endmatrix_label->setGeometry(100,248,80,20);
edit_endmatrix_label->setFont(subLabelFont());
edit_endmatrix_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_endline_spin=new QSpinBox(this);
edit_endline_spin->setGeometry(295,247,30,20);
edit_endline_spin->setRange(1,MAX_GPIO_PINS);
edit_endline_label=new QLabel(tr("GPI Line:"),this);
edit_endline_label->setGeometry(230,248,60,20);
edit_endline_label->setFont(subLabelFont());
edit_endline_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_maxlength_edit=new QTimeEdit(this);
edit_maxlength_edit->setGeometry(455,247,80,20);
edit_maxlength_edit->setDisplayFormat("hh:mm:ss");
edit_maxlength_label=new QLabel(tr("Max Record Length:"),this);
edit_maxlength_label->setGeometry(325,248,125,20);
edit_maxlength_label->setFont(subLabelFont());
edit_maxlength_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_endtype_group->addButton(rbutton,RDRecording::GpiEnd);
edit_endtype_group->addButton(edit_end_gpi_radio,RDRecording::GpiEnd);
//
// Description
//
edit_description_edit=new QLineEdit(this);
edit_description_edit->setGeometry(105,291,sizeHint().width()-115,20);
edit_description_edit->setValidator(validator);
label=new QLabel(tr("Description:"),this);
label->setGeometry(10,291,90,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_description_label=new QLabel(tr("Description:"),this);
edit_description_label->setFont(labelFont());
edit_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// Source Name
//
edit_source_box=new QComboBox(this);
edit_source_box->setGeometry(105,317,sizeHint().width()-115,24);
label=new QLabel(tr("Source:"),this);
label->setGeometry(10,317,90,24);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_source_label=new QLabel(tr("Source:"),this);
edit_source_label->setFont(labelFont());
edit_source_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// Destination
//
edit_destination_edit=new QLineEdit(this);
edit_destination_edit->setGeometry(105,345,sizeHint().width()-185,20);
edit_destination_edit->setReadOnly(true);
label=new QLabel(tr("Destination:"),this);
label->setGeometry(10,345,90,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
QPushButton *button=new QPushButton(this);
button->setGeometry(sizeHint().width()-70,344,60,24);
button->setFont(subButtonFont());
button->setText(tr("Select"));
connect(button,SIGNAL(clicked()),this,SLOT(selectCutData()));
edit_destination_label=new QLabel(tr("Destination:"),this);
edit_destination_label->setFont(labelFont());
edit_destination_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_destination_button=new QPushButton(this);
edit_destination_button->setFont(subButtonFont());
edit_destination_button->setText(tr("Select"));
connect(edit_destination_button,SIGNAL(clicked()),this,SLOT(selectCutData()));
//
// Channels
//
edit_channels_box=new QComboBox(this);
edit_channels_box->setGeometry(190,370,40,20);
edit_channels_box->insertItem(0,"1");
edit_channels_box->insertItem(1,"2");
label=new QLabel(tr("Channels:"),this);
label->setGeometry(120,370,70,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
edit_channels_label=new QLabel(tr("Channels:"),this);
edit_channels_label->setFont(labelFont());
edit_channels_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
//
// Autotrim Controls
//
edit_autotrim_box=new QCheckBox(tr("Autotrim"),this);
edit_autotrim_box->setGeometry(120,395,100,15);
edit_autotrim_box->setFont(labelFont());
connect(edit_autotrim_box,SIGNAL(toggled(bool)),
this,SLOT(autotrimToggledData(bool)));
edit_autotrim_spin=new QSpinBox(this);
edit_autotrim_spin->setGeometry(265,393,40,20);
edit_autotrim_spin->setRange(-99,-1);
edit_autotrim_label=new QLabel(tr("Level:"),this);
edit_autotrim_label->setGeometry(220,393,40,20);
edit_autotrim_label->setFont(labelFont());
edit_autotrim_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
edit_autotrim_unit=new QLabel(tr("dBFS"),this);
edit_autotrim_unit->setGeometry(310,393,40,20);
edit_autotrim_unit->setFont(labelFont());
edit_autotrim_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
@@ -316,145 +257,81 @@ EditRecording::EditRecording(int id,std::vector<int> *adds,QString *filter,
// Normalize Controls
//
edit_normalize_box=new QCheckBox(tr("Normalize"),this);
edit_normalize_box->setGeometry(120,420,100,15);
connect(edit_normalize_box,SIGNAL(toggled(bool)),
this,SLOT(normalizeToggledData(bool)));
edit_normalize_box->setFont(labelFont());
edit_normalize_spin=new QSpinBox(this);
edit_normalize_spin->setGeometry(265,418,40,20);
edit_normalize_spin->setRange(-99,-1);
edit_normalize_label=new QLabel(tr("Level:"),this);
edit_normalize_label->setGeometry(220,418,40,20);
edit_normalize_label->setFont(labelFont());
edit_normalize_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
edit_normalize_unit=new QLabel(tr("dBFS"),this);
edit_normalize_unit->setGeometry(310,418,40,20);
edit_normalize_unit->setFont(labelFont());
edit_normalize_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
//
// Button Label
// DOW Selector
//
groupbox=new QGroupBox(tr("Active Days"),this);
groupbox->setFont(labelFont());
groupbox->setGeometry(10,442,sizeHint().width()-20,62);
//
// Monday Button
//
edit_mon_button=new QCheckBox(tr("Monday"),this);
edit_mon_button->setGeometry(20,459,135,20);
edit_mon_button->setFont(subLabelFont());
//
// Tuesday Button
//
edit_tue_button=new QCheckBox(tr("Tuesday"),this);
edit_tue_button->setGeometry(115,459,135,20);
edit_tue_button->setFont(subLabelFont());
//
// Wednesday Button
//
edit_wed_button=new QCheckBox(tr("Wednesday"),this);
edit_wed_button->setGeometry(215,459,135,20);
edit_wed_button->setFont(subLabelFont());
//
// Thursday Button
//
edit_thu_button=new QCheckBox(tr("Thursday"),this);
edit_thu_button->setGeometry(335,459,135,20);
edit_thu_button->setFont(subLabelFont());
//
// Friday Button
//
edit_fri_button=new QCheckBox(tr("Friday"),this);
edit_fri_button->setGeometry(440,459,135,20);
edit_fri_button->setFont(subLabelFont());
//
// Saturday Button
//
edit_sat_button=new QCheckBox(tr("Saturday"),this);
edit_sat_button->setGeometry(130,484,80,20);
edit_sat_button->setFont(subLabelFont());
//
// Sunday Button
//
edit_sun_button=new QCheckBox(tr("Sunday"),this);
edit_sun_button->setGeometry(300,484,80,20);
edit_sun_button->setFont(subLabelFont());
edit_dow_selector=new DowSelector(this);
//
// Start Date Offset
//
edit_startoffset_box=new QSpinBox(this);
edit_startoffset_box->setGeometry(140,516,55,24);
edit_startoffset_box->setRange(0,355);
edit_startoffset_box->setSpecialValueText(tr("None"));
label=new QLabel(tr("Start Date Offset:"),this);
label->setGeometry(10,516,125,24);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_startoffset_label=new QLabel(tr("Start Date Offset:"),this);
edit_startoffset_label->setFont(labelFont());
edit_startoffset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// End Date Offset
//
edit_endoffset_box=new QSpinBox(this);
edit_endoffset_box->setGeometry(440,516,55,24);
edit_endoffset_box->setRange(0,355);
edit_endoffset_box->setSpecialValueText(tr("None"));
label=new QLabel(tr("End Date Offset:"),this);
label->setGeometry(310,516,125,24);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit_endoffset_label=new QLabel(tr("End Date Offset:"),this);
edit_endoffset_label->setFont(labelFont());
edit_endoffset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// OneShot Button
//
edit_oneshot_box=new QCheckBox(tr("Make OneShot"),this);
edit_oneshot_box->setGeometry(20,553,125,15);
edit_oneshot_box->setFont(labelFont());
//
// Save As Button
//
button=new QPushButton(this);
button->setGeometry(sizeHint().width()-300,sizeHint().height()-60,80,50);
button->setFont(buttonFont());
button->setText(tr("Save As\nNew"));
connect(button,SIGNAL(clicked()),this,SLOT(saveasData()));
edit_saveas_button=new QPushButton(this);
edit_saveas_button->setFont(buttonFont());
edit_saveas_button->setText(tr("Save As\nNew"));
connect(edit_saveas_button,SIGNAL(clicked()),this,SLOT(saveasData()));
if(adds==NULL) {
button->hide();
edit_saveas_button->hide();
}
//
// Ok Button
//
button=new QPushButton(this);
button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
button->setDefault(true);
button->setFont(buttonFont());
button->setText(tr("OK"));
connect(button,SIGNAL(clicked()),this,SLOT(okData()));
edit_ok_button=new QPushButton(this);
edit_ok_button->setDefault(true);
edit_ok_button->setFont(buttonFont());
edit_ok_button->setText(tr("OK"));
connect(edit_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
//
// Cancel Button
//
button=new QPushButton(this);
button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
button->setFont(buttonFont());
button->setText(tr("Cancel"));
connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
edit_cancel_button=new QPushButton(this);
edit_cancel_button->setFont(buttonFont());
edit_cancel_button->setText(tr("Cancel"));
connect(edit_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
//
// Populate Data
//
PopulateDecks(edit_station_box);
edit_active_button->setChecked(edit_recording->isActive());
edit_event_widget->fromRecording(edit_recording->id());
edit_starttime_edit->setTime(edit_recording->startTime());
edit_description_edit->setText(edit_recording->description());
edit_starttype_group->button((int)edit_recording->startType())->
@@ -504,16 +381,11 @@ EditRecording::EditRecording(int id,std::vector<int> *adds,QString *filter,
edit_cutname=edit_recording->cutName();
edit_destination_edit->setText(RDCutPath(edit_cutname));
edit_mon_button->setChecked(edit_recording->mon());
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_dow_selector->fromRecording(edit_recording->id());
edit_startoffset_box->setValue(edit_recording->startdateOffset());
edit_endoffset_box->setValue(edit_recording->enddateOffset());
activateStationData(edit_station_box->currentIndex(),false);
locationChangedData(edit_event_widget->stationName(),
edit_event_widget->deckNumber());
QString source=GetSourceName(edit_recording->switchSource());
for(int i=0;i<edit_source_box->count();i++) {
@@ -554,7 +426,8 @@ EditRecording::EditRecording(int id,std::vector<int> *adds,QString *filter,
EditRecording::~EditRecording()
{
delete edit_cut_dialog;
delete edit_station_box;
delete edit_event_widget;
delete edit_dow_selector;
if(edit_deck!=NULL) {
delete edit_deck;
}
@@ -564,7 +437,6 @@ EditRecording::~EditRecording()
QSize EditRecording::sizeHint() const
{
return QSize(560,619);
// return QSize(540,619);
}
@@ -574,28 +446,20 @@ QSizePolicy EditRecording::sizePolicy() const
}
void EditRecording::activateStationData(int id,bool use_temp)
void EditRecording::locationChangedData(const QString &station,int decknum)
{
QString sql;
RDSqlQuery *q;
if(edit_station_box->currentText().isEmpty()) {
return;
}
QString temp=edit_source_box->currentText();
QStringList f0=edit_station_box->currentText().split(":");
if(edit_deck!=NULL) {
delete edit_deck;
}
edit_deck=new RDDeck(f0[0],f0[1].left(f0[1].length()-1).toInt());
edit_deck=new RDDeck(station,decknum);
if(edit_channels_box->count()>0) {
edit_channels_box->setCurrentIndex(edit_deck->defaultChannels()-1);
}
edit_source_box->clear();
sql=QString("select `NAME` from `INPUTS` where ")+
QString sql=QString("select `NAME` from `INPUTS` where ")+
"(`STATION_NAME`='"+RDEscapeString(edit_deck->switchStation())+"')&&"+
QString().sprintf("(`MATRIX`=%d)",edit_deck->switchMatrix());
q=new RDSqlQuery(sql);
RDSqlQuery *q=new RDSqlQuery(sql);
while(q->next()) {
edit_source_box->
insertItem(edit_source_box->count(),q->value(0).toString());
@@ -631,7 +495,7 @@ void EditRecording::startTypeClickedData(int id)
edit_start_endwindow_edit->setDisabled(state);
edit_start_endwindow_label->setDisabled(state);
edit_startoffset_edit->setDisabled(state);
edit_startoffset_label->setDisabled(state);
edit_startoffset_time_label->setDisabled(state);
edit_startmatrix_spin->setDisabled(state);
edit_startmatrix_label->setDisabled(state);
edit_startline_spin->setDisabled(state);
@@ -732,6 +596,93 @@ void EditRecording::cancelData()
}
void EditRecording::resizeEvent(QResizeEvent *e)
{
edit_event_widget->setGeometry(10,11,edit_event_widget->sizeHint().width(),
edit_event_widget->sizeHint().height());
//
// Start Parameters
//
edit_start_groupbox->setGeometry(10,37,size().width()-20,105);
edit_start_hardtime_radio->setGeometry(20,57,110,15);
edit_starttime_edit->setGeometry(255,53,80,20);
edit_starttime_label->setGeometry(135,57,115,15);
edit_start_gpi_radio->setGeometry(20,81,100,15);
edit_start_startwindow_edit->setGeometry(255,77,80,20);
edit_start_startwindow_label->setGeometry(135,81,115,15);
edit_start_endwindow_edit->setGeometry(455,77,80,20);
edit_start_endwindow_label->setGeometry(345,81,105,15);
edit_startmatrix_spin->setGeometry(185,99,35,20);
edit_startmatrix_label->setGeometry(100,100,80,20);
edit_startline_spin->setGeometry(305,99,35,20);
edit_startline_label->setGeometry(240,100,60,20);
edit_startoffset_edit->setGeometry(455,99,80,20);
edit_startoffset_time_label->setGeometry(345,100,105,20);
edit_multirec_box->setGeometry(140,124,size().width()-170,15);
//
// End Parameters
//
edit_end_groupbox->setGeometry(10,160,size().width()-20,112);
edit_end_length_radio->setGeometry(20,205,100,15);
edit_endlength_edit->setGeometry(245,201,80,20);
edit_endlength_label->setGeometry(125,205,115,15);
edit_end_hardtime_radio->setGeometry(20,181,1100,15);
edit_endtime_edit->setGeometry(245,177,80,20);
edit_endtime_label->setGeometry(125,181,115,15);
edit_end_gpi_radio->setGeometry(20,229,100,15);
edit_end_startwindow_edit->setGeometry(245,225,80,20);
edit_end_startwindow_label->setGeometry(125,229,115,15);
edit_end_endwindow_edit->setGeometry(455,225,80,20);
edit_end_endwindow_label->setGeometry(345,229,105,15);
edit_endmatrix_spin->setGeometry(185,247,35,20);
edit_endmatrix_label->setGeometry(100,248,80,20);
edit_endline_spin->setGeometry(295,247,35,20);
edit_endline_label->setGeometry(230,248,60,20);
edit_maxlength_edit->setGeometry(455,247,80,20);
edit_maxlength_label->setGeometry(325,248,125,20);
edit_description_edit->setGeometry(105,291,size().width()-115,20);
edit_description_label->setGeometry(10,291,90,20);
edit_source_box->setGeometry(105,317,size().width()-115,24);
edit_source_label->setGeometry(10,317,90,24);
edit_destination_edit->setGeometry(105,345,size().width()-185,20);
edit_destination_label->setGeometry(10,345,90,20);
edit_destination_button->setGeometry(size().width()-70,344,60,24);
edit_channels_label->setGeometry(120,370,70,20);
edit_channels_box->setGeometry(190,370,40,20);
edit_autotrim_box->setGeometry(120,395,100,15);
edit_autotrim_label->setGeometry(220,393,40,20);
edit_autotrim_spin->setGeometry(265,393,50,20);
edit_autotrim_unit->setGeometry(320,393,40,20);
edit_normalize_box->setGeometry(120,420,100,15);
edit_normalize_label->setGeometry(220,418,40,20);
edit_normalize_spin->setGeometry(265,418,50,20);
edit_normalize_unit->setGeometry(320,418,40,20);
edit_dow_selector->setGeometry(30,442,edit_dow_selector->sizeHint().width(),
edit_dow_selector->sizeHint().height());
edit_startoffset_box->setGeometry(140,516,55,24);
edit_startoffset_label->setGeometry(10,516,125,24);
edit_endoffset_box->setGeometry(440,516,55,24);
edit_endoffset_label->setGeometry(310,516,125,24);
edit_oneshot_box->setGeometry(20,553,125,15);
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 EditRecording::keyPressEvent(QKeyEvent *e)
{
switch(e->key()) {
@@ -753,65 +704,12 @@ void EditRecording::closeEvent(QCloseEvent *e)
}
void EditRecording::PopulateDecks(QComboBox *box)
{
int count=0;
box->clear();
QString sql=QString("select ")+
"`STATION_NAME`,"+ // 00
"`CHANNEL` "+ // 01
"from `DECKS` where "+
"(`CARD_NUMBER`!=-1)&&"+
"(`PORT_NUMBER`!=-1)&&"+
"(`CHANNEL`!=0)&&"+
"(`CHANNEL`<9) "+
"order by `STATION_NAME`,`CHANNEL`";
RDSqlQuery *q=new RDSqlQuery(sql);
while(q->next()) {
box->insertItem(box->count(),q->value(0).toString()+
QString().sprintf(" : %dR",q->value(1).toInt()));
if((q->value(0).toString()==edit_recording->station())&&
(q->value(1).toUInt()==edit_recording->channel())) {
box->setCurrentIndex(count);
}
count++;
}
if(q->size()>0) {
if(edit_deck!=NULL) {
delete edit_deck;
}
q->first();
edit_deck=new RDDeck(q->value(0).toString(),q->value(1).toUInt());
if(edit_channels_box->count()>0) {
edit_channels_box->setCurrentIndex(edit_deck->defaultChannels()-1);
}
}
delete q;
if(box->count()==0) { // In case the deck has been disabled
box->insertItem(box->count(),edit_recording->station()+
QString().sprintf(" : %dR",edit_recording->channel()));
}
}
void EditRecording::Save()
{
int chan=-1;
QString station=GetLocation(&chan);
edit_recording->setIsActive(edit_active_button->isChecked());
edit_recording->setStation(station);
edit_recording->setType(RDRecording::Recording);
edit_recording->setChannel(chan);
edit_event_widget->toRecording(edit_recording->id());
edit_recording->setDescription(edit_description_edit->text());
edit_recording->setCutName(edit_cutname);
edit_recording->setMon(edit_mon_button->isChecked());
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_dow_selector->toRecording(edit_recording->id());
edit_recording->setSwitchSource(GetSource());
edit_recording->setStartdateOffset(edit_startoffset_box->value());
edit_recording->setEnddateOffset(edit_endoffset_box->value());
@@ -1011,10 +909,10 @@ bool EditRecording::CheckEvent(bool include_myself)
//
// Verify that the GPI values are valid
//
QStringList f0=edit_station_box->currentText().split(":");
switch((RDRecording::StartType)edit_starttype_group->checkedId()) {
case RDRecording::GpiStart:
matrix=new RDMatrix(f0[0],edit_startmatrix_spin->value());
matrix=new RDMatrix(edit_event_widget->stationName(),
edit_startmatrix_spin->value());
if(!matrix->exists()) {
QMessageBox::warning(this,tr("Record Parameter Error"),
tr("The start GPI matrix doesn't exist!"));
@@ -1036,7 +934,8 @@ bool EditRecording::CheckEvent(bool include_myself)
}
switch((RDRecording::EndType)edit_endtype_group->checkedId()) {
case RDRecording::GpiEnd:
matrix=new RDMatrix(f0[0],edit_endmatrix_spin->value());
matrix=new RDMatrix(edit_event_widget->stationName(),
edit_endmatrix_spin->value());
if(!matrix->exists()) {
QMessageBox::warning(this,tr("Record Parameter Error"),
tr("The end GPI matrix doesn't exist!"));
@@ -1057,10 +956,10 @@ bool EditRecording::CheckEvent(bool include_myself)
}
QString sql=QString("select `ID` from `RECORDINGS` where ")+
"(`STATION_NAME`='"+RDEscapeString(f0[0])+"')&&"+
"(`STATION_NAME`='"+RDEscapeString(edit_event_widget->stationName())+"')&&"+
QString().sprintf("(`TYPE`=%d)&&",RDRecording::Recording)+
"(`START_TIME`='"+RDEscapeString(edit_starttime_edit->time().toString("hh:mm:ss"))+"')&&"+
QString().sprintf("(`CHANNEL`=%d)",f0[1].toInt());
QString().sprintf("(`CHANNEL`=%d)",edit_event_widget->deckNumber());
switch((RDRecording::StartType)edit_starttype_group->checkedId()) {
case RDRecording::HardStart:
break;
@@ -1071,25 +970,25 @@ bool EditRecording::CheckEvent(bool include_myself)
edit_startline_spin->value());
break;
}
if(edit_sun_button->isChecked()) {
if(edit_dow_selector->dayOfWeekEnabled(7)) {
sql+="&&(`SUN`='Y')";
}
if(edit_mon_button->isChecked()) {
if(edit_dow_selector->dayOfWeekEnabled(1)) {
sql+="&&(`MON`='Y')";
}
if(edit_tue_button->isChecked()) {
if(edit_dow_selector->dayOfWeekEnabled(2)) {
sql+="&&(`TUE`='Y')";
}
if(edit_wed_button->isChecked()) {
if(edit_dow_selector->dayOfWeekEnabled(3)) {
sql+="&&(`WED`='Y')";
}
if(edit_thu_button->isChecked()) {
if(edit_dow_selector->dayOfWeekEnabled(4)) {
sql+="&&(`THU`='Y')";
}
if(edit_fri_button->isChecked()) {
if(edit_dow_selector->dayOfWeekEnabled(5)) {
sql+="&&(`FRI`='Y')";
}
if(edit_sat_button->isChecked()) {
if(edit_dow_selector->dayOfWeekEnabled(6)) {
sql+="&&(`SAT`='Y')";
}
if(!include_myself) {
@@ -1141,12 +1040,3 @@ int EditRecording::GetSource()
delete q;
return source;
}
QString EditRecording::GetLocation(int *chan) const
{
QStringList f0=edit_station_box->currentText().split(":");
*chan=
f0[1].trimmed().left(f0[1].trimmed().length()-1).toInt();
return f0[0].trimmed();
}