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;
81 executor->loadAndSetCachedProperties(
84 view->setVisible(
true);
85 view->showApplicationInstance(application, item);
92 if (application.get() ==
nullptr)
96 showingStartable =
false;
103 view->setVisible(
true);
104 view->showApplication(app);
110 if (scenario.get() ==
nullptr)
114 showingStartable =
true;
116 currentScenario = scenario;
118 scenario->reloadGlobalConf();
119 view->setVisible(
true);
120 view->showScenario(scenario);
126 if (package.get() ==
nullptr)
130 showingStartable =
false;
133 view->showPackage(package);
139 if (showingStartable)
141 std::string url =
"file://";
142 if (currentApplication.get() !=
nullptr)
144 url.append(currentApplication->getConfigPath());
146 else if (currentScenario.get() !=
nullptr)
148 url.append(currentScenario->getGlobalConfigPath());
150 QDesktopServices::openUrl(QUrl(url.c_str()));
157 if (showingStartable)
159 if (currentApplication.get() !=
nullptr)
161 currentApplication->addProperty(name, value);
162 currentApplication->save();
165 else if (currentScenario.get() !=
nullptr)
167 currentScenario->getGlobalConfig()->defineOptionalProperty<std::string>(
168 name,
"::NOT_DEFINED::",
"Custom Property");
169 currentScenario->getGlobalConfig()->getProperties()->setProperty(name, value);
170 currentScenario->save();
179 if (showingStartable)
181 if (currentApplication.get() !=
nullptr)
183 executor->startApplication(currentApplication);
185 else if (currentScenario.get() !=
nullptr)
189 startScenario(currentScenario);
191 catch (IceGrid::ServerStartException& ex)
193 showWarningDialog(
"Ice had an launching error. Please make sure your remote launch "
194 "settings are correct");
201DetailedApplicationController::startScenario(
ScenarioPtr scenario)
248 if (showingStartable)
250 if (currentApplication.get() !=
nullptr)
252 executor->stopApplication(currentApplication);
254 else if (currentScenario.get() !=
nullptr)
256 executor->stopScenario(currentScenario);
264 if (showingStartable)
266 if (currentApplication.get() !=
nullptr)
268 currentApplication->save();
269 executor->restartApplication(currentApplication);
271 else if (currentScenario.get() !=
nullptr)
273 currentScenario->save();
276 executor->restartScenario(currentScenario);
278 catch (IceGrid::ServerStartException& ex)
280 showWarningDialog(
"Ice had an launching error. Please make sure your remote launch "
281 "settings are correct");
295 propertyAdderView.exec();
299DetailedApplicationController::showWarningDialog(QString message)
302 box.setText(message);
309 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