!3 add save dialog
From: @dou33 Reviewed-by: @tanyulong2021 Signed-off-by: @tanyulong2021
This commit is contained in:
commit
4317b7b219
149
0001-add-save-dialog.patch
Normal file
149
0001-add-save-dialog.patch
Normal file
@ -0,0 +1,149 @@
|
||||
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;
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
%define debug_package %{nil}
|
||||
Name: kylin-screenshot
|
||||
Version: 1.0.0
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: a powerful screenshot and screen recording tool
|
||||
License: GPL-3+
|
||||
URL: https://github.com/ubuntukylin
|
||||
@ -27,6 +27,7 @@ BuildRequires: gsettings-qt-devel
|
||||
# Requires: NetworkManager
|
||||
|
||||
patch0: 0001-fix-screenshot-service.patch
|
||||
patch1: 0001-add-save-dialog.patch
|
||||
|
||||
%description
|
||||
Powerful yet simple-to-use screenshot software
|
||||
@ -39,6 +40,7 @@ patch0: 0001-fix-screenshot-service.patch
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
%{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-screenshot.pro
|
||||
@ -89,6 +91,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/metainfo/kylinscreenshot.appdata.xml
|
||||
|
||||
%changelog
|
||||
* Tue Dec 7 2021 douyan <douyan@kylinos.cn> - 1.0.0-3
|
||||
- add save dialog
|
||||
|
||||
* Thu Jan 14 2021 lvhan <lvhan@kylinos.cn> - 1.0.0-2
|
||||
- fix-screenshot-service
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user