Added ability to duplicate dropboxes in rdadmin(1)

This commit is contained in:
Patrick Linstruth 2019-01-24 12:25:32 -08:00
parent 568fedd74a
commit aed4008c35
12 changed files with 115 additions and 1 deletions

View File

@ -18414,3 +18414,5 @@
* Updated comments in 'pypad.Receiver::serviceDescription()' and
'pypad.Receiver::padField()' methods to caution against confusing
the two.
2019-01-24 Patrick Linstruth <patrick@deltecent.com>
* Added the ability to duplicate dropboxes in rdadmin(1).

View File

@ -54,6 +54,43 @@ int RDDropbox::id() const
}
int RDDropbox::duplicate() const
{
int new_box_id;
RDDropbox *new_box=new RDDropbox(-1,stationName());
new_box_id=new_box->id();
new_box->setStationName(stationName());
new_box->setGroupName(groupName());
new_box->setPath(path());
new_box->setNormalizationLevel(normalizationLevel());
new_box->setAutotrimLevel(autotrimLevel());
new_box->setSingleCart(singleCart());
new_box->setForceToMono(forceToMono());
new_box->setToCart(toCart());
new_box->setUseCartchunkId(useCartchunkId());
new_box->setTitleFromCartchunkId(titleFromCartchunkId());
new_box->setDeleteCuts(deleteCuts());
new_box->setDeleteSource(deleteSource());
new_box->setMetadataPattern(metadataPattern());
new_box->setUserDefined(userDefined());
new_box->setStartdateOffset(startdateOffset());
new_box->setEnddateOffset(enddateOffset());
new_box->setFixBrokenFormats(fixBrokenFormats());
new_box->setLogPath(logPath());
new_box->setCreateDates(createDates());
new_box->setCreateStartdateOffset(createStartdateOffset());
new_box->setCreateEnddateOffset(createEnddateOffset());
new_box->setSegueLevel(segueLevel());
new_box->setSegueLength(segueLength());
delete new_box;
return new_box_id;
}
QString RDDropbox::stationName() const
{
return RDGetSqlValue("DROPBOXES","ID",box_id,"STATION_NAME").toString();

View File

@ -29,6 +29,7 @@ class RDDropbox
public:
RDDropbox(int id,const QString &stationname="");
int id() const;
int duplicate() const;
QString stationName() const;
void setStationName(const QString &name) const;
QString groupName() const;

View File

@ -79,6 +79,14 @@ ListDropboxes::ListDropboxes(const QString &stationname,QWidget *parent)
list_edit_button->setText(tr("&Edit"));
connect(list_edit_button,SIGNAL(clicked()),this,SLOT(editData()));
//
// Delete Button
//
list_duplicate_button=new QPushButton(this);
list_duplicate_button->setFont(font);
list_duplicate_button->setText(tr("D&uplicate"));
connect(list_duplicate_button,SIGNAL(clicked()),this,SLOT(duplicateData()));
//
// Delete Button
//
@ -196,6 +204,41 @@ void ListDropboxes::editData()
}
void ListDropboxes::duplicateData()
{
RDListViewItem *item=(RDListViewItem *)list_dropboxes_view->selectedItem();
if(item==NULL) {
return;
}
RDDropbox *src_box=new RDDropbox(item->id(),list_stationname);
int new_box_id=src_box->duplicate();
delete src_box;
EditDropbox *edit_dropbox=new EditDropbox(new_box_id,this);
if(edit_dropbox->exec()) {
RDNotification *notify=new RDNotification(RDNotification::DropboxType,
RDNotification::AddAction,
list_stationname);
rda->ripc()->sendNotification(*notify);
delete notify;
}
else {
QString sql=QString().sprintf("delete from DROPBOXES where ID=%d",new_box_id);
RDSqlQuery *q=new RDSqlQuery(sql);
delete q;
delete edit_dropbox;
return;
}
item=new RDListViewItem(list_dropboxes_view);
item->setId(new_box_id);
RefreshItem(item);
item->setSelected(true);
list_dropboxes_view->setCurrentItem(item);
list_dropboxes_view->ensureItemVisible(item);
}
void ListDropboxes::deleteData()
{
QString sql;
@ -240,7 +283,8 @@ void ListDropboxes::resizeEvent(QResizeEvent *e)
{
list_add_button->setGeometry(size().width()-90,10,80,50);
list_edit_button->setGeometry(size().width()-90,70,80,50);
list_delete_button->setGeometry(size().width()-90,130,80,50);
list_duplicate_button->setGeometry(size().width()-90,130,80,50);
list_delete_button->setGeometry(size().width()-90,190,80,50);
list_close_button->setGeometry(size().width()-90,size().height()-60,80,50);
list_dropboxes_view->
setGeometry(10,10,size().width()-120,size().height()-40);

View File

@ -41,6 +41,7 @@ class ListDropboxes : public QDialog
private slots:
void addData();
void editData();
void duplicateData();
void deleteData();
void doubleClickedData(Q3ListViewItem *item,const QPoint &pt,int col);
void closeData();
@ -55,6 +56,7 @@ class ListDropboxes : public QDialog
RDListView *list_dropboxes_view;
QPushButton *list_add_button;
QPushButton *list_edit_button;
QPushButton *list_duplicate_button;
QPushButton *list_delete_button;
QPushButton *list_close_button;
QString list_stationname;

View File

@ -4653,6 +4653,10 @@ Jste si jistý, že chcete pokračovat?</translation>
<source>Rivendell Dropbox Configurations on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>D&amp;uplicate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListEncoders</name>

View File

@ -4515,6 +4515,10 @@ anzeigen</translation>
<source>Rivendell Dropbox Configurations on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>D&amp;uplicate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListEncoders</name>

View File

@ -4620,6 +4620,10 @@ Are you sure you want to continue?</source>
<source>Rivendell Dropbox Configurations on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>D&amp;uplicate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListEncoders</name>

View File

@ -3766,6 +3766,10 @@ PARTICULAR PURPOSE. Touch the &quot;View License&quot; button for details.</sou
<source>Rivendell Dropbox Configurations on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>D&amp;uplicate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListEndpoints</name>

View File

@ -4420,6 +4420,10 @@ Klikk på &quot;Lisens&quot;-knappen for fleire opplysningar.</translation>
<source>Rivendell Dropbox Configurations on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>D&amp;uplicate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListEncoders</name>

View File

@ -4420,6 +4420,10 @@ Klikk på &quot;Lisens&quot;-knappen for fleire opplysningar.</translation>
<source>Rivendell Dropbox Configurations on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>D&amp;uplicate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListEncoders</name>

View File

@ -4495,6 +4495,10 @@ FINALIDADE PARTICULAR. Aperte o botão VER LICENÇA para mais detalhes.</transl
<source>Rivendell Dropbox Configurations on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>D&amp;uplicate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ListEncoders</name>