Thu, 06 Aug 2009 13:21:30 +0200
Remove seemingly declarations unnecessary according to Qt 4.5.2 headers.
1 //
2 // OSSP asgui - Accounting system graphical user interface
3 // Copyright (c) 2002-2009 The OSSP Project (http://www.ossp.org/)
4 // Copyright (c) 2002-2009 Ralf S. Engelschall <rse@engelschall.com>
5 // Copyright (c) 2002-2009 Michael Schloh von Bennewitz <michael@schloh.com>
6 // Copyright (c) 2002-2009 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://asgui.europalab.com/.
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_gui.h: ISO C++ interface
30 //
32 #ifndef AS_GUI_MWIN_H
33 #define AS_GUI_MWIN_H
35 #include <q3mainwindow.h>
37 //Added by qt3to4:
38 #include <Q3TextStream>
39 #include <Q3HBoxLayout>
40 #include <QCloseEvent>
41 #include <Q3Frame>
42 #include <QLabel>
43 #include <Q3PopupMenu>
44 #include <Q3VBoxLayout>
45 #include <Q3Action>
46 #include <Q3ComboBox>
48 #ifdef HAVE_CONFIG_H
49 #include "ac_config.h"
50 #endif
52 #include "as_except.h" // Exception classes
54 // Version information
55 #define _AS_VERSION_CPP_AS_HEADER_
56 #include "as_version.cpp"
57 #undef _AS_VERSION_CPP_AS_HEADER_
59 // Trolltech class prototypes
60 class Q3Action;
61 class Q3Header;
62 class Q3TimeEdit;
63 class Q3ComboBox;
64 class QLineEdit;
65 class QLabel;
66 class QDate;
67 class QFile;
69 // Local class prototypes
70 class ASTimeEdit;
71 class Daydatedit; // Might be replaced with ASTimeEdit throughout
72 class TiTable;
73 class Preferences;
74 class Prefpanel;
76 // Intentional no operation
77 #define TITRAQ_NOP ((void)0)
79 #ifdef HAVE_CONFIG_H
80 #if (SIZEOF_CHAR == 1)
81 typedef unsigned char U8;
82 #else
83 ?==Error: Undefined 8 bit type
84 #endif // U8
86 #if (SIZEOF_SHORT == 2)
87 typedef unsigned short U16;
88 #elif (SIZEOF_INT == 2)
89 typedef unsigned int U16;
90 #elif (SIZEOF_LONG == 2)
91 typedef unsigned long U16;
92 #else
93 ?==Error: Undefined 16 bit type
94 #endif // U16
96 #if (SIZEOF_SHORT == 4)
97 typedef unsigned short U32;
98 #elif (SIZEOF_INT == 4)
99 typedef unsigned int U32;
100 #elif (SIZEOF_LONG == 4)
101 typedef unsigned long U32;
102 #else
103 ?==Error: Undefined 32 bit type
104 #endif // U32
106 #else // HAVE_CONFIG_H (not defined)
107 typedef unsigned char U8;
109 #if (2 == 2)
110 typedef unsigned short U16;
111 #elif (4 == 2)
112 typedef unsigned int U16;
113 #else
114 ?==Error: Undefined 16 bit type
115 #endif
117 #if (2 == 4)
118 typedef unsigned short U32;
119 #elif (4 == 4)
120 typedef unsigned int U32;
121 #elif (4 == 4)
122 typedef unsigned long U32;
123 #else
124 ?== Error: Undefined 32 bit type
125 #endif
126 #endif // HAVE_CONFIG_H
129 // Main table size
130 const int g_knBlocks = 32;
132 // Styles enumeration
133 typedef enum
134 {
135 TITRAQ_STYLECDE,
136 TITRAQ_STYLESGI,
137 TITRAQ_STYLEMOTIF,
138 TITRAQ_STYLEMPLUS,
139 TITRAQ_STYLEPLAT,
140 TITRAQ_STYLEMSOFT
141 } styles_t;
143 // Main application form window
144 class Titraqform : public Q3MainWindow
145 {
146 Q_OBJECT // Generate MOC object model stubs
148 public:
149 Titraqform(QWidget *pParent = 0, const char *kszName = 0, Qt::WFlags Flags = 0);
150 ~Titraqform(void);
152 // Accessor methods
153 const QString getRowdata(void) const; // Get a whole row of data
154 void setRowdata(QString &) const; // Set a whole row of data
155 const int getFirstcol(void) const; // Learn which col is first
156 const bool isOpen(void) {return (m_szFilename == NULL) ? false : true;}; // Doc state
157 void setOpen(bool bDocopen = true) // Set state of document
158 {
159 if (bDocopen) {
160 if (m_szFilename == NULL)
161 m_szFilename = new QString();
162 }
163 else
164 if (m_szFilename != NULL) {
165 delete m_szFilename;
166 m_szFilename = NULL;
167 }
168 };
169 const QString *getFilename(void) // Get the current file name
170 {
171 if (this->isOpen())
172 return m_szFilename;
173 else
174 throw Genexcept("File name does not exist.");
175 };
176 void setFilename(const QString &Fname) // Set file name
177 {
178 if (this->isOpen()) // If a file name exists
179 setOpen(false); // then get rid of it first
180 m_szFilename = new QString(Fname);
181 };
183 // Utility members
184 void loadInit(void); // Parse cmds and open initial file
186 // Top level members
187 Preferences *m_pPrefs;
189 // Main application actions
190 Q3Action *m_pFilenewact, *m_pFileopenact;
191 Q3Action *m_pFilesaveact, *m_pFilesaveasact;
192 Q3Action *m_pFilecloseact, *m_pFilequitact;
193 Q3Action *m_pAddrowact, *m_pDelrowact;
194 Q3Action *m_pRefreshact, *m_pCutact;
195 Q3Action *m_pCopyact, *m_pPasteact;
196 Q3Action *m_pSyncact, *m_pPrefsact;
197 Q3Action *m_pReportact;
199 // Table, cells, and entries in package layout
200 TiTable *m_pMaintable;
201 Q3Header *m_pTablehead;
202 QStringList *m_pTaskentries;
204 // Edition widgets
205 QLabel *m_pStatusedit; // Control to show entry status
206 QLineEdit *m_pLineedit; // Control to line number
207 QLineEdit *m_pUseredit; // Control to edit user name
208 QLineEdit *m_pGuidedit; // Control to edit GUID
209 QLineEdit *m_pCrcedit; // Control to edit CRC
210 QLineEdit *m_pRevedit; // Control to edit revision
211 Daydatedit *m_pDateedit; // Control to edit date
212 Q3TimeEdit *m_pStarttime; // Control to edit start time
213 Q3TimeEdit *m_pEndtime; // Control to edit finish time
214 // QTimeEdit *m_pAmount; // Control to edit total time
215 ASTimeEdit *m_pAmount; // Control to edit total time
216 Q3ComboBox *m_pTasks; // Control to choose a task
217 QLineEdit *m_pRemark; // Control to edit remark
219 protected slots:
220 void cutEntry(void); // Cut task entries from the list
221 void copyEntry(void); // Copy task entries from the list
222 void pasteEntry(void); // Paste task entries to the list
223 void addEntry(int nRows= -1); // Add task entries to the list
224 void delEntry(int nRows= -1); // Delete task entries from the list
225 void refreshDisplay(void); // Refresh the display of all data items
226 void syncIiop(void); // Syncronize data with server using IIOP
227 void syncSoap(void); // Syncronize data with server using SOAP
228 void newDoc(void); // Make and display a new document window
229 void openDoc(void); // Open and display an existing document
230 void quitApp(void); // Close the current document and quit
231 void saveFile(void); // Serialize to the current file
232 void saveAs(void); // Serialize to a selected file
233 void saveName(void); // Implicitly serialize to a selected file
234 void helpContents(void); // Use the help contents
235 void aboutTitraq(void); // Learn more about this program itself
236 void aboutOSSP(void); // Learn more about the OSSP
237 void aboutQt(void); // Learn more about Qt
238 void selAll(void); // Edit menu select all
239 void onClick(int, int, int, const QPoint &); // Table was clicked
240 void inplaceEdit(int, int, int, const QPoint &); // Enter in place edit mode
241 void updEdit(int, int nCol = 0); // Update edit controls
242 void validateRow(void); // Validate current row of matrix
243 void validateRow(int, int); // Validate specified row of matrix
244 void updSizes(int, int, int); // Update edit sizes
245 void calcCrc(void); // Calculate CRC of current row
246 void calcCrc(int, int); // Calculate CRC of specified row
247 void dataChanged(int, int); // Timesheet data changed
248 void updateLine(const QString &); // Update line number column
249 void updateUser(const QString &); // Update user column
250 void updateGuid(const QString &); // Update GUID column
251 void updateCrc(const QString &); // Update CRC column
252 void updateRev(const QString &); // Update rev column
253 void updateDate(const QDate &); // Update date column
254 void updateStart(const QTime &); // Update start column
255 void updateFinish(const QTime &); // Update finish column
256 void updateAmount(const QTime &); // Update amount column
257 void updateTask(const QString &); // Update task column
258 void updateRemark(const QString &); // Update remark column
259 void confirmEdit(void); // Confirm whole row edition
260 void configPrefs(void); // Edit menu configure preferences
261 void normalView(void); // View menu normal
262 void editingView(void); // View menu editing
263 void timingView(void); // View menu timing
264 void showFilebar(void); // View menu show file toolbar
265 void showEditbar(void); // View menu show edit toolbar
266 void showViewbar(void); // View menu show view toolbar
267 void showPrefsbar(void); // View menu show prefs toolbar
268 void showWhatsbar(void); // View menu show whats this toolbar
269 void showStatcol(void); // View menu show status column
270 void showLinecol(void); // View menu show line numbers column
271 void showUsercol(void); // View menu show Users column
272 void showGuidcol(void); // View menu show GUIDs column
273 void showCrccol(void); // View menu show CRC column
274 void showRevcol(void); // View menu show Rev column
275 void showDatecol(void); // View menu show Dates column
276 void showStartcol(void); // View menu show Start time column
277 void showFinishcol(void); // View menu show Finish time column
278 void showAmountcol(void); // View menu show Amounts column
279 void showTaskcol(void); // View menu show Tasks column
280 void showRemarkcol(void); // View menu show Remarks column
281 void genReport(void); // Generate a local formatted report
282 void savePrefs(void); // Save user preferences
283 void applyPrefs(void); // Apply preferences from applied()
284 void applyPrefs(Prefpanel *); // Apply preferences from accept()
286 protected:
287 // Application main events
288 void closeEvent(QCloseEvent *); // Close current document in main window
290 // Application main window widgets
291 Q3Frame *m_pCenframe; // Central frame
292 Q3VBoxLayout *m_pMainlayout; // Package and control layouts
293 Q3VBoxLayout *m_pPackagelayout; // Main table control
294 Q3HBoxLayout *m_pEditlayout; // Lower edition widgets
296 private:
297 // Owned by QMainWindow
298 QMenuBar *m_pMenubar;
299 Q3PopupMenu *m_pViewpopup; // Saved for manipulating views
300 Q3PopupMenu *m_pTbarspopup; // Saved for manipulating toolbars
301 Q3PopupMenu *m_pColspopup; // Saved for manipulating columns
302 QStatusBar *m_pStatbar;
304 // Belong to us
305 Q3ToolBar *m_pFiletools;
306 Q3ToolBar *m_pEdittools;
307 Q3ToolBar *m_pViewtools;
308 Q3ToolBar *m_pPrefstools;
309 Q3ToolBar *m_pWhatstools;
310 QString *m_szFilename;
312 // Constructor helpers
313 void setupPrefs(void); // Preferences
314 void setupActions(void); // Actions
315 void setupMenubar(void); // Menu bar
316 void setupToolbars(void); // Tool bars
317 void setupStatusbar(void); // Status bar
318 void setupCentralwidget(void); // Assemble main Frame widget
319 void setupTable(void); // Table widget
320 void setupEditlay(void); // Editing lay
321 void setupPieces(void); // Assemble widget pieces
322 void setupColumns(void); // Arrange and configure columns
323 void enableIface(bool); // [En/dis]able most ui pieces
325 // Data processing
326 void loadAccounts(QFile &); // Load accounts from file
327 void loadAccounts(Q3TextStream &); // Load accounts from stream
328 void loadData(QFile &); // Load personal data from file
329 void loadData(Q3TextStream &); // Load personal data from stream
330 void saveData(QFile &); // Save accounting data to file
331 void saveData(Q3TextStream &); // Save accounting data to stream
332 const bool validateData(QFile &) const; // Validate personal data in file
333 const bool validateData(QString &) const; // Validate personal data from string
334 };
336 #endif // AS_GUI_MWIN_H