Merge branch 'develop' into better-launch
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
@ -37,12 +37,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/widgets/PageContainer.h"
|
||||
|
||||
@ -50,8 +50,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);
|
||||
|
||||
@ -91,7 +90,7 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent)
|
||||
m_launchButton->setText(tr("&Launch"));
|
||||
m_launchButton->setToolTip(tr("Launch the instance"));
|
||||
m_launchButton->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
m_launchButton->setMinimumWidth(80); // HACK!!
|
||||
m_launchButton->setMinimumWidth(80); // HACK!!
|
||||
horizontalLayout->addWidget(m_launchButton);
|
||||
connect(m_launchButton, &QPushButton::clicked, this, [this] { APPLICATION->launch(m_instance); });
|
||||
|
||||
@ -146,8 +145,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();
|
||||
}
|
||||
@ -158,7 +156,7 @@ void InstanceWindow::updateButtons()
|
||||
m_launchButton->setEnabled(m_instance->canLaunch());
|
||||
m_killButton->setEnabled(m_instance->isRunning());
|
||||
|
||||
QMenu *launchMenu = m_launchButton->menu();
|
||||
QMenu* launchMenu = m_launchButton->menu();
|
||||
if (launchMenu)
|
||||
launchMenu->clear();
|
||||
else
|
||||
@ -176,21 +174,19 @@ void InstanceWindow::runningStateChanged(bool running)
|
||||
{
|
||||
updateButtons();
|
||||
m_container->refreshContainer();
|
||||
if(running) {
|
||||
if (running) {
|
||||
selectPage("log");
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -220,10 +216,14 @@ void InstanceWindow::refreshContainer()
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
BasePage* InstanceWindow::selectedPage() const
|
||||
{
|
||||
return m_container->selectedPage();
|
||||
}
|
||||
|
||||
bool InstanceWindow::requestClose()
|
||||
{
|
||||
if(m_container->prepareToClose())
|
||||
{
|
||||
if (m_container->prepareToClose()) {
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user