From: Manuel Nickschas Date: Thu, 14 Jun 2018 19:12:17 +0000 (+0200) Subject: qtui: Show core connection dialog only after initialization X-Git-Tag: travis-deploy-test~29 X-Git-Url: https://git.quassel-irc.org/?a=commitdiff_plain;h=6a95ba6273599fa24e79fb008e38197448c29605;p=quassel.git qtui: Show core connection dialog only after initialization Showing a blocking dialog in init() is a bad idea, because then initialization doesn't actually finish until the dialog is closed. For example, this delays the setup of the tray icon. Instead, go through the event loop before showing the initial connection dialog. --- diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 07c47a4d..00f83725 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -299,11 +299,7 @@ void MainWin::init() // restore locked state of docks QtUi::actionCollection("General")->action("LockLayout")->setChecked(s.value("LockLayout", false).toBool()); - CoreConnection *conn = Client::coreConnection(); - if (!conn->connectToCore()) { - // No autoconnect selected (or no accounts) - showCoreConnectionDlg(); - } + QTimer::singleShot(0, this, SLOT(doAutoConnect())); } @@ -1217,6 +1213,15 @@ void MainWin::saveMainToolBarStatus(bool enabled) } +void MainWin::doAutoConnect() +{ + if (!Client::coreConnection()->connectToCore()) { + // No autoconnect selected (or no accounts) + showCoreConnectionDlg(); + } +} + + void MainWin::connectedToCore() { Q_CHECK_PTR(Client::bufferViewManager()); diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 6f741f55..e5b6ba21 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -135,6 +135,8 @@ private slots: void showNewTransferDlg(const QUuid &transferId); void onFullScreenToggled(); + void doAutoConnect(); + void handleCoreConnectionError(const QString &errorMsg); void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage); void handleNoSslInClient(bool *accepted);