mirror of
				https://github.com/ElvishArtisan/rivendell.git
				synced 2025-11-03 23:53:59 +01:00 
			
		
		
		
	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:
		@@ -22167,3 +22167,6 @@
 | 
			
		||||
2021-08-04 Fred Gleason <fredg@paravelsystems.com>
 | 
			
		||||
	* Fixed a bug in rddbconfig(8) that threw a segfault when attempting
 | 
			
		||||
	to create a new database.
 | 
			
		||||
2021-08-04 Fred Gleason <fredg@paravelsystems.com>
 | 
			
		||||
	* Refactored the 'Mysql Login' dialog in rddbconfig(8) to be
 | 
			
		||||
	resizeable.
 | 
			
		||||
 
 | 
			
		||||
@@ -30,58 +30,51 @@ MySqlLogin::MySqlLogin(QString *username,QString *password,RDConfig *c,
 | 
			
		||||
  login_password=password;
 | 
			
		||||
 | 
			
		||||
  setWindowTitle(tr("mySQL Admin"));
 | 
			
		||||
  setMinimumSize(sizeHint());
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // 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);
 | 
			
		||||
  label->setFont(labelFont());
 | 
			
		||||
  label->setGeometry(10,10,sizeHint().width()-20,30);
 | 
			
		||||
  label->setAlignment(Qt::AlignCenter);
 | 
			
		||||
  login_message_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->setAlignment(Qt::AlignCenter);
 | 
			
		||||
  
 | 
			
		||||
  //
 | 
			
		||||
  // MySql Login Name
 | 
			
		||||
  //
 | 
			
		||||
  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->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->setGeometry(sizeHint().width()/2-125,50,85,19);
 | 
			
		||||
  login_name_label->setAlignment(Qt::AlignRight);
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // MySql Login Password
 | 
			
		||||
  //
 | 
			
		||||
  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->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->setGeometry(sizeHint().width()/2-125,70,85,19);
 | 
			
		||||
  login_password_label->setAlignment(Qt::AlignRight);
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // OK Button
 | 
			
		||||
  //
 | 
			
		||||
  QPushButton *ok_button=new QPushButton(this);
 | 
			
		||||
  ok_button->setGeometry(sizeHint().width()/2-90,sizeHint().height()-60,80,50);
 | 
			
		||||
  ok_button->setFont(buttonFont());
 | 
			
		||||
  ok_button->setText(tr("OK"));
 | 
			
		||||
  ok_button->setDefault(true);
 | 
			
		||||
  connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));
 | 
			
		||||
  login_ok_button=new QPushButton(this);
 | 
			
		||||
  login_ok_button->setFont(buttonFont());
 | 
			
		||||
  login_ok_button->setText(tr("OK"));
 | 
			
		||||
  login_ok_button->setDefault(true);
 | 
			
		||||
  connect(login_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // Cancel Button
 | 
			
		||||
  //
 | 
			
		||||
  QPushButton *cancel_button=new QPushButton(this);
 | 
			
		||||
  cancel_button->setGeometry(sizeHint().width()/2+10,sizeHint().height()-60,
 | 
			
		||||
			     80,50);
 | 
			
		||||
  cancel_button->setFont(buttonFont());
 | 
			
		||||
  cancel_button->setText(tr("Cancel"));
 | 
			
		||||
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
 | 
			
		||||
  login_cancel_button=new QPushButton(this);
 | 
			
		||||
  login_cancel_button->setFont(buttonFont());
 | 
			
		||||
  login_cancel_button->setText(tr("Cancel"));
 | 
			
		||||
  connect(login_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -118,3 +111,18 @@ void MySqlLogin::cancelData()
 | 
			
		||||
  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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,29 +22,39 @@
 | 
			
		||||
#define MYSQL_LOGIN_H
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QLineEdit>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
 | 
			
		||||
#include <rddialog.h>
 | 
			
		||||
 | 
			
		||||
class MySqlLogin : public RDDialog
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
  public:
 | 
			
		||||
   MySqlLogin(QString *username,QString *password,RDConfig *c,
 | 
			
		||||
	      QWidget *parent=0);
 | 
			
		||||
   ~MySqlLogin();
 | 
			
		||||
   QSize sizeHint() const;
 | 
			
		||||
   QSizePolicy sizePolicy() const;
 | 
			
		||||
 public:
 | 
			
		||||
  MySqlLogin(QString *username,QString *password,RDConfig *c,
 | 
			
		||||
	     QWidget *parent=0);
 | 
			
		||||
  ~MySqlLogin();
 | 
			
		||||
  QSize sizeHint() const;
 | 
			
		||||
  QSizePolicy sizePolicy() const;
 | 
			
		||||
 | 
			
		||||
  private slots:
 | 
			
		||||
   void okData();
 | 
			
		||||
   void cancelData();
 | 
			
		||||
 private slots:
 | 
			
		||||
  void okData();
 | 
			
		||||
  void cancelData();
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
   QString *login_name;
 | 
			
		||||
   QLineEdit *login_name_edit;
 | 
			
		||||
   QString *login_password;
 | 
			
		||||
   QLineEdit *login_password_edit;
 | 
			
		||||
 protected:
 | 
			
		||||
  void resizeEvent(QResizeEvent *e);
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
  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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user