Port to new connect api

Change-Id: I873a36601d54065b61d0666558b93dc839ad0dfc
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Montel Laurent
2015-01-30 11:02:24 +01:00
committed by hjk
parent f1ac9cd56d
commit 063251ebbc
39 changed files with 287 additions and 240 deletions

View File

@@ -48,9 +48,11 @@ CallgrindRunControl::CallgrindRunControl(const AnalyzerStartParameters &sp,
: ValgrindRunControl(sp, runConfiguration)
, m_markAsPaused(false)
{
connect(&m_runner, SIGNAL(finished()), this, SLOT(slotFinished()));
connect(&m_runner, &Valgrind::Callgrind::CallgrindRunner::finished,
this, &CallgrindRunControl::slotFinished);
connect(m_runner.parser(), SIGNAL(parserDataReady()), this, SLOT(slotFinished()));
connect(&m_runner, SIGNAL(statusMessage(QString)), SLOT(showStatusMessage(QString)));
connect(&m_runner, &Valgrind::Callgrind::CallgrindRunner::statusMessage,
this, &CallgrindRunControl::showStatusMessage);
}
void CallgrindRunControl::showStatusMessage(const QString &msg)

View File

@@ -52,12 +52,12 @@ MemcheckRunControl::MemcheckRunControl(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
: ValgrindRunControl(sp, runConfiguration)
{
connect(&m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
SIGNAL(parserError(Valgrind::XmlProtocol::Error)));
connect(&m_parser, SIGNAL(suppressionCount(QString,qint64)),
SIGNAL(suppressionCount(QString,qint64)));
connect(&m_parser, SIGNAL(internalError(QString)),
SIGNAL(internalParserError(QString)));
connect(&m_parser, &XmlProtocol::ThreadedParser::error,
this, &MemcheckRunControl::parserError);
connect(&m_parser, &XmlProtocol::ThreadedParser::suppressionCount,
this, &MemcheckRunControl::suppressionCount);
connect(&m_parser, &XmlProtocol::ThreadedParser::internalError,
this, &MemcheckRunControl::internalParserError);
}
QString MemcheckRunControl::progressTitle() const

View File

@@ -187,8 +187,7 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QFont & font,
errorLocation(errorIndex, error, /*link=*/ true,
/*absolutePath=*/ false, linkStyle),
linkStyle));
connect(errorLabel, &QLabel::linkActivated,
this, &MemcheckErrorDelegate::openLinkInEditor);
connect(errorLabel, &QLabel::linkActivated, this, &MemcheckErrorDelegate::openLinkInEditor);
layout->addWidget(errorLabel);
const QVector<Stack> stacks = error.stacks();
@@ -223,8 +222,7 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QFont & font,
QFont fixedPitchFont = font;
fixedPitchFont.setFixedPitch(true);
frameLabel->setFont(fixedPitchFont);
connect(frameLabel, &QLabel::linkActivated,
this, &MemcheckErrorDelegate::openLinkInEditor);
connect(frameLabel, &QLabel::linkActivated, this, &MemcheckErrorDelegate::openLinkInEditor);
// pad frameNr to 2 chars since only 50 frames max are supported by valgrind
const QString displayText = displayTextTemplate
.arg(frameNr++, 2).arg(frameName);

View File

@@ -250,12 +250,12 @@ void MemcheckTool::updateFromSettings()
m_filterProjectAction->setChecked(!m_settings->filterExternalIssues());
m_errorView->settingsChanged(m_settings);
connect(m_settings, SIGNAL(visibleErrorKindsChanged(QList<int>)),
m_errorProxyModel, SLOT(setAcceptedKinds(QList<int>)));
connect(m_settings, &ValgrindBaseSettings::visibleErrorKindsChanged,
m_errorProxyModel, &MemcheckErrorFilterProxyModel::setAcceptedKinds);
m_errorProxyModel->setAcceptedKinds(m_settings->visibleErrorKinds());
connect(m_settings, SIGNAL(filterExternalIssuesChanged(bool)),
m_errorProxyModel, SLOT(setFilterExternalIssues(bool)));
connect(m_settings, &ValgrindBaseSettings::filterExternalIssuesChanged,
m_errorProxyModel, &MemcheckErrorFilterProxyModel::setFilterExternalIssues);
m_errorProxyModel->setFilterExternalIssues(m_settings->filterExternalIssues());
}
@@ -283,7 +283,7 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
// now make the new settings current, update and connect input widgets
m_settings = settings;
QTC_ASSERT(m_settings, return);
connect(m_settings, SIGNAL(destroyed(QObject*)), SLOT(settingsDestroyed(QObject*)));
connect(m_settings, &ValgrindBaseSettings::destroyed, this, &MemcheckTool::settingsDestroyed);
updateFromSettings();
}
@@ -381,7 +381,7 @@ QWidget *MemcheckTool::createWidgets()
action = new QAction(this);
action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_OPENFILE)));
action->setToolTip(tr("Load External XML Log File"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(loadExternalXmlLogFile()));
connect(action, &QAction::triggered, this, &MemcheckTool::loadExternalXmlLogFile);
button = new QToolButton;
button->setDefaultAction(action);
layout->addWidget(button);
@@ -421,7 +421,7 @@ QWidget *MemcheckTool::createWidgets()
m_filterMenu->addSeparator();
m_filterMenu->addAction(m_filterProjectAction);
m_filterMenu->addAction(m_suppressionSeparator);
connect(m_filterMenu, SIGNAL(triggered(QAction*)), SLOT(updateErrorFilter()));
connect(m_filterMenu, &QMenu::triggered, this, &MemcheckTool::updateErrorFilter);
filterButton->setMenu(m_filterMenu);
layout->addWidget(filterButton);
@@ -440,13 +440,10 @@ AnalyzerRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters
MemcheckRunControl *engine = new MemcheckRunControl(sp, runConfiguration);
connect(engine, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
this, SLOT(engineStarting(const Analyzer::AnalyzerRunControl*)));
connect(engine, SIGNAL(parserError(Valgrind::XmlProtocol::Error)),
this, SLOT(parserError(Valgrind::XmlProtocol::Error)));
connect(engine, SIGNAL(internalParserError(QString)),
this, SLOT(internalParserError(QString)));
connect(engine, SIGNAL(finished()), this, SLOT(engineFinished()));
connect(engine, &MemcheckRunControl::starting, this, &MemcheckTool::engineStarting);
connect(engine, &MemcheckRunControl::parserError, this, &MemcheckTool::parserError);
connect(engine, &MemcheckRunControl::internalParserError, this, &MemcheckTool::internalParserError);
connect(engine, &MemcheckRunControl::finished, this, &MemcheckTool::engineFinished);
return engine;
}
@@ -470,8 +467,7 @@ void MemcheckTool::engineStarting(const AnalyzerRunControl *engine)
QAction *action = m_filterMenu->addAction(Utils::FileName::fromString(file).fileName());
action->setToolTip(file);
action->setData(file);
connect(action, SIGNAL(triggered(bool)),
this, SLOT(suppressionActionTriggered()));
connect(action, &QAction::triggered, this, &MemcheckTool::suppressionActionTriggered);
m_suppressionActions.append(action);
}
}
@@ -515,12 +511,10 @@ void MemcheckTool::loadExternalXmlLogFile()
}
ThreadedParser *parser = new ThreadedParser;
connect(parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
this, SLOT(parserError(Valgrind::XmlProtocol::Error)));
connect(parser, SIGNAL(internalError(QString)),
this, SLOT(internalParserError(QString)));
connect(parser, SIGNAL(finished()), this, SLOT(loadingExternalXmlLogFileFinished()));
connect(parser, SIGNAL(finished()), parser, SLOT(deleteLater()));
connect(parser, &ThreadedParser::error, this, &MemcheckTool::parserError);
connect(parser, &ThreadedParser::internalError, this, &MemcheckTool::internalParserError);
connect(parser, &ThreadedParser::finished, this, &MemcheckTool::loadingExternalXmlLogFileFinished);
connect(parser, &ThreadedParser::finished, parser, &ThreadedParser::deleteLater);
parser->parse(logFile); // ThreadedParser owns the file
}

View File

@@ -63,14 +63,14 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command"));
updateUi();
connect(m_settings, SIGNAL(changed()), this, SLOT(updateUi()));
connect(m_settings, &ValgrindBaseSettings::changed, this, &ValgrindConfigWidget::updateUi);
connect(m_ui->valgrindExeChooser, SIGNAL(changed(QString)),
m_settings, SLOT(setValgrindExecutable(QString)));
connect(m_ui->valgrindExeChooser, &Utils::PathChooser::changed,
m_settings, &ValgrindBaseSettings::setValgrindExecutable);
connect(m_settings, SIGNAL(valgrindExecutableChanged(QString)),
m_ui->valgrindExeChooser, SLOT(setPath(QString)));
connect(m_ui->smcDetectionComboBox, SIGNAL(currentIndexChanged(int)),
m_settings, SLOT(setSelfModifyingCodeDetection(int)));
connect(m_ui->smcDetectionComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
m_settings, &ValgrindBaseSettings::setSelfModifyingCodeDetection);
if (Utils::HostOsInfo::isWindowsHost()) {
// FIXME: On Window we know that we don't have a local valgrind
@@ -82,38 +82,38 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
//
// Callgrind
//
connect(m_ui->enableCacheSim, SIGNAL(toggled(bool)),
m_settings, SLOT(setEnableCacheSim(bool)));
connect(m_ui->enableCacheSim, &QCheckBox::toggled,
m_settings, &ValgrindBaseSettings::setEnableCacheSim);
connect(m_settings, SIGNAL(enableCacheSimChanged(bool)),
m_ui->enableCacheSim, SLOT(setChecked(bool)));
connect(m_ui->enableBranchSim, SIGNAL(toggled(bool)),
m_settings, SLOT(setEnableBranchSim(bool)));
connect(m_ui->enableBranchSim, &QCheckBox::toggled,
m_settings, &ValgrindBaseSettings::setEnableBranchSim);
connect(m_settings, SIGNAL(enableBranchSimChanged(bool)),
m_ui->enableBranchSim, SLOT(setChecked(bool)));
connect(m_ui->collectSystime, SIGNAL(toggled(bool)),
m_settings, SLOT(setCollectSystime(bool)));
connect(m_ui->collectSystime, &QCheckBox::toggled,
m_settings, &ValgrindBaseSettings::setCollectSystime);
connect(m_settings, SIGNAL(collectSystimeChanged(bool)),
m_ui->collectSystime, SLOT(setChecked(bool)));
connect(m_ui->collectBusEvents, SIGNAL(toggled(bool)),
m_settings, SLOT(setCollectBusEvents(bool)));
connect(m_ui->collectBusEvents, &QCheckBox::toggled,
m_settings, &ValgrindBaseSettings::setCollectBusEvents);
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
m_ui->collectBusEvents, SLOT(setChecked(bool)));
connect(m_ui->enableEventToolTips, SIGNAL(toggled(bool)),
m_settings, SLOT(setEnableEventToolTips(bool)));
connect(m_ui->enableEventToolTips, &QGroupBox::toggled,
m_settings, &ValgrindBaseSettings::setEnableEventToolTips);
connect(m_settings, SIGNAL(enableEventToolTipsChanged(bool)),
m_ui->enableEventToolTips, SLOT(setChecked(bool)));
connect(m_ui->minimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
m_settings, SLOT(setMinimumInclusiveCostRatio(double)));
connect(m_ui->minimumInclusiveCostRatio, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
m_settings, &ValgrindBaseSettings::setMinimumInclusiveCostRatio);
connect(m_settings, SIGNAL(minimumInclusiveCostRatioChanged(double)),
m_ui->minimumInclusiveCostRatio, SLOT(setValue(double)));
connect(m_ui->visualisationMinimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
m_settings, SLOT(setVisualisationMinimumInclusiveCostRatio(double)));
connect(m_ui->visualisationMinimumInclusiveCostRatio, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
m_settings, &ValgrindBaseSettings::setVisualisationMinimumInclusiveCostRatio);
connect(m_settings, SIGNAL(visualisationMinimumInclusiveCostRatioChanged(double)),
m_ui->visualisationMinimumInclusiveCostRatio, SLOT(setValue(double)));
@@ -123,36 +123,32 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
m_ui->suppressionList->setModel(m_model);
m_ui->suppressionList->setSelectionMode(QAbstractItemView::MultiSelection);
connect(m_ui->addSuppression, SIGNAL(clicked()),
this, SLOT(slotAddSuppression()));
connect(m_ui->removeSuppression, SIGNAL(clicked()),
this, SLOT(slotRemoveSuppression()));
connect(m_ui->addSuppression, &QPushButton::clicked, this, &ValgrindConfigWidget::slotAddSuppression);
connect(m_ui->removeSuppression, &QPushButton::clicked, this, &ValgrindConfigWidget::slotRemoveSuppression);
connect(m_ui->numCallers, SIGNAL(valueChanged(int)), m_settings, SLOT(setNumCallers(int)));
connect(m_ui->numCallers, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
m_settings, &ValgrindBaseSettings::setNumCallers);
connect(m_settings, SIGNAL(numCallersChanged(int)), m_ui->numCallers, SLOT(setValue(int)));
connect(m_ui->leakCheckOnFinish, SIGNAL(currentIndexChanged(int)),
m_settings, SLOT(setLeakCheckOnFinish(int)));
connect(m_ui->leakCheckOnFinish, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
m_settings, &ValgrindBaseSettings::setLeakCheckOnFinish);
connect(m_settings, SIGNAL(leakCheckOnFinishChanged(int)),
m_ui->leakCheckOnFinish, SLOT(setCurrentIndex(int)));
connect(m_ui->showReachable, SIGNAL(toggled(bool)),
m_settings, SLOT(setShowReachable(bool)));
connect(m_ui->showReachable, &QCheckBox::toggled, m_settings, &ValgrindBaseSettings::setShowReachable);
connect(m_settings, SIGNAL(showReachableChanged(bool)),
m_ui->showReachable, SLOT(setChecked(bool)));
connect(m_ui->trackOrigins, SIGNAL(toggled(bool)),
m_settings, SLOT(setTrackOrigins(bool)));
connect(m_ui->trackOrigins, &QCheckBox::toggled, m_settings, &ValgrindBaseSettings::setTrackOrigins);
connect(m_settings, SIGNAL(trackOriginsChanged(bool)),
m_ui->trackOrigins, SLOT(setChecked(bool)));
connect(m_settings, SIGNAL(suppressionFilesRemoved(QStringList)),
this, SLOT(slotSuppressionsRemoved(QStringList)));
connect(m_settings, SIGNAL(suppressionFilesAdded(QStringList)),
this, SLOT(slotSuppressionsAdded(QStringList)));
connect(m_settings, &ValgrindBaseSettings::suppressionFilesRemoved,
this, &ValgrindConfigWidget::slotSuppressionsRemoved);
connect(m_settings, &ValgrindBaseSettings::suppressionFilesAdded,
this, &ValgrindConfigWidget::slotSuppressionsAdded);
connect(m_ui->suppressionList->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
connect(m_ui->suppressionList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(slotSuppressionSelectionChanged()));
slotSuppressionSelectionChanged();

View File

@@ -79,8 +79,10 @@ bool ValgrindRunControl::startEngine()
FutureProgress *fp = ProgressManager::addTimedTask(m_progress, progressTitle(), "valgrind", 100);
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
connect(fp, SIGNAL(canceled()), this, SLOT(handleProgressCanceled()));
connect(fp, SIGNAL(finished()), this, SLOT(handleProgressFinished()));
connect(fp, &FutureProgress::canceled,
this, &ValgrindRunControl::handleProgressCanceled);
connect(fp, &FutureProgress::finished,
this, &ValgrindRunControl::handleProgressFinished);
m_progress.reportStarted();
const AnalyzerStartParameters &sp = startParameters();
@@ -101,11 +103,12 @@ bool ValgrindRunControl::startEngine()
run->setStartMode(sp.startMode);
run->setLocalRunMode(sp.localRunMode);
connect(run, SIGNAL(processOutputReceived(QString,Utils::OutputFormat)),
SLOT(receiveProcessOutput(QString,Utils::OutputFormat)));
connect(run, SIGNAL(processErrorReceived(QString,QProcess::ProcessError)),
SLOT(receiveProcessError(QString,QProcess::ProcessError)));
connect(run, SIGNAL(finished()), SLOT(runnerFinished()));
connect(run, &ValgrindRunner::processOutputReceived,
this, &ValgrindRunControl::receiveProcessOutput);
connect(run, &ValgrindRunner::processErrorReceived,
this, &ValgrindRunControl::receiveProcessError);
connect(run, &ValgrindRunner::finished,
this, &ValgrindRunControl::runnerFinished);
if (!run->start()) {
m_progress.cancel();

View File

@@ -188,7 +188,8 @@ void ValgrindPlugin::extensionsInitialized()
QAction *action = new QAction(tr("Profile Costs of This Function and Its Callees"), this);
action->setIcon(QIcon(QLatin1String(Analyzer::Constants::ANALYZER_CONTROL_START_ICON)));
connect(action, SIGNAL(triggered()), m_callgrindTool, SLOT(handleShowCostsOfFunction()));
connect(action, &QAction::triggered, m_callgrindTool,
&CallgrindTool::handleShowCostsOfFunction);
Command *cmd = ActionManager::registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction",
analyzerContext);
editorContextMenu->addAction(cmd);