as_helpanel.cpp

changeset 1
d64aaa7d146f
child 3
c1941114ca88
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/as_helpanel.cpp	Fri Nov 28 11:21:08 2008 +0100
     1.3 @@ -0,0 +1,109 @@
     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_helpanel.cpp: ISO C++ implementation
    1.33 +//
    1.34 +
    1.35 +#include <qvariant.h>
    1.36 +#include <qpushbutton.h>
    1.37 +#include <qtextbrowser.h>
    1.38 +#include <qlayout.h>
    1.39 +#include <qtooltip.h>
    1.40 +#include <qwhatsthis.h>
    1.41 +
    1.42 +#include "as_helpanel.h"
    1.43 +
    1.44 +
    1.45 +namespace AS {
    1.46 +
    1.47 +//
    1.48 +// Constructs a Helpanel as a child of 'pParent', with the 
    1.49 +// name 'kszName' and widget flags set to 'Flags'.
    1.50 +//
    1.51 +// The dialog will by default be modal, unless you set 'bModal' to
    1.52 +// false to construct a modeless dialog.
    1.53 +//
    1.54 +Helpanel::Helpanel(const QString &kSource, QWidget *pParent, const char *kszName, bool bModal, WFlags Flags)
    1.55 +    : QDialog(pParent, kszName, bModal, Flags)
    1.56 +{
    1.57 +    // Boilerplate code to initialize the panel
    1.58 +    if (!kszName)
    1.59 +        this->setName("Helpanel");
    1.60 +
    1.61 +    // Make panel resizeable
    1.62 +    this->setSizeGripEnabled(true);
    1.63 +    this->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
    1.64 +        (QSizePolicy::SizeType)5, 0, 0, this->sizePolicy().hasHeightForWidth()));
    1.65 +
    1.66 +    // Build panel using already constructed widgets and layouts
    1.67 +    m_pFormlay = new QVBoxLayout(this, 11, 6, "Formlayout");
    1.68 +
    1.69 +    // Groupbox and its text display
    1.70 +    m_pBrowser = new QTextBrowser(this, "Helpbrowser");
    1.71 +    m_pBrowser->setSource(QString(TITRAQ_DOCDIR) + QChar('/') + kSource);
    1.72 +    m_pBrowser->setReadOnly(true);
    1.73 +    m_pBrowser->setFocus();
    1.74 +
    1.75 +    // Add a spacer to sideline the otherwise massive dismiss button
    1.76 +    m_pButtlay = new QHBoxLayout(0, 0, 6, "Buttonlayout"); 
    1.77 +    QSpacerItem *pSpacey = new QSpacerItem(40, 20, QSizePolicy::Minimum, QSizePolicy::Minimum);
    1.78 +    m_pButtlay->addItem(pSpacey);
    1.79 +
    1.80 +    // Add dismiss push button
    1.81 +    m_pDismissbutt = new QPushButton(this, "Dismissbutton");
    1.82 +    m_pDismissbutt->setPaletteBackgroundColor(QColor(198, 196, 186));
    1.83 +    m_pDismissbutt->setCursor(QCursor(13));
    1.84 +    m_pButtlay->addWidget(m_pDismissbutt);
    1.85 +
    1.86 +    // Add the stuff to our form layout
    1.87 +    m_pFormlay->addWidget(m_pBrowser);
    1.88 +    m_pFormlay->addSpacing(6);
    1.89 +    m_pFormlay->addLayout(m_pButtlay);
    1.90 +
    1.91 +    // Connect signals to slots, accept() and reject() are Qt implicit
    1.92 +    connect(m_pDismissbutt, SIGNAL(clicked(void)), SLOT(accept(void)));
    1.93 +    this->resize(QSize(464, 332).expandedTo(minimumSizeHint()));
    1.94 +    this->textChange();
    1.95 +}
    1.96 +
    1.97 +//
    1.98 +// Sets the strings of the subwidgets using the current language
    1.99 +//
   1.100 +void Helpanel::textChange(void)
   1.101 +{
   1.102 +    this->setCaption(trUtf8("AS Accounting System help contents", "Help contents for the AS GUI application."));
   1.103 +
   1.104 +    // Top level push buttons associated with accept and save slots
   1.105 +    m_pDismissbutt->setText(trUtf8("Dismiss", "Comment for Dismissbutton"));
   1.106 +    QToolTip::add(m_pDismissbutt, trUtf8("Closes the help panel", "Comment for tooltip Dismissbutton"));
   1.107 +    QWhatsThis::add(m_pDismissbutt, trUtf8("The dismiss button dismisses the help panel", "Comment for whatsThis Dismissbutton"));
   1.108 +
   1.109 +    // The main text browser window which presents the HTML help contents
   1.110 +    QWhatsThis::add(m_pBrowser, trUtf8("The text browser window displays the help contents", "Comment for whatsThis Browser"));
   1.111 +}
   1.112 +} // namespace AS

mercurial