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
37namespace armarx
38{
39 using QApplicationPtr = std::shared_ptr<QApplication>;
40 using GuiWindowPtr = std::shared_ptr<ArmarXMainWindow>;
41
42 /**
43 * ArmarXGuiApp property definition container.
44 */
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:
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 */
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 */
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:
126 ArmarXQApplication* qApplication;
127 ArmarXMainWindow* mainWindow;
129
130 int argc;
131 char** argv;
132 };
133} // namespace armarx
#define ARMARXCOMPONENT_IMPORT_EXPORT
ApplicationPropertyDefinitions(std::string prefix)
Baseclass for all ArmarX applications.
virtual std::string getDomainName()
Retrieve the domain name used for property parsing.
ArmarXGuiApp property definition container.
ArmarXGuiAppPropertyDefinitions(std::string prefix)
void setup(const ManagedIceObjectRegistryInterfacePtr &registry, Ice::PropertiesPtr properties) override
Configures the app, sets Qt up.
int run(int argc, char *argv[]) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
ArmarXGuiApp(int &argc=ArmarXGuiApp::globalargc, char **argv=NULL)
Constructs and initialized an ArmarXGuiApp.
int exec(const ArmarXManagerPtr &armarXManager) override
Runs the Qt Event Loop.
The ArmarXMainWindow class.
Ui_ExceptionDialog exceptionDialogHandler
ArmarXQApplication(int &argc, char **argv)
bool notify(QObject *obj, QEvent *ev) override
void exceptionCaught(QString exceptionReason)
void showException(QString exceptionReason)
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
::IceInternal::Handle<::Ice::Properties > PropertiesPtr
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< ArmarXManager > ArmarXManagerPtr
IceUtil::Handle< ManagedIceObjectRegistryInterface > ManagedIceObjectRegistryInterfacePtr
Definition Application.h:83
std::shared_ptr< ArmarXMainWindow > GuiWindowPtr
std::shared_ptr< QApplication > QApplicationPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.