From 99a5e3682c2e05b5f9f35e48ffa49958a557b175 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 2 Feb 2021 20:38:06 -0500 Subject: [PATCH] 2021-02-02 Fred Gleason * Refactored the 'System-Wide Settings' dialog in rdadmin(1) to use the model-based API. Signed-off-by: Fred Gleason --- rdadmin/edit_system.cpp | 16 ++++------------ rdadmin/edit_system.h | 2 ++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/rdadmin/edit_system.cpp b/rdadmin/edit_system.cpp index d480f2f3..1c5a93f5 100644 --- a/rdadmin/edit_system.cpp +++ b/rdadmin/edit_system.cpp @@ -140,12 +140,8 @@ EditSystem::EditSystem(QWidget *parent) // Temporary Cart Group // edit_temp_cart_group_box=new QComboBox(this); - sql="select NAME from GROUPS order by NAME"; - q=new RDSqlQuery(sql); - while(q->next()) { - edit_temp_cart_group_box->insertItem(q->value(0).toString()); - } - delete q; + edit_temp_cart_group_model=new RDGroupListModel(false,true,this); + edit_temp_cart_group_box->setModel(edit_temp_cart_group_model); edit_temp_cart_group_label= new QLabel(edit_temp_cart_group_box,tr("Temporary Cart Group:"),this); edit_temp_cart_group_label->setFont(labelFont()); @@ -252,11 +248,7 @@ EditSystem::EditSystem(QWidget *parent) edit_sample_rate_box->setCurrentItem(i); } } - for(int i=0;icount();i++) { - if(edit_temp_cart_group_box->text(i)==edit_system->tempCartGroup()) { - edit_temp_cart_group_box->setCurrentItem(i); - } - } + edit_temp_cart_group_box->setCurrentText(edit_system->tempCartGroup()); } @@ -519,7 +511,7 @@ void EditSystem::resizeEvent(QResizeEvent *e) edit_maxpost_label->setGeometry(10,164,235,20); edit_maxpost_unit_label->setGeometry(315,164,60,20); - edit_temp_cart_group_box->setGeometry(250,185,100,20); + edit_temp_cart_group_box->setGeometry(250,185,140,20); edit_temp_cart_group_label->setGeometry(10,185,235,20); edit_rss_processor_label->setGeometry(10,207,235,20); diff --git a/rdadmin/edit_system.h b/rdadmin/edit_system.h index cda39c91..10f4df56 100644 --- a/rdadmin/edit_system.h +++ b/rdadmin/edit_system.h @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -74,6 +75,7 @@ class EditSystem : public RDDialog QLineEdit *edit_origin_email_addr_edit; QLabel *edit_temp_cart_group_label; QComboBox *edit_temp_cart_group_box; + RDGroupListModel *edit_temp_cart_group_model; QComboBox *edit_rss_processor_station_box; QLabel *edit_show_user_list_label; QCheckBox *edit_show_user_list_box;