- initial work on new preferences dialog

This commit is contained in:
Dmytro Bogovych 2022-06-03 16:50:26 +03:00
parent c1af788d7f
commit 48cd3d0052
3 changed files with 225 additions and 203 deletions

View File

@ -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()

View File

@ -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

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>586</width>
<height>452</height>
<height>409</height>
</rect>
</property>
<property name="sizePolicy">
@ -21,54 +21,110 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Show seconds:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="mShowSecondsCheckbox">
<property name="text">
<string>Show seconds</string>
<string/>
</property>
</widget>
</item>
<item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Save password in keychain: </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="mAutosavePasswordCheckbox">
<property name="text">
<string>Save password in keychain</string>
<string/>
</property>
</widget>
</item>
<item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Ask before delete:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="mAskBeforeDeleteCheckbox">
<property name="text">
<string>Ask before delete</string>
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Show tray icon:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="mShowTrayIconCheckbox">
<property name="text">
<string>Show tray icon</string>
<string/>
</property>
</widget>
</item>
<item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Use dark theme:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="mDarkThemeCheckbox">
<property name="text">
<string>Use dark theme</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mChangeAppFont">
<item row="6" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Change app font...</string>
<string>Application font:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="mAppFontExampleLabel">
<widget class="QLabel" name="mAppFontLabel">
<property name="text">
<string>Example of used app font.</string>
<string>This is name and size of used app font.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -76,37 +132,69 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="mSelectDatabaseButton">
<widget class="QPushButton" name="mChangeAppFontButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Select file...</string>
<string>Change...</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Path to database:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="mPathToDatabaseLabel">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mDatabaseLocation">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QPushButton" name="mChangePathButton">
<property name="text">
<string>Location of used database</string>
<string>Change...</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="stopTrackingRuleLayout">
<property name="spacing">
<number>0</number>
</layout>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Pause tracking on idle:</string>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="mSmartStopTracking">
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="mPauseOnIdleCheckbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>20</horstretch>
@ -120,12 +208,19 @@
</size>
</property>
<property name="text">
<string>Stop tracking if idle detected for</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mSmartStopIntervalInMinutes">
<item row="9" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Idle timeout (in minutes):</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="mIdleTimeoutEdit">
<property name="maximumSize">
<size>
<width>50</width>
@ -134,92 +229,22 @@
</property>
</widget>
</item>
<item>
<item row="10" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>minutes</string>
</property>
<property name="margin">
<number>3</number>
<string>Ask question on resume:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>10</number>
</property>
<item>
<widget class="QRadioButton" name="mAskQuestionOnStopRadiobutton">
<property name="text">
<string>Ask question</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mAutomaticallyOnStopRadiobutton">
<property name="text">
<string>Automatically</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="startTrackingRuleLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="mSmartStartTracking">
<property name="text">
<string>Start tracking after stop on idle when user activity detected.
This option requires enabled automatic stop tracking on idle.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<item row="10" column="1">
<widget class="QCheckBox" name="mAskQuestionOnResumeCheckbox">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">