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/SelectionRangeDetails.qml \
|
||||
qml/Overview.qml
|
||||
|
||||
FORMS += \
|
||||
qmlprofilerattachdialog.ui
|
||||
|
||||
@@ -30,7 +30,6 @@ QtcPlugin {
|
||||
"qmlprofiler_global.h",
|
||||
"qmlprofilerattachdialog.cpp",
|
||||
"qmlprofilerattachdialog.h",
|
||||
"qmlprofilerattachdialog.ui",
|
||||
"qmlprofilerclientmanager.cpp",
|
||||
"qmlprofilerclientmanager.h",
|
||||
"qmlprofilerconstants.h",
|
||||
|
||||
@@ -28,51 +28,81 @@
|
||||
****************************************************************************/
|
||||
|
||||
#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 Internal {
|
||||
|
||||
class QmlProfilerAttachDialogPrivate
|
||||
{
|
||||
public:
|
||||
QSpinBox *portSpinBox;
|
||||
KitChooser *kitChooser;
|
||||
};
|
||||
|
||||
QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *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()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
void QmlProfilerAttachDialog::setPort(uint port)
|
||||
{
|
||||
ui->portSpinBox->setValue(port);
|
||||
}
|
||||
|
||||
void QmlProfilerAttachDialog::setSysroot(const QString &sysroot)
|
||||
{
|
||||
ui->sysrootChooser->setPath(sysroot);
|
||||
d->kitChooser->setCurrentKitId(id);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Core { class Id; }
|
||||
namespace ProjectExplorer { class Kit; }
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui {
|
||||
class QmlProfilerAttachDialog;
|
||||
}
|
||||
|
||||
class QmlProfilerAttachDialogPrivate;
|
||||
class QmlProfilerAttachDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -47,16 +47,14 @@ public:
|
||||
explicit QmlProfilerAttachDialog(QWidget *parent = 0);
|
||||
~QmlProfilerAttachDialog();
|
||||
|
||||
QString address() const;
|
||||
uint port() const;
|
||||
QString sysroot() const;
|
||||
int port() const;
|
||||
void setPort(const int port);
|
||||
|
||||
void setAddress(const QString &address);
|
||||
void setPort(uint port);
|
||||
void setSysroot(const QString &sysroot);
|
||||
ProjectExplorer::Kit *kit() const;
|
||||
void setKitId(const Core::Id &id);
|
||||
|
||||
private:
|
||||
Ui::QmlProfilerAttachDialog *ui;
|
||||
QmlProfilerAttachDialogPrivate *d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
#include <remotelinux/linuxdevice.h>
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -519,42 +521,46 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
Q_UNUSED(tool);
|
||||
|
||||
QString host;
|
||||
Id kitId;
|
||||
quint16 port;
|
||||
QString sysroot;
|
||||
Kit *kit = 0;
|
||||
|
||||
{
|
||||
QSettings *settings = ICore::settings();
|
||||
|
||||
host = settings->value(QLatin1String("AnalyzerQmlAttachDialog/host"), QLatin1String("localhost")).toString();
|
||||
port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toInt();
|
||||
sysroot = settings->value(QLatin1String("AnalyzerQmlAttachDialog/sysroot")).toString();
|
||||
kitId = Id::fromSetting(settings->value(QLatin1String("AnalyzerQmlAttachDialog/kitId")));
|
||||
port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toUInt();
|
||||
|
||||
QmlProfilerAttachDialog dialog;
|
||||
|
||||
dialog.setAddress(host);
|
||||
dialog.setKitId(kitId);
|
||||
dialog.setPort(port);
|
||||
dialog.setSysroot(sysroot);
|
||||
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
host = dialog.address();
|
||||
kit = dialog.kit();
|
||||
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/sysroot"), sysroot);
|
||||
}
|
||||
|
||||
AnalyzerStartParameters sp;
|
||||
sp.toolId = tool->id();
|
||||
sp.startMode = mode;
|
||||
sp.connParams.host = host;
|
||||
sp.connParams.port = port;
|
||||
sp.sysroot = sysroot;
|
||||
sp.analyzerHost = host;
|
||||
|
||||
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
if (device) {
|
||||
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;
|
||||
|
||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||
|
||||
Reference in New Issue
Block a user