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
17751775 }
17761776 });
17771777
1778+ connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {
1779+ initializeQml();
1780+ });
1781+
17781782 // Make sure we don't time out during slow operations at startup
17791783 updateHeartbeat();
17801784 QTimer* settingsTimer = new QTimer();
17811785 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
17831787 // receiver object, otherwise it will run on the application thread and trigger a warning
17841788 // about trying to kill the timer on the main thread.
17851789 connect(qApp, &Application::beforeAboutToQuit, settingsTimer, [this, settingsTimer]{
@@ -2327,15 +2331,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 541 unmodified lines
23272331 connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);
23282332 connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
23292333 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);
23392334 #endif
23402335 }
23412336
@@ -2883,6 +2878,25 @@ void Application::initializeRenderEngine() { · 541 unmodified lines
28832878 extern void setupPreferences();
28842879 static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false);
28852880
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+
28862900 void Application::initializeUi() {
28872901 AddressBarDialog::registerType();
28882902 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