26 #include <QListWidget>
27 #include <QMessageBox>
35 #include <IceUtil/UUID.h>
51 QTextCodec::setCodecForLocale(QTextCodec::codecForName(
"UTF-8"));
61 this->registry = registry;
70 int result = startArmarX();
90 SoQt::init(argc, argv,
"ArmarXGuiApp");
93 (void)coin_setenv(
"COIN_SEPARATE_DIFFUSE_TRANSPARENCY_OVERRIDE",
"1", TRUE);
98 if (getProperty<std::string>(
"GuiConfigFile").isSet())
100 configToLoad = QString::fromStdString(getProperty<std::string>(
"GuiConfigFile").getValue());
104 mainWindow =
new ArmarXMainWindow(registry, packageNames, configToLoad, getProperty<bool>(
"DisablePreloading").getValue());
105 connect(mainWindow, SIGNAL(closeRequest()),
this, SLOT(closeRequest_sent()));
109 std::string
plugins = getProperty<std::string>(
"LoadPlugins").getValue();
110 std::vector<std::string> pluginList =
Split(
plugins,
",");
111 for (
auto iter = pluginList.begin(); iter != pluginList.end(); ++iter)
115 std::cout <<
"Loading plugin: " << iter->c_str() << std::endl;
120 std::cout <<
"Started ArmarXGui App" << std::endl;
123 armarxManagerTask->start();
129 int result = qApplication->exec();
134 armarXManager->waitForShutdown();
137 qApplication->quit();
147 void ArmarXGuiApp::closeRequest_sent()
151 void ArmarXGuiApp::runArmarXManager()
157 qApplication->quit();
161 int ArmarXGuiApp::startArmarX()
163 CMakePackageFinder finder(
"ArmarXCore");
166 if (finder.packageFound())
168 res = system(std::string(finder.getBinaryDir() + std::string(
"/armarx start")).c_str());
172 res = system(
"armarx start");
174 res = WEXITSTATUS(res);
175 if (res == EXIT_SUCCESS)
178 if (finder.packageFound())
180 res = system(std::string(finder.getBinaryDir() + std::string(
"/armarx memory start")).c_str());
184 res = system(
"armarx memory assureRunning");
186 res = WEXITSTATUS(res);
187 if (res == EXIT_FAILURE)
189 QMessageBox::warning(
nullptr,
"ArmarX Error",
"Could not start MongoDB! See terminal output for more information. The GUI will now started anyway.");
195 QMessageBox::critical(
nullptr,
"ArmarX Error",
"Could not start ArmarX! See terminal output for more information.");
207 return QApplication::notify(obj, ev);
209 catch (std::exception& e)
221 QStringList infos = exceptionReason.split(
"Backtrace:");
223 auto item =
new QListWidgetItem(
"[" + QTime::currentTime().
toString() +
"] " + infos.first().trimmed());
224 item->setToolTip(exceptionReason);
226 list->scrollToBottom();
246 QApplication(argc, argv)