diff options
-rw-r--r-- | common/configstore.cpp | 4 | ||||
-rw-r--r-- | common/definitions.cpp | 14 | ||||
-rw-r--r-- | common/definitions.h | 2 | ||||
-rw-r--r-- | common/log.cpp | 6 | ||||
-rw-r--r-- | common/resourceconfig.cpp | 4 |
5 files changed, 21 insertions, 9 deletions
diff --git a/common/configstore.cpp b/common/configstore.cpp index c8809ea..9a68662 100644 --- a/common/configstore.cpp +++ b/common/configstore.cpp | |||
@@ -20,15 +20,15 @@ | |||
20 | 20 | ||
21 | #include <QSettings> | 21 | #include <QSettings> |
22 | #include <QSharedPointer> | 22 | #include <QSharedPointer> |
23 | #include <QStandardPaths> | ||
24 | #include <QFile> | 23 | #include <QFile> |
25 | #include <log.h> | 24 | #include <log.h> |
25 | #include <definitions.h> | ||
26 | 26 | ||
27 | SINK_DEBUG_AREA("configstore") | 27 | SINK_DEBUG_AREA("configstore") |
28 | 28 | ||
29 | static QSharedPointer<QSettings> getConfig(const QByteArray &identifier) | 29 | static QSharedPointer<QSettings> getConfig(const QByteArray &identifier) |
30 | { | 30 | { |
31 | return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/" + identifier + ".ini", QSettings::IniFormat); | 31 | return QSharedPointer<QSettings>::create(Sink::configLocation() + "/" + identifier + ".ini", QSettings::IniFormat); |
32 | } | 32 | } |
33 | 33 | ||
34 | ConfigStore::ConfigStore(const QByteArray &identifier) | 34 | ConfigStore::ConfigStore(const QByteArray &identifier) |
diff --git a/common/definitions.cpp b/common/definitions.cpp index 362faf7..3fc4700 100644 --- a/common/definitions.cpp +++ b/common/definitions.cpp | |||
@@ -25,12 +25,22 @@ | |||
25 | 25 | ||
26 | QString Sink::storageLocation() | 26 | QString Sink::storageLocation() |
27 | { | 27 | { |
28 | return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/storage"; | 28 | return dataLocation() + "/storage"; |
29 | } | ||
30 | |||
31 | QString Sink::dataLocation() | ||
32 | { | ||
33 | return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink"; | ||
34 | } | ||
35 | |||
36 | QString Sink::configLocation() | ||
37 | { | ||
38 | return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/sink"; | ||
29 | } | 39 | } |
30 | 40 | ||
31 | QString Sink::temporaryFileLocation() | 41 | QString Sink::temporaryFileLocation() |
32 | { | 42 | { |
33 | auto path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/temporaryFiles"; | 43 | auto path = dataLocation() + "/temporaryFiles"; |
34 | //FIXME create in a singleton on startup? | 44 | //FIXME create in a singleton on startup? |
35 | QDir dir; | 45 | QDir dir; |
36 | dir.mkpath(path); | 46 | dir.mkpath(path); |
diff --git a/common/definitions.h b/common/definitions.h index 1008235..e8cd45e 100644 --- a/common/definitions.h +++ b/common/definitions.h | |||
@@ -26,6 +26,8 @@ | |||
26 | 26 | ||
27 | namespace Sink { | 27 | namespace Sink { |
28 | QString SINK_EXPORT storageLocation(); | 28 | QString SINK_EXPORT storageLocation(); |
29 | QString SINK_EXPORT dataLocation(); | ||
30 | QString SINK_EXPORT configLocation(); | ||
29 | QString SINK_EXPORT temporaryFileLocation(); | 31 | QString SINK_EXPORT temporaryFileLocation(); |
30 | QString SINK_EXPORT resourceStorageLocation(const QByteArray &resourceInstanceIdentifier); | 32 | QString SINK_EXPORT resourceStorageLocation(const QByteArray &resourceInstanceIdentifier); |
31 | } | 33 | } |
diff --git a/common/log.cpp b/common/log.cpp index a3df04c..099c043 100644 --- a/common/log.cpp +++ b/common/log.cpp | |||
@@ -4,19 +4,19 @@ | |||
4 | #include <QIODevice> | 4 | #include <QIODevice> |
5 | #include <QCoreApplication> | 5 | #include <QCoreApplication> |
6 | #include <QSettings> | 6 | #include <QSettings> |
7 | #include <QStandardPaths> | ||
8 | #include <QSharedPointer> | 7 | #include <QSharedPointer> |
9 | #include <QMutex> | 8 | #include <QMutex> |
10 | #include <QMutexLocker> | 9 | #include <QMutexLocker> |
11 | #include <iostream> | 10 | #include <iostream> |
12 | #include <unistd.h> | 11 | #include <unistd.h> |
13 | #include <memory> | 12 | #include <memory> |
13 | #include <definitions.h> | ||
14 | 14 | ||
15 | using namespace Sink::Log; | 15 | using namespace Sink::Log; |
16 | 16 | ||
17 | static QSharedPointer<QSettings> config() | 17 | static QSharedPointer<QSettings> config() |
18 | { | 18 | { |
19 | return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/log.ini", QSettings::IniFormat); | 19 | return QSharedPointer<QSettings>::create(Sink::configLocation() + "/log.ini", QSettings::IniFormat); |
20 | } | 20 | } |
21 | 21 | ||
22 | static QByteArray sPrimaryComponent; | 22 | static QByteArray sPrimaryComponent; |
@@ -223,7 +223,7 @@ static QByteArray getProgramName() | |||
223 | 223 | ||
224 | static QSharedPointer<QSettings> debugAreasConfig() | 224 | static QSharedPointer<QSettings> debugAreasConfig() |
225 | { | 225 | { |
226 | return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/debugAreas.ini", QSettings::IniFormat); | 226 | return QSharedPointer<QSettings>::create(Sink::dataLocation() + "/debugAreas.ini", QSettings::IniFormat); |
227 | } | 227 | } |
228 | 228 | ||
229 | class DebugAreaCollector { | 229 | class DebugAreaCollector { |
diff --git a/common/resourceconfig.cpp b/common/resourceconfig.cpp index a4e5fc5..39f9ddb 100644 --- a/common/resourceconfig.cpp +++ b/common/resourceconfig.cpp | |||
@@ -20,13 +20,13 @@ | |||
20 | 20 | ||
21 | #include <QSettings> | 21 | #include <QSettings> |
22 | #include <QSharedPointer> | 22 | #include <QSharedPointer> |
23 | #include <QStandardPaths> | ||
24 | #include <QFile> | 23 | #include <QFile> |
25 | #include <log.h> | 24 | #include <log.h> |
25 | #include <definitions.h> | ||
26 | 26 | ||
27 | static QSharedPointer<QSettings> getConfig(const QByteArray &identifier) | 27 | static QSharedPointer<QSettings> getConfig(const QByteArray &identifier) |
28 | { | 28 | { |
29 | return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/" + identifier + ".ini", QSettings::IniFormat); | 29 | return QSharedPointer<QSettings>::create(Sink::configLocation() +"/" + identifier + ".ini", QSettings::IniFormat); |
30 | } | 30 | } |
31 | 31 | ||
32 | QByteArray ResourceConfig::newIdentifier(const QByteArray &type) | 32 | QByteArray ResourceConfig::newIdentifier(const QByteArray &type) |