mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-18 16:41:18 +02:00
2021-01-13 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'Edit Log' dialog in rdlibrary(1) to use the model-based API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -278,7 +278,8 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
lib_player->stopButton()->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
QShortcut *lib_player_shortcut=new QShortcut(Qt::Key_Space,this);
|
||||
connect(lib_player_shortcut,SIGNAL(activated()),this,SLOT(playerShortcutData()));
|
||||
connect(lib_player_shortcut,SIGNAL(activated()),
|
||||
this,SLOT(playerShortcutData()));
|
||||
|
||||
//
|
||||
// Setup Signal Handling
|
||||
@@ -294,7 +295,6 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
|
||||
dragsChangedData(lib_cart_filter->dragEnabled());
|
||||
lib_cart_model->setFilterSql(lib_cart_filter->filterSql());
|
||||
// lib_cart_view->resizeColumnsToContents();
|
||||
|
||||
LoadGeometry();
|
||||
}
|
||||
@@ -360,6 +360,7 @@ void MainWidget::addData()
|
||||
int cart_num;
|
||||
RDCart::Type cart_type=RDCart::All;
|
||||
QString cart_title;
|
||||
QList<unsigned> cartnums;
|
||||
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
@@ -380,12 +381,12 @@ void MainWidget::addData()
|
||||
"TITLE=\""+RDEscapeString(cart_title)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
|
||||
cartnums.push_back(cart_num);
|
||||
EditCart *cart=
|
||||
new EditCart(cart_num,&lib_import_path,true,profile_ripping,this);
|
||||
new EditCart(cartnums,&lib_import_path,true,profile_ripping,this);
|
||||
if(cart->exec()) {
|
||||
int row=lib_cart_model->addCart(cart_num);
|
||||
// lib_cart_view->selectRow(row);
|
||||
lib_cart_view->scrollTo(lib_cart_model->index(row,0));
|
||||
SendNotification(RDNotification::AddAction,cart_num);
|
||||
}
|
||||
@@ -403,25 +404,29 @@ void MainWidget::addData()
|
||||
|
||||
void MainWidget::editData()
|
||||
{
|
||||
QModelIndexList rows=lib_cart_view->selectionModel()->selectedRows();
|
||||
QModelIndexList carts;
|
||||
|
||||
if(!CurrentSelection(&carts)) {
|
||||
return;
|
||||
}
|
||||
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
|
||||
if(rows.size()==1) {
|
||||
EditCart *edit_cart=
|
||||
new EditCart(lib_cart_model->cartNumber(rows.first().row()),
|
||||
&lib_import_path,false,profile_ripping,this);
|
||||
if(edit_cart->exec()) {
|
||||
lib_cart_model->refreshRow(rows.first().row());
|
||||
//cartOnItemData(item);
|
||||
QList<unsigned> cartnums;
|
||||
for(int i=0;i<carts.size();i++) {
|
||||
cartnums.push_back(lib_cart_model->cartNumber(carts.at(i)));
|
||||
}
|
||||
EditCart *d=
|
||||
new EditCart(cartnums,&lib_import_path,false,profile_ripping,this);
|
||||
if(d->exec()) {
|
||||
for(int i=0;i<carts.size();i++) {
|
||||
lib_cart_model->refreshRow(carts.at(i));
|
||||
SendNotification(RDNotification::ModifyAction,
|
||||
lib_cart_model->cartNumber(rows.first().row()));
|
||||
lib_cart_model->cartNumber(carts.at(i)));
|
||||
}
|
||||
delete edit_cart;
|
||||
}
|
||||
if(rows.size()>1) {
|
||||
}
|
||||
delete d;
|
||||
|
||||
UnlockUser();
|
||||
}
|
||||
@@ -429,19 +434,19 @@ void MainWidget::editData()
|
||||
|
||||
void MainWidget::macroData()
|
||||
{
|
||||
int row=-1;
|
||||
QModelIndexList carts;
|
||||
|
||||
if(((row=SingleSelectedCartLine())<0)||
|
||||
(lib_cart_model->cartType(row)!=RDCart::Macro)) {
|
||||
if((!CurrentSelection(&carts))||(carts.size()!=1)) {
|
||||
return;
|
||||
}
|
||||
RDCart *rdcart=new RDCart(lib_cart_model->cartNumber(row));
|
||||
RDCart *rdcart=new RDCart(lib_cart_model->cartNumber(carts.first()));
|
||||
lib_macro_events->clear();
|
||||
lib_macro_events->load(rdcart->macros());
|
||||
lib_macro_events->exec();
|
||||
delete rdcart;
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::deleteData()
|
||||
{
|
||||
QString sql;
|
||||
@@ -450,9 +455,9 @@ void MainWidget::deleteData()
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
|
||||
QModelIndexList rows=lib_cart_view->selectionModel()->selectedRows();
|
||||
QModelIndexList carts;
|
||||
|
||||
if(rows.size()==0) {
|
||||
if(!CurrentSelection(&carts)) {
|
||||
UnlockUser();
|
||||
return;
|
||||
}
|
||||
@@ -470,8 +475,8 @@ void MainWidget::deleteData()
|
||||
//
|
||||
// Check for RDCatch events
|
||||
//
|
||||
for(int i=0;i<rows.size();i++) {
|
||||
unsigned cartnum=lib_cart_model->cartNumber(rows.at(i).row());
|
||||
for(int i=0;i<carts.size();i++) {
|
||||
unsigned cartnum=lib_cart_model->cartNumber(carts.at(i));
|
||||
sql=QString("select ")+
|
||||
"CUT_NAME "+ // 00
|
||||
"from RECORDINGS where "+
|
||||
@@ -498,8 +503,8 @@ void MainWidget::deleteData()
|
||||
// Check clipboard
|
||||
//
|
||||
if(cut_clipboard!=NULL) {
|
||||
for(int i=0;i<rows.size();i++) {
|
||||
unsigned cartnum=lib_cart_model->cartNumber(rows.at(i).row());
|
||||
for(int i=0;i<carts.size();i++) {
|
||||
unsigned cartnum=lib_cart_model->cartNumber(carts.at(i));
|
||||
if(cartnum==cut_clipboard->cartNumber()) {
|
||||
QString str=tr("Deleting cart")+QString().sprintf(" %06u ",cartnum)+
|
||||
tr("will also empty the clipboard.")+"\n"+
|
||||
@@ -520,23 +525,37 @@ void MainWidget::deleteData()
|
||||
//
|
||||
// Check for voicetracks
|
||||
//
|
||||
for(int i=0;i<rows.size();i++) {
|
||||
unsigned cartnum=lib_cart_model->cartNumber(rows.at(i).row());
|
||||
if(!lib_cart_model->cartOwnedBy(i).isEmpty()) {
|
||||
for(int i=0;i<carts.size();i++) {
|
||||
unsigned cartnum=lib_cart_model->cartNumber(carts.at(i));
|
||||
if(!lib_cart_model->cartOwnedBy(carts.at(i)).isEmpty()) {
|
||||
QString str=tr("Cart")+QString().sprintf(" %06u ",cartnum)+
|
||||
tr("is a voicetrack belonging to log")+" \""+
|
||||
lib_cart_model->cartOwnedBy(i)+"\".\n"+tr("It cannot be deleted here!");
|
||||
lib_cart_model->cartOwnedBy(carts.at(i))+"\".\n"+tr("It cannot be deleted here!");
|
||||
QMessageBox::information(this,"RDLibrary - "+tr("Voicetrack Found"),str);
|
||||
UnlockUser();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Find row to be selected after deletion
|
||||
//
|
||||
unsigned newcartnum=0;
|
||||
QModelIndex row=lib_cart_model->index(carts.last().row(),0).
|
||||
sibling(carts.last().row()+1,0);
|
||||
if((!row.isValid())||(row.row()>=lib_cart_model->rowCount())) {
|
||||
row=lib_cart_model->index(carts.last().row(),0).
|
||||
sibling(carts.first().row()-1,0);
|
||||
}
|
||||
if(row.isValid()) {
|
||||
newcartnum=lib_cart_model->cartNumber(row);
|
||||
}
|
||||
|
||||
//
|
||||
// Delete Carts
|
||||
//
|
||||
for(int i=rows.size()-1;i>=0;i--) {
|
||||
RDCart *rdcart=new RDCart(lib_cart_model->cartNumber(rows.at(i).row()));
|
||||
for(int i=carts.size()-1;i>=0;i--) {
|
||||
RDCart *rdcart=new RDCart(lib_cart_model->cartNumber(carts.at(i)));
|
||||
if(!rdcart->remove(rda->station(),rda->user(),rda->config())) {
|
||||
QMessageBox::warning(this,tr("RDLibrary"),tr("Unable to delete audio!"));
|
||||
return;
|
||||
@@ -546,9 +565,12 @@ void MainWidget::deleteData()
|
||||
delete rdcart;
|
||||
}
|
||||
|
||||
// lib_cart_view->selectRow(rows.first().row());
|
||||
lib_cart_view->scrollTo(lib_cart_model->index(rows.first().row(),0));
|
||||
|
||||
if(newcartnum>0) {
|
||||
QModelIndex index=lib_cart_model->cartRow(newcartnum);
|
||||
if(index.isValid()) {
|
||||
SelectRow(index);
|
||||
}
|
||||
}
|
||||
UnlockUser();
|
||||
}
|
||||
|
||||
@@ -596,41 +618,48 @@ void MainWidget::cartDoubleClickedData(const QModelIndex &)
|
||||
void MainWidget::selectionChangedData(const QItemSelection &,
|
||||
const QItemSelection &)
|
||||
{
|
||||
QList<int> cartlines;
|
||||
QStringList cutnames;
|
||||
QModelIndexList rows=lib_cart_view->selectionModel()->selectedRows();
|
||||
|
||||
for(int i=0;i<rows.size();i++) {
|
||||
QModelIndexList carts;
|
||||
QModelIndexList cuts;
|
||||
|
||||
if(!CurrentSelection(&carts,&cuts)) {
|
||||
lib_edit_button->setEnabled(false);
|
||||
lib_delete_button->setEnabled(false);
|
||||
lib_player->playButton()->setEnabled(false);
|
||||
lib_player->stopButton()->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
lib_player->playButton()->setEnabled(rows.size()==1);
|
||||
lib_player->stopButton()->setEnabled(rows.size()==1);
|
||||
lib_macro_button->setEnabled(rows.size()==1);
|
||||
if(rows.size()==1) {
|
||||
switch(lib_cart_model->cartType(rows.first().row())) {
|
||||
case RDCart::Audio:
|
||||
lib_player->setCart(lib_cart_model->cartNumber(rows.first().row()));
|
||||
lib_player->playButton()->show();
|
||||
lib_player->stopButton()->show();
|
||||
lib_macro_button->hide();
|
||||
break;
|
||||
|
||||
case RDCart::Macro:
|
||||
lib_player->playButton()->hide();
|
||||
lib_player->stopButton()->hide();
|
||||
lib_macro_button->show();
|
||||
break;
|
||||
|
||||
case RDCart::All:
|
||||
lib_player->playButton()->hide();
|
||||
lib_player->stopButton()->hide();
|
||||
lib_macro_button->hide();
|
||||
break;
|
||||
/*
|
||||
printf("CARTS\n");
|
||||
for(int i=0;i<carts.size();i++) {
|
||||
printf(" %d: %06u\n",i,lib_cart_model->cartNumber(carts.at(i)));
|
||||
}
|
||||
printf("CUTS\n");
|
||||
for(int i=0;i<cuts.size();i++) {
|
||||
printf(" %d: %s\n",i,lib_cart_model->cutName(cuts.at(i)).toUtf8().constData());
|
||||
}
|
||||
printf("\n");
|
||||
return;
|
||||
*/
|
||||
if(carts.size()>0) {
|
||||
lib_edit_button->setEnabled(true);
|
||||
lib_delete_button->setEnabled(rda->user()->deleteCarts());
|
||||
lib_player->playButton()->setEnabled(carts.size()==1);
|
||||
lib_player->stopButton()->setEnabled(carts.size()==1);
|
||||
lib_player->setCart(lib_cart_model->cartNumber(carts.first()));
|
||||
SetPlayer(lib_cart_model->cartType(carts.first()));
|
||||
}
|
||||
else {
|
||||
lib_edit_button->setEnabled(false);
|
||||
lib_delete_button->setEnabled(false);
|
||||
lib_player->playButton()->setEnabled(cuts.size()==1);
|
||||
lib_player->stopButton()->setEnabled(cuts.size()==1);
|
||||
if(cuts.size()>=1) {
|
||||
lib_player->setCart(lib_cart_model->cartNumber(cuts.first()));
|
||||
lib_player->setCut(lib_cart_model->cutName(cuts.first()));
|
||||
}
|
||||
SetPlayer(lib_cart_model->cartType(cuts.first()));
|
||||
}
|
||||
lib_edit_button->setEnabled(rows.size()>0);
|
||||
lib_delete_button->setEnabled((rows.size()>0)&&rda->user()->deleteCarts());
|
||||
lib_macro_button->setEnabled(carts.size()==1);
|
||||
}
|
||||
|
||||
|
||||
@@ -753,245 +782,6 @@ void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::RefreshCuts(RDListViewItem *p,unsigned cartnum)
|
||||
{
|
||||
/*
|
||||
RDListViewItem *l=NULL;
|
||||
Q3ListViewItem *i=NULL;
|
||||
RDSqlQuery *q;
|
||||
QString sql;
|
||||
QDateTime current_datetime(QDate::currentDate(),QTime::currentTime());
|
||||
QDateTime end_datetime;
|
||||
RDCart::Validity cart_validity=RDCart::NeverValid;
|
||||
RDCart::Validity cut_validity=RDCart::NeverValid;
|
||||
|
||||
while ((i=p->firstChild())) {
|
||||
delete i;
|
||||
}
|
||||
|
||||
sql=QString("select ")+
|
||||
"CUTS.CART_NUMBER,"+ // 00
|
||||
"CUTS.CUT_NAME,"+ // 01
|
||||
"CUTS.DESCRIPTION,"+ // 02
|
||||
"CUTS.TALK_START_POINT,"+ // 03
|
||||
"CUTS.TALK_END_POINT,"+ // 04
|
||||
"CUTS.LENGTH,"+ // 05 offsets begin here
|
||||
"CUTS.EVERGREEN,"+ // 06
|
||||
"CUTS.START_DATETIME,"+ // 07
|
||||
"CUTS.END_DATETIME,"+ // 08
|
||||
"CUTS.START_DAYPART,"+ // 09
|
||||
"CUTS.END_DAYPART,"+ // 10
|
||||
"CUTS.MON,"+ // 11
|
||||
"CUTS.TUE,"+ // 12
|
||||
"CUTS.WED,"+ // 13
|
||||
"CUTS.THU,"+ // 14
|
||||
"CUTS.FRI,"+ // 15
|
||||
"CUTS.SAT,"+ // 16
|
||||
"CUTS.SUN "+ // 17
|
||||
"from CUTS ";
|
||||
sql+=QString().sprintf("where CUTS.CART_NUMBER=%u ",cartnum);
|
||||
sql+="order by CUTS.CUT_NAME";
|
||||
q=new RDSqlQuery(sql);
|
||||
if (q->size()>1) {
|
||||
while(q->next()) {
|
||||
l=new RDListViewItem(p);
|
||||
l->setDragEnabled(false);
|
||||
l->setText(Cart,q->value(1).toString());
|
||||
l->setText(Length,RDGetTimeLength(q->value(5).toUInt()));
|
||||
l->setText(Talk,RDGetTimeLength(q->value(4).toUInt()-q->value(3).toUInt()));
|
||||
l->setText(Title,q->value(2).toString());
|
||||
if(!q->value(7).toDateTime().isNull()) {
|
||||
l->setText(Start,q->value(7).toDateTime().
|
||||
toString("MM/dd/yyyy hh:mm:ss"));
|
||||
}
|
||||
if(!q->value(8).toDateTime().isNull()) {
|
||||
l->setText(End,q->value(8).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
l->setText(End,"TFN");
|
||||
}
|
||||
end_datetime=q->value(8).toDateTime();
|
||||
cut_validity=ValidateCut(q,5,RDCart::NeverValid,current_datetime);
|
||||
UpdateItemColor(l,cut_validity,end_datetime,current_datetime);
|
||||
cart_validity=ValidateCut(q,5,cart_validity,current_datetime);
|
||||
UpdateItemColor(p,cart_validity,end_datetime,current_datetime);
|
||||
}
|
||||
}
|
||||
else if(q->size()==1){
|
||||
if(q->next()) {
|
||||
cart_validity=ValidateCut(q,5,cart_validity,current_datetime);
|
||||
end_datetime=q->value(8).toDateTime();
|
||||
UpdateItemColor(p,cart_validity,end_datetime,current_datetime);
|
||||
}
|
||||
}
|
||||
else {
|
||||
p->setBackgroundColor(RD_CART_ERROR_COLOR);
|
||||
}
|
||||
|
||||
delete q;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::RefreshList()
|
||||
{
|
||||
/*
|
||||
RDSqlQuery *q;
|
||||
QString sql;
|
||||
RDListViewItem *l=NULL;
|
||||
QString type_filter;
|
||||
QDateTime current_datetime(QDate::currentDate(),QTime::currentTime());
|
||||
QDateTime end_datetime;
|
||||
|
||||
lib_cart_list->clear();
|
||||
|
||||
lib_edit_button->setEnabled(false);
|
||||
lib_delete_button->setEnabled(false);
|
||||
|
||||
type_filter=GetTypeFilter();
|
||||
if(type_filter.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
sql=QString("select ")+
|
||||
"CART.NUMBER,"+ // 00
|
||||
"CART.FORCED_LENGTH,"+ // 01
|
||||
"CART.TITLE,"+ // 02
|
||||
"CART.ARTIST,"+ // 03
|
||||
"CART.ALBUM,"+ // 04
|
||||
"CART.LABEL,"+ // 05
|
||||
"CART.CLIENT,"+ // 06
|
||||
"CART.AGENCY,"+ // 07
|
||||
"CART.USER_DEFINED,"+ // 08
|
||||
"CART.COMPOSER,"+ // 09
|
||||
"CART.PUBLISHER,"+ // 10
|
||||
"CART.CONDUCTOR,"+ // 11
|
||||
"CART.GROUP_NAME,"+ // 12
|
||||
"CART.START_DATETIME,"+ // 13
|
||||
"CART.END_DATETIME,"+ // 14
|
||||
"CART.TYPE,"+ // 15
|
||||
"CART.CUT_QUANTITY,"+ // 16
|
||||
"CART.LAST_CUT_PLAYED,"+ // 17
|
||||
"CART.ENFORCE_LENGTH,"+ // 18
|
||||
"CART.PRESERVE_PITCH,"+ // 19
|
||||
"CART.LENGTH_DEVIATION,"+ // 20
|
||||
"CART.OWNER,"+ // 21
|
||||
"CART.VALIDITY,"+ // 22
|
||||
"GROUPS.COLOR,"+ // 23
|
||||
"CUTS.TALK_START_POINT,"+ // 24
|
||||
"CUTS.TALK_END_POINT "+ // 25
|
||||
"from CART left join GROUPS on CART.GROUP_NAME=GROUPS.NAME "+
|
||||
"left join CUTS on CART.NUMBER=CUTS.CART_NUMBER";
|
||||
sql+=WhereClause();
|
||||
sql+=" group by CART.NUMBER order by CART.NUMBER";
|
||||
if(lib_showmatches_box->isChecked()) {
|
||||
sql+=QString().sprintf(" limit %d",RD_LIMITED_CART_SEARCH_QUANTITY);
|
||||
}
|
||||
q=new RDSqlQuery(sql);
|
||||
int step=0;
|
||||
int count=0;
|
||||
int matches=0;
|
||||
lib_progress_dialog->setMaximum(q->size()/RDLIBRARY_STEP_SIZE);
|
||||
lib_progress_dialog->setValue(0);
|
||||
while(q->next()) {
|
||||
end_datetime=q->value(14).toDateTime();
|
||||
|
||||
//
|
||||
// Start a new entry
|
||||
//
|
||||
l=new RDListViewItem(lib_cart_list);
|
||||
l->setExpandable(false);
|
||||
switch((RDCart::Type)q->value(15).toUInt()) {
|
||||
case RDCart::Audio:
|
||||
if(q->value(21).isNull()) {
|
||||
l->setPixmap(Icon,*lib_playout_map);
|
||||
}
|
||||
else {
|
||||
l->setPixmap(Icon,*lib_track_cart_map);
|
||||
}
|
||||
break;
|
||||
|
||||
case RDCart::Macro:
|
||||
l->setPixmap(Icon,*lib_macro_map);
|
||||
l->setBackgroundColor(backgroundColor());
|
||||
break;
|
||||
|
||||
case RDCart::All:
|
||||
break;
|
||||
}
|
||||
l->setText(Cart,QString().sprintf("%06d",q->value(0).toUInt()));
|
||||
l->setText(Group,q->value(12).toString());
|
||||
l->setTextColor(Group,q->value(23).toString(),QFont::Bold);
|
||||
if(q->value(16).toUInt()==1) {
|
||||
l->setText(Length,RDGetTimeLength(q->value(1).toUInt()));
|
||||
l->setText(Talk,RDGetTimeLength(q->value(25).toUInt()-q->value(24).toUInt()));
|
||||
}
|
||||
l->setText(Title,q->value(2).toString());
|
||||
l->setText(Artist,q->value(3).toString());
|
||||
if(!q->value(13).toDateTime().isNull()) {
|
||||
l->setText(Start,q->value(13).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
if(!q->value(14).toDateTime().isNull()) {
|
||||
l->setText(End,q->value(14).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
l->setText(End,"TFN");
|
||||
}
|
||||
l->setText(Album,q->value(4).toString());
|
||||
l->setText(Label,q->value(5).toString());
|
||||
l->setText(Composer,q->value(9).toString());
|
||||
l->setText(Conductor,q->value(11).toString());
|
||||
l->setText(Publisher,q->value(10).toString());
|
||||
l->setText(Client,q->value(6).toString());
|
||||
l->setText(Agency,q->value(7).toString());
|
||||
l->setText(UserDefined,q->value(8).toString());
|
||||
l->setText(Cuts,q->value(16).toString());
|
||||
l->setText(LastCutPlayed,q->value(17).toString());
|
||||
l->setText(EnforceLength,q->value(18).toString());
|
||||
l->setText(PreservePitch,q->value(19).toString());
|
||||
l->setText(LengthDeviation,q->value(20).toString());
|
||||
l->setText(OwnedBy,q->value(21).toString());
|
||||
if(q->value(18).toString()=="Y") {
|
||||
l->setTextColor(Length,QColor(RDLIBRARY_ENFORCE_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
if((q->value(20).toUInt()>RDLIBRARY_MID_LENGTH_LIMIT)&&
|
||||
(q->value(18).toString()=="N")) {
|
||||
if(q->value(20).toUInt()>RDLIBRARY_MAX_LENGTH_LIMIT) {
|
||||
l->setTextColor(Length,QColor(RDLIBRARY_MAX_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
l->setTextColor(Length,QColor(RDLIBRARY_MID_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
}
|
||||
else {
|
||||
l->setTextColor(Length,QColor(Qt::black),QFont::Normal);
|
||||
}
|
||||
}
|
||||
if((RDCart::Type)q->value(15).toUInt()==RDCart::Audio) {
|
||||
RefreshCuts(l,q->value(0).toUInt());
|
||||
}
|
||||
else {
|
||||
l->setBackgroundColor(palette().color(QPalette::Active,QColorGroup::Base));
|
||||
}
|
||||
matches++;
|
||||
count++;
|
||||
|
||||
if(count>RDLIBRARY_STEP_SIZE) {
|
||||
lib_progress_dialog->setValue(++step);
|
||||
count=0;
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
}
|
||||
lib_progress_dialog->reset();
|
||||
lib_matches_edit->setText(QString().sprintf("%d",matches));
|
||||
delete q;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void SigHandler(int signo)
|
||||
{
|
||||
pid_t pLocalPid;
|
||||
@@ -1010,167 +800,6 @@ void SigHandler(int signo)
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::RefreshLine(RDListViewItem *item)
|
||||
{
|
||||
RDCart::Validity validity=RDCart::NeverValid;
|
||||
QDateTime current_datetime(QDate::currentDate(),QTime::currentTime());
|
||||
QString sql=QString("select ")+
|
||||
"CART.FORCED_LENGTH,"+ // 00
|
||||
"CART.TITLE,"+ // 01
|
||||
"CART.ARTIST,"+ // 02
|
||||
"CART.ALBUM,"+ // 03
|
||||
"CART.LABEL,"+ // 04
|
||||
"CART.CLIENT,"+ // 05
|
||||
"CART.AGENCY,"+ // 06
|
||||
"CART.USER_DEFINED,"+ // 07
|
||||
"CART.COMPOSER,"+ // 08
|
||||
"CART.CONDUCTOR,"+ // 09
|
||||
"CART.PUBLISHER,"+ // 10
|
||||
"CART.GROUP_NAME,"+ // 11
|
||||
"CART.START_DATETIME,"+ // 12
|
||||
"CART.END_DATETIME,"+ // 13
|
||||
"CART.TYPE,"+ // 14
|
||||
"CART.CUT_QUANTITY,"+ // 15
|
||||
"CART.LAST_CUT_PLAYED,"+ // 16
|
||||
"CART.ENFORCE_LENGTH,"+ // 17
|
||||
"CART.PRESERVE_PITCH,"+ // 18
|
||||
"CART.LENGTH_DEVIATION,"+ // 19
|
||||
"CART.OWNER,"+ // 20
|
||||
"CART.VALIDITY,"+ // 21
|
||||
"GROUPS.COLOR,"+ // 22
|
||||
"CUTS.TALK_START_POINT,"+ // 23
|
||||
"CUTS.TALK_END_POINT "+ // 24
|
||||
"from CART left join GROUPS "+
|
||||
"on CART.GROUP_NAME=GROUPS.NAME left join CUTS on "+
|
||||
"CART.NUMBER=CUTS.CART_NUMBER where "+
|
||||
QString().sprintf("CART.NUMBER=%u ",item->text(Cart).toUInt())+
|
||||
"group by CART.NUMBER";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
switch((RDCart::Type)q->value(14).toUInt()) {
|
||||
case RDCart::Audio:
|
||||
if(q->value(20).isNull()) {
|
||||
item->setPixmap(Icon,*lib_playout_map);
|
||||
}
|
||||
else {
|
||||
item->setPixmap(Icon,*lib_track_cart_map);
|
||||
}
|
||||
if(q->value(0).toUInt()==0) {
|
||||
item->setBackgroundColor(RD_CART_ERROR_COLOR);
|
||||
}
|
||||
else {
|
||||
UpdateItemColor(item,validity,
|
||||
q->value(13).toDateTime(),current_datetime);
|
||||
}
|
||||
break;
|
||||
|
||||
case RDCart::Macro:
|
||||
item->setPixmap(Icon,*lib_macro_map);
|
||||
break;
|
||||
|
||||
case RDCart::All:
|
||||
break;
|
||||
}
|
||||
item->setText(Group,q->value(11).toString());
|
||||
item->setTextColor(Group,q->value(22).toString(),QFont::Bold);
|
||||
if(q->value(15).toUInt()==1) {
|
||||
item->setText(Length,RDGetTimeLength(q->value(0).toUInt()));
|
||||
item->setText(Talk,RDGetTimeLength(q->value(24).toUInt()-q->value(23).toUInt()));
|
||||
}
|
||||
item->setText(Title,q->value(1).toString());
|
||||
item->setText(Artist,q->value(2).toString());
|
||||
item->setText(Album,q->value(3).toString());
|
||||
item->setText(Label,q->value(4).toString());
|
||||
item->setText(Composer,q->value(8).toString());
|
||||
item->setText(Conductor,q->value(9).toString());
|
||||
|
||||
item->setText(Publisher,q->value(10).toString());
|
||||
item->setText(Client,q->value(5).toString());
|
||||
item->setText(Agency,q->value(6).toString());
|
||||
if(!q->value(12).toDateTime().isNull()) {
|
||||
item->setText(Start,q->value(12).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
item->setText(Start,"");
|
||||
}
|
||||
if(!q->value(13).toDateTime().isNull()) {
|
||||
item->setText(End,q->value(13).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
item->setText(End,tr("TFN"));
|
||||
}
|
||||
item->setText(Cuts,q->value(15).toString());
|
||||
item->setText(LastCutPlayed,q->value(16).toString());
|
||||
item->setText(EnforceLength,q->value(17).toString());
|
||||
item->setText(PreservePitch,q->value(18).toString());
|
||||
item->setText(LengthDeviation,q->value(19).toString());
|
||||
item->setText(OwnedBy,q->value(20).toString());
|
||||
if(q->value(17).toString()=="Y") {
|
||||
item->setTextColor(Length,QColor(RDLIBRARY_ENFORCE_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
if((q->value(19).toUInt()>RDLIBRARY_MID_LENGTH_LIMIT)&&
|
||||
(q->value(17).toString()=="N")) {
|
||||
if(q->value(19).toUInt()>RDLIBRARY_MAX_LENGTH_LIMIT) {
|
||||
item->setTextColor(Length,QColor(RDLIBRARY_MAX_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
item->setTextColor(Length,QColor(RDLIBRARY_MID_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
}
|
||||
else {
|
||||
item->setTextColor(Length,QColor(Qt::black),QFont::Normal);
|
||||
}
|
||||
}
|
||||
|
||||
if((RDCart::Type)q->value(14).toUInt()==RDCart::Audio) {
|
||||
RefreshCuts(item,item->text(Cart).toUInt());
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::UpdateItemColor(RDListViewItem *item,
|
||||
RDCart::Validity validity,
|
||||
const QDateTime &end_datetime,
|
||||
const QDateTime ¤t_datetime)
|
||||
{
|
||||
if(item!=NULL) {
|
||||
switch(validity) {
|
||||
case RDCart::NeverValid:
|
||||
item->setBackgroundColor(RD_CART_ERROR_COLOR);
|
||||
break;
|
||||
|
||||
case RDCart::ConditionallyValid:
|
||||
if(end_datetime.isValid()&&
|
||||
(end_datetime<current_datetime)) {
|
||||
item->setBackgroundColor(RD_CART_ERROR_COLOR);
|
||||
}
|
||||
else {
|
||||
item->setBackgroundColor(RD_CART_CONDITIONAL_COLOR);
|
||||
}
|
||||
break;
|
||||
|
||||
case RDCart::FutureValid:
|
||||
item->setBackgroundColor(RD_CART_FUTURE_COLOR);
|
||||
break;
|
||||
|
||||
case RDCart::AlwaysValid:
|
||||
item->setBackgroundColor(palette().color(QPalette::Active,
|
||||
QColorGroup::Base));
|
||||
break;
|
||||
|
||||
case RDCart::EvergreenValid:
|
||||
item->setBackgroundColor(RD_CART_EVERGREEN_COLOR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::SetCaption(QString user)
|
||||
{
|
||||
QString str1;
|
||||
@@ -1182,17 +811,45 @@ void MainWidget::SetCaption(QString user)
|
||||
}
|
||||
|
||||
|
||||
int MainWidget::SingleSelectedCartLine() const
|
||||
int MainWidget::CurrentSelection(QModelIndexList *carts,
|
||||
QModelIndexList *cuts) const
|
||||
{
|
||||
int row=-1;
|
||||
QModelIndexList rows=lib_cart_view->selectionModel()->selectedRows();
|
||||
|
||||
if((lib_cart_view->selectionModel()->selectedRows().size()==1)&&
|
||||
(lib_cart_view->selectionModel()->selectedRows().first().internalId()==
|
||||
0)) {
|
||||
return lib_cart_view->selectionModel()->selectedRows().first().row();
|
||||
carts->clear();
|
||||
if(cuts!=NULL) {
|
||||
cuts->clear();
|
||||
}
|
||||
for(int i=0;i<rows.size();i++) {
|
||||
if(lib_cart_model->isCart(rows.at(i))) {
|
||||
carts->push_back(rows.at(i));
|
||||
}
|
||||
else {
|
||||
if(cuts!=NULL) {
|
||||
cuts->push_back(rows.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cuts!=NULL) {
|
||||
return (carts->size()>0)||(cuts->size()>0);
|
||||
}
|
||||
return carts->size()>0;
|
||||
}
|
||||
|
||||
return row;
|
||||
|
||||
void MainWidget::SelectRow(const QModelIndex &index)
|
||||
{
|
||||
if(index.isValid()) {
|
||||
lib_cart_view->selectionModel()->
|
||||
select(index,QItemSelectionModel::ClearAndSelect|QItemSelectionModel::Rows);
|
||||
lib_cart_view->scrollTo(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::SelectRow(unsigned cartnum)
|
||||
{
|
||||
SelectRow(lib_cart_model->cartRow(cartnum));
|
||||
}
|
||||
|
||||
|
||||
@@ -1247,18 +904,11 @@ void MainWidget::LockUser()
|
||||
|
||||
bool MainWidget::UnlockUser()
|
||||
{
|
||||
// RDListViewItem *item=NULL;
|
||||
|
||||
//
|
||||
// Process Deleted Carts
|
||||
//
|
||||
for(unsigned i=0;i<lib_deleted_carts.size();i++) {
|
||||
lib_cart_model->removeCart(lib_deleted_carts.at(i));
|
||||
/*
|
||||
if((item=(RDListViewItem *)lib_cart_list->findItem(QString().sprintf("%06u",lib_deleted_carts.at(i)),Cart))!=NULL) {
|
||||
delete item;
|
||||
}
|
||||
*/
|
||||
}
|
||||
lib_deleted_carts.clear();
|
||||
|
||||
@@ -1286,6 +936,30 @@ void MainWidget::SendNotification(RDNotification::Action action,
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::SetPlayer(RDCart::Type type)
|
||||
{
|
||||
switch(type) {
|
||||
case RDCart::Audio:
|
||||
lib_player->playButton()->show();
|
||||
lib_player->stopButton()->show();
|
||||
lib_macro_button->hide();
|
||||
break;
|
||||
|
||||
case RDCart::Macro:
|
||||
lib_player->playButton()->hide();
|
||||
lib_player->stopButton()->hide();
|
||||
lib_macro_button->show();
|
||||
break;
|
||||
|
||||
case RDCart::All:
|
||||
lib_player->playButton()->hide();
|
||||
lib_player->stopButton()->hide();
|
||||
lib_macro_button->hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication::setStyle(RD_GUI_STYLE);
|
||||
|
Reference in New Issue
Block a user