diff options
Diffstat (limited to 'src/pwgui/pwgui.cpp')
-rw-r--r-- | src/pwgui/pwgui.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/pwgui/pwgui.cpp b/src/pwgui/pwgui.cpp new file mode 100644 index 0000000..31dd822 --- /dev/null +++ b/src/pwgui/pwgui.cpp @@ -0,0 +1,59 @@ +#include "pwgui.h" +#include "ui_pwgui.h" +#include <QMessageBox> +#include <QTimer> +#include <QDesktopWidget> + +// ____________________________________________________________________________ +PwGui::PwGui(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::PwGui) { + // Initialize UI + initializeUI(); +} + +// ____________________________________________________________________________ +PwGui::~PwGui() { + delete ui; +} + +// ____________________________________________________________________________ +void PwGui::initializeUI() { + ui->setupUi(this); + + /* + // Prefill username + if (this->user != NULL) { + ui->lineEditUser->setText(QString::fromUtf8(user)); + } + */ + + // Protect password from being seen + ui->lineEditPass->setEchoMode(QLineEdit::Password); + ui->lineEditPass->setInputMethodHints(ui->lineEditPass->inputMethodHints() | Qt::ImhNoAutoUppercase); + + /* Main Window properties */ + + // Disable close button + this->setWindowFlags((this->windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::WindowStaysOnTopHint); + // center dialog on screen center + QRect desktopRect = QApplication::desktop()->screenGeometry(this); + this->move( desktopRect.width()/2-this->width()/2, + desktopRect.height()/2-this->height()/2); +} + +/* +void PwGui::on_buttonCancel_clicked() { + // Quit with code 1 + QCoreApplication::instance()->exit(1); +} +*/ + +// ____________________________________________________________________________ +void PwGui::on_checkStatusTimer() { + static int retries = 0; + if (++retries > 20) { + QCoreApplication::instance()->quit(); + } +} + |