as_helpanel.cpp

Thu, 06 Aug 2009 13:21:30 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 06 Aug 2009 13:21:30 +0200
changeset 15
0e0eb7c91312
parent 14
1c58588f9cb6
permissions
-rw-r--r--

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_helpanel.cpp: ISO C++ implementation
    30 //
    32 #include <qvariant.h>
    33 #include <qpushbutton.h>
    34 #include <q3textbrowser.h>
    35 #include <qlayout.h>
    36 #include <qtooltip.h>
    37 #include <q3whatsthis.h>
    39 //Added by qt3to4:
    40 #include <Q3HBoxLayout>
    41 #include <Q3VBoxLayout>
    43 #include "as_helpanel.h"
    46 namespace AS {
    48 //
    49 // Constructs a Helpanel as a child of 'pParent', with the 
    50 // name 'kszName' and widget flags set to 'Flags'.
    51 //
    52 // The dialog will by default be modal, unless you set 'bModal' to
    53 // false to construct a modeless dialog.
    54 //
    55 Helpanel::Helpanel(const QString &kSource, QWidget *pParent, const char *kszName, bool bModal, Qt::WFlags Flags)
    56     : QDialog(pParent, kszName, bModal, Flags)
    57 {
    58     // Boilerplate code to initialize the panel
    59     if (!kszName)
    60         this->setName("Helpanel");
    62     // Make panel resizeable
    63     this->setSizeGripEnabled(true);
    64     this->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
    65         (QSizePolicy::SizeType)5, 0, 0, this->sizePolicy().hasHeightForWidth()));
    67     // Build panel using already constructed widgets and layouts
    68     m_pFormlay = new Q3VBoxLayout(this, 11, 6, "Formlayout");
    70     // Groupbox and its text display
    71     m_pBrowser = new Q3TextBrowser(this, "Helpbrowser");
    72     m_pBrowser->setSource(QString(TITRAQ_DOCDIR) + QChar('/') + kSource);
    73     m_pBrowser->setReadOnly(true);
    74     m_pBrowser->setFocus();
    76     // Add a spacer to sideline the otherwise massive dismiss button
    77     m_pButtlay = new Q3HBoxLayout(0, 0, 6, "Buttonlayout"); 
    78     QSpacerItem *pSpacey = new QSpacerItem(40, 20, QSizePolicy::Minimum, QSizePolicy::Minimum);
    79     m_pButtlay->addItem(pSpacey);
    81     // Add dismiss push button
    82     m_pDismissbutt = new QPushButton(this, "Dismissbutton");
    83     m_pDismissbutt->setPaletteBackgroundColor(QColor(198, 196, 186));
    84     m_pDismissbutt->setCursor(QCursor(Qt::PointingHandCursor));
    85     m_pButtlay->addWidget(m_pDismissbutt);
    87     // Add the stuff to our form layout
    88     m_pFormlay->addWidget(m_pBrowser);
    89     m_pFormlay->addSpacing(6);
    90     m_pFormlay->addLayout(m_pButtlay);
    92     // Connect signals to slots, accept() and reject() are Qt implicit
    93     connect(m_pDismissbutt, SIGNAL(clicked(void)), SLOT(accept(void)));
    94     this->resize(QSize(464, 332).expandedTo(minimumSizeHint()));
    95     this->textChange();
    96 }
    98 //
    99 // Sets the strings of the subwidgets using the current language
   100 //
   101 void Helpanel::textChange(void)
   102 {
   103     this->setCaption(trUtf8("AS Accounting System help contents", "Help contents for the AS GUI application."));
   105     // Top level push buttons associated with accept and save slots
   106     m_pDismissbutt->setText(trUtf8("Dismiss", "Comment for Dismissbutton"));
   107     QToolTip::add(m_pDismissbutt, trUtf8("Closes the help panel", "Comment for tooltip Dismissbutton"));
   108     Q3WhatsThis::add(m_pDismissbutt, trUtf8("The dismiss button dismisses the help panel", "Comment for whatsThis Dismissbutton"));
   110     // The main text browser window which presents the HTML help contents
   111     Q3WhatsThis::add(m_pBrowser, trUtf8("The text browser window displays the help contents", "Comment for whatsThis Browser"));
   112 }
   113 } // namespace AS

mercurial