2009-03-02 14:04:03 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "debuggerdialogs.h"
|
2012-02-06 15:15:57 +01:00
|
|
|
#include "debuggerstartparameters.h"
|
2011-01-07 09:44:23 +01:00
|
|
|
|
2009-10-08 11:43:26 +02:00
|
|
|
#include "debuggerconstants.h"
|
2012-06-26 15:25:49 +02:00
|
|
|
#include "debuggerprofileinformation.h"
|
2012-02-06 15:15:57 +01:00
|
|
|
#include "debuggerstringutils.h"
|
2012-06-28 10:00:04 +02:00
|
|
|
#include "debuggertoolchaincombobox.h"
|
2011-01-11 11:22:55 +01:00
|
|
|
#include "cdb/cdbengine.h"
|
2011-11-03 12:01:50 +01:00
|
|
|
#include "shared/hostutils.h"
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-10-08 11:43:26 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2011-02-24 16:50:15 +01:00
|
|
|
#include <projectexplorer/abi.h>
|
2012-06-26 15:25:49 +02:00
|
|
|
#include <projectexplorer/profileinformation.h>
|
2012-06-28 13:30:09 +02:00
|
|
|
#include <utils/filterlineedit.h>
|
2010-09-16 12:28:50 +02:00
|
|
|
#include <utils/historycompleter.h>
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <utils/pathchooser.h>
|
2010-11-19 16:13:22 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2011-11-07 20:07:14 +01:00
|
|
|
#include <utils/synchronousprocess.h>
|
2009-10-08 11:43:26 +02:00
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <QAction>
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
#include <QButtonGroup>
|
2012-06-28 13:30:09 +02:00
|
|
|
#include <QCheckBox>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QDebug>
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <QDialog>
|
|
|
|
|
#include <QDialogButtonBox>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFileDialog>
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QGridLayout>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QGroupBox>
|
|
|
|
|
#include <QHeaderView>
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QLineEdit>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QRadioButton>
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <QRegExp>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QScrollArea>
|
|
|
|
|
#include <QSortFilterProxyModel>
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <QSpinBox>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStandardItemModel>
|
2012-06-28 13:30:09 +02:00
|
|
|
#include <QTreeView>
|
2012-06-28 10:00:04 +02:00
|
|
|
#include <QVariant>
|
|
|
|
|
#include <QVBoxLayout>
|
2009-03-05 17:30:29 +01:00
|
|
|
|
2012-06-26 15:25:49 +02:00
|
|
|
using namespace ProjectExplorer;
|
2010-09-16 12:28:50 +02:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
namespace Debugger {
|
2009-05-04 14:47:45 +02:00
|
|
|
namespace Internal {
|
2009-03-05 17:30:29 +01:00
|
|
|
|
|
|
|
|
bool operator<(const ProcData &p1, const ProcData &p2)
|
|
|
|
|
{
|
|
|
|
|
return p1.name < p2.name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A filterable process list model
|
2009-05-04 14:47:45 +02:00
|
|
|
class ProcessListFilterModel : public QSortFilterProxyModel
|
|
|
|
|
{
|
2009-03-05 17:30:29 +01:00
|
|
|
public:
|
|
|
|
|
explicit ProcessListFilterModel(QObject *parent);
|
|
|
|
|
QString processIdAt(const QModelIndex &index) const;
|
2010-03-17 10:57:19 +01:00
|
|
|
QString executableForPid(const QString& pid) const;
|
|
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
void populate(QList<ProcData> processes, const QString &excludePid);
|
2009-03-05 17:30:29 +01:00
|
|
|
|
|
|
|
|
private:
|
2010-07-21 09:36:16 +02:00
|
|
|
enum { ProcessImageRole = Qt::UserRole, ProcessNameRole };
|
2010-03-17 10:57:19 +01:00
|
|
|
|
2010-03-09 12:25:43 +01:00
|
|
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
|
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
QStandardItemModel *m_model;
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
ProcessListFilterModel::ProcessListFilterModel(QObject *parent)
|
|
|
|
|
: QSortFilterProxyModel(parent),
|
|
|
|
|
m_model(new QStandardItemModel(this))
|
2009-03-05 17:30:29 +01:00
|
|
|
{
|
|
|
|
|
QStringList columns;
|
|
|
|
|
columns << AttachExternalDialog::tr("Process ID")
|
|
|
|
|
<< AttachExternalDialog::tr("Name")
|
|
|
|
|
<< AttachExternalDialog::tr("State");
|
|
|
|
|
m_model->setHorizontalHeaderLabels(columns);
|
|
|
|
|
setSourceModel(m_model);
|
|
|
|
|
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
|
|
|
|
setFilterKeyColumn(1);
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-09 12:25:43 +01:00
|
|
|
bool ProcessListFilterModel::lessThan(const QModelIndex &left,
|
|
|
|
|
const QModelIndex &right) const
|
|
|
|
|
{
|
|
|
|
|
const QString l = sourceModel()->data(left).toString();
|
|
|
|
|
const QString r = sourceModel()->data(right).toString();
|
|
|
|
|
if (left.column() == 0)
|
|
|
|
|
return l.toInt() < r.toInt();
|
|
|
|
|
return l < r;
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
QString ProcessListFilterModel::processIdAt(const QModelIndex &index) const
|
|
|
|
|
{
|
|
|
|
|
if (index.isValid()) {
|
|
|
|
|
const QModelIndex index0 = mapToSource(index);
|
2010-06-11 13:35:22 +10:00
|
|
|
QModelIndex siblingIndex = index0.sibling(index0.row(), 0);
|
|
|
|
|
if (const QStandardItem *item = m_model->itemFromIndex(siblingIndex))
|
2009-03-05 17:30:29 +01:00
|
|
|
return item->text();
|
|
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-17 10:57:19 +01:00
|
|
|
QString ProcessListFilterModel::executableForPid(const QString &pid) const
|
|
|
|
|
{
|
|
|
|
|
const int rowCount = m_model->rowCount();
|
|
|
|
|
for (int r = 0; r < rowCount; r++) {
|
|
|
|
|
const QStandardItem *item = m_model->item(r, 0);
|
2010-07-21 09:36:16 +02:00
|
|
|
if (item->text() == pid) {
|
|
|
|
|
QString name = item->data(ProcessImageRole).toString();
|
|
|
|
|
if (name.isEmpty())
|
|
|
|
|
name = item->data(ProcessNameRole).toString();
|
|
|
|
|
return name;
|
|
|
|
|
}
|
2010-03-17 10:57:19 +01:00
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
void ProcessListFilterModel::populate
|
|
|
|
|
(QList<ProcData> processes, const QString &excludePid)
|
2009-03-05 17:30:29 +01:00
|
|
|
{
|
|
|
|
|
qStableSort(processes);
|
|
|
|
|
|
|
|
|
|
if (const int rowCount = m_model->rowCount())
|
|
|
|
|
m_model->removeRows(0, rowCount);
|
|
|
|
|
|
|
|
|
|
QStandardItem *root = m_model->invisibleRootItem();
|
2010-07-21 09:36:16 +02:00
|
|
|
foreach (const ProcData &proc, processes) {
|
2009-03-05 17:30:29 +01:00
|
|
|
QList<QStandardItem *> row;
|
|
|
|
|
row.append(new QStandardItem(proc.ppid));
|
2010-07-21 09:36:16 +02:00
|
|
|
QString name = proc.image.isEmpty() ? proc.name : proc.image;
|
|
|
|
|
row.back()->setData(name, ProcessImageRole);
|
2009-03-05 17:30:29 +01:00
|
|
|
row.append(new QStandardItem(proc.name));
|
2010-07-21 09:36:16 +02:00
|
|
|
row.back()->setToolTip(proc.image);
|
2009-03-05 17:30:29 +01:00
|
|
|
row.append(new QStandardItem(proc.state));
|
2010-03-17 10:57:19 +01:00
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
if (proc.ppid == excludePid)
|
2010-07-21 09:36:16 +02:00
|
|
|
foreach (QStandardItem *item, row)
|
|
|
|
|
item->setEnabled(false);
|
2009-03-05 17:30:29 +01:00
|
|
|
root->appendRow(row);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
|
2009-03-02 14:04:03 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// AttachCoreDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
class AttachCoreDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QLabel *execLabel;
|
|
|
|
|
Utils::PathChooser *execFileName;
|
|
|
|
|
QLabel *coreLabel;
|
|
|
|
|
Utils::PathChooser *coreFileName;
|
|
|
|
|
QLabel *profileLabel;
|
|
|
|
|
Debugger::ProfileChooser *profileComboBox;
|
|
|
|
|
Utils::PathChooser *overrideStartScriptFileName;
|
|
|
|
|
QLabel *overrideStartScriptLabel;
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
|
|
|
|
};
|
|
|
|
|
|
2009-03-02 14:04:03 +01:00
|
|
|
AttachCoreDialog::AttachCoreDialog(QWidget *parent)
|
2012-06-28 13:30:09 +02:00
|
|
|
: QDialog(parent), d(new AttachCoreDialogPrivate)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2012-06-28 13:30:09 +02:00
|
|
|
setWindowTitle(tr("Start Debugger"));
|
2011-05-03 14:57:05 +02:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
d->coreFileName = new Utils::PathChooser(this);
|
|
|
|
|
d->coreFileName->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->coreFileName->setPromptDialogTitle(tr("Select Core File"));
|
|
|
|
|
d->coreLabel = new QLabel(tr("&Core file:"), this);
|
|
|
|
|
d->coreLabel->setBuddy(d->coreFileName);
|
|
|
|
|
|
|
|
|
|
d->execFileName = new Utils::PathChooser(this);
|
|
|
|
|
d->execFileName->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->execFileName->setPromptDialogTitle(tr("Select Executable"));
|
|
|
|
|
d->execLabel = new QLabel(tr("&Executable:"), this);
|
|
|
|
|
d->execLabel->setBuddy(d->execFileName);
|
|
|
|
|
|
|
|
|
|
d->overrideStartScriptFileName = new Utils::PathChooser(this);
|
|
|
|
|
d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
|
|
|
|
|
d->overrideStartScriptLabel = new QLabel(tr("Override &start script:"), this);
|
|
|
|
|
d->overrideStartScriptLabel->setBuddy(d->overrideStartScriptFileName);
|
|
|
|
|
|
|
|
|
|
d->profileComboBox = new Debugger::ProfileChooser(this);
|
|
|
|
|
d->profileComboBox->init(false);
|
|
|
|
|
d->profileLabel = new QLabel(tr("&Target:"), this);
|
|
|
|
|
d->profileLabel->setBuddy(d->profileComboBox);
|
|
|
|
|
|
|
|
|
|
QFrame *line = new QFrame(this);
|
|
|
|
|
line->setFrameShape(QFrame::HLine);
|
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
QFormLayout *formLayout = new QFormLayout;
|
|
|
|
|
formLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
formLayout->setHorizontalSpacing(6);
|
|
|
|
|
formLayout->setVerticalSpacing(6);
|
|
|
|
|
formLayout->addRow(d->execLabel, d->execFileName);
|
|
|
|
|
formLayout->addRow(d->coreLabel, d->coreFileName);
|
|
|
|
|
formLayout->addRow(d->profileLabel, d->profileComboBox);
|
|
|
|
|
formLayout->addRow(d->overrideStartScriptLabel, d->overrideStartScriptFileName);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
|
|
|
|
vboxLayout->addLayout(formLayout);
|
|
|
|
|
vboxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
|
|
|
vboxLayout->addWidget(line);
|
|
|
|
|
vboxLayout->addWidget(d->buttonBox);
|
|
|
|
|
|
|
|
|
|
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
|
|
|
|
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
|
|
|
|
connect(d->coreFileName, SIGNAL(changed(QString)), SLOT(changed()));
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AttachCoreDialog::~AttachCoreDialog()
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
delete d;
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
QString AttachCoreDialog::executableFile() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->execFileName->path();
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
void AttachCoreDialog::setExecutableFile(const QString &fileName)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->execFileName->setPath(fileName);
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AttachCoreDialog::coreFile() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->coreFileName->path();
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::setCoreFile(const QString &fileName)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->coreFileName->setPath(fileName);
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
Core::Id AttachCoreDialog::profileId() const
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileComboBox->currentProfileId();
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2012-06-26 15:25:49 +02:00
|
|
|
void AttachCoreDialog::setProfileIndex(int i)
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
if (i >= 0 && i < d->profileComboBox->count())
|
|
|
|
|
d->profileComboBox->setCurrentIndex(i);
|
2011-02-25 16:03:22 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-26 15:25:49 +02:00
|
|
|
int AttachCoreDialog::profileIndex() const
|
2011-02-25 16:03:22 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileComboBox->currentIndex();
|
2011-02-25 16:03:22 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-03 14:57:05 +02:00
|
|
|
QString AttachCoreDialog::overrideStartScript() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->overrideStartScriptFileName->path();
|
2011-05-03 14:57:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::setOverrideStartScript(const QString &scriptName)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->overrideStartScriptFileName->setPath(scriptName);
|
2011-05-03 14:57:05 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
bool AttachCoreDialog::isValid() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileComboBox->currentIndex() >= 0 &&
|
2011-02-24 16:50:15 +01:00
|
|
|
!coreFile().isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::changed()
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid());
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
2009-05-04 14:47:45 +02:00
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// AttachExternalDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
class AttachExternalDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QLabel *pidLabel;
|
|
|
|
|
QLineEdit *pidLineEdit;
|
|
|
|
|
Utils::FilterLineEdit *filterWidget;
|
|
|
|
|
QLabel *profileLabel;
|
|
|
|
|
Debugger::ProfileChooser *profileComboBox;
|
|
|
|
|
QTreeView *procView;
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
|
|
|
|
|
|
|
|
|
QString selfPid;
|
|
|
|
|
ProcessListFilterModel *model;
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
AttachExternalDialog::AttachExternalDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent),
|
2012-06-28 13:30:09 +02:00
|
|
|
d(new AttachExternalDialogPrivate)
|
2009-03-04 16:00:43 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2012-06-28 13:30:09 +02:00
|
|
|
setWindowTitle(tr("Start Debugger", 0, QApplication::UnicodeUTF8));
|
|
|
|
|
setMinimumHeight(500);
|
|
|
|
|
|
|
|
|
|
d->selfPid = QString::number(QCoreApplication::applicationPid());
|
|
|
|
|
|
|
|
|
|
d->model = new ProcessListFilterModel(this);
|
2009-03-04 16:00:43 +01:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
d->pidLineEdit = new QLineEdit(this);
|
|
|
|
|
d->pidLabel = new QLabel(tr("Attach to &process ID:"), this);
|
|
|
|
|
d->pidLabel->setBuddy(d->pidLineEdit);
|
|
|
|
|
|
|
|
|
|
d->filterWidget = new Utils::FilterLineEdit(this);
|
|
|
|
|
d->filterWidget->setFocus(Qt::TabFocusReason);
|
|
|
|
|
|
|
|
|
|
d->profileComboBox = new Debugger::ProfileChooser(this);
|
|
|
|
|
d->profileComboBox->init(true);
|
|
|
|
|
d->profileLabel = new QLabel(tr("&Target:"), this);
|
|
|
|
|
d->profileLabel->setBuddy(d->profileComboBox);
|
|
|
|
|
|
|
|
|
|
d->procView = new QTreeView(this);
|
|
|
|
|
d->procView->setAlternatingRowColors(true);
|
|
|
|
|
d->procView->setRootIsDecorated(false);
|
|
|
|
|
d->procView->setUniformRowHeights(true);
|
|
|
|
|
d->procView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
|
d->procView->setModel(d->model);
|
|
|
|
|
d->procView->setSortingEnabled(true);
|
|
|
|
|
d->procView->sortByColumn(1, Qt::AscendingOrder);
|
2009-03-04 16:00:43 +01:00
|
|
|
|
|
|
|
|
QPushButton *refreshButton = new QPushButton(tr("Refresh"));
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
d->buttonBox->addButton(refreshButton, QDialogButtonBox::ActionRole);
|
2010-03-04 10:07:59 +01:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
QFrame *line = new QFrame(this);
|
|
|
|
|
line->setFrameShape(QFrame::HLine);
|
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
2009-03-04 16:00:43 +01:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
|
|
|
|
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
|
|
|
formLayout->addRow(d->pidLabel, d->pidLineEdit);
|
|
|
|
|
formLayout->addRow(d->profileLabel, d->profileComboBox);
|
|
|
|
|
formLayout->addRow(d->filterWidget);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
|
|
|
|
vboxLayout->addLayout(formLayout);
|
|
|
|
|
vboxLayout->addWidget(d->procView);
|
|
|
|
|
vboxLayout->addWidget(line);
|
|
|
|
|
vboxLayout->addWidget(d->buttonBox);
|
|
|
|
|
|
|
|
|
|
okButton()->setDefault(true);
|
|
|
|
|
okButton()->setEnabled(false);
|
|
|
|
|
|
|
|
|
|
connect(refreshButton, SIGNAL(clicked()), SLOT(rebuildProcessList()));
|
|
|
|
|
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
|
|
|
|
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
|
|
|
|
// Do not use activated, will be single click in Oxygen
|
|
|
|
|
connect(d->procView, SIGNAL(doubleClicked(QModelIndex)),
|
|
|
|
|
SLOT(procSelected(QModelIndex)));
|
|
|
|
|
connect(d->procView, SIGNAL(clicked(QModelIndex)),
|
|
|
|
|
SLOT(procClicked(QModelIndex)));
|
|
|
|
|
connect(d->pidLineEdit, SIGNAL(textChanged(QString)),
|
|
|
|
|
SLOT(pidChanged(QString)));
|
|
|
|
|
connect(d->filterWidget, SIGNAL(filterChanged(QString)),
|
|
|
|
|
SLOT(setFilterString(QString)));
|
2010-03-09 12:25:43 +01:00
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
rebuildProcessList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AttachExternalDialog::~AttachExternalDialog()
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
delete d;
|
2009-03-04 16:00:43 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-05 09:19:38 +02:00
|
|
|
void AttachExternalDialog::setFilterString(const QString &filter)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->model->setFilterFixedString(filter);
|
2009-10-05 09:19:38 +02:00
|
|
|
// Activate the line edit if there's a unique filtered process.
|
|
|
|
|
QString processId;
|
2012-06-28 13:30:09 +02:00
|
|
|
if (d->model->rowCount(QModelIndex()) == 1)
|
|
|
|
|
processId = d->model->processIdAt(d->model->index(0, 0, QModelIndex()));
|
|
|
|
|
d->pidLineEdit->setText(processId);
|
2009-10-05 09:19:38 +02:00
|
|
|
pidChanged(processId);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:48:13 +01:00
|
|
|
QPushButton *AttachExternalDialog::okButton() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->buttonBox->button(QDialogButtonBox::Ok);
|
2009-03-04 16:48:13 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
void AttachExternalDialog::rebuildProcessList()
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->model->populate(hostProcessList(), d->selfPid);
|
|
|
|
|
d->procView->expandAll();
|
|
|
|
|
d->procView->resizeColumnToContents(0);
|
|
|
|
|
d->procView->resizeColumnToContents(1);
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
void AttachExternalDialog::procSelected(const QModelIndex &proxyIndex)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
const QString processId = d->model->processIdAt(proxyIndex);
|
2009-10-05 09:19:38 +02:00
|
|
|
if (!processId.isEmpty()) {
|
2012-06-28 13:30:09 +02:00
|
|
|
d->pidLineEdit->setText(processId);
|
2009-03-04 16:48:13 +01:00
|
|
|
if (okButton()->isEnabled())
|
|
|
|
|
okButton()->animateClick();
|
2009-03-04 16:00:43 +01:00
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2010-03-09 12:25:43 +01:00
|
|
|
void AttachExternalDialog::procClicked(const QModelIndex &proxyIndex)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
const QString processId = d->model->processIdAt(proxyIndex);
|
2010-03-09 12:25:43 +01:00
|
|
|
if (!processId.isEmpty())
|
2012-06-28 13:30:09 +02:00
|
|
|
d->pidLineEdit->setText(processId);
|
2010-03-09 12:25:43 +01:00
|
|
|
}
|
|
|
|
|
|
2010-03-17 10:57:19 +01:00
|
|
|
QString AttachExternalDialog::attachPIDText() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->pidLineEdit->text().trimmed();
|
2010-03-17 10:57:19 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-25 16:22:11 +02:00
|
|
|
qint64 AttachExternalDialog::attachPID() const
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2010-03-17 10:57:19 +01:00
|
|
|
return attachPIDText().toLongLong();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AttachExternalDialog::executable() const
|
|
|
|
|
{
|
|
|
|
|
// Search pid in model in case the user typed in the PID.
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->model->executableForPid(attachPIDText());
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
Core::Id AttachExternalDialog::profileId() const
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileComboBox->currentProfileId();
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-26 15:25:49 +02:00
|
|
|
void AttachExternalDialog::setProfileIndex(int i)
|
2011-02-25 16:03:22 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
if (i >= 0 && i < d->profileComboBox->count())
|
|
|
|
|
d->profileComboBox->setCurrentIndex(i);
|
2011-02-25 16:03:22 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-26 15:25:49 +02:00
|
|
|
int AttachExternalDialog::profileIndex() const
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileComboBox->currentIndex();
|
2011-02-25 16:03:22 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:48:13 +01:00
|
|
|
void AttachExternalDialog::pidChanged(const QString &pid)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
const bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != d->selfPid
|
|
|
|
|
&& d->profileComboBox->currentIndex() >= 0;
|
2009-05-04 14:47:45 +02:00
|
|
|
okButton()->setEnabled(enabled);
|
2009-03-04 16:48:13 +01:00
|
|
|
}
|
|
|
|
|
|
2010-10-22 14:03:25 +02:00
|
|
|
void AttachExternalDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
const qint64 pid = attachPID();
|
|
|
|
|
if (pid && isWinProcessBeingDebugged(pid)) {
|
|
|
|
|
QMessageBox::warning(this, tr("Process Already Under Debugger Control"),
|
|
|
|
|
tr("The process %1 is already under the control of a debugger.\n"
|
|
|
|
|
"Qt Creator cannot attach to it.").arg(pid));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// StartExternalDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
class StartExternalParameters
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
StartExternalParameters();
|
|
|
|
|
bool equals(const StartExternalParameters &rhs) const;
|
|
|
|
|
bool isValid() const { return !executableFile.isEmpty(); }
|
|
|
|
|
QString displayName() const;
|
|
|
|
|
void toSettings(QSettings *) const;
|
|
|
|
|
void fromSettings(const QSettings *settings);
|
|
|
|
|
|
|
|
|
|
QString executableFile;
|
|
|
|
|
QString arguments;
|
|
|
|
|
QString workingDirectory;
|
|
|
|
|
int abiIndex;
|
|
|
|
|
bool breakAtMain;
|
|
|
|
|
bool runInTerminal;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::StartExternalParameters)
|
|
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
bool operator==(const StartExternalParameters &p1, const StartExternalParameters &p2)
|
|
|
|
|
{
|
|
|
|
|
return p1.equals(p2);
|
|
|
|
|
}
|
2012-02-06 15:15:57 +01:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
bool operator!=(const StartExternalParameters &p1, const StartExternalParameters &p2)
|
|
|
|
|
{
|
|
|
|
|
return !p1.equals(p2);
|
|
|
|
|
}
|
2012-02-06 15:15:57 +01:00
|
|
|
|
|
|
|
|
StartExternalParameters::StartExternalParameters() :
|
|
|
|
|
abiIndex(0), breakAtMain(false), runInTerminal(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool StartExternalParameters::equals(const StartExternalParameters &rhs) const
|
|
|
|
|
{
|
|
|
|
|
return executableFile == rhs.executableFile && arguments == rhs.arguments
|
|
|
|
|
&& workingDirectory == rhs.workingDirectory && abiIndex == rhs.abiIndex
|
|
|
|
|
&& breakAtMain == rhs.breakAtMain && runInTerminal == rhs.runInTerminal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartExternalParameters::displayName() const
|
|
|
|
|
{
|
|
|
|
|
enum { maxLength = 60 };
|
|
|
|
|
|
|
|
|
|
QString name = QFileInfo(executableFile).fileName()
|
|
|
|
|
+ QLatin1Char(' ') + arguments;
|
|
|
|
|
if (name.size() > maxLength) {
|
|
|
|
|
int index = name.lastIndexOf(QLatin1Char(' '), maxLength);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
index = maxLength;
|
|
|
|
|
name.truncate(index);
|
|
|
|
|
name += QLatin1String("...");
|
|
|
|
|
}
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartExternalParameters::toSettings(QSettings *settings) const
|
|
|
|
|
{
|
|
|
|
|
settings->setValue(_("LastExternalExecutableFile"), executableFile);
|
|
|
|
|
settings->setValue(_("LastExternalExecutableArguments"), arguments);
|
|
|
|
|
settings->setValue(_("LastExternalWorkingDirectory"), workingDirectory);
|
|
|
|
|
settings->setValue(_("LastExternalAbiIndex"), abiIndex);
|
|
|
|
|
settings->setValue(_("LastExternalBreakAtMain"), breakAtMain);
|
|
|
|
|
settings->setValue(_("LastExternalRunInTerminal"), runInTerminal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartExternalParameters::fromSettings(const QSettings *settings)
|
|
|
|
|
{
|
|
|
|
|
executableFile = settings->value(_("LastExternalExecutableFile")).toString();
|
|
|
|
|
arguments = settings->value(_("LastExternalExecutableArguments")).toString();
|
|
|
|
|
workingDirectory = settings->value(_("LastExternalWorkingDirectory")).toString();
|
|
|
|
|
abiIndex = settings->value(_("LastExternalAbiIndex")).toInt();
|
|
|
|
|
breakAtMain = settings->value(_("LastExternalBreakAtMain")).toBool();
|
|
|
|
|
runInTerminal = settings->value(_("LastExternalRunInTerminal")).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
class StartExternalDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QLabel *execLabel;
|
|
|
|
|
Utils::PathChooser *execFile;
|
|
|
|
|
QLabel *argsLabel;
|
|
|
|
|
QLineEdit *argsEdit;
|
|
|
|
|
QLabel *runInTerminalLabel;
|
|
|
|
|
QCheckBox *runInTerminalCheckBox;
|
|
|
|
|
QLabel *workingDirectoryLabel;
|
|
|
|
|
Utils::PathChooser *workingDirectory;
|
|
|
|
|
QLabel *profileLabel;
|
|
|
|
|
Debugger::ProfileChooser *profileChooser;
|
|
|
|
|
QLabel *breakAtMainLabel;
|
|
|
|
|
QCheckBox *breakAtMainCheckBox;
|
|
|
|
|
QLabel *historyLabel;
|
|
|
|
|
QComboBox *historyComboBox;
|
|
|
|
|
QFrame *historyLine;
|
|
|
|
|
QSpacerItem *spacerItem;
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
StartExternalDialog::StartExternalDialog(QWidget *parent)
|
2012-06-28 13:30:09 +02:00
|
|
|
: QDialog(parent), d(new StartExternalDialogPrivate)
|
2009-05-07 09:35:11 +02:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2012-06-28 13:30:09 +02:00
|
|
|
setWindowTitle(tr("Start Debugger"));
|
|
|
|
|
|
|
|
|
|
QSettings *settings = Core::ICore::settings();
|
|
|
|
|
|
|
|
|
|
d->execFile = new Utils::PathChooser(this);
|
|
|
|
|
d->execFile->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->execFile->setPromptDialogTitle(tr("Select Executable"));
|
|
|
|
|
d->execFile->lineEdit()->setCompleter(
|
|
|
|
|
new HistoryCompleter(settings, d->execFile->lineEdit()));
|
|
|
|
|
d->execLabel = new QLabel(tr("&Executable:"), this);
|
|
|
|
|
d->execLabel->setBuddy(d->execFile);
|
|
|
|
|
|
|
|
|
|
d->argsEdit = new QLineEdit(this);
|
|
|
|
|
d->argsEdit->setCompleter(new HistoryCompleter(settings, d->argsEdit));
|
|
|
|
|
d->argsLabel = new QLabel(tr("&Arguments:"), this);
|
|
|
|
|
d->argsLabel->setBuddy(d->argsEdit);
|
|
|
|
|
|
|
|
|
|
d->workingDirectory = new Utils::PathChooser(this);
|
|
|
|
|
d->workingDirectory->setExpectedKind(PathChooser::ExistingDirectory);
|
|
|
|
|
d->workingDirectory->setPromptDialogTitle(tr("Select Working Directory"));
|
|
|
|
|
d->workingDirectory->lineEdit()->setCompleter(
|
|
|
|
|
new HistoryCompleter(settings, d->workingDirectory->lineEdit()));
|
|
|
|
|
d->workingDirectoryLabel = new QLabel(tr("&Working directory:"), this);
|
|
|
|
|
d->workingDirectoryLabel->setBuddy(d->workingDirectory);
|
|
|
|
|
|
|
|
|
|
d->runInTerminalCheckBox = new QCheckBox(this);
|
|
|
|
|
d->runInTerminalLabel = new QLabel(tr("Run in &terminal:"), this);
|
|
|
|
|
d->runInTerminalLabel->setBuddy(d->runInTerminalCheckBox);
|
|
|
|
|
|
|
|
|
|
d->profileChooser = new Debugger::ProfileChooser(this);
|
|
|
|
|
d->profileChooser->init(true);
|
|
|
|
|
d->profileLabel = new QLabel(tr("&Target:"), this);
|
|
|
|
|
d->profileLabel->setBuddy(d->profileChooser);
|
|
|
|
|
|
|
|
|
|
d->breakAtMainCheckBox = new QCheckBox(this);
|
|
|
|
|
d->breakAtMainCheckBox->setText(QString());
|
|
|
|
|
d->breakAtMainLabel = new QLabel(tr("Break at \"&main\":"), this);
|
|
|
|
|
d->breakAtMainLabel->setBuddy(d->breakAtMainCheckBox);
|
|
|
|
|
|
|
|
|
|
d->historyComboBox = new QComboBox(this);
|
|
|
|
|
d->historyLabel = new QLabel(tr("&Recent:"), this);
|
|
|
|
|
d->historyLabel->setBuddy(d->historyComboBox);
|
|
|
|
|
|
|
|
|
|
QFrame *historyLine = new QFrame(this);
|
|
|
|
|
historyLine->setFrameShape(QFrame::HLine);
|
|
|
|
|
historyLine->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
QFrame *line = new QFrame(this);
|
|
|
|
|
line->setFrameShape(QFrame::HLine);
|
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
|
|
|
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
|
|
|
|
formLayout->setHorizontalSpacing(6);
|
|
|
|
|
formLayout->setVerticalSpacing(6);
|
|
|
|
|
formLayout->addRow(d->execLabel, d->execFile);
|
|
|
|
|
formLayout->addRow(d->argsLabel, d->argsEdit);
|
|
|
|
|
formLayout->addRow(d->runInTerminalLabel, d->runInTerminalCheckBox);
|
|
|
|
|
formLayout->addRow(d->workingDirectoryLabel, d->workingDirectory);
|
|
|
|
|
formLayout->addRow(d->profileLabel, d->profileChooser);
|
|
|
|
|
formLayout->addRow(d->breakAtMainLabel, d->breakAtMainCheckBox);
|
|
|
|
|
formLayout->addRow(d->historyLabel, d->historyComboBox);
|
|
|
|
|
formLayout->addWidget(historyLine);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
|
|
|
|
verticalLayout->addLayout(formLayout);
|
|
|
|
|
verticalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
|
|
|
verticalLayout->addWidget(line);
|
|
|
|
|
verticalLayout->addWidget(d->buttonBox);
|
|
|
|
|
|
|
|
|
|
connect(d->execFile, SIGNAL(changed(QString)), SLOT(changed()));
|
|
|
|
|
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
|
|
|
|
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
|
|
|
|
connect(d->historyComboBox, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
SLOT(historyIndexChanged(int)));
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartExternalDialog::~StartExternalDialog()
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
delete d;
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
StartExternalParameters StartExternalDialog::parameters() const
|
2009-05-07 09:35:11 +02:00
|
|
|
{
|
2012-02-06 15:15:57 +01:00
|
|
|
StartExternalParameters result;
|
2012-06-28 13:30:09 +02:00
|
|
|
result.executableFile = d->execFile->path();
|
|
|
|
|
result.arguments = d->argsEdit->text();
|
|
|
|
|
result.workingDirectory = d->workingDirectory->path();
|
|
|
|
|
result.abiIndex = d->profileChooser->currentIndex();
|
|
|
|
|
result.breakAtMain = d->breakAtMainCheckBox->isChecked();
|
|
|
|
|
result.runInTerminal = d->runInTerminalCheckBox->isChecked();
|
2012-02-06 15:15:57 +01:00
|
|
|
return result;
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
void StartExternalDialog::setParameters(const StartExternalParameters &p)
|
2009-05-07 09:35:11 +02:00
|
|
|
{
|
2012-02-06 15:15:57 +01:00
|
|
|
setExecutableFile(p.executableFile);
|
2012-06-28 13:30:09 +02:00
|
|
|
d->argsEdit->setText(p.arguments);
|
|
|
|
|
d->workingDirectory->setPath(p.workingDirectory);
|
|
|
|
|
if (p.abiIndex >= 0 && p.abiIndex < d->profileChooser->count())
|
|
|
|
|
d->profileChooser->setCurrentIndex(p.abiIndex);
|
|
|
|
|
d->runInTerminalCheckBox->setChecked(p.runInTerminal);
|
|
|
|
|
d->breakAtMainCheckBox->setChecked(p.breakAtMain);
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
void StartExternalDialog::setHistory(const QList<StartExternalParameters> &l)
|
2010-05-12 11:48:00 +02:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->historyComboBox->clear();
|
|
|
|
|
for (int i = l.size(); --i >= 0; ) {
|
|
|
|
|
const StartExternalParameters &p = l.at(i);
|
|
|
|
|
if (p.isValid())
|
|
|
|
|
d->historyComboBox->addItem(p.displayName(), QVariant::fromValue(p));
|
|
|
|
|
}
|
2010-05-12 11:48:00 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
void StartExternalDialog::historyIndexChanged(int index)
|
2010-05-12 11:48:00 +02:00
|
|
|
{
|
2012-02-06 15:15:57 +01:00
|
|
|
if (index < 0)
|
|
|
|
|
return;
|
2012-06-28 13:30:09 +02:00
|
|
|
const QVariant v = d->historyComboBox->itemData(index);
|
2012-02-06 15:15:57 +01:00
|
|
|
QTC_ASSERT(v.canConvert<StartExternalParameters>(), return);
|
|
|
|
|
setParameters(v.value<StartExternalParameters>());
|
2009-06-12 12:57:22 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
void StartExternalDialog::setExecutableFile(const QString &str)
|
2011-05-04 09:21:18 +02:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->execFile->setPath(str);
|
2012-02-06 15:15:57 +01:00
|
|
|
changed();
|
2011-05-04 09:21:18 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
QString StartExternalDialog::executableFile() const
|
2011-05-04 09:21:18 +02:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->execFile->path();
|
2011-05-04 09:21:18 +02:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
Core::Id StartExternalDialog::profileId() const
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileChooser->currentProfileId();
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool StartExternalDialog::isValid() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileChooser->currentIndex() >= 0 && !executableFile().isEmpty();
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartExternalDialog::changed()
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid());
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
// Read parameter history (start external, remote)
|
|
|
|
|
// from settings array. Always return at least one element.
|
|
|
|
|
template <class Parameter>
|
|
|
|
|
QList<Parameter> readParameterHistory(QSettings *settings,
|
|
|
|
|
const QString &settingsGroup,
|
|
|
|
|
const QString &arrayName)
|
|
|
|
|
{
|
|
|
|
|
QList<Parameter> result;
|
|
|
|
|
settings->beginGroup(settingsGroup);
|
|
|
|
|
const int arraySize = settings->beginReadArray(arrayName);
|
|
|
|
|
for (int i = 0; i < arraySize; ++i) {
|
|
|
|
|
settings->setArrayIndex(i);
|
|
|
|
|
Parameter p;
|
|
|
|
|
p.fromSettings(settings);
|
|
|
|
|
result.push_back(p);
|
|
|
|
|
}
|
|
|
|
|
settings->endArray();
|
|
|
|
|
if (result.isEmpty()) { // First time: Read old settings.
|
|
|
|
|
Parameter p;
|
|
|
|
|
p.fromSettings(settings);
|
|
|
|
|
result.push_back(p);
|
|
|
|
|
}
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Write parameter history (start external, remote) to settings.
|
|
|
|
|
template <class Parameter>
|
|
|
|
|
void writeParameterHistory(const QList<Parameter> &history,
|
|
|
|
|
QSettings *settings,
|
|
|
|
|
const QString &settingsGroup,
|
|
|
|
|
const QString &arrayName)
|
|
|
|
|
{
|
|
|
|
|
settings->beginGroup(settingsGroup);
|
|
|
|
|
settings->beginWriteArray(arrayName);
|
|
|
|
|
for (int i = 0; i < history.size(); ++i) {
|
|
|
|
|
settings->setArrayIndex(i);
|
|
|
|
|
history.at(i).toSettings(settings);
|
|
|
|
|
}
|
|
|
|
|
settings->endArray();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool StartExternalDialog::run(QWidget *parent,
|
|
|
|
|
QSettings *settings,
|
|
|
|
|
DebuggerStartParameters *sp)
|
|
|
|
|
{
|
|
|
|
|
const QString settingsGroup = _("DebugMode");
|
|
|
|
|
const QString arrayName = _("StartExternal");
|
|
|
|
|
QList<StartExternalParameters> history =
|
|
|
|
|
readParameterHistory<StartExternalParameters>(settings, settingsGroup, arrayName);
|
|
|
|
|
QTC_ASSERT(!history.isEmpty(), return false);
|
|
|
|
|
|
|
|
|
|
StartExternalDialog dialog(parent);
|
|
|
|
|
dialog.setHistory(history);
|
|
|
|
|
dialog.setParameters(history.back());
|
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
|
return false;
|
|
|
|
|
const StartExternalParameters newParameters = dialog.parameters();
|
|
|
|
|
|
|
|
|
|
if (newParameters != history.back()) {
|
|
|
|
|
history.push_back(newParameters);
|
|
|
|
|
if (history.size() > 10)
|
|
|
|
|
history.pop_front();
|
|
|
|
|
writeParameterHistory(history, settings, settingsGroup, arrayName);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
fillParameters(sp, dialog.profileId());
|
2012-02-06 15:15:57 +01:00
|
|
|
sp->executable = newParameters.executableFile;
|
|
|
|
|
sp->startMode = StartExternal;
|
|
|
|
|
sp->workingDirectory = newParameters.workingDirectory;
|
|
|
|
|
sp->displayName = sp->executable;
|
|
|
|
|
sp->useTerminal = newParameters.runInTerminal;
|
|
|
|
|
if (!newParameters.arguments.isEmpty())
|
|
|
|
|
sp->processArgs = newParameters.arguments;
|
|
|
|
|
sp->breakOnMain = newParameters.breakAtMain;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-02 14:04:03 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2009-05-06 13:27:11 +02:00
|
|
|
// StartRemoteDialog
|
2009-03-02 14:04:03 +01:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
class StartRemoteParameters
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
StartRemoteParameters();
|
|
|
|
|
bool equals(const StartRemoteParameters &rhs) const;
|
|
|
|
|
QString displayName() const { return remoteChannel; }
|
|
|
|
|
bool isValid() const { return !remoteChannel.isEmpty(); }
|
|
|
|
|
|
|
|
|
|
void toSettings(QSettings *) const;
|
|
|
|
|
void fromSettings(const QSettings *settings);
|
|
|
|
|
|
|
|
|
|
QString localExecutable;
|
|
|
|
|
QString remoteChannel;
|
|
|
|
|
QString remoteArchitecture;
|
|
|
|
|
QString overrideStartScript;
|
|
|
|
|
bool useServerStartScript;
|
|
|
|
|
QString serverStartScript;
|
2012-06-26 16:16:59 +02:00
|
|
|
Core::Id profileId;
|
2012-02-06 15:15:57 +01:00
|
|
|
QString debugInfoLocation;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::StartRemoteParameters)
|
|
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
bool operator==(const StartRemoteParameters &p1, const StartRemoteParameters &p2)
|
|
|
|
|
{
|
|
|
|
|
return p1.equals(p2);
|
|
|
|
|
}
|
2012-02-06 15:15:57 +01:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
bool operator!=(const StartRemoteParameters &p1, const StartRemoteParameters &p2)
|
|
|
|
|
{
|
|
|
|
|
return !p1.equals(p2);
|
|
|
|
|
}
|
2012-02-06 15:15:57 +01:00
|
|
|
|
|
|
|
|
StartRemoteParameters::StartRemoteParameters() :
|
2012-07-16 15:58:36 +02:00
|
|
|
useServerStartScript(false)
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool StartRemoteParameters::equals(const StartRemoteParameters &rhs) const
|
|
|
|
|
{
|
|
|
|
|
return localExecutable == rhs.localExecutable && remoteChannel ==rhs.remoteChannel
|
|
|
|
|
&& remoteArchitecture == rhs.remoteArchitecture
|
|
|
|
|
&& overrideStartScript == rhs.overrideStartScript
|
|
|
|
|
&& useServerStartScript == rhs.useServerStartScript
|
|
|
|
|
&& serverStartScript == rhs.serverStartScript
|
2012-06-26 16:16:59 +02:00
|
|
|
&& profileId == rhs.profileId
|
2012-02-06 15:15:57 +01:00
|
|
|
&& debugInfoLocation == rhs.debugInfoLocation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteParameters::toSettings(QSettings *settings) const
|
|
|
|
|
{
|
|
|
|
|
settings->setValue(_("LastRemoteChannel"), remoteChannel);
|
|
|
|
|
settings->setValue(_("LastLocalExecutable"), localExecutable);
|
|
|
|
|
settings->setValue(_("LastRemoteArchitecture"), remoteArchitecture);
|
|
|
|
|
settings->setValue(_("LastServerStartScript"), serverStartScript);
|
|
|
|
|
settings->setValue(_("LastUseServerStartScript"), useServerStartScript);
|
|
|
|
|
settings->setValue(_("LastRemoteStartScript"), overrideStartScript);
|
2012-06-26 16:16:59 +02:00
|
|
|
settings->setValue(_("LastProfileId"), profileId.toString());
|
2012-02-06 15:15:57 +01:00
|
|
|
settings->setValue(_("LastDebugInfoLocation"), debugInfoLocation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteParameters::fromSettings(const QSettings *settings)
|
|
|
|
|
{
|
|
|
|
|
remoteChannel = settings->value(_("LastRemoteChannel")).toString();
|
|
|
|
|
localExecutable = settings->value(_("LastLocalExecutable")).toString();
|
2012-07-16 15:58:36 +02:00
|
|
|
const QString profileIdString = settings->value(_("LastProfileId")).toString();
|
|
|
|
|
if (profileIdString.isEmpty()) {
|
|
|
|
|
profileId = Core::Id();
|
|
|
|
|
} else {
|
|
|
|
|
profileId = Core::Id(profileIdString);
|
|
|
|
|
}
|
2012-02-06 15:15:57 +01:00
|
|
|
remoteArchitecture = settings->value(_("LastRemoteArchitecture")).toString();
|
|
|
|
|
serverStartScript = settings->value(_("LastServerStartScript")).toString();
|
|
|
|
|
useServerStartScript = settings->value(_("LastUseServerStartScript")).toBool();
|
|
|
|
|
overrideStartScript = settings->value(_("LastRemoteStartScript")).toString();
|
|
|
|
|
debugInfoLocation = settings->value(_("LastDebugInfoLocation")).toString();
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
class StartRemoteDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QLabel *profileLabel;
|
|
|
|
|
Debugger::ProfileChooser *profileChooser;
|
|
|
|
|
QLabel *executableLabel;
|
|
|
|
|
Utils::PathChooser *executablePathChooser;
|
|
|
|
|
QLabel *channelLabel;
|
|
|
|
|
QLineEdit *channelLineEdit;
|
|
|
|
|
QLabel *architectureLabel;
|
|
|
|
|
QComboBox *architectureComboBox;
|
|
|
|
|
QLabel *debuginfoLabel;
|
|
|
|
|
Utils::PathChooser *debuginfoPathChooser;
|
|
|
|
|
QLabel *overrideStartScriptLabel;
|
|
|
|
|
Utils::PathChooser *overrideStartScriptPathChooser;
|
|
|
|
|
QLabel *useServerStartScriptLabel;
|
|
|
|
|
QCheckBox *useServerStartScriptCheckBox;
|
|
|
|
|
QLabel *serverStartScriptLabel;
|
|
|
|
|
Utils::PathChooser *serverStartScriptPathChooser;
|
|
|
|
|
QLabel *historyLabel;
|
|
|
|
|
QComboBox *historyComboBox;
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
|
|
|
|
};
|
|
|
|
|
|
2011-09-14 15:22:08 +02:00
|
|
|
StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript)
|
2009-05-04 14:47:45 +02:00
|
|
|
: QDialog(parent),
|
2012-06-28 13:30:09 +02:00
|
|
|
d(new StartRemoteDialogPrivate)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2012-06-28 13:30:09 +02:00
|
|
|
setWindowTitle(tr("Start Debugger"));
|
|
|
|
|
|
|
|
|
|
d->profileChooser = new Debugger::ProfileChooser(this);
|
|
|
|
|
d->profileChooser->init(false);
|
|
|
|
|
d->profileLabel = new QLabel(tr("Target:"), this);
|
|
|
|
|
d->profileLabel->setBuddy(d->profileChooser);
|
|
|
|
|
|
|
|
|
|
d->executablePathChooser = new Utils::PathChooser(this);
|
|
|
|
|
d->executablePathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->executablePathChooser->setPromptDialogTitle(tr("Select Executable"));
|
|
|
|
|
d->executableLabel = new QLabel(tr("Local &executable:"));
|
|
|
|
|
d->executableLabel->setBuddy(d->executablePathChooser);
|
|
|
|
|
|
|
|
|
|
d->channelLineEdit = new QLineEdit(this);
|
|
|
|
|
d->channelLineEdit->setText(QString::fromUtf8("localhost:5115"));
|
|
|
|
|
d->channelLabel = new QLabel(tr("&Host and port:"), this);
|
|
|
|
|
d->channelLabel->setBuddy(d->channelLineEdit);
|
|
|
|
|
|
|
|
|
|
d->architectureComboBox = new QComboBox(this);
|
|
|
|
|
d->architectureComboBox->setEditable(true);
|
|
|
|
|
d->architectureLabel = new QLabel(tr("&Architecture:"), this);
|
|
|
|
|
d->architectureLabel->setBuddy(d->architectureComboBox);
|
|
|
|
|
|
|
|
|
|
d->debuginfoPathChooser = new Utils::PathChooser(this);
|
|
|
|
|
d->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information"));
|
|
|
|
|
d->debuginfoLabel = new QLabel(tr("Location of debugging &information:"), this);
|
|
|
|
|
d->debuginfoLabel->setBuddy(d->debuginfoPathChooser);
|
|
|
|
|
|
|
|
|
|
d->overrideStartScriptPathChooser = new Utils::PathChooser(this);
|
|
|
|
|
d->overrideStartScriptPathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->overrideStartScriptPathChooser->setPromptDialogTitle(tr("Select GDB Start Script"));
|
|
|
|
|
d->overrideStartScriptLabel = new QLabel(tr("Override host GDB s&tart script:"), this);
|
|
|
|
|
d->overrideStartScriptLabel->setBuddy(d->overrideStartScriptPathChooser);
|
|
|
|
|
|
|
|
|
|
d->useServerStartScriptCheckBox = new QCheckBox(this);
|
|
|
|
|
d->useServerStartScriptCheckBox->setVisible(enableStartScript);
|
|
|
|
|
d->useServerStartScriptLabel = new QLabel(tr("&Use server start script:"), this);
|
|
|
|
|
d->useServerStartScriptLabel->setVisible(enableStartScript);
|
|
|
|
|
|
|
|
|
|
d->serverStartScriptPathChooser = new Utils::PathChooser(this);
|
|
|
|
|
d->serverStartScriptPathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->serverStartScriptPathChooser->setPromptDialogTitle(tr("Select Server Start Script"));
|
|
|
|
|
d->serverStartScriptPathChooser->setVisible(enableStartScript);
|
|
|
|
|
d->serverStartScriptLabel = new QLabel(tr("&Server start script:"), this);
|
|
|
|
|
d->serverStartScriptLabel->setVisible(enableStartScript);
|
|
|
|
|
d->serverStartScriptLabel->setBuddy(d->serverStartScriptPathChooser);
|
|
|
|
|
|
|
|
|
|
QFrame *line = new QFrame(this);
|
|
|
|
|
line->setFrameShape(QFrame::HLine);
|
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
d->historyComboBox = new QComboBox(this);
|
|
|
|
|
d->historyLabel = new QLabel(tr("&Recent:"), this);
|
|
|
|
|
d->historyLabel->setBuddy(d->historyComboBox);
|
|
|
|
|
|
|
|
|
|
QFrame *line2 = new QFrame(this);
|
|
|
|
|
line2->setFrameShape(QFrame::HLine);
|
|
|
|
|
line2->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
|
|
|
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
|
|
|
|
formLayout->addRow(d->profileLabel, d->profileChooser);
|
|
|
|
|
formLayout->addRow(d->executableLabel, d->executablePathChooser);
|
|
|
|
|
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
|
formLayout->addRow(d->channelLabel, d->channelLineEdit);
|
|
|
|
|
formLayout->addRow(d->architectureLabel, d->architectureComboBox);
|
2012-07-15 21:47:19 +03:00
|
|
|
formLayout->addRow(d->debuginfoLabel, d->debuginfoPathChooser);
|
2012-06-28 13:30:09 +02:00
|
|
|
formLayout->addRow(d->overrideStartScriptLabel, d->overrideStartScriptPathChooser);
|
|
|
|
|
formLayout->addRow(d->useServerStartScriptLabel, d->useServerStartScriptCheckBox);
|
|
|
|
|
formLayout->addRow(d->serverStartScriptLabel, d->serverStartScriptPathChooser);
|
|
|
|
|
formLayout->addRow(line);
|
|
|
|
|
formLayout->addRow(d->historyLabel, d->historyComboBox);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
|
|
|
|
verticalLayout->addLayout(formLayout);
|
|
|
|
|
verticalLayout->addWidget(line2);
|
|
|
|
|
verticalLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
|
|
|
verticalLayout->addWidget(d->buttonBox);
|
|
|
|
|
|
|
|
|
|
connect(d->useServerStartScriptCheckBox, SIGNAL(toggled(bool)),
|
2011-09-14 15:22:08 +02:00
|
|
|
SLOT(updateState()));
|
2012-06-28 13:30:09 +02:00
|
|
|
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
|
|
|
|
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
|
|
|
|
connect(d->historyComboBox, SIGNAL(currentIndexChanged(int)),
|
2012-02-06 15:15:57 +01:00
|
|
|
this, SLOT(historyIndexChanged(int)));
|
2009-05-07 09:35:11 +02:00
|
|
|
updateState();
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
StartRemoteDialog::~StartRemoteDialog()
|
2009-03-02 15:14:12 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
delete d;
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
bool StartRemoteDialog::run(QWidget *parent, QSettings *settings,
|
|
|
|
|
bool useScript, DebuggerStartParameters *sp)
|
2009-03-05 17:30:29 +01:00
|
|
|
{
|
2012-02-06 15:15:57 +01:00
|
|
|
const QString settingsGroup = _("DebugMode");
|
|
|
|
|
const QString arrayName = useScript ?
|
|
|
|
|
_("StartRemoteScript") : _("StartRemote");
|
2009-03-05 17:30:29 +01:00
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
QStringList arches;
|
|
|
|
|
arches << _("i386:x86-64:intel") << _("i386") << _("arm");
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
QList<StartRemoteParameters> history =
|
|
|
|
|
readParameterHistory<StartRemoteParameters>(settings, settingsGroup, arrayName);
|
|
|
|
|
QTC_ASSERT(!history.isEmpty(), return false);
|
2009-12-10 16:57:45 +01:00
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
foreach (const StartRemoteParameters &h, history)
|
|
|
|
|
if (!arches.contains(h.remoteArchitecture))
|
|
|
|
|
arches.prepend(h.remoteArchitecture);
|
2009-12-11 11:49:32 +01:00
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
StartRemoteDialog dialog(parent, useScript);
|
|
|
|
|
dialog.setRemoteArchitectures(arches);
|
|
|
|
|
dialog.setHistory(history);
|
|
|
|
|
dialog.setParameters(history.back());
|
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
|
return false;
|
|
|
|
|
const StartRemoteParameters newParameters = dialog.parameters();
|
2012-01-26 20:57:00 +02:00
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
if (newParameters != history.back()) {
|
|
|
|
|
history.push_back(newParameters);
|
|
|
|
|
if (history.size() > 10)
|
|
|
|
|
history.pop_front();
|
|
|
|
|
writeParameterHistory(history, settings, settingsGroup, arrayName);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
fillParameters(sp, dialog.profileId());
|
2012-02-06 15:15:57 +01:00
|
|
|
sp->remoteChannel = newParameters.remoteChannel;
|
|
|
|
|
sp->remoteArchitecture = newParameters.remoteArchitecture;
|
|
|
|
|
sp->executable = newParameters.localExecutable;
|
|
|
|
|
sp->displayName = tr("Remote: \"%1\"").arg(sp->remoteChannel);
|
|
|
|
|
sp->overrideStartScript = newParameters.overrideStartScript;
|
|
|
|
|
sp->useServerStartScript = newParameters.useServerStartScript;
|
|
|
|
|
sp->serverStartScript = newParameters.serverStartScript;
|
|
|
|
|
sp->debugInfoLocation = newParameters.debugInfoLocation;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartRemoteParameters StartRemoteDialog::parameters() const
|
|
|
|
|
{
|
|
|
|
|
StartRemoteParameters result;
|
2012-06-28 13:30:09 +02:00
|
|
|
result.remoteChannel = d->channelLineEdit->text();
|
|
|
|
|
result.localExecutable = d->executablePathChooser->path();
|
|
|
|
|
result.remoteArchitecture = d->architectureComboBox->currentText();
|
|
|
|
|
result.overrideStartScript = d->overrideStartScriptPathChooser->path();
|
|
|
|
|
result.useServerStartScript = d->useServerStartScriptCheckBox->isChecked();
|
|
|
|
|
result.serverStartScript = d->serverStartScriptPathChooser->path();
|
|
|
|
|
result.profileId = d->profileChooser->currentProfileId();
|
|
|
|
|
result.debugInfoLocation = d->debuginfoPathChooser->path();
|
2012-02-06 15:15:57 +01:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteDialog::setParameters(const StartRemoteParameters &p)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->channelLineEdit->setText(p.remoteChannel);
|
|
|
|
|
d->executablePathChooser->setPath(p.localExecutable);
|
|
|
|
|
const int index = d->architectureComboBox->findText(p.remoteArchitecture);
|
2012-02-06 15:15:57 +01:00
|
|
|
if (index != -1)
|
2012-06-28 13:30:09 +02:00
|
|
|
d->architectureComboBox->setCurrentIndex(index);
|
|
|
|
|
d->overrideStartScriptPathChooser->setPath(p.overrideStartScript);
|
|
|
|
|
d->useServerStartScriptCheckBox->setChecked(p.useServerStartScript);
|
|
|
|
|
d->serverStartScriptPathChooser->setPath(p.serverStartScript);
|
|
|
|
|
d->profileChooser->setCurrentProfileId(p.profileId);
|
|
|
|
|
d->debuginfoPathChooser->setPath(p.debugInfoLocation);
|
2012-01-26 20:57:00 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
void StartRemoteDialog::setHistory(const QList<StartRemoteParameters> &l)
|
2009-12-11 11:49:32 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->historyComboBox->clear();
|
2012-02-06 15:15:57 +01:00
|
|
|
for (int i = l.size() - 1; i >= 0; --i)
|
|
|
|
|
if (l.at(i).isValid())
|
2012-06-28 13:30:09 +02:00
|
|
|
d->historyComboBox->addItem(l.at(i).displayName(),
|
2012-02-06 15:15:57 +01:00
|
|
|
QVariant::fromValue(l.at(i)));
|
2009-12-11 11:49:32 +01:00
|
|
|
}
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
void StartRemoteDialog::historyIndexChanged(int index)
|
2009-12-11 11:49:32 +01:00
|
|
|
{
|
2012-02-06 15:15:57 +01:00
|
|
|
if (index < 0)
|
|
|
|
|
return;
|
2012-06-28 13:30:09 +02:00
|
|
|
const QVariant v = d->historyComboBox->itemData(index);
|
2012-02-06 15:15:57 +01:00
|
|
|
QTC_ASSERT(v.canConvert<StartRemoteParameters>(), return);
|
|
|
|
|
setParameters(v.value<StartRemoteParameters>());
|
2009-12-10 16:57:45 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
Core::Id StartRemoteDialog::profileId() const
|
2011-09-14 17:01:57 +02:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->profileChooser->currentProfileId();
|
2011-09-14 17:01:57 +02:00
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)
|
2009-05-04 14:47:45 +02:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
d->architectureComboBox->clear();
|
2009-05-04 14:47:45 +02:00
|
|
|
if (!list.isEmpty()) {
|
2012-06-28 13:30:09 +02:00
|
|
|
d->architectureComboBox->insertItems(0, list);
|
|
|
|
|
d->architectureComboBox->setCurrentIndex(0);
|
2009-03-05 17:30:29 +01:00
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
void StartRemoteDialog::updateState()
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
bool enabled = d->useServerStartScriptCheckBox->isChecked();
|
|
|
|
|
d->serverStartScriptLabel->setEnabled(enabled);
|
|
|
|
|
d->serverStartScriptPathChooser->setEnabled(enabled);
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
2009-03-05 17:30:29 +01:00
|
|
|
|
2011-09-13 17:26:02 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// AttachToQmlPortDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
class AttachToQmlPortDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QLabel *hostLabel;
|
|
|
|
|
QLineEdit *hostLineEdit;
|
|
|
|
|
QLabel *portLabel;
|
|
|
|
|
QSpinBox *portSpinBox;
|
|
|
|
|
QLabel *profileLabel;
|
|
|
|
|
Debugger::ProfileChooser *profileChooser;
|
|
|
|
|
};
|
|
|
|
|
|
2011-09-13 17:26:02 +02:00
|
|
|
AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent),
|
2012-06-28 10:00:04 +02:00
|
|
|
d(new AttachToQmlPortDialogPrivate)
|
2011-09-13 17:26:02 +02:00
|
|
|
{
|
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2012-06-28 10:00:04 +02:00
|
|
|
setWindowTitle(tr("Start Debugger"));
|
2011-09-13 17:26:02 +02:00
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
d->profileChooser = new Debugger::ProfileChooser(this);
|
|
|
|
|
d->profileLabel = new QLabel(tr("Target:"), this);
|
|
|
|
|
d->profileLabel->setBuddy(d->profileChooser);
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
d->hostLineEdit = new QLineEdit(this);
|
|
|
|
|
d->hostLineEdit->setText(QString::fromUtf8("localhost"));
|
2012-06-28 13:30:09 +02:00
|
|
|
d->hostLabel = new QLabel(tr("&Host:"), this);
|
2012-06-28 10:00:04 +02:00
|
|
|
d->hostLabel->setBuddy(d->hostLineEdit);
|
|
|
|
|
|
|
|
|
|
d->portSpinBox = new QSpinBox(this);
|
|
|
|
|
d->portSpinBox->setMaximum(65535);
|
|
|
|
|
d->portSpinBox->setValue(3768);
|
2012-06-28 13:30:09 +02:00
|
|
|
d->portLabel = new QLabel(tr("&Port:"), this);
|
2012-06-28 10:00:04 +02:00
|
|
|
d->portLabel->setBuddy(d->portSpinBox);
|
|
|
|
|
|
|
|
|
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
2012-06-28 13:30:09 +02:00
|
|
|
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
2012-06-28 10:00:04 +02:00
|
|
|
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
2012-06-28 13:30:09 +02:00
|
|
|
formLayout->addRow(d->profileLabel, d->profileChooser);
|
2012-06-28 10:00:04 +02:00
|
|
|
formLayout->addRow(d->hostLabel, d->hostLineEdit);
|
|
|
|
|
formLayout->addRow(d->portLabel, d->portSpinBox);
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
2012-06-28 10:00:04 +02:00
|
|
|
verticalLayout->addLayout(formLayout);
|
|
|
|
|
verticalLayout->addWidget(buttonBox);
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
connect(buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
|
|
|
|
connect(buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
2011-09-13 17:26:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AttachToQmlPortDialog::~AttachToQmlPortDialog()
|
|
|
|
|
{
|
2012-06-28 10:00:04 +02:00
|
|
|
delete d;
|
2011-09-13 17:26:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachToQmlPortDialog::setHost(const QString &host)
|
|
|
|
|
{
|
2012-06-28 10:00:04 +02:00
|
|
|
d->hostLineEdit->setText(host);
|
2011-09-13 17:26:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AttachToQmlPortDialog::host() const
|
|
|
|
|
{
|
2012-06-28 10:00:04 +02:00
|
|
|
return d->hostLineEdit->text();
|
2011-09-13 17:26:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachToQmlPortDialog::setPort(const int port)
|
|
|
|
|
{
|
2012-06-28 10:00:04 +02:00
|
|
|
d->portSpinBox->setValue(port);
|
2011-09-13 17:26:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AttachToQmlPortDialog::port() const
|
|
|
|
|
{
|
2012-06-28 10:00:04 +02:00
|
|
|
return d->portSpinBox->value();
|
2011-09-13 17:26:02 +02:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
Core::Id AttachToQmlPortDialog::profileId() const
|
2011-10-11 15:21:00 +02:00
|
|
|
{
|
2012-06-28 10:00:04 +02:00
|
|
|
return d->profileChooser->currentProfileId();
|
2011-10-11 15:21:00 +02:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
void AttachToQmlPortDialog::setProfileId(const Core::Id &id)
|
2011-10-11 15:21:00 +02:00
|
|
|
{
|
2012-06-28 10:00:04 +02:00
|
|
|
d->profileChooser->setCurrentProfileId(id);
|
2011-10-11 15:21:00 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-19 16:13:22 +01:00
|
|
|
// --------- StartRemoteCdbDialog
|
2012-06-28 13:30:09 +02:00
|
|
|
static QString cdbRemoteHelp()
|
2010-11-19 16:13:22 +01:00
|
|
|
{
|
|
|
|
|
const char *cdbConnectionSyntax =
|
|
|
|
|
"Server:Port<br>"
|
|
|
|
|
"tcp:server=Server,port=Port[,password=Password][,ipversion=6]\n"
|
|
|
|
|
"tcp:clicon=Server,port=Port[,password=Password][,ipversion=6]\n"
|
|
|
|
|
"npipe:server=Server,pipe=PipeName[,password=Password]\n"
|
|
|
|
|
"com:port=COMPort,baud=BaudRate,channel=COMChannel[,password=Password]\n"
|
|
|
|
|
"spipe:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,pipe=PipeName[,password=Password]\n"
|
|
|
|
|
"ssl:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,port=Socket[,password=Password]\n"
|
|
|
|
|
"ssl:proto=Protocol,{certuser=Cert|machuser=Cert},clicon=Server,port=Socket[,password=Password]";
|
|
|
|
|
|
2011-01-11 11:06:15 +01:00
|
|
|
const QString ext32 = QDir::toNativeSeparators(CdbEngine::extensionLibraryName(false));
|
|
|
|
|
const QString ext64 = QDir::toNativeSeparators(CdbEngine::extensionLibraryName(true));
|
2010-11-19 16:13:22 +01:00
|
|
|
return StartRemoteCdbDialog::tr(
|
|
|
|
|
"<html><body><p>The remote CDB needs to load the matching Qt Creator CDB extension "
|
|
|
|
|
"(<code>%1</code> or <code>%2</code>, respectively).</p><p>Copy it onto the remote machine and set the "
|
|
|
|
|
"environment variable <code>%3</code> to point to its folder.</p><p>"
|
|
|
|
|
"Launch the remote CDB as <code>%4 <executable></code> "
|
|
|
|
|
" to use TCP/IP as communication protocol.</p><p>Enter the connection parameters as:</p>"
|
|
|
|
|
"<pre>%5</pre></body></html>").
|
|
|
|
|
arg(ext32, ext64, QLatin1String("_NT_DEBUGGER_EXTENSION_PATH"),
|
|
|
|
|
QLatin1String("cdb.exe -server tcp:port=1234"),
|
|
|
|
|
QLatin1String(cdbConnectionSyntax));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent), m_okButton(0), m_lineEdit(new QLineEdit)
|
|
|
|
|
{
|
|
|
|
|
setWindowTitle(tr("Start a CDB Remote Session"));
|
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
|
|
|
|
QGroupBox *groupBox = new QGroupBox;
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2010-11-19 16:13:22 +01:00
|
|
|
QLabel *helpLabel = new QLabel(cdbRemoteHelp());
|
|
|
|
|
helpLabel->setWordWrap(true);
|
|
|
|
|
helpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2010-11-19 16:13:22 +01:00
|
|
|
QLabel *label = new QLabel(tr("&Connection:"));
|
|
|
|
|
label->setBuddy(m_lineEdit);
|
|
|
|
|
m_lineEdit->setMinimumWidth(400);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
|
|
|
|
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout;
|
|
|
|
|
formLayout->addRow(helpLabel);
|
2010-11-19 16:13:22 +01:00
|
|
|
formLayout->addRow(label, m_lineEdit);
|
|
|
|
|
groupBox->setLayout(formLayout);
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
QVBoxLayout *vLayout = new QVBoxLayout(this);
|
2010-11-19 16:13:22 +01:00
|
|
|
vLayout->addWidget(groupBox);
|
|
|
|
|
vLayout->addWidget(box);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2010-11-19 16:13:22 +01:00
|
|
|
m_okButton = box->button(QDialogButtonBox::Ok);
|
|
|
|
|
m_okButton->setEnabled(false);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
|
|
|
|
|
connect(m_lineEdit, SIGNAL(returnPressed()), m_okButton, SLOT(animateClick()));
|
2010-11-19 16:13:22 +01:00
|
|
|
connect(box, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(box, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteCdbDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
if (!m_lineEdit->text().isEmpty())
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartRemoteCdbDialog::~StartRemoteCdbDialog()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteCdbDialog::textChanged(const QString &t)
|
|
|
|
|
{
|
|
|
|
|
m_okButton->setEnabled(!t.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteCdbDialog::connection() const
|
|
|
|
|
{
|
|
|
|
|
const QString rc = m_lineEdit->text();
|
|
|
|
|
// Transform an IP:POrt ('localhost:1234') specification into full spec
|
|
|
|
|
QRegExp ipRegexp(QLatin1String("([\\w\\.\\-_]+):([0-9]{1,4})"));
|
|
|
|
|
QTC_ASSERT(ipRegexp.isValid(), return QString());
|
|
|
|
|
if (ipRegexp.exactMatch(rc))
|
2012-02-16 09:55:47 +02:00
|
|
|
return QString::fromLatin1("tcp:server=%1,port=%2").arg(ipRegexp.cap(1), ipRegexp.cap(2));
|
2010-11-19 16:13:22 +01:00
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteCdbDialog::setConnection(const QString &c)
|
|
|
|
|
{
|
|
|
|
|
m_lineEdit->setText(c);
|
|
|
|
|
m_okButton->setEnabled(!c.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-19 14:41:51 +02:00
|
|
|
AddressDialog::AddressDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent),
|
|
|
|
|
m_lineEdit(new QLineEdit),
|
|
|
|
|
m_box(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel))
|
|
|
|
|
{
|
2010-09-17 11:03:43 +02:00
|
|
|
setWindowTitle(tr("Select Start Address"));
|
2009-08-19 14:41:51 +02:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
QHBoxLayout *hLayout = new QHBoxLayout;
|
|
|
|
|
hLayout->addWidget(new QLabel(tr("Enter an address: ")));
|
|
|
|
|
hLayout->addWidget(m_lineEdit);
|
|
|
|
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
|
|
|
|
vLayout->addLayout(hLayout);
|
|
|
|
|
vLayout->addWidget(m_box);
|
|
|
|
|
setLayout(vLayout);
|
|
|
|
|
|
|
|
|
|
connect(m_box, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(m_box, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
connect(m_lineEdit, SIGNAL(returnPressed()), this, SLOT(accept()));
|
|
|
|
|
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
|
|
|
|
|
|
|
|
|
setOkButtonEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddressDialog::setOkButtonEnabled(bool v)
|
|
|
|
|
{
|
|
|
|
|
m_box->button(QDialogButtonBox::Ok)->setEnabled(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AddressDialog::isOkButtonEnabled() const
|
|
|
|
|
{
|
|
|
|
|
return m_box->button(QDialogButtonBox::Ok)->isEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 11:58:54 +02:00
|
|
|
void AddressDialog::setAddress(quint64 a)
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
m_lineEdit->setText(QLatin1String("0x") + QString::number(a, 16));
|
2011-05-04 11:58:54 +02:00
|
|
|
}
|
|
|
|
|
|
2009-08-19 14:41:51 +02:00
|
|
|
quint64 AddressDialog::address() const
|
|
|
|
|
{
|
|
|
|
|
return m_lineEdit->text().toULongLong(0, 16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddressDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
if (isOkButtonEnabled())
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddressDialog::textChanged()
|
|
|
|
|
{
|
|
|
|
|
setOkButtonEnabled(isValid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AddressDialog::isValid() const
|
|
|
|
|
{
|
|
|
|
|
const QString text = m_lineEdit->text();
|
|
|
|
|
bool ok = false;
|
|
|
|
|
text.toULongLong(&ok, 16);
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-01 15:41:08 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// StartRemoteEngineDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
class StartRemoteEngineDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QLabel *hostLabel;
|
|
|
|
|
QLineEdit *host;
|
|
|
|
|
QLabel *userLabel;
|
|
|
|
|
QLineEdit *username;
|
|
|
|
|
QLabel *passwordLabel;
|
|
|
|
|
QLineEdit *password;
|
|
|
|
|
QLabel *engineLabel;
|
|
|
|
|
QLineEdit *enginePath;
|
|
|
|
|
QLabel *inferiorLabel;
|
|
|
|
|
QLineEdit *inferiorPath;
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent), d(new StartRemoteEngineDialogPrivate)
|
2010-12-01 15:41:08 +01:00
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
QSettings *settings = Core::ICore::settings();
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2012-06-28 13:30:09 +02:00
|
|
|
setWindowTitle(tr("Start Remote Engine"));
|
|
|
|
|
|
|
|
|
|
d->host = new QLineEdit(this);
|
|
|
|
|
d->host->setText(QString());
|
|
|
|
|
d->host->setCompleter(new HistoryCompleter(settings, d->host));
|
|
|
|
|
d->hostLabel = new QLabel(tr("&Host:"), this);
|
|
|
|
|
d->hostLabel->setBuddy(d->host);
|
|
|
|
|
|
|
|
|
|
d->username = new QLineEdit(this);
|
|
|
|
|
d->username->setCompleter(new HistoryCompleter(settings, d->username));
|
|
|
|
|
d->userLabel = new QLabel(tr("&Username:"), this);
|
|
|
|
|
d->userLabel->setBuddy(d->username);
|
|
|
|
|
|
|
|
|
|
d->password = new QLineEdit(this);
|
|
|
|
|
d->password->setEchoMode(QLineEdit::Password);
|
|
|
|
|
d->passwordLabel = new QLabel(tr("&Password:"), this);
|
|
|
|
|
d->passwordLabel->setBuddy(d->password);
|
|
|
|
|
|
|
|
|
|
d->enginePath = new QLineEdit(this);
|
|
|
|
|
d->enginePath->setCompleter(new HistoryCompleter(settings, d->enginePath));
|
|
|
|
|
d->engineLabel = new QLabel(tr("&Engine path:"), this);
|
|
|
|
|
d->engineLabel->setBuddy(d->enginePath);
|
|
|
|
|
|
|
|
|
|
d->inferiorPath = new QLineEdit(this);
|
|
|
|
|
d->inferiorPath->setCompleter(new HistoryCompleter(settings, d->inferiorPath));
|
|
|
|
|
d->inferiorLabel = new QLabel(tr("&Inferior path:"), this);
|
|
|
|
|
d->inferiorLabel->setBuddy(d->inferiorPath);
|
|
|
|
|
|
|
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
|
|
|
|
formLayout->addRow(d->hostLabel, d->host);
|
|
|
|
|
formLayout->addRow(d->userLabel, d->username);
|
|
|
|
|
formLayout->addRow(d->passwordLabel, d->password);
|
|
|
|
|
formLayout->addRow(d->engineLabel, d->enginePath);
|
|
|
|
|
formLayout->addRow(d->inferiorLabel, d->inferiorPath);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
|
|
|
|
verticalLayout->addLayout(formLayout);
|
|
|
|
|
verticalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
|
|
|
verticalLayout->addWidget(d->buttonBox);
|
|
|
|
|
|
|
|
|
|
connect(d->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(d->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartRemoteEngineDialog::~StartRemoteEngineDialog()
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
delete d;
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::host() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->host->text();
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::username() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->username->text();
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::password() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->password->text();
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::inferiorPath() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->inferiorPath->text();
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::enginePath() const
|
|
|
|
|
{
|
2012-06-28 13:30:09 +02:00
|
|
|
return d->enginePath->text();
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
2011-11-07 20:07:14 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// TypeFormatsDialogUi
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TypeFormatsDialogPage : public QWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TypeFormatsDialogPage()
|
|
|
|
|
{
|
2011-12-12 17:29:32 +01:00
|
|
|
m_layout = new QGridLayout;
|
|
|
|
|
m_layout->setColumnStretch(0, 2);
|
|
|
|
|
QVBoxLayout *vboxLayout = new QVBoxLayout;
|
|
|
|
|
vboxLayout->addLayout(m_layout);
|
|
|
|
|
vboxLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Ignored,
|
|
|
|
|
QSizePolicy::MinimumExpanding));
|
|
|
|
|
setLayout(vboxLayout);
|
2011-11-07 20:07:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addTypeFormats(const QString &type,
|
|
|
|
|
const QStringList &typeFormats, int current)
|
|
|
|
|
{
|
2011-12-12 17:29:32 +01:00
|
|
|
const int row = m_layout->rowCount();
|
|
|
|
|
int column = 0;
|
2011-11-07 20:07:14 +01:00
|
|
|
QButtonGroup *group = new QButtonGroup(this);
|
2011-12-12 17:29:32 +01:00
|
|
|
m_layout->addWidget(new QLabel(type), row, column++);
|
2011-11-07 20:07:14 +01:00
|
|
|
for (int i = -1; i != typeFormats.size(); ++i) {
|
|
|
|
|
QRadioButton *choice = new QRadioButton(this);
|
2011-12-13 16:17:43 +01:00
|
|
|
choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset") : typeFormats.at(i));
|
2011-12-12 17:29:32 +01:00
|
|
|
m_layout->addWidget(choice, row, column++);
|
2011-11-07 20:07:14 +01:00
|
|
|
if (i == current)
|
|
|
|
|
choice->setChecked(true);
|
|
|
|
|
group->addButton(choice, i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private:
|
2011-12-12 17:29:32 +01:00
|
|
|
QGridLayout *m_layout;
|
2011-11-07 20:07:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TypeFormatsDialogUi
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TypeFormatsDialogUi(TypeFormatsDialog *q)
|
|
|
|
|
{
|
|
|
|
|
tabs = new QTabWidget(q);
|
|
|
|
|
|
|
|
|
|
buttonBox = new QDialogButtonBox(q);
|
|
|
|
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(q);
|
2011-11-07 20:07:14 +01:00
|
|
|
layout->addWidget(tabs);
|
|
|
|
|
layout->addWidget(buttonBox);
|
|
|
|
|
q->setLayout(layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addPage(const QString &name)
|
|
|
|
|
{
|
|
|
|
|
TypeFormatsDialogPage *page = new TypeFormatsDialogPage;
|
|
|
|
|
pages.append(page);
|
|
|
|
|
QScrollArea *scroller = new QScrollArea;
|
|
|
|
|
scroller->setWidgetResizable(true);
|
|
|
|
|
scroller->setWidget(page);
|
|
|
|
|
scroller->setFrameStyle(QFrame::NoFrame);
|
|
|
|
|
tabs->addTab(scroller, name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QList<TypeFormatsDialogPage *> pages;
|
2012-06-28 13:30:09 +02:00
|
|
|
QDialogButtonBox *buttonBox;
|
2011-11-07 20:07:14 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QTabWidget *tabs;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// TypeFormatsDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TypeFormatsDialog::TypeFormatsDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent), m_ui(new TypeFormatsDialogUi(this))
|
|
|
|
|
{
|
2011-12-12 17:29:32 +01:00
|
|
|
setWindowTitle(tr("Type Formats"));
|
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2011-11-07 20:07:14 +01:00
|
|
|
m_ui->addPage(tr("Qt Types"));
|
|
|
|
|
m_ui->addPage(tr("Standard Types"));
|
|
|
|
|
m_ui->addPage(tr("Misc Types"));
|
|
|
|
|
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TypeFormatsDialog::~TypeFormatsDialog()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TypeFormatsDialog::addTypeFormats(const QString &type0,
|
|
|
|
|
const QStringList &typeFormats, int current)
|
|
|
|
|
{
|
|
|
|
|
QString type = type0;
|
2011-12-21 14:02:52 +01:00
|
|
|
type.replace(QLatin1String("__"), QLatin1String("::"));
|
2011-11-07 20:07:14 +01:00
|
|
|
int pos = 2;
|
|
|
|
|
if (type.startsWith(QLatin1Char('Q')))
|
|
|
|
|
pos = 0;
|
|
|
|
|
else if (type.startsWith(QLatin1String("std::")))
|
|
|
|
|
pos = 1;
|
|
|
|
|
m_ui->pages[pos]->addTypeFormats(type, typeFormats, current);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TypeFormats TypeFormatsDialog::typeFormats() const
|
|
|
|
|
{
|
|
|
|
|
return TypeFormats();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|