2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-05-09 12:46:33 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-05-09 12:46:33 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-05-09 12:46:33 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-05-09 12:46:33 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-05-09 12:46:33 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-05-09 12:46:33 +02:00
|
|
|
|
2011-04-04 15:03:31 +02:00
|
|
|
#include "qmlprofilerattachdialog.h"
|
2013-04-26 10:23:14 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/kitchooser.h>
|
|
|
|
|
#include <coreplugin/id.h>
|
|
|
|
|
|
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
#include <QFormLayout>
|
2017-06-19 14:10:24 +02:00
|
|
|
#include <QLabel>
|
2013-04-26 10:23:14 +02:00
|
|
|
#include <QPushButton>
|
2017-06-19 14:10:24 +02:00
|
|
|
#include <QSpinBox>
|
2013-04-26 10:23:14 +02:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
2011-04-04 15:03:31 +02:00
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-04-26 10:23:14 +02:00
|
|
|
class QmlProfilerAttachDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QSpinBox *portSpinBox;
|
|
|
|
|
KitChooser *kitChooser;
|
|
|
|
|
};
|
|
|
|
|
|
2011-04-04 15:03:31 +02:00
|
|
|
QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent),
|
2013-04-26 10:23:14 +02:00
|
|
|
d(new QmlProfilerAttachDialogPrivate)
|
2011-04-04 15:03:31 +02:00
|
|
|
{
|
2013-04-26 10:23:14 +02:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
setWindowTitle(tr("Start QML Profiler"));
|
2011-04-04 15:03:31 +02:00
|
|
|
|
2013-04-26 10:23:14 +02:00
|
|
|
d->kitChooser = new KitChooser(this);
|
|
|
|
|
d->kitChooser->populate();
|
2011-04-04 15:03:31 +02:00
|
|
|
|
2013-04-26 10:23:14 +02:00
|
|
|
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);
|
|
|
|
|
|
2017-06-19 14:10:24 +02:00
|
|
|
QLabel *hint = new QLabel(this);
|
|
|
|
|
hint->setWordWrap(true);
|
|
|
|
|
hint->setTextFormat(Qt::RichText);
|
|
|
|
|
hint->setText(tr("Select an externally started QML-debug enabled application.<p>"
|
|
|
|
|
"Commonly used command-line arguments are:")
|
|
|
|
|
+ "<p><tt>-qmljsdebugger=port:<port>,host:<host>,block,</tt><br>"
|
|
|
|
|
"<tt> <tt> services:EngineControl,DebugMessages[,...]</tt><p>");
|
|
|
|
|
|
2013-04-26 10:23:14 +02:00
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
|
|
|
|
formLayout->addRow(tr("Kit:"), d->kitChooser);
|
|
|
|
|
formLayout->addRow(tr("&Port:"), d->portSpinBox);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
2017-06-19 14:10:24 +02:00
|
|
|
verticalLayout->addWidget(hint);
|
2013-04-26 10:23:14 +02:00
|
|
|
verticalLayout->addLayout(formLayout);
|
|
|
|
|
verticalLayout->addWidget(buttonBox);
|
|
|
|
|
|
2015-10-30 12:35:17 +01:00
|
|
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
|
|
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2011-04-04 15:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
2013-04-26 10:23:14 +02:00
|
|
|
QmlProfilerAttachDialog::~QmlProfilerAttachDialog()
|
2011-04-04 15:03:31 +02:00
|
|
|
{
|
2013-04-26 10:23:14 +02:00
|
|
|
delete d;
|
2011-04-04 15:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
2013-04-26 10:23:14 +02:00
|
|
|
int QmlProfilerAttachDialog::port() const
|
2011-10-15 11:32:55 +02:00
|
|
|
{
|
2013-04-26 10:23:14 +02:00
|
|
|
return d->portSpinBox->value();
|
2011-10-15 11:32:55 +02:00
|
|
|
}
|
|
|
|
|
|
2013-04-26 10:23:14 +02:00
|
|
|
void QmlProfilerAttachDialog::setPort(const int port)
|
2011-04-04 15:03:31 +02:00
|
|
|
{
|
2013-04-26 10:23:14 +02:00
|
|
|
d->portSpinBox->setValue(port);
|
2011-04-04 15:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
2015-02-03 23:48:57 +02:00
|
|
|
Kit *QmlProfilerAttachDialog::kit() const
|
2011-04-04 15:03:31 +02:00
|
|
|
{
|
2013-04-26 10:23:14 +02:00
|
|
|
return d->kitChooser->currentKit();
|
2011-04-04 15:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
void QmlProfilerAttachDialog::setKitId(Core::Id id)
|
2011-10-15 11:32:55 +02:00
|
|
|
{
|
2013-04-26 10:23:14 +02:00
|
|
|
d->kitChooser->setCurrentKitId(id);
|
2011-10-15 11:32:55 +02:00
|
|
|
}
|
|
|
|
|
|
2011-04-04 15:03:31 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfiler
|