Profiler support. Currently JProfiler and JVisualVM are implemented.
This commit is contained in:
@ -29,6 +29,8 @@
|
||||
|
||||
#include "logic/updater/UpdateChecker.h"
|
||||
|
||||
#include "logic/profiler/BaseProfiler.h"
|
||||
|
||||
#include <settingsobject.h>
|
||||
#include <pathutils.h>
|
||||
#include <QFileDialog>
|
||||
@ -368,6 +370,22 @@ void SettingsDialog::applySettings(SettingsObject *s)
|
||||
}
|
||||
|
||||
s->set("PostExitCommand", ui->postExitCmdTextBox->text());
|
||||
|
||||
// Profilers
|
||||
s->set("JProfilerPath", ui->jprofilerPathEdit->text());
|
||||
s->set("JVisualVMPath", ui->jvisualvmPathEdit->text());
|
||||
if (ui->profilerNoneBtn->isChecked())
|
||||
{
|
||||
s->set("CurrentProfiler", QString());
|
||||
}
|
||||
else if (ui->jprofilerBtn->isChecked())
|
||||
{
|
||||
s->set("CurrentProfiler", "jprofiler");
|
||||
}
|
||||
else if (ui->jvisualvmBtn->isChecked())
|
||||
{
|
||||
s->set("CurrentProfiler", "jvisualvm");
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::loadSettings(SettingsObject *s)
|
||||
@ -447,6 +465,23 @@ void SettingsDialog::loadSettings(SettingsObject *s)
|
||||
// Custom Commands
|
||||
ui->preLaunchCmdTextBox->setText(s->get("PreLaunchCommand").toString());
|
||||
ui->postExitCmdTextBox->setText(s->get("PostExitCommand").toString());
|
||||
|
||||
// Profilers
|
||||
ui->jprofilerPathEdit->setText(s->get("JProfilerPath").toString());
|
||||
ui->jvisualvmPathEdit->setText(s->get("JVisualVMPath").toString());
|
||||
const QString currentProfiler = s->get("CurrentProfiler").toString();
|
||||
if (currentProfiler.isEmpty())
|
||||
{
|
||||
ui->profilerNoneBtn->setChecked(true);
|
||||
}
|
||||
else if (currentProfiler == "jprofiler")
|
||||
{
|
||||
ui->jprofilerBtn->setChecked(true);
|
||||
}
|
||||
else if (currentProfiler == "jvisualvm")
|
||||
{
|
||||
ui->jvisualvmBtn->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::on_javaDetectBtn_clicked()
|
||||
@ -503,3 +538,53 @@ void SettingsDialog::checkFinished(JavaCheckResult result)
|
||||
"or set the path to the java executable."));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::on_jprofilerPathBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Directory"),
|
||||
ui->jprofilerPathEdit->text());
|
||||
QString cooked_dir = NormalizePath(raw_dir);
|
||||
|
||||
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
|
||||
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
|
||||
{
|
||||
ui->jprofilerPathEdit->setText(cooked_dir);
|
||||
}
|
||||
}
|
||||
void SettingsDialog::on_jprofilerCheckBtn_clicked()
|
||||
{
|
||||
if (!ui->jprofilerPathEdit->text().isEmpty())
|
||||
{
|
||||
QString error;
|
||||
if (!MMC->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error while checking JProfiler install:\n%1").arg(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::on_jvisualvmPathBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getOpenFileName(this, tr("JVisualVM Executable"),
|
||||
ui->jvisualvmPathEdit->text());
|
||||
QString cooked_dir = NormalizePath(raw_dir);
|
||||
|
||||
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
|
||||
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
|
||||
{
|
||||
ui->jvisualvmPathEdit->setText(cooked_dir);
|
||||
}
|
||||
}
|
||||
void SettingsDialog::on_jvisualvmCheckBtn_clicked()
|
||||
{
|
||||
if (!ui->jvisualvmPathEdit->text().isEmpty())
|
||||
{
|
||||
QString error;
|
||||
if (!MMC->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error while checking JVisualVM install:\n%1").arg(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,11 @@ slots:
|
||||
|
||||
void checkFinished(JavaCheckResult result);
|
||||
|
||||
void on_jprofilerPathBtn_clicked();
|
||||
void on_jprofilerCheckBtn_clicked();
|
||||
void on_jvisualvmPathBtn_clicked();
|
||||
void on_jvisualvmCheckBtn_clicked();
|
||||
|
||||
/*!
|
||||
* Updates the list of update channels in the combo box.
|
||||
*/
|
||||
|
@ -863,6 +863,116 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="profilingTab">
|
||||
<attribute name="title">
|
||||
<string>Profiling</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Active profiler</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="profilerNoneBtn">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="jprofilerBtn">
|
||||
<property name="text">
|
||||
<string>JProfiler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="jvisualvmBtn">
|
||||
<property name="text">
|
||||
<string>JVisualVM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>JProfiler</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="jprofilerPathEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="jprofilerPathBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="jprofilerCheckBtn">
|
||||
<property name="text">
|
||||
<string>Check</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>JVisualVM</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="jvisualvmPathEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="jvisualvmPathBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="jvisualvmCheckBtn">
|
||||
<property name="text">
|
||||
<string>Check</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -938,7 +1048,7 @@
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="proxyGroup"/>
|
||||
<buttongroup name="sortingModeGroup"/>
|
||||
<buttongroup name="proxyGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
Reference in New Issue
Block a user