2021-02-14 Fred Gleason <fredg@paravelsystems.com>

* Reenabled the 'Import' button on the 'Scheduler Rules' dialog
	in rdlogmanager(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-02-14 13:50:50 -05:00
parent ef9e33ca12
commit 621888ee46
12 changed files with 90 additions and 91 deletions

View File

@@ -21118,3 +21118,6 @@
2021-02-14 Fred Gleason <fredg@paravelsystems.com> 2021-02-14 Fred Gleason <fredg@paravelsystems.com>
* Removed 'Q3Frame' dependencies from rdcatch(1). * Removed 'Q3Frame' dependencies from rdcatch(1).
* Removed 'Q3ScrollView' dependencies from rdcatch(1). * Removed 'Q3ScrollView' dependencies from rdcatch(1).
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
* Reenabled the 'Import' button on the 'Scheduler Rules' dialog
in rdlogmanager(1).

View File

@@ -90,23 +90,10 @@ EditSchedRules::EditSchedRules(QString clock,unsigned *artistsep,
edit_schedcodes_view,SLOT(resizeColumnsToContents())); edit_schedcodes_view,SLOT(resizeColumnsToContents()));
edit_schedcodes_view->resizeColumnsToContents(); edit_schedcodes_view->resizeColumnsToContents();
/*
edit_schedcodes_view=new RDListView(this);
edit_schedcodes_view->setAllColumnsShowFocus(true);
edit_schedcodes_view->addColumn(tr("CODE"));
edit_schedcodes_view->addColumn(tr("MAX. IN A ROW"));
edit_schedcodes_view->addColumn(tr("MIN. WAIT"));
edit_schedcodes_view->addColumn(tr("DO NOT SCHEDULE AFTER"));
edit_schedcodes_view->addColumn(tr("OR AFTER"));
edit_schedcodes_view->addColumn(tr("OR AFTER"));
edit_schedcodes_view->addColumn(tr("DESCRIPTION"));
*/
list_box_label= list_box_label=
new QLabel(edit_schedcodes_view,tr("Scheduler Codes:"),this); new QLabel(edit_schedcodes_view,tr("Scheduler Codes:"),this);
list_box_label->setFont(labelFont()); list_box_label->setFont(labelFont());
edit_modified=false; edit_modified=false;
// Load();
} }
@@ -139,76 +126,79 @@ void EditSchedRules::editData()
if(list_editrules_dialog->exec(edit_schedcodes_model->ruleId(rows.first()))) { if(list_editrules_dialog->exec(edit_schedcodes_model->ruleId(rows.first()))) {
edit_schedcodes_model->refresh(rows.first()); edit_schedcodes_model->refresh(rows.first());
} }
/*
RDListViewItem *item=(RDListViewItem *)edit_schedcodes_view->selectedItem();
if(item==NULL) {
return;
}
EditSchedCodeRules *edit_CodeRules=
new EditSchedCodeRules(item,edit_sched_rules_list,this);
if(edit_CodeRules->exec()>=0)
{
edit_modified=true;
}
delete edit_CodeRules;
edit_CodeRules=NULL;
*/
} }
void EditSchedRules::importData() void EditSchedRules::importData()
{ {
/* QString src_clockname;
QModelIndexList rows=edit_schedcodes_view->selectionModel()->selectedRows();
if(rows.size()!=1) {
return;
}
// RDListViewItem *item;
QString sql; QString sql;
RDSqlQuery *q; RDSqlQuery *q;
ListClocks *listclocks=new ListClocks(&clockname,this); ListClocks *listclocks=new ListClocks(&src_clockname,this);
listclocks->setWindowTitle("RDLogManager - "+tr("Import Rules from Clock")); listclocks->setWindowTitle("RDLogManager - "+tr("Import Rules from Clock"));
if(!listclocks->exec()) { if(!listclocks->exec()<0) {
delete listclocks; delete listclocks;
return; return;
} }
delete listclocks; delete listclocks;
sql=QString("select ")+ sql=QString("select ")+
" "ID,"+ // 00
RDSchedRulesList *import_list=new RDSchedRulesList(clockname,rda->config()); "CODE,"+ // 01
"MAX_ROW,"+ // 02
"MIN_WAIT,"+ // 03
"NOT_AFTER,"+ // 04
"OR_AFTER,"+ // 05
"OR_AFTER_II "+ // 06
"from RULE_LINES where "+
"CLOCK_NAME=\""+RDEscapeString(src_clockname)+"\" "+
"order by CODE";
edit_schedcodes_view->clear();
for (int i=0; i<import_list->getNumberOfItems(); i++)
{
item=new RDListViewItem(edit_schedcodes_view);
item->setId(i);
item->setText(0,import_list->getItemSchedCode(i));
str=QString().sprintf("%d",import_list->getItemMaxRow(i));
item->setText(1,str);
str=QString().sprintf("%d",import_list->getItemMinWait(i));
item->setText(2,str);
item->setText(3,import_list->getItemNotAfter(i));
item->setText(4,import_list->getItemOrAfter(i));
item->setText(5,import_list->getItemOrAfterII(i));
item->setText(6,import_list->getItemDescription(i));
}
delete import_list;
sql=QString("select ARTISTSEP from CLOCKS where ")+
"NAME=\""+RDEscapeString(clockname)+"\"";
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
if (q->first()) while(q->next()) {
{ sql=QString("update RULE_LINES set ");
*edit_artistsep=q->value(0).toUInt(); if(q->value(2).isNull()) {
// edit_artist_sep_spin->setValue(*edit_artistsep); sql+="MAX_ROW=null,";
} }
delete q; else {
edit_modified=true; sql+=QString().sprintf("MAX_ROW=%u,",q->value(2).toUInt());
*/ }
if(q->value(3).isNull()) {
sql+="MIN_WAIT=null,";
}
else {
sql+=QString().sprintf("MIN_WAIT=%u,",q->value(3).toUInt());
}
if(q->value(4).isNull()) {
sql+="NOT_AFTER=null,";
}
else {
sql+="NOT_AFTER=\""+RDEscapeString(q->value(4).toString())+"\",";
}
if(q->value(5).isNull()) {
sql+="OR_AFTER=null,";
}
else {
sql+="OR_AFTER=\""+RDEscapeString(q->value(5).toString())+"\",";
}
if(q->value(6).isNull()) {
sql+="OR_AFTER_II=null ";
}
else {
sql+="OR_AFTER_II=\""+RDEscapeString(q->value(6).toString())+"\" ";
}
sql+=QString("where ")+
"CLOCK_NAME=\""+RDEscapeString(edit_clockname)+"\" && "+
"CODE=\""+RDEscapeString(q->value(1).toString())+"\"";
RDSqlQuery::apply(sql);
}
delete q;
edit_schedcodes_model->refresh();
} }
@@ -242,26 +232,3 @@ void EditSchedRules::resizeEvent(QResizeEvent *e)
list_close_button->setGeometry(size().width()-90,size().height()-60,80,50); list_close_button->setGeometry(size().width()-90,size().height()-60,80,50);
} }
/*
void EditSchedRules::Load()
{
QString str;
RDListViewItem *item;
edit_schedcodes_view->clear();
for (int i=0; i<edit_sched_rules_list->getNumberOfItems(); i++) {
item=new RDListViewItem(edit_schedcodes_view);
item->setId(i);
item->setText(0,edit_sched_rules_list->getItemSchedCode(i));
str=QString().sprintf("%d",edit_sched_rules_list->getItemMaxRow(i));
item->setText(1,str);
str=QString().sprintf("%d",edit_sched_rules_list->getItemMinWait(i));
item->setText(2,str);
item->setText(3,edit_sched_rules_list->getItemNotAfter(i));
item->setText(4,edit_sched_rules_list->getItemOrAfter(i));
item->setText(5,edit_sched_rules_list->getItemOrAfterII(i));
item->setText(6,edit_sched_rules_list->getItemDescription(i));
}
}
*/

View File

@@ -52,9 +52,7 @@ class EditSchedRules : public RDDialog
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
private: private:
// void Load();
QLabel *list_box_label; QLabel *list_box_label;
// RDListView *edit_schedcodes_view;
RDTableView *edit_schedcodes_view; RDTableView *edit_schedcodes_view;
SchedRulesModel *edit_schedcodes_model; SchedRulesModel *edit_schedcodes_model;
QString edit_clockname; QString edit_clockname;

View File

@@ -845,6 +845,10 @@ Chcete je uložit?</translation>
<source>&amp;Close</source> <source>&amp;Close</source>
<translation type="unfinished">&amp;Zavřít</translation> <translation type="unfinished">&amp;Zavřít</translation>
</message> </message>
<message>
<source>Import Rules from Clock</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditTrack</name> <name>EditTrack</name>

View File

@@ -845,6 +845,10 @@ Wollen Sie sie speichern?</translation>
<source>&amp;Close</source> <source>&amp;Close</source>
<translation type="unfinished">&amp;Schliessen</translation> <translation type="unfinished">&amp;Schliessen</translation>
</message> </message>
<message>
<source>Import Rules from Clock</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditTrack</name> <name>EditTrack</name>

View File

@@ -845,7 +845,7 @@ Do you want to save?</source>
</message> </message>
<message> <message>
<source>Import Rules from Clock</source> <source>Import Rules from Clock</source>
<translation type="obsolete">Importar reglas desde Torta</translation> <translation type="unfinished">Importar reglas desde Torta</translation>
</message> </message>
<message> <message>
<source>None</source> <source>None</source>

View File

@@ -596,6 +596,10 @@ already existing event.</source>
<source>&amp;Close</source> <source>&amp;Close</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Import Rules from Clock</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditTrack</name> <name>EditTrack</name>

View File

@@ -842,6 +842,10 @@ Vil du lagra?</translation>
<source>&amp;Close</source> <source>&amp;Close</source>
<translation type="unfinished">&amp;Lukk</translation> <translation type="unfinished">&amp;Lukk</translation>
</message> </message>
<message>
<source>Import Rules from Clock</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditTrack</name> <name>EditTrack</name>

View File

@@ -842,6 +842,10 @@ Vil du lagra?</translation>
<source>&amp;Close</source> <source>&amp;Close</source>
<translation type="unfinished">&amp;Lukk</translation> <translation type="unfinished">&amp;Lukk</translation>
</message> </message>
<message>
<source>Import Rules from Clock</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditTrack</name> <name>EditTrack</name>

View File

@@ -847,6 +847,10 @@ Você quer salvar?</translation>
<source>&amp;Close</source> <source>&amp;Close</source>
<translation type="unfinished">&amp;Fechar</translation> <translation type="unfinished">&amp;Fechar</translation>
</message> </message>
<message>
<source>Import Rules from Clock</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditTrack</name> <name>EditTrack</name>

View File

@@ -153,6 +153,12 @@ unsigned SchedRulesModel::ruleId(const QModelIndex &row) const
} }
void SchedRulesModel::refresh()
{
updateModel();
}
void SchedRulesModel::refresh(const QModelIndex &row) void SchedRulesModel::refresh(const QModelIndex &row)
{ {
if(row.row()<d_texts.size()) { if(row.row()<d_texts.size()) {

View File

@@ -43,6 +43,7 @@ class SchedRulesModel : public QAbstractTableModel
int role=Qt::DisplayRole) const; int role=Qt::DisplayRole) const;
QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const; QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const;
unsigned ruleId(const QModelIndex &row) const; unsigned ruleId(const QModelIndex &row) const;
void refresh();
void refresh(const QModelIndex &row); void refresh(const QModelIndex &row);
void refresh(unsigned id); void refresh(unsigned id);