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 #include <string>
27 
28 #include <QApplication>
29 
31 
33 #include <ArmarXGui/applications/ArmarXGui/Widgets/ui_ExceptionDialog.h>
34 
35 #include <Inventor/Qt/SoQt.h>
36 
37 namespace armarx
38 {
39  using QApplicationPtr = std::shared_ptr<QApplication>;
40  using GuiWindowPtr = std::shared_ptr<ArmarXMainWindow>;
41 
42  /**
43  * ArmarXGuiApp property definition container.
44  */
46  {
47  public:
49  };
50 
51  class ArmarXQApplication : public QApplication
52  {
53  Q_OBJECT
54  public:
55  ArmarXQApplication(int& argc, char** argv);
56  ~ArmarXQApplication() override;
57  // QCoreApplication interface
58  bool notify(QObject* obj, QEvent* ev) override;
59  signals:
60  void exceptionCaught(QString exceptionReason);
61 
62  public slots:
63  void showException(QString exceptionReason);
64 
65  protected:
66  QDialog exceptionDialog;
67  Ui_ExceptionDialog exceptionDialogHandler;
68  };
69 
70  /**
71  \class ArmarXGuiApp
72  \brief The main ArmarX gui application.
73 
74  Instantiates an armarx::GuiWindow with the following functionality
75  \li Gui config saving and loading.
76  \li Wraps Qt-based plugin mechanism for gui plugin loading.
77  \li Offers an SoQt examiner viewer for rendering 3d data. One ore multiple sources can be handled.
78 
79  */
81  public QObject,
82  virtual public armarx::Application,
83  virtual public Logging
84  {
85  Q_OBJECT
86  public:
87  static int globalargc;
88  /**
89  * Constructs and initialized an ArmarXGuiApp
90  */
91  ArmarXGuiApp(int& argc = ArmarXGuiApp::globalargc, char** argv = NULL);
92  ~ArmarXGuiApp() override;
93 
94  /**
95  * Configures the app, sets Qt up
96  */
97  void setup(const ManagedIceObjectRegistryInterfacePtr& registry,
98  Ice::PropertiesPtr properties) override;
99 
100  int run(int argc, char* argv[]) override;
101  /**
102  * Runs the Qt Event Loop
103  */
104  int exec(const ArmarXManagerPtr& armarXManager) override;
105 
106  /**
107  * @see PropertyUser::createPropertyDefinitions()
108  */
111  {
113  new ArmarXGuiAppPropertyDefinitions(getDomainName()));
114  }
115 
116  private slots:
117  void closeRequest_sent();
118 
119  private:
120  static std::string makeName();
121  void runArmarXManager();
122  int startArmarX();
123 
124  private:
125  RunningTask<ArmarXGuiApp>::pointer_type armarxManagerTask;
126  ArmarXQApplication* qApplication;
127  ArmarXMainWindow* mainWindow;
129 
130  int argc;
131  char** argv;
132  };
133 } // namespace armarx
armarx::ArmarXQApplication::ArmarXQApplication
ArmarXQApplication(int &argc, char **argv)
Definition: ArmarXGuiApp.cpp:325
armarx::QApplicationPtr
std::shared_ptr< QApplication > QApplicationPtr
Definition: ArmarXGuiApp.h:39
armarx::ArmarXMainWindow
The ArmarXMainWindow class.
Definition: ArmarXMainWindow.h:76
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:45
armarx::ArmarXGuiApp
The main ArmarX gui application.
Definition: ArmarXGuiApp.h:80
IceInternal::Handle< ::Ice::Properties >
armarx::ArmarXQApplication::exceptionCaught
void exceptionCaught(QString exceptionReason)
armarx::GuiWindowPtr
std::shared_ptr< ArmarXMainWindow > GuiWindowPtr
Definition: ArmarXGuiApp.h:40
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:51
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
armarx::ArmarXGuiApp::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ArmarXGuiApp.h:110
IceUtil::Handle< ManagedIceObjectRegistryInterface >
armarx::ArmarXGuiApp::globalargc
static int globalargc
Definition: ArmarXGuiApp.h:87
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:66
armarx::ArmarXQApplication::exceptionDialogHandler
Ui_ExceptionDialog exceptionDialogHandler
Definition: ArmarXGuiApp.h:67
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h