KVIrc  4.9.2
DeveloperAPIs
KviOptionsWidget.h
Go to the documentation of this file.
1 #ifndef _KVI_OPTIONSWIDGET_H_
2 #define _KVI_OPTIONSWIDGET_H_
3 
4 //=============================================================================
5 //
6 // File : KviOptionsWidget.h
7 // Creation date : Mon Jun 10 2000 17:47:33 by Szymon Stefanek
8 //
9 // This file is part of the KVIrc IRC client distribution
10 // Copyright (C) 2000-2010 Szymon Stefanek (pragma at kvirc dot net)
11 //
12 // This program is FREE software. You can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the HOPE that it will be USEFUL,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 // See the GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, write to the Free Software Foundation,
24 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 //
26 //=============================================================================
27 
28 #include "kvi_settings.h"
29 #include "KviSelectors.h"
30 #include "KviPointerList.h"
31 #include "KviTalGroupBox.h"
32 #include "KviIconManager.h"
33 
34 #include <QFrame>
35 #include <QLayout>
36 #include <QLineEdit>
37 #include <QTabWidget>
38 #include <QPushButton>
39 
40 class KVIRC_API KviOptionsWidget : public QFrame, public KviSelectorInterface
41 {
42  Q_OBJECT
43 public:
44  KviOptionsWidget(QWidget * parent, const char * name = 0, bool bSunken = true);
46 
47 private:
48  QGridLayout * m_pLayout;
49  QTabWidget * m_pTabWidget;
53  static QString m_szBasicTipStart;
54  static QString m_szBasicTipEnd;
55 
56 public:
57  void mergeResetFlag(int flag) { m_iResetFlags |= flag; };
58  void createLayout();
59  QGridLayout * layout() { return m_pLayout; };
60 protected:
61  void commitSelectors();
62  void commitOptionsReset();
63 
64 public:
65  void mergeTip(QWidget * w, const QString & tip);
66  KviPointerList<KviSelectorInterface> * selectors() { return m_pSelectorInterfaceList; };
67 
68  // tabbed page paradigm
69  void createTabbedPage();
70  void addOptionsWidget(const QString & szText, const QIcon & iconSet, KviOptionsWidget * pWidget);
71  QTabWidget * tabWidget() { return m_pTabWidget; };
72 
73  // non tabbed page paradigm
74  KviBoolSelector * addBoolSelector(int x1, int y1, int x2, int y2, const QString & txt, bool * pOption, bool bEnabled = true);
75  KviBoolSelector * addBoolSelector(QWidget * pParent, const QString & txt, bool * pOption, bool bEnabled = true);
76  KviBoolSelector * addBoolSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
77  KviBoolSelector * addBoolSelector(QWidget * pParnt, const QString & txt, int optId, bool bEnabled = true);
78 
79  KviColorSelector * addColorSelector(int x1, int y1, int x2, int y2, const QString & txt, QColor * pOption, bool bEnabled = true);
80  KviColorSelector * addColorSelector(QWidget * pParent, const QString & txt, QColor * pOption, bool bEnabled = true);
81  KviColorSelector * addColorSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
82  KviColorSelector * addColorSelector(QWidget * pParent, const QString & txt, int optId, bool bEnabled = true);
83 
84  KviMircTextColorSelector * addMircTextColorSelector(int x1, int y1, int x2, int y2, const QString & txt, unsigned int * uFore, unsigned int * uBack, bool bEnabled = true);
85  KviMircTextColorSelector * addMircTextColorSelector(QWidget * pParent, const QString & txt, unsigned int * uFore, unsigned int * uBack, bool bEnabled = true);
86  KviMircTextColorSelector * addMircTextColorSelector(int x1, int y1, int x2, int y2, const QString & txt, int optForeId, int optBackId, bool bEnabled = true);
87  KviMircTextColorSelector * addMircTextColorSelector(QWidget * pParent, const QString & txt, int optForeId, int optBackId, bool bEnabled = true);
88 
89  KviDirectorySelector * addDirectorySelector(int x1, int y1, int x2, int y2, const QString & txt, QString * pOption, bool bEnabled = true);
90  KviDirectorySelector * addDirectorySelector(QWidget * pParent, const QString & txt, QString * pOption, bool bEnabled = true);
91  KviDirectorySelector * addDirectorySelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
92  KviDirectorySelector * addDirectorySelector(QWidget * pParent, const QString & txt, int optId, bool bEnabled = true);
93 
94  KviFileSelector * addFileSelector(int x1, int y1, int x2, int y2, const QString & txt, QString * pOption, bool bEnabled = true);
95  KviFileSelector * addFileSelector(QWidget * pParent, const QString & txt, QString * pOption, bool bEnabled = true);
96  KviFileSelector * addFileSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
97  KviFileSelector * addFileSelector(QWidget * pParent, const QString & txt, int optId, bool bEnabled = true);
98 
99  KviSoundSelector * addSoundSelector(int x1, int y1, int x2, int y2, const QString & txt, QString * pOption, bool bEnabled = true);
100  KviSoundSelector * addSoundSelector(QWidget * pParent, const QString & txt, QString * pOption, bool bEnabled = true);
101  KviSoundSelector * addSoundSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
102  KviSoundSelector * addSoundSelector(QWidget * pParent, const QString & txt, int optId, bool bEnabled = true);
103 
104  KviFontSelector * addFontSelector(int x1, int y1, int x2, int y2, const QString & txt, QFont * pOption, bool bEnabled = true);
105  KviFontSelector * addFontSelector(QWidget * pParent, const QString & txt, QFont * pOption, bool bEnabled = true);
106  KviFontSelector * addFontSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
107  KviFontSelector * addFontSelector(QWidget * pParent, const QString & txt, int optId, bool bEnabled = true);
108 
109  KviPasswordSelector * addPasswordSelector(int x1, int y1, int x2, int y2, const QString & txt, QString * pOption, bool bEnabled = true);
110  KviPasswordSelector * addPasswordSelector(QWidget * pParent, const QString & txt, QString * pOption, bool bEnabled = true);
111  KviPasswordSelector * addPasswordSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
112  KviPasswordSelector * addPasswordSelector(QWidget * pParent, const QString & txt, int optId, bool bEnabled = true);
113 
114  KviPixmapSelector * addPixmapSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
115  KviPixmapSelector * addPixmapSelector(int x1, int y1, int x2, int y2, const QString & txt, KviPixmap * pOption, bool bEnabled = true);
116 
117  KviStringListSelector * addStringListSelector(int x1, int y1, int x2, int y2, const QString & txt, QStringList * pOption, bool bEnabled = true);
118  KviStringListSelector * addStringListSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
119 
120  KviStringSelector * addStringSelector(int x1, int y1, int x2, int y2, const QString & txt, QString * pOption, bool bEnabled = true);
121  KviStringSelector * addStringSelector(QWidget * pParent, const QString & txt, QString * pOption, bool bEnabled = true);
122  KviStringSelector * addStringSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId, bool bEnabled = true);
123  KviStringSelector * addStringSelector(QWidget * pParent, const QString & txt, int optId, bool bEnabled = true);
124 
125  KviUIntSelector * addUIntSelector(int x1, int y1, int x2, int y2, const QString & txt, unsigned int * pOption,
126  unsigned int uLowBound, unsigned int uHighBound, unsigned int uDefault, bool bEnabled = true);
127  KviUIntSelector * addUIntSelector(QWidget * pParent, const QString & txt, unsigned int * pOption,
128  unsigned int uLowBound, unsigned int uHighBound, unsigned int uDefault, bool bEnabled = true);
129  KviUIntSelector * addUIntSelector(int x1, int y1, int x2, int y2, const QString & txt, int optId,
130  unsigned int uLowBound, unsigned int uHighBound, unsigned int uDefault, bool bEnabled = true);
131  KviUIntSelector * addUIntSelector(QWidget * pParent, const QString & txt, int optId,
132  unsigned int uLowBound, unsigned int uHighBound, unsigned int uDefault, bool bEnabled = true);
133 
134  KviUIntSelector * addUShortIntSelector(int x1, int y1, int x2, int y2, const QString & txt, unsigned short int * pOption,
135  unsigned int uLowBound, unsigned int uHighBound, unsigned int uDefault, bool bEnabled = true);
136 
137  QLabel * addLabel(int x1, int y1, int x2, int y2, const QString & text, bool bEnabled = true);
138  QLabel * addLabel(QWidget * pParent, const QString & text, bool bEnabled = true);
139  QLineEdit * addLineEdit(int x1, int y1, int x2, int y2, bool bEnabled = true);
140  QPushButton * addPushButton(int x1, int y1, int x2, int y2, const QString & text, bool bEnabled = true);
141  KviTalGroupBox * addGroupBox(int x1, int y1, int x2, int y2, Qt::Orientation o, const QString & txt, bool bEnabled = true);
142  QFrame * addSeparator(int x1, int y1, int x2, int y2);
143  void addRowSpacer(int x1, int y1, int x2, int y2);
144 
145  void addWidgetToLayout(QWidget * w, int x1, int y1, int x2, int y2);
146 
147  // this does NOT add the advanced button if this page is not inside a KviGeneralOptionsDialog
148  // this is because nobody listens to the "switchToAdvancedPage" requests....
149  //void addAdvancedButton(int x1,int y1,int x2,int y2);
150 
151  void removeSelector(KviSelectorInterface * pInterface);
152 
153  virtual void commit();
154  virtual void childEvent(QChildEvent * e);
155 
156  virtual bool eventFilter(QObject * watched, QEvent * e);
157 
158 protected slots:
159  // this is internal to the options dialog (options module)
160  // it attempts to show all the hidden subitems (usually the "Advanced...") page
161  // and switch to the first of them
162  //void switchToAdvancedPage();
163  void childOptionsWidgetDestroyed();
164 signals:
165  // internal signal used for the stuff above
166  //void wantToSwitchToAdvancedPage(KviOptionsWidget *);
167 };
168 
169 #endif
Definition: KviSelectors.h:215
QGridLayout * m_pLayout
Definition: KviOptionsWidget.h:48
Definition: KviSelectors.h:59
#define KVIRC_API
Definition: kvi_settings.h:128
Class for groupbox.
Definition: KviSelectors.h:163
#define e
Definition: detector.cpp:69
QTabWidget * tabWidget()
Definition: KviOptionsWidget.h:71
Definition: KviSelectors.h:349
Definition: KviOptionsWidget.h:40
Icon manager.
Definition: KviPixmap.h:33
static QString m_szBasicTipStart
Definition: KviOptionsWidget.h:53
Definition: KviSelectors.h:78
QGridLayout * layout()
Definition: KviOptionsWidget.h:59
Toolkit Abstraction Layer: groupbox class.
Definition: KviTalGroupBox.h:43
Definition: KviSelectors.h:47
Definition: KviSelectors.h:256
Definition: KviSelectors.h:103
C++ Template based double linked pointer list class.
int m_iResetFlags
Definition: KviOptionsWidget.h:50
#define o
Definition: detector.cpp:79
Definition: KviSelectors.h:379
#define w
Definition: detector.cpp:87
virtual void commit()
Definition: KviSelectors.h:54
int m_iSelectors
Definition: KviOptionsWidget.h:51
QString name()
Definition: KviRuntimeInfo.cpp:655
void mergeResetFlag(int flag)
Definition: KviOptionsWidget.h:57
static QString m_szBasicTipEnd
Definition: KviOptionsWidget.h:54
Definition: KviSelectors.h:295
Definition: KviSelectors.h:267
This file contains compile time settings.
QTabWidget * m_pTabWidget
Definition: KviOptionsWidget.h:49
Definition: KviSelectors.h:319
KviPointerList< KviSelectorInterface > * m_pSelectorInterfaceList
Definition: KviOptionsWidget.h:52
KviPointerList< KviSelectorInterface > * selectors()
Definition: KviOptionsWidget.h:66
Definition: KviSelectors.h:187