Merge branch 'deltecent-rdlibrary'

This commit is contained in:
Fred Gleason 2019-05-09 16:38:11 -04:00
commit 5aa95b30ac
12 changed files with 161 additions and 13 deletions

View File

@ -18652,3 +18652,6 @@
2019-05-09 Patrick Linstruth <patrick@deltecent.com> 2019-05-09 Patrick Linstruth <patrick@deltecent.com>
* Fixed bug in clock schedule rules where "or After" schedule codes * Fixed bug in clock schedule rules where "or After" schedule codes
were not displayed correctly. were not displayed correctly.
2019-05-09 Patrick Linstruth <patrick@deltecent.com>
* Added second schedule code filter to rdlibrary(1).
* Change rdlibrary(1) minimum width from 850 to 1000.

View File

@ -116,6 +116,18 @@ QString RDSchedSearchText(const QString &schedcode)
} }
QString RDSchedSearchText(const QStringList &schedcodes)
{
QString ret="";
for(int i=0;i<schedcodes.size();i++) {
ret+=QString().sprintf(" inner join CART_SCHED_CODES as S%d on (CART.NUMBER=S%d.CART_NUMBER and S%d.SCHED_CODE='%s')",i,i,i,(const char *)schedcodes.at(i));
}
return ret;
}
QString RDCartSearchText(QString filter,const QString &group, QString RDCartSearchText(QString filter,const QString &group,
const QString &schedcode,bool incl_cuts) const QString &schedcode,bool incl_cuts)
{ {
@ -130,6 +142,20 @@ QString RDCartSearchText(QString filter,const QString &group,
return ret; return ret;
} }
QString RDCartSearchText(QString filter,const QString &group,
const QStringList &schedcodes,bool incl_cuts)
{
QString ret="";
ret+=RDSchedSearchText(schedcodes);
ret+=QString(" where ")+RDBaseSearchText(filter,incl_cuts);
if(!group.isEmpty()) {
ret+=QString("&&(CART.GROUP_NAME=\"")+RDEscapeString(group)+"\")";
}
return ret;
}
QString RDAllCartSearchText(const QString &filter,const QString &schedcode, QString RDAllCartSearchText(const QString &filter,const QString &schedcode,
const QString &user,bool incl_cuts) const QString &user,bool incl_cuts)
@ -153,3 +179,25 @@ QString RDAllCartSearchText(const QString &filter,const QString &schedcode,
return search; return search;
} }
QString RDAllCartSearchText(const QString &filter,const QStringList &schedcodes,
const QString &user,bool incl_cuts)
{
QString sql;
RDSqlQuery *q;
QString search="";
search+=RDSchedSearchText(schedcodes);
search+=" where (";
sql=QString("select GROUP_NAME from USER_PERMS where ")+
"USER_NAME=\""+RDEscapeString(user)+"\"";
q=new RDSqlQuery(sql);
while(q->next()) {
search+=QString("(CART.GROUP_NAME=\"")+
RDEscapeString(q->value(0).toString())+"\")||";
}
delete q;
search=search.left(search.length()-2)+QString(")");
search+=QString("&&")+RDBaseSearchText(filter,incl_cuts);
return search;
}

View File

@ -22,14 +22,19 @@
#define RDCART_SEARCH_TEXT_H #define RDCART_SEARCH_TEXT_H
#include <qstring.h> #include <qstring.h>
#include <qstringlist.h>
#include <rdstation.h> #include <rdstation.h>
QString RDCartSearchText(QString filter,const QString &group, QString RDCartSearchText(QString filter,const QString &group,
const QString &schedcode,bool incl_cuts); const QString &schedcode,bool incl_cuts);
QString RDCartSearchText(QString filter,const QString &group,
const QStringList &schedcodes,bool incl_cuts);
QString RDAllCartSearchText(const QString &filter,const QString &schedcode, QString RDAllCartSearchText(const QString &filter,const QString &schedcode,
const QString &user,bool incl_cuts); const QString &user,bool incl_cuts);
QString RDAllCartSearchText(const QString &filter,const QStringList &schedcodes,
const QString &user,bool incl_cuts);
#endif // RDCART_SEARCH_TEXT_H #endif // RDCART_SEARCH_TEXT_H

View File

@ -249,6 +249,26 @@ MainWidget::MainWidget(QWidget *parent)
connect(lib_codes_box,SIGNAL(activated(const QString &)), connect(lib_codes_box,SIGNAL(activated(const QString &)),
this,SLOT(groupActivatedData(const QString &))); this,SLOT(groupActivatedData(const QString &)));
//
// Scheduler Codes2 Filter
//
lib_codes2_box=new QComboBox(this);
lib_codes2_box->setFont(default_font);
lib_codes2_label=new QLabel(lib_codes2_box,tr("And Scheduler Code:"),this);
lib_codes2_label->setFont(button_font);
lib_codes2_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
connect(lib_codes2_box,SIGNAL(activated(const QString &)),
this,SLOT(groupActivatedData(const QString &)));
//
// Results Counter
//
lib_matches_edit=new QLineEdit(this);
lib_matches_edit->setFont(default_font);
lib_matches_edit->setReadOnly(true);
lib_matches_label=new QLabel(lib_matches_edit,tr("Matching Carts:"),this);
lib_matches_label->setFont(button_font);
// //
// Show Allow Cart Drags Checkbox // Show Allow Cart Drags Checkbox
// //
@ -525,7 +545,7 @@ MainWidget::MainWidget(QWidget *parent)
QSize MainWidget::sizeHint() const QSize MainWidget::sizeHint() const
{ {
return QSize(850,600); return QSize(1000,600);
} }
@ -581,10 +601,13 @@ void MainWidget::userData()
lib_codes_box->clear(); lib_codes_box->clear();
lib_codes_box->insertItem(tr("ALL")); lib_codes_box->insertItem(tr("ALL"));
lib_codes2_box->clear();
lib_codes2_box->insertItem(tr("ALL"));
sql=QString().sprintf("select CODE from SCHED_CODES"); sql=QString().sprintf("select CODE from SCHED_CODES");
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
while(q->next()) { while(q->next()) {
lib_codes_box->insertItem(q->value(0).toString()); lib_codes_box->insertItem(q->value(0).toString());
lib_codes2_box->insertItem(q->value(0).toString());
} }
delete q; delete q;
lib_search_button->setDisabled(true); lib_search_button->setDisabled(true);
@ -1129,16 +1152,20 @@ void MainWidget::resizeEvent(QResizeEvent *e)
lib_group_label->setGeometry(10,40,55,20); lib_group_label->setGeometry(10,40,55,20);
lib_codes_box->setGeometry(330,40,120,20); lib_codes_box->setGeometry(330,40,120,20);
lib_codes_label->setGeometry(195,40,130,20); lib_codes_label->setGeometry(195,40,130,20);
lib_allowdrag_box->setGeometry(470,42,15,15); lib_codes2_box->setGeometry(600,40,120,20);
lib_allowdrag_label->setGeometry(490,40,130,20); lib_codes2_label->setGeometry(460,40,130,20);
lib_matches_edit->setGeometry(835,40,65,20);
lib_matches_label->setGeometry(740,40,100,20);
lib_showmatches_box->setGeometry(740,67,15,15);
lib_showmatches_label->setGeometry(760,65,200,20);
lib_allowdrag_box->setGeometry(560,67,15,15);
lib_allowdrag_label->setGeometry(580,65,130,20);
lib_showaudio_box->setGeometry(70,67,15,15); lib_showaudio_box->setGeometry(70,67,15,15);
lib_showaudio_label->setGeometry(90,65,130,20); lib_showaudio_label->setGeometry(90,65,130,20);
lib_showmacro_box->setGeometry(230,67,15,15); lib_showmacro_box->setGeometry(230,67,15,15);
lib_showmacro_label->setGeometry(250,65,130,20); lib_showmacro_label->setGeometry(250,65,130,20);
lib_shownotes_box->setGeometry(390,67,15,15); lib_shownotes_box->setGeometry(390,67,15,15);
lib_shownotes_label->setGeometry(410,65,130,20); lib_shownotes_label->setGeometry(410,65,130,20);
lib_showmatches_box->setGeometry(550,67,15,15);
lib_showmatches_label->setGeometry(570,65,200,20);
lib_cart_list-> lib_cart_list->
setGeometry(10,90,e->size().width()-20,e->size().height()-155); setGeometry(10,90,e->size().width()-20,e->size().height()-155);
lib_add_button->setGeometry(10,e->size().height()-60,80,50); lib_add_button->setGeometry(10,e->size().height()-60,80,50);
@ -1394,14 +1421,16 @@ void MainWidget::RefreshList()
if(q->value(16).toUInt() > 1) { if(q->value(16).toUInt() > 1) {
RefreshCuts(l,q->value(0).toUInt()); RefreshCuts(l,q->value(0).toUInt());
} }
count++;
} }
cartnum=q->value(0).toUInt(); cartnum=q->value(0).toUInt();
if(count++>RDLIBRARY_STEP_SIZE) { if(count>RDLIBRARY_STEP_SIZE) {
lib_progress_dialog->setProgress(++step); lib_progress_dialog->setProgress(++step);
count=0; count=0;
qApp->processEvents(QEventLoop::ExcludeUserInputEvents); qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
} }
} }
lib_matches_edit->setText(QString().sprintf("%d",count));
UpdateItemColor(l,validity,end_datetime,current_datetime); UpdateItemColor(l,validity,end_datetime,current_datetime);
lib_progress_dialog->reset(); lib_progress_dialog->reset();
delete q; delete q;
@ -1413,18 +1442,21 @@ QString MainWidget::WhereClause() const
QString sql=""; QString sql="";
QString type_filter=GetTypeFilter(); QString type_filter=GetTypeFilter();
QString schedcode=""; QStringList schedcodes;
if(lib_codes_box->currentText()!=tr("ALL")) { if(lib_codes_box->currentText()!=tr("ALL")) {
schedcode=lib_codes_box->currentText(); schedcodes << lib_codes_box->currentText();
}
if(lib_codes2_box->currentText()!=tr("ALL")) {
schedcodes << lib_codes2_box->currentText();
} }
if(lib_group_box->currentText()==QString(tr("ALL"))) { if(lib_group_box->currentText()==QString(tr("ALL"))) {
sql+=RDAllCartSearchText(lib_filter_edit->text(),schedcode, sql=RDAllCartSearchText(lib_filter_edit->text(),schedcodes,
rda->user()->name(),true)+" && "+type_filter; rda->user()->name(),true)+" && "+type_filter;
} }
else { else {
sql+=RDCartSearchText(lib_filter_edit->text(),lib_group_box->currentText(), sql=RDCartSearchText(lib_filter_edit->text(),lib_group_box->currentText(),
schedcode,true)+" && "+type_filter; schedcodes,true)+" && "+type_filter;
} }
return sql; return sql;
@ -1698,10 +1730,10 @@ void MainWidget::SaveGeometry()
fprintf(file,"Height=%d\n",geometry().height()); fprintf(file,"Height=%d\n",geometry().height());
fprintf(file,"ShowNoteBubbles="); fprintf(file,"ShowNoteBubbles=");
if(lib_shownotes_box->isChecked()) { if(lib_shownotes_box->isChecked()) {
fprintf(file,"Yes\n"); fputs("Yes\n",file);
} }
else { else {
fprintf(file,"No\n"); fputs("No\n",file);
} }
fprintf(file,"AllowCartDragging="); fprintf(file,"AllowCartDragging=");
if(lib_allowdrag_box->isChecked()) { if(lib_allowdrag_box->isChecked()) {

View File

@ -130,6 +130,10 @@ class MainWidget : public QWidget
QLabel *lib_group_label; QLabel *lib_group_label;
QComboBox *lib_codes_box; QComboBox *lib_codes_box;
QLabel *lib_codes_label; QLabel *lib_codes_label;
QComboBox *lib_codes2_box;
QLabel *lib_codes2_label;
QLineEdit *lib_matches_edit;
QLabel *lib_matches_label;
QPushButton *lib_search_button; QPushButton *lib_search_button;
QPushButton *lib_clear_button; QPushButton *lib_clear_button;
QPushButton *lib_add_button; QPushButton *lib_add_button;

View File

@ -1487,6 +1487,14 @@ Přesto smazat?</translation>
&amp;Macro</source> &amp;Macro</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>And Scheduler Code:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Matching Carts:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RecordCut</name> <name>RecordCut</name>

View File

@ -1464,6 +1464,14 @@ verwendet. Trotzdem löschen?</translation>
&amp;Macro</source> &amp;Macro</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>And Scheduler Code:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Matching Carts:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RecordCut</name> <name>RecordCut</name>

View File

@ -1473,6 +1473,14 @@ Do you still want to delete it?</source>
&amp;Macro</source> &amp;Macro</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>And Scheduler Code:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Matching Carts:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RecordCut</name> <name>RecordCut</name>

View File

@ -1177,6 +1177,14 @@ Do you still want to delete it?</source>
&amp;Macro</source> &amp;Macro</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>And Scheduler Code:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Matching Carts:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RecordCut</name> <name>RecordCut</name>

View File

@ -1460,6 +1460,14 @@ Vil du sletta ho likevel?</translation>
&amp;Macro</source> &amp;Macro</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>And Scheduler Code:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Matching Carts:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RecordCut</name> <name>RecordCut</name>

View File

@ -1460,6 +1460,14 @@ Vil du sletta ho likevel?</translation>
&amp;Macro</source> &amp;Macro</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>And Scheduler Code:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Matching Carts:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RecordCut</name> <name>RecordCut</name>

View File

@ -1462,6 +1462,14 @@ Você ainda quer deletá-lo?</translation>
&amp;Macro</source> &amp;Macro</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>And Scheduler Code:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Matching Carts:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RecordCut</name> <name>RecordCut</name>