diff options
| author | 2009-07-09 16:54:10 +0000 | |
|---|---|---|
| committer | 2009-07-09 16:54:10 +0000 | |
| commit | 270debaa603d9d5f794b4698e9e7faa8a2fd0cae (patch) | |
| tree | 7c37981ec667c3787ff8551d8b6c1a019a947505 /src/modules/options | |
| parent | notifer second round: get rid of old options file and added a new menu entry ... (diff) | |
| download | KVIrc-270debaa603d9d5f794b4698e9e7faa8a2fd0cae.tar.gz KVIrc-270debaa603d9d5f794b4698e9e7faa8a2fd0cae.tar.bz2 KVIrc-270debaa603d9d5f794b4698e9e7faa8a2fd0cae.zip | |
added missing files from previous commit
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3327 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/options')
| -rw-r--r-- | src/modules/options/optw_notifier.cpp | 186 | ||||
| -rw-r--r-- | src/modules/options/optw_notifier.h | 63 |
2 files changed, 249 insertions, 0 deletions
diff --git a/src/modules/options/optw_notifier.cpp b/src/modules/options/optw_notifier.cpp new file mode 100644 index 000000000..9ea49a25e --- /dev/null +++ b/src/modules/options/optw_notifier.cpp @@ -0,0 +1,186 @@ +//============================================================================= +// +// File : optw_notifier.cpp +// Creation date : Thu Jul 09 2009 10:54:39 CEST by Fabio Bas +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001-2009 Szymon Stefanek (pragma at kvirc dot net) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#include "optw_notifier.h" + +#include "kvi_options.h" +#include "kvi_locale.h" + +#include <QLayout> + +KviNotifierLookOptionsWidget::KviNotifierLookOptionsWidget(QWidget * parent) +: KviOptionsWidget(parent) +{ + setObjectName("notifierlook_options_widget"); + createLayout(); + + addFontSelector(0,0,1,0,__tr2qs_ctx("Font","options"),KviOption_fontNotifier); + addColorSelector(0,1,1,1,__tr2qs_ctx("Background color","options"),KviOption_colorNotifierBackground); + addColorSelector(0,2,1,2,__tr2qs_ctx("Foreground color","options"),KviOption_colorNotifierForeground); + addFontSelector(0,3,1,3,__tr2qs_ctx("Title Font","options"),KviOption_fontNotifierTitle); + addColorSelector(0,4,1,4,__tr2qs_ctx("Title Foreground color","options"),KviOption_colorNotifierTitleForeground); + + addPixmapSelector(0,5,1,5,__tr2qs_ctx("Background image","options"),KviOption_pixmapNotifierBackground); + + addLabel(0,6,0,6,__tr2qs_ctx("Horizontal align:","options")); + m_pHorizontalAlign=new QComboBox(this); + addWidgetToLayout(m_pHorizontalAlign,1,6,1,6); + + addLabel(0,7,0,7,__tr2qs_ctx("Vertical align:","options")); + m_pVerticalAlign=new QComboBox(this); + addWidgetToLayout(m_pVerticalAlign,1,7,1,7); + + m_pHorizontalAlign->addItem(__tr2qs_ctx("Tile","options")); + m_pHorizontalAlign->addItem(__tr2qs_ctx("Left","options")); + m_pHorizontalAlign->addItem(__tr2qs_ctx("Right","options")); + m_pHorizontalAlign->addItem(__tr2qs_ctx("Center","options")); + + m_pVerticalAlign->addItem(__tr2qs_ctx("Tile","options")); + m_pVerticalAlign->addItem(__tr2qs_ctx("Top","options")); + m_pVerticalAlign->addItem(__tr2qs_ctx("Bottom","options")); + m_pVerticalAlign->addItem(__tr2qs_ctx("Center","options")); + + switch( KVI_OPTION_UINT(KviOption_uintNotifierPixmapAlign) & Qt::AlignHorizontal_Mask) + { + case Qt::AlignLeft: + m_pHorizontalAlign->setCurrentIndex(1); + break; + case Qt::AlignRight: + m_pHorizontalAlign->setCurrentIndex(2); + break; + case Qt::AlignHCenter: + m_pHorizontalAlign->setCurrentIndex(3); + break; + default: + m_pHorizontalAlign->setCurrentIndex(0); + } + + switch( KVI_OPTION_UINT(KviOption_uintNotifierPixmapAlign) & Qt::AlignVertical_Mask) + { + case Qt::AlignTop: + m_pVerticalAlign->setCurrentIndex(1); + break; + case Qt::AlignBottom: + m_pVerticalAlign->setCurrentIndex(2); + break; + case Qt::AlignVCenter: + m_pVerticalAlign->setCurrentIndex(3); + break; + default: + m_pVerticalAlign->setCurrentIndex(0); + } + + layout()->setRowStretch(5,1); +} + +KviNotifierLookOptionsWidget::~KviNotifierLookOptionsWidget() +{ +} + +void KviNotifierLookOptionsWidget::commit() +{ + int iFlags=0; + switch(m_pHorizontalAlign->currentIndex()) + { + case 1: + iFlags|=Qt::AlignLeft; + break; + case 2: + iFlags|=Qt::AlignRight; + break; + case 3: + iFlags|=Qt::AlignHCenter; + break; + } + switch(m_pVerticalAlign->currentIndex()) + { + case 1: + iFlags|=Qt::AlignTop; + break; + case 2: + iFlags|=Qt::AlignBottom; + break; + case 3: + iFlags|=Qt::AlignVCenter; + break; + } + + KVI_OPTION_UINT(KviOption_uintNotifierPixmapAlign)=iFlags; + KviOptionsWidget::commit(); +} + + + +KviNotifierOptionsWidget::KviNotifierOptionsWidget(QWidget * parent) +: KviOptionsWidget(parent) +{ + setObjectName("notifier_options_widget"); + + createLayout(); + + KviBoolSelector * b = addBoolSelector(0,0,0,0,__tr2qs_ctx("Enable the notifier","options"),KviOption_boolEnableNotifier); + QString tip = "<center>"; + tip += __tr2qs_ctx("This is an option for the impatient: it allows to forcibly and permanently disable " \ + "the notifier window. Please note that if this option is activated then " \ + "the notifier will NOT popup even if all the other options around specify " \ + "to use it in response to particular events. Also note that this option " \ + "will make all the /notifier.* commands fail silently.","options"); + tip += "</center>"; + mergeTip(b,tip); + addBoolSelector(0,1,0,1,__tr2qs_ctx("Enable notifier window flashing","options"),KviOption_boolNotifierFlashing); + KviBoolSelector * b2 = addBoolSelector(0,2,0,2,__tr2qs_ctx("Enable notifier window fade effect","options"),KviOption_boolNotifierFading); + + KviTalGroupBox *g = addGroupBox(0,3,0,3,Qt::Horizontal,__tr2qs_ctx("Advanced configuration","options")); + connect(b,SIGNAL(toggled(bool)),g,SLOT(setEnabled(bool))); + + connect(b, + SIGNAL(toggled(bool)), + addUIntSelector(g,__tr2qs_ctx("Default auto hiding time for messages (0 to disable)","options"), + KviOption_uintNotifierAutoHideTime, + 0,86400,30,KVI_OPTION_BOOL(KviOption_boolEnableNotifier)), + SLOT(setEnabled(bool))); + + 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(b2, + SIGNAL(toggled(bool)), + addUIntSelector(g,__tr2qs_ctx("Notifier window opacity while inactive","options"), + KviOption_uintNotifierInactiveTransparency, + 0,100,40,KVI_OPTION_BOOL(KviOption_boolNotifierFading)), + SLOT(setEnabled(bool))); + + addRowSpacer(0,4,0,4); +} + +KviNotifierOptionsWidget::~KviNotifierOptionsWidget() +{ +} +#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES +#include "m_optw_input.moc" +#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES diff --git a/src/modules/options/optw_notifier.h b/src/modules/options/optw_notifier.h new file mode 100644 index 000000000..ccb47be6e --- /dev/null +++ b/src/modules/options/optw_notifier.h @@ -0,0 +1,63 @@ +#ifndef _OPTW_NOTIFIER_H_ +#define _OPTW_NOTIFIER_H_ + +//============================================================================= +// +// File : optw_notifier.h +// Creation date : Thu Jul 09 2009 10:54:39 CEST by Fabio Bas +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001-2009 Szymon Stefanek (pragma at kvirc dot net) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#include "kvi_optionswidget.h" + +#include <QComboBox> + +#define KVI_OPTIONS_WIDGET_ICON_KviNotifierLookOptionsWidget KVI_SMALLICON_ALERT +#define KVI_OPTIONS_WIDGET_NAME_KviNotifierLookOptionsWidget __tr2qs_no_lookup("Notifier") +#define KVI_OPTIONS_WIDGET_KEYWORDS_KviNotifierLookOptionsWidget __tr2qs_no_lookup("theme,colors,text") +#define KVI_OPTIONS_WIDGET_GROUP_KviNotifierLookOptionsWidget "theme" + +class KviNotifierLookOptionsWidget : public KviOptionsWidget +{ + Q_OBJECT +private: + QComboBox* m_pHorizontalAlign; + QComboBox* m_pVerticalAlign; +public: + KviNotifierLookOptionsWidget(QWidget * parent); + ~KviNotifierLookOptionsWidget(); + + virtual void commit(); +}; + +#define KVI_OPTIONS_WIDGET_ICON_KviNotifierOptionsWidget KVI_SMALLICON_ALERT +#define KVI_OPTIONS_WIDGET_NAME_KviNotifierOptionsWidget __tr2qs_no_lookup("Notifier") +#define KVI_OPTIONS_WIDGET_KEYWORDS_KviNotifierOptionsWidget __tr2qs_no_lookup("popup") +#define KVI_OPTIONS_WIDGET_PARENT_KviNotifierOptionsWidget KviInterfaceFeaturesOptionsWidget + +class KviNotifierOptionsWidget : public KviOptionsWidget +{ + Q_OBJECT +public: + KviNotifierOptionsWidget(QWidget * parent); + ~KviNotifierOptionsWidget(); +}; + +#endif //!_OPTW_NOTIFIER_H_ |
