!29 update upstream version 1.0.5

From: @tanyulong2021 
Reviewed-by: @peijiankang 
Signed-off-by: @peijiankang
This commit is contained in:
openeuler-ci-bot 2022-12-09 01:08:47 +00:00 committed by Gitee
commit 56d0ba239f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 42 additions and 7416 deletions

View File

@ -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 <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 "mysavedialog.h"
+#include <QLineEdit>
+#include <QComboBox>
+#include <QDebug>
+#include <QStandardPaths>
+#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<QLineEdit *>("fileNameEdit").at(0)->setText(a);
+ connect(this->findChildren<QComboBox *>("fileTypeCombo").at(0), QOverload<int>::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<QLineEdit *>("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 <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 <QWidget>
+#include <QFileDialog>
+
+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 <QClipboard>
#include <QApplication>
#include <QMessageBox>
-#include <QFileDialog>
#include <QImageWriter>
+#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;
}

View File

@ -1,45 +0,0 @@
From 104239c8a8ad8e53377a6c06c574719eb788290f Mon Sep 17 00:00:00 2001
From: lvhan <lvhan@kylinos.cn>
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

View File

@ -1,71 +0,0 @@
From 03e592209248d972d491dc39a0b189002a9eb8ae Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Fri, 24 Jun 2022 13:58:39 +0800
Subject: [PATCH] change kylin-screenshot to screenshot
---
src/core/controller.cpp | 2 +-
src/widgets/capture/buttonhandler.cpp | 5 +++--
src/widgets/capturelauncher.cpp | 1 +
src/widgets/infowindow.cpp | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/core/controller.cpp b/src/core/controller.cpp
index fd70486..6cd047d 100755
--- a/src/core/controller.cpp
+++ b/src/core/controller.cpp
@@ -257,7 +257,7 @@ void Controller::enableTrayIcon() {
trayIconMenu->addAction(quitAction);
m_trayIcon = new QSystemTrayIcon();
- m_trayIcon->setToolTip(tr("Kylin-Screenshot"));
+ m_trayIcon->setToolTip(tr("Screenshot"));
m_trayIcon->setContextMenu(trayIconMenu);
//QIcon trayicon = QIcon::fromTheme("kylin-screenshot-tray", QIcon("/usr/share/icons/ukui-icon-theme-default/128x128/apps/kylin-screenshot.png"));
QIcon trayicon = QIcon("/usr/share/icons/ukui-icon-theme-default/128x128/apps/kylin-screenshot.png");
diff --git a/src/widgets/capture/buttonhandler.cpp b/src/widgets/capture/buttonhandler.cpp
index 5604b91..4086078 100755
--- a/src/widgets/capture/buttonhandler.cpp
+++ b/src/widgets/capture/buttonhandler.cpp
@@ -336,10 +336,11 @@ void ButtonHandler::positionButtonsInside(int index) {
// selection.
QRect mainArea = m_selection;
mainArea = intersectWithAreas(mainArea);
- const int buttonsPerRow = (mainArea.width()) / (m_buttonExtendedSize);
+ /*const int buttonsPerRow = (mainArea.width()) / (m_buttonExtendedSize);
if (buttonsPerRow == 0) {
return;
- }
+ }*/
+ const int buttonsPerRow = 19;
QPoint center = QPoint(mainArea.center().x(),
mainArea.bottom() - m_buttonExtendedSize);
diff --git a/src/widgets/capturelauncher.cpp b/src/widgets/capturelauncher.cpp
index 278ba77..d36e716 100755
--- a/src/widgets/capturelauncher.cpp
+++ b/src/widgets/capturelauncher.cpp
@@ -41,6 +41,7 @@ CaptureLauncher::CaptureLauncher(QWidget *parent) :
QWidget(parent), m_id(0)
{
setWindowIcon(QIcon("/usr/share/icons/ukui-icon-theme-default/128x128/apps/kylin-screenshot.png"));
+ setWindowTitle(tr("Screenshot"));
setAttribute(Qt::WA_DeleteOnClose);
connect(Controller::getInstance(), &Controller::captureTaken,
this, &CaptureLauncher::captureTaken);
diff --git a/src/widgets/infowindow.cpp b/src/widgets/infowindow.cpp
index 6f1e5ad..b0508f0 100755
--- a/src/widgets/infowindow.cpp
+++ b/src/widgets/infowindow.cpp
@@ -188,7 +188,7 @@ void InfoWindow::initLabels() {
QLabel *versionTitleLabel = new QLabel(tr("<u><b>Version</b></u>"), this);
versionTitleLabel->setAlignment(Qt::AlignHCenter);
m_layout->addWidget(versionTitleLabel);
- QString versionMsg = tr("Kylin-ScreenShot") + "v1.0.0" + "\n" +
+ QString versionMsg = tr("ScreenShot") + "v1.0.0" + "\n" +
tr("Compiled with Qt")
+ QT_VERSION_STR;
QLabel *versionLabel = new QLabel(versionMsg, this);
--
2.33.0

View File

@ -1,68 +0,0 @@
From 75a0f24336e038f7f2380745abf4639c6d94229f Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Mon, 27 Jun 2022 14:20:06 +0800
Subject: [PATCH] add log
---
debian/control | 2 +-
debian/source/format | 2 +-
kylin-screenshot.pro | 2 +-
src/main.cpp | 2 ++
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/debian/control b/debian/control
index 2c99e66..4ac86d9 100755
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: graphics
Priority: optional
Maintainer: Kylin Team <team+kylin@tracker.debian.org>
Uploaders: handsome_feng <jianfengli@ubuntukylin.com>
-Build-Depends: debhelper-compat (= 13),
+Build-Depends: debhelper-compat (= 12),
qt5-qmake,
qtbase5-dev,
qttools5-dev-tools,
diff --git a/debian/source/format b/debian/source/format
index 163aaf8..89ae9db 100755
--- a/debian/source/format
+++ b/debian/source/format
@@ -1 +1 @@
-3.0 (quilt)
+3.0 (native)
diff --git a/kylin-screenshot.pro b/kylin-screenshot.pro
index 3ffbc60..69458fb 100755
--- a/kylin-screenshot.pro
+++ b/kylin-screenshot.pro
@@ -6,7 +6,7 @@
win32:LIBS += -luser32 -lshell32
-LIBS += -lavutil -lavformat -lavcodec -lswscale -lX11 -lXext -lXtst -lXfixes -lXinerama -lpulse
+LIBS += -lukui-log4qt -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){
diff --git a/src/main.cpp b/src/main.cpp
index fc06999..d90685c 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <signal.h>
#include "src/common/CommandLineOptions.h"
+#include <ukui-log4qt.h>
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
#include "src/core/flameshotdbusadapter.h"
@@ -57,6 +58,7 @@ int main(int argc, char *argv[]) {
// required for the button serialization
// TODO: change to QVector in v1.0
+ initUkuiLog4qt("kylin-screenshot");
if (getScreenWidth() > 2560) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
--
2.33.0

View File

@ -1,39 +0,0 @@
From 0fdf762e789c8f530146a5014f873314cce36f15 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Tue, 28 Jun 2022 09:37:00 +0800
Subject: [PATCH] fixed wayland cannot screenshot top widget
---
src/utils/screengrabber.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp
index 7fef395..42b9cb3 100755
--- a/src/utils/screengrabber.cpp
+++ b/src/utils/screengrabber.cpp
@@ -99,7 +99,7 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool &ok) {
QPixmap ScreenGrabber::grabScreen(int screenNumber, bool &ok) {
QPixmap p;
- bool isVirtual = QApplication::desktop()->isVirtualDesktop();
+/* bool isVirtual = QApplication::desktop()->isVirtualDesktop();
if (isVirtual || m_info.waylandDectected()) {
p = grabEntireDesktop(ok);
if (ok) {
@@ -119,11 +119,11 @@ QPixmap ScreenGrabber::grabScreen(int screenNumber, bool &ok) {
p = p.copy(geometry);
}
}
- else {
+ else {*/
QList<WId> windows = KWindowSystem::windows();
QScreen* screen = QApplication::screens().at(0);
p =screen->grabWindow(KWindowSystem::activeWindow());
ok = true;
- }
+// }
return p;
}
--
2.33.0

View File

@ -1,25 +0,0 @@
From 9949bc701d108f68fbe1e3e16d753db5df98c61b Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Tue, 28 Jun 2022 17:05:35 +0800
Subject: [PATCH] change markertool opacity
---
src/tools/marker/markertool.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tools/marker/markertool.cpp b/src/tools/marker/markertool.cpp
index 980833b..7c16d98 100755
--- a/src/tools/marker/markertool.cpp
+++ b/src/tools/marker/markertool.cpp
@@ -70,7 +70,7 @@ void MarkerTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUn
updateBackup(pixmap);
}
painter.setCompositionMode(QPainter::CompositionMode_Multiply);
- painter.setOpacity(0.35);
+ painter.setOpacity(0.5);
painter.setPen(QPen(m_color, m_thickness));
painter.drawLine(m_points.first, m_points.second);
}
--
2.33.0

View File

@ -1,222 +0,0 @@
From 97df00beb618898b290ca2a633d5043c3d58e3db Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Wed, 29 Jun 2022 09:31:14 +0800
Subject: [PATCH] change text property in time
---
src/tools/AbstractActionToolWithWidget.cpp | 4 ++++
src/tools/AbstractActionToolWithWidget.h | 1 +
src/tools/abstractactiontool.cpp | 4 ++++
src/tools/abstractactiontool.h | 1 +
src/tools/abstractpathtool.cpp | 4 ++++
src/tools/abstractpathtool.h | 2 +-
src/tools/abstracttwopointtool.cpp | 4 ++++
src/tools/abstracttwopointtool.h | 1 +
src/tools/capturetool.h | 2 +-
src/tools/text/texttool.cpp | 11 +++++++++++
src/tools/text/texttool.h | 1 +
src/widgets/capture/capturewidget.cpp | 9 +++++++--
src/widgets/capture/capturewidget.h | 1 +
13 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/src/tools/AbstractActionToolWithWidget.cpp b/src/tools/AbstractActionToolWithWidget.cpp
index bd07d86..9289683 100644
--- a/src/tools/AbstractActionToolWithWidget.cpp
+++ b/src/tools/AbstractActionToolWithWidget.cpp
@@ -86,3 +86,7 @@ void AbstractActionToolWithWidget::colorChanged(const QColor &c) {
void AbstractActionToolWithWidget::thicknessChanged(const int th) {
Q_UNUSED(th);
}
+
+void AbstractActionToolWithWidget::textChanged(const CaptureContext &context) {
+ Q_UNUSED(context);
+}
diff --git a/src/tools/AbstractActionToolWithWidget.h b/src/tools/AbstractActionToolWithWidget.h
index d92e7cd..feb2fbe 100644
--- a/src/tools/AbstractActionToolWithWidget.h
+++ b/src/tools/AbstractActionToolWithWidget.h
@@ -44,4 +44,5 @@ public slots:
void drawStart(const CaptureContext &context) override;
void colorChanged(const QColor &c) override;
void thicknessChanged(const int th) override;
+ void textChanged(const CaptureContext &context) override;
};
diff --git a/src/tools/abstractactiontool.cpp b/src/tools/abstractactiontool.cpp
index 2d0c886..df19020 100755
--- a/src/tools/abstractactiontool.cpp
+++ b/src/tools/abstractactiontool.cpp
@@ -84,3 +84,7 @@ void AbstractActionTool::colorChanged(const QColor &c) {
void AbstractActionTool::thicknessChanged(const int th) {
Q_UNUSED(th);
}
+
+void AbstractActionTool::textChanged(const CaptureContext &context) {
+ Q_UNUSED(context);
+}
diff --git a/src/tools/abstractactiontool.h b/src/tools/abstractactiontool.h
index 8b8b9c3..3cf57ac 100755
--- a/src/tools/abstractactiontool.h
+++ b/src/tools/abstractactiontool.h
@@ -42,4 +42,5 @@ public slots:
void drawStart(const CaptureContext &context) override;
void colorChanged(const QColor &c) override;
void thicknessChanged(const int th) override;
+ void textChanged(const CaptureContext &context) override;
};
diff --git a/src/tools/abstractpathtool.cpp b/src/tools/abstractpathtool.cpp
index 89ab28f..e678c4f 100755
--- a/src/tools/abstractpathtool.cpp
+++ b/src/tools/abstractpathtool.cpp
@@ -82,3 +82,7 @@ void AbstractPathTool::addPoint(const QPoint &point) {
}
m_points.append(point);
}
+
+void AbstractPathTool::textChanged(const CaptureContext &context) {
+ Q_UNUSED(context);
+}
diff --git a/src/tools/abstractpathtool.h b/src/tools/abstractpathtool.h
index 172dab8..842fcb1 100755
--- a/src/tools/abstractpathtool.h
+++ b/src/tools/abstractpathtool.h
@@ -35,7 +35,7 @@ public slots:
void drawMove(const QPoint &p) override;
void colorChanged(const QColor &c) override;
void thicknessChanged(const int th) override;
-
+ void textChanged(const CaptureContext &context) override;
protected:
void updateBackup(const QPixmap &pixmap);
void addPoint(const QPoint &point);
diff --git a/src/tools/abstracttwopointtool.cpp b/src/tools/abstracttwopointtool.cpp
index d968dea..6403190 100755
--- a/src/tools/abstracttwopointtool.cpp
+++ b/src/tools/abstracttwopointtool.cpp
@@ -133,3 +133,7 @@ QPoint AbstractTwoPointTool::adjustedVector(QPoint v) const {
}
return v;
}
+
+void AbstractTwoPointTool::textChanged(const CaptureContext &context) {
+ Q_UNUSED(context);
+}
diff --git a/src/tools/abstracttwopointtool.h b/src/tools/abstracttwopointtool.h
index 65ee630..4c684d2 100755
--- a/src/tools/abstracttwopointtool.h
+++ b/src/tools/abstracttwopointtool.h
@@ -39,6 +39,7 @@ public slots:
void drawMoveWithAdjustment(const QPoint &p) override;
void colorChanged(const QColor &c) override;
void thicknessChanged(const int th) override;
+ void textChanged(const CaptureContext &context) override;
protected:
void updateBackup(const QPixmap &pixmap);
diff --git a/src/tools/capturetool.h b/src/tools/capturetool.h
index f1eff27..8531aeb 100755
--- a/src/tools/capturetool.h
+++ b/src/tools/capturetool.h
@@ -191,7 +191,7 @@ public slots:
virtual void colorChanged(const QColor &c) = 0;
// Called when the thickness of the tool is updated in the editor.
virtual void thicknessChanged(const int th) = 0;
-
+ virtual void textChanged(const CaptureContext &context) = 0;
#ifdef ENABLE_RECORD
virtual void pressCalled() {
m_isPressed = !m_isPressed;
diff --git a/src/tools/text/texttool.cpp b/src/tools/text/texttool.cpp
index 43ac557..b70889e 100755
--- a/src/tools/text/texttool.cpp
+++ b/src/tools/text/texttool.cpp
@@ -201,6 +201,17 @@ void TextTool::thicknessChanged(const int th) {
}
}
+void TextTool::textChanged(const CaptureContext &context)
+{
+ m_font.setUnderline(context.underline);
+ m_font.setStrikeOut(context.deleteline);
+ m_font.setItalic(context.italic);
+ m_font.setBold(context.bold);
+ if (m_widget) {
+ m_widget->setFont(m_font);
+ }
+}
+
void TextTool::updateText(const QString &s) {
m_text = s;
}
diff --git a/src/tools/text/texttool.h b/src/tools/text/texttool.h
index 8981bff..c97a87e 100755
--- a/src/tools/text/texttool.h
+++ b/src/tools/text/texttool.h
@@ -58,6 +58,7 @@ public slots:
void pressed(const CaptureContext &context) override;
void colorChanged(const QColor &c) override;
void thicknessChanged(const int th) override;
+ void textChanged(const CaptureContext &context) override;
private slots:
void updateText(const QString &s);
diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp
index 178d7da..b93e08c 100755
--- a/src/widgets/capture/capturewidget.cpp
+++ b/src/widgets/capture/capturewidget.cpp
@@ -631,6 +631,8 @@ void CaptureWidget::mousePressEvent(QMouseEvent *e) {
m_activeTool, &CaptureTool::thicknessChanged);
connect(m_activeTool, &CaptureTool::requestAction,
this, &CaptureWidget::handleButtonSignal);
+ connect(this,&CaptureWidget::textchanged,
+ m_activeTool, &CaptureTool::textChanged);
m_activeTool->drawStart(m_context);
return;
}
@@ -1266,7 +1268,7 @@ void CaptureWidget::setState(CaptureButton *b) {
new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Left), this, SLOT(leftResize()));
new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Up), this, SLOT(upResize()));
new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Down), this, SLOT(downResize()));
- // new QShortcut(Qt::Key_Space, this, SLOT(togglePanel()));
+ new QShortcut(Qt::Key_Space, this, SLOT(togglePanel()));
new QShortcut(Qt::Key_Escape, this, SLOT(deleteToolwidgetOrClose()));
new QShortcut(Qt::Key_Return, this, SLOT(copyScreenshot()));
new QShortcut(Qt::Key_Enter, this, SLOT(copyScreenshot()));
@@ -1480,19 +1482,22 @@ void CaptureWidget::setState(CaptureButton *b) {
void CaptureWidget::font_bold_clicked(bool b)
{
m_context.bold = b;
+ emit textchanged(m_context);
}
void CaptureWidget::font_delete_clicked(bool b)
{
m_context.deleteline = b;
+ emit textchanged(m_context);
}
void CaptureWidget::font_underline_clicked(bool b)
{
m_context.underline =b;
-
+ emit textchanged(m_context);
}
void CaptureWidget::font_italic_clicked(bool b)
{
m_context.italic =b;
+ emit textchanged(m_context);
}
void CaptureWidget::ClickedSaveType(int i)
{
diff --git a/src/widgets/capture/capturewidget.h b/src/widgets/capture/capturewidget.h
index 1d011d3..ce04f5d 100755
--- a/src/widgets/capture/capturewidget.h
+++ b/src/widgets/capture/capturewidget.h
@@ -88,6 +88,7 @@ signals:
void captureFailed(uint id);
void colorChanged(const QColor &c);
void thicknessChanged(const int thickness);
+ void textchanged(CaptureContext m_context);
private slots:
// TODO replace with tools
--
2.33.0

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
From 358f633f51ae1264d56752475cb29921a5613013 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Mon, 11 Jul 2022 15:28:12 +0800
Subject: [PATCH] add changelog for 1.0.1
---
debian/changelog | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 8a949fb..cd74632 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+kylin-screenshot (1.0.1-1) focal; urgency=medium
+
+ * New upstream release.
+
+ -- handsome_feng <jianfengli@ubuntukylin.com> Thu, 17 Jun 2021 20:05:52 +0800
+
kylin-screenshot (1.0.0-1) unstable; urgency=medium
* Initial release. (Closes: #969417)
--
2.33.0

View File

@ -1,30 +0,0 @@
From 8dcf3640346818e4540559f7e921d90fe9a0f00d Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Wed, 13 Jul 2022 10:08:57 +0800
Subject: [PATCH] pin windget windowIcon follow theme
---
src/tools/pin/pinwidget.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp
index 4c10ecd..0eef443 100755
--- a/src/tools/pin/pinwidget.cpp
+++ b/src/tools/pin/pinwidget.cpp
@@ -26,12 +26,11 @@
PinWidget::PinWidget(const QPixmap &pixmap, QWidget *parent) :
QWidget(parent), m_pixmap(pixmap)
{
- setWindowIcon(QIcon("/usr/share/icons/ukui-icon-theme-default/128x128/apps/kylin-screenshot.png"));
setWindowFlags(Qt::WindowStaysOnTopHint
| Qt::FramelessWindowHint);
//set the bottom widget background transparent
setAttribute(Qt::WA_TranslucentBackground);
- setMinimumWidth(300);
+ //setMinimumWidth(300);
ConfigHandler conf;
m_baseColor = conf.uiMainColorValue();
m_hoverColor = conf.uiContrastColorValue();
--
2.33.0

View File

@ -1,93 +0,0 @@
From 15e9127686ece049524c8ca2ac8e16629769174f Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Wed, 13 Jul 2022 14:14:10 +0800
Subject: [PATCH] change coloeFontWidget some ui options
---
src/widgets/capture/fontsize_color_chose.cpp | 26 ++++++++++++++-----
src/widgets/capture/fontsize_color_chose2.cpp | 21 ++++++++++++---
2 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/src/widgets/capture/fontsize_color_chose.cpp b/src/widgets/capture/fontsize_color_chose.cpp
index a5d5ba0..7a26c7f 100755
--- a/src/widgets/capture/fontsize_color_chose.cpp
+++ b/src/widgets/capture/fontsize_color_chose.cpp
@@ -121,18 +121,30 @@ void FontSize_Color_Chose::paintEvent(QPaintEvent *event)
if (color_rect == rect){
Rect_h = rect.height()+4;
Rect_w = rect.width() +4;
- painter.setBrush(QColor(255,255,255));
- painter.drawEllipse(QRect(rect.x()-2,rect.y()-2,Rect_h,Rect_w));
- painter.setBrush(QColor(0,0,0));
- painter.drawEllipse(rect);
+ painter.setBrush(QColor(255,255,255));
+ painter.drawEllipse(QRect(rect.x()-2,rect.y()-2,Rect_h,Rect_w));
+ if ((context.style_name.compare("ukui-dark") == 0)
+ || (context.style_name.compare("ukui-black") == 0)) {
+ painter.setBrush(QColor(Qt::gray));
+ } else
+ painter.setBrush(QColor(0, 0, 0));
+ painter.drawEllipse(rect);
}
else{
- painter.setBrush(QColor(78,78,78));
+ if ((context.style_name.compare("ukui-dark") == 0)
+ || (context.style_name.compare("ukui-black") == 0)) {
+ painter.setBrush(QColor(Qt::gray));
+ } else
+ painter.setBrush(QColor(78, 78, 78));
painter.drawEllipse(rect);
}
}
- painter.setBrush(QColor(25,25,25));
- painter.drawRect(80,31,1,17);
+ if ((context.style_name.compare("ukui-dark") == 0)
+ || (context.style_name.compare("ukui-black") == 0)) {
+ painter.setBrush(QColor(Qt::gray));
+ } else
+ painter.setBrush(QColor(25, 25, 25, 153));
+ painter.drawRect(85,33,1.52,16);
for (int i =4;i<12;i++)
{
QRect rect = m_colorAreaList.at(i);
diff --git a/src/widgets/capture/fontsize_color_chose2.cpp b/src/widgets/capture/fontsize_color_chose2.cpp
index cd2b89c..859c2ab 100755
--- a/src/widgets/capture/fontsize_color_chose2.cpp
+++ b/src/widgets/capture/fontsize_color_chose2.cpp
@@ -121,16 +121,29 @@ void FontSize_Color_Chose2::paintEvent(QPaintEvent *event)
Rect_w = rect.width() +4;
painter.setBrush(QColor(255,255,255));
painter.drawEllipse(QRect(rect.x()-2,rect.y()-2,Rect_h,Rect_w));
- painter.setBrush(QColor(0,0,0));
+ if ((context.style_name.compare("ukui-dark") == 0)
+ || (context.style_name.compare("ukui-black") == 0)) {
+ painter.setBrush(QColor(Qt::gray));
+ } else
+ painter.setBrush(QColor(0, 0, 0));
+ painter.drawEllipse(rect);
painter.drawEllipse(rect);
}
else{
- painter.setBrush(QColor(78,78,78));
+ if ((context.style_name.compare("ukui-dark") == 0)
+ || (context.style_name.compare("ukui-black") == 0)) {
+ painter.setBrush(QColor(Qt::gray));
+ } else
+ painter.setBrush(QColor(78, 78, 78));
painter.drawEllipse(rect);
}
}
- painter.setBrush(QColor(25,25,25));
- painter.drawRect(80,17,1,14);
+ if ((context.style_name.compare("ukui-dark") == 0)
+ || (context.style_name.compare("ukui-black") == 0)) {
+ painter.setBrush(QColor(Qt::gray));
+ } else
+ painter.setBrush(QColor(25, 25, 25, 153));
+ painter.drawRect(80,17,1.52,16);
for (int i =4;i<12;i++)
{
QRect rect = m_colorAreaList.at(i);
--
2.33.0

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,9 @@
%define debug_package %{nil}
Name: kylin-screenshot
Version: 1.0.0
Release: 15
Version: 1.0.5
Release: 1
Summary: a powerful screenshot and screen recording tool
License: GPL-3.0-or-later and LGPL-3.0-or-later and MIT and Apache-2.0
License: GPL-3+
URL: https://github.com/ubuntukylin
Source0: %{name}-%{version}.tar.gz
@ -23,22 +23,10 @@ BuildRequires: ffmpeg-devel
BuildRequires: kf5-kwindowsystem-devel
BuildRequires: kf5-kwindowsystem
BuildRequires: gsettings-qt-devel
BuildRequires: ukui-interface
# Requires: NetworkManager
patch0: 0001-fix-screenshot-service.patch
patch1: 0001-add-save-dialog.patch
patch2: optimize-the-undo-button-function.patch
patch3: 0003-change-kylin-screenshot-to-screenshot.patch
patch4: 0004-add-log.patch
patch5: 0005-fixed-wayland-cannot-screenshot-top-widget.patch
patch6: 0006-change-markertool-opacity.patch
patch7: 0007-change-text-property-in-time.patch
patch8: 0008-change-notify-information-about-application-name.patch
patch9: 0009-add-changelog-for-1.0.1.patch
patch10: 0010-pin-windget-windowIcon-follow-theme.patch
patch11: 0011-change-coloeFontWidget-some-ui-options.patch
%description
Powerful yet simple-to-use screenshot software
@ -50,18 +38,6 @@ patch11: 0011-change-coloeFontWidget-some-ui-options.patch
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%build
%{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-screenshot.pro
@ -75,43 +51,46 @@ make INSTALL_ROOT=%{buildroot} install
rm -rf $RPM_BUILD_ROOT
%files
%{_bindir}/kylin-screenshot
%{_datadir}/applications/kylin-screenshot.desktop
%{_datadir}/dbus-1/interfaces/org.dharkael.kylinscreenshot.xml
%{_datadir}/dbus-1/services/org.dharkael.kylinscreenshot.service
%{_datadir}/glib-2.0/schemas/org.ukui.screenshot.gschema.xml
%{_datadir}/icons/hicolor/128x128/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/128x128@2x/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/16x16/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/16x16@2x/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/24x24/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/256x256/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/256x256@2x/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/32x32/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/32x32@2x/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/48x48/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/48x48@2x/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/64x64@2x/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/96x96/apps/kylin-screenshot.png
%{_datadir}/icons/hicolor/96x96@2x/apps/kylin-screenshot.png
%{_datadir}/kylin-screenshot/translations/Internationalization_ca.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_de_DE.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_es.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_fr.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_ja.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_ka.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_pl.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_pt_br.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_ru.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_sk.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_sr.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_tr.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_uk.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_zh_CN.qm
%{_datadir}/kylin-screenshot/translations/Internationalization_zh_TW.qm
%{_datadir}/metainfo/kylinscreenshot.appdata.xml
/usr/local/bin/kylin-screenshot
/usr/local/share/applications/kylin-screenshot.desktop
/usr/local/share/dbus-1/interfaces/org.dharkael.kylinscreenshot.xml
/usr/local/share/dbus-1/services/org.dharkael.kylinscreenshot.service
/usr/local/share/glib-2.0/schemas/org.ukui.screenshot.gschema.xml
/usr/local/share/icons/hicolor/128x128/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/128x128@2x/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/16x16/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/16x16@2x/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/24x24/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/256x256/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/256x256@2x/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/32x32/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/32x32@2x/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/48x48/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/48x48@2x/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/64x64@2x/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/96x96/apps/kylin-screenshot.png
/usr/local/share/icons/hicolor/96x96@2x/apps/kylin-screenshot.png
/usr/local/share/kylin-screenshot/translations/Internationalization_ca.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_de_DE.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_es.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_fr.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_ja.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_ka.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_pl.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_pt_br.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_ru.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_sk.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_sr.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_tr.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_uk.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_zh_CN.qm
/usr/local/share/kylin-screenshot/translations/Internationalization_zh_TW.qm
/usr/local/share/metainfo/kylinscreenshot.appdata.xml
%changelog
* Mon Oct 24 2022 tanyulong <tanyulong@kylinos.cn> - 1.0.5-1
- update upstream version 1.0.5
* Wed Jul 13 2022 peijiankang <peijiankang@kylinos.cn> - 1.0.0-15
- change coloeFontWidget some ui options

View File

@ -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 <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;