mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat(ui): add setting for disabling new message notification popup
Fix #4979
This commit is contained in:
parent
9f8b0fed07
commit
fcd88d65b2
|
@ -208,6 +208,7 @@ void Settings::loadGlobal()
|
||||||
{
|
{
|
||||||
showWindow = s.value("showWindow", true).toBool();
|
showWindow = s.value("showWindow", true).toBool();
|
||||||
showInFront = s.value("showInFront", true).toBool();
|
showInFront = s.value("showInFront", true).toBool();
|
||||||
|
notify = s.value("notify", true).toBool();
|
||||||
groupAlwaysNotify = s.value("groupAlwaysNotify", true).toBool();
|
groupAlwaysNotify = s.value("groupAlwaysNotify", true).toBool();
|
||||||
groupchatPosition = s.value("groupchatPosition", true).toBool();
|
groupchatPosition = s.value("groupchatPosition", true).toBool();
|
||||||
separateWindow = s.value("separateWindow", false).toBool();
|
separateWindow = s.value("separateWindow", false).toBool();
|
||||||
|
@ -526,6 +527,7 @@ void Settings::saveGlobal()
|
||||||
{
|
{
|
||||||
s.setValue("showWindow", showWindow);
|
s.setValue("showWindow", showWindow);
|
||||||
s.setValue("showInFront", showInFront);
|
s.setValue("showInFront", showInFront);
|
||||||
|
s.setValue("notify", notify);
|
||||||
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
||||||
s.setValue("separateWindow", separateWindow);
|
s.setValue("separateWindow", separateWindow);
|
||||||
s.setValue("dontGroupWindows", dontGroupWindows);
|
s.setValue("dontGroupWindows", dontGroupWindows);
|
||||||
|
@ -1668,6 +1670,21 @@ void Settings::setCheckUpdates(bool newValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getNotify() const
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&bigLock};
|
||||||
|
return notify;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setNotify(bool newValue)
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&bigLock};
|
||||||
|
if (newValue != notify) {
|
||||||
|
notify = newValue;
|
||||||
|
emit notifyChanged(notify);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::getShowWindow() const
|
bool Settings::getShowWindow() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker{&bigLock};
|
QMutexLocker locker{&bigLock};
|
||||||
|
|
|
@ -166,6 +166,7 @@ signals:
|
||||||
void closeToTrayChanged(bool enabled);
|
void closeToTrayChanged(bool enabled);
|
||||||
void lightTrayIconChanged(bool enabled);
|
void lightTrayIconChanged(bool enabled);
|
||||||
void minimizeToTrayChanged(bool enabled);
|
void minimizeToTrayChanged(bool enabled);
|
||||||
|
void notifyChanged(bool enabled);
|
||||||
void showWindowChanged(bool enabled);
|
void showWindowChanged(bool enabled);
|
||||||
void makeToxPortableChanged(bool enabled);
|
void makeToxPortableChanged(bool enabled);
|
||||||
void busySoundChanged(bool enabled);
|
void busySoundChanged(bool enabled);
|
||||||
|
@ -315,6 +316,9 @@ public:
|
||||||
bool getCheckUpdates() const;
|
bool getCheckUpdates() const;
|
||||||
void setCheckUpdates(bool newValue);
|
void setCheckUpdates(bool newValue);
|
||||||
|
|
||||||
|
bool getNotify() const;
|
||||||
|
void setNotify(bool newValue);
|
||||||
|
|
||||||
bool getShowWindow() const;
|
bool getShowWindow() const;
|
||||||
void setShowWindow(bool newValue);
|
void setShowWindow(bool newValue);
|
||||||
|
|
||||||
|
@ -580,6 +584,7 @@ private:
|
||||||
bool lightTrayIcon;
|
bool lightTrayIcon;
|
||||||
bool useEmoticons;
|
bool useEmoticons;
|
||||||
bool checkUpdates;
|
bool checkUpdates;
|
||||||
|
bool notify;
|
||||||
bool showWindow;
|
bool showWindow;
|
||||||
bool showInFront;
|
bool showInFront;
|
||||||
bool notifySound;
|
bool notifySound;
|
||||||
|
|
|
@ -75,6 +75,7 @@ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent)
|
||||||
int index = static_cast<int>(s.getStylePreference());
|
int index = static_cast<int>(s.getStylePreference());
|
||||||
bodyUI->textStyleComboBox->setCurrentIndex(index);
|
bodyUI->textStyleComboBox->setCurrentIndex(index);
|
||||||
|
|
||||||
|
bodyUI->notify->setChecked(s.getNotify());
|
||||||
bool showWindow = s.getShowWindow();
|
bool showWindow = s.getShowWindow();
|
||||||
|
|
||||||
bodyUI->showWindow->setChecked(showWindow);
|
bodyUI->showWindow->setChecked(showWindow);
|
||||||
|
@ -260,6 +261,11 @@ void UserInterfaceForm::reloadSmileys()
|
||||||
bodyUI->emoticonSize->setMaximum(actualSize.width());
|
bodyUI->emoticonSize->setMaximum(actualSize.width());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_notify_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setNotify(bodyUI->notify->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void UserInterfaceForm::on_showWindow_stateChanged()
|
void UserInterfaceForm::on_showWindow_stateChanged()
|
||||||
{
|
{
|
||||||
bool isChecked = bodyUI->showWindow->isChecked();
|
bool isChecked = bodyUI->showWindow->isChecked();
|
||||||
|
|
|
@ -48,6 +48,7 @@ private slots:
|
||||||
void on_dateFormats_editTextChanged(const QString& format);
|
void on_dateFormats_editTextChanged(const QString& format);
|
||||||
void on_textStyleComboBox_currentTextChanged();
|
void on_textStyleComboBox_currentTextChanged();
|
||||||
void on_useEmoticons_stateChanged();
|
void on_useEmoticons_stateChanged();
|
||||||
|
void on_notify_stateChanged();
|
||||||
void on_showWindow_stateChanged();
|
void on_showWindow_stateChanged();
|
||||||
void on_showInFront_stateChanged();
|
void on_showInFront_stateChanged();
|
||||||
void on_groupAlwaysNotify_stateChanged();
|
void on_groupAlwaysNotify_stateChanged();
|
||||||
|
|
|
@ -161,6 +161,16 @@
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="notify">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="tooltip for Notify setting">Show a notification when you receive a new message and the window is not selected.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Notify</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="showWindow">
|
<widget class="QCheckBox" name="showWindow">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -572,6 +582,7 @@
|
||||||
<tabstop>txtChatFont</tabstop>
|
<tabstop>txtChatFont</tabstop>
|
||||||
<tabstop>txtChatFontSize</tabstop>
|
<tabstop>txtChatFontSize</tabstop>
|
||||||
<tabstop>textStyleComboBox</tabstop>
|
<tabstop>textStyleComboBox</tabstop>
|
||||||
|
<tabstop>notify</tabstop>
|
||||||
<tabstop>showWindow</tabstop>
|
<tabstop>showWindow</tabstop>
|
||||||
<tabstop>showInFront</tabstop>
|
<tabstop>showInFront</tabstop>
|
||||||
<tabstop>groupAlwaysNotify</tabstop>
|
<tabstop>groupAlwaysNotify</tabstop>
|
||||||
|
|
|
@ -1421,11 +1421,6 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notify) {
|
if (notify) {
|
||||||
if (inactiveWindow) {
|
|
||||||
QApplication::alert(currentWindow);
|
|
||||||
eventFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings::getInstance().getShowWindow()) {
|
if (Settings::getInstance().getShowWindow()) {
|
||||||
currentWindow->show();
|
currentWindow->show();
|
||||||
if (inactiveWindow && Settings::getInstance().getShowInFront()) {
|
if (inactiveWindow && Settings::getInstance().getShowInFront()) {
|
||||||
|
@ -1433,6 +1428,11 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings::getInstance().getNotify()) {
|
||||||
|
if (inactiveWindow) {
|
||||||
|
QApplication::alert(currentWindow);
|
||||||
|
eventFlag = true;
|
||||||
|
}
|
||||||
bool isBusy = Nexus::getCore()->getStatus() == Status::Busy;
|
bool isBusy = Nexus::getCore()->getStatus() == Status::Busy;
|
||||||
bool busySound = Settings::getInstance().getBusySound();
|
bool busySound = Settings::getInstance().getBusySound();
|
||||||
bool notifySound = Settings::getInstance().getNotifySound();
|
bool notifySound = Settings::getInstance().getNotifySound();
|
||||||
|
@ -1442,6 +1442,7 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound,
|
||||||
Audio::getInstance().playMono16Sound(soundPath);
|
Audio::getInstance().playMono16Sound(soundPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user