From 32b3ed0a1362a4b0798ad71fac3450fb77cb7e41 Mon Sep 17 00:00:00 2001 From: Thomas Groman Date: Thu, 19 Sep 2019 00:41:48 -0700 Subject: merged from 0.6.7 codebase --- api/logic/tools/JVisualVM.cpp | 100 +++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'api/logic/tools/JVisualVM.cpp') 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 process); + void beginProfilingImpl(shared_qobject_ptr 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 process) +void JVisualVM::beginProfilingImpl(shared_qobject_ptr 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" -- cgit v1.2.3