2021-01-20 Fred Gleason <fredg@paravelsystems.com>

* Updated the 'Default User' control in the 'Host' dialog in
	rdadmin(1) to use 'RDUserListModel'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-01-20 16:38:29 -05:00
parent 962abfa7fc
commit 38a2d40351
3 changed files with 24 additions and 28 deletions

View File

@ -20851,3 +20851,6 @@
* Added a 'RDUserListModel' class. * Added a 'RDUserListModel' class.
* Refactored the 'List Users' dialog in rdadmin(1) to use the * Refactored the 'List Users' dialog in rdadmin(1) to use the
model-based API. model-based API.
2021-01-20 Fred Gleason <fredg@paravelsystems.com>
* Updated the 'Default User' control in the 'Host' dialog in
rdadmin(1) to use 'RDUserListModel'.

View File

@ -2,7 +2,7 @@
// //
// Edit a Rivendell Workstation Configuration // Edit a Rivendell Workstation Configuration
// //
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -48,11 +48,8 @@
EditStation::EditStation(QString sname,QWidget *parent) EditStation::EditStation(QString sname,QWidget *parent)
: RDDialog(parent) : RDDialog(parent)
{ {
setModal(true);
RDSqlQuery *q; RDSqlQuery *q;
QString sql; QString sql;
int item=0;
char temp[256]; char temp[256];
// //
@ -108,14 +105,17 @@ EditStation::EditStation(QString sname,QWidget *parent)
station_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); station_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
// //
// Station Default Name // Station Default User Name
// //
station_default_name_edit=new QComboBox(this); station_username_box=new QComboBox(this);
station_default_name_edit->setEditable(false); station_username_box->setEditable(false);
station_default_name_label= station_username_model=new RDUserListModel(this);
new QLabel(station_default_name_edit,tr("Default &User:"),this); station_username_model->setTypeFilter(RDUser::TypeUser);
station_default_name_label->setFont(labelFont()); station_username_box->setModel(station_username_model);
station_default_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); station_username_label=
new QLabel(station_username_box,tr("Default &User:"),this);
station_username_label->setFont(labelFont());
station_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
// //
// Station IP Address // Station IP Address
@ -521,17 +521,7 @@ EditStation::EditStation(QString sname,QWidget *parent)
station_stop_cart_edit-> station_stop_cart_edit->
setText(QString().sprintf("%06u",station_station->cueStopCart())); setText(QString().sprintf("%06u",station_station->cueStopCart()));
} }
station_username_box->setCurrentText(station_station->defaultName());
sql="select LOGIN_NAME from USERS";
q=new RDSqlQuery(sql);
while(q->next()) {
station_default_name_edit->insertItem(q->value(0).toString());
if(q->value(0).toString()==station_station->defaultName()) {
station_default_name_edit->setCurrentItem(item);
}
item++;
}
delete q;
if((cartnum=station_station->heartbeatCart())>0) { if((cartnum=station_station->heartbeatCart())>0) {
station_heartbeat_box->setChecked(true); station_heartbeat_box->setChecked(true);
station_hbcart_edit->setText(QString().sprintf("%u",cartnum)); station_hbcart_edit->setText(QString().sprintf("%u",cartnum));
@ -593,6 +583,7 @@ EditStation::~EditStation()
{ {
delete station_station; delete station_station;
delete station_cae_station; delete station_cae_station;
delete station_username_model;
} }
@ -712,7 +703,7 @@ void EditStation::okData()
station_station->setCueStartCart(station_start_cart_edit->text().toInt()); station_station->setCueStartCart(station_start_cart_edit->text().toInt());
station_station->setCueStopCart(station_stop_cart_edit->text().toInt()); station_station->setCueStopCart(station_stop_cart_edit->text().toInt());
station_station->setDescription(station_description_edit->text()); station_station->setDescription(station_description_edit->text());
station_station->setDefaultName(station_default_name_edit->currentText()); station_station->setDefaultName(station_username_box->currentText());
station_station->setAddress(addr); station_station->setAddress(addr);
station_station-> station_station->
setEditorPath(station_audio_editor_edit->text()); setEditorPath(station_audio_editor_edit->text());
@ -914,8 +905,8 @@ void EditStation::resizeEvent(QResizeEvent *e)
station_description_edit->setGeometry(115,44,size().width()-120,19); station_description_edit->setGeometry(115,44,size().width()-120,19);
station_description_label->setGeometry(10,44,100,19); station_description_label->setGeometry(10,44,100,19);
station_default_name_edit->setGeometry(115,65,160,19); station_username_box->setGeometry(115,65,160,19);
station_default_name_label->setGeometry(10,65,100,19); station_username_label->setGeometry(10,65,100,19);
station_address_edit->setGeometry(115,86,120,19); station_address_edit->setGeometry(115,86,120,19);
station_address_label->setGeometry(10,86,100,19); station_address_label->setGeometry(10,86,100,19);

View File

@ -2,7 +2,7 @@
// //
// Edit a Rivendell Workstation // Edit a Rivendell Workstation
// //
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -34,6 +34,7 @@
#include <rdcatch_connect.h> #include <rdcatch_connect.h>
#include <rdripc.h> #include <rdripc.h>
#include <rdstation.h> #include <rdstation.h>
#include <rduserlistmodel.h>
class EditStation : public RDDialog class EditStation : public RDDialog
{ {
@ -84,8 +85,9 @@ class EditStation : public RDDialog
QLineEdit *station_short_name_edit; QLineEdit *station_short_name_edit;
QLabel *station_description_label; QLabel *station_description_label;
QLineEdit *station_description_edit; QLineEdit *station_description_edit;
QLabel *station_default_name_label; QLabel *station_username_label;
QComboBox *station_default_name_edit; QComboBox *station_username_box;
RDUserListModel *station_username_model;
QLabel *station_address_label; QLabel *station_address_label;
QLineEdit *station_address_edit; QLineEdit *station_address_edit;
QLabel *station_audio_editor_label; QLabel *station_audio_editor_label;