[neon/backports-noble/kimageannotator-noble/Neon/release] /: New upstream version 0.5.3

Boyuan Yang null at kde.org
Wed Jul 3 14:54:15 BST 2024


Git commit 7acd650d0581c2f41917ce25a0711bbe8d883395 by Boyuan Yang.
Committed on 23/11/2021 at 21:38.
Pushed by jriddell into branch 'Neon/release'.

New upstream version 0.5.3

M  +4    -0    CHANGELOG.md
M  +1    -1    CMakeLists.txt
M  +1    -1    README.md
M  +1    -0    src/CMakeLists.txt
M  +9    -12   src/annotations/items/AnnotationPixelate.cpp
M  +17   -13   src/annotations/items/text/CapsLockStatusChecker.cpp
M  +0    -4    src/annotations/items/text/CapsLockStatusChecker.h
M  +1    -1    src/annotations/items/text/KeyInputHelper.cpp
M  +1    -1    src/annotations/items/text/KeyInputHelper.h
C  +16   -16   src/common/platform/PlatformChecker.cpp [from: src/annotations/items/text/CapsLockStatusChecker.h - 065% similarity]
C  +15   -12   src/common/platform/PlatformChecker.h [from: src/annotations/items/text/CapsLockStatusChecker.h - 066% similarity]
M  +1    -0    src/gui/annotator/docks/AbstractAnnotationDockWidgetContent.h
M  +7    -3    src/gui/annotator/settings/AnnotationToolSelection.cpp
M  +1    -0    src/gui/annotator/settings/AnnotationToolSelection.h
M  +21   -19   translations/kImageAnnotator_el.ts

https://invent.kde.org/neon/backports-noble/kimageannotator-noble/-/commit/7acd650d0581c2f41917ce25a0711bbe8d883395

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c848aa..8dab88a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Change log
 
+## Release 0.5.3
+* Fixed: Crash while typing text on wayland. ([#256](https://github.com/ksnip/kImageAnnotator/issues/256))
+* Changed: Show scrollbar when not all tools visible. ([#258](https://github.com/ksnip/kImageAnnotator/issues/258))
+
 ## Release 0.5.2
 * Fixed: Memory leaks caught by ASAN. ([#243](https://github.com/ksnip/kImageAnnotator/issues/243))
 * Changed: Use system font provided by QGuiApplication as default for text tool. ([#247](https://github.com/ksnip/kImageAnnotator/issues/247))
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53c9449..4f9dc0c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.5)
-project(kImageAnnotator LANGUAGES CXX VERSION 0.5.2)
+project(kImageAnnotator LANGUAGES CXX VERSION 0.5.3)
 
 set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
diff --git a/README.md b/README.md
index 518491f..d221eb0 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 # kImageAnnotator [![Build Status][github-badge]][github-url] [![Translation status][weblate-badge]][weblate-url]
 Tool for annotating images
 
-Version 0.5.2
+Version 0.5.3
 
 ![kImageAnnotator](https://i.imgur.com/4vlPDUn.png "kImageAnnotator")
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 81afa53..cab541e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -128,6 +128,7 @@ set(KIMAGEANNOTATOR_SRCS
 	${CMAKE_CURRENT_SOURCE_DIR}/common/helper/PathHelper.cpp
 	${CMAKE_CURRENT_SOURCE_DIR}/common/filter/IgnoreShortcutsFilter.cpp
 	${CMAKE_CURRENT_SOURCE_DIR}/common/filter/KeyEventListener.cpp
+	${CMAKE_CURRENT_SOURCE_DIR}/common/platform/PlatformChecker.cpp
 	${CMAKE_CURRENT_SOURCE_DIR}/widgets/ToolPicker.cpp
 	${CMAKE_CURRENT_SOURCE_DIR}/widgets/CustomFontComboBox.cpp
 	${CMAKE_CURRENT_SOURCE_DIR}/widgets/CustomSpinBox.cpp
diff --git a/src/annotations/items/AnnotationPixelate.cpp b/src/annotations/items/AnnotationPixelate.cpp
index 59d3d39..ffe9ec0 100644
--- a/src/annotations/items/AnnotationPixelate.cpp
+++ b/src/annotations/items/AnnotationPixelate.cpp
@@ -39,18 +39,15 @@ Tools AnnotationPixelate::toolType() const
 
 QImage AnnotationPixelate::obfuscateBackground(const QImage &sceneBehindItem) const
 {
-	auto width = sceneBehindItem.width();
-	auto factor = obfuscateProperties()->factor();
-	auto intensity = abs(factor - 21) * 0.01;
-	auto scaledWidth = width * intensity;
-
-	if(scaledWidth < 1) {
-		return sceneBehindItem;
-	}
-
-	auto result   = sceneBehindItem.convertToFormat( QImage::Format_ARGB32_Premultiplied );
-	result = result.scaledToWidth(scaledWidth, Qt::FastTransformation );
-	result = result.scaledToWidth(width, Qt::FastTransformation );
+    auto result = sceneBehindItem.convertToFormat( QImage::Format_ARGB32_Premultiplied );
+    auto factor = obfuscateProperties()->factor();
+
+    int width  = sceneBehindItem.width() * (0.5 / qMax(1, factor));
+    int height = sceneBehindItem.height() * (0.5 / qMax(1, factor));
+    QSize size  = QSize(qMax(width, 1), qMax(height, 1));
+
+    result = result.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+    result = result.scaled(sceneBehindItem.width(), sceneBehindItem.height());
 
 	return result;
 }
diff --git a/src/annotations/items/text/CapsLockStatusChecker.cpp b/src/annotations/items/text/CapsLockStatusChecker.cpp
index e73eb4c..8bf9843 100644
--- a/src/annotations/items/text/CapsLockStatusChecker.cpp
+++ b/src/annotations/items/text/CapsLockStatusChecker.cpp
@@ -19,13 +19,13 @@
 
 #include "CapsLockStatusChecker.h"
 
-/*
- * Currently we need to keep the x11 include in the definition
- * file as x11 and qt::cursor don't work together and we fail
- * to compile
- */
+#if defined(_WIN32)
+#include <Windows.h>
+#endif
 
 #if defined(__linux__)
+#include "src/common/platform/PlatformChecker.h"
+
 #include <X11/Xlib.h>
 #include <X11/XKBlib.h>
 #endif
@@ -37,15 +37,19 @@ bool CapsLockStatusChecker::isCapsLockEnabled()
 #if defined(_WIN32)
 	return GetKeyState(VK_CAPITAL) == 1;
 #elif defined(__linux__)
-	auto display = XOpenDisplay(nullptr);
-	auto capsState = false;
-	if (display) {
-		unsigned n;
-		XkbGetIndicatorState(display, XkbUseCoreKbd, &n);
-		capsState = (n & 0x01) == 1;
+	if (PlatformChecker::instance()->isWayland()) {
+		return false;
+	} else {
+		auto display = XOpenDisplay(nullptr);
+		auto capsState = false;
+		if (display) {
+			unsigned n;
+			XkbGetIndicatorState(display, XkbUseCoreKbd, &n);
+			capsState = (n & 0x01) == 1;
+		}
+		XCloseDisplay(display);
+		return capsState;
 	}
-	XCloseDisplay(display);
-	return capsState;
 #else
 	return false;
 #endif
diff --git a/src/annotations/items/text/CapsLockStatusChecker.h b/src/annotations/items/text/CapsLockStatusChecker.h
index 41e821d..9ef68ed 100644
--- a/src/annotations/items/text/CapsLockStatusChecker.h
+++ b/src/annotations/items/text/CapsLockStatusChecker.h
@@ -20,10 +20,6 @@
 #ifndef KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
 #define KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
 
-#if defined(_WIN32)
-#include <Windows.h>
-#endif
-
 namespace kImageAnnotator {
 
 class CapsLockStatusChecker
diff --git a/src/annotations/items/text/KeyInputHelper.cpp b/src/annotations/items/text/KeyInputHelper.cpp
index 877382a..5a92fdb 100644
--- a/src/annotations/items/text/KeyInputHelper.cpp
+++ b/src/annotations/items/text/KeyInputHelper.cpp
@@ -21,7 +21,7 @@
 
 namespace kImageAnnotator {
 
-void KeyInputHelper::handleKeyPress(const QKeyEvent *event)
+void KeyInputHelper::handleKeyPress(const QKeyEvent *event) const
 {
 	switch (event->key()) {
 		case Qt::Key_Backspace:
diff --git a/src/annotations/items/text/KeyInputHelper.h b/src/annotations/items/text/KeyInputHelper.h
index ccb6b39..d619cee 100644
--- a/src/annotations/items/text/KeyInputHelper.h
+++ b/src/annotations/items/text/KeyInputHelper.h
@@ -33,7 +33,7 @@ Q_OBJECT
 public:
 	explicit KeyInputHelper() = default;
 	~KeyInputHelper() override = default;
-	void handleKeyPress(const QKeyEvent *event);
+	void handleKeyPress(const QKeyEvent *event) const;
 	bool isShiftPressed(const QKeyEvent *event) const;
 	bool isControlPressed(const QKeyEvent *event) const;
 	QString getTextWithCorrectCase(const QKeyEvent *event) const;
diff --git a/src/annotations/items/text/CapsLockStatusChecker.h b/src/common/platform/PlatformChecker.cpp
similarity index 65%
copy from src/annotations/items/text/CapsLockStatusChecker.h
copy to src/common/platform/PlatformChecker.cpp
index 41e821d..983af38 100644
--- a/src/annotations/items/text/CapsLockStatusChecker.h
+++ b/src/common/platform/PlatformChecker.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Damir Porobic <damir.porobic at gmx.com>
+ * Copyright (C) 2021 Damir Porobic <damir.porobic at gmx.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -17,25 +17,25 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
-#define KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
-
-#if defined(_WIN32)
-#include <Windows.h>
-#endif
+#include "PlatformChecker.h"
 
 namespace kImageAnnotator {
 
-class CapsLockStatusChecker
+PlatformChecker *PlatformChecker::instance()
 {
-public:
-	static bool isCapsLockEnabled();
+	static PlatformChecker instance;
+	return &instance;
+}
 
-protected:
-	explicit CapsLockStatusChecker() = default;
-	~CapsLockStatusChecker() = default;
-};
+bool PlatformChecker::isWayland() const
+{
+	return mIsWayland;
+}
 
-} // namespace kImageAnnotator
+PlatformChecker::PlatformChecker()
+{
+	auto output = qgetenv("XDG_CURRENT_DESKTOP");
+	mIsWayland = output.contains("wayland");
+}
 
-#endif //KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
+} // namespace kImageAnnotator
diff --git a/src/annotations/items/text/CapsLockStatusChecker.h b/src/common/platform/PlatformChecker.h
similarity index 66%
copy from src/annotations/items/text/CapsLockStatusChecker.h
copy to src/common/platform/PlatformChecker.h
index 41e821d..33e86c7 100644
--- a/src/annotations/items/text/CapsLockStatusChecker.h
+++ b/src/common/platform/PlatformChecker.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Damir Porobic <damir.porobic at gmx.com>
+ * Copyright (C) 2021 Damir Porobic <damir.porobic at gmx.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -17,25 +17,28 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
-#define KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
+#ifndef KIMAGEANNOTATOR_PLATFORMCHECKER_H
+#define KIMAGEANNOTATOR_PLATFORMCHECKER_H
 
-#if defined(_WIN32)
-#include <Windows.h>
-#endif
+#include <QString>
 
 namespace kImageAnnotator {
 
-class CapsLockStatusChecker
+class PlatformChecker
 {
 public:
-	static bool isCapsLockEnabled();
+	virtual ~PlatformChecker() = default;
 
-protected:
-	explicit CapsLockStatusChecker() = default;
-	~CapsLockStatusChecker() = default;
+	static PlatformChecker *instance();
+
+	bool isWayland() const;
+
+private:
+	bool mIsWayland;
+
+	PlatformChecker();
 };
 
 } // namespace kImageAnnotator
 
-#endif //KIMAGEANNOTATOR_CAPSLOCKSTATUSCHECKER_H
+#endif //KIMAGEANNOTATOR_PLATFORMCHECKER_H
diff --git a/src/gui/annotator/docks/AbstractAnnotationDockWidgetContent.h b/src/gui/annotator/docks/AbstractAnnotationDockWidgetContent.h
index c93105f..8d45709 100644
--- a/src/gui/annotator/docks/AbstractAnnotationDockWidgetContent.h
+++ b/src/gui/annotator/docks/AbstractAnnotationDockWidgetContent.h
@@ -23,6 +23,7 @@
 #include <QWidget>
 #include <QBoxLayout>
 #include <QList>
+#include <QScrollArea>
 
 #include "src/widgets/misc/AbstractExpandingWidget.h"
 
diff --git a/src/gui/annotator/settings/AnnotationToolSelection.cpp b/src/gui/annotator/settings/AnnotationToolSelection.cpp
index 84991cc..dd7c047 100644
--- a/src/gui/annotator/settings/AnnotationToolSelection.cpp
+++ b/src/gui/annotator/settings/AnnotationToolSelection.cpp
@@ -23,9 +23,13 @@ namespace kImageAnnotator {
 
 AnnotationToolSelection::AnnotationToolSelection() :
 	mMainLayout(new QVBoxLayout),
-	mToolPicker(new ToolPicker(this))
+	mToolPicker(new ToolPicker(this)),
+	mScrollAreaToolPicker(new QScrollArea(this))
 {
-	mMainLayout->addWidget(mToolPicker);
+	mScrollAreaToolPicker->setWidgetResizable(true);
+	mScrollAreaToolPicker->setFrameShape(QFrame::NoFrame);
+	mScrollAreaToolPicker->setWidget(mToolPicker);
+	mMainLayout->addWidget(mScrollAreaToolPicker);
 	mMainLayout->setContentsMargins(0, 0, 0, 0);
 
 	setLayout(mMainLayout);
@@ -60,4 +64,4 @@ QString AnnotationToolSelection::name() const
 	return tr("Tool Selection");
 }
 
-} // namespace kImageAnnotator
\ No newline at end of file
+} // namespace kImageAnnotator
diff --git a/src/gui/annotator/settings/AnnotationToolSelection.h b/src/gui/annotator/settings/AnnotationToolSelection.h
index e7b4951..ffa7d3a 100644
--- a/src/gui/annotator/settings/AnnotationToolSelection.h
+++ b/src/gui/annotator/settings/AnnotationToolSelection.h
@@ -42,6 +42,7 @@ signals:
 private:
 	QVBoxLayout *mMainLayout;
 	ToolPicker *mToolPicker;
+	QScrollArea *mScrollAreaToolPicker;
 };
 
 } // namespace kImageAnnotator
diff --git a/translations/kImageAnnotator_el.ts b/translations/kImageAnnotator_el.ts
index 03d8b36..e9225a6 100644
--- a/translations/kImageAnnotator_el.ts
+++ b/translations/kImageAnnotator_el.ts
@@ -74,7 +74,7 @@
     </message>
     <message>
         <source>Number Seed</source>
-        <translation type="unfinished"></translation>
+        <translation>Αρχικός αριθμός</translation>
     </message>
     <message>
         <source>Obfuscation Factor</source>
@@ -82,11 +82,11 @@
     </message>
     <message>
         <source>Item Shadow</source>
-        <translation type="unfinished"></translation>
+        <translation>Σκιά αντικειμένου</translation>
     </message>
     <message>
         <source>Item Settings</source>
-        <translation type="unfinished"></translation>
+        <translation>Ρυθμίσεις αντικειμένου</translation>
     </message>
 </context>
 <context>
@@ -207,11 +207,11 @@
     </message>
     <message>
         <source>Drop Shadow</source>
-        <translation type="unfinished"></translation>
+        <translation>Σκίαση</translation>
     </message>
     <message>
         <source>Grayscale</source>
-        <translation type="unfinished">Διαβαθμίσεις του γκρι</translation>
+        <translation>Διαβαθμίσεις του γκρι</translation>
     </message>
     <message>
         <source>Border</source>
@@ -231,15 +231,16 @@
     <message>
         <source>When enabled enforces the canvas
 to include the background image.</source>
-        <translation type="unfinished"></translation>
+        <translation>Όταν είναι ενεργοποιημένο, εξαναγκάζει τον καμβά
+να συμπεριλάβει την εικόνα παρασκηνίου.</translation>
     </message>
     <message>
         <source>X:</source>
-        <translation type="unfinished">x</translation>
+        <translation>X:</translation>
     </message>
     <message>
         <source>Y:</source>
-        <translation type="unfinished">Y:</translation>
+        <translation>Y:</translation>
     </message>
     <message>
         <source>W:</source>
@@ -263,7 +264,7 @@ to include the background image.</source>
     </message>
     <message>
         <source>Canvas Background Color</source>
-        <translation type="unfinished"></translation>
+        <translation>Χρώμα παρασκηνίου του καμβά</translation>
     </message>
 </context>
 <context>
@@ -282,16 +283,17 @@ to include the background image.</source>
     </message>
     <message>
         <source>90° Counter Clockwise</source>
-        <translation type="unfinished"></translation>
+        <translation>90° Αριστερόστροφα</translation>
     </message>
     <message>
         <source>Arbitrary</source>
-        <translation type="unfinished"></translation>
+        <translation>Αυθαίρετα</translation>
     </message>
     <message>
         <source>Positive values rotate clockwise, negative values counter clockwise.
 Rotating by non 90° multipliers might introduce loss of quality.</source>
-        <translation type="unfinished"></translation>
+        <translation>Οι θετικές τιμές περιστρέφουν σύμφωνα με τους δείκτες του ρολογιού, και οι αρνητικές τιμές αντίστροφα.
+Η περιστροφή με πολλαπλασιαστές διαφορετικούς των 90° μπορεί να προκαλέσει απώλεια στην ποιότητα.</translation>
     </message>
     <message>
         <source>Horizontal</source>
@@ -357,7 +359,7 @@ Rotating by non 90° multipliers might introduce loss of quality.</source>
     <name>kImageAnnotator::StickerPicker</name>
     <message>
         <source>Sticker</source>
-        <translation type="unfinished"></translation>
+        <translation>Αυτοκόλλητο</translation>
     </message>
 </context>
 <context>
@@ -416,27 +418,27 @@ Rotating by non 90° multipliers might introduce loss of quality.</source>
     </message>
     <message>
         <source>Number Pointer</source>
-        <translation type="unfinished"></translation>
+        <translation>Δρομέας αριθμού</translation>
     </message>
     <message>
         <source>Sticker</source>
-        <translation type="unfinished"></translation>
+        <translation>Αυτοκόλλητο</translation>
     </message>
     <message>
         <source>Pixelate</source>
-        <translation type="unfinished"></translation>
+        <translation>Παραμόρφωση εικονοστοιχείων</translation>
     </message>
     <message>
         <source>Text Pointer</source>
-        <translation type="unfinished"></translation>
+        <translation>Δρομέας κειμένου</translation>
     </message>
     <message>
         <source>Text Arrow</source>
-        <translation type="unfinished"></translation>
+        <translation>Βέλος κειμένου</translation>
     </message>
     <message>
         <source>Number Arrow</source>
-        <translation type="unfinished"></translation>
+        <translation>Βέλος αριθμού</translation>
     </message>
     <message>
         <source>Duplicate</source>



More information about the Neon-commits mailing list