2021-03-22 Fred Gleason <fredg@paravelsystems.com>

* Added code to select the first cut by default in the 'Edit Cart'
	in rdlibrary(1) if no validity constraints in said cut are found.
	* Fixed regressions in the 'Edit Cart' dialog in rdlibrary(1) that
	caused focus on the Cut entry to be lost after modifying cut
	attributes.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-03-22 13:15:40 -04:00
parent c1b5926e2d
commit 99d81a326b
4 changed files with 40 additions and 39 deletions

View File

@ -21336,3 +21336,9 @@
2021-03-22 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdcatch(1) that threw a SQL error when
attempting to create a new event.
2021-03-22 Fred Gleason <fredg@paravelsystems.com>
* Added code to select the first cut by default in the 'Edit Cart'
in rdlibrary(1) if no validity constraints in said cut are found.
* Fixed regressions in the 'Edit Cart' dialog in rdlibrary(1) that
caused focus on the Cut entry to be lost after modifying cut
attributes.

View File

@ -217,20 +217,22 @@ void RDCutListModel::removeCut(const QString &cutname)
}
void RDCutListModel::refresh(const QModelIndex &row)
QModelIndex RDCutListModel::refresh(const QModelIndex &row)
{
updateCutLine(row.row());
return row;
}
void RDCutListModel::refresh(const QString &cutname)
QModelIndex RDCutListModel::refresh(const QString &cutname)
{
for(int i=0;i<d_texts.size();i++) {
if(d_texts.at(d_row_index.at(i)).at(12)==cutname) {
updateCutLine(i);
return;
return createIndex(i,0);
}
}
return QModelIndex();
}

View File

@ -48,8 +48,8 @@ class RDCutListModel : public QAbstractTableModel
QModelIndex addCut(const QString &name);
void removeCut(const QModelIndex &index);
void removeCut(const QString &cutname);
void refresh(const QModelIndex &index);
void refresh(const QString &cutname);
QModelIndex refresh(const QModelIndex &index);
QModelIndex refresh(const QString &cutname);
unsigned cartNumber() const;
QModelIndex row(const QString &cutname) const;
bool playOrderDuplicates(QList<int> *values) const;

View File

@ -222,7 +222,20 @@ void AudioCart::changeCutScheduling(int sched)
rdcart_cut_model->setCartNumber(rdcart_cart->number());
rdcart_cut_view->setModel(rdcart_cut_model);
rdcart_cut_view->resizeColumnsToContents();
if(old_model==NULL) { // Set default cut selection
if(rdcart_cut_model->rowCount()>0) {
RDCut *cut=
new RDCut(rdcart_cut_model->cutName(rdcart_cut_model->index(0,0)));
if(cut->validity()==RDCut::AlwaysValid) {
rdcart_cut_view->selectRow(0);
}
delete cut;
}
}
else {
delete old_model;
}
if(sched) {
rdcart_cut_view->sortByColumn(12,Qt::AscendingOrder);
@ -445,39 +458,13 @@ void AudioCart::editCutData()
rdcart_cart->updateLength(rdcart_controls->enforce_length_box->isChecked(),
QTime().msecsTo(rdcart_controls->
forced_length_edit->time()));
rdcart_cut_model->refresh(row);
QModelIndex index=rdcart_cut_model->refresh(row);
if(index.isValid()) {
rdcart_cut_view->selectRow(index.row());
}
}
}
/*
void AudioCart::editCutData()
{
QModelIndex row=SingleSelectedLine();
if(!row.isValid()) {
return;
}
QString cutname=rdcart_cut_model->cutName(row);
if(!RDAudioExists(cutname)) {
QMessageBox::information(this,"RDLibrary",
tr("No audio is present in the cut!"));
return;
}
RDEditAudio *edit=
new RDEditAudio(rdcart_cart,cutname,rda->libraryConf()->outputCard(),
rda->libraryConf()->outputPort(),
rda->libraryConf()->tailPreroll(),
rda->libraryConf()->trimThreshold(),this);
if(edit->exec()!=-1) {
emit cartDataChanged();
rdcart_cart->updateLength(rdcart_controls->enforce_length_box->isChecked(),
QTime().msecsTo(rdcart_controls->
forced_length_edit->time()));
rdcart_cut_model->refresh(row);
}
delete edit;
}
*/
void AudioCart::recordCutData()
{
@ -552,7 +539,10 @@ void AudioCart::ripCutData()
rdcart_cart->updateLength(rdcart_controls->enforce_length_box->isChecked(),
QTime().msecsTo(rdcart_controls->
forced_length_edit->time()));
rdcart_cut_model->refresh(row);
row=rdcart_cut_model->refresh(row);
if(row.isValid()) {
rdcart_cut_view->selectRow(row.row());
}
}
@ -630,7 +620,10 @@ void AudioCart::importCutData()
rdcart_cart->updateLength(rdcart_controls->enforce_length_box->isChecked(),
QTime().msecsTo(rdcart_controls->
forced_length_edit->time()));
rdcart_cut_model->refresh(row);
row=rdcart_cut_model->refresh(row);
if(row.isValid()) {
rdcart_cut_view->selectRow(row.row());
}
}