150 lines
5.6 KiB
Diff
150 lines
5.6 KiB
Diff
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;
|
|
}
|