diff --git a/ChangeLog b/ChangeLog index 1ce2c0a3..ead74552 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16317,3 +16317,6 @@ * Removed 'docs/WIN32.txt'. * Removed 'docs/copy_split_format.odt'. * Moved remaining unformatted notes to 'docs/misc/. +2017-11-07 Fred Gleason + * Added the ability to delete multiple logs simultaneously in + rdlogedit(1). diff --git a/lib/rdlog.cpp b/lib/rdlog.cpp index 824b6c20..56cacd04 100644 --- a/lib/rdlog.cpp +++ b/lib/rdlog.cpp @@ -370,13 +370,11 @@ bool RDLog::remove(RDStation *station,RDUser *user,RDConfig *config) const { QString sql; RDSqlQuery *q; - QString name=log_name; - name.replace(" ","_"); if(removeTracks(station,user,config)<0) { return false; } - sql=QString().sprintf("drop table `%s_LOG`",(const char *)name); + sql=QString("drop table `")+RDLog::tableName(log_name)+"`"; q=new RDSqlQuery(sql); delete q; sql=QString().sprintf("delete from LOGS where (NAME=\"%s\" && TYPE=0)", diff --git a/rdlogedit/rdlogedit.cpp b/rdlogedit/rdlogedit.cpp index 9b9ad368..9981b788 100644 --- a/rdlogedit/rdlogedit.cpp +++ b/rdlogedit/rdlogedit.cpp @@ -290,7 +290,10 @@ MainWidget::MainWidget(QWidget *parent) log_log_list=new QListView(this); log_log_list->setFont(default_font); log_log_list->setAllColumnsShowFocus(true); + log_log_list->setSelectionMode(QListView::Extended); log_log_list->setItemMargin(5); + connect(log_log_list,SIGNAL(selectionChanged()), + this,SLOT(logSelectionChangedData())); connect(log_log_list, SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)), this, @@ -322,8 +325,6 @@ MainWidget::MainWidget(QWidget *parent) log_log_list->addColumn(tr("LAST MODIFIED")); log_log_list->setColumnAlignment(12,Qt::AlignLeft); - RefreshList(); - // // Add Button // @@ -375,6 +376,8 @@ MainWidget::MainWidget(QWidget *parent) log_close_button->setText(tr("&Close")); connect(log_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); + RefreshList(); + #ifndef WIN32 // // Setup Signal Handling @@ -486,19 +489,20 @@ void MainWidget::addData() void MainWidget::editData() { - ListListViewItem *item=(ListListViewItem *)log_log_list->selectedItem(); - std::vector newlogs; - - if(item==NULL) { + // ListListViewItem *item=(ListListViewItem *)log_log_list->selectedItem(); + std::vector items; + if(SelectedLogs(&items)!=1) { return; } - EditLog *log=new EditLog(item->text(1),&log_filter,&log_group,&log_schedcode, + + std::vector newlogs; + EditLog *log=new EditLog(items.at(0)->text(1),&log_filter,&log_group,&log_schedcode, &log_clipboard,&newlogs,this); log->exec(); delete log; - RefreshItem(item); + RefreshItem(items.at(0)); for(unsigned i=0;isetText(1,newlogs[i]); RefreshItem(item); } @@ -511,42 +515,74 @@ void MainWidget::deleteData() QString str1; QString str2; unsigned tracks=0; - QListViewItem *item=log_log_list->selectedItem(); + ListListViewItem *item=(ListListViewItem *)log_log_list->firstChild(); + std::vector items; - if(item==NULL) { - return; - } if(rduser->deleteLog()) { - if(QMessageBox::question(this,tr("Delete Log"), - tr(QString().sprintf("Are you sure you want to delete the \"%s\" log?", - (const char *)item->text(1))), - QMessageBox::Yes, - QMessageBox::No)!=QMessageBox::Yes) { - return; - } - RDLog *log=new RDLog(item->text(1)); - if((tracks=log->completedTracks())>0) { - str1=QString(tr("This will also delete the")); - str2=QString(tr("voice tracks associated with this log.\nContinue?")); - if(QMessageBox::question(this,tr("Tracks Exist"), - QString().sprintf("%s %u %s", - (const char *)str1, - tracks, - (const char *)str2), - QMessageBox::Yes,QMessageBox::No)!= - QMessageBox::Yes) { + while(item!=NULL) { + if(item->isSelected()) { + items.push_back(item); + RDLog *log=new RDLog(items.at(0)->text(1)); + tracks+=log->completedTracks(); delete log; + } + item=(ListListViewItem *)item->nextSibling(); + } + if(items.size()==1) { + if(QMessageBox::question(this,"RDLogEdit - "+tr("Delete Log"), + tr("Are you sure you want to delete the")+" \""+ + items.at(0)->text(1)+"\" "+tr("log?"), + QMessageBox::Yes, + QMessageBox::No)!=QMessageBox::Yes) { return; } + if(tracks>0) { + if(QMessageBox::question(this,"RDLogEdit - "+tr("Tracks Exist"), + tr("This will also delete the")+ + QString().sprintf(" %u ",tracks)+ + tr("voice tracks associated with this log.")+ + "\n"+tr("Continue?"), + QMessageBox::Yes,QMessageBox::No)!= + QMessageBox::Yes) { + return; + } + } } - if(!log->remove(rdstation_conf,rduser,log_config)) { - QMessageBox::warning(this,tr("RDLogEdit"), - tr("Unable to delete log, audio deletion error!")); + else { + if(QMessageBox::question(this,"RDLogEdit - "+tr("Delete Log"), + tr("Are you sure you want to delete these")+ + QString().sprintf(" %lu ",items.size())+ + tr("logs?"), + QMessageBox::Yes, + QMessageBox::No)!=QMessageBox::Yes) { + return; + } + if(tracks>0) { + if(QMessageBox::question(this,"RDLogEdit - "+tr("Tracks Exist"), + tr("This will also delete the")+ + QString().sprintf(" %u ",tracks)+ + tr("voice tracks associated with these logs.")+ + "\n"+tr("Continue?"), + QMessageBox::Yes,QMessageBox::No)!= + QMessageBox::Yes) { + return; + } + } + } + + for(unsigned i=0;itext(1)); + if(log->remove(rdstation_conf,rduser,log_config)) { + delete items.at(i); + } + else { + QMessageBox::warning(this,"RDLogEdit - "+tr("Error"), + tr("Unable to delete log")+" \""+ + items.at(i)->text(1)+"\", "+ + tr("audio deletion error!")); + } delete log; - return; } - delete log; - delete item; } } @@ -554,14 +590,14 @@ void MainWidget::deleteData() void MainWidget::trackData() { #ifndef WIN32 - ListListViewItem *item=(ListListViewItem *)log_log_list->selectedItem(); - if(item==NULL) { + std::vector items; + if(SelectedLogs(&items)!=1) { return; } - VoiceTracker *dialog=new VoiceTracker(item->text(1),&log_import_path); + VoiceTracker *dialog=new VoiceTracker(items.at(0)->text(1),&log_import_path); dialog->exec(); delete dialog; - RefreshItem(item); + RefreshItem(items.at(0)); #endif // WIN32 } @@ -701,6 +737,22 @@ void MainWidget::filterClearedData() } +void MainWidget::logSelectionChangedData() +{ + int count=0; + ListListViewItem *item=(ListListViewItem *)log_log_list->firstChild(); + while(item!=NULL) { + if(item->isSelected()) { + count++; + } + item=(ListListViewItem *)item->nextSibling(); + } + log_edit_button->setEnabled(count==1); + log_delete_button->setEnabled(count>0); + log_track_button->setEnabled(count==1); +} + + void MainWidget::logDoubleclickedData(QListViewItem *,const QPoint &,int) { editData(); @@ -839,6 +891,28 @@ void MainWidget::RefreshList() RefreshItem(item); } delete q; + logSelectionChangedData(); +} + + +unsigned MainWidget::SelectedLogs(std::vector *items, + int *tracks) const +{ + ListListViewItem *item=(ListListViewItem *)log_log_list->firstChild(); + + items->clear(); + while(item!=NULL) { + if(item->isSelected()) { + items->push_back(item); + if(tracks!=NULL) { + RDLog *log=new RDLog(item->text(1)); + (*tracks)+=log->completedTracks(); + delete log; + } + } + item=(ListListViewItem *)item->nextSibling(); + } + return items->size(); } diff --git a/rdlogedit/rdlogedit.h b/rdlogedit/rdlogedit.h index 1c393118..77481c06 100644 --- a/rdlogedit/rdlogedit.h +++ b/rdlogedit/rdlogedit.h @@ -62,6 +62,7 @@ class MainWidget : public QMainWindow void reportData(); void filterChangedData(const QString &str); void filterClearedData(); + void logSelectionChangedData(); void logDoubleclickedData(QListViewItem *item,const QPoint &pt,int col); void quitMainWidget(); @@ -71,6 +72,8 @@ class MainWidget : public QMainWindow private: void RefreshItem(ListListViewItem *item); void RefreshList(); + unsigned SelectedLogs(std::vector *items, + int *tracks=NULL) const; QSqlDatabase *log_db; QString log_filename; QString log_import_path; diff --git a/rdlogedit/rdlogedit_cs.ts b/rdlogedit/rdlogedit_cs.ts index 4398f3ec..d345719e 100644 --- a/rdlogedit/rdlogedit_cs.ts +++ b/rdlogedit/rdlogedit_cs.ts @@ -838,7 +838,7 @@ o zápisu voice tracks associated with this log. Continue? - stopy hlasů spojených s tímto zápisem. + stopy hlasů spojených s tímto zápisem. Pokračovat? @@ -855,11 +855,11 @@ Pokračovat? RDLogEdit - RDLogedit + RDLogedit Unable to delete log, audio deletion error! - Soubor se zápisem nelze smazat, chyba při mazání zvuku! + Soubor se zápisem nelze smazat, chyba při mazání zvuku! RDLogEdit -- Database Skew @@ -899,6 +899,46 @@ Vyhledejte svého správce systému kvůli aktualizaci! Show Only Recent Logs + + Are you sure you want to delete the + + + + log? + + + + voice tracks associated with this log. + + + + Continue? + + + + Are you sure you want to delete these + + + + logs? + + + + voice tracks associated with these logs. + + + + Error + + + + Unable to delete log + + + + audio deletion error! + + RenderDialog diff --git a/rdlogedit/rdlogedit_de.ts b/rdlogedit/rdlogedit_de.ts index 92dd1fbe..c37b3f6c 100644 --- a/rdlogedit/rdlogedit_de.ts +++ b/rdlogedit/rdlogedit_de.ts @@ -838,7 +838,7 @@ Report voice tracks associated with this log. Continue? - Voice Tracks die mit diesem Log verbunden sind. + Voice Tracks die mit diesem Log verbunden sind. Fortfahren? @@ -855,11 +855,11 @@ Fortfahren? RDLogEdit - RDLogEdit + RDLogEdit Unable to delete log, audio deletion error! - Kann Logdatei nicht löschen, Audiolöschfehler! + Kann Logdatei nicht löschen, Audiolöschfehler! RDLogEdit -- Database Skew @@ -898,6 +898,46 @@ See your system administrator for an update! Show Only Recent Logs + + Are you sure you want to delete the + + + + log? + + + + voice tracks associated with this log. + + + + Continue? + + + + Are you sure you want to delete these + + + + logs? + + + + voice tracks associated with these logs. + + + + Error + + + + Unable to delete log + + + + audio deletion error! + + RenderDialog diff --git a/rdlogedit/rdlogedit_es.ts b/rdlogedit/rdlogedit_es.ts index d6a90294..88014bff 100644 --- a/rdlogedit/rdlogedit_es.ts +++ b/rdlogedit/rdlogedit_es.ts @@ -806,7 +806,7 @@ desactivado para el servicio especificado! voice tracks associated with this log. Continue? - voicetracks asociados a esta lista. + voicetracks asociados a esta lista. ¿Desea continuar? @@ -853,13 +853,9 @@ Report Reporte de Listas - - RDLogEdit - - Unable to delete log, audio deletion error! - ¡No es posible eliminar la lista, error de eliminación de audios! + ¡No es posible eliminar la lista, error de eliminación de audios! RDLogEdit -- Database Skew @@ -899,6 +895,46 @@ See your system administrator for an update! Show Only Recent Logs + + Are you sure you want to delete the + + + + log? + + + + voice tracks associated with this log. + + + + Continue? + + + + Are you sure you want to delete these + + + + logs? + + + + voice tracks associated with these logs. + + + + Error + + + + Unable to delete log + + + + audio deletion error! + + RenderDialog diff --git a/rdlogedit/rdlogedit_fr.ts b/rdlogedit/rdlogedit_fr.ts index 370bc9f3..64c23735 100644 --- a/rdlogedit/rdlogedit_fr.ts +++ b/rdlogedit/rdlogedit_fr.ts @@ -809,11 +809,6 @@ Report This will also delete the - - voice tracks associated with this log. -Continue? - - Tracks Exist @@ -826,14 +821,6 @@ Continue? TFN - - RDLogEdit - - - - Unable to delete log, audio deletion error! - - RDLogEdit -- Database Skew @@ -871,6 +858,46 @@ See your system administrator for an update! Show Only Recent Logs + + Are you sure you want to delete the + + + + log? + + + + voice tracks associated with this log. + + + + Continue? + + + + Are you sure you want to delete these + + + + logs? + + + + voice tracks associated with these logs. + + + + Error + + + + Unable to delete log + + + + audio deletion error! + + RenderDialog diff --git a/rdlogedit/rdlogedit_nb.ts b/rdlogedit/rdlogedit_nb.ts index 34f91dd2..1ebe6c05 100644 --- a/rdlogedit/rdlogedit_nb.ts +++ b/rdlogedit/rdlogedit_nb.ts @@ -860,7 +860,7 @@ rapport voice tracks associated with this log. Continue? - røystspor som er kopla til denne loggen. + røystspor som er kopla til denne loggen. Vil du halda fram? @@ -877,11 +877,7 @@ Vil du halda fram? RDLogEdit - RDLogEdit - - - Unable to delete log, audio deletion error! - + RDLogEdit RDLogEdit -- Database Skew @@ -920,6 +916,46 @@ See your system administrator for an update! Show Only Recent Logs + + Are you sure you want to delete the + + + + log? + + + + voice tracks associated with this log. + + + + Continue? + + + + Are you sure you want to delete these + + + + logs? + + + + voice tracks associated with these logs. + + + + Error + + + + Unable to delete log + + + + audio deletion error! + + RenderDialog diff --git a/rdlogedit/rdlogedit_nn.ts b/rdlogedit/rdlogedit_nn.ts index 34f91dd2..1ebe6c05 100644 --- a/rdlogedit/rdlogedit_nn.ts +++ b/rdlogedit/rdlogedit_nn.ts @@ -860,7 +860,7 @@ rapport voice tracks associated with this log. Continue? - røystspor som er kopla til denne loggen. + røystspor som er kopla til denne loggen. Vil du halda fram? @@ -877,11 +877,7 @@ Vil du halda fram? RDLogEdit - RDLogEdit - - - Unable to delete log, audio deletion error! - + RDLogEdit RDLogEdit -- Database Skew @@ -920,6 +916,46 @@ See your system administrator for an update! Show Only Recent Logs + + Are you sure you want to delete the + + + + log? + + + + voice tracks associated with this log. + + + + Continue? + + + + Are you sure you want to delete these + + + + logs? + + + + voice tracks associated with these logs. + + + + Error + + + + Unable to delete log + + + + audio deletion error! + + RenderDialog diff --git a/rdlogedit/rdlogedit_pt_BR.ts b/rdlogedit/rdlogedit_pt_BR.ts index c6d1c009..d12a693b 100644 --- a/rdlogedit/rdlogedit_pt_BR.ts +++ b/rdlogedit/rdlogedit_pt_BR.ts @@ -839,7 +839,7 @@ Report voice tracks associated with this log. Continue? - faixas de voz associadas a esta Lista. + faixas de voz associadas a esta Lista. Continuar? @@ -856,11 +856,7 @@ Continuar? RDLogEdit - RDListas - - - Unable to delete log, audio deletion error! - + RDListas RDLogEdit -- Database Skew @@ -899,6 +895,46 @@ See your system administrator for an update! Show Only Recent Logs + + Are you sure you want to delete the + + + + log? + + + + voice tracks associated with this log. + + + + Continue? + + + + Are you sure you want to delete these + + + + logs? + + + + voice tracks associated with these logs. + + + + Error + + + + Unable to delete log + + + + audio deletion error! + + RenderDialog