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>
* Added a 'Trans' column to the 'Imported Events' list in the
'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()
{
QList<QVariant> texts;

View File

@ -2,7 +2,7 @@
//
// 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
// 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;
int lineId(const QModelIndex &row) const;
void refresh();
void clear();
protected:
void updateModel();

View File

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

View File

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

View File

@ -33,30 +33,16 @@
#include "globals.h"
#include "test_import.h"
TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
TestImport::TestImport(QWidget *parent)
: RDDialog(parent)
{
QString sql;
QDate current_date=QDate::currentDate();
test_svc=svc;
test_src=src;
//
// Fix the Window Size
//
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
//
@ -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->setFont(labelFont());
test_date_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
test_date_edit->setDate(current_date);
connect(test_date_edit,SIGNAL(dateChanged(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->setFont(subButtonFont());
button->setText(tr("Select"));
test_date_edit->setDate(QDate::currentDate());
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->setText(tr("Close"));
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()
{
RDDateDialog *datedialog=
@ -171,9 +177,11 @@ void TestImport::importData()
void TestImport::dateChangedData(const QDate &date)
{
if(test_svc!=NULL) {
test_filename_edit->
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
//
// (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
// it under the terms of the GNU General Public License version 2 as
@ -35,11 +35,14 @@ class TestImport : public RDDialog
{
Q_OBJECT
public:
TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent=0);
TestImport(QWidget *parent=0);
~TestImport();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
public slots:
int exec(RDSvc *svc,RDSvc::ImportSource src);
private slots:
void selectData();
void importData();