Browse Source

refactor(ui): consolidate new message settings under UI page

reviewable/pr5050/r3
Anthony Bilinski 7 years ago
parent
commit
97bc4a9b4a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 4
      src/persistence/settings.cpp
  2. 16
      src/widget/form/settings/generalform.cpp
  3. 2
      src/widget/form/settings/generalform.h
  4. 37
      src/widget/form/settings/generalsettings.ui
  5. 32
      src/widget/form/settings/userinterfaceform.cpp
  6. 4
      src/widget/form/settings/userinterfaceform.h
  7. 52
      src/widget/form/settings/userinterfacesettings.ui

4
src/persistence/settings.cpp

@ -175,8 +175,8 @@ void Settings::loadGlobal() @@ -175,8 +175,8 @@ void Settings::loadGlobal()
}
autoAwayTime = s.value("autoAwayTime", 10).toInt();
checkUpdates = s.value("checkUpdates", true).toBool();
notifySound = s.value("notifySound", true).toBool();
busySound = s.value("busySound", false).toBool();
notifySound = s.value("notifySound", true).toBool(); // note: notifySound and busySound UI elements are now under UI settings
busySound = s.value("busySound", false).toBool(); // page, but kept under General in settings file to be backwards compatible
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
globalAutoAcceptDir = s.value("globalAutoAcceptDir",

16
src/widget/form/settings/generalform.cpp

@ -137,10 +137,6 @@ GeneralForm::GeneralForm(SettingsWidget* myParent) @@ -137,10 +137,6 @@ GeneralForm::GeneralForm(SettingsWidget* myParent)
bodyUI->closeToTray->setChecked(s.getCloseToTray());
bodyUI->closeToTray->setEnabled(showSystemTray);
bodyUI->notifySound->setChecked(s.getNotifySound());
bodyUI->busySound->setChecked(s.getBusySound());
bodyUI->busySound->setEnabled(s.getNotifySound());
bodyUI->statusChanges->setChecked(s.getStatusChangeNotificationEnabled());
bodyUI->cbFauxOfflineMessaging->setChecked(s.getFauxOfflineMessaging());
@ -203,18 +199,6 @@ void GeneralForm::on_minimizeToTray_stateChanged() @@ -203,18 +199,6 @@ void GeneralForm::on_minimizeToTray_stateChanged()
Settings::getInstance().setMinimizeToTray(bodyUI->minimizeToTray->isChecked());
}
void GeneralForm::on_notifySound_stateChanged()
{
bool notify = bodyUI->notifySound->isChecked();
Settings::getInstance().setNotifySound(notify);
bodyUI->busySound->setEnabled(notify);
}
void GeneralForm::on_busySound_stateChanged()
{
Settings::getInstance().setBusySound(bodyUI->busySound->isChecked());
}
void GeneralForm::on_statusChanges_stateChanged()
{
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked());

2
src/widget/form/settings/generalform.h

@ -48,8 +48,6 @@ private slots: @@ -48,8 +48,6 @@ private slots:
void on_lightTrayIcon_stateChanged();
void on_autoAwaySpinBox_editingFinished();
void on_minimizeToTray_stateChanged();
void on_notifySound_stateChanged();
void on_busySound_stateChanged();
void on_statusChanges_stateChanged();
void on_cbFauxOfflineMessaging_stateChanged();

37
src/widget/form/settings/generalsettings.ui

@ -208,41 +208,6 @@ instead of closing itself.</string> @@ -208,41 +208,6 @@ instead of closing itself.</string>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="newMessageLabel">
<property name="text">
<string>On new message:</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="notifySound">
<property name="text">
<string>Play sound</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="busySound">
<property name="text">
<string>Play sound while Busy</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="statusChanges">
<property name="text">
@ -384,8 +349,6 @@ instead of closing itself.</string> @@ -384,8 +349,6 @@ instead of closing itself.</string>
<tabstop>startInTray</tabstop>
<tabstop>minimizeToTray</tabstop>
<tabstop>closeToTray</tabstop>
<tabstop>notifySound</tabstop>
<tabstop>busySound</tabstop>
<tabstop>statusChanges</tabstop>
<tabstop>cbFauxOfflineMessaging</tabstop>
<tabstop>autoAwaySpinBox</tabstop>

32
src/widget/form/settings/userinterfaceform.cpp

@ -76,13 +76,20 @@ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) @@ -76,13 +76,20 @@ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent)
bodyUI->textStyleComboBox->setCurrentIndex(index);
bodyUI->notify->setChecked(s.getNotify());
// Note: UI is boolean inversed from settings to maintain setting file backwards compatibility
bodyUI->groupOnlyNotfiyWhenMentioned->setChecked(!s.getGroupAlwaysNotify());
bodyUI->groupOnlyNotfiyWhenMentioned->setEnabled(s.getNotify());
bodyUI->notifySound->setChecked(s.getNotifySound());
bodyUI->notifySound->setEnabled(s.getNotify());
bodyUI->busySound->setChecked(s.getBusySound());
bodyUI->busySound->setEnabled(s.getNotifySound() && s.getNotify());
bool showWindow = s.getShowWindow();
bodyUI->showWindow->setChecked(showWindow);
bodyUI->showInFront->setChecked(s.getShowInFront());
bodyUI->showInFront->setEnabled(showWindow);
bodyUI->groupAlwaysNotify->setChecked(s.getGroupAlwaysNotify());
bodyUI->cbGroupchatPosition->setChecked(s.getGroupchatPosition());
bodyUI->cbCompactLayout->setChecked(s.getCompactLayout());
bodyUI->cbSeparateWindow->setChecked(s.getSeparateWindow());
@ -263,7 +270,23 @@ void UserInterfaceForm::reloadSmileys() @@ -263,7 +270,23 @@ void UserInterfaceForm::reloadSmileys()
void UserInterfaceForm::on_notify_stateChanged()
{
Settings::getInstance().setNotify(bodyUI->notify->isChecked());
const bool notify = bodyUI->notify->isChecked();
Settings::getInstance().setNotify(notify);
bodyUI->groupOnlyNotfiyWhenMentioned->setEnabled(notify);
bodyUI->notifySound->setEnabled(notify);
bodyUI->busySound->setEnabled(notify && bodyUI->notifySound->isChecked());
}
void UserInterfaceForm::on_notifySound_stateChanged()
{
const bool notify = bodyUI->notifySound->isChecked();
Settings::getInstance().setNotifySound(notify);
bodyUI->busySound->setEnabled(notify);
}
void UserInterfaceForm::on_busySound_stateChanged()
{
Settings::getInstance().setBusySound(bodyUI->busySound->isChecked());
}
void UserInterfaceForm::on_showWindow_stateChanged()
@ -278,9 +301,10 @@ void UserInterfaceForm::on_showInFront_stateChanged() @@ -278,9 +301,10 @@ void UserInterfaceForm::on_showInFront_stateChanged()
Settings::getInstance().setShowInFront(bodyUI->showInFront->isChecked());
}
void UserInterfaceForm::on_groupAlwaysNotify_stateChanged()
void UserInterfaceForm::on_groupOnlyNotfiyWhenMentioned_stateChanged()
{
Settings::getInstance().setGroupAlwaysNotify(bodyUI->groupAlwaysNotify->isChecked());
// Note: UI is boolean inversed from settings to maintain setting file backwards compatibility
Settings::getInstance().setGroupAlwaysNotify(!bodyUI->groupOnlyNotfiyWhenMentioned->isChecked());
}
void UserInterfaceForm::on_cbCompactLayout_stateChanged()

4
src/widget/form/settings/userinterfaceform.h

@ -49,9 +49,11 @@ private slots: @@ -49,9 +49,11 @@ private slots:
void on_textStyleComboBox_currentTextChanged();
void on_useEmoticons_stateChanged();
void on_notify_stateChanged();
void on_notifySound_stateChanged();
void on_busySound_stateChanged();
void on_showWindow_stateChanged();
void on_showInFront_stateChanged();
void on_groupAlwaysNotify_stateChanged();
void on_groupOnlyNotfiyWhenMentioned_stateChanged();
void on_cbCompactLayout_stateChanged();
void on_cbSeparateWindow_stateChanged();
void on_cbDontGroupWindows_stateChanged();

52
src/widget/form/settings/userinterfacesettings.ui

@ -171,6 +171,44 @@ @@ -171,6 +171,44 @@
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="groupOnlyNotfiyWhenMentioned">
<property name="toolTip">
<string comment="toolTip for Group chats only notify when mentioned">Onlys notify about new messages in groupchats when mentioned.</string>
</property>
<property name="text">
<string>Group chats only notify when mentioned</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notifySound">
<property name="text">
<string>Play sound</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="busySound">
<property name="text">
<string>Play sound while Busy</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="showWindow">
<property name="toolTip">
@ -207,16 +245,6 @@ @@ -207,16 +245,6 @@
<string>Contact list</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="groupAlwaysNotify">
<property name="toolTip">
<string comment="toolTip for Group chat always notify">Always notify about new messages in groupchats.</string>
</property>
<property name="text">
<string>Group chats always notify</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbGroupchatPosition">
<property name="toolTip">
@ -583,9 +611,11 @@ @@ -583,9 +611,11 @@
<tabstop>txtChatFontSize</tabstop>
<tabstop>textStyleComboBox</tabstop>
<tabstop>notify</tabstop>
<tabstop>groupOnlyNotfiyWhenMentioned</tabstop>
<tabstop>notifySound</tabstop>
<tabstop>busySound</tabstop>
<tabstop>showWindow</tabstop>
<tabstop>showInFront</tabstop>
<tabstop>groupAlwaysNotify</tabstop>
<tabstop>cbGroupchatPosition</tabstop>
<tabstop>cbCompactLayout</tabstop>
<tabstop>cbSeparateWindow</tabstop>

Loading…
Cancel
Save