mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
Misc fixes
This commit is contained in:
parent
7f5f290c93
commit
15998fb3e6
8 changed files with 84 additions and 519 deletions
|
|
@ -1,9 +1,9 @@
|
|||
#include <QSettings>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include "dlg_edit_password.h"
|
||||
|
||||
|
|
@ -14,7 +14,11 @@ DlgEditPassword::DlgEditPassword(QWidget *parent)
|
|||
settings.beginGroup("server");
|
||||
|
||||
oldPasswordLabel = new QLabel(tr("Old password:"));
|
||||
oldPasswordEdit = new QLineEdit(settings.value("password").toString());
|
||||
oldPasswordEdit = new QLineEdit();
|
||||
|
||||
if(settings.value("save_password", 1).toInt())
|
||||
oldPasswordEdit->setText(settings.value("password").toString());
|
||||
|
||||
oldPasswordLabel->setBuddy(oldPasswordEdit);
|
||||
oldPasswordEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
|
|
@ -22,12 +26,19 @@ DlgEditPassword::DlgEditPassword(QWidget *parent)
|
|||
newPasswordEdit = new QLineEdit();
|
||||
newPasswordLabel->setBuddy(newPasswordLabel);
|
||||
newPasswordEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
newPasswordLabel2 = new QLabel(tr("Confirm new password:"));
|
||||
newPasswordEdit2 = new QLineEdit();
|
||||
newPasswordLabel2->setBuddy(newPasswordLabel2);
|
||||
newPasswordEdit2->setEchoMode(QLineEdit::Password);
|
||||
|
||||
QGridLayout *grid = new QGridLayout;
|
||||
grid->addWidget(oldPasswordLabel, 0, 0);
|
||||
grid->addWidget(oldPasswordEdit, 0, 1);
|
||||
grid->addWidget(newPasswordLabel, 1, 0);
|
||||
grid->addWidget(newPasswordEdit, 1, 1);
|
||||
grid->addWidget(newPasswordLabel2, 2, 0);
|
||||
grid->addWidget(newPasswordEdit2, 2, 1);
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk()));
|
||||
|
|
@ -45,6 +56,12 @@ DlgEditPassword::DlgEditPassword(QWidget *parent)
|
|||
|
||||
void DlgEditPassword::actOk()
|
||||
{
|
||||
if(newPasswordEdit->text() != newPasswordEdit2->text())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error"), tr("The new passwords don't match."));
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
settings.beginGroup("server");
|
||||
// always save the password so it will be picked up by the connect dialog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue