diff options
| -rw-r--r-- | src/modules/options/OptionsWidget_notifier.cpp | 64 | ||||
| -rw-r--r-- | src/modules/options/OptionsWidget_notifier.h | 11 |
2 files changed, 50 insertions, 25 deletions
diff --git a/src/modules/options/OptionsWidget_notifier.cpp b/src/modules/options/OptionsWidget_notifier.cpp index d4901aae7..76ec28f4b 100644 --- a/src/modules/options/OptionsWidget_notifier.cpp +++ b/src/modules/options/OptionsWidget_notifier.cpp @@ -154,25 +154,25 @@ OptionsWidget_notifier::OptionsWidget_notifier(QWidget * parent) iRow++; KviBoolSelector * b2; - KviBoolSelector * b3; #ifdef COMPILE_KDE_SUPPORT - b2 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Use the KDE notifier","options"),KviOption_boolUseKDENotifier); + m_pKdeNotifier = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Use the KDE notifier","options"),KviOption_boolUseKDENotifier); szTip += __tr2qs_ctx("This option uses the KDE notification system " \ "instead of KVIrc one.<br>" \ "This is cool if you want to better integrate KVIrc inside KDE. " \ "Note that KDE's notifier isn't flexible and \"tabbed\" like KVIrc's","options"); szTip += "</center>"; - mergeTip(b2,szTip); - - b2->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); - connect(b,SIGNAL(toggled(bool)),b2,SLOT(setEnabled(bool))); + mergeTip(m_pKdeNotifier,szTip); + m_pKdeNotifier->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); + connect(b,SIGNAL(toggled(bool)),m_pKdeNotifier,SLOT(setEnabled(bool))); + connect(m_pKdeNotifier,SIGNAL(toggled(bool)),this,SLOT(toggleNotifierProtocol(bool))); + iRow++; #endif // COMPILE_KDE_SUPPORT #ifdef COMPILE_DBUS_SUPPORT - b3 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Use the DBus-based notifiers","options"),KviOption_boolUseDBusNotifier); + m_pDBusNotifier = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Use the DBus-based notifiers","options"),KviOption_boolUseDBusNotifier); szTip = "<center>"; szTip += __tr2qs_ctx("This option uses the DBus-based notifier instead of " \ "KVIrc one.<br>" \ @@ -180,48 +180,50 @@ OptionsWidget_notifier::OptionsWidget_notifier(QWidget * parent) "desktop environment. " \ "Note that this notifier isn't flexible and \"tabbed\" like KVIrc's","options"); szTip += "</center>"; - mergeTip(b3,szTip); + mergeTip(m_pDBusNotifier,szTip); - b3->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); - connect(b,SIGNAL(toggled(bool)),b3,SLOT(setEnabled(bool))); + m_pDBusNotifier->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); +#ifdef COMPILE_KDE_SUPPORT + m_pDBusNotifier->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseKDENotifier)); +#endif // COMPILE_KDE_SUPPORT + connect(b,SIGNAL(toggled(bool)),m_pDBusNotifier,SLOT(setEnabled(bool))); #ifdef COMPILE_KDE_SUPPORT - b3->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseKDENotifier)); - connect(b2,SIGNAL(toggled(bool)),b3,SLOT(setEnabled(bool))); + connect(m_pDBusNotifier,SIGNAL(toggled(bool)),this,SLOT(toggleNotifierProtocol(bool))); #endif - + iRow++; #endif // COMPILE_DBUS_SUPPORT #if defined(COMPILE_KDE_SUPPORT) || defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) - b3 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Don't show notifier when there is an active fullscreen window","options"),KviOption_boolDontShowNotifierIfActiveWindowIsFullScreen); + b2 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Don't show notifier when there is an active fullscreen window","options"),KviOption_boolDontShowNotifierIfActiveWindowIsFullScreen); szTip = "<center>"; szTip += __tr2qs_ctx("This option stops the notifier from being displayed when there is an active fullscreen window. " \ "This is useful for gaming sessions where you may be distracted by the notifier or it may even switch " \ "your game from fullscreen to window mode.","options"); szTip += "</center>"; - mergeTip(b3,szTip); + mergeTip(b2,szTip); - b3->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); - QObject::connect(b,SIGNAL(toggled(bool)),b3,SLOT(setEnabled(bool))); + b2->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); + QObject::connect(b,SIGNAL(toggled(bool)),b2,SLOT(setEnabled(bool))); iRow++; #endif //COMPILE_KDE_SUPPORT || COMPILE_ON_WINDOWS || COMPILE_ON_MINGW - b3 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Enable notifier window flashing","options"),KviOption_boolNotifierFlashing); + b2 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Enable notifier window flashing","options"),KviOption_boolNotifierFlashing); - b3->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); - QObject::connect(b,SIGNAL(toggled(bool)),b3,SLOT(setEnabled(bool))); + b2->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); + QObject::connect(b,SIGNAL(toggled(bool)),b2,SLOT(setEnabled(bool))); iRow++; - b3 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Enable notifier window fade effect","options"),KviOption_boolNotifierFading); + b2 = addBoolSelector(0,iRow,0,iRow,__tr2qs_ctx("Enable notifier window fade effect","options"),KviOption_boolNotifierFading); - b3->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); - QObject::connect(b,SIGNAL(toggled(bool)),b3,SLOT(setEnabled(bool))); + b2->setEnabled(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)); + QObject::connect(b,SIGNAL(toggled(bool)),b2,SLOT(setEnabled(bool))); iRow++; @@ -235,14 +237,14 @@ OptionsWidget_notifier::OptionsWidget_notifier(QWidget * parent) 0,86400,30,KVI_OPTION_BOOL(KviOption_boolEnableNotifier)), SLOT(setEnabled(bool))); - connect(b3, + connect(b2, SIGNAL(toggled(bool)), addUIntSelector(g,__tr2qs_ctx("Notifier window opacity while active (mouseover)","options"), KviOption_uintNotifierActiveTransparency, 0,100,90,KVI_OPTION_BOOL(KviOption_boolNotifierFading)), SLOT(setEnabled(bool))); - connect(b3, + connect(b2, SIGNAL(toggled(bool)), addUIntSelector(g,__tr2qs_ctx("Notifier window opacity while inactive","options"), KviOption_uintNotifierInactiveTransparency, @@ -257,6 +259,18 @@ OptionsWidget_notifier::OptionsWidget_notifier(QWidget * parent) OptionsWidget_notifier::~OptionsWidget_notifier() { } + +#ifdef COMPILE_KDE_SUPPORT +void OptionsWidget_notifier::toggleNotifierProtocol(bool) +{ + if(m_pKdeNotifier->isEnabled()) + m_pDBusNotifier->setEnabled(!m_pKdeNotifier->isChecked()); + + if(m_pDBusNotifier->isEnabled()) + m_pKdeNotifier->setEnabled(!m_pDBusNotifier->isChecked()); +} +#endif // COMPILE_KDE_SUPPORT + #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_OptionsWidget_input.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES diff --git a/src/modules/options/OptionsWidget_notifier.h b/src/modules/options/OptionsWidget_notifier.h index fc2f7277a..1d9eea3e0 100644 --- a/src/modules/options/OptionsWidget_notifier.h +++ b/src/modules/options/OptionsWidget_notifier.h @@ -58,6 +58,17 @@ class OptionsWidget_notifier : public KviOptionsWidget public: OptionsWidget_notifier(QWidget * parent); ~OptionsWidget_notifier(); +private: +#ifdef COMPILE_KDE_SUPPORT + KviBoolSelector * m_pKdeNotifier; +#endif +#ifdef COMPILE_DBUS_SUPPORT + KviBoolSelector * m_pDBusNotifier; +#endif +#ifdef COMPILE_KDE_SUPPORT +private slots: + void toggleNotifierProtocol(bool); +#endif }; #endif //!_OPTW_NOTIFIER_H_ |
