diff --git a/0001-add-save-dialog.patch b/0001-add-save-dialog.patch deleted file mode 100644 index b1a43af..0000000 --- a/0001-add-save-dialog.patch +++ /dev/null @@ -1,149 +0,0 @@ -diff -Naur kylin-screenshot-1.0.0/kylin-screenshot.pro kylin-screenshot-1.0.0~/kylin-screenshot.pro ---- kylin-screenshot-1.0.0/kylin-screenshot.pro 2021-11-27 02:29:46.641814553 +0800 -+++ kylin-screenshot-1.0.0~/kylin-screenshot.pro 2021-11-27 02:45:56.503760907 +0800 -@@ -88,6 +88,7 @@ - SOURCES += src/main.cpp \ - src/common/CommandLineOptions.cpp \ - src/common/Logger.cpp \ -+ src/utils/mysavedialog.cpp \ - src/widgets/capture/buttonhandler.cpp \ - src/widgets/capture/font_options.cpp \ - src/widgets/capture/font_options2.cpp \ -@@ -178,6 +179,7 @@ - src/common/CommandLineOptions.h \ - src/common/Enum.h \ - src/common/Logger.h \ -+ src/utils/mysavedialog.h \ - src/widgets/capture/font_options.h \ - src/widgets/capture/font_options2.h \ - src/widgets/infowindow.h \ -diff -Naur kylin-screenshot-1.0.0/src/utils/mysavedialog.cpp kylin-screenshot-1.0.0~/src/utils/mysavedialog.cpp ---- kylin-screenshot-1.0.0/src/utils/mysavedialog.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/utils/mysavedialog.cpp 2021-11-27 02:45:57.762760838 +0800 -@@ -0,0 +1,53 @@ -+/* -+ * Copyright: 2020 KylinSoft Co., Ltd. -+ * Authors: -+ * huanhuan zhang -+ * -+ * This program is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program. If not, see . -+ */ -+#include "mysavedialog.h" -+#include -+#include -+#include -+#include -+#include "src/utils/filenamehandler.h" -+ -+MySaveDialog::MySaveDialog(QWidget *parent) : -+ QFileDialog(parent) -+{ -+ setWindowIcon(QIcon("/usr/share/icons/ukui-icon-theme-default/128x128/apps/kylin-screenshot.png")); -+ setNameFilter(QLatin1String("Portable Network Graphic file (PNG) (*.png);;BMP file (*.bmp);;JPEG file (*.jpg)")); -+ setDirectory(QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).at(0)); -+ setAcceptMode(QFileDialog::AcceptSave); -+ QString a = FileNameHandler().parsedPattern()+".png"; -+ this->findChildren("fileNameEdit").at(0)->setText(a); -+ connect(this->findChildren("fileTypeCombo").at(0), QOverload::of(&QComboBox::currentIndexChanged), -+ [=](int index) -+ { -+ switch (index) { -+ case 0: -+ qDebug()<<"change the type is png"; -+ break; -+ case 1: -+ qDebug()<<"change the type is bmp"; -+ break; -+ case 2: -+ qDebug()<<"change the type is jpg"; -+ break; -+ default: -+ break; -+ } -+ this->findChildren("fileNameEdit").at(0)->setText(a); -+ }); -+} -diff -Naur kylin-screenshot-1.0.0/src/utils/mysavedialog.h kylin-screenshot-1.0.0~/src/utils/mysavedialog.h ---- kylin-screenshot-1.0.0/src/utils/mysavedialog.h 1970-01-01 08:00:00.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/utils/mysavedialog.h 2021-11-27 02:45:57.757760838 +0800 -@@ -0,0 +1,30 @@ -+/* -+ * Copyright: 2020 KylinSoft Co., Ltd. -+ * Authors: -+ * huanhuan zhang -+ * -+ * This program is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program. If not, see . -+ */ -+#pragma once -+ -+#include -+#include -+ -+class MySaveDialog :public QFileDialog -+{ -+Q_OBJECT -+public: -+ explicit MySaveDialog(QWidget *parent = 0); -+signals: -+}; -diff -Naur kylin-screenshot-1.0.0/src/utils/screenshotsaver.cpp kylin-screenshot-1.0.0~/src/utils/screenshotsaver.cpp ---- kylin-screenshot-1.0.0/src/utils/screenshotsaver.cpp 2021-01-08 14:21:25.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/utils/screenshotsaver.cpp 2021-11-27 02:45:57.772760837 +0800 -@@ -21,8 +21,8 @@ - #include - #include - #include --#include - #include -+#include "mysavedialog.h" - - ScreenshotSaver::ScreenshotSaver() { - } -@@ -78,11 +78,9 @@ - bool ok = false; - - while (!ok) { -- QString savePath = QFileDialog::getSaveFileName( -- nullptr, -- QString(), -- FileNameHandler().absoluteSavePath() + ".png", -- QLatin1String("Portable Network Graphic file (PNG) (*.png);;BMP file (*.bmp);;JPEG file (*.jpg)")); -+ MySaveDialog *a = new MySaveDialog(nullptr); -+ if(a->exec() == QFileDialog::Accepted){ -+ QString savePath = a->selectedFiles().at(0); - - if (savePath.isNull()) { - break; -@@ -112,5 +110,10 @@ - saveErrBox.exec(); - } - } -+ else -+ { -+ return ok; -+ } -+ } - return ok; - } diff --git a/0001-fix-screenshot-service.patch b/0001-fix-screenshot-service.patch deleted file mode 100644 index 4908e09..0000000 --- a/0001-fix-screenshot-service.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 104239c8a8ad8e53377a6c06c574719eb788290f Mon Sep 17 00:00:00 2001 -From: lvhan -Date: Thu, 14 Jan 2021 16:25:26 +0800 -Subject: [PATCH] fix-screenshot-service - ---- - kylin-screenshot.pro | 11 ++++++----- - openEuler/build_install.sh | 2 +- - 2 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/kylin-screenshot.pro b/kylin-screenshot.pro -index f216f23..70fd2cb 100644 ---- a/kylin-screenshot.pro -+++ b/kylin-screenshot.pro -@@ -315,11 +315,12 @@ unix:!macx { - - servicedbus.path = $${PREFIX}/share/dbus-1/services/ - -- packaging { -- servicedbus.files = dbus/package/org.dharkael.kylinscreenshot.service -- } else { -- servicedbus.files = dbus/make/org.dharkael.kylinscreenshot.service -- } -+# packaging { -+# servicedbus.files = dbus/package/org.dharkael.kylinscreenshot.service -+# } else { -+# servicedbus.files = dbus/make/org.dharkael.kylinscreenshot.service -+# } -+ servicedbus.files = dbus/package/org.dharkael.kylinscreenshot.service - - INSTALLS += target \ - icon \ -diff --git a/openEuler/build_install.sh b/openEuler/build_install.sh -index 46643ff..06455e8 100644 ---- a/openEuler/build_install.sh -+++ b/openEuler/build_install.sh -@@ -21,4 +21,4 @@ cd /root/rpmbuild/SPECS/ - rpmbuild -ba $pkg_name.spec - echo "安装rpm包" - cd /root/rpmbuild/RPMS/x86_64/ --rpm -ivh --replacefiles --force --nodeps *.x86_64.rpm -+rpm -Uvh --replacefiles --force --nodeps $pkg_name*.x86_64.rpm --- -2.29.2.windows.2 - diff --git a/fix-screenshot-not-show.patch b/0001-fxi-screenshot-not-work.patch similarity index 65% rename from fix-screenshot-not-show.patch rename to 0001-fxi-screenshot-not-work.patch index a0d2501..ce1e204 100644 --- a/fix-screenshot-not-show.patch +++ b/0001-fxi-screenshot-not-work.patch @@ -1,17 +1,17 @@ -From 1e24386bfeec01911f33dc19c68171425316cd73 Mon Sep 17 00:00:00 2001 +From e1632e6d4f5f2aeb995b56101251325bc4c04dd1 Mon Sep 17 00:00:00 2001 From: tanyulong2021 -Date: Tue, 22 Feb 2022 14:49:13 +0800 -Subject: [PATCH] fix screenshot not show +Date: Fri, 4 Mar 2022 15:53:31 +0800 +Subject: [PATCH] fxi screenshot not work --- - kylin-screenshot.pro | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) + kylin-screenshot.pro | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/kylin-screenshot.pro b/kylin-screenshot.pro -index 3ffbc60..5ad2bd0 100755 +index f372c46..3083cb4 100644 --- a/kylin-screenshot.pro +++ b/kylin-screenshot.pro -@@ -315,11 +315,8 @@ unix:!macx { +@@ -315,11 +315,7 @@ unix:!macx { servicedbus.path = $${PREFIX}/share/dbus-1/services/ @@ -20,7 +20,6 @@ index 3ffbc60..5ad2bd0 100755 - } else { - servicedbus.files = dbus/make/org.dharkael.kylinscreenshot.service - } -+ + servicedbus.files = dbus/package/org.dharkael.kylinscreenshot.service INSTALLS += target \ diff --git a/kylin-screenshot-1.0.0.tar.gz b/kylin-screenshot-1.0.0.tar.gz deleted file mode 100644 index c278a95..0000000 Binary files a/kylin-screenshot-1.0.0.tar.gz and /dev/null differ diff --git a/kylin-screenshot-1.0.3.tar.gz b/kylin-screenshot-1.0.3.tar.gz new file mode 100644 index 0000000..3ff7f6e Binary files /dev/null and b/kylin-screenshot-1.0.3.tar.gz differ diff --git a/kylin-screenshot.spec b/kylin-screenshot.spec index 60490d3..e1552fc 100644 --- a/kylin-screenshot.spec +++ b/kylin-screenshot.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: kylin-screenshot -Version: 1.0.0 -Release: 6 +Version: 1.0.3 +Release: 1 Summary: a powerful screenshot and screen recording tool License: GPL-3+ URL: https://github.com/ubuntukylin @@ -24,12 +24,10 @@ BuildRequires: kf5-kwindowsystem-devel BuildRequires: kf5-kwindowsystem BuildRequires: gsettings-qt-devel +Patch0: 0001-fxi-screenshot-not-work.patch + # Requires: NetworkManager -patch0: 0001-fix-screenshot-service.patch -patch1: 0001-add-save-dialog.patch -patch2: optimize-the-undo-button-function.patch -patch3: fix-screenshot-not-show.patch %description Powerful yet simple-to-use screenshot software @@ -42,9 +40,6 @@ patch3: fix-screenshot-not-show.patch %prep %setup -q %patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 %build %{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-screenshot.pro @@ -95,6 +90,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/metainfo/kylinscreenshot.appdata.xml %changelog +* Fri Mar 04 2022 tanyulong - 1.0.3-1 +- update upstream version 1.0.3 + * Tue Feb 22 2022 tanyulong - 1.0.0-6 - fix screenshot not show diff --git a/optimize-the-undo-button-function.patch b/optimize-the-undo-button-function.patch deleted file mode 100644 index 271c63d..0000000 --- a/optimize-the-undo-button-function.patch +++ /dev/null @@ -1,690 +0,0 @@ -diff -Naur kylin-screenshot-1.0.0/debian/copyright kylin-screenshot-1.0.0~/debian/copyright ---- kylin-screenshot-1.0.0/debian/copyright 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/debian/copyright 2021-12-08 17:17:40.318668024 +0800 -@@ -42,7 +42,8 @@ - Copyright:2012-2020 Maarten Baert - License: LGPL-3+ - --Files: src/tools/cut/* -+Files: src/tools/AbstractActionToolWithWidget* -+ src/tools/cut/* - src/tools/luping/* - src/tools/options/* - src/tools/screencap/* -diff -Naur kylin-screenshot-1.0.0/kylin-screenshot.pro kylin-screenshot-1.0.0~/kylin-screenshot.pro ---- kylin-screenshot-1.0.0/kylin-screenshot.pro 2021-12-08 17:29:46.815135871 +0800 -+++ kylin-screenshot-1.0.0~/kylin-screenshot.pro 2021-12-08 17:32:17.786319602 +0800 -@@ -6,8 +6,7 @@ - - win32:LIBS += -luser32 -lshell32 - --#LIBS += -lavutil -lavformat -lavcodec -lswscale -lX11 -lXext -lXtst -lXfixes -lXinerama -lpulse --LIBS += -lX11 -lXext -lXtst -lXfixes -lXinerama -lpulse -+LIBS += -lavutil -lavformat -lavcodec -lswscale -lX11 -lXext -lXtst -lXfixes -lXinerama -lpulse - - TAG_VERSION = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags) - isEmpty(TAG_VERSION){ -@@ -28,6 +27,7 @@ - CONFIG += c++11 link_pkgconfig - PKGCONFIG += gsettings-qt - QMAKE_CXXFLAGS += -std=c++0x -+PKGCONFIG += libavutil libavformat libavcodec libswscale x11 xext xfixes xinerama libpulse - - #CONFIG += packaging # Enables "make install" for packaging paths - -@@ -88,6 +88,7 @@ - SOURCES += src/main.cpp \ - src/common/CommandLineOptions.cpp \ - src/common/Logger.cpp \ -+ src/tools/AbstractActionToolWithWidget.cpp \ - src/utils/mysavedialog.cpp \ - src/widgets/capture/buttonhandler.cpp \ - src/widgets/capture/font_options.cpp \ -@@ -171,14 +172,11 @@ - src/widgets/screentype.cpp \ - # src/widgets/widget.cpp - --HEADERS += src/common/Global.h \ -- src/common/my_qt.h \ -- src/common/my_x.h \ -- src/common/my_av.h \ -- src/widgets/capture/buttonhandler.h \ -+HEADERS += src/common/Global.h src/common/my_qt.h src/common/my_x.h src/common/my_av.h src/widgets/capture/buttonhandler.h \ - src/common/CommandLineOptions.h \ - src/common/Enum.h \ - src/common/Logger.h \ -+ src/tools/AbstractActionToolWithWidget.h \ - src/utils/mysavedialog.h \ - src/widgets/capture/font_options.h \ - src/widgets/capture/font_options2.h \ -@@ -317,12 +315,11 @@ - - servicedbus.path = $${PREFIX}/share/dbus-1/services/ - --# packaging { --# servicedbus.files = dbus/package/org.dharkael.kylinscreenshot.service --# } else { --# servicedbus.files = dbus/make/org.dharkael.kylinscreenshot.service --# } -- servicedbus.files = dbus/package/org.dharkael.kylinscreenshot.service -+ packaging { -+ servicedbus.files = dbus/package/org.dharkael.kylinscreenshot.service -+ } else { -+ servicedbus.files = dbus/make/org.dharkael.kylinscreenshot.service -+ } - - INSTALLS += target \ - icon \ -diff -Naur kylin-screenshot-1.0.0/src/common/CommandLineOptions.cpp kylin-screenshot-1.0.0~/src/common/CommandLineOptions.cpp ---- kylin-screenshot-1.0.0/src/common/CommandLineOptions.cpp 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/common/CommandLineOptions.cpp 2021-12-08 17:17:42.139694256 +0800 -@@ -204,11 +204,11 @@ - #else - "Compiled with GCC " + QString::number(__GNUC__) + "." + QString::number(__GNUC_MINOR__) + "." + QString::number(__GNUC_PATCHLEVEL__) + "\n" - #endif -- "Qt: header " + QT_VERSION_STR + ", lib " + qVersion() + "\n"; --// "libavformat: header " + av_version(LIBAVFORMAT_VERSION_INT) + ", lib " + av_version(avformat_version()) + "\n" --// "libavcodec: header " + av_version(LIBAVCODEC_VERSION_INT) + ", lib " + av_version(avcodec_version()) + "\n" --// "libavutil: header " + av_version(LIBAVUTIL_VERSION_INT) + ", lib " + av_version(avutil_version()) + "\n" --// "libswscale: header " + av_version(LIBSWSCALE_VERSION_INT) + ", lib " + av_version(swscale_version()); -+ "Qt: header " + QT_VERSION_STR + ", lib " + qVersion() + "\n" -+ "libavformat: header " + av_version(LIBAVFORMAT_VERSION_INT) + ", lib " + av_version(avformat_version()) + "\n" -+ "libavcodec: header " + av_version(LIBAVCODEC_VERSION_INT) + ", lib " + av_version(avcodec_version()) + "\n" -+ "libavutil: header " + av_version(LIBAVUTIL_VERSION_INT) + ", lib " + av_version(avutil_version()) + "\n" -+ "libswscale: header " + av_version(LIBSWSCALE_VERSION_INT) + ", lib " + av_version(swscale_version()); - } - - QString GetApplicationSystemDir(const QString& subdir) { -diff -Naur kylin-screenshot-1.0.0/src/common/my_av.h kylin-screenshot-1.0.0~/src/common/my_av.h ---- kylin-screenshot-1.0.0/src/common/my_av.h 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/common/my_av.h 2021-12-08 17:17:42.128694098 +0800 -@@ -1,21 +1,21 @@ - #pragma once - - extern "C" { --// #include --// #include --// #include --// #include --// #include --// #include --// #include --// #include -+#include -+#include -+#include -+#include -+//#include -+#include -+#include -+#include - } - #include - - // convert weird types from libav/ffmpeg to doubles --// inline double ToDouble(const AVRational& r) { --// return (double) r.num / (double) r.den; --// } -+inline double ToDouble(const AVRational& r) { -+ return (double) r.num / (double) r.den; -+} - - class LibavException : public std::exception { - public: -diff -Naur kylin-screenshot-1.0.0/src/tools/abstractactiontool.cpp kylin-screenshot-1.0.0~/src/tools/abstractactiontool.cpp ---- kylin-screenshot-1.0.0/src/tools/abstractactiontool.cpp 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/tools/abstractactiontool.cpp 2021-12-08 17:17:41.448684302 +0800 -@@ -26,7 +26,7 @@ - } - - bool AbstractActionTool::isSelectable() const { -- return true; -+ return false; - } - - bool AbstractActionTool::showMousePreview() const { -diff -Naur kylin-screenshot-1.0.0/src/tools/AbstractActionToolWithWidget.cpp kylin-screenshot-1.0.0~/src/tools/AbstractActionToolWithWidget.cpp ---- kylin-screenshot-1.0.0/src/tools/AbstractActionToolWithWidget.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/tools/AbstractActionToolWithWidget.cpp 2021-12-08 17:17:41.463684518 +0800 -@@ -0,0 +1,88 @@ -+/* -+ * -+ * Copyright: 2020 KylinSoft Co., Ltd. -+ * Authors: -+ * huanhuan zhang -+ * -+ * This program is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program. If not, see . -+ */ -+#include "AbstractActionToolWithWidget.h".h" -+ -+AbstractActionToolWithWidget::AbstractActionToolWithWidget(QObject *parent) : CaptureTool(parent) { -+ -+} -+ -+bool AbstractActionToolWithWidget::isValid() const { -+ return true; -+} -+ -+bool AbstractActionToolWithWidget::isSelectable() const { -+ return true; -+} -+ -+bool AbstractActionToolWithWidget::showMousePreview() const { -+ return false; -+} -+ -+QIcon AbstractActionToolWithWidget::icon(const QColor &background, bool inEditor) const -+{ -+ Q_UNUSED(background); -+ Q_UNUSED(inEditor); -+ return QIcon(); -+} -+#ifdef SUPPORT_UKUI -+QIcon AbstractActionToolWithWidget::icon(const QColor &background, bool inEditor, const CaptureContext &context) const -+{ -+ Q_UNUSED(background); -+ Q_UNUSED(inEditor); -+ Q_UNUSED(context); -+ return QIcon(); -+} -+#endif -+void AbstractActionToolWithWidget::undo(QPixmap &pixmap) { -+ Q_UNUSED(pixmap); -+} -+ -+void AbstractActionToolWithWidget::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { -+ Q_UNUSED(painter); -+ Q_UNUSED(pixmap); -+ Q_UNUSED(recordUndo); -+} -+ -+void AbstractActionToolWithWidget::paintMousePreview( -+ QPainter &painter, const CaptureContext &context) -+{ -+ Q_UNUSED(painter); -+ Q_UNUSED(context); -+} -+ -+void AbstractActionToolWithWidget::drawEnd(const QPoint &p) { -+ Q_UNUSED(p); -+} -+ -+void AbstractActionToolWithWidget::drawMove(const QPoint &p) { -+ Q_UNUSED(p); -+} -+ -+void AbstractActionToolWithWidget::drawStart(const CaptureContext &context) { -+ Q_UNUSED(context); -+} -+ -+void AbstractActionToolWithWidget::colorChanged(const QColor &c) { -+ Q_UNUSED(c); -+} -+ -+void AbstractActionToolWithWidget::thicknessChanged(const int th) { -+ Q_UNUSED(th); -+} -diff -Naur kylin-screenshot-1.0.0/src/tools/AbstractActionToolWithWidget.h kylin-screenshot-1.0.0~/src/tools/AbstractActionToolWithWidget.h ---- kylin-screenshot-1.0.0/src/tools/AbstractActionToolWithWidget.h 1970-01-01 08:00:00.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/tools/AbstractActionToolWithWidget.h 2021-12-08 17:17:41.437684144 +0800 -@@ -0,0 +1,47 @@ -+/* -+ * -+ * Copyright: 2020 KylinSoft Co., Ltd. -+ * Authors: -+ * huanhuan zhang -+ * -+ * This program is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program. If not, see . -+ */ -+#pragma once -+ -+#include "capturetool.h" -+ -+class AbstractActionToolWithWidget : public CaptureTool { -+ Q_OBJECT -+public: -+ explicit AbstractActionToolWithWidget(QObject *parent = nullptr); -+ -+ bool isValid() const override; -+ bool isSelectable() const override; -+ bool showMousePreview() const override; -+ -+ QIcon icon(const QColor &background, bool inEditor) const override; -+#ifdef SUPPORT_UKUI -+ QIcon icon(const QColor &background, bool inEditor,const CaptureContext &context) const override; -+#endif -+ void undo(QPixmap &pixmap) override; -+ void process(QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; -+ void paintMousePreview(QPainter &painter, const CaptureContext &context) override; -+ -+public slots: -+ void drawEnd(const QPoint &p) override; -+ void drawMove(const QPoint &p) override; -+ void drawStart(const CaptureContext &context) override; -+ void colorChanged(const QColor &c) override; -+ void thicknessChanged(const int th) override; -+}; -diff -Naur kylin-screenshot-1.0.0/src/tools/options/options.cpp kylin-screenshot-1.0.0~/src/tools/options/options.cpp ---- kylin-screenshot-1.0.0/src/tools/options/options.cpp 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/tools/options/options.cpp 2021-12-08 17:17:41.485684835 +0800 -@@ -19,7 +19,7 @@ - */ - #include "options.h" - --Options::Options(QObject *parent) : AbstractActionTool(parent) -+Options::Options(QObject *parent) : AbstractActionToolWithWidget(parent) - { - } - bool Options::closeOnButtonPressed() const -diff -Naur kylin-screenshot-1.0.0/src/tools/options/options.h kylin-screenshot-1.0.0~/src/tools/options/options.h ---- kylin-screenshot-1.0.0/src/tools/options/options.h 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/tools/options/options.h 2021-12-08 17:17:41.489684893 +0800 -@@ -22,8 +22,8 @@ - - #include - #include --#include "src/tools/abstractactiontool.h" --class Options : public AbstractActionTool { -+#include "src/tools/AbstractActionToolWithWidget.h" -+class Options : public AbstractActionToolWithWidget { - Q_OBJECT - public: - explicit Options(QObject *parent = nullptr); -diff -Naur kylin-screenshot-1.0.0/src/tools/save/saveastool.cpp kylin-screenshot-1.0.0~/src/tools/save/saveastool.cpp ---- kylin-screenshot-1.0.0/src/tools/save/saveastool.cpp 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/tools/save/saveastool.cpp 2021-12-08 17:17:41.718688191 +0800 -@@ -21,7 +21,7 @@ - #include "src/utils/screenshotsaver.h" - #include - #include --SaveAsTool::SaveAsTool(QObject *parent) : AbstractActionTool(parent) { -+SaveAsTool::SaveAsTool(QObject *parent) : AbstractActionToolWithWidget(parent) { - - } - -diff -Naur kylin-screenshot-1.0.0/src/tools/save/saveastool.h kylin-screenshot-1.0.0~/src/tools/save/saveastool.h ---- kylin-screenshot-1.0.0/src/tools/save/saveastool.h 2021-01-08 14:21:24.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/tools/save/saveastool.h 2021-12-08 17:17:41.721688235 +0800 -@@ -19,8 +19,8 @@ - */ - #ifndef SAVEASTOOL_H - #define SAVEASTOOL_H --#include "src/tools/abstractactiontool.h" --class SaveAsTool : public AbstractActionTool -+#include "src/tools/AbstractActionToolWithWidget.h" -+class SaveAsTool : public AbstractActionToolWithWidget - { - Q_OBJECT - public: -diff -Naur kylin-screenshot-1.0.0/src/widgets/capture/buttonhandler.cpp kylin-screenshot-1.0.0~/src/widgets/capture/buttonhandler.cpp ---- kylin-screenshot-1.0.0/src/widgets/capture/buttonhandler.cpp 2021-01-08 14:21:25.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/widgets/capture/buttonhandler.cpp 2021-12-08 17:17:42.289696417 +0800 -@@ -384,6 +384,7 @@ - button->move(p.x()+29,p.y()); - break; - case CaptureButton::TYPE_OPTION: -+ Save_Location_Window_Pos = move_Save_Location_Window(p.x()+19,p.y()); - button->move(p.x()+19,p.y()); - break; - case CaptureButton::TYPE_SAVEAS: -@@ -405,6 +406,13 @@ - case CaptureButton::TYPE_SAVE: - button->move(p.x()+46,p.y()); - break; -+ case CaptureButton::TYPE_TEXT: -+ Font_Options_Window_Pos = move_Font_Options_Window(p.x(),p.y()); -+ button->move(p); -+ break; -+ case CaptureButton::TYPE_BLUR: -+ button->move(p); -+ break; - #endif - - case CaptureButton::TYPE_PIN: -@@ -424,6 +432,7 @@ - } - break; - default: -+ FontSize_Color_Chose_Window_Y = move_FontSize_Color_Chose_Window(p.y()); - button->move(p); - break; - } -@@ -479,3 +488,64 @@ - m_vectorButtons.clear(); - } - -+int ButtonHandler::move_FontSize_Color_Chose_Window(int y) -+{ -+ int FontSize_Color_Chose_Window_y; -+ if (y>m_selection.y()) -+ { -+ if (y+150 <= QGuiApplication::primaryScreen()->geometry().height()) -+ FontSize_Color_Chose_Window_y = y+50; -+ else -+ FontSize_Color_Chose_Window_y = y-80; -+ } -+ else -+ { -+ if (y-80 >= 0) -+ FontSize_Color_Chose_Window_y = y-80; -+ else -+ FontSize_Color_Chose_Window_y = y+50; -+ } -+ return FontSize_Color_Chose_Window_y; -+} -+QPoint ButtonHandler::move_Save_Location_Window(int x,int y) -+{ -+ QPoint p(x,y); -+ p.setX(x-50); -+ if (y>m_selection.y()) -+ { -+ if (y+170 <= QGuiApplication::primaryScreen()->geometry().height()) -+ p.setY(y+50); -+ else -+ p.setY(y-155); -+ } -+ else -+ { -+ if (y-155>= 0) -+ p.setY(y-155); -+ else -+ p.setY(y+50); -+ } -+ return p; -+} -+QPoint ButtonHandler::move_Font_Options_Window(int x,int y) -+{ -+ QPoint p(x,y); -+ p.setX(x-120); -+ if(y>m_selection.y()) -+ { -+ if (y+125 <= QGuiApplication::primaryScreen()->geometry().height()) -+ p.setY(y+50); -+ else -+ p.setY(y-95); -+ } -+ else -+ { -+ if (y-95 >= 0) -+ p.setY(y-95); -+ else -+ p.setY(y+50); -+ } -+ return p; -+} -+ -+ -diff -Naur kylin-screenshot-1.0.0/src/widgets/capture/buttonhandler.h kylin-screenshot-1.0.0~/src/widgets/capture/buttonhandler.h ---- kylin-screenshot-1.0.0/src/widgets/capture/buttonhandler.h 2021-01-08 14:21:25.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/widgets/capture/buttonhandler.h 2021-12-08 17:17:42.303696619 +0800 -@@ -44,6 +44,13 @@ - - void clearButtons(); - -+ int move_FontSize_Color_Chose_Window(int y); -+ QPoint move_Save_Location_Window(int x,int y); -+ QPoint move_Font_Options_Window(int x,int y); -+ -+ int FontSize_Color_Chose_Window_Y; -+ QPoint Save_Location_Window_Pos; -+ QPoint Font_Options_Window_Pos; - public slots: - void updatePosition(const QRect &selection); - void hide(); -diff -Naur kylin-screenshot-1.0.0/src/widgets/capture/capturewidget.cpp kylin-screenshot-1.0.0~/src/widgets/capture/capturewidget.cpp ---- kylin-screenshot-1.0.0/src/widgets/capture/capturewidget.cpp 2021-01-08 14:21:25.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/widgets/capture/capturewidget.cpp 2021-12-08 17:17:42.326696950 +0800 -@@ -513,8 +513,66 @@ - painter.drawPixmap(r,QPixmap(QStringLiteral(":/img/material/control_point.png"))); - } - } -+ updateChildWindow(); - } - -+void CaptureWidget::updateChildWindow() -+{ -+ if (font_color->isVisible()) -+ { -+ if (m_buttonHandler->FontSize_Color_Chose_Window_Y < vectorButtons.first()->pos().y()) -+ { -+ font_color->hide(); -+ font_color2->show(); -+ } -+ } -+ if (font_color2->isVisible()) -+ { -+ if (m_buttonHandler->FontSize_Color_Chose_Window_Y > vectorButtons.first()->pos().y()) -+ { -+ font_color2->hide(); -+ font_color->show(); -+ } -+ } -+ if (save_location->isVisible()) -+ { -+ if (m_buttonHandler->Save_Location_Window_Pos.y() < vectorButtons.first()->pos().y()) -+ { -+ save_location->hide(); -+ save_location2->show(); -+ } -+ } -+ if (save_location2->isVisible()) -+ { -+ if (m_buttonHandler->Save_Location_Window_Pos.y() > vectorButtons.first()->pos().y()) -+ { -+ save_location2->hide(); -+ save_location->show(); -+ } -+ } -+ if (font_options->isVisible()) -+ { -+ if (m_buttonHandler->Font_Options_Window_Pos.y() < vectorButtons.first()->pos().y()) -+ { -+ font_options->hide(); -+ font_options2->show(); -+ } -+ } -+ if (font_options2->isVisible()) -+ { -+ if (m_buttonHandler->Font_Options_Window_Pos.y()> vectorButtons.first()->pos().y()) -+ { -+ font_options->hide(); -+ font_options2->show(); -+ } -+ } -+ font_color ->move(vectorButtons.first()->pos().x()+length,m_buttonHandler->FontSize_Color_Chose_Window_Y); -+ font_color2 ->move(vectorButtons.first()->pos().x()+length,m_buttonHandler->FontSize_Color_Chose_Window_Y); -+ save_location ->move(m_buttonHandler->Font_Options_Window_Pos); -+ save_location2 ->move(m_buttonHandler->Font_Options_Window_Pos); -+ font_options ->move(m_buttonHandler->Font_Options_Window_Pos); -+ font_options2 ->move(m_buttonHandler->Font_Options_Window_Pos); -+} - void CaptureWidget::updateMagnifier(CaptureContext m_context){ - int x = m_context.mousePos.x(); - int y = m_context.mousePos.y(); -@@ -1473,6 +1531,7 @@ - - void CaptureWidget::font_options_defult() - { -+ font_options->move(m_buttonHandler->Font_Options_Window_Pos); - font_options->Font_size->setValue(m_context.thickness); - font_options->color = m_context.color; - font_options->Underline = m_context.underline; -@@ -1482,6 +1541,7 @@ - } - void CaptureWidget::font_options2_defult() - { -+ font_options2->move(m_buttonHandler->Font_Options_Window_Pos); - font_options2->Font_size->setValue(m_context.thickness); - font_options2->color = m_context.color; - font_options2->Underline = m_context.underline; -@@ -1542,6 +1602,7 @@ - } - void CaptureWidget::savetype_chose_default() - { -+ save_location->move(m_buttonHandler->Save_Location_Window_Pos); - if(m_context.saveType == ".jpg") - save_location->type_rect = save_location->m_TypeList.at(0); - else if(m_context.saveType == ".bmp") -@@ -1552,6 +1613,7 @@ - } - void CaptureWidget::savetype_chose2_default() - { -+ save_location->move(m_buttonHandler->Save_Location_Window_Pos); - if(m_context.saveType == ".jpg") - save_location2->type_rect = save_location2->m_TypeList.at(0); - else if(m_context.saveType == ".bmp") -@@ -1647,6 +1709,7 @@ - font_color_point->setY(b->y()+50); - font_color->move(font_color_point->x(),font_color_point->y()); - font_color->show(); -+ length = font_color->x() - vectorButtons.first()->pos().x(); - } - else - { -@@ -1654,6 +1717,7 @@ - font_color_point->setY(b->y()-80); - font_color2->move(font_color_point->x(),font_color_point->y()); - font_color2->show(); -+ length = font_color2->x() - vectorButtons.first()->pos().x(); - } - } - else -@@ -1664,6 +1728,7 @@ - font_color_point->setY(b->y()-80); - font_color2->move(font_color_point->x(),font_color_point->y()); - font_color2->show(); -+ length = font_color2->x() - vectorButtons.first()->pos().x(); - } - else - { -@@ -1671,8 +1736,10 @@ - font_color_point->setY(b->y()+50); - font_color->move(font_color_point->x(),font_color_point->y()); - font_color->show(); -+ length = font_color->x() - vectorButtons.first()->pos().x(); - } - } -+ - } - //options - void CaptureWidget::show_Save_Location_Window(CaptureButton *b) -@@ -1686,36 +1753,16 @@ - if(b->y()>m_selection->y()) - { - if (b->y()+170 <= QGuiApplication::primaryScreen()->geometry().height()) -- { -- font_color_point->setX(b->x()-67); -- font_color_point->setY(b->y()+50); -- save_location->move(font_color_point->x(),font_color_point->y()); - save_location->show(); -- } - else -- { -- font_color_point->setX(b->x()-67); -- font_color_point->setY(b->y()-155); -- save_location2->move(font_color_point->x(),font_color_point->y()); - save_location2->show(); -- } - } - else - { -- if (b->y()-155>= 0) -- { -- font_color_point->setX(b->x()-67); -- font_color_point->setY(b->y()-155); -- save_location2->move(font_color_point->x(),font_color_point->y()); -- save_location2->show(); -- } -+ if (b->y()-155>= 0) -+ save_location2->show(); - else -- { -- font_color_point->setX(b->x()-67); -- font_color_point->setY(b->y()+50); -- save_location->move(font_color_point->x(),font_color_point->y()); -- save_location->show(); -- } -+ save_location->show(); - } - } - //text -@@ -1728,37 +1775,16 @@ - if(b->y()>m_selection->y()) - { - if (b->y()+125 <= QGuiApplication::primaryScreen()->geometry().height()) -- { -- font_color_point->setX(b->x()-125); -- font_color_point->setY(b->y()+50); -- font_options->move(font_color_point->x(),font_color_point->y()); - font_options->show(); -- } - else -- { -- font_color_point->setX(b->x()-125); -- font_color_point->setY(b->y()-95); -- font_options2->move(font_color_point->x(),font_color_point->y()); - font_options2->show(); -- } - } - else - { - if (b->y()-95 >= 0) -- { -- font_color_point->setX(b->x()-125); -- font_color_point->setY(b->y()-95); -- font_options2->move(font_color_point->x(),font_color_point->y()); - font_options2->show(); -- -- } - else -- { -- font_color_point->setX(b->x()-125); -- font_color_point->setY(b->y()+50); -- font_options->move(font_color_point->x(),font_color_point->y()); - font_options->show(); -- } - } - } - void CaptureWidget::deal_with_SaveAs(CaptureButton *b) -diff -Naur kylin-screenshot-1.0.0/src/widgets/capture/capturewidget.h kylin-screenshot-1.0.0~/src/widgets/capture/capturewidget.h ---- kylin-screenshot-1.0.0/src/widgets/capture/capturewidget.h 2021-01-08 14:21:25.000000000 +0800 -+++ kylin-screenshot-1.0.0~/src/widgets/capture/capturewidget.h 2021-12-08 17:17:42.253695898 +0800 -@@ -174,6 +174,7 @@ - void pushToolToStack(); - void makeChild(QWidget *w); - -+ void updateChildWindow(); - //format code - void show_childwindow(CaptureButton *b); - void hide_ChildWindow(); -@@ -209,6 +210,8 @@ - uint m_id; - int magnifier_x; - int magnifier_y; -+ //signed width between FontSize_Color_Chose_Window and fistbutton -+ int length; - #ifdef ENABLE_RECORD - Recorder *recorder; - QMap m_isolatedButtons;