forked from qt-creator/qt-creator
Debugger: Some code modernization
Qt 5 signal/slot, a few auto. Change-Id: Ia17f1b3dcd41dfe0a373c14e7c1d34d210d084f1 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -282,11 +282,11 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
|
||||
"If empty, $SYSROOT/usr/lib/debug will be chosen."));
|
||||
d->debuginfoPathChooser->setHistoryCompleter(QLatin1String("Debugger.DebugLocation.History"));
|
||||
|
||||
QFrame *line = new QFrame(this);
|
||||
auto line = new QFrame(this);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
QFrame *line2 = new QFrame(this);
|
||||
auto line2 = new QFrame(this);
|
||||
line2->setFrameShape(QFrame::HLine);
|
||||
line2->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
@@ -296,7 +296,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
|
||||
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout();
|
||||
auto formLayout = new QFormLayout();
|
||||
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
formLayout->addRow(tr("&Kit:"), d->kitChooser);
|
||||
formLayout->addRow(d->serverPortLabel, d->serverPortSpinBox);
|
||||
@@ -311,17 +311,18 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
|
||||
formLayout->addRow(line2);
|
||||
formLayout->addRow(tr("&Recent:"), d->historyComboBox);
|
||||
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
||||
auto verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->addLayout(formLayout);
|
||||
verticalLayout->addStretch();
|
||||
verticalLayout->addWidget(line);
|
||||
verticalLayout->addWidget(d->buttonBox);
|
||||
|
||||
connect(d->localExecutablePathChooser, SIGNAL(changed(QString)), SLOT(updateState()));
|
||||
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
||||
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
connect(d->historyComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
SLOT(historyIndexChanged(int)));
|
||||
connect(d->localExecutablePathChooser, &PathChooser::changed,
|
||||
this, &StartApplicationDialog::updateState);
|
||||
connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
connect(d->historyComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &StartApplicationDialog::historyIndexChanged);
|
||||
|
||||
updateState();
|
||||
}
|
||||
@@ -493,20 +494,20 @@ AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
|
||||
d->portSpinBox->setMaximum(65535);
|
||||
d->portSpinBox->setValue(3768);
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
|
||||
auto buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout();
|
||||
auto formLayout = new QFormLayout();
|
||||
formLayout->addRow(tr("Kit:"), d->kitChooser);
|
||||
formLayout->addRow(tr("&Port:"), d->portSpinBox);
|
||||
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
||||
auto verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->addLayout(formLayout);
|
||||
verticalLayout->addWidget(buttonBox);
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
AttachToQmlPortDialog::~AttachToQmlPortDialog()
|
||||
@@ -567,34 +568,38 @@ StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) :
|
||||
setWindowTitle(tr("Start a CDB Remote Session"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox;
|
||||
auto groupBox = new QGroupBox;
|
||||
|
||||
QLabel *helpLabel = new QLabel(cdbRemoteHelp());
|
||||
auto helpLabel = new QLabel(cdbRemoteHelp());
|
||||
helpLabel->setWordWrap(true);
|
||||
helpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
|
||||
QLabel *label = new QLabel(tr("&Connection:"));
|
||||
auto label = new QLabel(tr("&Connection:"));
|
||||
label->setBuddy(m_lineEdit);
|
||||
m_lineEdit->setMinimumWidth(400);
|
||||
|
||||
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
auto box = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
auto formLayout = new QFormLayout;
|
||||
formLayout->addRow(helpLabel);
|
||||
formLayout->addRow(label, m_lineEdit);
|
||||
groupBox->setLayout(formLayout);
|
||||
|
||||
QVBoxLayout *vLayout = new QVBoxLayout(this);
|
||||
auto vLayout = new QVBoxLayout(this);
|
||||
vLayout->addWidget(groupBox);
|
||||
vLayout->addWidget(box);
|
||||
|
||||
m_okButton = box->button(QDialogButtonBox::Ok);
|
||||
m_okButton->setEnabled(false);
|
||||
|
||||
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
|
||||
connect(m_lineEdit, SIGNAL(returnPressed()), m_okButton, SLOT(animateClick()));
|
||||
connect(box, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(box, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(m_lineEdit, &QLineEdit::textChanged,
|
||||
this, &StartRemoteCdbDialog::textChanged);
|
||||
connect(m_lineEdit, &QLineEdit::returnPressed,
|
||||
[this] { m_okButton->animateClick(); });
|
||||
connect(box, &QDialogButtonBox::accepted,
|
||||
this, &StartRemoteCdbDialog::accept);
|
||||
connect(box, &QDialogButtonBox::rejected,
|
||||
this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void StartRemoteCdbDialog::accept()
|
||||
@@ -636,18 +641,20 @@ AddressDialog::AddressDialog(QWidget *parent) :
|
||||
{
|
||||
setWindowTitle(tr("Select Start Address"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||
|
||||
auto hLayout = new QHBoxLayout;
|
||||
hLayout->addWidget(new QLabel(tr("Enter an address:") + QLatin1Char(' ')));
|
||||
hLayout->addWidget(m_lineEdit);
|
||||
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||
|
||||
auto 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()));
|
||||
connect(m_box, &QDialogButtonBox::accepted, this, &AddressDialog::accept);
|
||||
connect(m_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
connect(m_lineEdit, &QLineEdit::returnPressed, this, &AddressDialog::accept);
|
||||
connect(m_lineEdit, &QLineEdit::textChanged, this, &AddressDialog::textChanged);
|
||||
|
||||
setOkButtonEnabled(false);
|
||||
}
|
||||
@@ -732,20 +739,20 @@ StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent)
|
||||
d->buttonBox = new QDialogButtonBox(this);
|
||||
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout();
|
||||
auto formLayout = new QFormLayout();
|
||||
formLayout->addRow(tr("&Host:"), d->host);
|
||||
formLayout->addRow(tr("&Username:"), d->username);
|
||||
formLayout->addRow(tr("&Password:"), d->password);
|
||||
formLayout->addRow(tr("&Engine path:"), d->enginePath);
|
||||
formLayout->addRow(tr("&Inferior path:"), d->inferiorPath);
|
||||
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
||||
auto 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()));
|
||||
connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
StartRemoteEngineDialog::~StartRemoteEngineDialog()
|
||||
|
||||
Reference in New Issue
Block a user