diff options
author | Tayou <31988415+TayouVR@users.noreply.github.com> | 2023-08-07 10:32:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-07 10:32:38 +0200 |
commit | 9afa7cc91fd889b146c609c6a59f7f7b3d995d9f (patch) | |
tree | 20ef3bd30beedca4995875485e468ee323d52096 /launcher/ui/InstanceWindow.cpp | |
parent | b572f75dbaad61cf305f1fd4f60ba94d74bfa3fa (diff) | |
parent | 75c7df46a7022a46d447bb96fbde619e5d65db05 (diff) | |
download | PrismLauncher-9afa7cc91fd889b146c609c6a59f7f7b3d995d9f.tar.gz PrismLauncher-9afa7cc91fd889b146c609c6a59f7f7b3d995d9f.tar.bz2 PrismLauncher-9afa7cc91fd889b146c609c6a59f7f7b3d995d9f.zip |
Merge branch 'develop' into icon-indexing
Signed-off-by: Tayou <31988415+TayouVR@users.noreply.github.com>
Diffstat (limited to 'launcher/ui/InstanceWindow.cpp')
-rw-r--r-- | launcher/ui/InstanceWindow.cpp | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/launcher/ui/InstanceWindow.cpp b/launcher/ui/InstanceWindow.cpp index c62b370f..9c7886fa 100644 --- a/launcher/ui/InstanceWindow.cpp +++ b/launcher/ui/InstanceWindow.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher + * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> * * This program is free software: you can redistribute it and/or modify @@ -36,12 +36,12 @@ #include "InstanceWindow.h" #include "Application.h" -#include <QScrollBar> -#include <QMessageBox> -#include <QHBoxLayout> -#include <QPushButton> #include <qlayoutitem.h> #include <QCloseEvent> +#include <QHBoxLayout> +#include <QMessageBox> +#include <QPushButton> +#include <QScrollBar> #include "ui/dialogs/CustomMessageBox.h" #include "ui/dialogs/ProgressDialog.h" @@ -51,8 +51,7 @@ #include "icons/IconList.h" -InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent) - : QMainWindow(parent), m_instance(instance) +InstanceWindow::InstanceWindow(InstancePtr instance, QWidget* parent) : QMainWindow(parent), m_instance(instance) { setAttribute(Qt::WA_DeleteOnClose); @@ -143,8 +142,7 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent) void InstanceWindow::on_instanceStatusChanged(BaseInstance::Status, BaseInstance::Status newStatus) { - if(newStatus == BaseInstance::Status::Gone) - { + if (newStatus == BaseInstance::Status::Gone) { m_doNotSave = true; close(); } @@ -152,25 +150,20 @@ void InstanceWindow::on_instanceStatusChanged(BaseInstance::Status, BaseInstance void InstanceWindow::updateLaunchButtons() { - if(m_instance->isRunning()) - { + if (m_instance->isRunning()) { m_launchOfflineButton->setEnabled(false); m_launchDemoButton->setEnabled(false); m_killButton->setText(tr("Kill")); m_killButton->setObjectName("killButton"); m_killButton->setToolTip(tr("Kill the running instance")); - } - else if(!m_instance->canLaunch()) - { + } else if (!m_instance->canLaunch()) { m_launchOfflineButton->setEnabled(false); m_launchDemoButton->setEnabled(false); m_killButton->setText(tr("Launch")); m_killButton->setObjectName("launchButton"); m_killButton->setToolTip(tr("Launch the instance")); m_killButton->setEnabled(false); - } - else - { + } else { m_launchOfflineButton->setEnabled(true); // Disable demo-mode if not available. @@ -207,7 +200,7 @@ void InstanceWindow::runningStateChanged(bool running) { updateLaunchButtons(); m_container->refreshContainer(); - if(running) { + if (running) { selectPage("log"); } } @@ -217,16 +210,14 @@ void InstanceWindow::on_closeButton_clicked() close(); } -void InstanceWindow::closeEvent(QCloseEvent *event) +void InstanceWindow::closeEvent(QCloseEvent* event) { bool proceed = true; - if(!m_doNotSave) - { + if (!m_doNotSave) { proceed &= m_container->prepareToClose(); } - if(!proceed) - { + if (!proceed) { return; } @@ -243,12 +234,9 @@ bool InstanceWindow::saveAll() void InstanceWindow::on_btnKillMinecraft_clicked() { - if(m_instance->isRunning()) - { + if (m_instance->isRunning()) { APPLICATION->kill(m_instance); - } - else - { + } else { APPLICATION->launch(m_instance, true, false, nullptr); } } @@ -268,14 +256,11 @@ void InstanceWindow::refreshContainer() m_container->refreshContainer(); } -InstanceWindow::~InstanceWindow() -{ -} +InstanceWindow::~InstanceWindow() {} bool InstanceWindow::requestClose() { - if(m_container->prepareToClose()) - { + if (m_container->prepareToClose()) { close(); return true; } |