Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

[android] Extract main window flashing function

Carsten Hartenfels468aaa5a24da
diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cpp
index 305066ca54..7e4f296ce5 100644
--- a/libs/ui/KisMainWindow.cpp
+++ b/libs/ui/KisMainWindow.cpp
@@ -234,6 +234,9 @@ public:
bool firstTime {true};
bool windowSizeDirty {false};
+#ifdef Q_OS_ANDROID
+ bool flashWindowHackInProgress {false};
+#endif
KisAction *showDocumentInfo {nullptr};
KisAction *saveAction {nullptr};
@@ -1163,12 +1166,7 @@ KisView* KisMainWindow::addViewAndNotifyLoadingCompleted(KisDocument *document,
// opening a document seems to work fine on these devices though, it delays
// for a moment then displays fine, so just skip this there I guess.
if (!KisAndroidUtils::looksLikeXiaomiDevice()) {
- QTimer::singleShot(0, this, [this] {
- hide();
- QTimer::singleShot(0, this, [this] {
- show();
- });
- });
+ slotFlashWindowHack();
}
#endif
@@ -1891,6 +1889,20 @@ void KisMainWindow::slotShowDonationManagementDialog()
dlg->show();
}
}
+
+void KisMainWindow::slotFlashWindowHack()
+{
+ if (!d->flashWindowHackInProgress) {
+ d->flashWindowHackInProgress = true;
+ QTimer::singleShot(0, this, [this] {
+ hide();
+ QTimer::singleShot(0, this, [this] {
+ show();
+ d->flashWindowHackInProgress = false;
+ });
+ });
+ }
+}
#endif
KoCanvasResourceProvider *KisMainWindow::resourceManager() const
diff --git a/libs/ui/KisMainWindow.h b/libs/ui/KisMainWindow.h
index 005a83c636..74bc2ad472 100644
--- a/libs/ui/KisMainWindow.h
+++ b/libs/ui/KisMainWindow.h
@@ -258,6 +258,7 @@ public Q_SLOTS:
#ifdef Q_OS_ANDROID
void slotShowDonationManagementDialog();
+ void slotFlashWindowHack();
#endif
/**