2016-03-23 Fred Gleason <fredg@paravelsystems.com>

* Added a 'CART.USE_WEIGHTING' field to the database.
	* Added a 'CUTS.PLAY_ORDER' field to the database.
	* Incremented the database version to 254.
	* Added a 'Schedule Cuts By' control to the Edit Cart dialog in
	'rdlibrary/edit_cart.cpp' and 'rdlibrary/edit_cart.h'.
	* Added 'RDCart::useWeighting()' and 'RDCart::setUseWeighting()'
	methods in 'lib/rdcart.cpp' and 'lib/rdcart.h'.
	* Added 'RDCut::playOrder()' and 'RDCut::setPlayOrder()' methods
	in 'lib/rdcut.cpp' and 'lib/rdcut.h'.
This commit is contained in:
Fred Gleason 2016-03-24 11:38:21 -04:00
parent 422dff4a15
commit 6d168b0a8f
23 changed files with 527 additions and 89 deletions

View File

@ -14967,3 +14967,13 @@
* Updated the package version to 2.11.0.
2016-03-20 Fred Gleason <fredg@paravelsystems.com>
* Added a switcher driver for the Broadcast Tools ADMS 44.22.
2016-03-23 Fred Gleason <fredg@paravelsystems.com>
* Added a 'CART.USE_WEIGHTING' field to the database.
* Added a 'CUTS.PLAY_ORDER' field to the database.
* Incremented the database version to 254.
* Added a 'Schedule Cuts By' control to the Edit Cart dialog in
'rdlibrary/edit_cart.cpp' and 'rdlibrary/edit_cart.h'.
* Added 'RDCart::useWeighting()' and 'RDCart::setUseWeighting()'
methods in 'lib/rdcart.cpp' and 'lib/rdcart.h'.
* Added 'RDCut::playOrder()' and 'RDCut::setPlayOrder()' methods
in 'lib/rdcut.cpp' and 'lib/rdcut.h'.

View File

@ -40,6 +40,7 @@ START_DATETIME datetime
END_DATETIME datetime
ENFORCE_LENGTH enum('N','Y') Timeshift?
PRESERVE_PITCH enum('N','Y') Preserve Pitch?
USE_WEIGHTING enum('N','Y')
ASYNCRONOUS enum('N','Y')
OWNER char(64) From LOGS.NAME or STATIONS.NAME
MACROS text RML Macros

View File

@ -29,6 +29,7 @@ FRI enum('N','Y')
SAT enum('N','Y')
ORIGIN_NAME char(64) Workstation ID where recorded
WEIGHT int(10) unsigned Relative airplay frequency, 1 = normal
PLAY_ORDER int(11) Play order when weighting disabled
LAST_PLAY_DATETIME datetime
UPLOAD_DATETIME datetime Copy-split upload timestamp
PLAY_COUNTER int(10) unsigned

View File

@ -26,7 +26,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 245
#define RD_VERSION_DATABASE 254
#endif // DBVERSION_H

View File

@ -112,23 +112,30 @@ bool RDCart::selectCut(QString *cut,const QTime &time) const
toString("yyyy-MM-dd hh:mm:ss");
QString time_str=QDateTime(current_date,time).toString("hh:mm:ss");
// if(type()==RDCart::Audio) {
switch(type()) {
case RDCart::Audio:
sql=QString().sprintf("select CUT_NAME,WEIGHT,LOCAL_COUNTER\
from CUTS where (((START_DATETIME<=\"%s\")&&\
(END_DATETIME>=\"%s\"))||\
(START_DATETIME is null))&&\
(((START_DAYPART<=\"%s\")&&(END_DAYPART>=\"%s\")||\
START_DAYPART is null))&&\
(%s=\"Y\")&&(CART_NUMBER=%u)&&(EVERGREEN=\"N\")&&\
(LENGTH>0) order by LOCAL_COUNTER",
(const char *)datetime_str,
(const char *)datetime_str,
(const char *)time_str,
(const char *)time_str,
(const char *)RDGetShortDayNameEN(current_date.dayOfWeek()).upper(),
cart_number);
sql=QString("select ")+
"CUT_NAME,"+
"PLAY_ORDER,"+
"WEIGHT,"+
"LOCAL_COUNTER,"+
"LAST_PLAY_DATETIME "+
"from CUTS where ("+
"((START_DATETIME<=\""+datetime_str+"\")&&"+
"(END_DATETIME>=\""+datetime_str+"\"))||"+
"(START_DATETIME is null))&&"+
"(((START_DAYPART<=\""+time_str+"\")&&"+
"(END_DAYPART>=\""+time_str+"\")||"+
"START_DAYPART is null))&&"+
"("+RDGetShortDayNameEN(current_date.dayOfWeek()).upper()+"=\"Y\")&&"+
QString().sprintf("(CART_NUMBER=%u)&&(EVERGREEN=\"N\")&&",cart_number)+
"(LENGTH>0)";
if(useWeighting()) {
sql+=" order by LOCAL_COUNTER";
}
else {
sql+=" order by LAST_PLAY_DATETIME desc";
}
q=new RDSqlQuery(sql);
cutname=GetNextCut(q);
delete q;
@ -142,11 +149,22 @@ bool RDCart::selectCut(QString *cut,const QTime &time) const
#ifndef WIN32
// syslog(LOG_USER|LOG_WARNING,"RDCart::selectCut(): no valid cuts, trying evergreen, SQL=%s",(const char *)sql);
#endif // WIN32
sql=QString().sprintf("select CUT_NAME,WEIGHT,LOCAL_COUNTER\
from CUTS where (CART_NUMBER=%u)&&\
(EVERGREEN=\"Y\")&&(LENGTH>0) \
order by LOCAL_COUNTER",
cart_number);
sql=QString("select ")+
"CUT_NAME,"+
"PLAY_ORDER,"+
"WEIGHT,"+
"LOCAL_COUNTER "+
"LAST_PLAY_DATETIME "+
"from CUTS where "+
QString().sprintf("(CART_NUMBER=%u)&&",cart_number)+
"(EVERGREEN=\"Y\")&&"+
"(LENGTH>0)";
if(useWeighting()) {
sql+=" order by LOCAL_COUNTER";
}
else {
sql+=" order by LAST_PLAY_DATETIME desc";
}
q=new RDSqlQuery(sql);
cutname=GetNextCut(q);
delete q;
@ -718,6 +736,20 @@ void RDCart::setEnforceLength(bool state)
}
bool RDCart::useWeighting() const
{
return RDBool(RDGetSqlValue("CART","NUMBER",cart_number,
"USE_WEIGHTING").toString());
}
void RDCart::setUseWeighting(bool state)
{
SetRow("USE_WEIGHTING",RDYesNo(state));
metadata_changed=true;
}
bool RDCart::preservePitch() const
{
return RDBool(RDGetSqlValue("CART","NUMBER",cart_number,
@ -1214,16 +1246,15 @@ int RDCart::addCut(unsigned format,unsigned bitrate,unsigned chans,
if(desc.isEmpty()) {
desc=QString().sprintf("Cut %03d",next);
}
sql=QString().sprintf("insert into CUTS set CUT_NAME=\"%s\",\
CART_NUMBER=%d,ISCI=\"%s\",DESCRIPTION=\"%s\",\
LENGTH=0,CODING_FORMAT=%d,BIT_RATE=%d,CHANNELS=%d",
(const char *)next_name,
cart_number,
(const char *)RDEscapeString(isci),
(const char *)RDEscapeString(desc),
format,
bitrate,
chans);
sql=QString("insert into CUTS set CUT_NAME=\"")+next_name+"\","+
QString().sprintf("CART_NUMBER=%d,",cart_number)+
"ISCI=\""+RDEscapeString(isci)+"\","+
"DESCRIPTION=\""+RDEscapeString(desc)+"\","+
"LENGTH=0,"+
QString().sprintf("CODING_FORMAT=%d,",format)+
QString().sprintf("BIT_RATE=%d,",bitrate)+
QString().sprintf("CHANNELS=%d,",chans)+
QString().sprintf("PLAY_ORDER=%d",next);
q=new RDSqlQuery(sql);
delete q;
@ -1495,13 +1526,36 @@ QString RDCart::GetNextCut(RDSqlQuery *q) const
QString cutname;
double ratio;
double play_ratio=100000000.0;
std::vector<int> eligibles;
int play=RD_MAX_CUT_NUMBER+1;
int last_play;
while(q->next()) {
if((ratio=q->value(2).toDouble()/q->value(1).toDouble())<play_ratio) {
play_ratio=ratio;
cutname=q->value(0).toString();
if(useWeighting()) {
while(q->next()) {
if((ratio=q->value(3).toDouble()/q->value(2).toDouble())<play_ratio) {
play_ratio=ratio;
cutname=q->value(0).toString();
}
}
}
else {
if(q->first()) {
last_play=q->value(1).toInt();
while(q->next()) {
if((q->value(1).toInt()>last_play)&&(q->value(1).toInt()<play)) {
play=q->value(1).toInt();
cutname=q->value(0).toString();
}
}
if(!cutname.isEmpty()) {
return cutname;
}
}
q->seek(-1);
while(q->next()) {
if(q->value(1).toInt()<play) {
play=q->value(1).toInt();
cutname=q->value(0).toString();
}
}
}
return cutname;

View File

@ -119,6 +119,8 @@ class RDCart
void setEndDateTime();
bool enforceLength() const;
void setEnforceLength(bool state);
bool useWeighting() const;
void setUseWeighting(bool state);
bool preservePitch() const;
void setPreservePitch(bool state) const;
bool asyncronous() const;

View File

@ -397,6 +397,19 @@ void RDCut::setWeight(int value) const
}
int RDCut::playOrder() const
{
return RDGetSqlValue("CUTS","CUT_NAME",cut_name,"PLAY_ORDER",cut_db).
toInt();
}
void RDCut::setPlayOrder(int order) const
{
SetRow("PLAY_ORDER",order);
}
QDateTime RDCut::lastPlayDatetime(bool *valid) const
{
return

View File

@ -78,6 +78,8 @@ class RDCut
void setOriginName(const QString &name) const;
unsigned weight() const;
void setWeight(int value) const;
int playOrder() const;
void setPlayOrder(int order) const;
QDateTime lastPlayDatetime(bool *valid) const;
void setLastPlayDatetime(const QDateTime &datetime,bool valid) const;
QDateTime uploadDatetime(bool *valid) const;

View File

@ -720,6 +720,7 @@ bool CreateDb(QString name,QString pwd)
END_DATETIME DATETIME,\
ENFORCE_LENGTH ENUM('N','Y') DEFAULT 'N',\
PRESERVE_PITCH ENUM('N','Y') DEFAULT 'N',\
USE_WEIGHTING enum('N','Y') default 'Y',\
ASYNCRONOUS enum('N','Y') default 'N',\
OWNER char(64),\
MACROS text,\
@ -777,6 +778,7 @@ bool CreateDb(QString name,QString pwd)
END_DAYPART TIME,\
ORIGIN_NAME CHAR(64),\
WEIGHT INT UNSIGNED DEFAULT 1,\
PLAY_ORDER int,\
LAST_PLAY_DATETIME DATETIME,\
UPLOAD_DATETIME datetime,\
PLAY_COUNTER INT UNSIGNED DEFAULT 0,\
@ -8109,6 +8111,32 @@ int UpdateDb(int ver)
delete q;
}
/*
* Versions 246 - 253 are reserved
*/
if(ver<254) {
sql=QString("alter table CART add column ")+
"USE_WEIGHTING enum('N','Y') default 'Y' after ENFORCE_LENGTH";
q=new QSqlQuery(sql);
delete q;
sql=QString("alter table CUTS add column PLAY_ORDER int after WEIGHT");
q=new QSqlQuery(sql);
delete q;
sql=QString("select CUT_NAME from CUTS order by CUT_NAME");
q=new QSqlQuery(sql);
while(q->next()) {
sql=QString("update CUTS set ")+
"PLAY_ORDER="+q->value(0).toString().right(3)+" "+
"where CUT_NAME=\""+q->value(0).toString()+"\"";
q1=new QSqlQuery(sql);
delete q1;
}
delete q;
}
// **** End of version updates ****

View File

@ -277,6 +277,31 @@ QSizePolicy AudioCart::sizePolicy() const
}
void AudioCart::changeCutScheduling(int sched)
{
QString sql;
RDSqlQuery *q;
RDListViewItem *item=(RDListViewItem *)rdcart_cut_list->firstChild();
while(item!=NULL) {
sql=QString("select PLAY_ORDER,WEIGHT from CUTS where ")+
"CUT_NAME=\""+item->text(11)+"\"";
q=new RDSqlQuery(sql);
if(q->first()) {
item->setText(0,QString().sprintf("%d",q->value(sched).toInt()));
}
item=(RDListViewItem *)item->nextSibling();
}
if(sched) {
rdcart_cut_list->setColumnText(0,tr("WT"));
}
else {
rdcart_cut_list->setColumnText(0,tr("ORD"));
}
rdcart_use_weighting=sched!=0;
}
void AudioCart::addCutData()
{
QString next_name=RDCut::cutName(rdcart_cart->number(),
@ -526,7 +551,7 @@ void AudioCart::recordCutData()
return;
}
QString cutname=item->text(11);
RecordCut *cut=new RecordCut(rdcart_cart,cutname,this,"cut");
RecordCut *cut=new RecordCut(rdcart_cart,cutname,rdcart_use_weighting,this);
cut->exec();
delete cut;
if(cut_clipboard==NULL) {
@ -704,16 +729,16 @@ void AudioCart::RefreshList()
q=new RDSqlQuery(sql);
while(q->next()) {
l=new RDListViewItem(rdcart_cut_list);
l->setText(0,q->value(0).toString());
l->setText(1,q->value(1).toString());
l->setText(2,RDGetTimeLength(q->value(2).toUInt()));
// l->setText(0,q->value(0).toString());
l->setText(1,q->value(2).toString());
l->setText(2,RDGetTimeLength(q->value(3).toUInt()));
if (q->value(0) == 0){// zero weight
l->setBackgroundColor(RD_CART_ERROR_COLOR);
if(pass==0) {
err=true;
}
} else {
switch(ValidateCut(q,9,RDCart::NeverValid,current_datetime)) {
switch(ValidateCut(q,10,RDCart::NeverValid,current_datetime)) {
case RDCart::NeverValid:
l->setBackgroundColor(RD_CART_ERROR_COLOR);
if(pass==0) {
@ -722,8 +747,8 @@ void AudioCart::RefreshList()
break;
case RDCart::ConditionallyValid:
if((!q->value(10).isNull())&&
(q->value(10).toDateTime()<current_datetime)) {
if((!q->value(11).isNull())&&
(q->value(11).toDateTime()<current_datetime)) {
l->setBackgroundColor(RD_CART_ERROR_COLOR);
}
else {
@ -752,40 +777,40 @@ void AudioCart::RefreshList()
break;
}
}
if(q->value(4).toUInt()>0) {
l->setText(3,q->value(3).toDateTime().toString("M/d/yy"));
if(q->value(5).toUInt()>0) {
l->setText(3,q->value(4).toDateTime().toString("M/d/yy"));
}
else {
l->setText(3,tr("Never"));
}
l->setText(4,q->value(4).toString());
if(!q->value(5).toDateTime().isNull()) {
l->setText(5,q->value(6).toString()+" - "+
q->value(5).toDateTime().toString("M/d/yy hh:mm:ss"));
l->setText(4,q->value(5).toString());
if(!q->value(6).toDateTime().isNull()) {
l->setText(5,q->value(7).toString()+" - "+
q->value(6).toDateTime().toString("M/d/yy hh:mm:ss"));
}
l->setText(6,q->value(7).toString());
if(!q->value(11).toDateTime().isNull()) {
l->setText(7,q->value(11).toDateTime().toString("M/d/yyyy hh:mm:ss"));
l->setText(6,q->value(8).toString());
if(!q->value(12).toDateTime().isNull()) {
l->setText(7,q->value(12).toDateTime().toString("M/d/yyyy hh:mm:ss"));
}
else {
l->setText(7,tr("None"));
}
if(!q->value(12).toDateTime().isNull()) {
l->setText(8,q->value(12).toDateTime().toString("M/d/yyyy hh:mm:ss"));
if(!q->value(13).toDateTime().isNull()) {
l->setText(8,q->value(13).toDateTime().toString("M/d/yyyy hh:mm:ss"));
}
else {
l->setText(8,tr("None"));
}
if(!q->value(14).isNull()) {
l->setText(9,q->value(13).toTime().toString("hh:mm:ss"));
l->setText(10,q->value(14).toTime().toString("hh:mm:ss"));
if(!q->value(15).isNull()) {
l->setText(9,q->value(15).toTime().toString("hh:mm:ss"));
l->setText(10,q->value(15).toTime().toString("hh:mm:ss"));
}
else {
l->setText(9,tr("None"));
l->setText(10,tr("None"));
}
l->setText(11,q->value(8).toString());
total_length+=q->value(2).toUInt();
l->setText(11,q->value(9).toString());
total_length+=q->value(3).toUInt();
pass++;
}
if(q->size()>0) {
@ -815,20 +840,20 @@ void AudioCart::RefreshLine(RDListViewItem *item)
"(CUT_NAME=\""+RDEscapeString(cut_name)+"\")";
RDSqlQuery *q=new RDSqlQuery(sql);
if(q->first()) {
item->setText(0,q->value(0).toString());
item->setText(0,q->value(rdcart_use_weighting).toString());
item->setText(1,q->value(1).toString());
item->setText(2,RDGetTimeLength(q->value(2).toUInt()));
if (q->value(0) == 0){ //zero weight
item->setBackgroundColor(RD_CART_ERROR_COLOR);
} else {
switch(ValidateCut(q,9,RDCart::NeverValid,current_datetime)) {
switch(ValidateCut(q,10,RDCart::NeverValid,current_datetime)) {
case RDCart::NeverValid:
item->setBackgroundColor(RD_CART_ERROR_COLOR);
break;
case RDCart::ConditionallyValid:
if((!q->value(11).isNull())&&
(q->value(11).toDateTime()<current_datetime)) {
if((!q->value(12).isNull())&&
(q->value(12).toDateTime()<current_datetime)) {
item->setBackgroundColor(RD_CART_ERROR_COLOR);
}
else {
@ -849,40 +874,40 @@ void AudioCart::RefreshLine(RDListViewItem *item)
break;
}
}
if(q->value(4).toUInt()>0) {
item->setText(3,q->value(3).toDateTime().toString("M/d/yy"));
if(q->value(5).toUInt()>0) {
item->setText(3,q->value(4).toDateTime().toString("M/d/yy"));
}
else {
item->setText(3,tr("Never"));
}
item->setText(4,q->value(4).toString());
if(!q->value(5).toDateTime().isNull()) {
item->setText(5,q->value(6).toString()+" - "+
q->value(5).toDateTime().toString("M/d/yy hh:mm:ss"));
item->setText(4,q->value(5).toString());
if(!q->value(6).toDateTime().isNull()) {
item->setText(5,q->value(7).toString()+" - "+
q->value(6).toDateTime().toString("M/d/yy hh:mm:ss"));
}
item->setText(6,q->value(7).toString());
if(!q->value(11).toDateTime().isNull()) {
item->setText(7,q->value(11).toDateTime().toString("M/d/yyyy hh:mm:ss"));
item->setText(6,q->value(8).toString());
if(!q->value(12).toDateTime().isNull()) {
item->setText(7,q->value(12).toDateTime().toString("M/d/yyyy hh:mm:ss"));
}
else {
item->setText(7,tr("None"));
}
if(!q->value(12).toDateTime().isNull()) {
item->setText(8,q->value(12).toDateTime().toString("M/d/yyyy hh:mm:ss"));
if(!q->value(13).toDateTime().isNull()) {
item->setText(8,q->value(13).toDateTime().toString("M/d/yyyy hh:mm:ss"));
}
else {
item->setText(8,tr("None"));
}
if(!q->value(14).isNull()) {
item->setText(9,q->value(13).toTime().toString("hh:mm:ss"));
item->setText(10,q->value(14).toTime().toString("hh:mm:ss"));
if(!q->value(15).isNull()) {
item->setText(9,q->value(14).toTime().toString("hh:mm:ss"));
item->setText(10,q->value(15).toTime().toString("hh:mm:ss"));
}
else {
item->setText(9,tr("None"));
item->setText(10,tr("None"));
}
item->setText(11,q->value(8).toString());
total_length+=q->value(2).toUInt();
item->setText(11,q->value(9).toString());
total_length+=q->value(3).toUInt();
}
if(q->size()>0) {
rdcart_average_length=total_length/q->size();

View File

@ -57,6 +57,9 @@ class AudioCart : public QWidget
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
public slots:
void changeCutScheduling(int sched);
private slots:
void addCutData();
void deleteCutData();
@ -95,6 +98,7 @@ class AudioCart : public QWidget
bool rdcart_modification_allowed;
bool rdcart_import_metadata;
bool rdcart_profile_rip;
bool rdcart_use_weighting;
};

View File

@ -20,6 +20,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <vector>
#include <qbitmap.h>
#include <unistd.h>
#include <qdialog.h>
@ -525,6 +527,22 @@ EditCart::EditCart(unsigned number,QString *path,bool new_cart,bool profile_rip,
rdcart_use_event_length_label->setAlignment(AlignLeft|ShowPrefix);
rdcart_use_event_length_label->hide();
//
// Cut Scheduling Policy
//
rdcart_cut_sched_box=new QComboBox(this);
rdcart_cut_sched_box->setGeometry(135,348,150,21);
rdcart_cut_sched_box->insertItem(tr("By Specified Order"));
rdcart_cut_sched_box->insertItem(tr("By Weight"));
rdcart_cut_sched_edit=new QLineEdit(this);
rdcart_cut_sched_edit->setGeometry(135,348,150,21);
rdcart_cut_sched_edit->hide();
QLabel *rdcart_cut_sched_label=
new QLabel(rdcart_cut_sched_box,tr("Schedule Cuts")+":",this);
rdcart_cut_sched_label->setGeometry(10,348,120,19);
rdcart_cut_sched_label->setFont(button_font);
rdcart_cut_sched_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
//
// Notes Button
//
@ -559,6 +577,8 @@ EditCart::EditCart(unsigned number,QString *path,bool new_cart,bool profile_rip,
rdcart_audio_cart->sizeHint().height());
connect(rdcart_audio_cart,SIGNAL(cartDataChanged()),
this,SLOT(cartDataChangedData()));
connect(rdcart_cut_sched_box,SIGNAL(activated(int)),
rdcart_audio_cart,SLOT(changeCutScheduling(int)));
rdcart_macro_cart=NULL;
break;
@ -629,6 +649,7 @@ EditCart::EditCart(unsigned number,QString *path,bool new_cart,bool profile_rip,
switch(rdcart_cart->type()) {
case RDCart::Audio:
rdcart_type_edit->setText(tr("AUDIO"));
rdcart_audio_cart->changeCutScheduling(rdcart_cart->useWeighting());
break;
case RDCart::Macro:
@ -693,6 +714,8 @@ EditCart::EditCart(unsigned number,QString *path,bool new_cart,bool profile_rip,
rdcart_syncronous_box->setChecked(rdcart_cart->asyncronous());
rdcart_use_event_length_box->
setChecked(rdcart_cart->useEventLength());
rdcart_cut_sched_box->setCurrentItem(rdcart_cart->useWeighting());
rdcart_cut_sched_edit->setText(rdcart_cut_sched_box->currentText());
}
else {//multi edit
if(rdcart_group_box->count() == 0) {
@ -751,6 +774,14 @@ EditCart::EditCart(unsigned number,QString *path,bool new_cart,bool profile_rip,
setRange(rdcart_cart->beatsPerMinute(),rdcart_cart->beatsPerMinute());
rdcart_controls.forced_length_edit->hide();
rdcart_forced_length_ledit->show();
if(rdcart_cart->type()==RDCart::Audio) {
rdcart_cut_sched_box->hide();
rdcart_cut_sched_edit->show();
}
}
if(rdcart_cart->type()==RDCart::Macro) {
rdcart_cut_sched_box->hide();
rdcart_cut_sched_label->hide();
}
}
@ -840,6 +871,35 @@ void EditCart::okData()
}
}
}
if(rdcart_cut_sched_box->currentItem()==0) {
std::vector<int> play_orders;
std::vector<int> order_duplicates;
sql=QString("select PLAY_ORDER from CUTS where ")+
QString().sprintf("CART_NUMBER=%u",rdcart_cart->number());
q=new RDSqlQuery(sql);
while(q->next()) {
play_orders.push_back(q->value(0).toInt());
}
delete q;
for(unsigned i=0;i<play_orders.size();i++) {
for(unsigned j=i;j<play_orders.size();j++) {
if((i!=j)&&(play_orders[i]==play_orders[j])) {
order_duplicates.push_back(play_orders[j]);
}
}
}
if(order_duplicates.size()>0) {
QString msg=
tr("The following cut order values are assigned more than once")+
":\n";
for(unsigned i=0;i<order_duplicates.size();i++) {
msg+=QString().sprintf("%d, ",order_duplicates[i]);
}
msg=msg.left(msg.length()-2)+".";
QMessageBox::warning(this,"RDLibrary - "+tr("Duplicate Cut Order"),msg);
return;
}
}
rdcart_cart->setGroupName(rdcart_group_box->currentText());
rdcart_cart->calculateAverageLength(&rdcart_length_deviation);
rdcart_cart->setLengthDeviation(rdcart_length_deviation);
@ -885,6 +945,9 @@ void EditCart::okData()
rdcart_cart->setAsyncronous(rdcart_syncronous_box->isChecked());
rdcart_cart->setUseEventLength(rdcart_use_event_length_box->isChecked());
}
else {
rdcart_cart->setUseWeighting(rdcart_cut_sched_box->currentItem());
}
}
else { // Multi Edit
it=new QListViewItemIterator(lib_cart_list_edit);

View File

@ -79,6 +79,8 @@ class EditCart : public QDialog
QComboBox *rdcart_group_box;
QLineEdit *rdcart_group_edit;
AudioControls rdcart_controls;
QComboBox *rdcart_cut_sched_box;
QLineEdit *rdcart_cut_sched_edit;
QCheckBox *rdcart_syncronous_box;
QCheckBox *rdcart_use_event_length_box;
QLabel *rdcart_syncronous_label;

View File

@ -220,6 +220,10 @@ Do you still want to delete?</source>
<source>You must select a single cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ORD</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CdRipper</name>
@ -866,6 +870,26 @@ poznámky</translation>
<source>Use Event Length for Now &amp;&amp; Next Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Specified Order</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Weight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Schedule Cuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following cut order values are assigned more than once</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Duplicate Cut Order</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditMacro</name>
@ -1545,5 +1569,9 @@ Přesto uložit?</translation>
<source>AES ALARM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Order</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -220,6 +220,10 @@ Do you still want to delete?</source>
<source>You must select a single cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ORD</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CdRipper</name>
@ -854,6 +858,26 @@ Notes</source>
<source>Use Event Length for Now &amp;&amp; Next Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Specified Order</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Weight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Schedule Cuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following cut order values are assigned more than once</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Duplicate Cut Order</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditMacro</name>
@ -1522,5 +1546,9 @@ Trotzdem speichern?</translation>
<source>AES ALARM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Order</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -220,6 +220,10 @@ Do you still want to delete?</source>
<source>You must select a single cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ORD</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CdRipper</name>
@ -855,6 +859,26 @@ Notas</translation>
<source>Use Event Length for Now &amp;&amp; Next Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Specified Order</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Weight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Schedule Cuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following cut order values are assigned more than once</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Duplicate Cut Order</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditMacro</name>
@ -1527,5 +1551,9 @@ Do you still want to save?</source>
<source>AES ALARM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Order</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -198,6 +198,10 @@ Do you still want to delete?</source>
<source>You must select a single cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ORD</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CdRipper</name>
@ -728,6 +732,26 @@ Notes</source>
<source>Use Event Length for Now &amp;&amp; Next Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Specified Order</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Weight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Schedule Cuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following cut order values are assigned more than once</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Duplicate Cut Order</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditMacro</name>
@ -1364,5 +1388,9 @@ Do you still want to save?</source>
<source>AES ALARM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Order</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -215,6 +215,10 @@ Do you still want to delete?</source>
<source>You must select a single cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ORD</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CdRipper</name>
@ -850,6 +854,26 @@ Notes</source>
<source>Use Event Length for Now &amp;&amp; Next Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Specified Order</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Weight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Schedule Cuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following cut order values are assigned more than once</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Duplicate Cut Order</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditMacro</name>
@ -1518,5 +1542,9 @@ Vil du lagra likevel?</translation>
<source>AES ALARM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Order</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -215,6 +215,10 @@ Do you still want to delete?</source>
<source>You must select a single cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ORD</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CdRipper</name>
@ -850,6 +854,26 @@ Notes</source>
<source>Use Event Length for Now &amp;&amp; Next Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Specified Order</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Weight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Schedule Cuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following cut order values are assigned more than once</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Duplicate Cut Order</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditMacro</name>
@ -1518,5 +1542,9 @@ Vil du lagra likevel?</translation>
<source>AES ALARM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Order</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -216,6 +216,10 @@ Do you still want to delete?</source>
<source>You must select a single cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ORD</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CdRipper</name>
@ -852,6 +856,26 @@ limite do sistema! Você ainda quer salvar?</translation>
<source>Use Event Length for Now &amp;&amp; Next Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Specified Order</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Weight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Schedule Cuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following cut order values are assigned more than once</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Duplicate Cut Order</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditMacro</name>
@ -1520,5 +1544,9 @@ Você ainda quer salvar?</translation>
<source>AES ALARM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Order</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -37,13 +37,15 @@
#include <globals.h>
#include <rdconfig.h>
RecordCut::RecordCut(RDCart *cart,QString cut,QWidget *parent,const char *name)
RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,
QWidget *parent,const char *name)
: QDialog(parent,name,true)
{
bool valid;
bool is_track=cart->owner().isEmpty();
bool allow_modification=lib_user->modifyCarts()&&is_track;
bool allow_editing=lib_user->editAudio()&&is_track;
rec_use_weighting=use_weight;
//
// Fix the Window Size
@ -507,7 +509,14 @@ RecordCut::RecordCut(RDCart *cart,QString cut,QWidget *parent,const char *name)
}
cut_isci_edit->setText(rec_cut->isci());
cut_isrc_edit->setText(rec_cut->isrc(RDCut::FormattedIsrc));
cut_weight_box->setValue(rec_cut->weight());
if(use_weight) {
cut_weight_label->setText(tr("Weight"));
cut_weight_box->setValue(rec_cut->weight());
}
else {
cut_weight_label->setText(tr("Order"));
cut_weight_box->setValue(rec_cut->playOrder());
}
if(rec_cut->playCounter()>0) {
cut_playdate_edit->
setText(rec_cut->lastPlayDatetime(&valid).toString("M/d/yyyy hh:mm:ss"));
@ -1001,7 +1010,12 @@ void RecordCut::closeData()
rec_cut->setOutcue(cut_outcue_edit->text());
rec_cut->setIsrc(isrc);
rec_cut->setIsci(cut_isci_edit->text());
rec_cut->setWeight(cut_weight_box->value());
if(rec_use_weighting) {
rec_cut->setWeight(cut_weight_box->value());
}
else {
rec_cut->setPlayOrder(cut_weight_box->value());
}
rec_cut->setLength(rec_length);
RDCart *cart=new RDCart(rec_cut->cartNumber());
cart->resetRotation();

View File

@ -50,7 +50,8 @@ class RecordCut : public QDialog
{
Q_OBJECT
public:
RecordCut(RDCart *cart,QString cut,QWidget *parent=0,const char *name=0);
RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent=0,
const char *name=0);
~RecordCut();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
@ -141,6 +142,7 @@ class RecordCut : public QDialog
bool is_closing;
QCheckBox *rec_evergreen_box;
QLabel *rec_evergreen_label;
bool rec_use_weighting;
};

View File

@ -27,10 +27,31 @@ QString ValidateCutFields()
{
QString sql;
sql=QString("select WEIGHT,DESCRIPTION,LENGTH,LAST_PLAY_DATETIME,")+
"PLAY_COUNTER,ORIGIN_DATETIME,ORIGIN_NAME,OUTCUE,CUT_NAME,LENGTH,"+
"EVERGREEN,START_DATETIME,END_DATETIME,START_DAYPART,END_DAYPART,"+
"MON,TUE,WED,THU,FRI,SAT,SUN from CUTS";
sql=QString("select ")+
"PLAY_ORDER,"+ // 00
"WEIGHT,"+ // 01
"DESCRIPTION,"+ // 02
"LENGTH,"+ // 03
"LAST_PLAY_DATETIME,"+ // 04
"PLAY_COUNTER,"+ // 03
"ORIGIN_DATETIME,"+ // 04
"ORIGIN_NAME,"+ // 05
"OUTCUE,"+ // 06
"CUT_NAME,"+ // 07
"LENGTH,"+ // 08
"EVERGREEN,"+ // 09
"START_DATETIME,"+ // 10
"END_DATETIME,"+ // 11
"START_DAYPART,"+ // 12
"END_DAYPART,"+ // 13
"MON,"+ // 14
"TUE,"+ // 15
"WED,"+ // 16
"THU,"+ // 17
"FRI,"+ // 18
"SAT,"+ // 19
"SUN "+ // 20
"from CUTS";
return sql;
}