michael@1: // michael@1: // OSSP asgui - Accounting system graphical user interface michael@12: // Copyright (c) 2002-2009 The OSSP Project (http://www.ossp.org/) michael@12: // Copyright (c) 2002-2009 Ralf S. Engelschall michael@12: // Copyright (c) 2002-2009 Michael Schloh von Bennewitz michael@12: // Copyright (c) 2002-2009 Cable & Wireless Telecommunications Services GmbH michael@1: // michael@1: // This file is part of OSSP asgui, an accounting system graphical user michael@3: // interface which can be found at http://asgui.europalab.com/. michael@1: // michael@1: // Permission to use, copy, modify, and distribute this software for michael@1: // any purpose with or without fee is hereby granted, provided that michael@1: // the above copyright notice and this permission notice appear in all michael@1: // copies. michael@1: // michael@1: // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@1: // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@1: // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@1: // IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@1: // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@1: // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@1: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@1: // USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@1: // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@1: // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@1: // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@1: // SUCH DAMAGE. michael@1: // michael@1: // as_helpanel.cpp: ISO C++ implementation michael@1: // michael@1: michael@1: #include michael@1: #include michael@3: #include michael@1: #include michael@1: #include michael@3: #include michael@3: michael@3: //Added by qt3to4: michael@3: #include michael@3: #include michael@1: michael@1: #include "as_helpanel.h" michael@1: michael@1: michael@1: namespace AS { michael@1: michael@1: // michael@1: // Constructs a Helpanel as a child of 'pParent', with the michael@1: // name 'kszName' and widget flags set to 'Flags'. michael@1: // michael@1: // The dialog will by default be modal, unless you set 'bModal' to michael@1: // false to construct a modeless dialog. michael@1: // michael@3: Helpanel::Helpanel(const QString &kSource, QWidget *pParent, const char *kszName, bool bModal, Qt::WFlags Flags) michael@1: : QDialog(pParent, kszName, bModal, Flags) michael@1: { michael@1: // Boilerplate code to initialize the panel michael@1: if (!kszName) michael@1: this->setName("Helpanel"); michael@1: michael@1: // Make panel resizeable michael@1: this->setSizeGripEnabled(true); michael@1: this->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, michael@1: (QSizePolicy::SizeType)5, 0, 0, this->sizePolicy().hasHeightForWidth())); michael@1: michael@1: // Build panel using already constructed widgets and layouts michael@3: m_pFormlay = new Q3VBoxLayout(this, 11, 6, "Formlayout"); michael@1: michael@1: // Groupbox and its text display michael@3: m_pBrowser = new Q3TextBrowser(this, "Helpbrowser"); michael@1: m_pBrowser->setSource(QString(TITRAQ_DOCDIR) + QChar('/') + kSource); michael@1: m_pBrowser->setReadOnly(true); michael@1: m_pBrowser->setFocus(); michael@1: michael@1: // Add a spacer to sideline the otherwise massive dismiss button michael@3: m_pButtlay = new Q3HBoxLayout(0, 0, 6, "Buttonlayout"); michael@1: QSpacerItem *pSpacey = new QSpacerItem(40, 20, QSizePolicy::Minimum, QSizePolicy::Minimum); michael@1: m_pButtlay->addItem(pSpacey); michael@1: michael@1: // Add dismiss push button michael@1: m_pDismissbutt = new QPushButton(this, "Dismissbutton"); michael@1: m_pDismissbutt->setPaletteBackgroundColor(QColor(198, 196, 186)); michael@14: m_pDismissbutt->setCursor(QCursor(Qt::PointingHandCursor)); michael@1: m_pButtlay->addWidget(m_pDismissbutt); michael@1: michael@1: // Add the stuff to our form layout michael@1: m_pFormlay->addWidget(m_pBrowser); michael@1: m_pFormlay->addSpacing(6); michael@1: m_pFormlay->addLayout(m_pButtlay); michael@1: michael@1: // Connect signals to slots, accept() and reject() are Qt implicit michael@1: connect(m_pDismissbutt, SIGNAL(clicked(void)), SLOT(accept(void))); michael@1: this->resize(QSize(464, 332).expandedTo(minimumSizeHint())); michael@1: this->textChange(); michael@1: } michael@1: michael@1: // michael@1: // Sets the strings of the subwidgets using the current language michael@1: // michael@1: void Helpanel::textChange(void) michael@1: { michael@1: this->setCaption(trUtf8("AS Accounting System help contents", "Help contents for the AS GUI application.")); michael@1: michael@1: // Top level push buttons associated with accept and save slots michael@1: m_pDismissbutt->setText(trUtf8("Dismiss", "Comment for Dismissbutton")); michael@1: QToolTip::add(m_pDismissbutt, trUtf8("Closes the help panel", "Comment for tooltip Dismissbutton")); michael@3: Q3WhatsThis::add(m_pDismissbutt, trUtf8("The dismiss button dismisses the help panel", "Comment for whatsThis Dismissbutton")); michael@1: michael@1: // The main text browser window which presents the HTML help contents michael@3: Q3WhatsThis::add(m_pBrowser, trUtf8("The text browser window displays the help contents", "Comment for whatsThis Browser")); michael@1: } michael@1: } // namespace AS