diff options
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/Application.cpp | 2 | ||||
-rw-r--r-- | launcher/minecraft/launch/LauncherPartLaunch.cpp | 15 | ||||
-rw-r--r-- | launcher/ui/dialogs/AboutDialog.cpp | 17 | ||||
-rw-r--r-- | launcher/ui/dialogs/AboutDialog.ui | 17 | ||||
-rw-r--r-- | launcher/ui/pages/global/MinecraftPage.cpp | 5 | ||||
-rw-r--r-- | launcher/ui/pages/global/MinecraftPage.ui | 20 | ||||
-rw-r--r-- | launcher/ui/pages/instance/ScreenshotsPage.cpp | 47 | ||||
-rw-r--r-- | launcher/ui/pages/instance/ScreenshotsPage.h | 2 | ||||
-rw-r--r-- | launcher/ui/pages/instance/ScreenshotsPage.ui | 18 |
9 files changed, 129 insertions, 14 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp index b605e54b..7050e5dc 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -717,6 +717,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) // pastebin URL m_settings->registerSetting("PastebinURL", "https://0x0.st"); + m_settings->registerSetting("CloseAfterLaunch", false); + // Init page provider { m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings")); diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp index 8fd11eca..f461b847 100644 --- a/launcher/minecraft/launch/LauncherPartLaunch.cpp +++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp @@ -25,6 +25,19 @@ LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent) { + if (APPLICATION->settings()->get("CloseAfterLaunch").toBool()) + { + std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection}; + *connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, MessageLevel::Enum level) { + qDebug() << lines; + if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0) + { + APPLICATION->closeAllWindows(); + disconnect(*connection); + } + }); + } + connect(&m_process, &LoggedProcess::log, this, &LauncherPartLaunch::logLines); connect(&m_process, &LoggedProcess::stateChanged, this, &LauncherPartLaunch::on_state); } @@ -155,6 +168,8 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state) } case LoggedProcess::Finished: { + if (APPLICATION->settings()->get("CloseAfterLaunch").toBool()) + APPLICATION->showMainWindow(); m_parent->setPid(-1); // if the exit code wasn't 0, report this as a crash auto exitCode = m_process.exitCode(); diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp index 46d2f429..ef96cc23 100644 --- a/launcher/ui/dialogs/AboutDialog.cpp +++ b/launcher/ui/dialogs/AboutDialog.cpp @@ -32,8 +32,14 @@ QString getCreditsHtml() QTextStream stream(&output); stream.setCodec(QTextCodec::codecForName("UTF-8")); stream << "<center>\n"; + + stream << "<h3>" << QObject::tr("PolyMC Developers", "About Credits") << "</h3>\n"; + stream << "<p>swirl <<a href='mailto:swurl@swurl.xyz'>swurl@swurl.xyz </a>></p>\n"; + stream << "<p>LennyMcLennington <<a href='mailto:lenny@sneed.church'>lenny@sneed.church</a>></p>\n"; + stream << "<br />\n"; + // TODO: possibly retrieve from git history at build time? - stream << "<h3>" << QObject::tr("Developers", "About Credits") << "</h3>\n"; + stream << "<h3>" << QObject::tr("MultiMC Developers", "About Credits") << "</h3>\n"; stream << "<p>Andrew Okin <<a href='mailto:forkk@forkk.net'>forkk@forkk.net</a>></p>\n"; stream << "<p>Petr Mrázek <<a href='mailto:peterix@gmail.com'>peterix@gmail.com</a>></p>\n"; stream << "<p>Sky Welch <<a href='mailto:multimc@bunnies.io'>multimc@bunnies.io</a>></p>\n"; @@ -47,6 +53,7 @@ QString getCreditsHtml() stream << "<p>Kilobyte <<a href='mailto:stiepen22@gmx.de'>stiepen22@gmx.de</a>></p>\n"; stream << "<p>Rootbear75 <<a href='https://twitter.com/rootbear75'>@rootbear75</a>></p>\n"; stream << "<p>Zeker Zhayard <<a href='https://twitter.com/zeker_zhayard'>@Zeker_Zhayard</a>></p>\n"; + stream << "<p>Everyone else who <a href='https://github.com/PolyMC/PolyMC/graphs/contributors'>contributed</a>!</p>\n"; stream << "<br />\n"; stream << "</center>\n"; @@ -83,8 +90,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 @@ -87,6 +87,13 @@ </property> </widget> </item> + <item> + <widget class="QLabel" name="versionLabel"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> @@ -152,16 +159,6 @@ </widget> </item> <item> - <widget class="QLabel" name="versionLabel"> - <property name="text"> - <string>Version:</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> <widget class="QLabel" name="platformLabel"> <property name="text"> <string>Platform:</string> diff --git a/launcher/ui/pages/global/MinecraftPage.cpp b/launcher/ui/pages/global/MinecraftPage.cpp index c763f8ac..5470a586 100644 --- a/launcher/ui/pages/global/MinecraftPage.cpp +++ b/launcher/ui/pages/global/MinecraftPage.cpp @@ -71,6 +71,9 @@ void MinecraftPage::applySettings() s->set("ShowGameTime", ui->showGameTime->isChecked()); s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked()); s->set("RecordGameTime", ui->recordGameTime->isChecked()); + + // Miscellaneous + s->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked()); } void MinecraftPage::loadSettings() @@ -88,4 +91,6 @@ void MinecraftPage::loadSettings() ui->showGameTime->setChecked(s->get("ShowGameTime").toBool()); ui->showGlobalGameTime->setChecked(s->get("ShowGlobalGameTime").toBool()); ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool()); + + ui->closeAfterLaunchCheck->setChecked(s->get("CloseAfterLaunch").toBool()); } diff --git a/launcher/ui/pages/global/MinecraftPage.ui b/launcher/ui/pages/global/MinecraftPage.ui index 857b8cfb..a28b1f59 100644 --- a/launcher/ui/pages/global/MinecraftPage.ui +++ b/launcher/ui/pages/global/MinecraftPage.ui @@ -165,6 +165,25 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Miscellaneous</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="closeAfterLaunchCheck"> + <property name="toolTip"> + <string><html><head/><body><p>PolyMC will automatically reopen when the game crashes or exits.</p></body></html></string> + </property> + <property name="text"> + <string>Close PolyMC after game window opens</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <spacer name="verticalSpacerMinecraft"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -184,7 +203,6 @@ </layout> </widget> <tabstops> - <tabstop>tabWidget</tabstop> <tabstop>maximizedCheckBox</tabstop> <tabstop>windowWidthSpinBox</tabstop> <tabstop>windowHeightSpinBox</tabstop> diff --git a/launcher/ui/pages/instance/ScreenshotsPage.cpp b/launcher/ui/pages/instance/ScreenshotsPage.cpp index f568ef0d..4011d88c 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_File_s_triggered(); + return true; + } + switch (keyEvent->key()) { case Qt::Key_Delete: @@ -272,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; } @@ -377,6 +388,42 @@ void ScreenshotsPage::on_actionUpload_triggered() m_uploadActive = false; } +void ScreenshotsPage::on_actionCopy_Image_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_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 d2f44837..2a1fdeee 100644 --- a/launcher/ui/pages/instance/ScreenshotsPage.h +++ b/launcher/ui/pages/instance/ScreenshotsPage.h @@ -73,6 +73,8 @@ protected: private slots: void on_actionUpload_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 ec461087..2e2227a2 100644 --- a/launcher/ui/pages/instance/ScreenshotsPage.ui +++ b/launcher/ui/pages/instance/ScreenshotsPage.ui @@ -50,6 +50,8 @@ <bool>false</bool> </attribute> <addaction name="actionUpload"/> + <addaction name="actionCopy_Image"/> + <addaction name="actionCopy_File_s"/> <addaction name="actionDelete"/> <addaction name="actionRename"/> <addaction name="actionView_Folder"/> @@ -74,6 +76,22 @@ <string>View Folder</string> </property> </action> + <action name="actionCopy_Image"> + <property name="text"> + <string>Copy Image</string> + </property> + <property name="toolTip"> + <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> <customwidgets> <customwidget> |