aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/InstanceWindow.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-02 18:35:35 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-02 18:35:35 +0200
commit1d468ac35ad88d8c77cc83f25e3704d9bd7df01b (patch)
tree8644b1574c947a1a87c5c7b2567f746cfe17882f /launcher/ui/InstanceWindow.cpp
parentce2ca1381519a2e261d7f76dffa874d559d979c2 (diff)
downloadPrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.tar.gz
PrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.tar.bz2
PrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.zip
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/ui/InstanceWindow.cpp')
-rw-r--r--launcher/ui/InstanceWindow.cpp49
1 files changed, 17 insertions, 32 deletions
diff --git a/launcher/ui/InstanceWindow.cpp b/launcher/ui/InstanceWindow.cpp
index c62b370f..4c54ba26 100644
--- a/launcher/ui/InstanceWindow.cpp
+++ b/launcher/ui/InstanceWindow.cpp
@@ -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;
}