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