aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kampas <martin.kampas@jolla.com>2016-09-22 11:03:33 +0200
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-10-06 12:42:30 +0000
commitbd618d3f72fb77b3c0f8d076d13f9f09517638fa (patch)
tree4dad6668ae207057cdfdd9ec221963c9e13524c3
parent4d30e91bff1cbd8f2411bda769fdce594ee38b1a (diff)
Allow to override default QSettings location
Inspired by Qt Creator's IDE_SETTINGSVARIANT. Useful when distributing QmlLive as part of a development kit, to separate settings from other QmlLive installations installed on the same workstation. This is achieved by setting QCoreApplication::organizationName. This property is dedicated for use by QSettings when it is constructed using the default constructor. Change-Id: I6f0d273fbbd89d23289618b0d3a061c1f797a585 Reviewed-by: Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>
-rw-r--r--doc/installation.qdoc5
-rw-r--r--qmllive.pri1
-rw-r--r--src/bench/main.cpp6
-rw-r--r--src/qmllive_version.h8
-rw-r--r--src/runtime/main.cpp6
5 files changed, 20 insertions, 6 deletions
diff --git a/doc/installation.qdoc b/doc/installation.qdoc
index 47c950c..bed44d8 100644
--- a/doc/installation.qdoc
+++ b/doc/installation.qdoc
@@ -143,6 +143,11 @@ The following custom qmake variables are recognized:
\row
\li QMLLIVE_REVISION
\li The VCS revision number.
+
+\row
+ \li QMLLIVE_SETTINGS_VARIANT
+ \li Overrides \c QCoreApplication::organizationName which is used to determine
+ application specific \c QSettings storage.
\endtable
diff --git a/qmllive.pri b/qmllive.pri
index 1d15253..fc7f480 100644
--- a/qmllive.pri
+++ b/qmllive.pri
@@ -14,6 +14,7 @@ unset(VERSIONS)
DEFINES += QMLLIVE_VERSION=$$VERSION
!isEmpty(QMLLIVE_VERSION_EXTRA): DEFINES += QMLLIVE_VERSION_EXTRA="\"$$QMLLIVE_VERSION_EXTRA\""
!isEmpty(QMLLIVE_REVISION): DEFINES += QMLLIVE_REVISION=$$QMLLIVE_REVISION
+!isEmpty(QMLLIVE_SETTINGS_VARIANT): DEFINES += QMLLIVE_SETTINGS_VARIANT=$$QMLLIVE_SETTINGS_VARIANT
# from qtcreator.pri
defineTest(minQtVersion) {
diff --git a/src/bench/main.cpp b/src/bench/main.cpp
index 19db787..18337a1 100644
--- a/src/bench/main.cpp
+++ b/src/bench/main.cpp
@@ -34,7 +34,7 @@
#include "options.h"
#include "mainwindow.h"
-
+#include "qmllive_version.h"
static void setDarkStyle(QApplication *app)
{
@@ -124,8 +124,8 @@ int main(int argc, char** argv)
{
QApplication app(argc, argv);
app.setApplicationName("QmlLiveBench");
- app.setOrganizationDomain("pelagicore.com");
- app.setOrganizationName("Pelagicore");
+ app.setOrganizationDomain(QLatin1String(QMLLIVE_ORGANIZATION_DOMAIN));
+ app.setOrganizationName(QLatin1String(QMLLIVE_ORGANIZATION_NAME));
app.setAttribute(Qt::AA_NativeWindows, true);
app.setAttribute(Qt::AA_ImmediateWidgetCreation, true);
diff --git a/src/qmllive_version.h b/src/qmllive_version.h
index 96ad1c2..5b5be59 100644
--- a/src/qmllive_version.h
+++ b/src/qmllive_version.h
@@ -48,3 +48,11 @@ const char *const QMLLIVE_REVISION_STR = QT_STRINGIFY(QMLLIVE_REVISION);
#else
const char *const QMLLIVE_REVISION_STR = "";
#endif
+
+#ifdef QMLLIVE_SETTINGS_VARIANT
+const char *const QMLLIVE_ORGANIZATION_NAME = QT_STRINGIFY(QMLLIVE_SETTINGS_VARIANT);
+const char *const QMLLIVE_ORGANIZATION_DOMAIN = "";
+#else
+const char *const QMLLIVE_ORGANIZATION_NAME = "Pelagicore";
+const char *const QMLLIVE_ORGANIZATION_DOMAIN = "pelagicore.com";
+#endif
diff --git a/src/runtime/main.cpp b/src/runtime/main.cpp
index 89acda8..db26054 100644
--- a/src/runtime/main.cpp
+++ b/src/runtime/main.cpp
@@ -37,7 +37,7 @@
#include "remotereceiver.h"
#include "logger.h"
#include "qmlhelper.h"
-
+#include "qmllive_version.h"
struct Options
{
@@ -166,8 +166,8 @@ int main(int argc, char** argv)
{
QGuiApplication app(argc, argv);
app.setApplicationName("QmlLiveRuntime");
- app.setOrganizationDomain("pelagicore.com");
- app.setOrganizationName("Pelagicore");
+ app.setOrganizationDomain(QLatin1String(QMLLIVE_ORGANIZATION_DOMAIN));
+ app.setOrganizationName(QLatin1String(QMLLIVE_ORGANIZATION_NAME));
parseArguments(app.arguments());