|
1 // |
|
2 // OSSP asgui - Accounting system graphical user interface |
|
3 // Copyright (c) 2002-2004 The OSSP Project (http://www.ossp.org/) |
|
4 // Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com> |
|
5 // Copyright (c) 2002-2004 Michael Schloh von Bennewitz <michael@schloh.com> |
|
6 // Copyright (c) 2002-2004 Cable & Wireless Telecommunications Services GmbH |
|
7 // |
|
8 // This file is part of OSSP asgui, an accounting system graphical user |
|
9 // interface which can be found at http://www.ossp.org/pkg/tool/asgui/. |
|
10 // |
|
11 // Permission to use, copy, modify, and distribute this software for |
|
12 // any purpose with or without fee is hereby granted, provided that |
|
13 // the above copyright notice and this permission notice appear in all |
|
14 // copies. |
|
15 // |
|
16 // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
17 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
18 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
19 // IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
20 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
23 // USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
25 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
26 // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
27 // SUCH DAMAGE. |
|
28 // |
|
29 // as_panel.h: ISO C++ interface |
|
30 // |
|
31 |
|
32 #ifndef PREFPANEL_H |
|
33 #define PREFPANEL_H |
|
34 |
|
35 #include <qvariant.h> |
|
36 #include <qdialog.h> |
|
37 #include <qbuttongroup.h> |
|
38 #include <qlabel.h> |
|
39 #include <qlineedit.h> |
|
40 #include <qpushbutton.h> |
|
41 #include <qtoolbutton.h> |
|
42 #include <qcolordialog.h> |
|
43 #include <qradiobutton.h> |
|
44 #include <qcheckbox.h> |
|
45 #include <qtabwidget.h> |
|
46 #include <qwidget.h> |
|
47 #include <qlayout.h> |
|
48 #include <qtooltip.h> |
|
49 #include <qwhatsthis.h> |
|
50 #include <qstylefactory.h> |
|
51 #include <qlayout.h> |
|
52 |
|
53 #include "as_gui.h" // For usage of style_t |
|
54 |
|
55 |
|
56 class Prefpanel : public QDialog |
|
57 { |
|
58 Q_OBJECT |
|
59 |
|
60 public: |
|
61 Prefpanel(QWidget *pParent = 0, const char *kszName = 0, bool bModal = true, WFlags Flags = 0); |
|
62 // ~Prefpanel(void); // No need to destroy widgets, because qt does it for us |
|
63 |
|
64 private: |
|
65 Preferences *m_pPanprefs; |
|
66 QColor *m_pLight, *m_pDark; |
|
67 QColorGroup *m_pOrigcolours, *m_pAltcolours; |
|
68 |
|
69 public: |
|
70 QGroupBox *m_pGenbox, *m_pRembox, *m_pShadebox, *m_pThemebox; |
|
71 QVBoxLayout *m_pStylelay, *m_pReportlay, *m_pSwitchlay; |
|
72 QVBoxLayout *m_pVlayout, *m_pBinlayout; |
|
73 QHBoxLayout *m_pBoolayout, *m_pGenlayout, *m_pRemlayout; |
|
74 QVBoxLayout *m_pShadeboxlay, *m_pThemeboxlay; |
|
75 QHBoxLayout *m_pGenboxlay, *m_pRemboxlay, *m_pColourlayout; |
|
76 QGridLayout *m_pGeninner, *m_pReminner, *m_pShadelayout; |
|
77 |
|
78 QWidget *m_pBoolpage, *m_pGeneralpage, *m_pRemotepage, *m_pColourpage; |
|
79 |
|
80 QHBoxLayout *m_pButtlay; |
|
81 QPushButton *m_pOkaybutton; |
|
82 QPushButton *m_pApplybutton; |
|
83 QPushButton *m_pCancelbutton; |
|
84 QTabWidget *m_pTabselect; |
|
85 |
|
86 QLabel *m_pAcctlabel, *m_pEventlabel; |
|
87 QLabel *m_pUserlabel, *m_pHomelabel; |
|
88 QLabel *m_pCorbalabel, *m_pSoaplabel; |
|
89 QLineEdit *m_pAcctline, *m_pEventline; |
|
90 QLineEdit *m_pUserline, *m_pHomeline; |
|
91 QLineEdit *m_pCorbaline, *m_pSoapline; |
|
92 QCheckBox *m_pCorbacheck, *m_pSoapcheck; |
|
93 |
|
94 QLabel *m_pLightlab, *m_pDarklab, *m_pRevertlab; |
|
95 QToolButton *m_pLightbutt, *m_pDarkbutt, *m_pRevertbutt; |
|
96 |
|
97 QButtonGroup *m_pStylegroup, *m_pReportgroup, *m_pSwitchgroup; |
|
98 QCheckBox *m_pBackupcheck, *m_pExtendcheck; |
|
99 QCheckBox *m_pDetailcheck, *m_pSigncheck; |
|
100 |
|
101 public: |
|
102 // Accessor get methods |
|
103 QString getStyle(void) {return (m_pStylegroup->selected()->text());}; |
|
104 QString getAccounts(void) {return (m_pAcctline->text());}; |
|
105 QString getEvents(void) {return (m_pEventline->text());}; |
|
106 QString getUser(void) {return (m_pUserline->text());}; |
|
107 QString getHome(void) {return (m_pHomeline->text());}; |
|
108 QString getCorbahost(void) {return (m_pCorbaline->text());}; |
|
109 QString getSoaphost(void) {return (m_pSoapline->text());}; |
|
110 bool getCorbaon(void) {return (m_pCorbacheck->isChecked());}; |
|
111 bool getSoapon(void) {return (m_pSoapcheck->isChecked());}; |
|
112 bool getBackon(void) {return (m_pBackupcheck->isChecked());}; |
|
113 bool getExtendon(void) {return (m_pExtendcheck->isChecked());}; |
|
114 bool getDetailon(void) {return (m_pDetailcheck->isChecked());}; |
|
115 bool getSignaton(void) {return (m_pSigncheck->isChecked());}; |
|
116 QColor *getLight(void) {return m_pLight;}; |
|
117 QColor *getDark(void) {return m_pDark;}; |
|
118 QColor *getRevlight(void) {return (QColor *)&m_pOrigcolours->foreground();}; |
|
119 QColor *getRevdark(void) {return (QColor *)&m_pOrigcolours->background();}; |
|
120 QColor *getAltlight(void) {return (QColor *)&m_pAltcolours->foreground();}; |
|
121 QColor *getAltdark(void) {return (QColor *)&m_pAltcolours->background();}; |
|
122 |
|
123 // Accessor set methods |
|
124 void setAccounts(const QString &kInstr) {m_pAcctline->setText(kInstr);}; |
|
125 void setEvents(const QString &kInstr) {m_pEventline->setText(kInstr);}; |
|
126 void setUser(const QString &kInstr) {m_pUserline->setText(kInstr);}; |
|
127 void setHome(const QString &kInstr) {m_pHomeline->setText(kInstr);}; |
|
128 void setCorbahost(const QString &kInstr) {m_pCorbaline->setText(kInstr);}; |
|
129 void setSoaphost(const QString &kInstr) {m_pSoapline->setText(kInstr);}; |
|
130 void setBackon(const bool &kbEnable = true) {m_pBackupcheck->setChecked(kbEnable);}; |
|
131 void setExtendon(const bool &kbEnable = true) {m_pExtendcheck->setChecked(kbEnable);}; |
|
132 void setDetailon(const bool &kbEnable = true) {m_pDetailcheck->setChecked(kbEnable);}; |
|
133 void setSignaton(const bool &kbEnable = true) {m_pSigncheck->setChecked(kbEnable);}; |
|
134 void lockCorba(const bool &kbLock = true) {m_pCorbacheck->setEnabled(!kbLock);}; |
|
135 void lockSoap(const bool &kbLock = true) {m_pSoapcheck->setEnabled(!kbLock);}; |
|
136 void setLight(const QColor *pLight) {m_pLight = (QColor *)pLight;}; |
|
137 void setDark(const QColor *pDark) {m_pDark = (QColor *)pDark;}; |
|
138 void setOrigcolour(QColorGroup *pGroup) {m_pOrigcolours = pGroup;}; |
|
139 void setAltcolour(QColorGroup *pGroup) {m_pAltcolours = pGroup;}; |
|
140 void setCorbaon(const bool &kbEnable = true) { |
|
141 m_pCorbaline->setEnabled(kbEnable); |
|
142 m_pCorbacheck->setChecked(kbEnable); |
|
143 }; |
|
144 void setSoapon(const bool &kbEnable = true) { |
|
145 m_pSoapline->setEnabled(kbEnable); |
|
146 m_pSoapcheck->setChecked(kbEnable); |
|
147 }; |
|
148 void setStyle(const char *pkszStyle) { |
|
149 for (int nIter = 0; nIter < m_pStylegroup->count(); nIter++) |
|
150 if (m_pStylegroup->find(nIter)->text() == pkszStyle) |
|
151 m_pStylegroup->setButton(nIter); |
|
152 }; |
|
153 |
|
154 protected slots: |
|
155 virtual void polish(void); |
|
156 virtual void textChange(void); |
|
157 virtual void shadeLight(void); |
|
158 virtual void shadeDark(void); |
|
159 virtual void shadeRevert(void); |
|
160 void enableCorba(bool bOn) {m_pCorbaline->setEnabled(bOn);}; |
|
161 void enableSoap(bool bOn) {m_pSoapline->setEnabled(bOn);}; |
|
162 |
|
163 signals: |
|
164 void applied(void); |
|
165 }; |
|
166 |
|
167 #endif // PREFPANEL_H |