aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages
diff options
context:
space:
mode:
authorGhosty <ghosty141@gmail.com>2021-12-03 16:08:11 +0100
committerGhosty <ghosty141@gmail.com>2021-12-03 16:08:11 +0100
commite9c52ec69663b2cb28a40428c96de749bdf49547 (patch)
tree37219bcaa2762da1d09a7d6331e2bb91d9f4dcae /launcher/ui/pages
parent75f2dab3c87d9d88979553792473a5aace4c96bf (diff)
downloadPrismLauncher-e9c52ec69663b2cb28a40428c96de749bdf49547.tar.gz
PrismLauncher-e9c52ec69663b2cb28a40428c96de749bdf49547.tar.bz2
PrismLauncher-e9c52ec69663b2cb28a40428c96de749bdf49547.zip
NOISSUE Added Copy File(s) feature for the screenshot page
- Ctrl+C now copies the file instead of the image data - Renamed Copy to Copy Image
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp24
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.h3
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.ui17
3 files changed, 37 insertions, 7 deletions
diff --git a/launcher/ui/pages/instance/ScreenshotsPage.cpp b/launcher/ui/pages/instance/ScreenshotsPage.cpp
index e391b95d..7aead623 100644
--- a/launcher/ui/pages/instance/ScreenshotsPage.cpp
+++ b/launcher/ui/pages/instance/ScreenshotsPage.cpp
@@ -252,7 +252,7 @@ bool ScreenshotsPage::eventFilter(QObject *obj, QEvent *evt)
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(evt);
if (keyEvent->matches(QKeySequence::Copy)) {
- on_actionCopy_triggered();
+ on_actionCopy_File_s_triggered();
return true;
}
@@ -378,7 +378,7 @@ void ScreenshotsPage::on_actionUpload_triggered()
m_uploadActive = false;
}
-void ScreenshotsPage::on_actionCopy_triggered()
+void ScreenshotsPage::on_actionCopy_Image_triggered()
{
auto selection = ui->listView->selectionModel()->selectedRows();
if(selection.size() < 1)
@@ -394,6 +394,26 @@ void ScreenshotsPage::on_actionCopy_triggered()
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
}
+void ScreenshotsPage::on_actionCopy_File_s_triggered()
+{
+ auto selection = ui->listView->selectionModel()->selectedRows();
+ if(selection.size() < 1)
+ {
+ // Don't do anything so we don't empty the users clipboard
+ return;
+ }
+
+ QString buf = "";
+ for (auto item : selection)
+ {
+ auto info = m_model->fileInfo(item);
+ buf += "file:///" + info.absoluteFilePath() + "\r\n";
+ }
+ QMimeData* mimeData = new QMimeData();
+ mimeData->setData("text/uri-list", buf.toLocal8Bit());
+ QApplication::clipboard()->setMimeData(mimeData);
+}
+
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 d32f08ff..2a1fdeee 100644
--- a/launcher/ui/pages/instance/ScreenshotsPage.h
+++ b/launcher/ui/pages/instance/ScreenshotsPage.h
@@ -73,7 +73,8 @@ protected:
private slots:
void on_actionUpload_triggered();
- void on_actionCopy_triggered();
+ void on_actionCopy_Image_triggered();
+ void on_actionCopy_File_s_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 bb4213de..2e2227a2 100644
--- a/launcher/ui/pages/instance/ScreenshotsPage.ui
+++ b/launcher/ui/pages/instance/ScreenshotsPage.ui
@@ -50,7 +50,8 @@
<bool>false</bool>
</attribute>
<addaction name="actionUpload"/>
- <addaction name="actionCopy"/>
+ <addaction name="actionCopy_Image"/>
+ <addaction name="actionCopy_File_s"/>
<addaction name="actionDelete"/>
<addaction name="actionRename"/>
<addaction name="actionView_Folder"/>
@@ -75,12 +76,20 @@
<string>View Folder</string>
</property>
</action>
- <action name="actionCopy">
+ <action name="actionCopy_Image">
<property name="text">
- <string>Copy</string>
+ <string>Copy Image</string>
</property>
<property name="toolTip">
- <string>Copy</string>
+ <string>Copy Image</string>
+ </property>
+ </action>
+ <action name="actionCopy_File_s">
+ <property name="text">
+ <string>Copy File(s)</string>
+ </property>
+ <property name="toolTip">
+ <string>Copy File(s)</string>
</property>
</action>
</widget>