added settings window

This commit is contained in:
arcan1s
2014-02-27 03:53:09 +04:00
parent 710941c259
commit fbad5a6c7d
6 changed files with 599 additions and 9 deletions

View File

@ -27,12 +27,16 @@ PasswdWidget::PasswdWidget(MainWindow *wid)
ui(new Ui::PasswdWidget)
{
ui->setupUi(this);
okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
cancelButton = ui->buttonBox->button(QDialogButtonBox::Cancel);
createActions();
}
PasswdWidget::~PasswdWidget()
{
delete cancelButton;
delete okButton;
delete ui;
}
@ -40,18 +44,16 @@ PasswdWidget::~PasswdWidget()
// ESC press event
void PasswdWidget::keyPressEvent(QKeyEvent *pressedKey)
{
if (pressedKey->key() == Qt::Key_Escape) {
hide();
parent->updateTabs(2);
this->~PasswdWidget();
}
if (pressedKey->key() == Qt::Key_Escape)
cancel();
}
void PasswdWidget::createActions()
{
connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(passwdApply()));
connect(ui->pushButton, SIGNAL(clicked(bool)), this, SLOT(passwdApply()));
connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));
connect(okButton, SIGNAL(clicked(bool)), this, SLOT(passwdApply()));
}
@ -61,6 +63,14 @@ void PasswdWidget::setFocusToLineEdit()
}
void PasswdWidget::cancel()
{
hide();
parent->updateTabs(2);
this->~PasswdWidget();
}
void PasswdWidget::passwdApply()
{
hide();