/***************************************************************************
- * Copyright (C) 2005-2016 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
QtUiApplication::QtUiApplication(int &argc, char **argv)
#ifdef HAVE_KDE4
- : KApplication(), // KApplication is deprecated in KF5
+ : KApplication() // KApplication is deprecated in KF5
#else
- : QApplication(argc, argv),
+ : QApplication(argc, argv)
#endif
- Quassel(),
- _aboutToQuit(false)
{
#ifdef HAVE_KDE4
Q_UNUSED(argc); Q_UNUSED(argv);
}
dataDirs.removeDuplicates();
- setDataDirPaths(dataDirs);
+ Quassel::setDataDirPaths(dataDirs);
#else /* HAVE_KDE4 */
- setDataDirPaths(findDataDirPaths());
+ Quassel::setDataDirPaths(Quassel::findDataDirPaths());
#endif /* HAVE_KDE4 */
#if defined(HAVE_KDE4) || defined(Q_OS_MAC)
- disableCrashhandler();
+ Quassel::disableCrashHandler();
#endif /* HAVE_KDE4 || Q_OS_MAC */
- setRunMode(Quassel::ClientOnly);
+
+ Quassel::setRunMode(Quassel::ClientOnly);
#if QT_VERSION < 0x050000
qInstallMsgHandler(Client::logMessage);
// Some platforms don't set a default icon theme; chances are we can find our bundled theme though
QIcon::setThemeName("breeze");
- // session resume
- QtUi *gui = new QtUi();
- Client::init(gui);
- // init gui only after the event loop has started
- // QTimer::singleShot(0, gui, SLOT(init()));
- gui->init();
- resumeSessionIfPossible();
+ Client::init(new QtUi());
+
+ // Init UI only after the event loop has started
+ // TODO Qt5: Make this a lambda
+ QTimer::singleShot(0, this, SLOT(initUi()));
+
+ Quassel::registerQuitHandler([]() {
+ QtUi::mainWindow()->quit();
+ });
+
+
return true;
}
return false;
QtUiApplication::~QtUiApplication()
{
Client::destroy();
+ Quassel::destroy();
}
-void QtUiApplication::quit()
+void QtUiApplication::initUi()
{
- QtUi::mainWindow()->quit();
+ QtUi::instance()->init();
+ resumeSessionIfPossible();
}
//
// NOTE: If you increase the minor version, you MUST ALSO add new version upgrade logic in
// applySettingsMigration()! Otherwise, settings upgrades will fail.
- const uint VERSION_MINOR_CURRENT = 6;
+ const uint VERSION_MINOR_CURRENT = 7;
// Stored minor version
uint versionMinor = s.versionMinor();
// migrateSettings()! Otherwise, your upgrade logic won't ever be called.
case 7:
{
- // New default changes: ProxyType=3 (no proxy) now means QNetworkProxy::HttpProxy
- // So we have to change it to ProxyType=2 (QNetworkProxy::NoProxy)
- const QString proxyType = "ProxyType";
- if (settings.valueExists(proxyType) && settings.value(proxyType)=="3") {
- settings.setValue(proxyType, 2);
+ // New default changes: UseProxy is no longer used in CoreAccountSettings
+ CoreAccountSettings s;
+ for (auto &&accountId : s.knownAccounts()) {
+ auto map = s.retrieveAccountData(accountId);
+ if (!map.value("UseProxy", false).toBool()) {
+ map["ProxyType"] = static_cast<int>(QNetworkProxy::ProxyType::NoProxy);
+ }
+ map.remove("UseProxy");
+ s.storeAccountData(accountId, map);
}
+
// Migration complete!
return true;
}