diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-04-06 20:52:59 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-04-13 00:04:08 +0200 |
commit | 58840ac10cc7aac866d61cbcece3c3b9be1af8b4 (patch) | |
tree | 4641c42e20d33728bdc03fa7b4769084fae201e5 /application | |
parent | 3d3725f08820ee129c8edc5395687e5edd997537 (diff) | |
download | MultiMC-58840ac10cc7aac866d61cbcece3c3b9be1af8b4.tar MultiMC-58840ac10cc7aac866d61cbcece3c3b9be1af8b4.tar.gz MultiMC-58840ac10cc7aac866d61cbcece3c3b9be1af8b4.tar.lz MultiMC-58840ac10cc7aac866d61cbcece3c3b9be1af8b4.tar.xz MultiMC-58840ac10cc7aac866d61cbcece3c3b9be1af8b4.zip |
NOISSUE fix profilers
Diffstat (limited to 'application')
-rw-r--r-- | application/MainWindow.cpp | 86 |
1 files changed, 38 insertions, 48 deletions
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) |