diff options
author | hjk <[email protected]> | 2015-02-12 13:50:54 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2015-02-12 15:14:55 +0000 |
commit | f1c5889e7753a4eea6f6dd4e9d94b5a25bf0e964 (patch) | |
tree | 2be3e96f3f6a4d52e093e389d27dc4a97ed24849 /src | |
parent | 0eabe627864137220087cf4a25f79a57b21b5f54 (diff) |
Debugger: Some code modernization
Qt 5 signal/slot, a few auto.
Change-Id: Ia17f1b3dcd41dfe0a373c14e7c1d34d210d084f1
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/debugger/breakwindow.cpp | 33 | ||||
-rw-r--r-- | src/plugins/debugger/cdb/cdbengine.cpp | 25 | ||||
-rw-r--r-- | src/plugins/debugger/commonoptionspage.cpp | 4 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerdialogs.cpp | 75 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerengine.cpp | 10 | ||||
-rw-r--r-- | src/plugins/debugger/debuggermainwindow.cpp | 28 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 2 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerrunconfigurationaspect.cpp | 26 | ||||
-rw-r--r-- | src/plugins/debugger/debuggersourcepathmappingwidget.cpp | 35 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.cpp | 21 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.h | 3 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdbplainengine.cpp | 4 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/remotegdbserveradapter.cpp | 19 | ||||
-rw-r--r-- | src/plugins/debugger/imageviewer.cpp | 4 | ||||
-rw-r--r-- | src/plugins/debugger/logwindow.cpp | 46 |
15 files changed, 177 insertions, 158 deletions
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 871c27957c9..2bd6ad87f13 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -144,7 +144,7 @@ BreakpointDialog::BreakpointDialog(Breakpoint b, QWidget *parent) { setWindowTitle(tr("Edit Breakpoint Properties")); - QGroupBox *groupBoxBasic = new QGroupBox(tr("Basic"), this); + auto groupBoxBasic = new QGroupBox(tr("Basic"), this); // Match BreakpointType (omitting unknown type). QStringList types; @@ -195,7 +195,7 @@ BreakpointDialog::BreakpointDialog(Breakpoint b, QWidget *parent) m_labelFunction = new QLabel(tr("Fun&ction:"), groupBoxBasic); m_labelFunction->setBuddy(m_lineEditFunction); - QGroupBox *groupBoxAdvanced = new QGroupBox(tr("Advanced"), this); + auto groupBoxAdvanced = new QGroupBox(tr("Advanced"), this); m_checkBoxTracepoint = new QCheckBox(groupBoxAdvanced); m_labelTracepoint = new QLabel(tr("T&racepoint only:"), groupBoxAdvanced); @@ -279,7 +279,7 @@ BreakpointDialog::BreakpointDialog(Breakpoint b, QWidget *parent) } } - QFormLayout *basicLayout = new QFormLayout(groupBoxBasic); + auto basicLayout = new QFormLayout(groupBoxBasic); basicLayout->addRow(m_labelType, m_comboBoxType); basicLayout->addRow(m_labelFileName, m_pathChooserFileName); basicLayout->addRow(m_labelLineNumber, m_lineEditLineNumber); @@ -289,7 +289,7 @@ BreakpointDialog::BreakpointDialog(Breakpoint b, QWidget *parent) basicLayout->addRow(m_labelFunction, m_lineEditFunction); basicLayout->addRow(m_labelOneShot, m_checkBoxOneShot); - QFormLayout *advancedLeftLayout = new QFormLayout(); + auto advancedLeftLayout = new QFormLayout(); advancedLeftLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); advancedLeftLayout->addRow(m_labelCondition, m_lineEditCondition); advancedLeftLayout->addRow(m_labelIgnoreCount, m_spinBoxIgnoreCount); @@ -297,18 +297,18 @@ BreakpointDialog::BreakpointDialog(Breakpoint b, QWidget *parent) advancedLeftLayout->addRow(m_labelUseFullPath, m_comboBoxPathUsage); advancedLeftLayout->addRow(m_labelModule, m_lineEditModule); - QFormLayout *advancedRightLayout = new QFormLayout(); + auto advancedRightLayout = new QFormLayout(); advancedRightLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); advancedRightLayout->addRow(m_labelCommands, m_textEditCommands); advancedRightLayout->addRow(m_labelTracepoint, m_checkBoxTracepoint); advancedRightLayout->addRow(m_labelMessage, m_lineEditMessage); - QHBoxLayout *horizontalLayout = new QHBoxLayout(groupBoxAdvanced); + auto horizontalLayout = new QHBoxLayout(groupBoxAdvanced); horizontalLayout->addLayout(advancedLeftLayout); horizontalLayout->addSpacing(15); horizontalLayout->addLayout(advancedRightLayout); - QVBoxLayout *verticalLayout = new QVBoxLayout(this); + auto verticalLayout = new QVBoxLayout(this); verticalLayout->addWidget(groupBoxBasic); verticalLayout->addSpacing(10); verticalLayout->addWidget(groupBoxAdvanced); @@ -316,9 +316,10 @@ BreakpointDialog::BreakpointDialog(Breakpoint b, QWidget *parent) verticalLayout->addWidget(m_buttonBox); verticalLayout->setStretchFactor(groupBoxAdvanced, 10); - connect(m_comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int))); - connect(m_buttonBox, SIGNAL(accepted()), SLOT(accept())); - connect(m_buttonBox, SIGNAL(rejected()), SLOT(reject())); + connect(m_comboBoxType, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), + this, &BreakpointDialog::typeChanged); + connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } void BreakpointDialog::setType(BreakpointType type) @@ -654,18 +655,18 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) : m_buttonBox = new QDialogButtonBox(this); m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); - QFormLayout *formLayout = new QFormLayout; + auto formLayout = new QFormLayout; if (currentEngine()->hasCapability(BreakConditionCapability)) formLayout->addRow(tr("&Condition:"), m_lineEditCondition); formLayout->addRow(tr("&Ignore count:"), m_spinBoxIgnoreCount); formLayout->addRow(tr("&Thread specification:"), m_lineEditThreadSpec); - QVBoxLayout *verticalLayout = new QVBoxLayout(this); + auto verticalLayout = new QVBoxLayout(this); verticalLayout->addLayout(formLayout); verticalLayout->addWidget(m_buttonBox); - QObject::connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - QObject::connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } /////////////////////////////////////////////////////////////////////// @@ -678,8 +679,8 @@ BreakTreeView::BreakTreeView() { setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png"))); setSelectionMode(QAbstractItemView::ExtendedSelection); - connect(action(UseAddressInBreakpointsView), - SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool))); + connect(action(UseAddressInBreakpointsView), &QAction::toggled, + this, &BreakTreeView::showAddressColumn); } void BreakTreeView::showAddressColumn(bool on) diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 7898334f8eb..f8eea34371b 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -340,17 +340,22 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp) : m_watchPointY(0), m_ignoreCdbOutput(false) { - connect(action(OperateByInstruction), SIGNAL(triggered(bool)), - this, SLOT(operateByInstructionTriggered(bool))); - connect(action(VerboseLog), SIGNAL(triggered(bool)), - this, SLOT(verboseLogTriggered(bool))); - connect(action(CreateFullBacktrace), SIGNAL(triggered()), - this, SLOT(createFullBacktrace())); setObjectName(QLatin1String("CdbEngine")); - connect(&m_process, SIGNAL(finished(int)), this, SLOT(processFinished())); - connect(&m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError())); - connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOut())); - connect(&m_process, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardOut())); + + connect(action(OperateByInstruction), &QAction::triggered, + this, &CdbEngine::operateByInstructionTriggered); + connect(action(VerboseLog), &QAction::triggered, + this, &CdbEngine::verboseLogTriggered); + connect(action(CreateFullBacktrace), &QAction::triggered, + this, &CdbEngine::createFullBacktrace); + connect(&m_process, static_cast<void(QProcess::*)(int)>(&QProcess::finished), + this, &CdbEngine::processFinished); + connect(&m_process, static_cast<void(QProcess::*)(QProcess::ProcessError)>(&QProcess::error), + this, &CdbEngine::processError); + connect(&m_process, &QProcess::readyReadStandardOutput, + this, &CdbEngine::readyReadStandardOut); + connect(&m_process, &QProcess::readyReadStandardError, + this, &CdbEngine::readyReadStandardOut); } void CdbEngine::init() diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index b832ee49562..f4aa0696388 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -230,8 +230,8 @@ CommonOptionsPageWidget::CommonOptionsPageWidget Utils::SavedAction *registerAction = action(RegisterForPostMortem); m_group->insert(registerAction, checkBoxRegisterForPostMortem); - connect(registerAction, SIGNAL(toggled(bool)), - checkBoxRegisterForPostMortem, SLOT(setChecked(bool))); + connect(registerAction, &QAction::toggled, + checkBoxRegisterForPostMortem, &QAbstractButton::setChecked); } else { checkBoxRegisterForPostMortem->setVisible(false); } diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 02423157efe..00d5dca13d6 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -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() diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 2cfc00face6..84be81a46c3 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -177,10 +177,10 @@ public: m_memoryAgent(engine), m_isStateDebugging(false) { - connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation())); - connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)), - SLOT(reloadDisassembly())); - + connect(&m_locationTimer, &QTimer::timeout, + this, &DebuggerEnginePrivate::resetLocation); + connect(action(IntelFlavor), &Utils::SavedAction::valueChanged, + this, &DebuggerEnginePrivate::reloadDisassembly); connect(action(OperateNativeMixed), &QAction::triggered, engine, &DebuggerEngine::reloadFullStack); @@ -526,7 +526,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) d->m_progress.setProgressRange(0, 1000); FutureProgress *fp = ProgressManager::addTask(d->m_progress.future(), tr("Launching Debugger"), "Debugger.Launcher"); - connect(fp, SIGNAL(canceled()), this, SLOT(quitDebugger())); + connect(fp, &FutureProgress::canceled, this, &DebuggerEngine::quitDebugger); fp->setKeepOnFinish(FutureProgress::HideOnFinish); d->m_progress.reportStarted(); diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 27b17ef62de..ac815f9ebe7 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -299,8 +299,8 @@ void DebuggerMainWindowPrivate::createViewsMenuItems() QAction *openMemoryEditorAction = new QAction(this); openMemoryEditorAction->setText(tr("Memory...")); - connect(openMemoryEditorAction, SIGNAL(triggered()), - SLOT(openMemoryEditor())); + connect(openMemoryEditorAction, &QAction::triggered, + this, &DebuggerMainWindowPrivate::openMemoryEditor); // Add menu items Command *cmd = 0; @@ -440,17 +440,17 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) connect(autoHideTitleBarsAction(), SIGNAL(triggered()), d, SLOT(updateDockWidgetSettings())); - QBoxLayout *editorHolderLayout = new QVBoxLayout; + auto editorHolderLayout = new QVBoxLayout; editorHolderLayout->setMargin(0); editorHolderLayout->setSpacing(0); - QWidget *editorAndFindWidget = new QWidget; + auto editorAndFindWidget = new QWidget; editorAndFindWidget->setLayout(editorHolderLayout); auto editorManagerPlaceHolder = new EditorManagerPlaceHolder(mode); editorHolderLayout->addWidget(editorManagerPlaceHolder); editorHolderLayout->addWidget(new FindToolBarPlaceHolder(editorAndFindWidget)); - MiniSplitter *documentAndRightPane = new MiniSplitter; + auto documentAndRightPane = new MiniSplitter; documentAndRightPane->addWidget(editorAndFindWidget); documentAndRightPane->addWidget(new RightPanePlaceHolder(mode)); documentAndRightPane->setStretchFactor(0, 1); @@ -462,18 +462,18 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) hackyName.replace(QLatin1Char('&'), QString()); d->m_viewButton->setText(hackyName); - Utils::StyledBar *debugToolBar = new Utils::StyledBar; + auto debugToolBar = new Utils::StyledBar; debugToolBar->setProperty("topBorder", true); - QHBoxLayout *debugToolBarLayout = new QHBoxLayout(debugToolBar); + auto debugToolBarLayout = new QHBoxLayout(debugToolBar); debugToolBarLayout->setMargin(0); debugToolBarLayout->setSpacing(0); debugToolBarLayout->addWidget(d->m_debugToolBar); debugToolBarLayout->addWidget(new Utils::StyledSeparator); debugToolBarLayout->addWidget(d->m_viewButton); - connect(d->m_viewButton, SIGNAL(clicked()), this, SLOT(showViewsMenu())); + connect(d->m_viewButton, &QAbstractButton::clicked, this, &DebuggerMainWindow::showViewsMenu); - QDockWidget *dock = new QDockWidget(DebuggerMainWindowPrivate::tr("Debugger Toolbar")); + auto dock = new QDockWidget(DebuggerMainWindowPrivate::tr("Debugger Toolbar")); dock->setObjectName(QLatin1String("Debugger Toolbar")); dock->setWidget(debugToolBar); dock->setFeatures(QDockWidget::NoDockWidgetFeatures); @@ -483,10 +483,10 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) addDockWidget(Qt::BottomDockWidgetArea, dock); setToolBarDockWidget(dock); - QWidget *centralWidget = new QWidget; + auto centralWidget = new QWidget; setCentralWidget(centralWidget); - QVBoxLayout *centralLayout = new QVBoxLayout(centralWidget); + auto centralLayout = new QVBoxLayout(centralWidget); centralWidget->setLayout(centralLayout); centralLayout->setMargin(0); centralLayout->setSpacing(0); @@ -495,9 +495,9 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) centralLayout->setStretch(1, 0); // Right-side window with editor, output etc. - MiniSplitter *mainWindowSplitter = new MiniSplitter; + auto mainWindowSplitter = new MiniSplitter; mainWindowSplitter->addWidget(this); - QWidget *outputPane = new OutputPanePlaceHolder(mode, mainWindowSplitter); + auto outputPane = new OutputPanePlaceHolder(mode, mainWindowSplitter); outputPane->setObjectName(QLatin1String("DebuggerOutputPanePlaceHolder")); mainWindowSplitter->addWidget(outputPane); mainWindowSplitter->setStretchFactor(0, 10); @@ -505,7 +505,7 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) mainWindowSplitter->setOrientation(Qt::Vertical); // Navigation and right-side window. - MiniSplitter *splitter = new MiniSplitter; + auto splitter = new MiniSplitter; splitter->setFocusProxy(editorManagerPlaceHolder); splitter->addWidget(new NavigationWidgetPlaceHolder(mode)); splitter->addWidget(mainWindowSplitter); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 07c1cf502ba..7a2e0385b51 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -3398,7 +3398,7 @@ void DebuggerPluginPrivate::testProjectEvaluated() QVERIFY(!fileName.isEmpty()); qWarning("Project %s loaded", qPrintable(fileName)); connect(BuildManager::instance(), SIGNAL(buildQueueFinished(bool)), - SLOT(testProjectBuilt(bool))); + this, SLOT(testProjectBuilt(bool))); ProjectExplorerPlugin::buildProject(m_testProject); } diff --git a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp index 58572946dda..0b02b33cccb 100644 --- a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp +++ b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp @@ -122,18 +122,18 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(DebuggerRunConfigurationAspect connect(m_qmlDebuggerInfoLabel, SIGNAL(linkActivated(QString)), Core::HelpManager::instance(), SLOT(handleHelpRequest(QString))); - connect(m_useQmlDebugger, SIGNAL(toggled(bool)), - SLOT(useQmlDebuggerToggled(bool))); - connect(m_useQmlDebugger, SIGNAL(clicked(bool)), - SLOT(useQmlDebuggerClicked(bool))); - connect(m_useCppDebugger, SIGNAL(clicked(bool)), - SLOT(useCppDebuggerClicked(bool))); - connect(m_debugServerPort, SIGNAL(valueChanged(int)), - SLOT(qmlDebugServerPortChanged(int))); - connect(m_useMultiProcess, SIGNAL(toggled(bool)), - SLOT(useMultiProcessToggled(bool))); - - QHBoxLayout *qmlLayout = new QHBoxLayout; + connect(m_useQmlDebugger, &QAbstractButton::toggled, + this, &DebuggerRunConfigWidget::useQmlDebuggerToggled); + connect(m_useQmlDebugger, &QAbstractButton::clicked, + this, &DebuggerRunConfigWidget::useQmlDebuggerClicked); + connect(m_useCppDebugger, &QAbstractButton::clicked, + this, &DebuggerRunConfigWidget::useCppDebuggerClicked); + connect(m_debugServerPort, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), + this, &DebuggerRunConfigWidget::qmlDebugServerPortChanged); + connect(m_useMultiProcess, &QAbstractButton::toggled, + this, &DebuggerRunConfigWidget::useMultiProcessToggled); + + auto qmlLayout = new QHBoxLayout; qmlLayout->setMargin(0); qmlLayout->addWidget(m_useQmlDebugger); qmlLayout->addWidget(m_debugServerPortLabel); @@ -141,7 +141,7 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(DebuggerRunConfigurationAspect qmlLayout->addWidget(m_qmlDebuggerInfoLabel); qmlLayout->addStretch(); - QVBoxLayout *layout = new QVBoxLayout; + auto layout = new QVBoxLayout; layout->setMargin(0); layout->addWidget(m_useCppDebugger); layout->addLayout(qmlLayout); diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp index 8fcb4a4567d..637c2e5e0ed 100644 --- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp +++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp @@ -228,40 +228,41 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent m_treeView->setSelectionMode(QAbstractItemView::SingleSelection); m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows); m_treeView->setModel(m_model); - connect(m_treeView->selectionModel(), - SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), - SLOT(slotCurrentRowChanged(QModelIndex,QModelIndex))); + connect(m_treeView->selectionModel(), &QItemSelectionModel::currentRowChanged, + this, &DebuggerSourcePathMappingWidget::slotCurrentRowChanged); // Top list/Right part: Buttons. - QVBoxLayout *buttonLayout = new QVBoxLayout; + auto buttonLayout = new QVBoxLayout; buttonLayout->addWidget(m_addButton); buttonLayout->addWidget(m_addQtButton); m_addQtButton->setVisible(sizeof(qtBuildPaths) > 0); m_addQtButton->setToolTip(tr("Add a mapping for Qt's source folders " "when using an unpatched version of Qt.")); buttonLayout->addWidget(m_removeButton); - connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAdd())); - connect(m_addQtButton, SIGNAL(clicked()), this, SLOT(slotAddQt())); - - connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemove())); + connect(m_addButton, &QAbstractButton::clicked, + this, &DebuggerSourcePathMappingWidget::slotAdd); + connect(m_addQtButton, &QAbstractButton::clicked, + this, &DebuggerSourcePathMappingWidget::slotAddQt); + connect(m_removeButton, &QAbstractButton::clicked, + this, &DebuggerSourcePathMappingWidget::slotRemove); buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding)); // Assemble top - QHBoxLayout *treeHLayout = new QHBoxLayout; + auto treeHLayout = new QHBoxLayout; treeHLayout->addWidget(m_treeView); treeHLayout->addLayout(buttonLayout); // Edit part m_targetChooser->setExpectedKind(PathChooser::ExistingDirectory); m_targetChooser->setHistoryCompleter(QLatin1String("Debugger.MappingTarget.History")); - connect(m_sourceLineEdit, SIGNAL(textChanged(QString)), - this, SLOT(slotEditSourceFieldChanged())); - connect(m_targetChooser, SIGNAL(changed(QString)), - this, SLOT(slotEditTargetFieldChanged())); - QFormLayout *editLayout = new QFormLayout; + connect(m_sourceLineEdit, &QLineEdit::textChanged, + this, &DebuggerSourcePathMappingWidget::slotEditSourceFieldChanged); + connect(m_targetChooser, &PathChooser::changed, + this, &DebuggerSourcePathMappingWidget::slotEditTargetFieldChanged); + auto editLayout = new QFormLayout; const QString sourceToolTip = tr("The source path contained in the " "debug information of the executable as reported by the debugger"); - QLabel *editSourceLabel = new QLabel(tr("&Source path:")); + auto editSourceLabel = new QLabel(tr("&Source path:")); editSourceLabel->setToolTip(sourceToolTip); m_sourceLineEdit->setToolTip(sourceToolTip); editSourceLabel->setBuddy(m_sourceLineEdit); @@ -269,7 +270,7 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent const QString targetToolTip = tr("The actual location of the source " "tree on the local machine"); - QLabel *editTargetLabel = new QLabel(tr("&Target path:")); + auto editTargetLabel = new QLabel(tr("&Target path:")); editTargetLabel->setToolTip(targetToolTip); editTargetLabel->setBuddy(m_targetChooser); m_targetChooser->setToolTip(targetToolTip); @@ -279,7 +280,7 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent chooser->addSupportedWidget(m_targetChooser->lineEdit()); // Main layout - QVBoxLayout *mainLayout = new QVBoxLayout; + auto mainLayout = new QVBoxLayout; mainLayout->addLayout(treeHLayout); mainLayout->addLayout(editLayout); setLayout(mainLayout); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index d6e5c087ad2..b4664feed8f 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -231,16 +231,17 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters) //ExtensionSystem::PluginManager::addObject(m_debugInfoTaskHandler); m_commandTimer.setSingleShot(true); - connect(&m_commandTimer, &QTimer::timeout, this, &GdbEngine::commandTimeout); - - connect(action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)), - SLOT(reloadLocals())); - connect(action(CreateFullBacktrace), SIGNAL(triggered()), - SLOT(createFullBacktrace())); - connect(action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), - SLOT(reloadLocals())); - connect(action(UseDynamicType), SIGNAL(valueChanged(QVariant)), - SLOT(reloadLocals())); + connect(&m_commandTimer, &QTimer::timeout, + this, &GdbEngine::commandTimeout); + + connect(action(AutoDerefPointers), &SavedAction::valueChanged, + this, &GdbEngine::reloadLocals); + connect(action(CreateFullBacktrace), &QAction::triggered, + this, &GdbEngine::createFullBacktrace); + connect(action(UseDebuggingHelpers), &SavedAction::valueChanged, + this, &GdbEngine::reloadLocals); + connect(action(UseDynamicType), &SavedAction::valueChanged, + this, &GdbEngine::reloadLocals); } GdbEngine::~GdbEngine() diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 39de6fdfa32..adedf6b9420 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -129,12 +129,13 @@ protected: ////////// Gdb Process Management ////////// void handleAdapterCrashed(const QString &msg); private slots: + friend class GdbPlainEngine; void handleInterruptDeviceInferior(const QString &error); void handleGdbFinished(int, QProcess::ExitStatus status); void handleGdbError(QProcess::ProcessError error); + void readDebugeeOutput(const QByteArray &data); void readGdbStandardOutput(); void readGdbStandardError(); - void readDebugeeOutput(const QByteArray &data); private: QTextCodec *m_outputCodec; diff --git a/src/plugins/debugger/gdb/gdbplainengine.cpp b/src/plugins/debugger/gdb/gdbplainengine.cpp index 9b5f98f6b95..5d86e9ca0ec 100644 --- a/src/plugins/debugger/gdb/gdbplainengine.cpp +++ b/src/plugins/debugger/gdb/gdbplainengine.cpp @@ -51,8 +51,8 @@ GdbPlainEngine::GdbPlainEngine(const DebuggerStartParameters &startParameters) : GdbEngine(startParameters) { // Output - connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)), - this, SLOT(readDebugeeOutput(QByteArray))); + connect(&m_outputCollector, &OutputCollector::byteDelivery, + this, &GdbEngine::readDebugeeOutput); } void GdbPlainEngine::setupInferior() diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index e2339f8e4be..351211efb02 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -46,6 +46,8 @@ #include <QFileInfo> +using namespace Utils; + namespace Debugger { namespace Internal { @@ -60,8 +62,9 @@ namespace Internal { GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerStartParameters &startParameters) : GdbEngine(startParameters), m_startAttempted(false) { - if (Utils::HostOsInfo::isWindowsHost()) + if (HostOsInfo::isWindowsHost()) m_gdbProc->setUseCtrlCStub(startParameters.useCtrlCStub); // This is only set for QNX/BlackBerry + connect(&m_uploadProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), this, &GdbRemoteServerEngine::uploadProcError); connect(&m_uploadProc, &QProcess::readyReadStandardOutput, @@ -80,9 +83,9 @@ void GdbRemoteServerEngine::setupEngine() // Provide script information about the environment QString arglist; - Utils::QtcProcess::addArg(&arglist, startParameters().serverStartScript); - Utils::QtcProcess::addArg(&arglist, startParameters().executable); - Utils::QtcProcess::addArg(&arglist, startParameters().remoteChannel); + QtcProcess::addArg(&arglist, startParameters().serverStartScript); + QtcProcess::addArg(&arglist, startParameters().executable); + QtcProcess::addArg(&arglist, startParameters().remoteChannel); m_uploadProc.start(_("/bin/sh ") + arglist); m_uploadProc.waitForStarted(); @@ -172,12 +175,12 @@ void GdbRemoteServerEngine::setupInferior() //const QByteArray sysroot = sp.sysroot.toLocal8Bit(); //const QByteArray remoteArch = sp.remoteArchitecture.toLatin1(); - const QString args = isMasterEngine() ? startParameters().processArgs : masterEngine()->startParameters().processArgs; + const QString args = isMasterEngine() ? startParameters().processArgs + : masterEngine()->startParameters().processArgs; // if (!remoteArch.isEmpty()) // postCommand("set architecture " + remoteArch); - const QString solibSearchPath - = sp.solibSearchPath.join(Utils::HostOsInfo::pathListSeparator()); + const QString solibSearchPath = sp.solibSearchPath.join(HostOsInfo::pathListSeparator()); if (!solibSearchPath.isEmpty()) postCommand("set solib-search-path " + solibSearchPath.toLocal8Bit()); @@ -431,7 +434,7 @@ void GdbRemoteServerEngine::interruptInferior2() if (boolSetting(TargetAsync)) { postCommand("-exec-interrupt", GdbEngine::Immediate, CB(handleInterruptInferior)); - } else if (m_isQnxGdb && Utils::HostOsInfo::isWindowsHost()) { + } else if (m_isQnxGdb && HostOsInfo::isWindowsHost()) { m_gdbProc->winInterruptByCtrlC(); } else { bool ok = m_gdbProc->interrupt(); diff --git a/src/plugins/debugger/imageviewer.cpp b/src/plugins/debugger/imageviewer.cpp index c5f94946f71..03d0d019d1a 100644 --- a/src/plugins/debugger/imageviewer.cpp +++ b/src/plugins/debugger/imageviewer.cpp @@ -104,11 +104,11 @@ ImageViewer::ImageViewer(QWidget *parent) , m_imageWidget(new ImageWidget) , m_infoLabel(new QLabel) { - QVBoxLayout *mainLayout = new QVBoxLayout(this); + auto mainLayout = new QVBoxLayout(this); mainLayout->addWidget(m_infoLabel); mainLayout->addWidget(m_scrollArea); m_scrollArea->setWidget(m_imageWidget); - connect(m_imageWidget, SIGNAL(clicked(QString)), this, SLOT(clicked(QString))); + connect(m_imageWidget, &ImageWidget::clicked, this, &ImageViewer::clicked); } void ImageViewer::setImage(const QImage &i) diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index f3f9d1e8a4e..df9f6b2b860 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -145,27 +145,27 @@ class DebuggerPane : public QPlainTextEdit Q_OBJECT public: - DebuggerPane(QWidget *parent) + DebuggerPane(LogWindow *parent) : QPlainTextEdit(parent) { setFrameStyle(QFrame::NoFrame); m_clearContentsAction = new QAction(this); m_clearContentsAction->setText(tr("Clear Contents")); m_clearContentsAction->setEnabled(true); - connect(m_clearContentsAction, SIGNAL(triggered(bool)), - parent, SLOT(clearContents())); + connect(m_clearContentsAction, &QAction::triggered, + parent, &LogWindow::clearContents); m_saveContentsAction = new QAction(this); m_saveContentsAction->setText(tr("Save Contents")); m_saveContentsAction->setEnabled(true); - connect(m_saveContentsAction, SIGNAL(triggered()), - this, SLOT(saveContents())); + connect(m_saveContentsAction, &QAction::triggered, + this, &DebuggerPane::saveContents); m_reloadDebuggingHelpersAction = new QAction(this); m_reloadDebuggingHelpersAction->setText(tr("Reload Debugging Helpers")); m_reloadDebuggingHelpersAction->setEnabled(true); - connect(m_reloadDebuggingHelpersAction, SIGNAL(triggered()), - this, SLOT(reloadDebuggingHelpers())); + connect(m_reloadDebuggingHelpersAction, &QAction::triggered, + this, &DebuggerPane::reloadDebuggingHelpers); } void contextMenuEvent(QContextMenuEvent *ev) @@ -209,11 +209,10 @@ public: setUndoRedoEnabled(true); } -private slots: +private: void saveContents(); void reloadDebuggingHelpers(); -private: QAction *m_clearContentsAction; QAction *m_saveContentsAction; QAction *m_reloadDebuggingHelpersAction; @@ -239,7 +238,7 @@ class InputPane : public DebuggerPane { Q_OBJECT public: - InputPane(QWidget *parent) + InputPane(LogWindow *parent) : DebuggerPane(parent) { (void) new InputHighlighter(this); @@ -305,7 +304,7 @@ class CombinedPane : public DebuggerPane { Q_OBJECT public: - CombinedPane(QWidget *parent) + CombinedPane(LogWindow *parent) : DebuggerPane(parent) { (void) new OutputHighlighter(this); @@ -354,7 +353,7 @@ LogWindow::LogWindow(QWidget *parent) m_ignoreNextInputEcho = false; - QSplitter *m_splitter = new Core::MiniSplitter(Qt::Horizontal); + auto m_splitter = new Core::MiniSplitter(Qt::Horizontal); m_splitter->setParent(this); // Mixed input/output. @@ -374,25 +373,25 @@ LogWindow::LogWindow(QWidget *parent) m_commandEdit->setFrame(false); m_commandEdit->setHistoryCompleter(QLatin1String("DebuggerInput")); - QToolButton *repeatButton = new QToolButton(this); + auto repeatButton = new QToolButton(this); repeatButton->setIcon(QIcon(QLatin1String(":/debugger/images/debugger_stepover_small.png"))); repeatButton->setIconSize(QSize(12, 12)); repeatButton->setToolTip(tr("Repeat last command for debug reasons.")); - QHBoxLayout *commandBox = new QHBoxLayout; + auto commandBox = new QHBoxLayout; commandBox->addWidget(repeatButton); commandBox->addWidget(new QLabel(tr("Command:"), this)); commandBox->addWidget(m_commandEdit); commandBox->setMargin(2); commandBox->setSpacing(6); - QVBoxLayout *leftBox = new QVBoxLayout; + auto leftBox = new QVBoxLayout; leftBox->addWidget(m_inputText); leftBox->addItem(commandBox); leftBox->setMargin(0); leftBox->setSpacing(0); - QWidget *leftDummy = new QWidget; + auto leftDummy = new QWidget; leftDummy->setLayout(leftBox); m_splitter->addWidget(leftDummy); @@ -400,14 +399,14 @@ LogWindow::LogWindow(QWidget *parent) m_splitter->setStretchFactor(0, 1); m_splitter->setStretchFactor(1, 3); - QVBoxLayout *layout = new QVBoxLayout(this); + auto layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(m_splitter); layout->addWidget(new Core::FindToolBarPlaceHolder(this)); setLayout(layout); - Aggregation::Aggregate *aggregate = new Aggregation::Aggregate; + auto aggregate = new Aggregation::Aggregate; aggregate->add(m_combinedText); aggregate->add(new Core::BaseTextFind(m_combinedText)); @@ -419,14 +418,15 @@ LogWindow::LogWindow(QWidget *parent) SIGNAL(statusMessageRequested(QString,int))); connect(m_inputText, SIGNAL(commandSelected(int)), m_combinedText, SLOT(gotoResult(int))); - connect(m_commandEdit, SIGNAL(returnPressed()), - SLOT(sendCommand())); + connect(m_commandEdit, &QLineEdit::returnPressed, + this, &LogWindow::sendCommand); connect(m_inputText, SIGNAL(executeLineRequested()), SLOT(executeLine())); - connect(repeatButton, SIGNAL(clicked()), - SLOT(repeatLastCommand())); + connect(repeatButton, &QAbstractButton::clicked, + this, &LogWindow::repeatLastCommand); - connect(&m_outputTimer, SIGNAL(timeout()), SLOT(doOutput())); + connect(&m_outputTimer, &QTimer::timeout, + this, &LogWindow::doOutput); setMinimumHeight(60); } |