2021-08-04 Fred Gleason <fredg@paravelsystems.com>

* Refactored the 'Mysql Login' dialog in rddbconfig(8) to be
	resizeable.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-08-04 10:36:12 -04:00
parent a0f87afcef
commit dc6b289574
3 changed files with 57 additions and 36 deletions

View File

@@ -22167,3 +22167,6 @@
2021-08-04 Fred Gleason <fredg@paravelsystems.com> 2021-08-04 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rddbconfig(8) that threw a segfault when attempting * Fixed a bug in rddbconfig(8) that threw a segfault when attempting
to create a new database. to create a new database.
2021-08-04 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'Mysql Login' dialog in rddbconfig(8) to be
resizeable.

View File

@@ -30,58 +30,51 @@ MySqlLogin::MySqlLogin(QString *username,QString *password,RDConfig *c,
login_password=password; login_password=password;
setWindowTitle(tr("mySQL Admin")); setWindowTitle(tr("mySQL Admin"));
setMinimumSize(sizeHint());
// //
// Message Label // Message Label
// //
QLabel *label=new QLabel(tr("Enter your MySQL administrator username and password\nThe Hostname and Database are found in /etc/rd.conf"),this); login_message_label=
label->setFont(labelFont()); new QLabel(tr("Enter your MySQL administrator username and password\nThe Hostname and Database are found in /etc/rd.conf"),this);
label->setGeometry(10,10,sizeHint().width()-20,30); login_message_label->setAlignment(Qt::AlignCenter);
label->setAlignment(Qt::AlignCenter);
// //
// MySql Login Name // MySql Login Name
// //
login_name_edit=new QLineEdit(this); login_name_edit=new QLineEdit(this);
login_name_edit->setGeometry(sizeHint().width()/2-125+90,50,140,19);
login_name_edit->setMaxLength(16); login_name_edit->setMaxLength(16);
login_name_edit->setFocus(); login_name_edit->setFocus();
QLabel *login_name_label=new QLabel(tr("Username:"),this); login_name_label=new QLabel(tr("Username:"),this);
login_name_label->setFont(labelFont()); login_name_label->setFont(labelFont());
login_name_label->setGeometry(sizeHint().width()/2-125,50,85,19);
login_name_label->setAlignment(Qt::AlignRight); login_name_label->setAlignment(Qt::AlignRight);
// //
// MySql Login Password // MySql Login Password
// //
login_password_edit=new QLineEdit(this); login_password_edit=new QLineEdit(this);
login_password_edit->setGeometry(sizeHint().width()/2-125+90,70,140,19);
login_password_edit->setMaxLength(16); login_password_edit->setMaxLength(16);
login_password_edit->setEchoMode(QLineEdit::Password); login_password_edit->setEchoMode(QLineEdit::Password);
QLabel *login_password_label=new QLabel(tr("Password:"),this); login_password_label=new QLabel(tr("Password:"),this);
login_password_label->setFont(labelFont()); login_password_label->setFont(labelFont());
login_password_label->setGeometry(sizeHint().width()/2-125,70,85,19);
login_password_label->setAlignment(Qt::AlignRight); login_password_label->setAlignment(Qt::AlignRight);
// //
// OK Button // OK Button
// //
QPushButton *ok_button=new QPushButton(this); login_ok_button=new QPushButton(this);
ok_button->setGeometry(sizeHint().width()/2-90,sizeHint().height()-60,80,50); login_ok_button->setFont(buttonFont());
ok_button->setFont(buttonFont()); login_ok_button->setText(tr("OK"));
ok_button->setText(tr("OK")); login_ok_button->setDefault(true);
ok_button->setDefault(true); connect(login_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));
// //
// Cancel Button // Cancel Button
// //
QPushButton *cancel_button=new QPushButton(this); login_cancel_button=new QPushButton(this);
cancel_button->setGeometry(sizeHint().width()/2+10,sizeHint().height()-60, login_cancel_button->setFont(buttonFont());
80,50); login_cancel_button->setText(tr("Cancel"));
cancel_button->setFont(buttonFont()); connect(login_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
cancel_button->setText(tr("Cancel"));
connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
} }
@@ -118,3 +111,18 @@ void MySqlLogin::cancelData()
done(1); done(1);
} }
void MySqlLogin::resizeEvent(QResizeEvent *e)
{
login_message_label->setGeometry(10,10,size().width()-20,30);
login_name_label->setGeometry(size().width()/2-125,50,85,19);
login_name_edit->setGeometry(size().width()/2-125+90,50,140,19);
login_password_label->setGeometry(size().width()/2-125,70,85,19);
login_password_edit->setGeometry(size().width()/2-125+90,70,140,19);
login_ok_button->setGeometry(size().width()/2-90,size().height()-60,80,50);
login_cancel_button->
setGeometry(size().width()/2+10,size().height()-60,80,50);
}

View File

@@ -22,29 +22,39 @@
#define MYSQL_LOGIN_H #define MYSQL_LOGIN_H
#include <QDialog> #include <QDialog>
#include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton>
#include <rddialog.h> #include <rddialog.h>
class MySqlLogin : public RDDialog class MySqlLogin : public RDDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
MySqlLogin(QString *username,QString *password,RDConfig *c, MySqlLogin(QString *username,QString *password,RDConfig *c,
QWidget *parent=0); QWidget *parent=0);
~MySqlLogin(); ~MySqlLogin();
QSize sizeHint() const; QSize sizeHint() const;
QSizePolicy sizePolicy() const; QSizePolicy sizePolicy() const;
private slots: private slots:
void okData(); void okData();
void cancelData(); void cancelData();
private: protected:
QString *login_name; void resizeEvent(QResizeEvent *e);
QLineEdit *login_name_edit;
QString *login_password; private:
QLineEdit *login_password_edit; QString *login_name;
QLabel *login_name_label;
QLabel *login_message_label;
QLineEdit *login_name_edit;
QString *login_password;
QLabel *login_password_label;
QLineEdit *login_password_edit;
QPushButton *login_ok_button;
QPushButton *login_cancel_button;
}; };