Skip to content

Android port on stable branch

Sharaf Zaman requested to merge szaman/krita:krita/4.2 into krita/4.2

To the best of my effort, while reviewing, I tried to see what changes to Krita Android also changed the Desktop version. I have pasted the patches below which also change Desktop Krita, if upon testing it is found it is not something stable, I can rebase and change it again.

Reason: On Android to make Krita fullscreen, there is a button on the bottom, which when pressed, did make it fullscreen however it didn't change the checkmark in Menu (i.e View -> Full Screen Mode).

diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cpp
index 8698ff6be6..714619c856 100644
--- a/libs/ui/KisMainWindow.cpp
+++ b/libs/ui/KisMainWindow.cpp
@@ -1967,6 +1967,7 @@ void KisMainWindow::viewFullscreen(bool fullScreen)
     } else {
         setWindowState(windowState() & ~Qt::WindowFullScreen);   // reset
     }
+    d->fullScreenMode->setChecked(isFullScreen());
 }

When Krita Android would start for the first time, the flag would be OPENGL_NOT_TRIED. However, sometimes if Krita crashed the first time, settings won't be saved and flag would next be set to OPENGL_FAILED.

diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index 80eac2a1e4..9c3c8f7e4f 100644
--- a/libs/ui/KisApplication.cpp
+++ b/libs/ui/KisApplication.cpp
@@ -366,7 +366,7 @@ bool KisApplication::start(const KisApplicationArguments &args)
     if (opengl == "OPENGL_NOT_TRIED" ) {
         cfg.setCanvasState("TRY_OPENGL");
     }
-    else if (opengl != "OPENGL_SUCCESS") {
+    else if (opengl != "OPENGL_SUCCESS" && opengl != "TRY_OPENGL") {
         cfg.setCanvasState("OPENGL_FAILED");
     }

Please read commit message for the reason: 3613f13c72bd6840e2eb6122c5af6a8413836c37

diff --git a/libs/ui/widgets/kis_floating_message.cpp b/libs/ui/widgets/kis_floating_message.cpp
index 86e248c5d5..4dbe9ba964 100644
--- a/libs/ui/widgets/kis_floating_message.cpp
+++ b/libs/ui/widgets/kis_floating_message.cpp
@@ -128,6 +128,7 @@ KisFloatingMessage::KisFloatingMessage(const QString &message, QWidget *parent,
     , m_timeout(timeout)
     , m_priority(priority)
     , m_alignment(alignment)
+    , widgetQueuedForDeletion(false)
 {
     m_icon = KisIconUtils::loadIcon("krita").pixmap(256, 256).toImage();
 
@@ -139,6 +140,7 @@ KisFloatingMessage::KisFloatingMessage(const QString &message, QWidget *parent,
 
     m_timer.setSingleShot( true );
     connect(&m_timer, SIGNAL(timeout()), SLOT(startFade()));
+    connect(this, SIGNAL(destroyed()), SLOT(widgetDeleted()));
 }
 
 void KisFloatingMessage::tryOverrideMessage(const QString message,
@@ -160,6 +162,7 @@ void KisFloatingMessage::tryOverrideMessage(const QString message,
 
 void KisFloatingMessage::showMessage()
 {
+    if (widgetQueuedForDeletion) return;
 
     setGeometry(determineMetrics(fontMetrics().width('x')));
     setWindowOpacity(OSD_WINDOW_OPACITY);
@@ -320,6 +323,7 @@ void KisFloatingMessage::removeMessage()
 {
     m_timer.stop();
     m_fadeTimeLine.stop();
+    widgetQueuedForDeletion = true;
 
     hide();
     deleteLater();
@@ -329,3 +333,8 @@ void KisFloatingMessage::updateOpacity(int /*value*/)
 {
     setWindowOpacity(OSD_WINDOW_OPACITY - 0.1);
 }
+
+void KisFloatingMessage::widgetDeleted()
+{
+    widgetQueuedForDeletion = false;
+}


diff --git a/libs/ui/widgets/kis_floating_message.h b/libs/ui/widgets/kis_floating_message.h
index 7c961ed076..305a2cdaa7 100644
--- a/libs/ui/widgets/kis_floating_message.h
+++ b/libs/ui/widgets/kis_floating_message.h
@@ -75,6 +75,7 @@ public Q_SLOTS:
 private Q_SLOTS:
     void startFade();
     void updateOpacity(int value);
+    void widgetDeleted();
 private:
 
     QRect determineMetrics(const int M);
@@ -89,6 +90,7 @@ private:
     int m_timeout;
     Priority m_priority;
     int m_alignment;
+    bool widgetQueuedForDeletion;
 };
Edited by Sharaf Zaman

Merge request reports

Loading