diff --git a/ChangeLog b/ChangeLog index e8afb868..2abcd40a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19166,3 +19166,6 @@ 2019-10-07 Fred Gleason * Refactored rdalsaconfig(8) to use the 'RDDialog' and 'RDWidget' base classes. +2019-10-07 Fred Gleason + * Refactored rddbconfig(8) to use the 'RDDialog' and 'RDWidget' + base classes. diff --git a/utils/rddbconfig/mysql_login.cpp b/utils/rddbconfig/mysql_login.cpp index e895c358..ca1f204b 100644 --- a/utils/rddbconfig/mysql_login.cpp +++ b/utils/rddbconfig/mysql_login.cpp @@ -2,7 +2,7 @@ // // mySQL Administrative Login widget for RDDbConfig // -// (C) Copyright 2002-2018 Fred Gleason +// (C) Copyright 2002-2019 Fred Gleason // // 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 @@ -18,42 +18,25 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include #include #include "mysql_login.h" MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent) - : QDialog(parent,"",true) + : RDDialog(parent) { - setCaption(tr("mySQL Admin")); login_name=username; login_password=password; - // - // Create Fonts - // - QFont font=QFont("Helvetica",12,QFont::Normal); - font.setPixelSize(12); + setWindowTitle(tr("mySQL Admin")); // // Message Label // RDLabel *label=new RDLabel(tr("Enter your MySQL administrator username and password\nThe Hostname and Database are found in /etc/rd.conf"),this); - label->setFont(font); + label->setFont(labelFont()); label->setGeometry(10,10,sizeHint().width()-20,30); label->setAlignment(Qt::AlignCenter); @@ -61,12 +44,11 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent) // MySql Login Name // login_name_edit=new QLineEdit(this); - login_name_edit->setFont(font); login_name_edit->setGeometry(sizeHint().width()/2-125+90,50,140,19); login_name_edit->setMaxLength(16); login_name_edit->setFocus(); QLabel *login_name_label=new QLabel(login_name_edit,tr("&Username:"),this); - login_name_label->setFont(font); + login_name_label->setFont(labelFont()); login_name_label->setGeometry(sizeHint().width()/2-125,50,85,19); login_name_label->setAlignment(Qt::AlignRight|Qt::ShowPrefix); @@ -74,12 +56,12 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent) // MySql Login Password // login_password_edit=new QLineEdit(this); - login_password_edit->setFont(font); login_password_edit->setGeometry(sizeHint().width()/2-125+90,70,140,19); login_password_edit->setMaxLength(16); login_password_edit->setEchoMode(QLineEdit::Password); - QLabel *login_password_label=new QLabel(login_password_edit,tr("&Password:"),this); - login_password_label->setFont(font); + QLabel *login_password_label= + new QLabel(login_password_edit,tr("&Password:"),this); + login_password_label->setFont(labelFont()); login_password_label->setGeometry(sizeHint().width()/2-125,70,85,19); login_password_label->setAlignment(Qt::AlignRight|Qt::ShowPrefix); @@ -88,7 +70,7 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent) // QPushButton *ok_button=new QPushButton(this); ok_button->setGeometry(sizeHint().width()/2-90,sizeHint().height()-60,80,50); - ok_button->setFont(font); + ok_button->setFont(buttonFont()); ok_button->setText(tr("&OK")); ok_button->setDefault(true); connect(ok_button,SIGNAL(clicked()),this,SLOT(okData())); @@ -99,7 +81,7 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent) QPushButton *cancel_button=new QPushButton(this); cancel_button->setGeometry(sizeHint().width()/2+10,sizeHint().height()-60, 80,50); - cancel_button->setFont(font); + cancel_button->setFont(buttonFont()); cancel_button->setText(tr("&Cancel")); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); } diff --git a/utils/rddbconfig/mysql_login.h b/utils/rddbconfig/mysql_login.h index cfc4fcd5..812da866 100644 --- a/utils/rddbconfig/mysql_login.h +++ b/utils/rddbconfig/mysql_login.h @@ -1,8 +1,8 @@ // mysql_login.h // -// mySQL Administrative Login Widget for RDAdmin. +// mySQL Administrative Login Widget for rddbconfig(8). // -// (C) Copyright 2002-2003,2016 Fred Gleason +// (C) Copyright 2002-2019 Fred Gleason // // 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 @@ -23,11 +23,10 @@ #include #include -#include -#include -#include -class MySqlLogin : public QDialog +#include + +class MySqlLogin : public RDDialog { Q_OBJECT public: @@ -48,6 +47,4 @@ class MySqlLogin : public QDialog }; -#endif - - +#endif // MYSQL_LOGIN_H diff --git a/utils/rddbconfig/rddbconfig.cpp b/utils/rddbconfig/rddbconfig.cpp index 460b5225..28633bb7 100644 --- a/utils/rddbconfig/rddbconfig.cpp +++ b/utils/rddbconfig/rddbconfig.cpp @@ -44,8 +44,8 @@ // // Globals // -MainWidget::MainWidget(QWidget *parent) - : QWidget(parent) +MainWidget::MainWidget(RDConfig *c,QWidget *parent) + : RDWidget(c,parent) { QString err_msg; @@ -65,35 +65,24 @@ MainWidget::MainWidget(QWidget *parent) rd_config->load(); rd_config->setModuleName("rddbconfig"); - setWindowTitle(tr("RDDbConfig")+" v"+VERSION); // // Create And Set Icon // setWindowIcon(QPixmap(rivendell_22x22_xpm)); + setWindowTitle(tr("RDDbConfig")+" v"+VERSION); // // Fix the Window Size // - setMinimumWidth(sizeHint().width()); - setMinimumHeight(sizeHint().height()); - - // - // Generate Fonts - // - QFont font("Helvetica",12,QFont::Normal); - font.setPixelSize(12); - QFont label_font("Helvetica",12,QFont::Bold); - label_font.setPixelSize(12); - QFont day_font=QFont("Helvetica",12,QFont::Normal); - day_font.setPixelSize(12); + setMinimumSize(sizeHint()); // // Labels // QLabel *label=new QLabel(tr("Select an operation:"),this); label->setGeometry(0,90,sizeHint().width(),16); - label->setFont(label_font); + label->setFont(labelFont()); label->setAlignment(Qt::AlignCenter); label_hostname=new QLabel(QString().sprintf("SQL Server: %s", @@ -123,28 +112,28 @@ MainWidget::MainWidget(QWidget *parent) // Create Button // db_create_button=new QPushButton(tr("Create"),this); - db_create_button->setFont(label_font); + db_create_button->setFont(buttonFont()); connect(db_create_button,SIGNAL(clicked()),this,SLOT(createData())); // // Backup Button // db_backup_button=new QPushButton(tr("Backup"),this); - db_backup_button->setFont(label_font); + db_backup_button->setFont(buttonFont()); connect(db_backup_button,SIGNAL(clicked()),this,SLOT(backupData())); // // Restore Button // db_restore_button=new QPushButton(tr("Restore"),this); - db_restore_button->setFont(label_font); + db_restore_button->setFont(buttonFont()); connect(db_restore_button,SIGNAL(clicked()),this,SLOT(restoreData())); // // Close Button // db_close_button=new QPushButton(tr("Close"),this); - db_close_button->setFont(label_font); + db_close_button->setFont(buttonFont()); connect(db_close_button,SIGNAL(clicked()),this,SLOT(closeData())); // @@ -453,9 +442,10 @@ int main(int argc,char *argv[]) // // Start GUI // - QApplication::setStyle(RD_GUI_STYLE); + RDConfig *config=new RDConfig(); + config->load(); QApplication a(argc,argv); - MainWidget *w=new MainWidget(); + MainWidget *w=new MainWidget(config); a.setMainWidget(w); return a.exec(); } diff --git a/utils/rddbconfig/rddbconfig.h b/utils/rddbconfig/rddbconfig.h index d5e98880..c69e1167 100644 --- a/utils/rddbconfig/rddbconfig.h +++ b/utils/rddbconfig/rddbconfig.h @@ -22,26 +22,20 @@ #ifndef RDDBCONFIG_H #define RDDBCONFIG_H -#include -#include -#include #include +#include -#include - -#include -#include +#include #include "db.h" #define RDDBCONFIG_USAGE "\n\n"; -class MainWidget : public QWidget +class MainWidget : public RDWidget { Q_OBJECT - public: - MainWidget(QWidget *parent=0); + MainWidget(RDConfig *c,QWidget *parent=0); ~MainWidget(); QSize sizeHint() const; QSizePolicy sizePolicy() const;