1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/as_gui.cpp Fri Nov 28 11:21:08 2008 +0100 1.3 @@ -0,0 +1,100 @@ 1.4 +// 1.5 +// OSSP asgui - Accounting system graphical user interface 1.6 +// Copyright (c) 2002-2004 The OSSP Project (http://www.ossp.org/) 1.7 +// Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com> 1.8 +// Copyright (c) 2002-2004 Michael Schloh von Bennewitz <michael@schloh.com> 1.9 +// Copyright (c) 2002-2004 Cable & Wireless Telecommunications Services GmbH 1.10 +// 1.11 +// This file is part of OSSP asgui, an accounting system graphical user 1.12 +// interface which can be found at http://www.ossp.org/pkg/tool/asgui/. 1.13 +// 1.14 +// Permission to use, copy, modify, and distribute this software for 1.15 +// any purpose with or without fee is hereby granted, provided that 1.16 +// the above copyright notice and this permission notice appear in all 1.17 +// copies. 1.18 +// 1.19 +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.20 +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.21 +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.22 +// IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.23 +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.24 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.25 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.26 +// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.27 +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.28 +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.29 +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.30 +// SUCH DAMAGE. 1.31 +// 1.32 +// as_gui.cpp: ISO C++ implementation 1.33 +// 1.34 + 1.35 +// User interface 1.36 +#include "as_gui.h" // Main classes 1.37 +#include "as_except.h" // Exception classes 1.38 +#include "as_table.h" // Class TiTable 1.39 +#include "as_const.h" // Application constants 1.40 +#include "as_pref.h" // Class Preferences 1.41 + 1.42 + 1.43 +// 1.44 +// Construct a Titraqform which is a child of 'pParent', with the 1.45 +// name 'kszName' and widget flags set to 'Flags' 1.46 +// 1.47 +Titraqform::Titraqform(QWidget *pParent, const char *kszName, WFlags Flags) : 1.48 + QMainWindow(pParent, kszName, Flags) 1.49 +{ 1.50 + // Early initializations 1.51 + m_pFiletools = NULL; 1.52 + m_pEdittools = NULL; 1.53 + m_pViewtools = NULL; 1.54 + m_pWhatstools = NULL; 1.55 + m_szFilename = NULL; 1.56 + 1.57 + // Atenzione! Order is very important in the following sequence. 1.58 + // FIXME: Reorganize this procedural mess into self contained objects 1.59 + try { 1.60 + setupPrefs(); // Load general preferences 1.61 + setupActions(); // Create and initialize actions 1.62 + setupMenubar(); // Create and initialize menu bar 1.63 + setupToolbars(); // Create and initialize tool bars 1.64 + setupCentralwidget(); // Format the layout of related widgets 1.65 + setupStatusbar(); // Create and initialize status bar 1.66 + setupTable(); // Create and initialize table and cells 1.67 + setupEditlay(); // Create and initialize edit controls 1.68 + setupColumns(); // Prepare columns for viewing, sorting 1.69 + enableIface(false); // Start things off in a empty state 1.70 + } 1.71 + catch (Genexcept& Genex) { 1.72 + Genex.reportErr(); 1.73 + exit(1); 1.74 + } 1.75 + 1.76 + // Postsetup manipulations 1.77 + m_pMaintable->setDirty(false); 1.78 + if (!kszName) 1.79 + this->setName(trUtf8("ASGuiapp")); 1.80 + this->resize(m_pPrefs->getNumber(TITRAQ_PREFFRAMEWIDTH, TITRAQ_DEFFRAMEWIDTH), 1.81 + m_pPrefs->getNumber(TITRAQ_PREFFRAMEHEIGHT, TITRAQ_DEFFRAMEHEIGHT)); 1.82 + connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(savePrefs())); 1.83 + this->setCaption(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short); 1.84 + 1.85 + // Rehydrate main window layout and doc positions 1.86 + QString Laystring = m_pPrefs->getString(TITRAQ_PREFFRAMELAY, NULL); // FIXME: Handle first case better 1.87 + QTextStream Laystream(&Laystring, IO_ReadOnly); 1.88 + Laystream >> *this; 1.89 + 1.90 +// // Lock down window size 1.91 +// setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, 1.92 +// (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth())); 1.93 +} 1.94 + 1.95 +// 1.96 +// Destroy the object and free any allocated resources 1.97 +// 1.98 +Titraqform::~Titraqform(void) 1.99 +{ 1.100 + // Qt deletes child widgets for us 1.101 + m_pPrefs->flush(); 1.102 + delete m_pPrefs; 1.103 +}