History

adding initialization of qml when keyboard ready

Wayne Chen committed 8 years ago

Commit 60bbcc71 parent ccebf3e4 files · +41 −20Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+24−10
@@ -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 // Make sure we don't time out during slow operations at startup1782 // Make sure we don't time out during slow operations at startup
1779 updateHeartbeat();1783 updateHeartbeat();
1780 QTimer* settingsTimer = new QTimer();1784 QTimer* settingsTimer = new QTimer();
1781 moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{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 // receiver object, otherwise it will run on the application thread and trigger a warning1787 // receiver object, otherwise it will run on the application thread and trigger a warning
1784 // about trying to kill the timer on the main thread.1788 // about trying to kill the timer on the main thread.
1785 connect(qApp, &Application::beforeAboutToQuit, settingsTimer, [this, settingsTimer]{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 connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);2331 connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);
2328 connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);2332 connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
2329 AndroidHelper::instance().notifyLoadComplete();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#endif2334#endif
2340}2335}
2341 2336
@@ -2883,6 +2878,25 @@ void Application::initializeRenderEngine() { · 541 unmodified lines
2883extern void setupPreferences();2878extern void setupPreferences();
2884static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false);2879static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false);
2885 2880
2881void 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
2886void Application::initializeUi() {2900void Application::initializeUi() {
2887 AddressBarDialog::registerType();2901 AddressBarDialog::registerType();
2888 ErrorDialog::registerType();2902 ErrorDialog::registerType();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t