Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -1775,11 +1775,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1774 unmodified lines | ||
| 1775 | 1775 | } |
| 1776 | 1776 | }); |
| 1777 | 1777 | |
| 1778 | + connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() { | |
| 1779 | + initializeQml(); | |
| 1780 | + }); | |
| 1781 | + | |
| 1778 | 1782 | // Make sure we don't time out during slow operations at startup |
| 1779 | 1783 | updateHeartbeat(); |
| 1780 | 1784 | QTimer* settingsTimer = new QTimer(); |
| 1781 | 1785 | moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{ |
| 1782 | − // This needs to run on the settings thread, so we need to pass the `settingsTimer` as the | |
| 1786 | + // This needs to run on the settings thread, so we need to pass the `settingsTimer` as the | |
| 1783 | 1787 | // receiver object, otherwise it will run on the application thread and trigger a warning |
| 1784 | 1788 | // about trying to kill the timer on the main thread. |
| 1785 | 1789 | connect(qApp, &Application::beforeAboutToQuit, settingsTimer, [this, settingsTimer]{ |
| @@ -2327,15 +2331,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 541 unmodified lines | ||
| 2327 | 2331 | connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground); |
| 2328 | 2332 | connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground); |
| 2329 | 2333 | AndroidHelper::instance().notifyLoadComplete(); |
| 2330 | −#else | |
| 2331 | − if (!accountManager->isLoggedIn()) { | |
| 2332 | − Setting::Handle<bool>{"loginDialogPoppedUp", false}.set(true); | |
| 2333 | − dialogsManager->showLoginDialog(); | |
| 2334 | − QJsonObject loginData = {}; | |
| 2335 | − loginData["action"] = "login dialog shown"; | |
| 2336 | − UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData); | |
| 2337 | − } | |
| 2338 | − Setting::Handle<bool>{"loginDialogPoppedUp", false}.set(false); | |
| 2339 | 2334 | #endif |
| 2340 | 2335 | } |
| 2341 | 2336 | |
| @@ -2883,6 +2878,25 @@ void Application::initializeRenderEngine() { · 541 unmodified lines | ||
| 2883 | 2878 | extern void setupPreferences(); |
| 2884 | 2879 | static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false); |
| 2885 | 2880 | |
| 2881 | +void Application::initializeQml() { | |
| 2882 | + if (QThread::currentThread() != thread()) { | |
| 2883 | + QMetaObject::invokeMethod(this, "initializeQml"); | |
| 2884 | + return; | |
| 2885 | + } | |
| 2886 | +#if !defined(Q_OS_ANDROID) | |
| 2887 | + auto accountManager = DependencyManager::get<AccountManager>(); | |
| 2888 | + auto dialogsManager = DependencyManager::get<DialogsManager>(); | |
| 2889 | + if (!accountManager->isLoggedIn()) { | |
| 2890 | + Setting::Handle<bool>{"loginDialogPoppedUp", false}.set(true); | |
| 2891 | + dialogsManager->showLoginDialog(); | |
| 2892 | + QJsonObject loginData = {}; | |
| 2893 | + loginData["action"] = "login dialog shown"; | |
| 2894 | + UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData); | |
| 2895 | + } | |
| 2896 | + Setting::Handle<bool>{"loginDialogPoppedUp", false}.set(false); | |
| 2897 | +#endif | |
| 2898 | +} | |
| 2899 | + | |
| 2886 | 2900 | void Application::initializeUi() { |
| 2887 | 2901 | AddressBarDialog::registerType(); |
| 2888 | 2902 | ErrorDialog::registerType(); |