make it possible to use different settings location
This commit is contained in:
parent
f90ccbb6b1
commit
c9270e51b4
|
@ -33,9 +33,14 @@
|
|||
using namespace Snore;
|
||||
|
||||
SnoreCorePrivate::SnoreCorePrivate():
|
||||
m_localSettingsPrefix(qApp->applicationName().isEmpty() ? QLatin1String("SnoreNotify") : qApp->applicationName()),
|
||||
m_settings(new QSettings(QLatin1String("Snorenotify"), QLatin1String("libsnore"), this))
|
||||
m_localSettingsPrefix(qApp->applicationName().isEmpty() ? QLatin1String("SnoreNotify") : qApp->applicationName())
|
||||
{
|
||||
if(!qgetenv("LIBSNORE_SETTINGS_FILE").isNull())
|
||||
{
|
||||
m_settings = new QSettings(QString::fromUtf8(qgetenv("LIBSNORE_SETTINGS_FILE")), QSettings::IniFormat);
|
||||
} else {
|
||||
m_settings = new QSettings(QLatin1String("Snorenotify"), QLatin1String("libsnore"), this);
|
||||
}
|
||||
snoreDebug(SNORE_INFO) << "Version:" << Version::version();
|
||||
if (!Version::revision().isEmpty()) {
|
||||
snoreDebug(SNORE_INFO) << "Revision:" << Version::revision();
|
||||
|
@ -189,6 +194,11 @@ void SnoreCorePrivate::syncSettings()
|
|||
}
|
||||
}
|
||||
|
||||
QSettings &SnoreCorePrivate::settings()
|
||||
{
|
||||
return *m_settings;
|
||||
}
|
||||
|
||||
void SnoreCorePrivate::setLocalSttingsPrefix(const QString &prefix)
|
||||
{
|
||||
m_localSettingsPrefix = prefix;
|
||||
|
|
|
@ -72,6 +72,9 @@ public:
|
|||
void startNotificationTimeoutTimer(Notification notification);
|
||||
|
||||
void syncSettings();
|
||||
|
||||
QSettings &settings();
|
||||
|
||||
private Q_SLOTS:
|
||||
//TODO: find a better solutinon for the slots in this section
|
||||
friend class Snore::SnoreBackend;
|
||||
|
|
|
@ -55,8 +55,7 @@ QStringList SettingsWindow::knownApps()
|
|||
|
||||
QSettings &SettingsWindow::settings()
|
||||
{
|
||||
static QSettings settings(QLatin1String("Snorenotify"), QLatin1String("libsnore"));
|
||||
return settings;
|
||||
return SnoreCorePrivate::instance()->settings();
|
||||
}
|
||||
|
||||
void SettingsWindow::on_comboBox_currentIndexChanged(const QString &arg1)
|
||||
|
|
Loading…
Reference in New Issue