DetailedApplicationController.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Cedric Seehausen (usdnr at kit dot edu)
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #pragma once
27 
32 #include "../gui/detailedapplicationview.h"
33 #include "../gui/createpropertyview.h"
34 #include "../gui/scenarioitem.h"
35 #include "../gui/scenariolistview.h"
36 
39 #include <QObject>
40 #include <memory>
41 #include <vector>
42 
44 {
45  /**
46  * @class DetailedApplicationController
47  * @ingroup controller
48  * @brief This Controller manages the signals and model of the DetailedApplicationView.
49  * This controller gets notified by the ScenarioListController when a scenario or application
50  * gets selected and displays it. It also starts and stops applications and scenarios using the Executor.
51  */
52  class DetailedApplicationController : public QObject
53  {
54  Q_OBJECT
55  public:
56  /**
57  * Constructor that optionally sets the parent object.
58  * @parent standard QT option to specify a parent
59  */
60  DetailedApplicationController(Exec::ExecutorPtr executor, QObject* parent = 0);
61 
62  /**
63  * Destructor.
64  */
66 
67  /**
68  * Sets the view this controller manages.
69  */
71 
72  public slots:
73  /**
74  * Shows an ApplicationInstance in the DetailedApplicationView.
75  * @param application ApplicationInstance to show
76  */
78 
79  /**
80  * Shows an Application in the DetailedApplicationView.
81  * @param application Application to show
82  */
84 
85  /**
86  * Shows a Scenario in the DetailedApplicationView.
87  * @param scenario Scenario to show
88  */
90 
91  /**
92  * Shows a Package in the DetailedApplicationView.
93  * @param package Package to show
94  */
96 
97  /**
98  * Shows the configuration of the current ApplicationInstance in the standard editor.
99  */
100  void showInStandardEditor();
101 
102  /**
103  * Sets a property of the current ApplicationInstance.
104  * @param name key of the property
105  * @param value new value of the property
106  */
107  void setProperty(std::string name, std::string value);
108 
109  /**
110  * Starts the current ApplicationInstance.
111  */
112  void start();
113 
114  /**
115  * Stops the current ApplicationInstance.
116  */
117  void stop();
118 
119  /**
120  * Saves the configuration of the current ApplicationInstance to the config file.
121  */
122  void save();
123 
124  /**
125  * Deletes a property off the configuration file of the current ApplicationInstance.
126  * @param name name of the property to be deleted
127  */
128  void deleteProperty(std::string name);
129 
130  void showPropertyAddView();
131 
132 
133  /**
134  * @brief Set an IceAdmin for the controller. Needet to start an application via ice
135  * @param IceGrid::AdminPrx
136  */
137  void setIceAdmin(IceGrid::AdminPrx iceAdmin);
138  private:
139  void startScenario(ScenarioManager::Data_Structure::ScenarioPtr scenarioItem);
140  void showWarningDialog(QString message);
141 
142  private:
143  Exec::ExecutorPtr executor;
144 
145  bool showingStartable;
146  Data_Structure::ApplicationInstancePtr currentApplication;
147  Data_Structure::ScenarioPtr currentScenario;
149  CreatePropertyView propertyAdderView;
150  IceGrid::AdminPrx iceAdmin;
151  };
152 }
153 
154 
ScenarioItem
TreeItem representing data contained in a Scenario or an Application.
Definition: scenarioitem.h:38
ScenarioManager::Data_Structure::ApplicationInstancePtr
std::shared_ptr< ApplicationInstance > ApplicationInstancePtr
Definition: ApplicationInstance.h:33
ScenarioManager::Data_Structure::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Definition: Scenario.h:36
Scenario.h
ScenarioManager::Controller::DetailedApplicationController::~DetailedApplicationController
~DetailedApplicationController() override
Destructor.
Definition: DetailedApplicationController.cpp:59
ScenarioManager::Data_Structure::ApplicationPtr
std::shared_ptr< Application > ApplicationPtr
Definition: Application.h:119
ScenarioManager::Controller
Definition: ApplicationDatabaseController.h:39
ScenarioManager::Controller::DetailedApplicationController::DetailedApplicationController
DetailedApplicationController(Exec::ExecutorPtr executor, QObject *parent=0)
Constructor that optionally sets the parent object.
Definition: DetailedApplicationController.cpp:49
message
message(STATUS "Boost-Library-Dir: " "${Boost_LIBRARY_DIRS}") message(STATUS "Boost-LIBRARIES
Definition: CMakeLists.txt:8
ScenarioManager::Exec::ExecutorPtr
std::shared_ptr< Executor > ExecutorPtr
Definition: Executor.h:164
ScenarioManager::Controller::DetailedApplicationController::save
void save()
Saves the configuration of the current ApplicationInstance to the config file.
Definition: DetailedApplicationController.cpp:262
ScenarioManager::Controller::DetailedApplicationController::setProperty
void setProperty(std::string name, std::string value)
Sets a property of the current ApplicationInstance.
Definition: DetailedApplicationController.cpp:155
CreatePropertyView
Definition: createpropertyview.h:37
ScenarioManager::Controller::DetailedApplicationController::showPackage
void showPackage(Data_Structure::PackagePtr package)
Shows a Package in the DetailedApplicationView.
Definition: DetailedApplicationController.cpp:124
ScenarioManager::Controller::DetailedApplicationController::showPropertyAddView
void showPropertyAddView()
Definition: DetailedApplicationController.cpp:293
Package.h
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
ScenarioManager::Data_Structure::PackagePtr
std::shared_ptr< Package > PackagePtr
Definition: Package.h:121
ScenarioManager::Controller::DetailedApplicationController::deleteProperty
void deleteProperty(std::string name)
Deletes a property off the configuration file of the current ApplicationInstance.
Definition: DetailedApplicationController.cpp:288
Executor.h
ScenarioManager::Controller::DetailedApplicationController::setDetailedApplicationView
void setDetailedApplicationView(DetailedApplicationView *ptr)
Sets the view this controller manages.
Definition: DetailedApplicationController.cpp:64
IceManager.h
ScenarioManager::Controller::DetailedApplicationController::showApplication
void showApplication(Data_Structure::ApplicationPtr application)
Shows an Application in the DetailedApplicationView.
Definition: DetailedApplicationController.cpp:89
IceGridAdmin.h
ScenarioManager::Controller::DetailedApplicationController::setIceAdmin
void setIceAdmin(IceGrid::AdminPrx iceAdmin)
Set an IceAdmin for the controller.
Definition: DetailedApplicationController.cpp:307
ScenarioManager::Controller::DetailedApplicationController
This Controller manages the signals and model of the DetailedApplicationView. This controller gets no...
Definition: DetailedApplicationController.h:52
ApplicationInstance.h
ScenarioManager::Controller::DetailedApplicationController::showInStandardEditor
void showInStandardEditor()
Shows the configuration of the current ApplicationInstance in the standard editor.
Definition: DetailedApplicationController.cpp:137
ScenarioManager::Controller::DetailedApplicationController::stop
void stop()
Stops the current ApplicationInstance.
Definition: DetailedApplicationController.cpp:246
DetailedApplicationView
View that shows detailed information about a Scenario, Package or Application. Shows status and param...
Definition: detailedapplicationview.h:52
ScenarioManager::Controller::DetailedApplicationController::start
void start()
Starts the current ApplicationInstance.
Definition: DetailedApplicationController.cpp:177
ScenarioManager::Controller::DetailedApplicationController::showScenario
void showScenario(Data_Structure::ScenarioPtr scenario)
Shows a Scenario in the DetailedApplicationView.
Definition: DetailedApplicationController.cpp:108
ScenarioManager::Controller::DetailedApplicationController::showApplicationInstance
void showApplicationInstance(Data_Structure::ApplicationInstancePtr application, ScenarioItem *item)
Shows an ApplicationInstance in the DetailedApplicationView.
Definition: DetailedApplicationController.cpp:70