# include <KStandardDirs>
#endif
+#include "chatviewsettings.h"
#include "client.h"
#include "cliparser.h"
#include "mainwin.h"
#include "qtui.h"
#include "qtuisettings.h"
+#include "types.h"
QtUiApplication::QtUiApplication(int &argc, char **argv)
#ifdef HAVE_KDE4
Quassel::setRunMode(Quassel::ClientOnly);
-#if QT_VERSION < 0x050000
- qInstallMsgHandler(Client::logMessage);
-#else
- qInstallMessageHandler(Client::logMessage);
+#if QT_VERSION >= 0x050000
connect(this, &QGuiApplication::commitDataRequest, this, &QtUiApplication::commitData, Qt::DirectConnection);
connect(this, &QGuiApplication::saveStateRequest, this, &QtUiApplication::saveState, Qt::DirectConnection);
#endif
}
-bool QtUiApplication::init()
+void QtUiApplication::init()
{
- if (Quassel::init()) {
- // Settings upgrade/downgrade handling
- if (!migrateSettings()) {
- qCritical() << "Could not load or upgrade client settings, terminating!";
- return false;
- }
+ if (!Quassel::init()) {
+ throw ExitException{EXIT_FAILURE, tr("Could not initialize Quassel!")};
+ }
- Client::init(new QtUi());
+ // Settings upgrade/downgrade handling
+ if (!migrateSettings()) {
+ throw ExitException{EXIT_FAILURE, tr("Could not load or upgrade client settings!")};
+ }
- // Init UI only after the event loop has started
- // TODO Qt5: Make this a lambda
- QTimer::singleShot(0, this, SLOT(initUi()));
+ Client::init(new QtUi());
- Quassel::registerQuitHandler([]() {
- QtUi::mainWindow()->quit();
- });
+ // Init UI only after the event loop has started
+ // TODO Qt5: Make this a lambda
+ QTimer::singleShot(0, this, SLOT(initUi()));
- return true;
- }
- return false;
+ Quassel::registerQuitHandler([]() {
+ QtUi::mainWindow()->quit();
+ });
}
//
// 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 = 8;
+ const uint VERSION_MINOR_CURRENT = 9;
// Stored minor version
uint versionMinor = s.versionMinor();
// saved. Exceptions will be noted below.
// NOTE: If you add new upgrade logic here, you MUST ALSO increase VERSION_MINOR_CURRENT in
// migrateSettings()! Otherwise, your upgrade logic won't ever be called.
+ case 9:
+ {
+ // New default changes: show highest sender prefix mode, if available
+
+ // --------
+ // ChatView settings
+ ChatViewSettings chatViewSettings;
+ const QString senderPrefixModeId = "SenderPrefixMode";
+ if (!chatViewSettings.valueExists(senderPrefixModeId)) {
+ // New default is HighestMode, preserve previous behavior by setting to NoModes
+ chatViewSettings.setValue(senderPrefixModeId,
+ static_cast<int>(UiStyle::SenderPrefixMode::NoModes));
+ }
+ // --------
+
+ // Migration complete!
+ return true;
+ }
+
case 8:
{
// New default changes: RegEx checkbox now toggles Channel regular expressions, too
// --------
// Migration complete!
+ return true;
}
case 7:
{