From: Manuel Nickschas Date: Wed, 21 Jan 2009 23:27:00 +0000 (+0100) Subject: Don't tinker with config and data files on Mac for now X-Git-Tag: 0.4.0~182 X-Git-Url: https://git.quassel-irc.org/?a=commitdiff_plain;h=6053070613c26ad5744d2a3e84ac5ee305a5a8d6;p=quassel.git Don't tinker with config and data files on Mac for now Still need to figure out how to behave correctly on Mac. To not break Mac builds until that's sorted, this should restore the old behavior. Disabling migration code on Mac as well. --- diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 52be52b8..50140732 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -241,17 +241,22 @@ QString Quassel::configDirPath() { _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(); diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 6b0ce039..722be0e9 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -25,6 +25,12 @@ QHash > Settings::settingsCache; QHash > 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_) @@ -56,7 +62,7 @@ void Settings::notify(const QString &key, QObject *receiver, const char *slot) { } QStringList Settings::allLocalKeys() { - QSettings s(fileName(), format()); + create_qsettings; s.beginGroup(group); QStringList res = s.allKeys(); s.endGroup(); @@ -70,7 +76,7 @@ QStringList Settings::localChildKeys(const QString &rootkey) { else g = QString("%1/%2").arg(group, rootkey); - QSettings s(fileName(), format()); + create_qsettings; s.beginGroup(g); QStringList res = s.childKeys(); s.endGroup(); @@ -84,7 +90,7 @@ QStringList Settings::localChildGroups(const QString &rootkey) { else g = QString("%1/%2").arg(group, rootkey); - QSettings s(fileName(), format()); + create_qsettings; s.beginGroup(g); QStringList res = s.childGroups(); s.endGroup(); @@ -92,7 +98,7 @@ QStringList Settings::localChildGroups(const QString &rootkey) { } void Settings::setLocalValue(const QString &key, const QVariant &data) { - QSettings s(fileName(), format()); + create_qsettings; s.beginGroup(group); s.setValue(key, data); s.endGroup(); @@ -104,7 +110,7 @@ void Settings::setLocalValue(const QString &key, const QVariant &data) { 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(); @@ -113,7 +119,7 @@ const QVariant &Settings::localValue(const QString &key, const QVariant &def) { } void Settings::removeLocalKey(const QString &key) { - QSettings s(fileName(), format()); + create_qsettings; s.beginGroup(group); s.remove(key); s.endGroup(); diff --git a/src/core/core.cpp b/src/core/core.cpp index 27243780..1e1bb61d 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -55,6 +55,8 @@ Core::Core() : storage(0) { 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 @@ -113,7 +115,7 @@ Core::Core() : storage(0) { qWarning() << "*** Migration completed.\n\n"; } } - +#endif /* !Q_WS_MAC */ // MIGRATION end // Register storage backends here! diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index 82013eb4..49eeceeb 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -64,6 +64,7 @@ QtUiApplication::QtUiApplication(int &argc, char **argv) bool QtUiApplication::init() { if(Quassel::init()) { +#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 @@ -91,7 +92,7 @@ bool QtUiApplication::init() { } qWarning() << "*** Migration completed.\n\n"; } - +#endif /* !Q_WS_MAC */ // MIGRATION end // session resume