Marlin  01.17.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
guihelp.cpp
Go to the documentation of this file.
1 #include <QtGui>
2 
3 #include "guihelp.h"
4 
5 GUIHelp::GUIHelp( QString path, QWidget* parent, Qt::WFlags f ) : QWidget( parent, f ){
6 
7  browser = new QTextBrowser;
8 
9  QString mPath=getenv("MARLIN");
10  QString sPath=mPath;
11  sPath+="/gui/help/index.html";
12 
13  QString lPath=mPath;
14  lPath+=path;
15 
16  //set the browser home
17  browser->setSource(QUrl(sPath));
18 
19  //goto path given in constructor
20  browser->setSource(QUrl(lPath));
21 
22  //Buttons
23  QPushButton *forwButton = new QPushButton(tr("->"));
24  QPushButton *backButton = new QPushButton(tr("<-"));
25  QPushButton *homeButton = new QPushButton(tr("TOC"));
26  QPushButton *closeButton = new QPushButton(tr("Close"));
27 
28  forwButton->setToolTip(tr("Forward"));
29  backButton->setToolTip(tr("Backward"));
30  homeButton->setToolTip(tr("Table of Contents"));
31  closeButton->setToolTip(tr("Close Help"));
32 
33  forwButton->setMaximumWidth(50);
34  backButton->setMaximumWidth(50);
35  homeButton->setMaximumWidth(90);
36  homeButton->setMaximumWidth(70);
37 
38  connect(forwButton, SIGNAL(clicked()), browser, SLOT(forward()));
39  connect(backButton, SIGNAL(clicked()), browser, SLOT(backward()));
40  connect(homeButton, SIGNAL(clicked()), browser, SLOT(home()));
41  connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
42 
43  //Layout
44  QHBoxLayout *helpBLayout = new QHBoxLayout;
45  helpBLayout->addWidget(backButton);
46  helpBLayout->addWidget(forwButton);
47  helpBLayout->addWidget(homeButton);
48  helpBLayout->addWidget(closeButton);
49 
50  //GroupBox
51  QGroupBox *browserButtons = new QGroupBox(tr("Help Browser"));
52  browserButtons->setLayout(helpBLayout);
53  browserButtons->setMaximumWidth(250);
54  browserButtons->setMaximumHeight(70);
55 
56  QVBoxLayout *helpLayout = new QVBoxLayout;
57  helpLayout->addWidget(browserButtons);
58  helpLayout->addWidget(browser);
59 
60  setLayout(helpLayout);
61  resize(1000,800);
62  setWindowTitle(tr("Marlin GUI Help"));
63 }
64 
GUIHelp(const GUIHelp &)=default
QTextBrowser * browser
Definition: guihelp.h:26