From 75f2dab3c87d9d88979553792473a5aace4c96bf Mon Sep 17 00:00:00 2001 From: Ghosty Date: Fri, 3 Dec 2021 03:02:58 +0100 Subject: NOISSUE Implemented copy screenshots to the clipboard - Added context-menu entry - Ctrl+C keybind works as well - If multiple screenshots are selected, only the first one gets copied --- launcher/ui/pages/instance/ScreenshotsPage.cpp | 22 ++++++++++++++++++++++ launcher/ui/pages/instance/ScreenshotsPage.h | 1 + launcher/ui/pages/instance/ScreenshotsPage.ui | 9 +++++++++ 3 files changed, 32 insertions(+) (limited to 'launcher/ui') 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(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 @@ false + @@ -74,6 +75,14 @@ View Folder + + + Copy + + + Copy + + -- cgit From e9c52ec69663b2cb28a40428c96de749bdf49547 Mon Sep 17 00:00:00 2001 From: Ghosty Date: Fri, 3 Dec 2021 16:08:11 +0100 Subject: 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 --- launcher/ui/pages/instance/ScreenshotsPage.cpp | 24 ++++++++++++++++++++++-- launcher/ui/pages/instance/ScreenshotsPage.h | 3 ++- launcher/ui/pages/instance/ScreenshotsPage.ui | 17 +++++++++++++---- 3 files changed, 37 insertions(+), 7 deletions(-) (limited to 'launcher/ui') 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(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 @@ false - + + @@ -75,12 +76,20 @@ View Folder - + - Copy + Copy Image - Copy + Copy Image + + + + + Copy File(s) + + + Copy File(s) -- cgit From a97d0a36f4807e082273d0f137186a5cebf6cd5d Mon Sep 17 00:00:00 2001 From: Ghosty Date: Fri, 3 Dec 2021 16:29:28 +0100 Subject: NOISSUE Copy Image is not shown if the selection is > 1 --- launcher/ui/pages/instance/ScreenshotsPage.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'launcher/ui') diff --git a/launcher/ui/pages/instance/ScreenshotsPage.cpp b/launcher/ui/pages/instance/ScreenshotsPage.cpp index 7aead623..ccde78e7 100644 --- a/launcher/ui/pages/instance/ScreenshotsPage.cpp +++ b/launcher/ui/pages/instance/ScreenshotsPage.cpp @@ -278,6 +278,11 @@ ScreenshotsPage::~ScreenshotsPage() void ScreenshotsPage::ShowContextMenu(const QPoint& pos) { auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); + + if (ui->listView->selectionModel()->selectedRows().size() > 1) { + menu->removeAction( ui->actionCopy_Image ); + } + menu->exec(ui->listView->mapToGlobal(pos)); delete menu; } -- cgit From c1aaf89baa6166707d7d489fe8ec1bcad1155df1 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 27 Jan 2022 19:06:07 -0500 Subject: Improve the About page Improves #106. This more clearly marks the original MultiMC contributors, and now correctly hides the "Build Platform" if this is set as empty. The version label is now moved under the "PolyMC" title so it looks just a little bit better (and matches other applications). The copyright on the "About" page now correctly attributes the MultiMC contributors just like on the "License" page. --- launcher/ui/dialogs/AboutDialog.cpp | 10 +++++++--- launcher/ui/dialogs/AboutDialog.ui | 17 +++++++---------- program_info/CMakeLists.txt | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'launcher/ui') diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp index 46d2f429..bba3f78b 100644 --- a/launcher/ui/dialogs/AboutDialog.cpp +++ b/launcher/ui/dialogs/AboutDialog.cpp @@ -33,7 +33,7 @@ QString getCreditsHtml() stream.setCodec(QTextCodec::codecForName("UTF-8")); stream << "
\n"; // TODO: possibly retrieve from git history at build time? - stream << "

" << QObject::tr("Developers", "About Credits") << "

\n"; + stream << "

" << QObject::tr("MultiMC Developers", "About Credits") << "

\n"; stream << "

Andrew Okin <forkk@forkk.net>

\n"; stream << "

Petr Mrázek <peterix@gmail.com>

\n"; stream << "

Sky Welch <multimc@bunnies.io>

\n"; @@ -83,8 +83,12 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia ui->icon->setPixmap(APPLICATION->getThemedIcon("logo").pixmap(64)); ui->title->setText(launcherName); - ui->versionLabel->setText(tr("Version") +": " + BuildConfig.printableVersionString()); - ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM); + ui->versionLabel->setText(BuildConfig.printableVersionString()); + + if (!BuildConfig.BUILD_PLATFORM.isEmpty()) + ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM); + else + ui->platformLabel->setVisible(false); if (BuildConfig.VERSION_BUILD >= 0) ui->buildNumLabel->setText(tr("Build Number") +": " + QString::number(BuildConfig.VERSION_BUILD)); diff --git a/launcher/ui/dialogs/AboutDialog.ui b/launcher/ui/dialogs/AboutDialog.ui index 822c6f58..58275c66 100644 --- a/launcher/ui/dialogs/AboutDialog.ui +++ b/launcher/ui/dialogs/AboutDialog.ui @@ -86,6 +86,13 @@ Qt::AlignCenter + + + + + Qt::AlignCenter + + @@ -151,16 +158,6 @@ - - - - Version: - - - Qt::AlignCenter - - - diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 26369fe5..0466b893 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -1,6 +1,6 @@ set(Launcher_CommonName "PolyMC") -set(Launcher_Copyright "PolyMC Contributors" PARENT_SCOPE) +set(Launcher_Copyright "PolyMC Contributors\\n© 2012-2021 MultiMC Contributors" PARENT_SCOPE) set(Launcher_Domain "polymc.org" PARENT_SCOPE) set(Launcher_Name "${Launcher_CommonName}" PARENT_SCOPE) set(Launcher_DisplayName "${Launcher_CommonName}" PARENT_SCOPE) -- cgit From 0211ee3ef10ca169354ac939761f0128e16ff026 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 31 Jan 2022 09:09:58 -0500 Subject: Add "PolyMC Contributors" to Credits section This also adds a link to the PolyMC Contributors page on Github. --- launcher/ui/dialogs/AboutDialog.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'launcher/ui') diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp index bba3f78b..ef96cc23 100644 --- a/launcher/ui/dialogs/AboutDialog.cpp +++ b/launcher/ui/dialogs/AboutDialog.cpp @@ -32,6 +32,12 @@ QString getCreditsHtml() QTextStream stream(&output); stream.setCodec(QTextCodec::codecForName("UTF-8")); stream << "
\n"; + + stream << "

" << QObject::tr("PolyMC Developers", "About Credits") << "

\n"; + stream << "

swirl <swurl@swurl.xyz >

\n"; + stream << "

LennyMcLennington <lenny@sneed.church>

\n"; + stream << "
\n"; + // TODO: possibly retrieve from git history at build time? stream << "

" << QObject::tr("MultiMC Developers", "About Credits") << "

\n"; stream << "

Andrew Okin <forkk@forkk.net>

\n"; @@ -47,6 +53,7 @@ QString getCreditsHtml() stream << "

Kilobyte <stiepen22@gmx.de>

\n"; stream << "

Rootbear75 <@rootbear75>

\n"; stream << "

Zeker Zhayard <@Zeker_Zhayard>

\n"; + stream << "

Everyone else who contributed!

\n"; stream << "
\n"; stream << "
\n"; -- cgit