Commit 98723e45 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

De-noise some ProjectExplorer/Utils qualifications



Change-Id: Iaec01ca0e7a43592528bcaf4252540561e109919
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent 74ce6e40
......@@ -477,11 +477,11 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
void AndroidManifestEditorWidget::updateTargetComboBox()
{
const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
ProjectExplorer::Project *project = androidProject(docPath);
Project *project = androidProject(docPath);
QStringList items;
if (project) {
ProjectExplorer::Kit *kit = project->activeTarget()->kit();
if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(kit) == Constants::ANDROID_DEVICE_TYPE)
Kit *kit = project->activeTarget()->kit();
if (DeviceTypeKitInformation::deviceTypeId(kit) == Constants::ANDROID_DEVICE_TYPE)
items = AndroidManager::androidQtSupport(project->activeTarget())->projectTargetApplications(project->activeTarget());
}
......
......@@ -71,6 +71,7 @@
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
using namespace ProjectExplorer;
using namespace Utils;
// QtCreator CMake Generator wishlist:
// Which make targets we need to build to get all executables
......@@ -171,7 +172,7 @@ void CMakeProject::activeTargetWasChanged(Target *target)
void CMakeProject::changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory)
{
bc->setBuildDirectory(Utils::FileName::fromString(newBuildDirectory));
bc->setBuildDirectory(FileName::fromString(newBuildDirectory));
parseCMakeLists();
}
......@@ -493,7 +494,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
bool hasUserFile = activeTarget();
if (!hasUserFile) {
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, projectDirectory().toString(), Utils::Environment::systemEnvironment());
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, projectDirectory().toString(), Environment::systemEnvironment());
if (copw.exec() != QDialog::Accepted)
return false;
Kit *k = copw.kit();
......@@ -501,7 +502,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t));
bc->setDefaultDisplayName(QLatin1String("all"));
bc->setUseNinja(copw.useNinja());
bc->setBuildDirectory(Utils::FileName::fromString(copw.buildDirectory()));
bc->setBuildDirectory(FileName::fromString(copw.buildDirectory()));
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
......@@ -578,17 +579,17 @@ CMakeBuildTarget CMakeProject::buildTargetForTitle(const QString &title)
QString CMakeProject::uiHeaderFile(const QString &uiFile)
{
QFileInfo fi(uiFile);
Utils::FileName project = projectDirectory();
Utils::FileName baseDirectory = Utils::FileName::fromString(fi.absolutePath());
FileName project = projectDirectory();
FileName baseDirectory = FileName::fromString(fi.absolutePath());
while (baseDirectory.isChildOf(project)) {
Utils::FileName cmakeListsTxt = baseDirectory;
FileName cmakeListsTxt = baseDirectory;
cmakeListsTxt.appendPath(QLatin1String("CMakeLists.txt"));
if (cmakeListsTxt.exists())
break;
QDir dir(baseDirectory.toString());
dir.cdUp();
baseDirectory = Utils::FileName::fromString(dir.absolutePath());
baseDirectory = FileName::fromString(dir.absolutePath());
}
QDir srcDirRoot = QDir(project.toString());
......@@ -699,8 +700,8 @@ void CMakeProject::updateApplicationAndDeploymentTargets()
if (ct.targetType == ExecutableType) {
// TODO: Put a path to corresponding .cbp file into projectFilePath?
appTargetList.list << BuildTargetInfo(ct.title,
Utils::FileName::fromString(ct.executable),
Utils::FileName::fromString(ct.executable));
FileName::fromString(ct.executable),
FileName::fromString(ct.executable));
}
}
......@@ -741,7 +742,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
{
setId("Cmake.ProjectFile");
setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
setFilePath(Utils::FileName::fromString(fileName));
setFilePath(FileName::fromString(fileName));
}
bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave)
......@@ -856,7 +857,7 @@ void CMakeBuildSettingsWidget::runCMake()
////
namespace {
int distance(const QString &targetDirectory, const Utils::FileName &fileName)
int distance(const QString &targetDirectory, const FileName &fileName)
{
const QString commonParent = Utils::commonPath(QStringList() << targetDirectory << fileName.toString());
return targetDirectory.mid(commonParent.size()).count(QLatin1Char('/'))
......@@ -871,15 +872,15 @@ int distance(const QString &targetDirectory, const Utils::FileName &fileName)
void CMakeCbpParser::sortFiles()
{
QLoggingCategory log("qtc.cmakeprojectmanager.filetargetmapping");
QList<Utils::FileName> fileNames = Utils::transform(m_fileList, [] (FileNode *node) {
return Utils::FileName::fromString(node->path());
QList<FileName> fileNames = Utils::transform(m_fileList, [] (FileNode *node) {
return FileName::fromString(node->path());
});
Utils::sort(fileNames);
CMakeBuildTarget *last = 0;
Utils::FileName parentDirectory;
FileName parentDirectory;
qCDebug(log) << "###############";
qCDebug(log) << "# Pre Dump #";
......@@ -908,7 +909,7 @@ void CMakeCbpParser::sortFiles()
qCDebug(log) << "# Sorting #";
qCDebug(log) << "###############";
foreach (const Utils::FileName &fileName, fileNames) {
foreach (const FileName &fileName, fileNames) {
qCDebug(log) << fileName;
if (fileName.parentDir() == parentDirectory && last) {
// easy case, same parent directory as last file
......@@ -1077,7 +1078,7 @@ void CMakeCbpParser::parseBuildTargetOption()
QDir dir(m_buildDirectory);
const QString relative = dir.relativeFilePath(m_buildTarget.workingDirectory);
m_buildTarget.sourceDirectory
= Utils::FileName::fromString(m_sourceDirectory).appendPath(relative).toString();
= FileName::fromString(m_sourceDirectory).appendPath(relative).toString();
}
}
while (!atEnd()) {
......@@ -1213,7 +1214,7 @@ void CMakeCbpParser::parseUnit()
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
} else {
bool generated = false;
QString onlyFileName = Utils::FileName::fromString(fileName).fileName();
QString onlyFileName = FileName::fromString(fileName).fileName();
if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
|| (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
|| (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
......
......@@ -52,6 +52,7 @@ namespace {
const char EXTERNAL_FILE_WARNING[] = "ExternalFile";
}
using namespace Utils;
using namespace ProjectExplorer;
using namespace Internal;
......@@ -133,8 +134,7 @@ void ProjectTree::updateFromFocus(bool invalidCurrentNode)
{
ProjectTreeWidget *focus = m_focusForContextMenu;
if (!focus)
focus = Utils::findOrDefault(m_projectTreeWidgets,
&ProjectTree::hasFocus);
focus = Utils::findOrDefault(m_projectTreeWidgets, &ProjectTree::hasFocus);
if (focus)
updateFromProjectTreeWidget(focus);
......@@ -413,12 +413,12 @@ void ProjectTree::updateExternalFileWarning()
}
if (!infoBar->canInfoBeAdded(externalFileId))
return;
const Utils::FileName fileName = document->filePath();
const FileName fileName = document->filePath();
const QList<Project *> projects = SessionManager::projects();
if (projects.isEmpty())
return;
foreach (Project *project, projects) {
Utils::FileName projectDir = project->projectDirectory();
FileName projectDir = project->projectDirectory();
if (projectDir.isEmpty())
continue;
if (fileName.isChildOf(projectDir))
......@@ -426,7 +426,7 @@ void ProjectTree::updateExternalFileWarning()
// External file. Test if it under the same VCS
QString topLevel;
if (Core::VcsManager::findVersionControlForDirectory(projectDir.toString(), &topLevel)
&& fileName.isChildOf(Utils::FileName::fromString(topLevel))) {
&& fileName.isChildOf(FileName::fromString(topLevel))) {
return;
}
}
......
......@@ -47,6 +47,8 @@
#include <QTcpSocket>
#include <QTcpServer>
using namespace ProjectExplorer;
enum { debug = 0 };
namespace QmakeProjectManager {
......@@ -130,8 +132,8 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
QString *errorMessage) const
{
// Get the binary either from the current Qt version of the project or Path
if (ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(fileName)) {
if (const ProjectExplorer::Target *target = project->activeTarget()) {
if (Project *project = SessionManager::projectForFile(fileName)) {
if (const Target *target = project->activeTarget()) {
if (const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit())) {
data->binary = (qtVersion->*commandAccessor)();
data->workingDirectory = project->projectDirectory().toString();
......
......@@ -79,7 +79,7 @@ enum { debug = 0 };
namespace {
QmakeBuildConfiguration *enableActiveQmakeBuildConfiguration(ProjectExplorer::Target *t, bool enabled)
QmakeBuildConfiguration *enableActiveQmakeBuildConfiguration(Target *t, bool enabled)
{
if (!t)
return 0;
......@@ -171,8 +171,8 @@ public:
void clear();
bool equals(const QmakeProjectFiles &f) const;
QStringList files[ProjectExplorer::FileTypeSize];
QStringList generatedFiles[ProjectExplorer::FileTypeSize];
QStringList files[FileTypeSize];
QStringList generatedFiles[FileTypeSize];
QStringList proFiles;
};
......@@ -211,7 +211,7 @@ QDebug operator<<(QDebug d, const QmakeProjectFiles &f)
}
// A visitor to collect all files of a project in a QmakeProjectFiles struct
class ProjectFilesVisitor : public ProjectExplorer::NodesVisitor
class ProjectFilesVisitor : public NodesVisitor
{
ProjectFilesVisitor(QmakeProjectFiles *files);
......@@ -283,7 +283,7 @@ QmakeProjectFile::QmakeProjectFile(const QString &filePath, QObject *parent)
{
setId("Qmake.ProFile");
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
setFilePath(Utils::FileName::fromString(filePath));
setFilePath(FileName::fromString(filePath));
}
bool QmakeProjectFile::save(QString *, const QString &, bool)
......@@ -417,12 +417,13 @@ bool QmakeProject::fromMap(const QVariantMap &map)
// On active buildconfiguration changes, reevaluate the .pro files
m_activeTarget = activeTarget();
if (m_activeTarget)
connect(m_activeTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(scheduleAsyncUpdate()));
if (m_activeTarget) {
connect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &QmakeProject::scheduleAsyncUpdateLater);
}
connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(activeTargetWasChanged()));
connect(this, &Project::activeTargetChanged,
this, &QmakeProject::activeTargetWasChanged);
scheduleAsyncUpdate(QmakeProFileNode::ParseNow);
return true;
......@@ -472,7 +473,7 @@ void QmakeProject::updateCppCodeModel()
Kit *k = 0;
QtSupport::BaseQtVersion *qtVersion = 0;
if (ProjectExplorer::Target *target = activeTarget())
if (Target *target = activeTarget())
k = target->kit();
else
k = KitManager::defaultKit();
......@@ -623,7 +624,7 @@ void QmakeProject::updateQmlJSCodeModel()
bool hasQmlLib = false;
foreach (QmakeProFileNode *node, proFiles) {
foreach (const QString &path, node->variableValue(QmlImportPathVar))
projectInfo.importPaths.maybeInsert(Utils::FileName::fromString(path),
projectInfo.importPaths.maybeInsert(FileName::fromString(path),
QmlJS::Dialect::Qml);
projectInfo.activeResourceFiles.append(node->variableValue(ExactResourceVar));
projectInfo.allResourceFiles.append(node->variableValue(ResourceVar));
......@@ -884,7 +885,7 @@ void QmakeProject::buildFinished(bool success)
m_qmakeVfs->invalidateContents();
}
ProjectExplorer::IProjectManager *QmakeProject::projectManager() const
IProjectManager *QmakeProject::projectManager() const
{
return m_manager;
}
......@@ -970,7 +971,7 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFileNo
m_qmakeGlobalsRefCnt = 0;
Kit *k;
Utils::Environment env = Utils::Environment::systemEnvironment();
Environment env = Environment::systemEnvironment();
QStringList qmakeArgs;
if (!bc)
bc = activeTarget() ? static_cast<QmakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration()) : 0;
......@@ -997,7 +998,7 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFileNo
m_qmakeGlobals->setDirectories(m_rootProjectNode->sourceDir(), m_rootProjectNode->buildDir());
m_qmakeGlobals->sysroot = systemRoot;
Utils::Environment::const_iterator eit = env.constBegin(), eend = env.constEnd();
Environment::const_iterator eit = env.constBegin(), eend = env.constEnd();
for (; eit != eend; ++eit)
m_qmakeGlobals->environment.insert(env.key(eit), env.value(eit));
......@@ -1053,7 +1054,7 @@ void QmakeProject::destroyProFileReader(QtSupport::ProFileReader *reader)
}
}
ProjectExplorer::ProjectNode *QmakeProject::rootProjectNode() const
ProjectNode *QmakeProject::rootProjectNode() const
{
return m_rootProjectNode;
}
......@@ -1139,8 +1140,8 @@ QList<Core::Id> QmakeProject::idsForNodes(Core::Id base, const QList<QmakeProFil
void QmakeProject::activeTargetWasChanged()
{
if (m_activeTarget) {
disconnect(m_activeTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(scheduleAsyncUpdate()));
disconnect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &QmakeProject::scheduleAsyncUpdateLater);
}
m_activeTarget = activeTarget();
......@@ -1148,8 +1149,8 @@ void QmakeProject::activeTargetWasChanged()
if (!m_activeTarget)
return;
connect(m_activeTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(scheduleAsyncUpdate()));
connect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &QmakeProject::scheduleAsyncUpdateLater);
scheduleAsyncUpdate();
}
......@@ -1346,7 +1347,7 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
QList<QmakePriFileNode *> nodes = m_map.values(dir);
if (!nodes.isEmpty()) {
// Collect all the files
QSet<Utils::FileName> newFiles;
QSet<FileName> newFiles;
newFiles += QmakePriFileNode::recursiveEnumerate(folder);
foreach (QmakePriFileNode *node, nodes) {
newOrRemovedFiles = newOrRemovedFiles
......@@ -1465,8 +1466,8 @@ void QmakeProject::updateBuildSystemData()
BuildTargetInfoList appTargetList;
foreach (const QmakeProFileNode * const node, applicationProFiles()) {
appTargetList.list << BuildTargetInfo(node->targetInformation().target,
Utils::FileName::fromString(executableFor(node)),
Utils::FileName::fromString(node->path()));
FileName::fromString(executableFor(node)),
FileName::fromString(node->path()));
}
target->setApplicationTargets(appTargetList);
}
......@@ -1526,9 +1527,8 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
const QString targetPath = node->installsList().targetPath;
if (targetPath.isEmpty())
return;
const ProjectExplorer::Kit * const kit = activeTarget()->kit();
const ProjectExplorer::ToolChain * const toolchain
= ProjectExplorer::ToolChainKitInformation::toolChain(kit);
const Kit * const kit = activeTarget()->kit();
const ToolChain * const toolchain = ToolChainKitInformation::toolChain(kit);
if (!toolchain)
return;
......@@ -1538,7 +1538,7 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
const bool isStatic = config.contains(QLatin1String("static"));
const bool isPlugin = config.contains(QLatin1String("plugin"));
switch (toolchain->targetAbi().os()) {
case ProjectExplorer::Abi::WindowsOS: {
case Abi::WindowsOS: {
QString targetVersionExt = node->singleVariableValue(TargetVersionExtVar);
if (targetVersionExt.isEmpty()) {
const QString version = node->singleVariableValue(VersionVar);
......@@ -1553,7 +1553,7 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
deploymentData.addFile(destDirFor(ti) + QLatin1Char('/') + targetFileName, targetPath);
break;
}
case ProjectExplorer::Abi::MacOS: {
case Abi::MacOS: {
QString destDir = destDirFor(ti);
if (config.contains(QLatin1String("lib_bundle"))) {
destDir.append(QLatin1Char('/')).append(ti.target)
......@@ -1575,9 +1575,9 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
deploymentData.addFile(destDir + QLatin1Char('/') + targetFileName, targetPath);
break;
}
case ProjectExplorer::Abi::LinuxOS:
case ProjectExplorer::Abi::BsdOS:
case ProjectExplorer::Abi::UnixOS:
case Abi::LinuxOS:
case Abi::BsdOS:
case Abi::UnixOS:
targetFileName.prepend(QLatin1String("lib"));
targetFileName += QLatin1Char('.');
if (isStatic) {
......@@ -1609,7 +1609,7 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
bool QmakeProject::matchesKit(const Kit *kit)
{
QList<QtSupport::BaseQtVersion *> parentQts;
Utils::FileName filePath = projectFilePath();
FileName filePath = projectFilePath();
foreach (QtSupport::BaseQtVersion *version, QtSupport::QtVersionManager::validVersions()) {
if (version->isSubProject(filePath))
parentQts.append(version);
......@@ -1623,9 +1623,8 @@ bool QmakeProject::matchesKit(const Kit *kit)
QString QmakeProject::executableFor(const QmakeProFileNode *node)
{
const ProjectExplorer::Kit * const kit = activeTarget()->kit();
const ProjectExplorer::ToolChain * const toolchain
= ProjectExplorer::ToolChainKitInformation::toolChain(kit);
const Kit * const kit = activeTarget()->kit();
const ToolChain * const toolchain = ToolChainKitInformation::toolChain(kit);
if (!toolchain)
return QString();
......@@ -1633,7 +1632,7 @@ QString QmakeProject::executableFor(const QmakeProFileNode *node)
QString target;
switch (toolchain->targetAbi().os()) {
case ProjectExplorer::Abi::MacOS:
case Abi::MacOS:
if (node->variableValue(ConfigVar).contains(QLatin1String("app_bundle"))) {
target = ti.target + QLatin1String(".app/Contents/MacOS/") + ti.target;
break;
......
......@@ -150,6 +150,7 @@ signals:
public slots:
void scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay = QmakeProFileNode::ParseLater);
void scheduleAsyncUpdateLater() { scheduleAsyncUpdate(); }
protected:
bool fromMap(const QVariantMap &map);
......
......@@ -57,6 +57,8 @@
#include <QPlainTextEdit>
#include <QApplication>
using namespace ProjectExplorer;
enum {
debug = false
};
......@@ -212,7 +214,7 @@ QString DesignDocument::fileName() const
return editor()->document()->filePath().toString();
}
ProjectExplorer::Kit *DesignDocument::currentKit() const
Kit *DesignDocument::currentKit() const
{
return m_currentKit;
}
......@@ -626,9 +628,9 @@ void DesignDocument::redo()
viewManager().resetPropertyEditorView();
}
static bool isFileInProject(DesignDocument *designDocument, ProjectExplorer::Project *project)
static bool isFileInProject(DesignDocument *designDocument, Project *project)
{
foreach (const QString &fileNameInProject, project->files(ProjectExplorer::Project::ExcludeGeneratedFiles)) {
foreach (const QString &fileNameInProject, project->files(Project::ExcludeGeneratedFiles)) {
if (designDocument->fileName() == fileNameInProject)
return true;
}
......@@ -636,12 +638,12 @@ static bool isFileInProject(DesignDocument *designDocument, ProjectExplorer::Pro
return false;
}
static inline ProjectExplorer::Kit *getActiveKit(DesignDocument *designDocument)
static inline Kit *getActiveKit(DesignDocument *designDocument)
{
ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectTree::currentProject();
Project *currentProject = ProjectTree::currentProject();
if (!currentProject)
currentProject = ProjectExplorer::SessionManager::projectForFile(designDocument->fileName());
currentProject = SessionManager::projectForFile(designDocument->fileName());
if (!currentProject)
return 0;
......@@ -649,18 +651,20 @@ static inline ProjectExplorer::Kit *getActiveKit(DesignDocument *designDocument)
if (!isFileInProject(designDocument, currentProject))
return 0;
QObject::connect(ProjectExplorer::ProjectTree::instance(), &ProjectExplorer::ProjectTree::currentProjectChanged,
QObject::connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
designDocument->connect(currentProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)), designDocument, SLOT(updateActiveQtVersion()), Qt::UniqueConnection);
QObject::connect(currentProject, &Project::activeTargetChanged,
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
ProjectExplorer::Target *target = currentProject->activeTarget();
Target *target = currentProject->activeTarget();
if (!target)
return 0;
designDocument->connect(target, SIGNAL(kitChanged()), designDocument, SLOT(updateActiveQtVersion()), Qt::UniqueConnection);
QObject::connect(target, &Target::kitChanged,
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
return target->kit();
}
......
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