Lambda cleanup

Change-Id: Ia7f1d530e01d4ae3990713e23d672249d9489561
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Orgad Shaneh
2014-06-25 09:29:33 +03:00
committed by Orgad Shaneh
parent 8da0742ae2
commit 7fbd4b7c6a
5 changed files with 20 additions and 20 deletions

View File

@@ -254,7 +254,7 @@ void VariableManager::registerIntVariable(const QByteArray &variable,
const QString &description, const VariableManager::IntFunction &value) const QString &description, const VariableManager::IntFunction &value)
{ {
registerVariable(variable, description, registerVariable(variable, description,
[=]() -> QString { return QString::number(value ? value() : 0); }); [value]() { return QString::number(value ? value() : 0); });
} }
/*! /*!
@@ -270,19 +270,19 @@ void VariableManager::registerFileVariables(const QByteArray &prefix,
{ {
registerVariable(prefix + kFilePathPostfix, registerVariable(prefix + kFilePathPostfix,
QCoreApplication::translate("Core::VariableManager", "%1: Full path including file name.").arg(heading), QCoreApplication::translate("Core::VariableManager", "%1: Full path including file name.").arg(heading),
[=]() -> QString { return QFileInfo(base()).filePath(); }); [base]() { return QFileInfo(base()).filePath(); });
registerVariable(prefix + kPathPostfix, registerVariable(prefix + kPathPostfix,
QCoreApplication::translate("Core::VariableManager", "%1: Full path excluding file name.").arg(heading), QCoreApplication::translate("Core::VariableManager", "%1: Full path excluding file name.").arg(heading),
[=]() -> QString { return QFileInfo(base()).path(); }); [base]() { return QFileInfo(base()).path(); });
registerVariable(prefix + kFileNamePostfix, registerVariable(prefix + kFileNamePostfix,
QCoreApplication::translate("Core::VariableManager", "%1: File name without path.").arg(heading), QCoreApplication::translate("Core::VariableManager", "%1: File name without path.").arg(heading),
[=]() -> QString { return QFileInfo(base()).fileName(); }); [base]() { return QFileInfo(base()).fileName(); });
registerVariable(prefix + kFileBaseNamePostfix, registerVariable(prefix + kFileBaseNamePostfix,
QCoreApplication::translate("Core::VariableManager", "%1: File base name without path and suffix.").arg(heading), QCoreApplication::translate("Core::VariableManager", "%1: File base name without path and suffix.").arg(heading),
[=]() -> QString { return QFileInfo(base()).baseName(); }); [base]() { return QFileInfo(base()).baseName(); });
} }
/*! /*!

View File

@@ -172,7 +172,7 @@ QStringList CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &
CppSourceProcessor *CppModelManager::createSourceProcessor() CppSourceProcessor *CppModelManager::createSourceProcessor()
{ {
CppModelManager *that = instance(); CppModelManager *that = instance();
return new CppSourceProcessor(that->snapshot(), [=](const Document::Ptr &doc) { return new CppSourceProcessor(that->snapshot(), [that](const Document::Ptr &doc) {
that->emitDocumentUpdated(doc); that->emitDocumentUpdated(doc);
doc->releaseSourceAndAST(); doc->releaseSourceAndAST();
}); });

View File

@@ -178,7 +178,7 @@ public:
VariableManager::registerFileVariables(PrefixDebugExecutable, VariableManager::registerFileVariables(PrefixDebugExecutable,
tr("Debugged executable"), tr("Debugged executable"),
[&]() { return this->m_startParameters.executable; }); [this]() { return m_startParameters.executable; });
} }
public slots: public slots:

View File

@@ -1066,40 +1066,40 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
VariableManager::registerVariable(Constants::VAR_CURRENTPROJECT_NAME, VariableManager::registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
tr("The current project's name."), tr("The current project's name."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTPROJECT_NAME); }); []() { return variableValue(Constants::VAR_CURRENTPROJECT_NAME); });
VariableManager::registerVariable(Constants::VAR_CURRENTKIT_NAME, VariableManager::registerVariable(Constants::VAR_CURRENTKIT_NAME,
tr("The currently active kit's name."), tr("The currently active kit's name."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTKIT_NAME); }); []() { return variableValue(Constants::VAR_CURRENTKIT_NAME); });
VariableManager::registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME, VariableManager::registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME,
tr("The currently active kit's name in a filesystem friendly version."), tr("The currently active kit's name in a filesystem friendly version."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTKIT_FILESYSTEMNAME); }); []() { return variableValue(Constants::VAR_CURRENTKIT_FILESYSTEMNAME); });
VariableManager::registerVariable(Constants::VAR_CURRENTKIT_ID, VariableManager::registerVariable(Constants::VAR_CURRENTKIT_ID,
tr("The currently active kit's id."), tr("The currently active kit's id."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTKIT_ID); }); []() { return variableValue(Constants::VAR_CURRENTKIT_ID); });
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_HOSTADDRESS, VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_HOSTADDRESS,
tr("The host address of the device in the currently active kit."), tr("The host address of the device in the currently active kit."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTDEVICE_HOSTADDRESS); }); []() { return variableValue(Constants::VAR_CURRENTDEVICE_HOSTADDRESS); });
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_SSHPORT, VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_SSHPORT,
tr("The SSH port of the device in the currently active kit."), tr("The SSH port of the device in the currently active kit."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTDEVICE_SSHPORT); }); []() { return variableValue(Constants::VAR_CURRENTDEVICE_SSHPORT); });
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_USERNAME, VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_USERNAME,
tr("The user name with which to log into the device in the currently active kit."), tr("The user name with which to log into the device in the currently active kit."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTDEVICE_USERNAME); }); []() { return variableValue(Constants::VAR_CURRENTDEVICE_USERNAME); });
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE, VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE,
tr("The private key file with which to authenticate when logging into the device " tr("The private key file with which to authenticate when logging into the device "
"in the currently active kit."), "in the currently active kit."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE); }); []() { return variableValue(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE); });
VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_NAME, VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_NAME,
tr("The currently active build configuration's name."), tr("The currently active build configuration's name."),
[]() -> QString { return variableValue(Constants::VAR_CURRENTBUILD_NAME); }); []() { return variableValue(Constants::VAR_CURRENTBUILD_NAME); });
VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_TYPE, VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_TYPE,
tr("The currently active build configuration's type."), tr("The currently active build configuration's type."),
@@ -1116,11 +1116,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
VariableManager::registerFileVariables(Constants::VAR_CURRENTSESSION_PREFIX, VariableManager::registerFileVariables(Constants::VAR_CURRENTSESSION_PREFIX,
tr("File where current session is saved."), tr("File where current session is saved."),
[]() -> QString { return SessionManager::sessionNameToFileName(SessionManager::activeSession()).toString(); }); []() { return SessionManager::sessionNameToFileName(SessionManager::activeSession()).toString(); });
VariableManager::registerVariable(Constants::VAR_CURRENTSESSION_NAME, VariableManager::registerVariable(Constants::VAR_CURRENTSESSION_NAME,
tr("Name of current session."), tr("Name of current session."),
[]() -> QString { return SessionManager::activeSession(); }); []() { return SessionManager::activeSession(); });
return true; return true;
} }

View File

@@ -117,12 +117,12 @@ void QtSupportPlugin::extensionsInitialized()
{ {
VariableManager::registerVariable(kHostBins, VariableManager::registerVariable(kHostBins,
tr("Full path to the host bin directory of the current project's Qt version."), tr("Full path to the host bin directory of the current project's Qt version."),
[]() -> QString { return qmakeProperty("QT_HOST_BINS"); }); []() { return qmakeProperty("QT_HOST_BINS"); });
VariableManager::registerVariable(kInstallBins, VariableManager::registerVariable(kInstallBins,
tr("Full path to the target bin directory of the current project's Qt version." tr("Full path to the target bin directory of the current project's Qt version."
" You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)), " You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)),
[]() -> QString { return qmakeProperty("QT_INSTALL_BINS"); }); []() { return qmakeProperty("QT_INSTALL_BINS"); });
} }
bool QtSupportPlugin::delayedInitialize() bool QtSupportPlugin::delayedInitialize()