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
|
|
|
**
|
2012-07-19 12:26:56 +02:00
|
|
|
** Contact: http://www.qt-project.org/
|
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.
|
|
|
|
|
**
|
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"
|
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-07-15 21:45:29 +03:00
|
|
|
#include <projectexplorer/profilechooser.h>
|
2012-06-26 15:25:49 +02:00
|
|
|
#include <projectexplorer/profileinformation.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 <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>
|
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-07-18 16:20:19 +02:00
|
|
|
using namespace Core;
|
2012-06-26 15:25:49 +02:00
|
|
|
using namespace ProjectExplorer;
|
2010-09-16 12:28:50 +02:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2012-08-08 13:09:31 +02:00
|
|
|
// StartApplicationDialogPrivate
|
2009-05-07 09:35:11 +02:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
class StartApplicationDialogPrivate
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2012-08-08 13:09:31 +02:00
|
|
|
ProfileChooser *profileChooser;
|
|
|
|
|
PathChooser *localExecutablePathChooser;
|
|
|
|
|
QLineEdit *arguments;
|
|
|
|
|
PathChooser *workingDirectory;
|
|
|
|
|
QCheckBox *breakAtMainCheckBox;
|
|
|
|
|
QCheckBox *runInTerminalCheckBox;
|
|
|
|
|
PathChooser *debuginfoPathChooser;
|
|
|
|
|
QLabel *serverStartScriptLabel;
|
|
|
|
|
PathChooser *serverStartScriptPathChooser;
|
|
|
|
|
QComboBox *historyComboBox;
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
2012-02-06 15:15:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::StartApplicationParameters)
|
2012-02-06 15:15:57 +01:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// StartApplicationParameters
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
2012-02-06 15:15:57 +01:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
class StartApplicationParameters
|
2012-06-28 13:30:09 +02:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
public:
|
|
|
|
|
StartApplicationParameters();
|
|
|
|
|
QString displayName() const;
|
|
|
|
|
bool equals(const StartApplicationParameters &rhs) const;
|
|
|
|
|
void toSettings(QSettings *) const;
|
|
|
|
|
void fromSettings(const QSettings *settings);
|
2012-02-06 15:15:57 +01:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
bool operator==(const StartApplicationParameters &p) const { return equals(p); }
|
|
|
|
|
bool operator!=(const StartApplicationParameters &p) const { return !equals(p); }
|
|
|
|
|
|
|
|
|
|
Id profileId;
|
|
|
|
|
QString localExecutable;
|
|
|
|
|
QString processArgs;
|
|
|
|
|
QString workingDirectory;
|
|
|
|
|
bool breakAtMain;
|
|
|
|
|
bool runInTerminal;
|
|
|
|
|
QString serverStartScript;
|
|
|
|
|
QString debugInfoLocation;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StartApplicationParameters::StartApplicationParameters() :
|
2012-08-14 10:16:53 +02:00
|
|
|
breakAtMain(false), runInTerminal(false)
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) const
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
return localExecutable == rhs.localExecutable
|
|
|
|
|
&& processArgs == rhs.processArgs
|
|
|
|
|
&& workingDirectory == rhs.workingDirectory
|
|
|
|
|
&& breakAtMain == rhs.breakAtMain
|
|
|
|
|
&& runInTerminal == rhs.runInTerminal
|
|
|
|
|
&& serverStartScript == rhs.serverStartScript
|
|
|
|
|
&& profileId == rhs.profileId
|
|
|
|
|
&& debugInfoLocation == rhs.debugInfoLocation;
|
2012-02-06 15:15:57 +01:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
QString StartApplicationParameters::displayName() const
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
const int maxLength = 60;
|
2012-02-06 15:15:57 +01:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
QString name = QFileInfo(localExecutable).fileName() + QLatin1Char(' ') + processArgs;
|
|
|
|
|
if (name.size() > 60) {
|
2012-02-06 15:15:57 +01:00
|
|
|
int index = name.lastIndexOf(QLatin1Char(' '), maxLength);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
index = maxLength;
|
|
|
|
|
name.truncate(index);
|
|
|
|
|
name += QLatin1String("...");
|
|
|
|
|
}
|
2012-08-08 13:09:31 +02:00
|
|
|
|
|
|
|
|
if (Profile *profile = ProfileManager::instance()->find(profileId))
|
|
|
|
|
name += QString::fromLatin1(" (%1)").arg(profile->displayName());
|
|
|
|
|
|
2012-02-06 15:15:57 +01:00
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
void StartApplicationParameters::toSettings(QSettings *settings) const
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
settings->setValue(_("LastProfileId"), profileId.toString());
|
|
|
|
|
settings->setValue(_("LastExternalExecutable"), localExecutable);
|
|
|
|
|
settings->setValue(_("LastExternalExecutableArguments"), processArgs);
|
2012-02-06 15:15:57 +01:00
|
|
|
settings->setValue(_("LastExternalWorkingDirectory"), workingDirectory);
|
|
|
|
|
settings->setValue(_("LastExternalBreakAtMain"), breakAtMain);
|
|
|
|
|
settings->setValue(_("LastExternalRunInTerminal"), runInTerminal);
|
2012-08-08 13:09:31 +02:00
|
|
|
settings->setValue(_("LastServerStartScript"), serverStartScript);
|
|
|
|
|
settings->setValue(_("LastDebugInfoLocation"), debugInfoLocation);
|
2012-02-06 15:15:57 +01:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
void StartApplicationParameters::fromSettings(const QSettings *settings)
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
const QString profileIdString = settings->value(_("LastProfileId")).toString();
|
|
|
|
|
profileId = profileIdString.isEmpty() ? Id() : Id(profileIdString);
|
|
|
|
|
localExecutable = settings->value(_("LastExternalExecutable")).toString();
|
|
|
|
|
processArgs = settings->value(_("LastExternalExecutableArguments")).toString();
|
2012-02-06 15:15:57 +01:00
|
|
|
workingDirectory = settings->value(_("LastExternalWorkingDirectory")).toString();
|
|
|
|
|
breakAtMain = settings->value(_("LastExternalBreakAtMain")).toBool();
|
|
|
|
|
runInTerminal = settings->value(_("LastExternalRunInTerminal")).toBool();
|
2012-08-08 13:09:31 +02:00
|
|
|
serverStartScript = settings->value(_("LastServerStartScript")).toString();
|
|
|
|
|
debugInfoLocation = settings->value(_("LastDebugInfoLocation")).toString();
|
2012-02-06 15:15:57 +01:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// StartApplicationDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
StartApplicationDialog::StartApplicationDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent), d(new StartApplicationDialogPrivate)
|
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"));
|
|
|
|
|
|
2012-07-18 16:20:19 +02:00
|
|
|
QSettings *settings = ICore::settings();
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
d->localExecutablePathChooser = new PathChooser(this);
|
|
|
|
|
d->localExecutablePathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable"));
|
|
|
|
|
d->localExecutablePathChooser->lineEdit()->setCompleter(
|
|
|
|
|
new HistoryCompleter(settings, d->localExecutablePathChooser->lineEdit()));
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
d->arguments = new QLineEdit(this);
|
|
|
|
|
d->arguments->setCompleter(new HistoryCompleter(settings, d->arguments));
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2012-07-18 16:20:19 +02:00
|
|
|
d->workingDirectory = new PathChooser(this);
|
2012-06-28 13:30:09 +02:00
|
|
|
d->workingDirectory->setExpectedKind(PathChooser::ExistingDirectory);
|
|
|
|
|
d->workingDirectory->setPromptDialogTitle(tr("Select Working Directory"));
|
|
|
|
|
d->workingDirectory->lineEdit()->setCompleter(
|
|
|
|
|
new HistoryCompleter(settings, d->workingDirectory->lineEdit()));
|
|
|
|
|
|
|
|
|
|
d->runInTerminalCheckBox = new QCheckBox(this);
|
|
|
|
|
|
2012-07-24 16:41:15 +02:00
|
|
|
d->profileChooser = new ProfileChooser(this, ProfileChooser::LocalDebugging);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
d->breakAtMainCheckBox = new QCheckBox(this);
|
|
|
|
|
d->breakAtMainCheckBox->setText(QString());
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
d->serverStartScriptPathChooser = new PathChooser(this);
|
|
|
|
|
d->serverStartScriptPathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
d->serverStartScriptPathChooser->setPromptDialogTitle(tr("Select Server Start Script"));
|
2012-08-14 10:16:53 +02:00
|
|
|
d->serverStartScriptPathChooser->setToolTip(tr(
|
|
|
|
|
"This option can be used to point to a script that will be used "
|
|
|
|
|
"to start a debug server. If the field is empty, Qt Creator's "
|
|
|
|
|
"default methods to set up debug servers will be used."));
|
2012-08-08 13:09:31 +02:00
|
|
|
d->serverStartScriptLabel = new QLabel(tr("&Server start script:"), this);
|
|
|
|
|
d->serverStartScriptLabel->setBuddy(d->serverStartScriptPathChooser);
|
2012-08-14 10:16:53 +02:00
|
|
|
d->serverStartScriptLabel->setToolTip(d->serverStartScriptPathChooser->toolTip());
|
|
|
|
|
|
|
|
|
|
d->debuginfoPathChooser = new PathChooser(this);
|
|
|
|
|
d->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information"));
|
|
|
|
|
d->debuginfoPathChooser->setToolTip(tr(
|
|
|
|
|
"Base path for external debug information and debug sources."
|
|
|
|
|
"If empty, $SYSROOT/usr/lib/debug will be chosen."));
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
QFrame *line = new QFrame(this);
|
|
|
|
|
line->setFrameShape(QFrame::HLine);
|
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
QFrame *line2 = new QFrame(this);
|
|
|
|
|
line2->setFrameShape(QFrame::HLine);
|
|
|
|
|
line2->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
d->historyComboBox = new QComboBox(this);
|
|
|
|
|
|
2012-06-28 13:30:09 +02:00
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
|
|
|
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
2012-08-08 13:09:31 +02:00
|
|
|
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
2012-07-24 12:29:26 +02:00
|
|
|
formLayout->addRow(tr("&Target:"), d->profileChooser);
|
2012-08-08 13:09:31 +02:00
|
|
|
formLayout->addRow(tr("Local &executable:"), d->localExecutablePathChooser);
|
|
|
|
|
formLayout->addRow(tr("Command line &arguments:"), d->arguments);
|
|
|
|
|
formLayout->addRow(tr("&Working directory:"), d->workingDirectory);
|
|
|
|
|
formLayout->addRow(tr("Run in &terminal:"), d->runInTerminalCheckBox);
|
2012-07-24 12:29:26 +02:00
|
|
|
formLayout->addRow(tr("Break at \"&main\":"), d->breakAtMainCheckBox);
|
2012-08-08 13:09:31 +02:00
|
|
|
formLayout->addRow(d->serverStartScriptLabel, d->serverStartScriptPathChooser);
|
2012-08-14 10:16:53 +02:00
|
|
|
formLayout->addRow(tr("Debug &information:"), d->debuginfoPathChooser);
|
2012-08-08 13:09:31 +02:00
|
|
|
formLayout->addRow(line2);
|
2012-08-14 10:16:53 +02:00
|
|
|
formLayout->addRow(tr("&Recent:"), d->historyComboBox);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
|
|
|
|
verticalLayout->addLayout(formLayout);
|
2012-08-14 10:16:53 +02:00
|
|
|
verticalLayout->addStretch();
|
|
|
|
|
verticalLayout->addRow(line);
|
2012-06-28 13:30:09 +02:00
|
|
|
verticalLayout->addWidget(d->buttonBox);
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
connect(d->localExecutablePathChooser, SIGNAL(changed(QString)), 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)),
|
|
|
|
|
SLOT(historyIndexChanged(int)));
|
2009-05-07 09:35:11 +02:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
updateState();
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
StartApplicationDialog::~StartApplicationDialog()
|
2009-05-07 09:35:11 +02:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
delete d;
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
void StartApplicationDialog::setHistory(const QList<StartApplicationParameters> &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; ) {
|
2012-08-08 13:09:31 +02:00
|
|
|
const StartApplicationParameters &p = l.at(i);
|
|
|
|
|
if (!p.localExecutable.isEmpty())
|
2012-06-28 13:30:09 +02:00
|
|
|
d->historyComboBox->addItem(p.displayName(), QVariant::fromValue(p));
|
|
|
|
|
}
|
2010-05-12 11:48:00 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-14 10:16:53 +02:00
|
|
|
void StartApplicationDialog::hideStartScript()
|
2011-05-04 09:21:18 +02:00
|
|
|
{
|
2012-08-14 10:16:53 +02:00
|
|
|
d->serverStartScriptPathChooser->setVisible(false);
|
|
|
|
|
d->serverStartScriptLabel->setVisible(false);
|
2011-05-04 09:21:18 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
void StartApplicationDialog::historyIndexChanged(int index)
|
2011-05-04 09:21:18 +02:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
if (index < 0)
|
|
|
|
|
return;
|
|
|
|
|
const QVariant v = d->historyComboBox->itemData(index);
|
|
|
|
|
QTC_ASSERT(v.canConvert<StartApplicationParameters>(), return);
|
|
|
|
|
setParameters(v.value<StartApplicationParameters>());
|
2011-05-04 09:21:18 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
Id StartApplicationDialog::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
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
void StartApplicationDialog::updateState()
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
bool okEnabled = d->localExecutablePathChooser->isValid();
|
|
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(okEnabled);
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerStartParameters *sp)
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
const QString settingsGroup = QLatin1String("DebugMode");
|
|
|
|
|
const QString arrayName = QLatin1String("StartApplication");
|
2011-02-24 16:50:15 +01:00
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
QList<StartApplicationParameters> history;
|
2012-02-06 15:15:57 +01:00
|
|
|
settings->beginGroup(settingsGroup);
|
2012-08-08 13:09:31 +02:00
|
|
|
if (const int arraySize = settings->beginReadArray(arrayName)) {
|
|
|
|
|
for (int i = 0; i < arraySize; ++i) {
|
|
|
|
|
settings->setArrayIndex(i);
|
|
|
|
|
StartApplicationParameters p;
|
|
|
|
|
p.fromSettings(settings);
|
|
|
|
|
history.append(p);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
history.append(StartApplicationParameters());
|
2012-02-06 15:15:57 +01:00
|
|
|
}
|
|
|
|
|
settings->endArray();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
StartApplicationDialog dialog(parent);
|
2012-02-06 15:15:57 +01:00
|
|
|
dialog.setHistory(history);
|
|
|
|
|
dialog.setParameters(history.back());
|
2012-08-14 10:16:53 +02:00
|
|
|
if (sp->startMode == AttachToRemoteServer)
|
|
|
|
|
dialog.hideStartScript();
|
2012-02-06 15:15:57 +01:00
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
|
return false;
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
const StartApplicationParameters newParameters = dialog.parameters();
|
2012-02-06 15:15:57 +01:00
|
|
|
if (newParameters != history.back()) {
|
2012-08-08 13:09:31 +02:00
|
|
|
history.append(newParameters);
|
|
|
|
|
while (history.size() > 10)
|
|
|
|
|
history.takeFirst();
|
|
|
|
|
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();
|
2012-02-06 15:15:57 +01:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
Profile *profile = dialog.d->profileChooser->currentProfile();
|
|
|
|
|
fillParameters(sp, profile->id());
|
|
|
|
|
|
|
|
|
|
sp->executable = newParameters.localExecutable;
|
|
|
|
|
sp->displayName = newParameters.displayName();
|
2012-02-06 15:15:57 +01:00
|
|
|
sp->workingDirectory = newParameters.workingDirectory;
|
|
|
|
|
sp->useTerminal = newParameters.runInTerminal;
|
2012-08-08 13:09:31 +02:00
|
|
|
if (!newParameters.processArgs.isEmpty())
|
|
|
|
|
sp->processArgs = newParameters.processArgs;
|
2012-02-06 15:15:57 +01:00
|
|
|
sp->breakOnMain = newParameters.breakAtMain;
|
|
|
|
|
sp->serverStartScript = newParameters.serverStartScript;
|
|
|
|
|
sp->debugInfoLocation = newParameters.debugInfoLocation;
|
2012-08-08 13:09:31 +02:00
|
|
|
|
|
|
|
|
bool isLocal = DeviceProfileInformation::device(profile)->type()
|
|
|
|
|
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
|
|
|
|
sp->startMode = isLocal ? StartExternal : StartRemoteProcess;
|
2012-02-06 15:15:57 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
StartApplicationParameters StartApplicationDialog::parameters() const
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
StartApplicationParameters result;
|
|
|
|
|
result.localExecutable = d->localExecutablePathChooser->path();
|
2012-06-28 13:30:09 +02:00
|
|
|
result.serverStartScript = d->serverStartScriptPathChooser->path();
|
|
|
|
|
result.profileId = d->profileChooser->currentProfileId();
|
|
|
|
|
result.debugInfoLocation = d->debuginfoPathChooser->path();
|
2012-08-08 13:09:31 +02:00
|
|
|
result.processArgs = d->arguments->text();
|
|
|
|
|
result.workingDirectory = d->workingDirectory->path();
|
|
|
|
|
result.breakAtMain = d->breakAtMainCheckBox->isChecked();
|
|
|
|
|
result.runInTerminal = d->runInTerminalCheckBox->isChecked();
|
2012-02-06 15:15:57 +01:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-08 13:09:31 +02:00
|
|
|
void StartApplicationDialog::setParameters(const StartApplicationParameters &p)
|
2012-02-06 15:15:57 +01:00
|
|
|
{
|
2012-08-08 13:09:31 +02:00
|
|
|
d->profileChooser->setCurrentProfileId(p.profileId);
|
|
|
|
|
d->localExecutablePathChooser->setPath(p.localExecutable);
|
2012-06-28 13:30:09 +02:00
|
|
|
d->serverStartScriptPathChooser->setPath(p.serverStartScript);
|
|
|
|
|
d->debuginfoPathChooser->setPath(p.debugInfoLocation);
|
2012-08-08 13:09:31 +02:00
|
|
|
d->arguments->setText(p.processArgs);
|
|
|
|
|
d->workingDirectory->setPath(p.workingDirectory);
|
|
|
|
|
d->runInTerminalCheckBox->setChecked(p.runInTerminal);
|
|
|
|
|
d->breakAtMainCheckBox->setChecked(p.breakAtMain);
|
|
|
|
|
updateState();
|
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:
|
|
|
|
|
QLineEdit *hostLineEdit;
|
|
|
|
|
QSpinBox *portSpinBox;
|
2012-07-15 21:45:29 +03:00
|
|
|
ProfileChooser *profileChooser;
|
2012-06-28 10:00:04 +02:00
|
|
|
};
|
|
|
|
|
|
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-07-24 16:41:15 +02:00
|
|
|
d->profileChooser = new ProfileChooser(this, ProfileChooser::RemoteDebugging);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
2012-06-28 10:00:04 +02:00
|
|
|
d->hostLineEdit = new QLineEdit(this);
|
|
|
|
|
d->hostLineEdit->setText(QString::fromUtf8("localhost"));
|
|
|
|
|
|
|
|
|
|
d->portSpinBox = new QSpinBox(this);
|
|
|
|
|
d->portSpinBox->setMaximum(65535);
|
|
|
|
|
d->portSpinBox->setValue(3768);
|
|
|
|
|
|
|
|
|
|
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-07-24 12:29:26 +02:00
|
|
|
formLayout->addRow(tr("Target:"), d->profileChooser);
|
|
|
|
|
formLayout->addRow(tr("&Host:"), d->hostLineEdit);
|
|
|
|
|
formLayout->addRow(tr("&Port:"), d->portSpinBox);
|
2012-06-28 10:00:04 +02:00
|
|
|
|
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-07-18 16:20:19 +02:00
|
|
|
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-07-18 16:20:19 +02:00
|
|
|
void AttachToQmlPortDialog::setProfileId(const 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> "
|
2012-08-06 13:45:34 +02:00
|
|
|
"to use TCP/IP as communication protocol.</p><p>Enter the connection parameters as:</p>"
|
2010-11-19 16:13:22 +01:00
|
|
|
"<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:
|
|
|
|
|
QLineEdit *host;
|
|
|
|
|
QLineEdit *username;
|
|
|
|
|
QLineEdit *password;
|
|
|
|
|
QLineEdit *enginePath;
|
|
|
|
|
QLineEdit *inferiorPath;
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent), d(new StartRemoteEngineDialogPrivate)
|
2010-12-01 15:41:08 +01:00
|
|
|
{
|
2012-07-18 16:20:19 +02:00
|
|
|
QSettings *settings = 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->username = new QLineEdit(this);
|
|
|
|
|
d->username->setCompleter(new HistoryCompleter(settings, d->username));
|
|
|
|
|
|
|
|
|
|
d->password = new QLineEdit(this);
|
|
|
|
|
d->password->setEchoMode(QLineEdit::Password);
|
|
|
|
|
|
|
|
|
|
d->enginePath = new QLineEdit(this);
|
|
|
|
|
d->enginePath->setCompleter(new HistoryCompleter(settings, d->enginePath));
|
|
|
|
|
|
|
|
|
|
d->inferiorPath = new QLineEdit(this);
|
|
|
|
|
d->inferiorPath->setCompleter(new HistoryCompleter(settings, d->inferiorPath));
|
|
|
|
|
|
|
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout();
|
2012-07-24 12:29:26 +02:00
|
|
|
formLayout->addRow(tr("&Host:"), d->host);
|
2012-07-27 15:43:00 +02:00
|
|
|
formLayout->addRow(tr("&Username:"), d->username);
|
2012-07-24 12:29:26 +02:00
|
|
|
formLayout->addRow(tr("&Password:"), d->password);
|
|
|
|
|
formLayout->addRow(tr("&Engine path:"), d->enginePath);
|
|
|
|
|
formLayout->addRow(tr("&Inferior path:"), d->inferiorPath);
|
2012-06-28 13:30:09 +02:00
|
|
|
|
|
|
|
|
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
|