ArmarXGuiApp.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::Component::ArmarXGui
17 * @author David Ruscheweyh (david.ruscheweyh at student.kit dot edu)
18 * @author Kai Welke (welke at kit dot edu)
19 * @copyright 2011 Humanoids Group, HIS, KIT
20 * @license http://www.gnu.org/licenses/gpl-2.0.txt
21 * GNU General Public License
22 */
23 
24 #pragma once
25 
26 // ArmarX
27 
29 #include <ArmarXGui/applications/ArmarXGui/Widgets/ui_ExceptionDialog.h>
30 
31 //SoQt
32 #include <Inventor/Qt/SoQt.h>
33 
34 //Qt
35 #include <QApplication>
36 
37 #include "ArmarXMainWindow.h"
38 
39 #include <string>
40 
41 
42 
43 namespace armarx
44 {
45  using QApplicationPtr = std::shared_ptr<QApplication>;
46  using GuiWindowPtr = std::shared_ptr<ArmarXMainWindow>;
47 
48  /**
49  * ArmarXGuiApp property definition container.
50  */
53  {
54  public:
56  };
57 
58 
60  public QApplication
61  {
62  Q_OBJECT
63  public:
64  ArmarXQApplication(int& argc, char** argv);
65  ~ArmarXQApplication() override;
66  // QCoreApplication interface
67  bool notify(QObject* obj, QEvent* ev) override;
68  signals:
69  void exceptionCaught(QString exceptionReason);
70 
71  public slots:
72  void showException(QString exceptionReason);
73  protected:
74  QDialog exceptionDialog;
75  Ui_ExceptionDialog exceptionDialogHandler;
76  };
77 
78 
79  /**
80  \class ArmarXGuiApp
81  \brief The main ArmarX gui application.
82 
83  Instantiates an armarx::GuiWindow with the following functionality
84  \li Gui config saving and loading.
85  \li Wraps Qt-based plugin mechanism for gui plugin loading.
86  \li Offers an SoQt examiner viewer for rendering 3d data. One ore multiple sources can be handled.
87 
88  */
90  public QObject,
91  virtual public armarx::Application,
92  virtual public Logging
93  {
94  Q_OBJECT
95  public:
96  static int globalargc;
97  /**
98  * Constructs and initialized an ArmarXGuiApp
99  */
100  ArmarXGuiApp(int& argc = ArmarXGuiApp::globalargc, char** argv = NULL);
101  ~ArmarXGuiApp() override;
102 
103  /**
104  * Configures the app, sets Qt up
105  */
106  void setup(const ManagedIceObjectRegistryInterfacePtr& registry, Ice::PropertiesPtr properties) override;
107 
108  int run(int argc, char* argv[]) override;
109  /**
110  * Runs the Qt Event Loop
111  */
112  int exec(const ArmarXManagerPtr& armarXManager) override;
113 
114  /**
115  * @see PropertyUser::createPropertyDefinitions()
116  */
118  {
120  }
121 
122  private slots:
123  void closeRequest_sent();
124 
125  private:
126  static std::string makeName();
127  void runArmarXManager();
128  int startArmarX();
129 
130  private:
131  RunningTask<ArmarXGuiApp>::pointer_type armarxManagerTask;
132  ArmarXQApplication* qApplication;
133  ArmarXMainWindow* mainWindow;
135 
136  int argc;
137  char** argv;
138  };
139 }
140 
armarx::ArmarXQApplication::ArmarXQApplication
ArmarXQApplication(int &argc, char **argv)
Definition: ArmarXGuiApp.cpp:325
armarx::QApplicationPtr
std::shared_ptr< QApplication > QApplicationPtr
Definition: ArmarXGuiApp.h:45
armarx::ArmarXMainWindow
The ArmarXMainWindow class.
Definition: ArmarXMainWindow.h:80
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
armarx::ArmarXGuiAppPropertyDefinitions
ArmarXGuiApp property definition container.
Definition: ArmarXGuiApp.h:51
armarx::ArmarXGuiApp
The main ArmarX gui application.
Definition: ArmarXGuiApp.h:89
IceInternal::Handle< ::Ice::Properties >
armarx::ArmarXQApplication::exceptionCaught
void exceptionCaught(QString exceptionReason)
armarx::GuiWindowPtr
std::shared_ptr< ArmarXMainWindow > GuiWindowPtr
Definition: ArmarXGuiApp.h:46
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
ArmarXMainWindow.h
armarx::ArmarXGuiAppPropertyDefinitions::ArmarXGuiAppPropertyDefinitions
ArmarXGuiAppPropertyDefinitions(std::string prefix)
Definition: ArmarXGuiApp.cpp:46
armarx::ArmarXQApplication::~ArmarXQApplication
~ArmarXQApplication() override
Definition: ArmarXGuiApp.cpp:360
armarx::ArmarXQApplication::notify
bool notify(QObject *obj, QEvent *ev) override
Definition: ArmarXGuiApp.cpp:282
armarx::Application
Baseclass for all ArmarX applications.
Definition: Application.h:193
armarx::ApplicationPropertyDefinitions
Application property definition container.
Definition: Application.h:101
armarx::ArmarXQApplication
Definition: ArmarXGuiApp.h:59
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
armarx::ArmarXGuiApp::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ArmarXGuiApp.h:117
IceUtil::Handle< ManagedIceObjectRegistryInterface >
armarx::ArmarXGuiApp::globalargc
static int globalargc
Definition: ArmarXGuiApp.h:96
armarx::ArmarXQApplication::showException
void showException(QString exceptionReason)
Definition: ArmarXGuiApp.cpp:299
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
armarx::ArmarXQApplication::exceptionDialog
QDialog exceptionDialog
Definition: ArmarXGuiApp.h:74
armarx::ArmarXQApplication::exceptionDialogHandler
Ui_ExceptionDialog exceptionDialogHandler
Definition: ArmarXGuiApp.h:75
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h