diff --git a/androidservice/androidservice.pro b/androidservice/androidservice.pro index febffa09..7503e717 100644 --- a/androidservice/androidservice.pro +++ b/androidservice/androidservice.pro @@ -4,7 +4,7 @@ CONFIG += dll QT += core androidextras QT += network qml quick quickcontrols2 svg websockets bluetooth charts nfc -include(../config.pri) +include(../shared.pri) include(../3rdParty/android/android_openssl/openssl.pri) diff --git a/config.h.in b/config.h.in new file mode 100644 index 00000000..4306598f --- /dev/null +++ b/config.h.in @@ -0,0 +1,38 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU General Public License as published by the Free Software +* Foundation, GNU version 3. This project is distributed in the hope that it +* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +* Public License for more details. +* +* You should have received a copy of the GNU General Public License along with +* this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef VERSION_H +#define VERSION_H + +#define APP_VERSION '"$$APP_VERSION"' +#define APPLICATION_NAME '"$$APPLICATION_NAME"' +#define ORGANISATION_NAME '"$$ORGANISATION_NAME"' + +#endif diff --git a/config.pri b/config.pri index 289057c5..b94071e9 100644 --- a/config.pri +++ b/config.pri @@ -1,35 +1,5 @@ -CONFIG += c++11 +APPLICATION_NAME="nymea-app" +ORGANISATION_NAME="nymea" -top_srcdir=$$PWD -top_builddir=$$shadowed($$PWD) - -VERSION_INFO=$$cat(version.txt) -APP_VERSION=$$member(VERSION_INFO, 0) -APP_REVISION=$$member(VERSION_INFO, 1) - -DEFINES+=APP_VERSION=\\\"$${APP_VERSION}\\\" - -# We want -Wall to keep the code clean and tidy, however: -# On Windows, -Wall goes mental, so not using it there -!win32:QMAKE_CXXFLAGS += -Wall - -# As of Qt 5.15, lots of things are deprecated inside Qt in preparation for Qt6 but no replacement to actually fix those yet. -linux:!android { - QMAKE_CXXFLAGS += -Wno-deprecated-declarations -Wno-deprecated-copy -} - -android: { - QMAKE_CXXFLAGS += -Wno-deprecated-declarations - - !equals(OVERLAY_PATH, ""):!equals(BRANDING, "") { - ANDROID_PACKAGE_SOURCE_DIR = $${OVERLAY_PATH}/packaging/android_$$BRANDING - } else { - ANDROID_PACKAGE_SOURCE_DIR = $${top_srcdir}/packaging/android - } - - !no-firebase:DEFINES+=WITH_FIREBASE -} - -ios: { - !no-firebase:DEFINES+=WITH_FIREBASE -} +PACKAGE_URN=io.nymea.nymeaapp +PACKAGE_NAME=nymea-app diff --git a/libnymea-app/connection/awsclient.cpp b/libnymea-app/connection/awsclient.cpp index dd2076f5..29af21ec 100644 --- a/libnymea-app/connection/awsclient.cpp +++ b/libnymea-app/connection/awsclient.cpp @@ -42,6 +42,7 @@ #include "sigv4utils.h" #include "logging.h" +#include "config.h" AWSClient* AWSClient::s_instance = nullptr; diff --git a/libnymea-app/libnymea-app.pro b/libnymea-app/libnymea-app.pro index c5ad1308..c5f32314 100644 --- a/libnymea-app/libnymea-app.pro +++ b/libnymea-app/libnymea-app.pro @@ -2,7 +2,7 @@ TARGET = nymea-app TEMPLATE = lib CONFIG += staticlib -include(../config.pri) +include(../shared.pri) include(libnymea-app.pri) LIBS += -lssl -lcrypto diff --git a/nymea-app.pro b/nymea-app.pro index 8bd18262..618f24cd 100644 --- a/nymea-app.pro +++ b/nymea-app.pro @@ -1,7 +1,9 @@ -include(config.pri) -message("APP_VERSION: $${APP_VERSION} ($${APP_REVISION})") TEMPLATE=subdirs +include(shared.pri) +message("APP_VERSION: $${APP_VERSION} ($${APP_REVISION})") + + SUBDIRS = libnymea-app nymea-app nymea-app.depends = libnymea-app @@ -14,35 +16,22 @@ withtests: { # Make sure your environment has the toolchain you want (e.g. msvc17 64 bit) by executing the command: # $ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" # $ make wininstaller -wininstaller.depends = nymea-app -!equals(OVERLAY_PATH, ""):!equals(BRANDING, "") { - PACKAGE_BASE_DIR = $${OVERLAY_PATH}\packaging -} else { - PACKAGE_BASE_DIR = $$shell_path($$PWD)\packaging +win32: { + wininstaller.depends = nymea-app + + OLDSTRING=".*" + NEWSTRING="$${APP_VERSION}" + wininstaller.commands += @powershell -Command \"(gc $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\meta\package.xml) -replace \'$${OLDSTRING}\',\'$${NEWSTRING}\' | sc $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\meta\package.xml\" && + wininstaller.commands += rmdir /S /Q $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data & mkdir $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data && + wininstaller.commands += copy $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\meta\logo.ico $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\logo.ico && + CONFIG(debug,debug|release):wininstaller.commands += copy nymea-app\debug\\$${APPLICATION_NAME}.exe $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\\$${APPLICATION_NAME}.exe && + CONFIG(release,debug|release):wininstaller.commands += copy nymea-app\release\\$${APPLICATION_NAME}.exe $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\\$${APPLICATION_NAME}.exe && + wininstaller.commands += copy \"$${top_srcdir}\"\3rdParty\windows\windows_openssl\*.dll $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data && + wininstaller.commands += windeployqt --compiler-runtime --qmldir \"$${top_srcdir}\"\nymea-app\ui $${WIN_PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\ && + wininstaller.commands += binarycreator -c $${WIN_PACKAGE_DIR}\config\config.xml -p $${WIN_PACKAGE_DIR}\packages\ $${PACKAGE_NAME}-$${APP_VERSION} + message("Windows installer package directory: $${WIN_PACKAGE_DIR}") + QMAKE_EXTRA_TARGETS += wininstaller } -equals(BRANDING, "") { - APP_NAME = nymea-app - PACKAGE_URN = io.nymea.nymeaapp - PACKAGE_NAME = nymea-app-win-installer - PACKAGE_DIR = $${PACKAGE_BASE_DIR}\windows -} else { - APP_NAME = $${BRANDING} - PACKAGE_URN = io.nymea.$${APP_NAME} - PACKAGE_NAME = $${BRANDING}-win-installer - PACKAGE_DIR = $${PACKAGE_BASE_DIR}\windows_$${APP_NAME} -} -OLDSTRING=".*" -NEWSTRING="$${APP_VERSION}" -wininstaller.commands += @powershell -Command \"(gc $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\meta\package.xml) -replace \'$${OLDSTRING}\',\'$${NEWSTRING}\' | sc $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\meta\package.xml\" && -wininstaller.commands += rmdir /S /Q $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data & mkdir $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data && -wininstaller.commands += copy $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\meta\logo.ico $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\logo.ico && -CONFIG(debug,debug|release):wininstaller.commands += copy nymea-app\debug\nymea-app.exe $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\\$${APP_NAME}.exe && -CONFIG(release,debug|release):wininstaller.commands += copy nymea-app\release\nymea-app.exe $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\\$${APP_NAME}.exe && -wininstaller.commands += copy \"$${top_srcdir}\"\3rdParty\windows\windows_openssl\*.dll $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data && -wininstaller.commands += windeployqt --compiler-runtime --qmldir \"$${top_srcdir}\"\nymea-app\ui $${PACKAGE_DIR}\packages\\$${PACKAGE_URN}\data\ && -wininstaller.commands += binarycreator -c $${PACKAGE_DIR}\config\config.xml -p $${PACKAGE_DIR}\packages\ $${PACKAGE_NAME}-$${APP_VERSION} -win32:message("Windows installer package directory: $${PACKAGE_DIR}") -QMAKE_EXTRA_TARGETS += wininstaller @@ -53,33 +42,32 @@ QMAKE_EXTRA_TARGETS += wininstaller # and we're using the WebView instead anyways. (IMHO a bug that macdeployqt -appstore-compliant even adds it) osxbundle.depends = nymea-app osxbundle.commands += cd nymea-app && rm -f ../*.dmg ../*pkg *.dmg || true && -osxbundle.commands += hdiutil eject /Volumes/nymea-app || true && -osxbundle.commands += macdeployqt nymea-app.app -appstore-compliant -qmldir=$$top_srcdir/nymea-app/ui -dmg && -osxbundle.commands += rm -r nymea-app.app/Contents/Frameworks/QtWebEngineCore.framework && -osxbundle.commands += codesign -s \"3rd Party Mac Developer Application\" --entitlements $$top_srcdir/packaging/osx/nymea-app.entitlements --deep nymea-app.app && -osxbundle.commands += hdiutil convert nymea-app.dmg -format UDRW -o nymea-app_writable.dmg && -osxbundle.commands += hdiutil attach -readwrite -noverify nymea-app_writable.dmg && sleep 2 && -osxbundle.commands += mv /Volumes/nymea-app/nymea-app.app /Volumes/nymea-app/nymea\:app.app && -osxbundle.commands += tar -xpf $$top_srcdir/packaging/osx/template.tar -C /Volumes/nymea-app/ && -osxbundle.commands += hdiutil eject /Volumes/nymea-app && -osxbundle.commands += hdiutil convert nymea-app_writable.dmg -format UDRO -o ../nymea-app-osx-bundle-$${APP_VERSION}.dmg && -osxbundle.commands += rm nymea-app.dmg nymea-app_writable.dmg +osxbundle.commands += hdiutil eject /Volumes/$${APPLICATION_NAME} || true && +osxbundle.commands += macdeployqt $${APPLICATION_NAME}.app -appstore-compliant -qmldir=$$top_srcdir/nymea-app/ui -dmg && +osxbundle.commands += rm -r $${APPLICATION_NAME}.app/Contents/Frameworks/QtWebEngineCore.framework && +osxbundle.commands += codesign -s \"3rd Party Mac Developer Application\" --entitlements $${MACX_PACKAGE_DIR}/$${APPLICATION_NAME}.entitlements --deep $${APPLICATION_NAME}.app && +osxbundle.commands += hdiutil convert $${APPLICATION_NAME}.dmg -format UDRW -o $${APPLICATION_NAME}_writable.dmg && +osxbundle.commands += hdiutil attach -readwrite -noverify $${APPLICATION_NAME}_writable.dmg && sleep 2 && +osxbundle.commands += tar -xpf $${MACX_PACKAGE_DIR}/template.tar -C /Volumes/$${APPLICATION_NAME}/ && +osxbundle.commands += hdiutil eject /Volumes/$${APPLICATION_NAME} && +osxbundle.commands += hdiutil convert $${APPLICATION_NAME}_writable.dmg -format UDRO -o ../$${APPLICATION_NAME}-osx-bundle-$${APP_VERSION}.dmg && +osxbundle.commands += rm $${APPLICATION_NAME}.dmg $${APPLICATION_NAME}_writable.dmg QMAKE_EXTRA_TARGETS += osxbundle # Create a .pkg osx installer. osxinstaller.depends = osxbundle osxinstaller.commands += cd nymea-app && -osxinstaller.commands += productbuild --component nymea-app.app /Applications ../nymea-app-$${APP_VERSION}.pkg && cd .. && -osxinstaller.commands += productsign -s \"3rd Party Mac Developer Installer\" nymea-app-$${APP_VERSION}.pkg nymea-app-signed-$${APP_VERSION}.pkg +osxinstaller.commands += productbuild --component $${APPLICATION_NAME}.app /Applications ../$${APPLICATION_NAME}-$${APP_VERSION}.pkg && cd .. && +osxinstaller.commands += productsign -s \"3rd Party Mac Developer Installer\" $${APPLICATION_NAME}-$${APP_VERSION}.pkg $${APPLICATION_NAME}-signed-$${APP_VERSION}.pkg QMAKE_EXTRA_TARGETS += osxinstaller # Generic linux desktop linux:!android: { -desktopfile.files = packaging/linux-common/nymea-app.desktop -desktopfile.path = /usr/share/applications/ -icons.files = packaging/linux-common/icons/ -icons.path = /usr/share/ -INSTALLS += desktopfile icons + desktopfile.files = $${PACKAGE_BASE_DIR}/linux-common/$${APPLICATION_NAME}.desktop + desktopfile.path = /usr/share/applications/ + icons.files = $${PACKAGE_BASE_DIR}/linux-common/icons/ + icons.path = /usr/share/ + INSTALLS += desktopfile icons } android: { @@ -96,9 +84,9 @@ android: { # Linux desktop (snap package) snap: { -desktopfile.files = packaging/linux/nymea-app.desktop -desktopfile.path = /usr/share/applications/ -INSTALLS += desktopfile + desktopfile.files = $${PACKAGE_BASE_DIR}/linux/$${APPLICATION_NAME}.desktop + desktopfile.path = /usr/share/applications/ + INSTALLS += desktopfile } ubports: { diff --git a/nymea-app/main.cpp b/nymea-app/main.cpp index 03cbe386..862590ba 100644 --- a/nymea-app/main.cpp +++ b/nymea-app/main.cpp @@ -46,6 +46,7 @@ #include "nfchelper.h" #include "nfcthingactionwriter.h" #include "platformhelper.h" +#include "../config.h" #include "logging.h" @@ -70,19 +71,18 @@ int main(int argc, char *argv[]) ); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication application(argc, argv); - application.setApplicationName("nymea-app"); - application.setOrganizationName("nymea"); + + application.setApplicationName(APPLICATION_NAME); + application.setOrganizationName(ORGANISATION_NAME); QCommandLineParser parser; parser.addHelpOption(); QCommandLineOption connectOption = QCommandLineOption({"c", "connect"}, "Connect to nymea:core without discovery.", "host"); parser.addOption(connectOption); -#ifndef BRANDING QCommandLineOption styleOption = QCommandLineOption({"s", "style"}, "Override the style. Style in settings will be disabled.", "style"); parser.addOption(styleOption); QCommandLineOption defaultStyleOption = QCommandLineOption({"d", "default-style"}, "The default style to be used if there is no style explicitly selected by the user yet.", "style"); parser.addOption(defaultStyleOption); -#endif QCommandLineOption defaultViewsOption = QCommandLineOption({"v", "default-views"}, "The main views enabled by default if there is no configuration done by the user and the style doesn't dictate them, comma separated.", "mainviews"); parser.addOption(defaultViewsOption); QCommandLineOption kioskOption = QCommandLineOption({"k", "kiosk"}, "Start the application in kiosk mode."); @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); application.installTranslator(&qtTranslator); - qCInfo(dcApplication()) << "nymea:app" << APP_VERSION << "running on" << QSysInfo::machineHostName() << QSysInfo::prettyProductName() << QSysInfo::productType() << QSysInfo::productVersion(); + qCInfo(dcApplication()) << application.applicationName() << APP_VERSION << "running on" << QSysInfo::machineHostName() << QSysInfo::prettyProductName() << QSysInfo::productType() << QSysInfo::productVersion(); qCInfo(dcApplication()) << "Locale info:" << QLocale() << QLocale().name() << QLocale().language() << QLocale().system(); QTranslator appTranslator; @@ -114,10 +114,6 @@ int main(int argc, char *argv[]) QQmlApplicationEngine *engine = new QQmlApplicationEngine(); -#if defined BRANDING - StyleController styleController(BRANDING); - styleController.lockToStyle(BRANDING); -#else QString defaultStyle; if (parser.isSet(defaultStyleOption)) { defaultStyle = parser.value(defaultStyleOption); @@ -131,7 +127,6 @@ int main(int argc, char *argv[]) qCInfo(dcApplication()) << "Setting style to" << defaultStyle; styleController.lockToStyle(parser.value(styleOption)); } -#endif QQmlFileSelector *styleSelector = new QQmlFileSelector(engine); styleSelector->setExtraSelectors({styleController.currentStyle()}); @@ -145,6 +140,7 @@ int main(int argc, char *argv[]) } qmlRegisterSingletonType(QUrl("qrc:///styles/" + styleController.currentStyle() + "/Style.qml"), "Nymea", 1, 0, "Style" ); + qmlRegisterSingletonType(QUrl("qrc:///ui/Configuration.qml"), "Nymea", 1, 0, "Configuration"); engine->rootContext()->setContextProperty("styleController", &styleController); diff --git a/nymea-app/nymea-app.pro b/nymea-app/nymea-app.pro index 661d29fe..06bbb6d9 100644 --- a/nymea-app/nymea-app.pro +++ b/nymea-app/nymea-app.pro @@ -1,6 +1,7 @@ TEMPLATE=app -TARGET=nymea-app -include(../config.pri) +include(../shared.pri) + +TARGET=$${APPLICATION_NAME} CONFIG += link_pkgconfig @@ -44,15 +45,12 @@ RESOURCES += resources.qrc \ ruletemplates.qrc \ images.qrc \ translations.qrc \ - styles.qrc !equals(OVERLAY_PATH, "") { message("Resource overlay enabled. Will be using overlay from $${OVERLAY_PATH}") RESOURCES += $${OVERLAY_PATH}/overlay.qrc -} - -win32 { - QT += webview +} else { + RESOURCES += styles.qrc } android { @@ -94,17 +92,17 @@ macx: { QMAKE_TARGET_BUNDLE_PREFIX = io.nymea QMAKE_BUNDLE = nymeaApp.mac - plist.input = ../packaging/osx/Info.plist.in + plist.input = $${MACX_PACKAGE_DIR}/Info.plist.in plist.output = $$OUT_PWD/Info.plist QMAKE_SUBSTITUTES += plist QMAKE_INFO_PLIST = $$OUT_PWD/Info.plist - OTHER_FILES += ../packaging/osx/Info.plist.in \ - ../packaging/osx/nymea-app.entitlements + OTHER_FILES += $${MACX_PACKAGE_DIR}/Info.plist.in \ + $${MACX_PACKAGE_DIR}/$${APPLICATION_NAME}.entitlements - ICON = ../packaging/osx/AppIcon.icns + ICON = $${MACX_PACKAGE_DIR}/AppIcon.icns OSX_ENTITLEMENTS.name = CODE_SIGN_ENTITLEMENTS - OSX_ENTITLEMENTS.value = $$files($$PWD/../packaging/ios/nymea-app.entitlements) + OSX_ENTITLEMENTS.value = $$files($${MACX_PACKAGE_DIR}/$${APPLICATION_NAME}.entitlements) QMAKE_MAC_XCODE_SETTINGS += OSX_ENTITLEMENTS } @@ -116,13 +114,6 @@ ios: { OBJECTIVE_SOURCES += $$PWD/../packaging/ios/platformhelperios.mm \ $$PWD/../packaging/ios/pushnotifications.mm \ -# Firebase CPP SDK -# QMAKE_LFLAGS += -ObjC $(inherited) -# INCLUDEPATH += /Users/micha/Downloads/firebase_cpp_sdk/include/ -# LIBS += -F/Users/micha/Downloads/firebase_cpp_sdk/libs/ios/arm64/ -# LIBS += -ObjC -L/Users/micha/Downloads/firebase_cpp_sdk/libs/ios/arm64/ -lfirebase_messaging -lfirebase_app -# LIBS += -framework "FirebaseCore" - # Add Firebase SDK QMAKE_LFLAGS += -ObjC $(inherited) firebase_files.files += $$files(../packaging/ios/GoogleService-Info.plist) @@ -176,13 +167,13 @@ ubports: { SOURCES += platformintegration/ubports/pushclient.cpp } -BR=$$BRANDING -!equals(BR, "") { - message("Branding the style to: $${BR}") - DEFINES += BRANDING=\\\"$${BR}\\\" - win32:RCC_ICONS += ../packaging/windows_$${BR}/packages/io.guh.$${BR}/meta/logo.ico -} else { - win32:RCC_ICONS += ../packaging/windows/packages/io.guh.nymeaapp/meta/logo.ico +win32 { + QT += webview + equals(OVERLAY_PATH, "") { + win32:RCC_ICONS += ../packaging/windows/packages/io.nymea.nymeaapp/meta/logo.ico + } else { + win32:RCC_ICONS += $${OVERLAY_PATH}/packaging/windows/packages/io.guh.$${BR}/meta/logo.ico + } } target.path = /usr/bin diff --git a/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java b/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java index fc24626d..ced4de7a 100644 --- a/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java +++ b/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java @@ -77,7 +77,7 @@ public class NymeaAppActivity extends org.qtproject.qt5.android.bindings.QtActiv } } - public boolean nightModeEnabled() { + public boolean darkModeEnabled() { return (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; } } diff --git a/nymea-app/resources.qrc b/nymea-app/resources.qrc index a95d5b6c..1b124310 100644 --- a/nymea-app/resources.qrc +++ b/nymea-app/resources.qrc @@ -233,5 +233,6 @@ ui/devicepages/ThermostatDevicePage.qml ui/components/BigThingTile.qml ui/appsettings/LoggingCategories.qml + ui/ConfigurationBase.qml diff --git a/nymea-app/styles.qrc b/nymea-app/styles.qrc index 0adf708f..b05c2acf 100644 --- a/nymea-app/styles.qrc +++ b/nymea-app/styles.qrc @@ -31,5 +31,6 @@ styles/energize/logo-wide.svg styles/lime/logo-wide.svg styles/noir/logo-wide.svg + ui/Configuration.qml diff --git a/nymea-app/ui/Configuration.qml b/nymea-app/ui/Configuration.qml new file mode 100644 index 00000000..cbbc40aa --- /dev/null +++ b/nymea-app/ui/Configuration.qml @@ -0,0 +1,6 @@ +pragma Singleton +import QtQuick 2.0 + +ConfigurationBase { + +} diff --git a/nymea-app/ui/ConfigurationBase.qml b/nymea-app/ui/ConfigurationBase.qml new file mode 100644 index 00000000..13efed6e --- /dev/null +++ b/nymea-app/ui/ConfigurationBase.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Item { + property string systemName: "nymea" + property string appName: "nymea:app" +} diff --git a/nymea-app/ui/MainMenu.qml b/nymea-app/ui/MainMenu.qml index 31d3f2fd..c6380c8f 100644 --- a/nymea-app/ui/MainMenu.qml +++ b/nymea-app/ui/MainMenu.qml @@ -49,7 +49,7 @@ Drawer { ColumnLayout { Label { Layout.fillWidth: true - text: root.currentEngine && root.currentEngine.jsonRpcClient.currentHost ? root.currentEngine.jsonRpcClient.currentHost.name : app.systemName + text: root.currentEngine && root.currentEngine.jsonRpcClient.currentHost ? root.currentEngine.jsonRpcClient.currentHost.name : Configuration.systemName } Label { Layout.fillWidth: true diff --git a/nymea-app/ui/MainPage.qml b/nymea-app/ui/MainPage.qml index 129dce11..e120e726 100644 --- a/nymea-app/ui/MainPage.qml +++ b/nymea-app/ui/MainPage.qml @@ -99,8 +99,8 @@ Page { // 2. Style mainViewsFilter as that comes with branding (for now, if a style defines main views, all of them are active by default) // 3. Command line args // 4. Just show "things" alone by default - property var filterList: app.hasOwnProperty("mainViewsFilter") ? - app.mainViewsFilter + property var filterList: Configuration.hasOwnProperty("mainViewsFilter") ? + Configuration.mainViewsFilter : defaultMainViewFilter.length > 0 ? defaultMainViewFilter.split(',') : ["things"] @@ -109,7 +109,6 @@ Page { ListModel { id: mainMenuBaseModel - // TODO: Should read this from disk somehow maybe? ListElement { name: "things"; source: "ThingsView"; displayName: qsTr("Things"); icon: "things" } ListElement { name: "favorites"; source: "FavoritesView"; displayName: qsTr("Favorites"); icon: "starred" } ListElement { name: "groups"; source: "GroupsView"; displayName: qsTr("Groups"); icon: "view-grid-symbolic" } @@ -129,9 +128,9 @@ Page { var newItems = 0 // Add extra views first to make them appear first in the list unless the config says otherwise - if (app.hasOwnProperty("additionalMainViews")) { - for (var i = 0; i < app.additionalMainViews.count; i++) { - var item = app.additionalMainViews.get(i); + if (Configuration.hasOwnProperty("additionalMainViews")) { + for (var i = 0; i < Configuration.additionalMainViews.count; i++) { + var item = Configuration.additionalMainViews.get(i); var idx = mainViewSettings.sortOrder.indexOf(item.name); if (idx === -1) { newList[newItems++] = item; @@ -153,7 +152,7 @@ Page { } clear(); - var brandingFilter = app.hasOwnProperty("mainViewsFilter") ? app.mainViewsFilter : [] + var brandingFilter = Configuration.hasOwnProperty("mainViewsFilter") ? Configuration.mainViewsFilter : [] for (idx in configList) { item = configList[idx]; diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index 37685790..5b5076c0 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -46,7 +46,7 @@ ApplicationWindow { minimumHeight: 480 visibility: kioskMode ? ApplicationWindow.FullScreen : settings.viewMode color: Material.background - title: app.appName + title: Configuration.appName Material.theme: NymeaUtils.isDark(Style.backgroundColor) ? Material.Dark : Material.Light Material.background: Style.backgroundColor @@ -59,9 +59,6 @@ ApplicationWindow { font.capitalization: Font.MixedCase font.family: Style.fontFamily - property string appName: "appBranding" in app ? app.appBranding : "nymea:app" - property string systemName: "coreBranding" in app ? app.coreBranding : "nymea" - property int margins: 16 property int bigMargins: 20 diff --git a/nymea-app/ui/PushButtonAuthPage.qml b/nymea-app/ui/PushButtonAuthPage.qml index 9d010707..a60204e8 100644 --- a/nymea-app/ui/PushButtonAuthPage.qml +++ b/nymea-app/ui/PushButtonAuthPage.qml @@ -39,7 +39,7 @@ Page { signal backPressed(); header: NymeaHeader { - text: qsTr("Welcome to %1!").arg(app.systemName) + text: qsTr("Welcome to %1!").arg(Configuration.systemName) backButtonVisible: true onBackPressed: { root.backPressed(); @@ -87,7 +87,7 @@ Page { Label { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter - text: qsTr("Please press the button on your %1 box to authenticate this device.").arg(app.systemName) + text: qsTr("Please press the button on your %1 box to authenticate this device.").arg(Configuration.systemName) wrapMode: Text.WordWrap } diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml index 54c53bb1..9deb880e 100644 --- a/nymea-app/ui/RootItem.qml +++ b/nymea-app/ui/RootItem.qml @@ -182,7 +182,7 @@ Item { } print("Warning: There is a last connected host but UUID is unknown to discovery...") } else if (autoConnectHost.length > 0) { - var host = nymeaDiscovery.nymeaHosts.createLanHost(app.systemName, autoConnectHost); + var host = nymeaDiscovery.nymeaHosts.createLanHost(Configuration.systemName, autoConnectHost); engine.jsonRpcClient.connectToHost(host) } else { // Only hide the splash right away if we're not trying to connect to something @@ -445,8 +445,8 @@ Item { } Label { text: popup.minVersion != "" - ? qsTr("The version of the %1:core you are trying to connect to is too old. This app requires at least version %2 but this %1:core only supports %3. Please update your %1:core system.").arg(app.systemName).arg(popup.minVersion).arg(popup.actualVersion) - : qsTr("The version of the %1:core you are trying to connect to is too new. This app supports only up to version %2 but this %1:core provides %3. Please update %1:app.").arg(app.systemName).arg(popup.maxVersion).arg(popup.actualVersion) + ? qsTr("The version of the %1 system you are trying to connect to is too old. This app requires at least version %2 but this %1 system only supports %3. Please update your %1 system.").arg(Configuration.systemName).arg(popup.minVersion).arg(popup.actualVersion) + : qsTr("The version of the %1 system you are trying to connect to is too new. This app supports only up to version %2 but this %1 system provides %3. Please update %4.").arg(Configuration.systemName).arg(popup.maxVersion).arg(popup.actualVersion).arg(Configuration.appName) wrapMode: Text.WordWrap Layout.fillWidth: true } diff --git a/nymea-app/ui/SettingsPage.qml b/nymea-app/ui/SettingsPage.qml index f9a387ff..97e78c96 100644 --- a/nymea-app/ui/SettingsPage.qml +++ b/nymea-app/ui/SettingsPage.qml @@ -112,7 +112,7 @@ Page { width: parent.width iconName: "../images/connections/cloud.svg" text: qsTr("Cloud") - subText: qsTr("Connect this %1:core to %1:cloud").arg(app.systemName) + subText: qsTr("Connect this %1 system to %1:cloud").arg(Configuration.systemName) prominentSubText: false wrapTexts: false onClicked: pageStack.push(Qt.resolvedUrl("system/CloudSettingsPage.qml")) @@ -228,7 +228,7 @@ Page { width: parent.width iconName: "../images/system-update.svg" text: qsTr("System update") - subText: qsTr("Update your %1:core system").arg(app.systemName) + subText: qsTr("Update your %1 system").arg(Configuration.systemName) prominentSubText: false wrapTexts: false onClicked: pageStack.push(Qt.resolvedUrl("system/SystemUpdatePage.qml")) @@ -259,7 +259,7 @@ Page { NymeaSwipeDelegate { width: parent.width iconName: "../images/info.svg" - text: qsTr("About %1:core").arg(app.systemName) + text: qsTr("About %1").arg(Configuration.systemName) subText: qsTr("Find server UUID and versions") prominentSubText: false wrapTexts: false diff --git a/nymea-app/ui/appsettings/AboutPage.qml b/nymea-app/ui/appsettings/AboutPage.qml index 1ed44ab8..d3132355 100644 --- a/nymea-app/ui/appsettings/AboutPage.qml +++ b/nymea-app/ui/appsettings/AboutPage.qml @@ -37,12 +37,12 @@ import "../components" SettingsPageBase { id: root - title: qsTr("About %1").arg(app.appName) + title: qsTr("About %1").arg(Configuration.appName) Imprint { id: imprint Layout.fillWidth: true - title: app.appName + title: Configuration.appName additionalLicenses: ListModel { ListElement { license: "CC-BY-SA-3.0"; component: "Suru icons"; infoText: qsTr("Suru icons by Ubuntu"); platforms: "*" } ListElement { license: "CC-BY-SA-3.0"; component: "Ubuntu font"; infoText: qsTr("Ubuntu font by Ubuntu"); platforms: "*" } diff --git a/nymea-app/ui/appsettings/AppSettingsPage.qml b/nymea-app/ui/appsettings/AppSettingsPage.qml index ffe6a278..1a1ba0ef 100644 --- a/nymea-app/ui/appsettings/AppSettingsPage.qml +++ b/nymea-app/ui/appsettings/AppSettingsPage.qml @@ -77,7 +77,7 @@ Page { NymeaSwipeDelegate { width: parent.width text: qsTr("Cloud login") - subText: qsTr("Log into %1:cloud and manage connected %1:core systems").arg(app.systemName) + subText: qsTr("Log into %1:cloud and manage connected %1 systems").arg(Configuration.systemName) iconName: "../images/connections/cloud.svg" prominentSubText: false wrapTexts: false @@ -104,7 +104,7 @@ Page { padding: 0 NymeaSwipeDelegate { width: parent.width - text: qsTr("About %1").arg(app.appName) + text: qsTr("About %1").arg(Configuration.appName) subText: qsTr("Find app versions and licence information") iconName: "../images/info.svg" prominentSubText: false diff --git a/nymea-app/ui/appsettings/CloudLoginPage.qml b/nymea-app/ui/appsettings/CloudLoginPage.qml index 912bd19a..e82d2a34 100644 --- a/nymea-app/ui/appsettings/CloudLoginPage.qml +++ b/nymea-app/ui/appsettings/CloudLoginPage.qml @@ -36,7 +36,7 @@ import "../components" SettingsPageBase { id: root - title: qsTr("%1 cloud login").arg(app.appName) + title: qsTr("%1 cloud login").arg(Configuration.appName) Component.onCompleted: { if (AWSClient.isLoggedIn) { @@ -91,7 +91,7 @@ SettingsPageBase { RowLayout { SettingsPageSectionHeader { - text: qsTr("Connected %1:core systems").arg(app.systemName) + text: qsTr("Connected %1 systems").arg(Configuration.systemName) } BusyIndicator { running: AWSClient.awsDevices.busy @@ -107,8 +107,8 @@ SettingsPageBase { Layout.rightMargin: app.margins wrapMode: Text.WordWrap text: AWSClient.awsDevices.count === 0 ? - qsTr("There are no %1:core systems connected to your cloud yet.").arg(app.systemName) : - qsTr("There are %n %1:core systems connected to your cloud.", "", AWSClient.awsDevices.count).arg(app.systemName) + qsTr("There are no %1 systems connected to your cloud yet.").arg(Configuration.systemName) : + qsTr("There are %n %1 systems connected to your cloud.", "", AWSClient.awsDevices.count).arg(Configuration.systemName) } Repeater { @@ -151,7 +151,7 @@ SettingsPageBase { Layout.fillWidth: true Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.topMargin: app.margins wrapMode: Text.WordWrap - text: qsTr("Log %1 in to %2:cloud in order to connect to %2:core systems from anywhere and receive push notifications from %2:core systems.").arg(app.appName).arg(app.systemName) + text: qsTr("Log %1 in to %2:cloud in order to connect to %2:core systems from anywhere and receive push notifications from %2:core systems.").arg(Configuration.appName).arg(Configuration.systemName) } Label { Layout.fillWidth: true @@ -283,7 +283,7 @@ SettingsPageBase { SettingsPageSectionHeader { - text: qsTr("Welcome to %1:cloud.").arg(app.systemName) + text: qsTr("Welcome to %1:cloud.").arg(Configuration.systemName) } Label { @@ -302,7 +302,7 @@ SettingsPageBase { Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.topMargin: app.margins wrapMode: Text.WordWrap font.pixelSize: app.smallFont - text: qsTr("See our privacy policy to find out what information is processed. By signing up to %2:cloud you accept those terms and conditions.").arg(app.privacyPolicyUrl).arg(app.systemName) + text: qsTr("See our privacy policy to find out what information is processed. By signing up to %2:cloud you accept those terms and conditions.").arg(app.privacyPolicyUrl).arg(Configuration.systemName) onLinkActivated: { Qt.openUrlExternally(link) } @@ -559,7 +559,7 @@ SettingsPageBase { MeaDialog { id: logoutDialog title: qsTr("Goodbye") - text: qsTr("Sorry to see you go. If you log out you won't be able to connect to %1:core systems remotely any more. However, you can come back any time, we'll keep your user account. If you whish to completely delete your account and all the data associated with it, check the box below before hitting ok. If you decide to delete your account, all your personal information will be removed from %1:cloud and cannot be restored.").arg(app.systemName) + text: qsTr("Sorry to see you go. If you log out you won't be able to connect to %1 systems remotely any more. However, you can come back any time, we'll keep your user account. If you whish to completely delete your account and all the data associated with it, check the box below before hitting ok. If you decide to delete your account, all your personal information will be removed from %1:cloud and cannot be restored.").arg(Configuration.systemName) headerIcon: "../images/dialog-warning-symbolic.svg" standardButtons: Dialog.Cancel | Dialog.Ok diff --git a/nymea-app/ui/components/UpdateRunningOverlay.qml b/nymea-app/ui/components/UpdateRunningOverlay.qml index cf487b39..eaffcb60 100644 --- a/nymea-app/ui/components/UpdateRunningOverlay.qml +++ b/nymea-app/ui/components/UpdateRunningOverlay.qml @@ -80,7 +80,7 @@ Rectangle { Label { Layout.fillWidth: true Layout.margins: app.margins * 2 - text: qsTr("The system may restart in order to complete the update. %1:app will reconnect automatically after the update.").arg(app.systemName) + text: qsTr("The system may restart in order to complete the update. %1:app will reconnect automatically after the update.").arg(Configuration.systemName) horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap font.pixelSize: app.smallFont diff --git a/nymea-app/ui/connection/CertificateErrorDialog.qml b/nymea-app/ui/connection/CertificateErrorDialog.qml index 10987809..bf54212a 100644 --- a/nymea-app/ui/connection/CertificateErrorDialog.qml +++ b/nymea-app/ui/connection/CertificateErrorDialog.qml @@ -40,6 +40,6 @@ MeaDialog { title: qsTr("Insecure connection") headerIcon: "../images/lock-broken.svg" - text: qsTr("The certificate for this %1 system has changed. This could be because the configuration has been changed, but could also mean the system has been compromised. Do you want to accept the new certificate?").arg(app.systemName) + text: qsTr("The certificate for this %1 system has changed. This could be because the configuration has been changed, but could also mean the system has been compromised. Do you want to accept the new certificate?").arg(Configuration.systemName) standardButtons: Dialog.Ok | Dialog.Cancel } diff --git a/nymea-app/ui/connection/ConnectPage.qml b/nymea-app/ui/connection/ConnectPage.qml index 63ce0d59..6e7138c9 100644 --- a/nymea-app/ui/connection/ConnectPage.qml +++ b/nymea-app/ui/connection/ConnectPage.qml @@ -49,7 +49,7 @@ Page { Label { Layout.fillWidth: true - text: qsTr("Connect %1").arg(app.systemName) + text: qsTr("Connect %1").arg(Configuration.systemName) } } } @@ -117,9 +117,9 @@ Page { Label { Layout.fillWidth: true text: root.haveHosts ? - qsTr("There are %1 %2:cores in your network! Which one would you like to use?").arg(hostsProxy.count).arg(app.systemName) - : startupTimer.running ? qsTr("We haven't found a %1:core in your network yet.").arg(app.systemName) - : qsTr("There doesn't seem to be a %1:core installed in your network. Please make sure your %1:core system is correctly set up and connected.").arg(app.systemName) + qsTr("There are %n %1 systems in your network! Which one would you like to use?", "", hostsProxy.count).arg(Configuration.systemName) + : startupTimer.running ? qsTr("We haven't found a %1 system in your network yet.").arg(Configuration.systemName) + : qsTr("There doesn't seem to be a %1 system installed in your network. Please make sure your %1 system is correctly set up and connected.").arg(Configuration.systemName) wrapMode: Text.WordWrap } } @@ -203,7 +203,7 @@ Page { visible: !root.haveHosts Label { - text: qsTr("Searching for %1:core systems...").arg(app.systemName) + text: qsTr("Searching for %1 systems...").arg(Configuration.systemName) } BusyIndicator { @@ -221,7 +221,7 @@ Page { Layout.rightMargin: app.margins wrapMode: Text.WordWrap visible: nymeaDiscovery.nymeaHosts.count === 0 - text: qsTr("Do you have a %1:core but it's not connected to your network yet? Use the wireless setup to connect it!").arg(app.systemName) + text: qsTr("Do you have a %1 system but it's not connected to your network yet? Use the wireless setup to connect it!").arg(Configuration.systemName) } Button { Layout.fillWidth: true diff --git a/nymea-app/ui/connection/ConnectingPage.qml b/nymea-app/ui/connection/ConnectingPage.qml index 754430e1..ae9f9068 100644 --- a/nymea-app/ui/connection/ConnectingPage.qml +++ b/nymea-app/ui/connection/ConnectingPage.qml @@ -95,17 +95,17 @@ Page { errorMessage = qsTr("It seems you're not connected to the network."); break; case NymeaConnection.ConnectionStatusHostNotFound: - errorMessage = qsTr("%1:core could not be found on this address. Please make sure you entered the address correctly and that the system is powered on.").arg(app.systemName); + errorMessage = qsTr("%1 could not be found on this address. Please make sure you entered the address correctly and that the system is powered on.").arg(Configuration.systemName); break; case NymeaConnection.ConnectionStatusConnectionRefused: - errorMessage = qsTr("The host has rejected our connection. This probably means that %1 is not running on this host. Perhaps it's restarting?").arg(app.systemName); + errorMessage = qsTr("The host has rejected our connection. This probably means that %1 is not running on this host. Perhaps it's restarting?").arg(Configuration.systemName); break; case NymeaConnection.ConnectionStatusRemoteHostClosed: - errorMessage = qsTr("%1:core has closed the connection. This probably means it has been turned off or restarted.").arg(app.systemName); + errorMessage = qsTr("%1 has closed the connection. This probably means it has been turned off or restarted.").arg(Configuration.systemName); break; case NymeaConnection.ConnectionStatusTimeout: - errorMessage = qsTr("%1:core did not respond. Please make sure your network connection works properly").arg(app.systemName); + errorMessage = qsTr("%1 did not respond. Please make sure your network connection works properly").arg(Configuration.systemName); break; case NymeaConnection.ConnectionStatusSslError: errorMessage = qsTr("An unrecovareable SSL Error happened. Please make sure certificates are installed correctly."); diff --git a/nymea-app/ui/connection/LoginPage.qml b/nymea-app/ui/connection/LoginPage.qml index 13968d4c..6f7a8788 100644 --- a/nymea-app/ui/connection/LoginPage.qml +++ b/nymea-app/ui/connection/LoginPage.qml @@ -39,7 +39,7 @@ Page { signal backPressed(); header: NymeaHeader { - text: qsTr("Welcome to %1!").arg(app.systemName) + text: qsTr("Welcome to %1!").arg(Configuration.systemName) backButtonVisible: true onBackPressed: root.backPressed() } @@ -70,7 +70,7 @@ Page { message = qsTr("The password you've chose is too weak.") break; case "UserErrorBackendError": - message = qsTr("An error happened with the user storage. Please make sure your %1:core system is installed correctly.").arg(app.systemName) + message = qsTr("An error happened with the user storage. Please make sure your %1 system is installed correctly.").arg(Configuration.systemName) break; } var popup = errorDialog.createObject(root, {text: message}); @@ -102,8 +102,8 @@ Page { Label { Layout.fillWidth: true text: engine.jsonRpcClient.initialSetupRequired ? - qsTr("In order to use your %1 system, please enter your email address and set a password for it.").arg(app.systemName) - : qsTr("In order to use your %1 system, please log in.").arg(app.systemName) + qsTr("In order to use your %1 system, please enter your email address and set a password for it.").arg(Configuration.systemName) + : qsTr("In order to use your %1 system, please log in.").arg(Configuration.systemName) wrapMode: Text.WordWrap } } diff --git a/nymea-app/ui/connection/SetupWizard.qml b/nymea-app/ui/connection/SetupWizard.qml index 85c4c575..6c39066e 100644 --- a/nymea-app/ui/connection/SetupWizard.qml +++ b/nymea-app/ui/connection/SetupWizard.qml @@ -47,8 +47,8 @@ Page { EmptyViewPlaceholder { anchors.centerIn: parent width: parent.width - app.margins * 2 - title: qsTr("Welcome to %1!").arg(app.systemName) - text: qsTr("This %1 system has not been set up yet. This wizard will guide you through a few simple steps to set it up.").arg(app.systemName) + title: qsTr("Welcome to %1!").arg(Configuration.systemName) + text: qsTr("This %1 system has not been set up yet. This wizard will guide you through a few simple steps to set it up.").arg(Configuration.systemName) imageSource: "qrc:/styles/%1/logo.svg".arg(styleController.currentStyle) buttonText: qsTr("Next") onButtonClicked: { diff --git a/nymea-app/ui/connection/wifisetup/BluetoothDiscoveryPage.qml b/nymea-app/ui/connection/wifisetup/BluetoothDiscoveryPage.qml index bd24fa24..b1edc04e 100644 --- a/nymea-app/ui/connection/wifisetup/BluetoothDiscoveryPage.qml +++ b/nymea-app/ui/connection/wifisetup/BluetoothDiscoveryPage.qml @@ -116,7 +116,7 @@ Page { Layout.margins: app.margins Label { Layout.fillWidth: true - text: qsTr("Searching for %1:core systems.").arg(app.systemName) + text: qsTr("Searching for %1 systems.").arg(Configuration.systemName) wrapMode: Text.WordWrap } BusyIndicator { @@ -157,7 +157,7 @@ Page { wrapMode: Text.WordWrap maximumLineCount: 2 elide: Text.ElideRight - text: qsTr("Troubles finding your %1:core?").arg(app.systemName) + text: qsTr("Troubles finding your %1 system?").arg(Configuration.systemName) } Button { text: qsTr("Help") @@ -246,7 +246,7 @@ Page { Layout.leftMargin: app.margins Layout.rightMargin: app.margins wrapMode: Text.WordWrap - text: qsTr("If you have a %1 box, plug it into a power socket and wait for it to be booted. Once the LED pulses slowly, press the button for 3 seconds until the LED changes.").arg(app.systemName) + text: qsTr("If you have a %1 box, plug it into a power socket and wait for it to be booted. Once the LED pulses slowly, press the button for 3 seconds until the LED changes.").arg(Configuration.systemName) } Image { Layout.preferredWidth: app.iconSize * 5 diff --git a/nymea-app/ui/connection/wifisetup/ConnectWiFiPage.qml b/nymea-app/ui/connection/wifisetup/ConnectWiFiPage.qml index b1939d49..adfb6e24 100644 --- a/nymea-app/ui/connection/wifisetup/ConnectWiFiPage.qml +++ b/nymea-app/ui/connection/wifisetup/ConnectWiFiPage.qml @@ -238,7 +238,7 @@ Page { Layout.fillWidth: true wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter - text: qsTr("Connecting the %1:core to %2").arg(app.systemName).arg(connectingWifiWaitPage.ssid) + text: qsTr("Connecting %1 to %2").arg(Configuration.systemName).arg(connectingWifiWaitPage.ssid) } } } diff --git a/nymea-app/ui/connection/wifisetup/WirelessSetupPage.qml b/nymea-app/ui/connection/wifisetup/WirelessSetupPage.qml index 8aa9159f..7fb37833 100644 --- a/nymea-app/ui/connection/wifisetup/WirelessSetupPage.qml +++ b/nymea-app/ui/connection/wifisetup/WirelessSetupPage.qml @@ -120,7 +120,7 @@ Page { Layout.leftMargin: app.margins; Layout.rightMargin: app.margins wrapMode: Text.WordWrap text: root.wifiSetup.currentConnection - ? qsTr("Your %1:core is connected to %2").arg(app.systemName).arg(root.wifiSetup.currentConnection.ssid) + ? qsTr("Your %1 system is connected to %2").arg(Configuration.systemName).arg(root.wifiSetup.currentConnection.ssid) : "" } @@ -137,7 +137,7 @@ Page { spacing: app.margins Label { Layout.fillWidth: true - text: qsTr("Waiting for the %1:core to appear in your network.").arg(app.systemName) + text: qsTr("Waiting for the %1 to appear in your network.").arg(Configuration.systemName) wrapMode: Text.WordWrap } BusyIndicator { } @@ -148,7 +148,7 @@ Page { visible: host !== null Layout.fillWidth: true Layout.leftMargin: app.margins; Layout.rightMargin: app.margins - text: qsTr("Connect to %1:core").arg(app.systemName) + text: qsTr("Connect to %1").arg(Configuration.systemName) property NymeaHost host: null onClicked: { print("connecting to", host) diff --git a/nymea-app/ui/mainviews/ThingsView.qml b/nymea-app/ui/mainviews/ThingsView.qml index 13c07a7a..a076232d 100644 --- a/nymea-app/ui/mainviews/ThingsView.qml +++ b/nymea-app/ui/mainviews/ThingsView.qml @@ -73,9 +73,9 @@ MainViewBase { anchors { left: parent.left; right: parent.right; margins: app.margins } anchors.verticalCenter: parent.verticalCenter visible: engine.thingManager.things.count === 0 && !engine.thingManager.fetchingData - title: qsTr("Welcome to %1!").arg(app.systemName) + title: qsTr("Welcome to %1!").arg(Configuration.systemName) // Have that split in 2 because we need those strings separated in EditDevicesPage too and don't want translators to do them twice - text: qsTr("There are no things set up yet.") + "\n" + qsTr("In order for your %1 system to be useful, go ahead and add some things.").arg(app.systemName) + text: qsTr("There are no things set up yet.") + "\n" + qsTr("In order for your %1 system to be useful, go ahead and add some things.").arg(Configuration.systemName) imageSource: "qrc:/styles/%1/logo.svg".arg(styleController.currentStyle) buttonText: qsTr("Add things") onButtonClicked: pageStack.push(Qt.resolvedUrl("../thingconfiguration/NewThingPage.qml")) diff --git a/nymea-app/ui/system/AboutNymeaPage.qml b/nymea-app/ui/system/AboutNymeaPage.qml index d3d7930d..22265f28 100644 --- a/nymea-app/ui/system/AboutNymeaPage.qml +++ b/nymea-app/ui/system/AboutNymeaPage.qml @@ -36,13 +36,13 @@ import "../components" SettingsPageBase { id: root - title: qsTr("About %1:core").arg(app.systemName) + title: qsTr("About %1").arg(Configuration.systemName) Imprint { id: imprint Layout.fillWidth: true - title: qsTr("%1:core").arg(app.systemName) + title: qsTr("%1").arg(Configuration.systemName) githubLink: "https://github.com/nymea/nymea" NymeaSwipeDelegate { diff --git a/nymea-app/ui/system/CloudSettingsPage.qml b/nymea-app/ui/system/CloudSettingsPage.qml index dd7f2c27..970a4d89 100644 --- a/nymea-app/ui/system/CloudSettingsPage.qml +++ b/nymea-app/ui/system/CloudSettingsPage.qml @@ -36,7 +36,7 @@ import "../components" SettingsPageBase { id: root - title: qsTr("%1:core cloud settings").arg(app.systemName) + title: qsTr("%1 cloud settings").arg(Configuration.systemName) Item { id: d @@ -64,7 +64,7 @@ SettingsPageBase { Layout.fillWidth: true Layout.leftMargin: app.margins Layout.rightMargin: app.margins - text: qsTr("Connect %1:core to %1:cloud in order to access it from anywhere and send push notifications from %1:core to %2.").arg(app.systemName).arg(app.appName) + text: qsTr("Connect %1 to %1:cloud in order to access it from anywhere.").arg(Configuration.systemName).arg(Configuration.appName) wrapMode: Text.WordWrap } @@ -107,16 +107,16 @@ SettingsPageBase { text: { switch (engine.jsonRpcClient.cloudConnectionState) { case JsonRpcClient.CloudConnectionStateDisabled: - return qsTr("This box is not connected to %1:cloud").arg(app.systemName) + return qsTr("This box is not connected to %1:cloud").arg(Configuration.systemName) case JsonRpcClient.CloudConnectionStateUnconfigured: if (d.deploymentStarted) { - return qsTr("Registering box in %1:cloud...").arg(app.systemName) + return qsTr("Registering box in %1:cloud...").arg(Configuration.systemName) } - return qsTr("This box is not configured to connect to %1:cloud.").arg(app.systemName); + return qsTr("This box is not configured to connect to %1:cloud.").arg(Configuration.systemName); case JsonRpcClient.CloudConnectionStateConnecting: - return qsTr("Connecting the box to %1:cloud...").arg(app.systemName); + return qsTr("Connecting the box to %1:cloud...").arg(Configuration.systemName); case JsonRpcClient.CloudConnectionStateConnected: - return qsTr("The box is connected to %1:cloud.").arg(app.systemName); + return qsTr("The box is connected to %1:cloud.").arg(Configuration.systemName); } return engine.jsonRpcClient.cloudConnectionState } @@ -132,7 +132,7 @@ SettingsPageBase { Layout.fillWidth: true Layout.leftMargin: app.margins; Layout.rightMargin: app.margins visible: engine.jsonRpcClient.cloudConnectionState === JsonRpcClient.CloudConnectionStateUnconfigured && !d.deploymentStarted - text: qsTr("This box is not configured to access the %1:cloud. In order for a box to connect to %1:cloud it needs to be registered first.").arg(app.systemName) + text: qsTr("This box is not configured to access the %1:cloud. In order for a box to connect to %1:cloud it needs to be registered first.").arg(Configuration.systemName) wrapMode: Text.WordWrap } @@ -160,13 +160,13 @@ SettingsPageBase { Layout.leftMargin: app.margins Layout.rightMargin: app.margins wrapMode: Text.WordWrap - text: qsTr("In order to remotely connect to this %1:core, %2 needs to be logged into %1:cloud as well.").arg(app.systemName).arg(app.appName) + text: qsTr("In order to remotely connect to this %1 system, %2 needs to be logged into %1:cloud as well.").arg(Configuration.systemName).arg(Configuration.appName) } NymeaSwipeDelegate { Layout.fillWidth: true text: qsTr("Go to app settings") - subText: qsTr("Set up cloud connection for %1").arg(app.appName) + subText: qsTr("Set up cloud connection for %1").arg(Configuration.appName) prominentSubText: false onClicked: { pageStack.push(Qt.resolvedUrl("../appsettings/CloudLoginPage.qml")) diff --git a/nymea-app/ui/system/GeneralSettingsPage.qml b/nymea-app/ui/system/GeneralSettingsPage.qml index e21fcd06..0d224999 100644 --- a/nymea-app/ui/system/GeneralSettingsPage.qml +++ b/nymea-app/ui/system/GeneralSettingsPage.qml @@ -223,15 +223,15 @@ SettingsPageBase { Layout.fillWidth: true Layout.leftMargin: app.margins Layout.rightMargin: app.margins - text: qsTr("Restart %1:core").arg(app.systemName) + text: qsTr("Restart %1").arg(Configuration.systemName) visible: engine.systemController.powerManagementAvailable && engine.jsonRpcClient.ensureServerVersion("5.1") onClicked: { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("Are you sure you want to restart %1:core now?").arg(app.systemName) + var text = qsTr("Are you sure you want to restart %1 now?").arg(Configuration.systemName) var popup = dialog.createObject(app, { headerIcon: "../images/dialog-warning-symbolic.svg", - title: qsTr("Restart %1:core").arg(app.systemName), + title: qsTr("Restart %1").arg(Configuration.systemName), text: text, standardButtons: Dialog.Ok | Dialog.Cancel }); @@ -246,15 +246,15 @@ SettingsPageBase { Layout.fillWidth: true Layout.leftMargin: app.margins Layout.rightMargin: app.margins - text: qsTr("Reboot %1:core system").arg(app.systemName) + text: qsTr("Reboot %1 system").arg(Configuration.systemName) visible: engine.systemController.powerManagementAvailable onClicked: { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("Are you sure you want to reboot your %1:core sytem now?").arg(app.systemName) + var text = qsTr("Are you sure you want to reboot your %1 sytem now?").arg(Configuration.systemName) var popup = dialog.createObject(app, { headerIcon: "../images/dialog-warning-symbolic.svg", - title: qsTr("Reboot %1:core system").arg(app.systemName), + title: qsTr("Reboot %1 system").arg(Configuration.systemName), text: text, standardButtons: Dialog.Ok | Dialog.Cancel }); @@ -268,15 +268,15 @@ SettingsPageBase { Layout.fillWidth: true Layout.leftMargin: app.margins Layout.rightMargin: app.margins - text: qsTr("Shut down %1:core system").arg(app.systemName) + text: qsTr("Shut down %1 system").arg(Configuration.systemName) visible: engine.systemController.powerManagementAvailable onClicked: { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("Are you sure you want to shut down your %1:core sytem now?").arg(app.systemName) + var text = qsTr("Are you sure you want to shut down your %1 sytem now?").arg(Configuration.systemName) var popup = dialog.createObject(app, { headerIcon: "../images/dialog-warning-symbolic.svg", - title: qsTr("Shut down %1:core system").arg(app.systemName), + title: qsTr("Shut down %1 system").arg(Configuration.systemName), text: text, standardButtons: Dialog.Ok | Dialog.Cancel }); diff --git a/nymea-app/ui/system/LogViewerPage.qml b/nymea-app/ui/system/LogViewerPage.qml index a65e116d..a95230f5 100644 --- a/nymea-app/ui/system/LogViewerPage.qml +++ b/nymea-app/ui/system/LogViewerPage.qml @@ -133,7 +133,7 @@ Page { Label { Layout.fillWidth: true text: model.source === LogEntry.LoggingSourceSystem ? - qsTr("%1 Server").arg(app.systemName) + qsTr("%1 Server").arg(Configuration.systemName) : model.source === LogEntry.LoggingSourceRules ? engine.ruleManager.rules.getRule(model.typeId).name : delegate.thing.name diff --git a/nymea-app/ui/system/NetworkSettingsPage.qml b/nymea-app/ui/system/NetworkSettingsPage.qml index d16e0953..62938ccb 100644 --- a/nymea-app/ui/system/NetworkSettingsPage.qml +++ b/nymea-app/ui/system/NetworkSettingsPage.qml @@ -216,7 +216,7 @@ SettingsPageBase { onClicked: { if (!checked) { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("Disabling networking will disconnect all connected clients. Be aware that you will not be able to interact remotely with this %1 system any more. Do not proceed unless you know what your are doing.").arg(app.systemName) + var text = qsTr("Disabling networking will disconnect all connected clients. Be aware that you will not be able to interact remotely with this %1 system any more. Do not proceed unless you know what your are doing.").arg(Configuration.systemName) + "\n\n" + qsTr("Do you want to proceed?") var popup = dialog.createObject(app, @@ -291,7 +291,7 @@ SettingsPageBase { onClicked: { if (!checked) { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("Disabling WiFi will disconnect all clients connected via WiFi. Be aware that you will not be able to interact remotely with this %1 system any more unless a LAN cable is connected.").arg(app.systemName) + var text = qsTr("Disabling WiFi will disconnect all clients connected via WiFi. Be aware that you will not be able to interact remotely with this %1 system any more unless a LAN cable is connected.").arg(Configuration.systemName) + "\n\n" + qsTr("Do you want to proceed?") var popup = dialog.createObject(app, diff --git a/nymea-app/ui/system/SystemUpdatePage.qml b/nymea-app/ui/system/SystemUpdatePage.qml index efef3802..9f4d7971 100644 --- a/nymea-app/ui/system/SystemUpdatePage.qml +++ b/nymea-app/ui/system/SystemUpdatePage.qml @@ -158,7 +158,7 @@ Page { enabled: !engine.systemController.updateManagementBusy onClicked: { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1:core might not be functioning properly during this time and restart during the process.\nDo you want to proceed?").arg(app.systemName) + var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1 system might not be functioning properly during this time and restart during the process.\nDo you want to proceed?").arg(Configuration.systemName) var popup = dialog.createObject(app, { headerIcon: "../images/system-update.svg", @@ -232,7 +232,7 @@ Page { onClicked: { if (checked) { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("Enabling additional software sources allows to install unreleased %1:core packages.\nThis can potentially break your system and lead to problems.\nPlease only use this if you are sure you want this and consider reporting the issues you find when testing unreleased channels.").arg(app.systemName) + var text = qsTr("Enabling additional software sources allows to install unreleased %1 packages.\nThis can potentially break your system and lead to problems.\nPlease only use this if you are sure you want this and consider reporting the issues you find when testing unreleased channels.").arg(Configuration.systemName) var popup = dialog.createObject(app, { headerIcon: "../images/dialog-warning-symbolic.svg", @@ -358,7 +358,7 @@ Page { text: packageDetailsPage.pkg.updateAvailable ? qsTr("Update") : qsTr("Install") onClicked: { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1:core might not be functioning properly or restart during this time.").arg(app.systemName) + var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1 might not be functioning properly or restart during this time.").arg(Configuration.systemName) + "\n\n" + qsTr("\nDo you want to proceed?") var popup = dialog.createObject(app, @@ -382,7 +382,7 @@ Page { visible: packageDetailsPage.pkg.canRemove onClicked: { var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1:core might not be functioning properly during this time and restart during the process.\nDo you want to proceed?").arg(app.systemName) + var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1 system might not be functioning properly during this time and restart during the process.\nDo you want to proceed?").arg(Configuration.systemName) var popup = dialog.createObject(app, { headerIcon: "../images/system-update.svg", diff --git a/nymea-app/ui/thingconfiguration/EditThingsPage.qml b/nymea-app/ui/thingconfiguration/EditThingsPage.qml index 4f1e8a3a..8013ddd7 100644 --- a/nymea-app/ui/thingconfiguration/EditThingsPage.qml +++ b/nymea-app/ui/thingconfiguration/EditThingsPage.qml @@ -125,7 +125,7 @@ Page { anchors.verticalCenter: parent.verticalCenter visible: engine.thingManager.things.count === 0 && !engine.thingManager.fetchingData title: qsTr("There are no things set up yet.") - text: qsTr("In order for your %1 system to be useful, go ahead and add some things.").arg(app.systemName) + text: qsTr("In order for your %1 system to be useful, go ahead and add some things.").arg(Configuration.systemName) imageSource: "qrc:/styles/%1/logo.svg".arg(styleController.currentStyle) buttonText: qsTr("Add a thing") onButtonClicked: pageStack.push(Qt.resolvedUrl("NewThingPage.qml")) diff --git a/shared.pri b/shared.pri new file mode 100644 index 00000000..759fc88c --- /dev/null +++ b/shared.pri @@ -0,0 +1,54 @@ +CONFIG += c++11 + +top_srcdir=$$PWD +top_builddir=$$shadowed($$PWD) + +# Read version info from version.txt +VERSION_INFO=$$cat(version.txt) +APP_VERSION=$$member(VERSION_INFO, 0) +APP_REVISION=$$member(VERSION_INFO, 1) + +equals(OVERLAY_PATH, "") { + include(config.pri) +} else { + include($${OVERLAY_PATH}/config.pri) +} + +QMAKE_SUBSTITUTES += $${top_srcdir}/config.h.in +INCLUDEPATH += $${top_builddir} + +# We want -Wall to keep the code clean and tidy, however: +# On Windows, -Wall goes mental, so not using it there +!win32:QMAKE_CXXFLAGS += -Wall + +equals(OVERLAY_PATH, "") { + PACKAGE_BASE_DIR = $$shell_path($$PWD/packaging) +} else { + PACKAGE_BASE_DIR = $$shell_path($${OVERLAY_PATH}/packaging) +} + +# As of Qt 5.15, lots of things are deprecated inside Qt in preparation for Qt6 but no replacement to actually fix those yet. +linux:!android { + QMAKE_CXXFLAGS += -Wno-deprecated-declarations -Wno-deprecated-copy +} + +android: { + QMAKE_CXXFLAGS += -Wno-deprecated-declarations + + ANDROID_PACKAGE_SOURCE_DIR = $${PACKAGE_BASE_DIR}/android + message("Android package directory: $${ANDROID_PACKAGE_SOURCE_DIR}") + + !no-firebase:DEFINES+=WITH_FIREBASE +} + +ios: { + !no-firebase:DEFINES+=WITH_FIREBASE +} + +macx: { + MACX_PACKAGE_DIR = $${PACKAGE_BASE_DIR}/osx/ +} + +win32: { + WIN_PACKAGE_DIR = $${PACKAGE_BASE_DIR}\windows +}