Made instace killing actually work

This commit is contained in:
Stiepen22
2013-09-06 22:40:50 +02:00
parent b44e70d58d
commit f897a200e2
7 changed files with 43 additions and 7 deletions

View File

@ -2,11 +2,13 @@
#include "ui_consolewindow.h"
#include <QScrollBar>
#include <QMessageBox>
ConsoleWindow::ConsoleWindow(QWidget *parent) :
ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) :
QDialog(parent),
ui(new Ui::ConsoleWindow),
m_mayclose(true)
m_mayclose(true),
proc(mcproc)
{
ui->setupUi(this);
}
@ -40,6 +42,9 @@ void ConsoleWindow::write(QString data, MessageLevel::Enum mode)
else if (mode == MessageLevel::Error)
while(iter.hasNext())
writeColor(iter.next(), "red");
else if (mode == MessageLevel::Warning)
while(iter.hasNext())
writeColor(iter.next(), "orange");
// TODO: implement other MessageLevels
else
while(iter.hasNext())
@ -72,3 +77,18 @@ void ConsoleWindow::closeEvent(QCloseEvent * event)
else
QDialog::closeEvent(event);
}
void ConsoleWindow::on_btnKillMinecraft_clicked()
{
ui->btnKillMinecraft->setEnabled(false);
QMessageBox r_u_sure;
r_u_sure.setText("Kill Minecraft?");
r_u_sure.setInformativeText("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason");
r_u_sure.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
r_u_sure.setDefaultButton(QMessageBox::Yes);
if (r_u_sure.exec() == QMessageBox::Yes)
proc->killMinecraft();
else
ui->btnKillMinecraft->setEnabled(true);
r_u_sure.close();
}