Merge branch 'deltecent-dropbox'

This commit is contained in:
Fred Gleason 2019-01-25 09:16:36 -08:00
commit 16d43261a3
14 changed files with 141 additions and 6 deletions

View File

@ -18422,3 +18422,5 @@
rdairplay(1).
2019-01-25 Patrick Linstruth <patrick@deltecent.com>
* Fixed regression with RDTransportButton taking focus from lists.
2019-01-25 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

@ -42,7 +42,7 @@
#include "globals.h"
#include "edit_dropbox.h"
EditDropbox::EditDropbox(int id,QWidget *parent)
EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent)
: QDialog(parent)
{
setModal(true);
@ -403,7 +403,7 @@ EditDropbox::EditDropbox(int id,QWidget *parent)
//
// Ok Button
//
QPushButton *ok_button=new QPushButton(this);
ok_button=new QPushButton(this);
ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
ok_button->setDefault(true);
ok_button->setFont(font);
@ -472,6 +472,13 @@ EditDropbox::EditDropbox(int id,QWidget *parent)
box_schedcodes.push_back(q->value(0).toString());
}
delete q;
if(duplicate) {
box_path=box_dropbox->path();
connect(box_path_edit,SIGNAL(textChanged(QString)),this,SLOT(pathChangedData(QString)));
ok_button->setEnabled(false);
box_path_edit->setFocus();
}
}
@ -497,6 +504,17 @@ void EditDropbox::selectPathData()
}
void EditDropbox::pathChangedData(QString text)
{
if(box_path!=text) {
ok_button->setEnabled(true);
}
else {
ok_button->setEnabled(false);
}
}
void EditDropbox::selectCartData()
{
int cartnum=box_to_cart_edit->text().toInt();

View File

@ -42,12 +42,13 @@ class EditDropbox : public QDialog
{
Q_OBJECT
public:
EditDropbox(int id,QWidget *parent=0);
EditDropbox(int id,bool duplicate=false,QWidget *parent=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
private slots:
void selectPathData();
void pathChangedData(QString text);
void selectCartData();
void selectLogPathData();
void schedcodesData();
@ -63,6 +64,7 @@ class EditDropbox : public QDialog
RDDropbox *box_dropbox;
QComboBox *box_group_name_box;
QLineEdit *box_path_edit;
QString box_path;
QLineEdit *box_to_cart_edit;
QPushButton *box_schedcodes_button;
QCheckBox *box_delete_cuts_box;
@ -85,6 +87,7 @@ class EditDropbox : public QDialog
QCheckBox *box_title_from_cartchunk_id_box;
QCheckBox *box_fix_broken_formats_box;
QPushButton *box_select_cart_button;
QPushButton *ok_button;
QSpinBox *box_startoffset_spin;
QSpinBox *box_endoffset_spin;
QCheckBox *box_create_dates_box;

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()));
//
// Duplicate 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
//
@ -153,7 +161,7 @@ void ListDropboxes::addData()
RDDropbox *box=new RDDropbox(-1,list_stationname);
int id=box->id();
delete box;
EditDropbox *edit_dropbox=new EditDropbox(id,this);
EditDropbox *edit_dropbox=new EditDropbox(id,false,this);
if(edit_dropbox->exec()) {
RDNotification *notify=new RDNotification(RDNotification::DropboxType,
RDNotification::AddAction,
@ -183,7 +191,7 @@ void ListDropboxes::editData()
if(item==NULL) {
return;
}
EditDropbox *edit_dropbox=new EditDropbox(item->id(),this);
EditDropbox *edit_dropbox=new EditDropbox(item->id(),false,this);
if(edit_dropbox->exec()) {
RDNotification *notify=new RDNotification(RDNotification::DropboxType,
RDNotification::ModifyAction,
@ -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,true,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>