2021-02-02 Fred Gleason <fredg@paravelsystems.com>

* Refactored the 'Autofill Carts' dialog in rdadmin(1) to use the
	model-based API.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-02-02 16:56:15 -05:00
parent ffea0d3279
commit 7d25c0c040
14 changed files with 186 additions and 197 deletions

View File

@@ -182,7 +182,6 @@ QSize RDCartDialog::sizeHint() const
int RDCartDialog::exec(int *cartnum,RDCart::Type type,const QString &svc,
bool *temp_allowed)
{
printf("RDCartDialog service: %s\n",svc.toUtf8().constData());
LoadState();
cart_cart_filter->setShowCartType(type);
cart_cart_filter->setService(svc);
@@ -416,7 +415,7 @@ void RDCartDialog::loadFileData()
delete conv;
delete cart;
delete cut;
done(0);
done(true);
}
}
@@ -438,7 +437,7 @@ void RDCartDialog::okData()
}
}
done(0);
done(true);
}
@@ -448,7 +447,7 @@ void RDCartDialog::cancelData()
if(cart_player!=NULL) {
cart_player->stop();
}
done(-1);
done(false);
}

View File

@@ -51,11 +51,6 @@ class RDCartDialog : public RDDialog
public slots:
int exec(int *cartnum,RDCart::Type type,const QString &svc,
bool *temp_allowed);
// int exec(int *cartnum,RDCart::Type type,QString *svcname,int svc_quan,
// bool *temp_allowed);
// int exec(int *cartnum,RDCart::Type type,QString *svcname,int svc_quan,
// const QString &username,const QString &passwd,
// bool *temp_allowed=NULL);
private slots:
void modelResetData();

View File

@@ -420,6 +420,24 @@ QModelIndex RDLibraryModel::addCart(unsigned cartnum)
}
void RDLibraryModel::removeCart(const QModelIndex &index)
{
beginRemoveRows(QModelIndex(),index.row(),index.row());
d_texts.removeAt(index.row());
d_notes.removeAt(index.row());
d_cart_numbers.removeAt(index.row());
d_cut_texts.removeAt(index.row());
d_cut_cutnames.removeAt(index.row());
d_background_colors.removeAt(index.row());
d_cart_types.removeAt(index.row());
d_icons.removeAt(index.row());
endRemoveRows();
emit rowCountChanged(d_texts.size());
}
void RDLibraryModel::removeCart(unsigned cartnum)
{
for(int i=0;i<d_texts.size();i++) {

View File

@@ -60,6 +60,7 @@ class RDLibraryModel : public QAbstractItemModel
QString cutName(const QModelIndex &index) const;
QString cartOwnedBy(const QModelIndex &index);
QModelIndex addCart(unsigned cartnum);
void removeCart(const QModelIndex &index);
void removeCart(unsigned cartnum);
void refreshRow(const QModelIndex &index);
void refreshCart(unsigned cartnum);