summaryrefslogtreecommitdiffstats
path: root/api/logic/tools/JVisualVM.cpp
diff options
context:
space:
mode:
authorThomas Groman <tgroman@nuegia.net>2019-09-19 00:41:48 -0700
committerThomas Groman <tgroman@nuegia.net>2019-09-19 00:41:48 -0700
commit32b3ed0a1362a4b0798ad71fac3450fb77cb7e41 (patch)
tree7be7a2f602e6a5af7bc2db86bef9cf2a659c3d3d /api/logic/tools/JVisualVM.cpp
parent5fb2c6334e7d5237db11695b4c0ec0f2d1e47c88 (diff)
downloadMultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar.gz
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar.lz
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar.xz
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.zip
merged from 0.6.7 codebase
Diffstat (limited to 'api/logic/tools/JVisualVM.cpp')
-rw-r--r--api/logic/tools/JVisualVM.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/api/logic/tools/JVisualVM.cpp b/api/logic/tools/JVisualVM.cpp
index 8fdb594f..b1acc3c0 100644
--- a/api/logic/tools/JVisualVM.cpp
+++ b/api/logic/tools/JVisualVM.cpp
@@ -9,96 +9,96 @@
class JVisualVM : public BaseProfiler
{
- Q_OBJECT
+ Q_OBJECT
public:
- JVisualVM(SettingsObjectPtr settings, InstancePtr instance, QObject *parent = 0);
+ JVisualVM(SettingsObjectPtr settings, InstancePtr instance, QObject *parent = 0);
private slots:
- void profilerStarted();
- void profilerFinished(int exit, QProcess::ExitStatus status);
+ void profilerStarted();
+ void profilerFinished(int exit, QProcess::ExitStatus status);
protected:
- void beginProfilingImpl(std::shared_ptr<LaunchTask> process);
+ void beginProfilingImpl(shared_qobject_ptr<LaunchTask> process);
};
JVisualVM::JVisualVM(SettingsObjectPtr settings, InstancePtr instance, QObject *parent)
- : BaseProfiler(settings, instance, parent)
+ : BaseProfiler(settings, instance, parent)
{
}
void JVisualVM::profilerStarted()
{
- emit readyToLaunch(tr("JVisualVM started"));
+ emit readyToLaunch(tr("JVisualVM started"));
}
void JVisualVM::profilerFinished(int exit, QProcess::ExitStatus status)
{
- if (status == QProcess::CrashExit)
- {
- emit abortLaunch(tr("Profiler aborted"));
- }
- if (m_profilerProcess)
- {
- m_profilerProcess->deleteLater();
- m_profilerProcess = 0;
- }
+ if (status == QProcess::CrashExit)
+ {
+ emit abortLaunch(tr("Profiler aborted"));
+ }
+ if (m_profilerProcess)
+ {
+ m_profilerProcess->deleteLater();
+ m_profilerProcess = 0;
+ }
}
-void JVisualVM::beginProfilingImpl(std::shared_ptr<LaunchTask> process)
+void JVisualVM::beginProfilingImpl(shared_qobject_ptr<LaunchTask> process)
{
- QProcess *profiler = new QProcess(this);
- QStringList profilerArgs =
- {
- "--openpid", QString::number(process->pid())
- };
- auto programPath = globalSettings->get("JVisualVMPath").toString();
+ QProcess *profiler = new QProcess(this);
+ QStringList profilerArgs =
+ {
+ "--openpid", QString::number(process->pid())
+ };
+ auto programPath = globalSettings->get("JVisualVMPath").toString();
- profiler->setArguments(profilerArgs);
- profiler->setProgram(programPath);
+ profiler->setArguments(profilerArgs);
+ profiler->setProgram(programPath);
- connect(profiler, SIGNAL(started()), SLOT(profilerStarted()));
- connect(profiler, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(profilerFinished(int,QProcess::ExitStatus)));
+ connect(profiler, SIGNAL(started()), SLOT(profilerStarted()));
+ connect(profiler, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(profilerFinished(int,QProcess::ExitStatus)));
- profiler->start();
- m_profilerProcess = profiler;
+ profiler->start();
+ m_profilerProcess = profiler;
}
void JVisualVMFactory::registerSettings(SettingsObjectPtr settings)
{
- QString defaultValue = QStandardPaths::findExecutable("jvisualvm");
- if (defaultValue.isNull())
- {
- defaultValue = QStandardPaths::findExecutable("visualvm");
- }
- settings->registerSetting("JVisualVMPath", defaultValue);
- globalSettings = settings;
+ QString defaultValue = QStandardPaths::findExecutable("jvisualvm");
+ if (defaultValue.isNull())
+ {
+ defaultValue = QStandardPaths::findExecutable("visualvm");
+ }
+ settings->registerSetting("JVisualVMPath", defaultValue);
+ globalSettings = settings;
}
BaseExternalTool *JVisualVMFactory::createTool(InstancePtr instance, QObject *parent)
{
- return new JVisualVM(globalSettings, instance, parent);
+ return new JVisualVM(globalSettings, instance, parent);
}
bool JVisualVMFactory::check(QString *error)
{
- return check(globalSettings->get("JVisualVMPath").toString(), error);
+ return check(globalSettings->get("JVisualVMPath").toString(), error);
}
bool JVisualVMFactory::check(const QString &path, QString *error)
{
- if (path.isEmpty())
- {
- *error = QObject::tr("Empty path");
- return false;
- }
- QFileInfo finfo(path);
- if (!finfo.isExecutable() || !finfo.fileName().contains("visualvm"))
- {
- *error = QObject::tr("Invalid path to JVisualVM");
- return false;
- }
- return true;
+ if (path.isEmpty())
+ {
+ *error = QObject::tr("Empty path");
+ return false;
+ }
+ QFileInfo finfo(path);
+ if (!finfo.isExecutable() || !finfo.fileName().contains("visualvm"))
+ {
+ *error = QObject::tr("Invalid path to JVisualVM");
+ return false;
+ }
+ return true;
}
#include "JVisualVM.moc"