aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp22
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.h1
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.ui9
3 files changed, 32 insertions, 0 deletions
diff --git a/launcher/ui/pages/instance/ScreenshotsPage.cpp b/launcher/ui/pages/instance/ScreenshotsPage.cpp
index 06c4379f..e391b95d 100644
--- a/launcher/ui/pages/instance/ScreenshotsPage.cpp
+++ b/launcher/ui/pages/instance/ScreenshotsPage.cpp
@@ -250,6 +250,12 @@ bool ScreenshotsPage::eventFilter(QObject *obj, QEvent *evt)
return QWidget::eventFilter(obj, evt);
}
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(evt);
+
+ if (keyEvent->matches(QKeySequence::Copy)) {
+ on_actionCopy_triggered();
+ return true;
+ }
+
switch (keyEvent->key())
{
case Qt::Key_Delete:
@@ -372,6 +378,22 @@ void ScreenshotsPage::on_actionUpload_triggered()
m_uploadActive = false;
}
+void ScreenshotsPage::on_actionCopy_triggered()
+{
+ auto selection = ui->listView->selectionModel()->selectedRows();
+ if(selection.size() < 1)
+ {
+ return;
+ }
+
+ // You can only copy one image to the clipboard. In the case of multiple selected files, only the first one gets copied.
+ auto item = selection[0];
+ auto info = m_model->fileInfo(item);
+ QImage image(info.absoluteFilePath());
+ Q_ASSERT(!image.isNull());
+ QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
+}
+
void ScreenshotsPage::on_actionDelete_triggered()
{
auto mbox = CustomMessageBox::selectable(
diff --git a/launcher/ui/pages/instance/ScreenshotsPage.h b/launcher/ui/pages/instance/ScreenshotsPage.h
index d2f44837..d32f08ff 100644
--- a/launcher/ui/pages/instance/ScreenshotsPage.h
+++ b/launcher/ui/pages/instance/ScreenshotsPage.h
@@ -73,6 +73,7 @@ protected:
private slots:
void on_actionUpload_triggered();
+ void on_actionCopy_triggered();
void on_actionDelete_triggered();
void on_actionRename_triggered();
void on_actionView_Folder_triggered();
diff --git a/launcher/ui/pages/instance/ScreenshotsPage.ui b/launcher/ui/pages/instance/ScreenshotsPage.ui
index ec461087..bb4213de 100644
--- a/launcher/ui/pages/instance/ScreenshotsPage.ui
+++ b/launcher/ui/pages/instance/ScreenshotsPage.ui
@@ -50,6 +50,7 @@
<bool>false</bool>
</attribute>
<addaction name="actionUpload"/>
+ <addaction name="actionCopy"/>
<addaction name="actionDelete"/>
<addaction name="actionRename"/>
<addaction name="actionView_Folder"/>
@@ -74,6 +75,14 @@
<string>View Folder</string>
</property>
</action>
+ <action name="actionCopy">
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="toolTip">
+ <string>Copy</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>