UiSettings uiSettings;
#ifndef SPUTDEV
- if(uiSettings.value("DisplayPopupMessages", QVariant(true)).toBool()) {
+ bool displayBubble = uiSettings.value("NotificationBubble", QVariant(true)).toBool();
+ bool displayDesktop = uiSettings.value("NotificationDesktop", QVariant(true)).toBool();
+ if(displayBubble || displayDesktop) {
// FIXME don't invoke style engine for this!
QString text = QtUi::style()->styleString(Message::mircToInternal(msg.contents())).plainText;
- displayTrayIconMessage(title, text);
- sendDesktopNotification(title, text);
+ if (displayBubble) displayTrayIconMessage(title, text);
+ if (displayDesktop) sendDesktopNotification(title, text);
}
#endif
if(uiSettings.value("AnimateTrayIcon", QVariant(true)).toBool()) {
{
QStringList actions;
QMap<QString, QVariant> hints;
+ UiSettings uiSettings;
- hints["x"] = 100; // Standard hint: x location for the popup to show up
- hints["y"] = 100; // Standard hint: y location for the popup to show up
+ hints["x"] = uiSettings.value("NotificationDesktopHintX", QVariant(0)).toInt(); // Standard hint: x location for the popup to show up
+ hints["y"] = uiSettings.value("NotificationDesktopHintY", QVariant(0)).toInt(); // Standard hint: y location for the popup to show up
actions << "click" << "Click Me!";
QString("%1: %2:\n%2").arg(QTime::currentTime().toString()).arg(title).arg(message), // Body of the message to display
actions, // Actions from which the user may choose
hints, // Hints to the server displaying the message
- 5000 // Timeout in milliseconds
+ uiSettings.value("NotificationDesktopTimeout", QVariant(5000)).toInt() // Timeout in milliseconds
);
if (!reply.isValid())
connect(ui.minimizeOnClose, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
connect(ui.animateTrayIcon, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
- connect(ui.displayPopupMessages, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+ connect(ui.bubbleBox, SIGNAL(toggled(bool)), this, SLOT(widgetHasChanged()));
+ connect(ui.desktopBox, SIGNAL(toggled(bool)), this, SLOT(widgetHasChanged()));
+ connect(ui.timeout_value, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+ connect(ui.x_value, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+ connect(ui.y_value, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
connect(ui.userMessagesInStatusBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
connect(ui.userMessagesInQueryBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
ui.minimizeOnClose->setChecked(false);
ui.animateTrayIcon->setChecked(true);
- ui.displayPopupMessages->setChecked(true);
+ ui.bubbleBox->setChecked(true);
+ ui.desktopBox->setChecked(true);
+ ui.timeout_value->setValue(5000);
+ ui.x_value->setValue(0);
+ ui.y_value->setValue(0);
ui.userMessagesInStatusBuffer->setChecked(true);
ui.userMessagesInQueryBuffer->setChecked(false);
settings["AnimateTrayIcon"] = uiSettings.value("AnimateTrayIcon", QVariant(true));
ui.animateTrayIcon->setChecked(settings["AnimateTrayIcon"].toBool());
- settings["DisplayPopupMessages"] = uiSettings.value("DisplayPopupMessages", QVariant(true));
- ui.displayPopupMessages->setChecked(settings["DisplayPopupMessages"].toBool());
+ settings["NotificationBubble"] = uiSettings.value("NotificationBubble", QVariant(true));
+ ui.bubbleBox->setChecked(settings["NotificationBubble"].toBool());
+
+ settings["NotificationDesktop"] = uiSettings.value("NotificationDesktop", QVariant(true));
+ ui.desktopBox->setChecked(settings["NotificationDesktop"].toBool());
+ settings["NotificationDesktopTimeout"] = uiSettings.value("NotificationDesktopTimeout", QVariant(5000));
+ ui.timeout_value->setValue(settings["NotificationDesktopTimeout"].toInt());
+ settings["NotificationDesktopHintX"] = uiSettings.value("NotificationDesktopHintX", QVariant(0));
+ ui.x_value->setValue(settings["NotificationDesktopHintX"].toInt());
+ settings["NotificationDesktopHintY"] = uiSettings.value("NotificationDesktopHintY", QVariant(0));
+ ui.y_value->setValue(settings["NotificationDesktopHintY"].toInt());
// bufferSettings:
BufferSettings bufferSettings;
uiSettings.setValue("MouseWheelChangesBuffers", ui.mouseWheelChangesBuffers->isChecked());
uiSettings.setValue("AnimateTrayIcon", ui.animateTrayIcon->isChecked());
+//<<< HEAD:src/qtui/settingspages/generalsettingspage.cpp
uiSettings.setValue("DisplayPopupMessages", ui.displayPopupMessages->isChecked());
uiSettings.setValue("CompletionSuffix", ui.completionSuffix->text());
+//=======
+ uiSettings.setValue("NotificationBubble", ui.bubbleBox->isChecked());
+ uiSettings.setValue("NotificationDesktop", ui.desktopBox->isChecked());
+ uiSettings.setValue("NotificationDesktopTimeout", ui.timeout_value->value());
+ uiSettings.setValue("NotificationDesktopHintX", ui.x_value->value());
+ uiSettings.setValue("NotificationDesktopHintY", ui.y_value->value());
+
+//>>> Configuration support for desktop notifications.:src/qtui/settingspages/generalsettingspage.cpp
BufferSettings bufferSettings;
bufferSettings.setValue("UserMessagesInStatusBuffer", ui.userMessagesInStatusBuffer->isChecked());
bufferSettings.setValue("UserMessagesInQueryBuffer", ui.userMessagesInQueryBuffer->isChecked());
if(settings["MinimizeOnClose"].toBool() != ui.minimizeOnClose->isChecked()) return true;
if(settings["AnimateTrayIcon"].toBool() != ui.animateTrayIcon->isChecked()) return true;
- if(settings["DisplayPopupMessages"].toBool() != ui.displayPopupMessages->isChecked()) return true;
+ if(settings["NotificationBubble"].toBool() != ui.bubbleBox->isChecked()) return true;
+ if(settings["NotificationDesktop"].toBool() != ui.desktopBox->isChecked()) return true;
+ if(settings["NotificationDesktopTimeout"].toInt() != ui.timeout_value->value()) return true;
+ if(settings["NotificationDesktopHintX"].toInt() != ui.x_value->value()) return true;
+ if(settings["NotificationDesktopHintY"].toInt() != ui.y_value->value()) return true;
if(settings["UserMessagesInStatusBuffer"].toBool() != ui.userMessagesInStatusBuffer->isChecked()) return true;
if(settings["UserMessagesInQueryBuffer"].toBool() != ui.userMessagesInQueryBuffer->isChecked()) return true;
<x>0</x>
<y>0</y>
<width>453</width>
- <height>632</height>
+ <height>800</height>
</rect>
</property>
<property name="windowTitle" >
<string>User Notification:</string>
</property>
<layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QCheckBox" name="animateTrayIcon" >
- <property name="text" >
- <string>Animate tray icon</string>
+ <item row="2" column="0" >
+ <widget class="QGroupBox" name="bubbleBox" >
+ <property name="title" >
+ <string>Bubble</string>
</property>
- <property name="checked" >
+ <property name="checkable" >
<bool>true</bool>
</property>
+ <layout class="QVBoxLayout" name="verticalLayout" />
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QGroupBox" name="desktopBox" >
+ <property name="title" >
+ <string>Desktop</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QFrame" name="desktopFrame" >
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QFormLayout" name="formLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="timeout_label" >
+ <property name="text" >
+ <string>Timeout</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QSpinBox" name="timeout_value" >
+ <property name="minimum" >
+ <number>-1</number>
+ </property>
+ <property name="maximum" >
+ <number>100000</number>
+ </property>
+ <property name="value" >
+ <number>5000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="x_label" >
+ <property name="text" >
+ <string>X</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="y_label" >
+ <property name="text" >
+ <string>Y</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QSpinBox" name="x_value" >
+ <property name="maximum" >
+ <number>10000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QSpinBox" name="y_value" >
+ <property name="maximum" >
+ <number>10000</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
<item row="1" column="0" >
- <widget class="QCheckBox" name="displayPopupMessages" >
+ <widget class="QCheckBox" name="animateTrayIcon" >
<property name="text" >
- <string>Display pop-up messages</string>
+ <string>Animate tray icon</string>
</property>
<property name="checked" >
<bool>true</bool>