6
6
#include " src/utils/confighandler.h"
7
7
#include " src/utils/globalvalues.h"
8
8
#include " src/utils/history.h"
9
+ #include " src/utils/screenshotsaver.h"
9
10
#include " src/widgets/imagelabel.h"
10
11
#include " src/widgets/loadspinner.h"
11
12
#include " src/widgets/notificationwidget.h"
@@ -130,10 +131,12 @@ void ImgUploaderBase::showPostUploadDialog()
130
131
m_openUrlButton = new QPushButton (tr (" Open URL" ));
131
132
m_openDeleteUrlButton = new QPushButton (tr (" Delete image" ));
132
133
m_toClipboardButton = new QPushButton (tr (" Image to Clipboard." ));
134
+ m_saveToFilesystemButton = new QPushButton (tr (" Save image" ));
133
135
m_hLayout->addWidget (m_copyUrlButton);
134
136
m_hLayout->addWidget (m_openUrlButton);
135
137
m_hLayout->addWidget (m_openDeleteUrlButton);
136
138
m_hLayout->addWidget (m_toClipboardButton);
139
+ m_hLayout->addWidget (m_saveToFilesystemButton);
137
140
138
141
connect (
139
142
m_copyUrlButton, &QPushButton::clicked, this , &ImgUploaderBase::copyURL);
@@ -147,6 +150,11 @@ void ImgUploaderBase::showPostUploadDialog()
147
150
&QPushButton::clicked,
148
151
this ,
149
152
&ImgUploaderBase::copyImage);
153
+
154
+ QObject::connect (m_saveToFilesystemButton,
155
+ &QPushButton::clicked,
156
+ this ,
157
+ &ImgUploaderBase::saveScreenshotToFilesystem);
150
158
}
151
159
152
160
void ImgUploaderBase::openURL ()
@@ -176,3 +184,13 @@ void ImgUploaderBase::deleteCurrentImage()
176
184
history.unpackFileName (m_currentImageName);
177
185
deleteImage (unpackFileName.file , unpackFileName.token );
178
186
}
187
+
188
+ void ImgUploaderBase::saveScreenshotToFilesystem ()
189
+ {
190
+ if (!ScreenshotSaver ().saveToFilesystemGUI (m_pixmap)) {
191
+ m_notification->showMessage (
192
+ tr (" Unable to save the screenshot to disk." ));
193
+ return ;
194
+ }
195
+ m_notification->showMessage (tr (" Screenshot saved." ));
196
+ }
0 commit comments