691 lines
26 KiB
Diff
691 lines
26 KiB
Diff
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 <maarten-baert@hotmail.com>
|
|
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 <libavutil/rational.h>
|
|
-// #include <libavformat/avformat.h>
|
|
-// #include <libavutil/frame.h>
|
|
-// #include <libavutil/mem.h>
|
|
-// #include <libavcodec/avcodec.h>
|
|
-// #include <libswscale/swscale.h>
|
|
-// #include <libavutil/pixfmt.h>
|
|
-// #include <libavutil/samplefmt.h>
|
|
+#include <libavutil/rational.h>
|
|
+#include <libavformat/avformat.h>
|
|
+#include <libavutil/frame.h>
|
|
+#include <libavutil/mem.h>
|
|
+//#include <libavcodec/avcodec.h>
|
|
+#include <libswscale/swscale.h>
|
|
+#include <libavutil/pixfmt.h>
|
|
+#include <libavutil/samplefmt.h>
|
|
}
|
|
#include <exception>
|
|
|
|
// 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 <zhanghuanhuan@kylinos.cn>
|
|
+ *
|
|
+ * 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 <https://www.gnu.org/licenses/>.
|
|
+ */
|
|
+#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 <zhanghuanhuan@kylinos.cn>
|
|
+ *
|
|
+ * 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 <https://www.gnu.org/licenses/>.
|
|
+ */
|
|
+#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 <QLabel>
|
|
#include <QHBoxLayout>
|
|
-#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 <QPainter>
|
|
#include <QStandardPaths>
|
|
-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<CaptureButton::ButtonType, CaptureTool*> m_isolatedButtons;
|