#include "settings.h"
+const int VERSION = 1;
+
QHash<QString, QHash<QString, QVariant> > Settings::settingsCache;
QHash<QString, QHash<QString, SettingsChangeNotifier *> > Settings::settingsChangeNotifier;
receiver, slot);
}
+uint Settings::version() {
+ // we don't cache this value, and we ignore the group
+ create_qsettings;
+ uint ver = s.value("Config/Version", 0).toUInt();
+ if(!ver) {
+ // No version, so create one
+ s.setValue("Config/Version", VERSION);
+ return VERSION;
+ }
+ return ver;
+}
+
QStringList Settings::allLocalKeys() {
create_qsettings;
s.beginGroup(group);
public:
virtual void notify(const QString &key, QObject *receiver, const char *slot);
+ virtual uint version();
protected:
inline Settings(QString group_, QString appName_) : group(group_), appName(appName_) {}
QSettings newSettings(newFilePath, format);
#endif /* Q_WS_MAC */
- if(newSettings.value("Config/Version").toUInt() != 1) {
+ if(newSettings.value("Config/Version").toUInt() == 0) {
qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your core settings...";
# ifdef Q_WS_MAC
QString org = "quassel-irc.org";
#endif /* !Q_WS_MAC */
// MIGRATION end
+ // check settings version
+ // so far, we only have 1
+ CoreSettings s;
+ if(s.version() != 1) {
+ qCritical() << "Invalid core settings version, terminating!";
+ exit(EXIT_FAILURE);
+ }
+
// Register storage backends here!
registerStorageBackend(new SqliteStorage(this));
#include "client.h"
#include "cliparser.h"
#include "qtui.h"
+#include "qtuisettings.h"
#include "sessionsettings.h"
QtUiApplication::QtUiApplication(int &argc, char **argv)
QSettings newSettings(newFilePath, format);
#endif /* Q_WS_MAC */
- if(newSettings.value("Config/Version").toUInt() != 1) {
+ if(newSettings.value("Config/Version").toUInt() == 0) {
qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your client settings...";
# ifdef Q_WS_MAC
QString org = "quassel-irc.org";
// MIGRATION end
+ // check settings version
+ // so far, we only have 1
+ QtUiSettings s;
+ if(s.version() != 1) {
+ qCritical() << "Invalid client settings version, terminating!";
+ return false;
+ }
+
// session resume
QtUi *gui = new QtUi();
Client::init(gui);