2017-04-23 15:05:48 +02:00
|
|
|
#include "settings.hpp"
|
|
|
|
|
2017-06-06 13:38:15 +02:00
|
|
|
#include <QMutex>
|
2017-04-23 15:05:48 +02:00
|
|
|
#include <QStandardPaths>
|
|
|
|
|
2017-06-06 13:38:15 +02:00
|
|
|
QMutex *lock = new QMutex;
|
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
QSettings &settings::settings() {
|
2017-06-06 13:38:15 +02:00
|
|
|
QMutexLocker l(lock);
|
2017-05-09 17:26:00 +02:00
|
|
|
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
|
2017-06-04 01:04:42 +02:00
|
|
|
if (configDir.dirName() != "KShare") {
|
2017-05-09 17:26:00 +02:00
|
|
|
configDir.mkdir("KShare");
|
|
|
|
configDir.cd("KShare");
|
|
|
|
}
|
|
|
|
static QSettings settings(configDir.absoluteFilePath("settings.ini"), QSettings::IniFormat);
|
|
|
|
return settings;
|
2017-04-23 15:05:48 +02:00
|
|
|
}
|