31#include <QDesktopServices>
51 QObject(parent), executor(executor), showingStartable(false)
53 QObject::connect(&propertyAdderView,
54 SIGNAL(create(std::string, std::string)),
73 if (application.get() ==
nullptr)
77 showingStartable =
true;
78 currentApplication = application;
84 executor->loadAndSetCachedProperties(
87 view->setVisible(
true);
88 view->showApplicationInstance(application, item);
95 if (application.get() ==
nullptr)
99 showingStartable =
false;
106 view->setVisible(
true);
107 view->showApplication(app);
113 if (scenario.get() ==
nullptr)
117 showingStartable =
true;
119 currentScenario = scenario;
121 scenario->reloadGlobalConf();
122 view->setVisible(
true);
123 view->showScenario(scenario);
129 if (package.get() ==
nullptr)
133 showingStartable =
false;
136 view->showPackage(package);
142 if (showingStartable)
144 std::string url =
"file://";
145 if (currentApplication.get() !=
nullptr)
147 url.append(currentApplication->getConfigPath());
149 else if (currentScenario.get() !=
nullptr)
151 url.append(currentScenario->getGlobalConfigPath());
153 QDesktopServices::openUrl(QUrl(url.c_str()));
160 if (showingStartable)
162 if (currentApplication.get() !=
nullptr)
164 currentApplication->addProperty(name, value);
165 currentApplication->save();
168 else if (currentScenario.get() !=
nullptr)
170 currentScenario->getGlobalConfig()->defineOptionalProperty<std::string>(
171 name,
"::NOT_DEFINED::",
"Custom Property");
172 currentScenario->getGlobalConfig()->getProperties()->setProperty(name, value);
173 currentScenario->save();
182 if (showingStartable)
184 if (currentApplication.get() !=
nullptr)
186 executor->startApplication(currentApplication);
188 else if (currentScenario.get() !=
nullptr)
192 startScenario(currentScenario);
194 catch (IceGrid::ServerStartException& ex)
196 showWarningDialog(
"Ice had an launching error. Please make sure your remote launch "
197 "settings are correct");
204DetailedApplicationController::startScenario(
ScenarioPtr scenario)
251 if (showingStartable)
253 if (currentApplication.get() !=
nullptr)
255 executor->stopApplication(currentApplication);
257 else if (currentScenario.get() !=
nullptr)
259 executor->stopScenario(currentScenario);
267 if (showingStartable)
269 if (currentApplication.get() !=
nullptr)
271 currentApplication->save();
272 executor->restartApplication(currentApplication);
274 else if (currentScenario.get() !=
nullptr)
276 currentScenario->save();
279 executor->restartScenario(currentScenario);
281 catch (IceGrid::ServerStartException& ex)
283 showWarningDialog(
"Ice had an launching error. Please make sure your remote launch "
284 "settings are correct");
298 propertyAdderView.exec();
302DetailedApplicationController::showWarningDialog(QString message)
305 box.setText(message);
312 this->iceAdmin = iceAdmin;
View that shows detailed information about a Scenario, Package or Application.
TreeItem representing data contained in a Scenario or an Application.
void showPropertyAddView()
void showApplication(Data_Structure::ApplicationPtr application)
Shows an Application in the DetailedApplicationView.
void showPackage(Data_Structure::PackagePtr package)
Shows a Package in the DetailedApplicationView.
void deleteProperty(std::string name)
Deletes a property off the configuration file of the current ApplicationInstance.
void setDetailedApplicationView(DetailedApplicationView *ptr)
Sets the view this controller manages.
DetailedApplicationController(Exec::ExecutorPtr executor, QObject *parent=0)
Constructor that optionally sets the parent object.
~DetailedApplicationController() override
Destructor.
void start()
Starts the current ApplicationInstance.
void setIceAdmin(IceGrid::AdminPrx iceAdmin)
Set an IceAdmin for the controller.
void stop()
Stops the current ApplicationInstance.
void showScenario(Data_Structure::ScenarioPtr scenario)
Shows a Scenario in the DetailedApplicationView.
void save()
Saves the configuration of the current ApplicationInstance to the config file.
void showInStandardEditor()
Shows the configuration of the current ApplicationInstance in the standard editor.
void setProperty(std::string name, std::string value)
Sets a property of the current ApplicationInstance.
void showApplicationInstance(Data_Structure::ApplicationInstancePtr application, ScenarioItem *item)
Shows an ApplicationInstance in the DetailedApplicationView.
static bool StartScenario(ScenarioManager::Data_Structure::ScenarioPtr scenario, Exec::ExecutorPtr executor, IceGrid::AdminPrx iceAdmin)
Class containing data about an application Provides methods to get and set the date contained in the ...
static std::string getCacheDir()
std::shared_ptr< Scenario > ScenarioPtr
std::shared_ptr< Application > ApplicationPtr
std::shared_ptr< Package > PackagePtr
std::shared_ptr< ApplicationInstance > ApplicationInstancePtr
std::shared_ptr< Executor > ExecutorPtr