mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat(settings, generalform, widget): Added setting for sound notification in busy status
This commit is contained in:
parent
e7785ab4c2
commit
e23eb1c5f7
|
@ -171,6 +171,7 @@ void Settings::loadGlobal()
|
||||||
showWindow = s.value("showWindow", true).toBool();
|
showWindow = s.value("showWindow", true).toBool();
|
||||||
showInFront = s.value("showInFront", false).toBool();
|
showInFront = s.value("showInFront", false).toBool();
|
||||||
notifySound = s.value("notifySound", true).toBool();
|
notifySound = s.value("notifySound", true).toBool();
|
||||||
|
busySound = s.value("busySound", false).toBool();
|
||||||
groupAlwaysNotify = s.value("groupAlwaysNotify", false).toBool();
|
groupAlwaysNotify = s.value("groupAlwaysNotify", false).toBool();
|
||||||
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
|
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
|
||||||
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
|
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
|
||||||
|
@ -417,6 +418,7 @@ void Settings::saveGlobal()
|
||||||
s.setValue("showWindow", showWindow);
|
s.setValue("showWindow", showWindow);
|
||||||
s.setValue("showInFront", showInFront);
|
s.setValue("showInFront", showInFront);
|
||||||
s.setValue("notifySound", notifySound);
|
s.setValue("notifySound", notifySound);
|
||||||
|
s.setValue("busySound", busySound);
|
||||||
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
||||||
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
||||||
s.setValue("separateWindow", separateWindow);
|
s.setValue("separateWindow", separateWindow);
|
||||||
|
@ -828,6 +830,18 @@ void Settings::setNotifySound(bool newValue)
|
||||||
notifySound = newValue;
|
notifySound = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getBusySound() const
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&bigLock};
|
||||||
|
return busySound;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setBusySound(bool newValue)
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&bigLock};
|
||||||
|
busySound = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::getGroupAlwaysNotify() const
|
bool Settings::getGroupAlwaysNotify() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker{&bigLock};
|
QMutexLocker locker{&bigLock};
|
||||||
|
|
|
@ -169,6 +169,9 @@ public:
|
||||||
bool getNotifySound() const;
|
bool getNotifySound() const;
|
||||||
void setNotifySound(bool newValue);
|
void setNotifySound(bool newValue);
|
||||||
|
|
||||||
|
bool getBusySound() const;
|
||||||
|
void setBusySound(bool newValue);
|
||||||
|
|
||||||
bool getGroupAlwaysNotify() const;
|
bool getGroupAlwaysNotify() const;
|
||||||
void setGroupAlwaysNotify(bool newValue);
|
void setGroupAlwaysNotify(bool newValue);
|
||||||
|
|
||||||
|
@ -372,6 +375,7 @@ private:
|
||||||
bool showWindow;
|
bool showWindow;
|
||||||
bool showInFront;
|
bool showInFront;
|
||||||
bool notifySound;
|
bool notifySound;
|
||||||
|
bool busySound;
|
||||||
bool groupAlwaysNotify;
|
bool groupAlwaysNotify;
|
||||||
|
|
||||||
bool forceTCP;
|
bool forceTCP;
|
||||||
|
|
|
@ -138,7 +138,12 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
bodyUI->showWindow->setChecked(showWindow);
|
bodyUI->showWindow->setChecked(showWindow);
|
||||||
bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
|
bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
|
||||||
bodyUI->showInFront->setEnabled(showWindow);
|
bodyUI->showInFront->setEnabled(showWindow);
|
||||||
bodyUI->notifySound->setChecked(Settings::getInstance().getNotifySound());
|
|
||||||
|
bool notifySound = Settings::getInstance().getNotifySound();
|
||||||
|
|
||||||
|
bodyUI->notifySound->setChecked(notifySound);
|
||||||
|
bodyUI->busySound->setChecked(Settings::getInstance().getBusySound());
|
||||||
|
bodyUI->busySound->setEnabled(notifySound);
|
||||||
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
|
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
|
||||||
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
|
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
|
||||||
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
|
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
|
||||||
|
@ -217,6 +222,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
connect(bodyUI->showWindow, &QCheckBox::stateChanged, this, &GeneralForm::onShowWindowChanged);
|
connect(bodyUI->showWindow, &QCheckBox::stateChanged, this, &GeneralForm::onShowWindowChanged);
|
||||||
connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowInFront);
|
connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowInFront);
|
||||||
connect(bodyUI->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound);
|
connect(bodyUI->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound);
|
||||||
|
connect(bodyUI->busySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetBusySound);
|
||||||
connect(bodyUI->markdownComboBox, &QComboBox::currentTextChanged, this, &GeneralForm::onMarkdownUpdated);
|
connect(bodyUI->markdownComboBox, &QComboBox::currentTextChanged, this, &GeneralForm::onMarkdownUpdated);
|
||||||
connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify);
|
connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify);
|
||||||
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
|
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
|
||||||
|
@ -489,6 +495,11 @@ void GeneralForm::onSetNotifySound()
|
||||||
Settings::getInstance().setNotifySound(bodyUI->notifySound->isChecked());
|
Settings::getInstance().setNotifySound(bodyUI->notifySound->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralForm::onSetBusySound()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setBusySound(bodyUI->busySound->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void GeneralForm::onSetGroupAlwaysNotify()
|
void GeneralForm::onSetGroupAlwaysNotify()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setGroupAlwaysNotify(bodyUI->groupAlwaysNotify->isChecked());
|
Settings::getInstance().setGroupAlwaysNotify(bodyUI->groupAlwaysNotify->isChecked());
|
||||||
|
|
|
@ -65,6 +65,7 @@ private slots:
|
||||||
void onShowWindowChanged();
|
void onShowWindowChanged();
|
||||||
void onSetShowInFront();
|
void onSetShowInFront();
|
||||||
void onSetNotifySound();
|
void onSetNotifySound();
|
||||||
|
void onSetBusySound();
|
||||||
void onSetGroupAlwaysNotify();
|
void onSetGroupAlwaysNotify();
|
||||||
void onFauxOfflineMessaging();
|
void onFauxOfflineMessaging();
|
||||||
void onCompactLayout();
|
void onCompactLayout();
|
||||||
|
|
|
@ -39,8 +39,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1278</width>
|
<width>1270</width>
|
||||||
<height>1413</height>
|
<height>1468</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,1">
|
||||||
|
@ -328,6 +328,20 @@ instead of closing itself.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||||
|
<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>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="showWindow">
|
<widget class="QCheckBox" name="showWindow">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -955,5 +969,21 @@ will be sent to them when they appear online to you.</string>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>notifySound</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>busySound</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>665</x>
|
||||||
|
<y>522</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>684</x>
|
||||||
|
<y>551</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -1295,8 +1295,10 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBusy = Nexus::getCore()->getStatus() == Status::Busy;
|
bool isBusy = Nexus::getCore()->getStatus() == Status::Busy;
|
||||||
|
bool busySound = Settings::getInstance().getBusySound();
|
||||||
|
bool notifySound = Settings::getInstance().getNotifySound();
|
||||||
|
|
||||||
if (Settings::getInstance().getNotifySound() && sound && !isBusy)
|
if (notifySound && sound && (!isBusy || busySound))
|
||||||
Audio::getInstance().playMono16Sound(QStringLiteral(":/audio/notification.pcm"));
|
Audio::getInstance().playMono16Sound(QStringLiteral(":/audio/notification.pcm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user