From 48cd3d0052829a5804fa79eef191d1fc5be1c3dc Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Fri, 3 Jun 2022 16:50:26 +0300 Subject: [PATCH] - initial work on new preferences dialog --- client/preferencesdlg.cpp | 17 +- client/preferencesdlg.h | 10 +- client/preferencesdlg.ui | 401 ++++++++++++++++++++------------------ 3 files changed, 225 insertions(+), 203 deletions(-) diff --git a/client/preferencesdlg.cpp b/client/preferencesdlg.cpp index 8276aaf..e8a2535 100644 --- a/client/preferencesdlg.cpp +++ b/client/preferencesdlg.cpp @@ -18,10 +18,12 @@ PreferencesDlg::PreferencesDlg(QWidget *parent, Settings& settings) : mSettings(settings) { ui->setupUi(this); - connect(ui->mSelectDatabaseButton, SIGNAL(clicked()), this, SLOT(selectDatabase())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accepted())); - connect(ui->mSmartStopTracking, SIGNAL(toggled(bool)), this, SLOT(smartStopSettingChanged(bool))); - connect(ui->mSmartStartTracking, SIGNAL(toggled(bool)), this, SLOT(smartStartSettingChanged(bool))); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(rejected())); + + connect(ui->mChangePathButton, SIGNAL(clicked()), this, SLOT(onChangeDatabasePath())); + connect(ui->mPauseOnIdleCheckbox, SIGNAL(toggled(bool)), this, SLOT(onPauseOnIdle(bool))); + connect(ui->mAskQuestionOnResumeCheckbox, SIGNAL(toggled(bool)), this, SLOT(smartStartSettingChanged(bool))); // Autosave password ui->mAutosavePasswordCheckbox->setChecked(settings.data().value(KEY_AUTOSAVE_PASSWORD).toBool()); @@ -36,7 +38,7 @@ PreferencesDlg::PreferencesDlg(QWidget *parent, Settings& settings) : ui->mDarkThemeCheckbox->setChecked(settings.data().value(KEY_DARK_THEME).toBool()); // Use custom database path ? - ui->mDatabaseLocation->setText(settings.data().value(KEY_DB_FILENAME).toString()); + ui->mPathToDatabaseLabel->setText(settings.data().value(KEY_DB_FILENAME).toString()); // Use stop on idle ? ui->mSmartStopTracking->setChecked(GET_BOOL(KEY_SMART_STOP)); @@ -104,14 +106,9 @@ void PreferencesDlg::smartStopSettingChanged(bool v) allowStartAfterIdleControls(); } -void PreferencesDlg::smartStartSettingChanged(bool/* v */) -{ - allowStartAfterIdleControls(); -} -void PreferencesDlg::smartStopWayChanged() +void PreferencesDlg::onPauseOnIdle(bool value) { - allowStartAfterIdleControls(); } void PreferencesDlg::allowStartAfterIdleControls() diff --git a/client/preferencesdlg.h b/client/preferencesdlg.h index b705c7d..2db98cf 100644 --- a/client/preferencesdlg.h +++ b/client/preferencesdlg.h @@ -23,13 +23,13 @@ private: void applyTheme(); private slots: - void selectDatabase(); void accepted(); - void smartStopSettingChanged(bool v); - void smartStartSettingChanged(bool); - void smartStopWayChanged(); - void allowStartAfterIdleControls(); + void rejected(); + + void onPauseOnIdle(bool v); + void onAskQuestionWhenResume(bool v); void onChangeAppFont(); + void onChangeDatabasePath(); }; #endif // PREFERENCESDLG_H diff --git a/client/preferencesdlg.ui b/client/preferencesdlg.ui index e8dce02..33f3251 100644 --- a/client/preferencesdlg.ui +++ b/client/preferencesdlg.ui @@ -7,7 +7,7 @@ 0 0 586 - 452 + 409 @@ -21,205 +21,230 @@ - - - Show seconds + + + QFrame::StyledPanel - - - - - - Save password in keychain + + QFrame::Raised - - - - - - Ask before delete - - - true - - - - - - - Show tray icon - - - - - - - Use dark theme - - - - - - - Change app font... - - - - - - - Example of used app font. - - - Qt::AlignCenter - - - - - - - Select file... - - - - - - - - 0 - 0 - - - - Location of used database - - - - - - - 0 - - - - - 0 - - - - - - 20 - 0 - - - - - 240 - 0 - - - - Stop tracking if idle detected for - - - - - - - - 50 - 16777215 - - - - - - - - minutes - - - 3 - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - 10 - + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Show seconds: + + + + + + + + + + + + + + Save password in keychain: + + + + + + + + + + + + + + Ask before delete: + + + + + + + + + + true + + + + + + + Show tray icon: + + + + + + + + + + + + + + Use dark theme: + + + + + + + + + + + + + + Application font: + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + - + - Ask question + This is name and size of used app font. + + + Qt::AlignCenter - - buttonGroup - - - - Automatically + + + + 16777215 + 16777215 + + + + Change... + + + false - - buttonGroup - - - - - - - - - - 0 - - - - - - - Start tracking after stop on idle when user activity detected. -This option requires enabled automatic stop tracking on idle. - - - - - - - - - - - - - + + + + + + Path to database: + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + Change... + + + + + + + + + + Pause tracking on idle: + + + + + + + + 20 + 0 + + + + + 240 + 0 + + + + + + + + + + + Idle timeout (in minutes): + + + + + + + + 50 + 16777215 + + + + + + + + Ask question on resume: + + + + + + + + + + + +