2022-10-14 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in the 'Test Music Import' dialog that caused
	the 'Imported Events' list to fail to be cleared when starting a
	new test.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-10-15 13:54:19 -04:00
parent ad31135bde
commit 5aacb1f6e7
7 changed files with 59 additions and 29 deletions

View File

@@ -23511,3 +23511,7 @@
2022-10-14 Fred Gleason <fredg@paravelsystems.com> 2022-10-14 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Trans' column to the 'Imported Events' list in the * Added a 'Trans' column to the 'Imported Events' list in the
'Test Music Import' list in rdadmin(1). 'Test Music Import' list in rdadmin(1).
2022-10-14 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in the 'Test Music Import' dialog that caused
the 'Imported Events' list to fail to be cleared when starting a
new test.

View File

@@ -168,6 +168,16 @@ void RDLogImportModel::refresh()
} }
void RDLogImportModel::clear()
{
beginResetModel();
d_texts.clear();
d_icons.clear();
d_ids.clear();
endResetModel();
}
void RDLogImportModel::updateModel() void RDLogImportModel::updateModel()
{ {
QList<QVariant> texts; QList<QVariant> texts;

View File

@@ -2,7 +2,7 @@
// //
// Data model for Rivendell log imports // Data model for Rivendell log imports
// //
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2021-2022 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@@ -46,6 +46,7 @@ class RDLogImportModel : public QAbstractTableModel
QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const; QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const;
int lineId(const QModelIndex &row) const; int lineId(const QModelIndex &row) const;
void refresh(); void refresh();
void clear();
protected: protected:
void updateModel(); void updateModel();

View File

@@ -58,6 +58,11 @@ EditSvc::EditSvc(QString svc,QWidget *parent)
RDIdValidator *log_validator=new RDIdValidator(this); RDIdValidator *log_validator=new RDIdValidator(this);
log_validator->addBannedChar(' '); log_validator->addBannedChar(' ');
//
// Dialogs
//
svc_test_import_dialog=new TestImport(this);
// //
// General Section // General Section
// //
@@ -583,6 +588,7 @@ EditSvc::~EditSvc()
{ {
delete svc_name_edit; delete svc_name_edit;
delete svc_description_edit; delete svc_description_edit;
delete svc_test_import_dialog;
} }
@@ -754,9 +760,7 @@ void EditSvc::TestDataImport(RDSvc::ImportSource src)
} }
Save(); Save();
} }
TestImport *testimport=new TestImport(svc_svc,src,this); svc_test_import_dialog->exec(svc_svc,src);
testimport->exec();
delete testimport;
} }

View File

@@ -31,6 +31,7 @@
#include <rdsvc.h> #include <rdsvc.h>
#include "importfields.h" #include "importfields.h"
#include "test_import.h"
class EditSvc : public RDDialog class EditSvc : public RDDialog
{ {
@@ -63,9 +64,7 @@ class EditSvc : public RDDialog
QLineEdit *svc_program_code_edit; QLineEdit *svc_program_code_edit;
QLineEdit *svc_name_template_edit; QLineEdit *svc_name_template_edit;
QLineEdit *svc_description_template_edit; QLineEdit *svc_description_template_edit;
QComboBox *svc_bypass_box; QComboBox *svc_bypass_box;
QComboBox *svc_sub_event_inheritance_box; QComboBox *svc_sub_event_inheritance_box;
QComboBox *svc_voice_group_box; QComboBox *svc_voice_group_box;
QComboBox *svc_autospot_group_box; QComboBox *svc_autospot_group_box;
@@ -95,6 +94,7 @@ class EditSvc : public RDDialog
QPushButton *svc_tfc_copy_button; QPushButton *svc_tfc_copy_button;
QPushButton *svc_mus_copy_button; QPushButton *svc_mus_copy_button;
bool import_changed; bool import_changed;
TestImport *svc_test_import_dialog;
}; };

View File

@@ -33,30 +33,16 @@
#include "globals.h" #include "globals.h"
#include "test_import.h" #include "test_import.h"
TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent) TestImport::TestImport(QWidget *parent)
: RDDialog(parent) : RDDialog(parent)
{ {
QString sql; QString sql;
QDate current_date=QDate::currentDate();
test_svc=svc;
test_src=src;
// //
// Fix the Window Size // Fix the Window Size
// //
setMinimumSize(sizeHint()); setMinimumSize(sizeHint());
switch(test_src) {
case RDSvc::Traffic:
setWindowTitle("RDAdmin - "+tr("Test Traffic Import"));
break;
case RDSvc::Music:
setWindowTitle("RDAdmin - "+tr("Test Music Import"));
break;
}
// //
// Date Selector // Date Selector
// //
@@ -64,7 +50,6 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
test_date_label=new QLabel(tr("Test Date:"),this); test_date_label=new QLabel(tr("Test Date:"),this);
test_date_label->setFont(labelFont()); test_date_label->setFont(labelFont());
test_date_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); test_date_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
test_date_edit->setDate(current_date);
connect(test_date_edit,SIGNAL(dateChanged(const QDate &)), connect(test_date_edit,SIGNAL(dateChanged(const QDate &)),
this,SLOT(dateChangedData(const QDate &))); this,SLOT(dateChangedData(const QDate &)));
@@ -75,6 +60,7 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
button->setGeometry(200,5,60,30); button->setGeometry(200,5,60,30);
button->setFont(subButtonFont()); button->setFont(subButtonFont());
button->setText(tr("Select")); button->setText(tr("Select"));
test_date_edit->setDate(QDate::currentDate());
connect(button,SIGNAL(clicked()),this,SLOT(selectData())); connect(button,SIGNAL(clicked()),this,SLOT(selectData()));
// //
@@ -114,8 +100,6 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
test_close_button->setFont(buttonFont()); test_close_button->setFont(buttonFont());
test_close_button->setText(tr("Close")); test_close_button->setText(tr("Close"));
connect(test_close_button,SIGNAL(clicked()),this,SLOT(closeData())); connect(test_close_button,SIGNAL(clicked()),this,SLOT(closeData()));
dateChangedData(current_date);
} }
@@ -136,6 +120,28 @@ QSizePolicy TestImport::sizePolicy() const
} }
int TestImport::exec(RDSvc *svc,RDSvc::ImportSource src)
{
test_svc=svc;
test_src=src;
switch(test_src) {
case RDSvc::Traffic:
setWindowTitle("RDAdmin - "+tr("Test Traffic Import"));
break;
case RDSvc::Music:
setWindowTitle("RDAdmin - "+tr("Test Music Import"));
break;
}
test_events_model->clear();
dateChangedData(test_date_edit->date());
return QDialog::exec();
}
void TestImport::selectData() void TestImport::selectData()
{ {
RDDateDialog *datedialog= RDDateDialog *datedialog=
@@ -171,9 +177,11 @@ void TestImport::importData()
void TestImport::dateChangedData(const QDate &date) void TestImport::dateChangedData(const QDate &date)
{ {
test_filename_edit-> if(test_svc!=NULL) {
setText(RDDateDecode(test_svc->importPath(test_src),date, test_filename_edit->
rda->station(),rda->config(),test_svc->name())); setText(RDDateDecode(test_svc->importPath(test_src),date,
rda->station(),rda->config(),test_svc->name()));
}
} }

View File

@@ -2,7 +2,7 @@
// //
// Test a Rivendell Log Import // Test a Rivendell Log Import
// //
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@@ -35,11 +35,14 @@ class TestImport : public RDDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent=0); TestImport(QWidget *parent=0);
~TestImport(); ~TestImport();
QSize sizeHint() const; QSize sizeHint() const;
QSizePolicy sizePolicy() const; QSizePolicy sizePolicy() const;
public slots:
int exec(RDSvc *svc,RDSvc::ImportSource src);
private slots: private slots:
void selectData(); void selectData();
void importData(); void importData();