Isis 3 Programmer Reference
HelpTool.cpp
1 #include "HelpTool.h"
2 
3 #include <QAction>
4 #include <QApplication>
5 #include <QMenu>
6 #include <QString>
7 #include <QToolBar>
8 #include <QWhatsThis>
9 
10 #include "IException.h"
11 #include "MainWindow.h"
12 #include "Workspace.h"
13 #include "Preference.h"
14 #include "ProgramLauncher.h"
15 
16 
17 namespace Isis {
18  // Constructor
19  HelpTool::HelpTool(QWidget *parent) : Tool(parent) {
20  p_whatsThis = new QAction(parent);
21  p_whatsThis->setShortcut(Qt::SHIFT + Qt::Key_F1);
22  p_whatsThis->setText("&What's This?");
23  p_whatsThis->setIcon(QPixmap(toolIconDir() + "/contexthelp.png"));
24  p_whatsThis->setToolTip("What's This");
25  QString whatsThis =
26  "<b>Function:</b> Use this to get longer descriptions of button \
27  functions \
28  <p><b>Shortcut:</b> Shift+F1</p>";
29  p_whatsThis->setWhatsThis(whatsThis);
30  connect(p_whatsThis, SIGNAL(triggered()), this, SLOT(whatsThis()));
31 
32  p_aboutProgram = new QAction(parent);
33  p_aboutProgram->setShortcut(Qt::CTRL + Qt::Key_H);
34  QString s = "About ";
35  s += QApplication::applicationName();
36  p_aboutProgram->setText(s);
37  connect(p_aboutProgram, SIGNAL(triggered()), this, SLOT(aboutProgram()));
38 
39  }
40 
41  // Add actions to the Help menu
42  void HelpTool::addTo(QMenu *menu) {
43  menu->addAction(p_whatsThis);
44  menu->addAction(p_aboutProgram);
45  }
46 
49  perm->addAction(p_whatsThis);
50  }
51 
52  // The user pressed the whatsThis button so do something
53  void HelpTool::whatsThis() {
54  QWhatsThis::enterWhatsThisMode();
55  }
56 
57 
64  PvlGroup &uig = Preference::Preferences().findGroup("UserInterface");
65 #if defined(__linux__)
66  QString command = (QString) uig["GuiHelpBrowser"] +
67  " http://isis.astrogeology.usgs.gov/Application/presentation/Tabbed/" +
68  QApplication::applicationName() + "/" +
69  QApplication::applicationName() + ".html";
70 #elif defined(__APPLE__)
71  QString command = "open -a" + (QString) uig["GuiHelpBrowser"] +
72  " http://isis.astrogeology.usgs.gov/Application/presentation/Tabbed/" +
73  QApplication::applicationName() + "/" +
74  QApplication::applicationName() + ".html";
75 #endif
77  }
78 }
QWidget
Isis::ProgramLauncher::RunSystemCommand
static void RunSystemCommand(QString commandLine)
This runs arbitrary system commands.
Definition: ProgramLauncher.cpp:207
QMenu
QToolBar
Isis::HelpTool::aboutProgram
void aboutProgram()
Slot to print program information.
Definition: HelpTool.cpp:63
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::HelpTool::addToPermanent
void addToPermanent(QToolBar *perm)
Add actions to the permanent toolbar.
Definition: HelpTool.cpp:48
QAction
Isis::HelpTool::addTo
void addTo(QMenu *menu)
Definition: HelpTool.cpp:42
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16