Prettify notifications settingspage
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 3 Mar 2010 01:34:39 +0000 (02:34 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 3 Mar 2010 01:36:37 +0000 (02:36 +0100)
The new look (for !KDE) is very similar to KNotify's configuration widget
(albeit it has (still) way fewer options). Looks better and is more consistent.

src/qtui/indicatornotificationbackend.cpp
src/qtui/phononnotificationbackend.cpp
src/qtui/settingspages/notificationssettingspage.cpp
src/qtui/systraynotificationbackend.cpp
src/qtui/systraynotificationbackend.h
src/qtui/taskbarnotificationbackend.cpp
src/qtui/ui/indicatornotificationconfigwidget.ui
src/qtui/ui/phononnotificationconfigwidget.ui

index df7b534..281fe98 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "client.h"
 #include "clientsettings.h"
+#include "iconloader.h"
 #include "mainwin.h"
 #include "networkmodel.h"
 #include "qtui.h"
@@ -154,6 +155,8 @@ IndicatorNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent)
 : SettingsPage("Internal", "IndicatorNotification", parent)
 {
   ui.setupUi(this);
+   // FIXME find proper icon (this one is used by the plasmoid as well)
+  ui.enabled->setIcon(SmallIcon("mail-message-new"));
 
   connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(widgetChanged()));
 }
index 7006f5e..1a106d4 100644 (file)
@@ -89,6 +89,7 @@ PhononNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent)
   audioPreview(0)
 {
   ui.setupUi(this);
+  ui.enabled->setIcon(SmallIcon("media-playback-start"));
   ui.play->setIcon(SmallIcon("media-playback-start"));
   ui.open->setIcon(SmallIcon("document-open"));
 
index a473bc8..6ac1e0b 100644 (file)
@@ -40,7 +40,7 @@ NotificationsSettingsPage::NotificationsSettingsPage(QWidget *parent)
       _hasDefaults |= cw->hasDefaults();
     }
   }
-  layout->addStretch(1);
+  layout->addStretch(20);
   load();
 }
 
index 82d9f96..b6d1ff5 100644 (file)
 #include <QApplication>
 #include <QCheckBox>
 #include <QGroupBox>
-#include <QVBoxLayout>
+#include <QHBoxLayout>
 
 #include "systraynotificationbackend.h"
 
 #include "client.h"
 #include "clientsettings.h"
 #include "icon.h"
+#include "iconloader.h"
 #include "mainwin.h"
 #include "networkmodel.h"
 #include "qtui.h"
@@ -130,23 +131,17 @@ SettingsPage *SystrayNotificationBackend::createConfigWidget() const {
 /***************************************************************************/
 
 SystrayNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "SystrayNotification", parent) {
-  QGroupBox *groupBox = new QGroupBox(tr("System Tray Icon"), this);
-  _animateBox = new QCheckBox(tr("Animate"));
-  connect(_animateBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged()));
-  _showBubbleBox = new QCheckBox(tr("Show bubble"));
+  _showBubbleBox = new QCheckBox(tr("Show a message in a popup"));
+  _showBubbleBox->setIcon(SmallIcon("dialog-information"));
   connect(_showBubbleBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged()));
-  QVBoxLayout *layout = new QVBoxLayout(groupBox);
-  layout->addWidget(_animateBox);
+  QHBoxLayout *layout = new QHBoxLayout(this);
   layout->addWidget(_showBubbleBox);
-  layout->addStretch(1);
-  QVBoxLayout *globalLayout = new QVBoxLayout(this);
-  globalLayout->addWidget(groupBox);
-
 }
 
 void SystrayNotificationBackend::ConfigWidget::widgetChanged() {
-  bool changed = (_showBubble != _showBubbleBox->isChecked() || _animate != _animateBox->isChecked());
-  if(changed != hasChanged()) setChangedState(changed);
+  bool changed = (_showBubble != _showBubbleBox->isChecked());
+  if(changed != hasChanged())
+    setChangedState(changed);
 }
 
 bool SystrayNotificationBackend::ConfigWidget::hasDefaults() const {
@@ -154,23 +149,19 @@ bool SystrayNotificationBackend::ConfigWidget::hasDefaults() const {
 }
 
 void SystrayNotificationBackend::ConfigWidget::defaults() {
-  _animateBox->setChecked(true);
   _showBubbleBox->setChecked(false);
   widgetChanged();
 }
 
 void SystrayNotificationBackend::ConfigWidget::load() {
   NotificationSettings s;
-  _animate = s.value("Systray/Animate", true).toBool();
   _showBubble = s.value("Systray/ShowBubble", false).toBool();
-  _animateBox->setChecked(_animate);
   _showBubbleBox->setChecked(_showBubble);
   setChangedState(false);
 }
 
 void SystrayNotificationBackend::ConfigWidget::save() {
   NotificationSettings s;
-  s.setValue("Systray/Animate", _animateBox->isChecked());
   s.setValue("Systray/ShowBubble", _showBubbleBox->isChecked());
   load();
 }
index 3a68533..319942b 100644 (file)
@@ -71,8 +71,8 @@ private slots:
   void widgetChanged();
 
 private:
-  QCheckBox *_showBubbleBox, *_animateBox;
-  bool _showBubble, _animate;
+  QCheckBox *_showBubbleBox;
+  bool _showBubble;
 };
 
 #endif
index 142c308..f99706b 100644 (file)
@@ -23,6 +23,7 @@
 #include <QtGui>
 
 #include "clientsettings.h"
+#include "iconloader.h"
 #include "mainwin.h"
 #include "qtui.h"
 
@@ -68,15 +69,19 @@ TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : Settin
 #else
   layout->addWidget(enabledBox = new QCheckBox(tr("Mark taskbar entry, timeout:"), this));
 #endif
+  enabledBox->setIcon(SmallIcon("flag-blue"));
+  enabledBox->setEnabled(true);
+
   timeoutBox = new QSpinBox(this);
-  timeoutBox->setMinimum(0);
+  timeoutBox->setMinimum(1);
   timeoutBox->setMaximum(99);
   timeoutBox->setSpecialValueText(tr("Unlimited"));
-  timeoutBox->setSuffix(tr(" s"));
+  timeoutBox->setSuffix(tr(" seconds"));
   layout->addWidget(timeoutBox);
-  layout->addStretch(1);
+  layout->addStretch(20);
 
   connect(enabledBox, SIGNAL(toggled(bool)), SLOT(widgetChanged()));
+  connect(enabledBox, SIGNAL(toggled(bool)), timeoutBox, SLOT(setEnabled(bool)));
   connect(timeoutBox, SIGNAL(valueChanged(int)), SLOT(widgetChanged()));
 }
 
index 69f2778..3f2c506 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>435</width>
+    <width>438</width>
     <height>35</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
     <widget class="QCheckBox" name="enabled">
+     <property name="toolTip">
+      <string>This enables support for the Ayatana Project's application indicator (libindicate).</string>
+     </property>
      <property name="text">
-      <string>Show messages in indicator</string>
+      <string>Show messages in application indicator</string>
      </property>
     </widget>
    </item>
index 8d3b066..d6536dd 100644 (file)
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>PhononNotificationConfigWidget</class>
- <widget class="QWidget" name="PhononNotificationConfigWidget" >
-  <property name="geometry" >
+ <widget class="QWidget" name="PhononNotificationConfigWidget">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>482</width>
-    <height>78</height>
+    <width>439</width>
+    <height>36</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout" >
+  <layout class="QHBoxLayout" name="horizontalLayout">
    <item>
-    <widget class="QGroupBox" name="enabled" >
-     <property name="title" >
-      <string>Audio Notification (via Phonon)</string>
-     </property>
-     <property name="checkable" >
-      <bool>true</bool>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout" >
-      <item>
-       <widget class="QLabel" name="label" >
-        <property name="text" >
-         <string>Play File:</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLineEdit" name="filename" />
-      </item>
-      <item>
-       <widget class="QToolButton" name="play" >
-        <property name="enabled" >
-         <bool>false</bool>
-        </property>
-        <property name="text" >
-         <string/>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="open" >
-        <property name="text" >
-         <string/>
-        </property>
-       </widget>
-      </item>
-     </layout>
+    <widget class="QCheckBox" name="enabled">
+     <property name="text">
+      <string>Play a sound</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="horizontalSpacer">
+     <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>
+    <widget class="QToolButton" name="play">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="toolTip">
+      <string>Prelisten to the selected sound</string>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLineEdit" name="filename">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="toolTip">
+      <string>Select the sound file to play</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QToolButton" name="open">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="toolTip">
+      <string>Select the sound file to play</string>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
     </widget>
    </item>
   </layout>
  </widget>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>enabled</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>filename</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>59</x>
+     <y>15</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>246</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>enabled</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>open</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>89</x>
+     <y>18</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>426</x>
+     <y>22</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>