33 #include <QDesktopServices>
35 #include <QMessageBox>
41 using namespace Controller;
43 using namespace Data_Structure;
47 QObject::connect(&propertyAdderView, SIGNAL(create(std::string, std::string)),
50 QObject::connect(&iceEnvVariableAddView, SIGNAL(create(std::string, std::string)),
65 if (application.get() ==
nullptr)
69 showingStartable =
true;
70 currentApplication = application;
75 view->setVisible(
true);
81 if (application.get() ==
nullptr)
85 showingStartable =
false;
91 view->setVisible(
true);
97 if (scenario.get() ==
nullptr)
101 showingStartable =
true;
103 currentScenario = scenario;
105 view->setVisible(
true);
111 if (package.get() ==
nullptr)
115 showingStartable =
false;
123 if (showingStartable)
125 std::string url =
"file://";
126 if (currentApplication.get() !=
nullptr)
128 url.append(currentApplication->getConfigPath());
130 else if (currentScenario.get() !=
nullptr)
132 url.append(currentScenario->getGlobalConfigPath());
134 QDesktopServices::openUrl(QUrl(url.c_str()));
140 if (showingStartable)
142 if (currentApplication.get() !=
nullptr)
144 currentApplication->addProperty(name,
value);
145 currentApplication->save();
148 else if (currentScenario.get() !=
nullptr)
150 currentScenario->getGlobalConfig()->defineOptionalProperty<std::string>(name,
"::NOT_DEFINED::",
"Custom Property");
151 currentScenario->getGlobalConfig()->getProperties()->setProperty(name,
value);
152 currentScenario->save();
160 if (currentScenario.get() !=
nullptr)
162 currentScenario->addIceEnviromentVariable(name,
value);
163 currentScenario->save();
170 if (showingStartable)
172 if (currentApplication.get() !=
nullptr)
174 executor->startApplication(currentApplication);
176 else if (currentScenario.get() !=
nullptr)
180 startScenario(currentScenario);
182 catch (IceGrid::ServerStartException& ex)
184 showWarningDialog(
"Ice had an launching error. Please make sure your remote launch settings are correct");
190 void DetailedApplicationController::startScenario(
ScenarioPtr scenario)
238 if (showingStartable)
240 if (currentApplication.get() !=
nullptr)
242 executor->stopApplication(currentApplication);
244 else if (currentScenario.get() !=
nullptr)
248 executor->stopScenario(currentScenario);
252 executor->removeScenario(currentScenario);
260 if (showingStartable)
262 if (currentApplication.get() !=
nullptr)
264 currentApplication->save();
265 executor->restartApplication(currentApplication);
267 else if (currentScenario.get() !=
nullptr)
269 currentScenario->save();
272 executor->restartScenario(currentScenario);
274 catch (IceGrid::ServerStartException& ex)
276 showWarningDialog(
"Ice had an launching error. Please make sure your remote launch settings are correct");
289 propertyAdderView.exec();
294 iceEnvVariableAddView.exec();
297 void DetailedApplicationController::showWarningDialog(QString
message)
306 this->iceAdmin = iceAdmin;