Commit 8146402e authored by Tobias Hunger's avatar Tobias Hunger

CMake: Use Qt5-style connects

Change-Id: I5ec451b55237fcceca86f0134ae081b435dab5c5
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 1d6c960f
......@@ -102,10 +102,8 @@ CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
m_file = new CMakeFile(this, fileName);
connect(this, SIGNAL(buildTargetsChanged()),
this, SLOT(updateRunConfigurations()));
connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString)));
connect(this, &CMakeProject::buildTargetsChanged, this, &CMakeProject::updateRunConfigurations);
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &CMakeProject::fileChanged);
}
CMakeProject::~CMakeProject()
......@@ -157,8 +155,8 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur
void CMakeProject::activeTargetWasChanged(Target *target)
{
if (m_activeTarget) {
disconnect(m_activeTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
disconnect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::changeActiveBuildConfiguration);
}
m_activeTarget = target;
......@@ -166,9 +164,8 @@ void CMakeProject::activeTargetWasChanged(Target *target)
if (!m_activeTarget)
return;
connect(m_activeTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
connect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::changeActiveBuildConfiguration);
changeActiveBuildConfiguration(m_activeTarget->activeBuildConfiguration());
}
......@@ -577,11 +574,10 @@ Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *er
m_activeTarget = activeTarget();
if (m_activeTarget)
connect(m_activeTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(activeTargetWasChanged(ProjectExplorer::Target*)));
connect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::changeActiveBuildConfiguration);
connect(this, &Project::activeTargetChanged,
this, &CMakeProject::activeTargetWasChanged);
return RestoreResult::Ok;
}
......@@ -636,11 +632,11 @@ QString CMakeProject::uiHeaderFile(const QString &uiFile)
void CMakeProject::updateRunConfigurations()
{
foreach (Target *t, targets())
updateRunConfigurations(t);
updateTargetRunConfigurations(t);
}
// TODO Compare with updateDefaultRunConfigurations();
void CMakeProject::updateRunConfigurations(Target *t)
void CMakeProject::updateTargetRunConfigurations(Target *t)
{
// create new and remove obsolete RCs using the factories
t->updateDefaultRunConfigurations();
......
......@@ -144,7 +144,7 @@ private:
ProjectExplorer::FolderNode *findOrCreateFolder(Internal::CMakeProjectNode *rootNode, QString directory);
void createUiCodeModelSupport();
QString uiHeaderFile(const QString &uiFile);
void updateRunConfigurations(ProjectExplorer::Target *t);
void updateTargetRunConfigurations(ProjectExplorer::Target *t);
void updateApplicationAndDeploymentTargets();
QStringList getCXXFlagsFor(const CMakeBuildTarget &buildTarget, QByteArray *cachedBuildNinja);
......
......@@ -50,6 +50,7 @@
#include <QAction>
#include <QDateTime>
using namespace ProjectExplorer;
using namespace CMakeProjectManager::Internal;
CMakeManager::CMakeManager() :
......@@ -71,7 +72,7 @@ CMakeManager::CMakeManager() :
command->setAttribute(Core::Command::CA_Hide);
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_DEPLOY);
connect(m_runCMakeAction, &QAction::triggered, [this]() {
runCMake(ProjectExplorer::SessionManager::startupProject());
runCMake(SessionManager::startupProject());
});
command = Core::ActionManager::registerAction(m_runCMakeActionContextMenu,
......@@ -80,23 +81,23 @@ CMakeManager::CMakeManager() :
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_runCMakeActionContextMenu, &QAction::triggered, [this]() {
runCMake(ProjectExplorer::ProjectTree::currentProject());
runCMake(ProjectTree::currentProject());
});
connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::startupProjectChanged,
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &CMakeManager::updateRunCmakeAction);
connect(ProjectExplorer::BuildManager::instance(), &ProjectExplorer::BuildManager::buildStateChanged,
connect(BuildManager::instance(), &BuildManager::buildStateChanged,
this, &CMakeManager::updateRunCmakeAction);
}
void CMakeManager::updateRunCmakeAction()
{
auto project = qobject_cast<CMakeProject *>(ProjectExplorer::SessionManager::startupProject());
m_runCMakeAction->setVisible(project && !ProjectExplorer::BuildManager::isBuilding(project));
auto project = qobject_cast<CMakeProject *>(SessionManager::startupProject());
m_runCMakeAction->setVisible(project && !BuildManager::isBuilding(project));
}
void CMakeManager::runCMake(ProjectExplorer::Project *project)
void CMakeManager::runCMake(Project *project)
{
if (!project)
return;
......@@ -104,7 +105,7 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
if (!cmakeProject || !cmakeProject->activeTarget() || !cmakeProject->activeTarget()->activeBuildConfiguration())
return;
if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
if (!ProjectExplorerPlugin::saveModifiedFiles())
return;
CMakeBuildConfiguration *bc
......@@ -117,7 +118,7 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
cmakeProject->parseCMakeLists();
}
ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QString *errorString)
Project *CMakeManager::openProject(const QString &fileName, QString *errorString)
{
Utils::FileName file = Utils::FileName::fromString(fileName);
if (!file.toFileInfo().isFile()) {
......
......@@ -78,7 +78,8 @@ CMakeTool::~CMakeTool()
void CMakeTool::cancel()
{
if (m_process) {
disconnect(m_process, SIGNAL(finished(int)));
disconnect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
this, &CMakeTool::finished);
if (m_process->state() != QProcess::NotRunning)
m_process->kill();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment