aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-09-03 10:34:52 +0200
committerhjk <hjk121@nokiamail.com>2014-09-04 10:23:03 +0200
commitf70ba9930eacdb91e31e8b1f2f4f57afee2aac80 (patch)
tree29896d0ba5dd422979ec36aff6ba42413eb4c41f /src/plugins/cmakeprojectmanager/cmakeeditor.cpp
parent2e17339b05028dee540cc6da6a481229e98224be (diff)
Core: Use std::function for info bar callbacks
Change-Id: Iae7cbef053bfe86a7692e09f66af91117815d2a6 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakeeditor.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
index 2c09ecac21..47c4c58c53 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
@@ -54,6 +54,7 @@
#include <QTextBlock>
using namespace Core;
+using namespace ProjectExplorer;
using namespace TextEditor;
namespace CMakeProjectManager {
@@ -80,24 +81,20 @@ void CMakeEditor::finalizeInitialization()
InfoBarEntry info(infoRunCmake,
tr("Changes to cmake files are shown in the project tree after building."),
InfoBarEntry::GlobalSuppressionEnabled);
- info.setCustomButtonInfo(tr("Build now"), this, SLOT(build()));
+ info.setCustomButtonInfo(tr("Build now"), [document]() {
+ foreach (Project *p, SessionManager::projects()) {
+ if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
+ if (cmakeProject->isProjectFile(document->filePath())) {
+ ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
+ break;
+ }
+ }
+ }
+ });
infoBar->addInfo(info);
});
}
-void CMakeEditor::build()
-{
- foreach (ProjectExplorer::Project *p, ProjectExplorer::SessionManager::projects()) {
- CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
- if (cmakeProject) {
- if (cmakeProject->isProjectFile(document()->filePath())) {
- ProjectExplorer::ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
- break;
- }
- }
- }
-}
-
QString CMakeEditor::contextHelpId() const
{
int pos = position();