From 58840ac10cc7aac866d61cbcece3c3b9be1af8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 6 Apr 2015 20:52:59 +0200 Subject: NOISSUE fix profilers --- application/MainWindow.cpp | 86 ++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 48 deletions(-) (limited to 'application') diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 8e235e19..07f0d02f 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -1832,58 +1832,48 @@ void MainWindow::launchInstance(InstancePtr instance, AuthSessionPtr session, proc->setHeader("MultiMC version: " + BuildConfig.printableVersionString() + "\n\n"); proc->arm(); - if (profiler) + if (!profiler) { - QString error; - if (!profiler->check(&error)) - { - QMessageBox::critical(this, tr("Error"), - tr("Couldn't start profiler: %1").arg(error)); - proc->abort(); - return; - } - BaseProfiler *profilerInstance = profiler->createProfiler(instance, this); - QProgressDialog dialog; - dialog.setMinimum(0); - dialog.setMaximum(0); - dialog.setValue(0); - dialog.setLabelText(tr("Waiting for profiler...")); - connect(&dialog, &QProgressDialog::canceled, profilerInstance, - &BaseProfiler::abortProfiling); - dialog.show(); - connect(profilerInstance, &BaseProfiler::readyToLaunch, - [&dialog, this, proc](const QString & message) - { - dialog.accept(); - QMessageBox msg; - msg.setText(tr("The game launch is delayed until you press the " - "button. This is the right time to setup the profiler, as the " - "profiler server is running now.\n\n%1").arg(message)); - msg.setWindowTitle(tr("Waiting")); - msg.setIcon(QMessageBox::Information); - msg.addButton(tr("Launch"), QMessageBox::AcceptRole); - msg.exec(); - proc->launch(); - }); - connect(profilerInstance, &BaseProfiler::abortLaunch, - [&dialog, this, proc](const QString & message) - { - dialog.accept(); - QMessageBox msg; - msg.setText(tr("Couldn't start the profiler: %1").arg(message)); - msg.setWindowTitle(tr("Error")); - msg.setIcon(QMessageBox::Critical); - msg.addButton(QMessageBox::Ok); - msg.exec(); - proc->abort(); - }); - profilerInstance->beginProfiling(proc); - dialog.exec(); + proc->launch(); + return; } - else + + QString error; + if (!profiler->check(&error)) { - proc->launch(); + proc->abort(); + QMessageBox::critical(this, tr("Error"), tr("Couldn't start profiler: %1").arg(error)); + return; } + BaseProfiler *profilerInstance = profiler->createProfiler(instance, this); + + connect(profilerInstance, &BaseProfiler::readyToLaunch, + [this, proc](const QString & message) + { + QMessageBox msg; + msg.setText(tr("The game launch is delayed until you press the " + "button. This is the right time to setup the profiler, as the " + "profiler server is running now.\n\n%1").arg(message)); + msg.setWindowTitle(tr("Waiting")); + msg.setIcon(QMessageBox::Information); + msg.addButton(tr("Launch"), QMessageBox::AcceptRole); + msg.setModal(true); + msg.exec(); + proc->launch(); + }); + connect(profilerInstance, &BaseProfiler::abortLaunch, + [this, proc](const QString & message) + { + QMessageBox msg; + msg.setText(tr("Couldn't start the profiler: %1").arg(message)); + msg.setWindowTitle(tr("Error")); + msg.setIcon(QMessageBox::Critical); + msg.addButton(QMessageBox::Ok); + msg.setModal(true); + msg.exec(); + proc->abort(); + }); + profilerInstance->beginProfiling(proc); } void MainWindow::onGameUpdateError(QString error) -- cgit v1.2.3