From 51a4dda185ea8b06baf18a34699d5dbb265b8c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 12 Dec 2016 09:45:03 +0100 Subject: [PATCH] translations installation path --- guh.pri | 4 + guh.pro | 4 +- libguh/guhsettings.cpp | 45 +- plugins/deviceplugins/deviceplugins.pro | 4 +- server/main.cpp | 11 +- snap/setup/gui/icon.svg | 602 ++++++++++++++++++++++++ snap/snapcraft.yaml | 9 - tests/auto/auto.pro | 1 - 8 files changed, 660 insertions(+), 20 deletions(-) create mode 100644 snap/setup/gui/icon.svg diff --git a/guh.pri b/guh.pri index 1c250e4c..e9fed031 100644 --- a/guh.pri +++ b/guh.pri @@ -86,6 +86,10 @@ coverage { # Ubuntu snappy snappy { DEFINES += SNAPPY +# # Install translation files +# translations.path = /usr/share/guh/translations +# translations.files = $${top_builddir}/translations/*.qm +# INSTALLS += translations } # Enable Radio 433 MHz for GPIO's diff --git a/guh.pro b/guh.pro index 7633c39c..1230c9ac 100644 --- a/guh.pro +++ b/guh.pro @@ -67,12 +67,12 @@ contains(DEFINES, BLUETOOTH_LE) { } # Ubuntu snappy -contains(DEFINES, SNAPPY){ +contains(DEFINES, SNAPPY) { message("Building Ubuntu snappy package.") } # GPIO RF 433 MHz support -contains(DEFINES, GPIO433){ +contains(DEFINES, GPIO433) { message("Radio 433 for GPIO's enabled") } else { message("Radio 433 for GPIO's disabled") diff --git a/libguh/guhsettings.cpp b/libguh/guhsettings.cpp index 2b770867..27b53f6b 100644 --- a/libguh/guhsettings.cpp +++ b/libguh/guhsettings.cpp @@ -62,6 +62,31 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent): m_role(role) { QString settingsFile; +#ifdef SNAPPY + QString settingsFilePath = QString(qgetenv("SNAP_DATA")); + switch (role) { + case SettingsRoleNone: + break; + case SettingsRoleDevices: + settingsFile = settingsFilePath + "/devices.conf"; + m_settings = new QSettings(settingsFile, QSettings::IniFormat, this); + break; + case SettingsRoleRules: + settingsFile = settingsFilePath + "/rules.conf"; + m_settings = new QSettings(settingsFile, QSettings::IniFormat, this); + break; + case SettingsRolePlugins: + settingsFile = settingsFilePath + "/plugins.conf"; + m_settings = new QSettings(settingsFile, QSettings::IniFormat, this); + break; + case SettingsRoleGlobal: + settingsFile = settingsFilePath + "/guhd.conf"; + m_settings = new QSettings(settingsFile, QSettings::IniFormat, this); + break; + default: + break; + } +#else QString settingsPrefix = QCoreApplication::instance()->organizationName(); bool rootPrivilege = isRoot(); @@ -125,6 +150,9 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent): default: break; } + +#endif // SNAPPY + } /*! Destructor of the GuhSettings.*/ @@ -156,6 +184,9 @@ bool GuhSettings::isRoot() QString GuhSettings::logPath() { QString logPath; +#ifdef SNAPPY + logPath = QString(qgetenv("SNAP_COMMON")) + "/guhd.sqlite"; +#else QString organisationName = QCoreApplication::instance()->organizationName(); if (organisationName == "guh-test") { @@ -166,6 +197,7 @@ QString GuhSettings::logPath() logPath = QDir::homePath() + "/.config/" + organisationName + "/guhd.sqlite"; } +#endif // SNAPPY return logPath; } @@ -173,6 +205,9 @@ QString GuhSettings::logPath() QString GuhSettings::settingsPath() { QString path; +#ifdef SNAPPY + path = QString(qgetenv("SNAP_DATA")); +#else QString organisationName = QCoreApplication::instance()->organizationName(); if (organisationName == "guh-test") { @@ -182,20 +217,27 @@ QString GuhSettings::settingsPath() } else { path = QDir::homePath() + "/.config/" + organisationName; } - +#endif // SNAPPY return path; } /*! Returns the default system translation path \tt{/usr/share/guh/translations}. */ QString GuhSettings::translationsPath() { +#ifdef SNAPPY + return QString(qgetenv("SNAP_DATA")); +#else return QString("/usr/share/guh/translations"); +#endif // SNAPPY } /*! Returns the path where the log file (console log) will be stored. */ QString GuhSettings::consoleLogPath() { QString consoleLogPath; +#ifdef SNAPPY + consoleLogPath = QString(qgetenv("SNAP_COMMON")) + "/guhd.log"; +#else QString organisationName = QCoreApplication::instance()->organizationName(); if (organisationName == "guh-test") { @@ -205,6 +247,7 @@ QString GuhSettings::consoleLogPath() } else { consoleLogPath = QDir::homePath() + "/.config/" + organisationName + "/guhd.log"; } +#endif // SNAPPY return consoleLogPath; } diff --git a/plugins/deviceplugins/deviceplugins.pro b/plugins/deviceplugins/deviceplugins.pro index 4a64ca96..97760bee 100644 --- a/plugins/deviceplugins/deviceplugins.pro +++ b/plugins/deviceplugins/deviceplugins.pro @@ -1,9 +1,9 @@ TEMPLATE = subdirs SUBDIRS += elro \ intertechno \ - networkdetector \ - conrad \ mock \ + networkdetector \ + conrad \ openweathermap \ lircd \ wakeonlan \ diff --git a/server/main.cpp b/server/main.cpp index 275e9e54..ab04c13b 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -232,11 +232,12 @@ int main(int argc, char *argv[]) #ifdef SNAPPY // http://snapcraft.io/docs/reference/env - qCDebug(dcApplication) << "Snappy name :" << qgetenv("SNAP_NAME"); - qCDebug(dcApplication) << "Snappy version :" << qgetenv("SNAP_VERSION"); - qCDebug(dcApplication) << "Snappy directory:" << qgetenv("SNAP"); - qCDebug(dcApplication) << "Snappy app data :" << qgetenv("SNAP_DATA"); - qCDebug(dcApplication) << "Snappy user data:" << qgetenv("SNAP_USER_DATA"); + qCDebug(dcApplication) << "Snap name :" << qgetenv("SNAP_NAME"); + qCDebug(dcApplication) << "Snap version :" << qgetenv("SNAP_VERSION"); + qCDebug(dcApplication) << "Snap directory :" << qgetenv("SNAP"); + qCDebug(dcApplication) << "Snap app data :" << qgetenv("SNAP_DATA"); + qCDebug(dcApplication) << "Snap user data :" << qgetenv("SNAP_USER_DATA"); + qCDebug(dcApplication) << "Snap app common :" << qgetenv("SNAP_COMMON"); #endif // create core instance diff --git a/snap/setup/gui/icon.svg b/snap/setup/gui/icon.svg new file mode 100644 index 00000000..17065d0b --- /dev/null +++ b/snap/setup/gui/icon.svg @@ -0,0 +1,602 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 49119cc4..95492130 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -17,10 +17,6 @@ apps: - bluetooth-control - bluez - guh-cli: - command: guh-cli - - parts: application: plugin: qmake @@ -55,8 +51,3 @@ parts: - avahi-daemon after: [qt5conf] -parts: - guh-cli: - plugin: python2 - source: https://github.com/guh/guh-cli - source-type: git diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index c746a081..8540b518 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,5 +1,4 @@ TEMPLATE = subdirs - SUBDIRS = versioning \ devices \ jsonrpc \