diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-11-13 00:25:57 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-11-13 00:25:57 +0100 |
commit | 662b4bc8cbf93eea5e57a5cd56962313eb0a966c (patch) | |
tree | f86178bcfe62ce3aae89f3eff0e538a87b7d7bed /gui/ConsoleWindow.cpp | |
parent | ee595fb1daa3c09215e3063321301e6746733662 (diff) | |
parent | 9693a5e6e96e815ad7617c888ef176e5fe97c9e3 (diff) | |
download | MultiMC-662b4bc8cbf93eea5e57a5cd56962313eb0a966c.tar MultiMC-662b4bc8cbf93eea5e57a5cd56962313eb0a966c.tar.gz MultiMC-662b4bc8cbf93eea5e57a5cd56962313eb0a966c.tar.lz MultiMC-662b4bc8cbf93eea5e57a5cd56962313eb0a966c.tar.xz MultiMC-662b4bc8cbf93eea5e57a5cd56962313eb0a966c.zip |
Merge branch 'develop'
Diffstat (limited to 'gui/ConsoleWindow.cpp')
-rw-r--r-- | gui/ConsoleWindow.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/gui/ConsoleWindow.cpp b/gui/ConsoleWindow.cpp index a3f294e6..350da837 100644 --- a/gui/ConsoleWindow.cpp +++ b/gui/ConsoleWindow.cpp @@ -22,16 +22,14 @@ #include <gui/Platform.h> #include <gui/dialogs/CustomMessageBox.h> -ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) : - QDialog(parent), - ui(new Ui::ConsoleWindow), - m_mayclose(true), - proc(mcproc) +ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) + : QDialog(parent), ui(new Ui::ConsoleWindow), m_mayclose(true), proc(mcproc) { MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); this->setWindowFlags(Qt::Window); - connect(mcproc, SIGNAL(ended(BaseInstance*)), this, SLOT(onEnded(BaseInstance*))); + connect(mcproc, SIGNAL(ended(BaseInstance *, int, ExitStatus)), this, + SLOT(onEnded(BaseInstance *, int, QProcess::ExitStatus))); } ConsoleWindow::~ConsoleWindow() @@ -54,32 +52,32 @@ void ConsoleWindow::writeColor(QString text, const char *color) void ConsoleWindow::write(QString data, MessageLevel::Enum mode) { if (data.endsWith('\n')) - data = data.left(data.length()-1); + data = data.left(data.length() - 1); QStringList paragraphs = data.split('\n'); - for(QString ¶graph : paragraphs) + for (QString ¶graph : paragraphs) { paragraph = paragraph.trimmed(); } QListIterator<QString> iter(paragraphs); if (mode == MessageLevel::MultiMC) - while(iter.hasNext()) + while (iter.hasNext()) writeColor(iter.next(), "blue"); else if (mode == MessageLevel::Error) - while(iter.hasNext()) + while (iter.hasNext()) writeColor(iter.next(), "red"); else if (mode == MessageLevel::Warning) - while(iter.hasNext()) + while (iter.hasNext()) writeColor(iter.next(), "orange"); else if (mode == MessageLevel::Fatal) - while(iter.hasNext()) + while (iter.hasNext()) writeColor(iter.next(), "pink"); else if (mode == MessageLevel::Debug) - while(iter.hasNext()) + while (iter.hasNext()) writeColor(iter.next(), "green"); // TODO: implement other MessageLevels else - while(iter.hasNext()) + while (iter.hasNext()) writeColor(iter.next()); } @@ -102,9 +100,9 @@ void ConsoleWindow::setMayClose(bool mayclose) ui->closeButton->setEnabled(false); } -void ConsoleWindow::closeEvent(QCloseEvent * event) +void ConsoleWindow::closeEvent(QCloseEvent *event) { - if(!m_mayclose) + if (!m_mayclose) event->ignore(); else QDialog::closeEvent(event); @@ -113,20 +111,22 @@ void ConsoleWindow::closeEvent(QCloseEvent * event) void ConsoleWindow::on_btnKillMinecraft_clicked() { ui->btnKillMinecraft->setEnabled(false); - auto response = CustomMessageBox::selectable(this, tr("Kill Minecraft?"), - tr("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason"), - QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)->exec(); + auto response = CustomMessageBox::selectable( + this, tr("Kill Minecraft?"), + tr("This can cause the instance to get corrupted and should only be used if Minecraft " + "is frozen for some reason"), + QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)->exec(); if (response == QMessageBox::Yes) proc->killMinecraft(); else ui->btnKillMinecraft->setEnabled(true); } -void ConsoleWindow::onEnded(BaseInstance* instance, int code, QProcess::ExitStatus status) +void ConsoleWindow::onEnded(BaseInstance *instance, int code, QProcess::ExitStatus status) { ui->btnKillMinecraft->setEnabled(false); - if(instance->settings().get("AutoCloseConsole").toBool()) + if (instance->settings().get("AutoCloseConsole").toBool()) { if (code == 0 && status != QProcess::CrashExit) { |