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 
53  {
54  public:
57  {
58  defineOptionalProperty<std::string>("LoadPlugins", "", "List of paths to GuiPlugin-Libs (semi-colon seperated)");
59  defineOptionalProperty<std::string>("GuiConfigFile", "", "Path to config file, that should be loaded on startup");
60  defineOptionalProperty<bool>("DisablePreloading", false, "Disables the preloading of widgets. Can be helpful if some preloaded widget crashes the gui.");
61  }
62  };
63 
65  public QApplication
66  {
67  Q_OBJECT
68  public:
69  ArmarXQApplication(int& argc, char** argv);
70  ~ArmarXQApplication() override;
71  // QCoreApplication interface
72  bool notify(QObject* obj, QEvent* ev) override;
73  signals:
74  void exceptionCaught(QString exceptionReason);
75 
76  public slots:
77  void showException(QString exceptionReason);
78  protected:
79  QDialog exceptionDialog;
80  Ui_ExceptionDialog exceptionDialogHandler;
81  };
82 
83 
95  public QObject,
96  virtual public armarx::Application,
97  virtual public Logging
98  {
99  Q_OBJECT
100  public:
101  static int globalargc;
105  ArmarXGuiApp(int& argc = ArmarXGuiApp::globalargc, char** argv = NULL);
106  ~ArmarXGuiApp() override;
107 
111  void setup(const ManagedIceObjectRegistryInterfacePtr& registry, Ice::PropertiesPtr properties) override;
112 
113  int run(int argc, char* argv[]) override;
117  int exec(const ArmarXManagerPtr& armarXManager) override;
118 
123  {
125  }
126 
127  private slots:
128  void closeRequest_sent();
129 
130  private:
131  void runArmarXManager();
132  int startArmarX();
133 
134  RunningTask<ArmarXGuiApp>::pointer_type armarxManagerTask;
135  ArmarXQApplication* qApplication;
136  ArmarXMainWindow* mainWindow;
138 
139  int argc;
140  char** argv;
141  };
142 }
143 
armarx::ArmarXQApplication::ArmarXQApplication
ArmarXQApplication(int &argc, char **argv)
Definition: ArmarXGuiApp.cpp:245
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:94
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.h:55
armarx::ArmarXQApplication::~ArmarXQApplication
~ArmarXQApplication() override
Definition: ArmarXGuiApp.cpp:255
armarx::ArmarXQApplication::notify
bool notify(QObject *obj, QEvent *ev) override
Definition: ArmarXGuiApp.cpp:203
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:64
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
armarx::ArmarXGuiApp::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ArmarXGuiApp.h:122
IceUtil::Handle< ManagedIceObjectRegistryInterface >
armarx::ArmarXGuiApp::globalargc
static int globalargc
Definition: ArmarXGuiApp.h:101
armarx::ArmarXQApplication::showException
void showException(QString exceptionReason)
Definition: ArmarXGuiApp.cpp:219
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
armarx::ArmarXQApplication::exceptionDialog
QDialog exceptionDialog
Definition: ArmarXGuiApp.h:79
armarx::ArmarXQApplication::exceptionDialogHandler
Ui_ExceptionDialog exceptionDialogHandler
Definition: ArmarXGuiApp.h:80
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h