KShare/settings.cpp

18 lines
494 B
C++
Raw Normal View History

2017-04-23 15:05:48 +02:00
#include "settings.hpp"
#include <QMutex>
2017-04-23 15:05:48 +02:00
#include <QStandardPaths>
QMutex *lock = new QMutex;
2017-05-06 13:21:12 +02:00
QSettings &settings::settings() {
QMutexLocker l(lock);
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
if (configDir.dirName() != "KShare") {
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
}