2019-10-07 Fred Gleason <fredg@paravelsystems.com>

* Refactored rddbconfig(8) to use the 'RDDialog' and 'RDWidget'
	base classes.
This commit is contained in:
Fred Gleason
2019-10-07 13:24:41 -04:00
parent 4c41f7f5aa
commit c8ed729c98
5 changed files with 35 additions and 69 deletions

View File

@@ -2,7 +2,7 @@
//
// mySQL Administrative Login widget for RDDbConfig
//
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
//
// 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 <qdialog.h>
#include <qdialog.h>
#include <qsize.h>
#include <qsizepolicy.h>
#include <qsqldatabase.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpixmap.h>
#include <q3progressdialog.h>
#include <qtimer.h>
#include <rdlabel.h>
#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()));
}