forked from qt-creator/qt-creator
QmlProfiling: Attach to QML application
Redo the Attach dialog to use Kits. This is in sync with the Valgrind Attach dialog. Change-Id: Iaf0c8bc2c5a912b6a93ed21b9757a074a60041c0 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
@@ -59,6 +59,3 @@ OTHER_FILES += \
|
|||||||
qml/SelectionRange.qml \
|
qml/SelectionRange.qml \
|
||||||
qml/SelectionRangeDetails.qml \
|
qml/SelectionRangeDetails.qml \
|
||||||
qml/Overview.qml
|
qml/Overview.qml
|
||||||
|
|
||||||
FORMS += \
|
|
||||||
qmlprofilerattachdialog.ui
|
|
||||||
|
@@ -30,7 +30,6 @@ QtcPlugin {
|
|||||||
"qmlprofiler_global.h",
|
"qmlprofiler_global.h",
|
||||||
"qmlprofilerattachdialog.cpp",
|
"qmlprofilerattachdialog.cpp",
|
||||||
"qmlprofilerattachdialog.h",
|
"qmlprofilerattachdialog.h",
|
||||||
"qmlprofilerattachdialog.ui",
|
|
||||||
"qmlprofilerclientmanager.cpp",
|
"qmlprofilerclientmanager.cpp",
|
||||||
"qmlprofilerclientmanager.h",
|
"qmlprofilerclientmanager.h",
|
||||||
"qmlprofilerconstants.h",
|
"qmlprofilerconstants.h",
|
||||||
|
@@ -28,51 +28,81 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlprofilerattachdialog.h"
|
#include "qmlprofilerattachdialog.h"
|
||||||
#include "ui_qmlprofilerattachdialog.h"
|
|
||||||
|
#include <projectexplorer/kitchooser.h>
|
||||||
|
|
||||||
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class QmlProfilerAttachDialogPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QSpinBox *portSpinBox;
|
||||||
|
KitChooser *kitChooser;
|
||||||
|
};
|
||||||
|
|
||||||
QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
|
QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::QmlProfilerAttachDialog)
|
d(new QmlProfilerAttachDialogPrivate)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
setWindowTitle(tr("Start QML Profiler"));
|
||||||
|
|
||||||
|
d->kitChooser = new KitChooser(this);
|
||||||
|
d->kitChooser->populate();
|
||||||
|
|
||||||
|
d->portSpinBox = new QSpinBox(this);
|
||||||
|
d->portSpinBox->setMaximum(65535);
|
||||||
|
d->portSpinBox->setValue(3768);
|
||||||
|
|
||||||
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
|
||||||
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||||
|
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
|
|
||||||
|
QFormLayout *formLayout = new QFormLayout();
|
||||||
|
formLayout->addRow(tr("Kit:"), d->kitChooser);
|
||||||
|
formLayout->addRow(tr("&Port:"), d->portSpinBox);
|
||||||
|
|
||||||
|
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
||||||
|
verticalLayout->addLayout(formLayout);
|
||||||
|
verticalLayout->addWidget(buttonBox);
|
||||||
|
|
||||||
|
connect(buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
||||||
|
connect(buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerAttachDialog::~QmlProfilerAttachDialog()
|
QmlProfilerAttachDialog::~QmlProfilerAttachDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProfilerAttachDialog::address() const
|
int QmlProfilerAttachDialog::port() const
|
||||||
{
|
{
|
||||||
return ui->addressLineEdit->text();
|
return d->portSpinBox->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint QmlProfilerAttachDialog::port() const
|
void QmlProfilerAttachDialog::setPort(const int port)
|
||||||
{
|
{
|
||||||
return ui->portSpinBox->value();
|
d->portSpinBox->setValue(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProfilerAttachDialog::sysroot() const
|
ProjectExplorer::Kit *QmlProfilerAttachDialog::kit() const
|
||||||
{
|
{
|
||||||
return ui->sysrootChooser->path();
|
return d->kitChooser->currentKit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerAttachDialog::setAddress(const QString &address)
|
void QmlProfilerAttachDialog::setKitId(const Core::Id &id)
|
||||||
{
|
{
|
||||||
ui->addressLineEdit->setText(address);
|
d->kitChooser->setCurrentKitId(id);
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerAttachDialog::setPort(uint port)
|
|
||||||
{
|
|
||||||
ui->portSpinBox->setValue(port);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerAttachDialog::setSysroot(const QString &sysroot)
|
|
||||||
{
|
|
||||||
ui->sysrootChooser->setPath(sysroot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -32,13 +32,13 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Core { class Id; }
|
||||||
|
namespace ProjectExplorer { class Kit; }
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
namespace Ui {
|
class QmlProfilerAttachDialogPrivate;
|
||||||
class QmlProfilerAttachDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class QmlProfilerAttachDialog : public QDialog
|
class QmlProfilerAttachDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -47,16 +47,14 @@ public:
|
|||||||
explicit QmlProfilerAttachDialog(QWidget *parent = 0);
|
explicit QmlProfilerAttachDialog(QWidget *parent = 0);
|
||||||
~QmlProfilerAttachDialog();
|
~QmlProfilerAttachDialog();
|
||||||
|
|
||||||
QString address() const;
|
int port() const;
|
||||||
uint port() const;
|
void setPort(const int port);
|
||||||
QString sysroot() const;
|
|
||||||
|
|
||||||
void setAddress(const QString &address);
|
ProjectExplorer::Kit *kit() const;
|
||||||
void setPort(uint port);
|
void setKitId(const Core::Id &id);
|
||||||
void setSysroot(const QString &sysroot);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::QmlProfilerAttachDialog *ui;
|
QmlProfilerAttachDialogPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -60,6 +60,8 @@
|
|||||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||||
#include <remotelinux/linuxdevice.h>
|
#include <remotelinux/linuxdevice.h>
|
||||||
|
|
||||||
|
#include <android/androidconstants.h>
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -519,42 +521,46 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(tool);
|
Q_UNUSED(tool);
|
||||||
|
|
||||||
QString host;
|
Id kitId;
|
||||||
quint16 port;
|
quint16 port;
|
||||||
QString sysroot;
|
Kit *kit = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
QSettings *settings = ICore::settings();
|
QSettings *settings = ICore::settings();
|
||||||
|
|
||||||
host = settings->value(QLatin1String("AnalyzerQmlAttachDialog/host"), QLatin1String("localhost")).toString();
|
kitId = Id::fromSetting(settings->value(QLatin1String("AnalyzerQmlAttachDialog/kitId")));
|
||||||
port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toInt();
|
port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toUInt();
|
||||||
sysroot = settings->value(QLatin1String("AnalyzerQmlAttachDialog/sysroot")).toString();
|
|
||||||
|
|
||||||
QmlProfilerAttachDialog dialog;
|
QmlProfilerAttachDialog dialog;
|
||||||
|
|
||||||
dialog.setAddress(host);
|
dialog.setKitId(kitId);
|
||||||
dialog.setPort(port);
|
dialog.setPort(port);
|
||||||
dialog.setSysroot(sysroot);
|
|
||||||
|
|
||||||
if (dialog.exec() != QDialog::Accepted)
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
host = dialog.address();
|
kit = dialog.kit();
|
||||||
port = dialog.port();
|
port = dialog.port();
|
||||||
sysroot = dialog.sysroot();
|
|
||||||
|
|
||||||
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/host"), host);
|
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), kit->id().toSetting());
|
||||||
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/port"), port);
|
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/port"), port);
|
||||||
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/sysroot"), sysroot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerStartParameters sp;
|
AnalyzerStartParameters sp;
|
||||||
sp.toolId = tool->id();
|
sp.toolId = tool->id();
|
||||||
sp.startMode = mode;
|
sp.startMode = mode;
|
||||||
sp.connParams.host = host;
|
|
||||||
sp.connParams.port = port;
|
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
sp.sysroot = sysroot;
|
if (device) {
|
||||||
sp.analyzerHost = host;
|
sp.connParams = device->sshParameters();
|
||||||
|
if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|
||||||
|
|| device->type() == Android::Constants::ANDROID_DEVICE_TYPE) {
|
||||||
|
sp.analyzerHost = QLatin1String("localhost");
|
||||||
|
} else {
|
||||||
|
sp.analyzerHost = sp.connParams.host;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sp.sysroot = SysRootKitInformation::sysRoot(kit).toString();
|
||||||
sp.analyzerPort = port;
|
sp.analyzerPort = port;
|
||||||
|
|
||||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||||
|
Reference in New Issue
Block a user