diff options
Diffstat (limited to 'api/logic/tools/JVisualVM.cpp')
-rw-r--r-- | api/logic/tools/JVisualVM.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/api/logic/tools/JVisualVM.cpp b/api/logic/tools/JVisualVM.cpp index 8fdb594f..10886857 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(std::shared_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) { - 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" |