diff --git a/data/ArmarXGui/armarx_logo.svg b/data/ArmarXGui/armarx_logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..2c96bf216c3fae79db63061f69e8efc5a8b080b3 --- /dev/null +++ b/data/ArmarXGui/armarx_logo.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" standalone="yes"?> + +<svg version="1.1" viewBox="0.0 0.0 64.0 64.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="p.0"><path d="m0 0l64.0 0l0 64.0l-64.0 0l0 -64.0z" clip-rule="nonzero"></path></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l64.0 0l0 64.0l-64.0 0z" fill-rule="nonzero"></path><path fill="#073763" d="m0.003555643 10.670436l0 0c0 -5.8911552 4.775725 -10.666881 10.666881 -10.666881l42.666237 0l0 0c2.829033 0 5.542198 1.1238288 7.5426254 3.1242568c2.0004272 2.0004282 3.1242561 4.7135906 3.1242561 7.5426235l0 42.666237c0 5.8911552 -4.7757263 10.666882 -10.666882 10.666882l-42.666237 0c-5.8911552 0 -10.666881 -4.7757263 -10.666881 -10.666882z" fill-rule="nonzero"></path><path fill="#000000" fill-opacity="0.0" d="m6.997333 -11.084444l62.582676 0l0 53.66929l-62.582676 0z" fill-rule="nonzero"></path><path fill="#ffffff" d="m51.95046 52.075554l-9.953125 0l-3.65625 -10.765625l-14.921875 0l-3.59375 10.765625l-9.703126 0l15.125001 -40.890625l11.96875 0l14.734375 40.890625zm-15.75 -17.328125l-5.15625 -15.374998l-0.25 0l-5.171875 15.374998l10.578125 0z" fill-rule="nonzero"></path><path fill="#000000" fill-opacity="0.0" d="m35.54933 -4.750222l61.70079 0l0 61.259842l-61.70079 0z" fill-rule="nonzero"></path><path fill="#9fc5e8" d="m56.58058 23.849775l-4.875 0l-4.0 -6.203125l-4.03125 6.203125l-4.859375 0l6.453125 -8.937499l-6.171875 -8.578125l4.859375 0l3.75 5.828125l3.71875 -5.828125l4.859375 0l-6.171875 8.578125l6.46875 8.937499z" fill-rule="nonzero"></path></g></svg> + diff --git a/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp b/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp index 88c6e5ab1202fc74fcc530e615d3ad53d1ba6677..7baf7902361767cd0d471dc0122d7f423f751d65 100644 --- a/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp +++ b/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp @@ -23,16 +23,20 @@ #include "ArmarXGuiApp.h" +#include <iostream> +#include <optional> + +#include <QHostInfo> #include <QListWidget> #include <QMessageBox> -#include <QTime> #include <QTextCodec> -#include <iostream> +#include <QTime> -#include <ArmarXCore/util/CPPUtility/trace.h> -#include <ArmarXCore/core/util/StringHelpers.h> +#include <SimoxUtility/algorithm/string/string_tools.h> -#include <IceUtil/UUID.h> +#include <ArmarXCore/core/util/StringHelpers.h> +#include <ArmarXCore/core/time/DateTime.h> +#include <ArmarXCore/util/CPPUtility/trace.h> #include <SimoxUtility/algorithm/string.h> @@ -42,11 +46,21 @@ namespace armarx int ArmarXGuiApp::globalargc = 0; + ArmarXGuiAppPropertyDefinitions::ArmarXGuiAppPropertyDefinitions(std::string prefix) : + ApplicationPropertyDefinitions(prefix) + { + defineOptionalProperty<std::string>( + "LoadPlugins", "", "List of paths to GuiPlugin-Libs (semi-colon seperated)"); + defineOptionalProperty<std::string>( + "GuiConfigFile", "", "Path to config file, that should be loaded on startup"); + defineOptionalProperty<bool>( + "DisablePreloading", false, "Disables the preloading of widgets. Can be helpful if some preloaded widget crashes the gui."); + } + + ArmarXGuiApp::ArmarXGuiApp(int& argc, char** argv) : - qApplication(nullptr) + qApplication(nullptr), argc(argc), argv(argv) { - this->argc = 0; - this->argv = 0; qApplication = new ArmarXQApplication(argc, argv); // Set text encoding to UTF-8 (otherwise, umlauts display wrongly in, e.g., the log viewer) @@ -80,7 +94,7 @@ namespace armarx return 1; } } - setName("ArmarXGui-" + std::to_string(IceUtil::Time::now().toMilliSeconds())); + setName(makeName()); return armarx::Application::run(argc, argv); } @@ -108,7 +122,7 @@ namespace armarx { // init SoDB and Qt, SoQt::init also creates an application object SoDB::init(); - SoQt::init(argc, argv, "ArmarXGuiApp"); + SoQt::init(argc, argv, "ArmarXGuiApp*1123"); // enable Coin3D extension: transparent settings without color (void)coin_setenv("COIN_SEPARATE_DIFFUSE_TRANSPARENCY_OVERRIDE", "1", TRUE); @@ -220,6 +234,42 @@ namespace armarx } + static QString getUserName() + { + QString username = qgetenv("USER"); + if (username.isEmpty()) + { + username = qgetenv("USERNAME"); + } + return username; + } + + + static QString getUserNameAtHostName() + { + const QString hostname = QHostInfo::localHostName(); + QString user = getUserName(); + if (user.isEmpty()) + { + return hostname; + } + else + { + return user + "@" + hostname; + } + } + + std::string ArmarXGuiApp::makeName() + { + std::vector<std::string> items { "ArmarXGui" }; + items.push_back(getUserNameAtHostName().toStdString()); + items.push_back(DateTime::Now().toDateTimeString()); + + std::string name = simox::alg::join(items, "_"); + + return name; + } + bool ArmarXQApplication::notify(QObject* obj, QEvent* ev) { @@ -266,8 +316,12 @@ namespace armarx ArmarXQApplication::ArmarXQApplication(int& argc, char** argv) : QApplication(argc, argv) { - connect(this, SIGNAL(exceptionCaught(QString)), this, SLOT(showException(QString)), Qt::QueuedConnection); + const auto guiWindowBaseName = QString{"ArmarX"} + " @ " + QHostInfo::localHostName(); + setApplicationName(guiWindowBaseName); + + setApplicationDisplayName(getUserNameAtHostName()); + connect(this, SIGNAL(exceptionCaught(QString)), this, SLOT(showException(QString)), Qt::QueuedConnection); exceptionDialogHandler.setupUi(&exceptionDialog); QListWidget* list = exceptionDialogHandler.listWidgetExceptions; connect(exceptionDialogHandler.pushButtonClearHistory, SIGNAL(clicked()), list, SLOT(clear()), Qt::QueuedConnection); @@ -276,4 +330,5 @@ namespace armarx ArmarXQApplication::~ArmarXQApplication() { } + } diff --git a/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.h b/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.h index dd462eb45fec80dacc17c63b8eaaff1efe7becce..99998cb83406455e91d4060e5b393ce40f11afce 100644 --- a/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.h +++ b/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.h @@ -52,15 +52,10 @@ namespace armarx public ApplicationPropertyDefinitions { public: - ArmarXGuiAppPropertyDefinitions(std::string prefix): - ApplicationPropertyDefinitions(prefix) - { - defineOptionalProperty<std::string>("LoadPlugins", "", "List of paths to GuiPlugin-Libs (semi-colon seperated)"); - defineOptionalProperty<std::string>("GuiConfigFile", "", "Path to config file, that should be loaded on startup"); - defineOptionalProperty<bool>("DisablePreloading", false, "Disables the preloading of widgets. Can be helpful if some preloaded widget crashes the gui."); - } + ArmarXGuiAppPropertyDefinitions(std::string prefix); }; + class ArmarXQApplication : public QApplication { @@ -128,9 +123,11 @@ namespace armarx void closeRequest_sent(); private: + static std::string makeName(); void runArmarXManager(); int startArmarX(); + private: RunningTask<ArmarXGuiApp>::pointer_type armarxManagerTask; ArmarXQApplication* qApplication; ArmarXMainWindow* mainWindow; diff --git a/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp b/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp index 69f055f7cdf724c2248f5b7d1ab5b09dbb9c26de..a05ba04db506da2da1fd01f4e3fd4b5fd31fc236 100644 --- a/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp +++ b/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp @@ -104,7 +104,7 @@ #define ARMARX_ORGANIZATION "KIT" -#define ARMARX_GUI_APPLICATION_NAME "ArmarXGUI" +#define ARMARX_GUI_APPLICATION_NAME "ArmarX" #define CONFIG_LOAD_LAST_CONFIG "LoadLastConfig" #define CONFIG_BLACKLISTED_TIPS "BlacklistedTips" @@ -147,7 +147,7 @@ namespace armarx username = qgetenv("USERNAME"); } - guiWindowBaseName = QString{ARMARX_GUI_APPLICATION_NAME} + " [" + username + "@" + QHostInfo::localHostName() + "]"; + guiWindowBaseName = QString{ARMARX_GUI_APPLICATION_NAME}; setWindowTitle(guiWindowBaseName); this->registry = registry; setAttribute(Qt::WA_QuitOnClose); diff --git a/source/ArmarXGui/applications/ArmarXGui/main.cpp b/source/ArmarXGui/applications/ArmarXGui/main.cpp index c53a1b8dbf21edd61ab2a4d163cedcbbf1932183..ab2248a114a3a6d814644e3e59f04a96ce4c691c 100644 --- a/source/ArmarXGui/applications/ArmarXGui/main.cpp +++ b/source/ArmarXGui/applications/ArmarXGui/main.cpp @@ -28,9 +28,8 @@ int main(int argc, char* argv[]) { - armarx::ApplicationPtr app = armarx::Application::createInstance<armarx::ArmarXGuiApp>(); + armarx::ApplicationPtr app = armarx::Application::createInstance<armarx::ArmarXGuiApp>(argc, argv); app->setName("ArmarXGui"); - if (argc > 1) { if (std::filesystem::exists(argv[1])) @@ -41,6 +40,5 @@ int main(int argc, char* argv[]) strcpy(argv[1], configProp.c_str()); } } - return app->main(argc, argv); }