Skip to content

Commit

Permalink
Always on top, fixes #118
Browse files Browse the repository at this point in the history
  • Loading branch information
annejan committed Jan 3, 2016
1 parent 16d2b1e commit cd9846f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 3 deletions.
16 changes: 16 additions & 0 deletions configdialog.cpp
Expand Up @@ -834,3 +834,19 @@ bool ConfigDialog::templateAllFields() {
void ConfigDialog::templateAllFields(bool templateAll) {
ui->checkBoxTemplateAllFields->setChecked(templateAll);
}

/**
* @brief ConfigDialog::alwaysOnTop
* @param alwaysOnTop
*/
void ConfigDialog::alwaysOnTop(bool alwaysOnTop) {
ui->checkBoxAlwaysOnTop->setChecked(alwaysOnTop);
}

/**
* @brief ConfigDialog::alwaysOnTop
* @return
*/
bool ConfigDialog::alwaysOnTop() {
return ui->checkBoxAlwaysOnTop->isChecked();
}
2 changes: 2 additions & 0 deletions configdialog.h
Expand Up @@ -77,6 +77,8 @@ class ConfigDialog : public QDialog {
void autoPull(bool autoPull);
bool autoPush();
void autoPush(bool autoPush);
bool alwaysOnTop();
void alwaysOnTop(bool alwaysOnTop);

protected:
void closeEvent(QCloseEvent *event);
Expand Down
7 changes: 7 additions & 0 deletions configdialog.ui
Expand Up @@ -400,6 +400,13 @@
<item row="0" column="0">
<widget class="QComboBox" name="comboBoxClipboard"/>
</item>
<item row="6" column="3">
<widget class="QCheckBox" name="checkBoxAlwaysOnTop">
<property name="text">
<string>Always on top</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down
21 changes: 20 additions & 1 deletion mainwindow.cpp
Expand Up @@ -237,6 +237,13 @@ bool MainWindow::checkConfig() {
useTrayIcon = settings.value("useTrayIcon").toBool();
hideOnClose = settings.value("hideOnClose").toBool();
startMinimized = settings.value("startMinimized").toBool();
alwaysOnTop = settings.value("alwaysOnTop").toBool();

if (alwaysOnTop) {
Qt::WindowFlags flags = windowFlags();
this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);
this->show();
}

autoPull = settings.value("autoPull").toBool();
autoPush = settings.value("autoPush").toBool();
Expand Down Expand Up @@ -400,6 +407,7 @@ void MainWindow::config() {
d->templateAllFields(templateAllFields);
d->autoPull(autoPull);
d->autoPush(autoPush);
d->alwaysOnTop(alwaysOnTop);
if (startupPhase)
d->wizard(); // does shit
if (d->exec()) {
Expand Down Expand Up @@ -432,6 +440,7 @@ void MainWindow::config() {
templateAllFields = d->templateAllFields();
autoPush = d->autoPush();
autoPull = d->autoPull();
alwaysOnTop = d->alwaysOnTop();

QSettings &settings(getSettings());

Expand Down Expand Up @@ -473,7 +482,17 @@ void MainWindow::config() {
settings.setValue("passTemplate", passTemplate);
settings.setValue("templateAllFields", templateAllFields);
settings.setValue("autoPull", autoPull ? "true" : "false");
settings.setValue("autoPush", autoPush ? "true" : "false");
settings.setValue("autoPush", autoPush ? "true" : "false");
settings.setValue("alwaysOnTop", alwaysOnTop ? "true" : "false");

if (alwaysOnTop) {
Qt::WindowFlags flags = windowFlags();
this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);
this->show();
} else {
this->setWindowFlags(Qt::Window);
this->show();
}

if (!profiles.isEmpty()) {
settings.beginGroup("profiles");
Expand Down
1 change: 1 addition & 0 deletions mainwindow.h
Expand Up @@ -142,6 +142,7 @@ class MainWindow : public QMainWindow {
bool templateAllFields;
bool autoPull;
bool autoPush;
bool alwaysOnTop;
void updateText();
void executePass(QString, QString = QString());
void executeWrapper(QString, QString, QString = QString());
Expand Down
2 changes: 1 addition & 1 deletion qtpass.iss
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "QtPass"
#define MyAppVersion "1.0.5.1"
#define MyAppVersion "1.0.6"
#define MyAppPublisher "IJhack"
#define MyAppURL "https://qtpass.org/"
#define MyAppExeName "qtpass.exe"
Expand Down
2 changes: 1 addition & 1 deletion qtpass.pro
Expand Up @@ -7,7 +7,7 @@
# #
#----------------------------------------------------------

VERSION = 1.0.5.1
VERSION = 1.0.6
TEMPLATE = app
QT += core gui

Expand Down

0 comments on commit cd9846f

Please sign in to comment.