_configDirPath = Quassel::optionValue("configdir");
} else {
- // We abuse QSettings to find us a sensible path on all platforms
-#ifdef Q_WS_WIN
+#ifdef Q_WS_MAC
+ // On Mac, the path is always the same
+ _configDirPath = QDir::homePath() + "/Library/Application Support/Quassel/";
+#else
+ // We abuse QSettings to find us a sensible path on the other platforms
+# ifdef Q_WS_WIN
// don't use the registry
QSettings::Format format = QSettings::IniFormat;
-#else
+# else
QSettings::Format format = QSettings::NativeFormat;
-#endif
+# endif
QSettings s(format, QSettings::UserScope, QCoreApplication::organizationDomain(), buildInfo().applicationName);
QFileInfo fileInfo(s.fileName());
_configDirPath = fileInfo.dir().absolutePath();
}
+#endif /* Q_WS_MAC */
if(!_configDirPath.endsWith(QDir::separator()) && !_configDirPath.endsWith('/'))
_configDirPath += QDir::separator();
QHash<QString, QHash<QString, QVariant> > Settings::settingsCache;
QHash<QString, QHash<QString, SettingsChangeNotifier *> > Settings::settingsChangeNotifier;
+#ifdef Q_WS_MAC
+# define create_qsettings QSettings s(QCoreApplication::organizationDomain(), appName)
+#else
+# define create_qsettings QSettings s(fileName(), format())
+#endif
+
// Settings::Settings(QString group_, QString appName_)
// : group(group_),
// appName(appName_)
}
QStringList Settings::allLocalKeys() {
- QSettings s(fileName(), format());
+ create_qsettings;
s.beginGroup(group);
QStringList res = s.allKeys();
s.endGroup();
else
g = QString("%1/%2").arg(group, rootkey);
- QSettings s(fileName(), format());
+ create_qsettings;
s.beginGroup(g);
QStringList res = s.childKeys();
s.endGroup();
else
g = QString("%1/%2").arg(group, rootkey);
- QSettings s(fileName(), format());
+ create_qsettings;
s.beginGroup(g);
QStringList res = s.childGroups();
s.endGroup();
}
void Settings::setLocalValue(const QString &key, const QVariant &data) {
- QSettings s(fileName(), format());
+ create_qsettings;
s.beginGroup(group);
s.setValue(key, data);
s.endGroup();
const QVariant &Settings::localValue(const QString &key, const QVariant &def) {
if(!isCached(group, key)) {
- QSettings s(fileName(), format());
+ create_qsettings;
s.beginGroup(group);
setCacheValue(group, key, s.value(key, def));
s.endGroup();
}
void Settings::removeLocalKey(const QString &key) {
- QSettings s(fileName(), format());
+ create_qsettings;
s.beginGroup(group);
s.remove(key);
s.endGroup();
loadTranslation(QLocale::system());
+#ifndef Q_WS_MAC
+
// FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
// Move settings, note this does not delete the old files
#ifdef Q_WS_WIN
qWarning() << "*** Migration completed.\n\n";
}
}
-
+#endif /* !Q_WS_MAC */
// MIGRATION end
// Register storage backends here!