Commit d4e1d7c6 authored by Friedemann Kleint's avatar Friedemann Kleint

Header cleanup in Qt4ProjectManager.

Disentangle the covariant returns and introduce
convenience accessors.
Move internal classes away from Qt4Project.

Change-Id: I6c3158988824d2a159b1b3f8ecdf8432c32be2bc
Reviewed-on: http://codereview.qt.nokia.com/3216Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent 4c116bbd
......@@ -37,6 +37,8 @@
#include "subcomponentmanager.h"
#include "model/viewlogger.h"
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <itemlibraryview.h>
#include <itemlibrarywidget.h>
#include <navigatorview.h>
......
......@@ -32,6 +32,7 @@
#include "externaleditors.h"
#include "qt4project.h"
#include "qt4target.h"
#include "qt4projectmanagerconstants.h"
#include "qt4buildconfiguration.h"
......@@ -142,7 +143,7 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
// Get the binary either from the current Qt version of the project or Path
if (const Qt4Project *project = qt4ProjectFor(fileName)) {
if (const Qt4BaseTarget *target = project->activeTarget()) {
if (const Qt4BuildConfiguration *qt4bc = target->activeBuildConfiguration()) {
if (const Qt4BuildConfiguration *qt4bc = target->activeQt4BuildConfiguration()) {
if (const QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion()) {
data->binary = (qtVersion->*commandAccessor)();
data->workingDirectory = project->projectDirectory();
......
......@@ -38,6 +38,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildconfiguration.h>
......
......@@ -35,6 +35,7 @@
#include "qt4project.h"
#include "qt4target.h"
#include "qt4nodes.h"
#include "qt4buildconfiguration.h"
#include "qt4projectmanagerconstants.h"
......@@ -222,7 +223,7 @@ bool MakeStep::init()
void MakeStep::run(QFutureInterface<bool> & fi)
{
if (qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode()->projectType() == ScriptTemplate) {
if (qt4BuildConfiguration()->qt4Target()->qt4Project()->rootQt4ProjectNode()->projectType() == ScriptTemplate) {
fi.reportResult(true);
return;
}
......
......@@ -34,6 +34,8 @@
#include "wizards/targetsetuppage.h"
#include "qt4project.h"
#include <coreplugin/ifile.h>
#include <QtGui/QCheckBox>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
......
......@@ -40,6 +40,7 @@
#include "qt4projectmanagerconstants.h"
#include "qt4projectmanager.h"
#include "qt4target.h"
#include "qt4nodes.h"
#include "qt4basetargetfactory.h"
#include "ui_showbuildlog.h"
......@@ -264,7 +265,7 @@ bool QMakeStep::init()
setOutputParser(new QMakeParser);
Qt4ProFileNode *node = qt4bc->qt4Target()->qt4Project()->rootProjectNode();
Qt4ProFileNode *node = qt4bc->qt4Target()->qt4Project()->rootQt4ProjectNode();
if (qt4bc->subNodeBuild())
node = qt4bc->subNodeBuild();
QString proFile = node->path();
......
......@@ -34,16 +34,14 @@
#define QMAKESTEP_H
#include "qt4projectmanager_global.h"
#include <QtCore/qglobal.h>
#include <projectexplorer/abstractprocessstep.h>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
namespace Ui { class QMakeStep; }
QT_END_NAMESPACE
#include <projectexplorer/abstractprocessstep.h>
#include <QtCore/QStringList>
namespace ProjectExplorer {
class BuildStep;
class IBuildStepFactory;
......
......@@ -32,7 +32,9 @@
#include "qt4desktoptarget.h"
#include "qt4project.h"
#include "qt4nodes.h"
#include "qt4runconfiguration.h"
#include "qt4buildconfiguration.h"
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <QtGui/QApplication>
......@@ -58,7 +60,7 @@ QString Qt4DesktopTarget::defaultDisplayName()
return QApplication::translate("Qt4ProjectManager::Qt4Target", "Desktop", "Qt4 Desktop target display name");
}
Qt4BuildConfigurationFactory *Qt4DesktopTarget::buildConfigurationFactory() const
ProjectExplorer::IBuildConfigurationFactory *Qt4DesktopTarget::buildConfigurationFactory() const
{
return m_buildConfigurationFactory;
}
......
......@@ -38,6 +38,7 @@
namespace Qt4ProjectManager {
class Qt4Project;
class Qt4BuildConfigurationFactory;
namespace Internal {
......@@ -49,7 +50,7 @@ public:
explicit Qt4DesktopTarget(Qt4Project *parent, const QString &id);
virtual ~Qt4DesktopTarget();
Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
void createApplicationProFiles();
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
......
......@@ -42,6 +42,8 @@
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <QtGui/QVBoxLayout>
#include <QtGui/QApplication>
#include <QtGui/QStyle>
......
......@@ -529,7 +529,7 @@ bool Qt4RunConfiguration::fromMap(const QVariantMap &map)
QString Qt4RunConfiguration::executable() const
{
Qt4Project *pro = qt4Target()->qt4Project();
TargetInformation ti = pro->rootProjectNode()->targetInformation(m_proFilePath);
TargetInformation ti = pro->rootQt4ProjectNode()->targetInformation(m_proFilePath);
if (!ti.valid)
return QString();
return ti.executable;
......@@ -565,7 +565,7 @@ QString Qt4RunConfiguration::baseWorkingDirectory() const
// else what the pro file reader tells us
Qt4Project *pro = qt4Target()->qt4Project();
TargetInformation ti = pro->rootProjectNode()->targetInformation(m_proFilePath);
TargetInformation ti = pro->rootQt4ProjectNode()->targetInformation(m_proFilePath);
if(!ti.valid)
return QString();
return ti.workingDir;
......@@ -609,7 +609,7 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const
// The user could be linking to a library found via a -L/some/dir switch
// to find those libraries while actually running we explicitly prepend those
// dirs to the library search path
const Qt4ProFileNode *node = qt4Target()->qt4Project()->rootProjectNode()->findProFileFor(m_proFilePath);
const Qt4ProFileNode *node = qt4Target()->qt4Project()->rootQt4ProjectNode()->findProFileFor(m_proFilePath);
if (node) {
const QStringList libDirectories = node->variableValue(LibDirectoriesVar);
if (!libDirectories.isEmpty()) {
......@@ -676,7 +676,7 @@ QString Qt4RunConfiguration::proFilePath() const
QString Qt4RunConfiguration::dumperLibrary() const
{
QtSupport::BaseQtVersion *version = qt4Target()->activeBuildConfiguration()->qtVersion();
QtSupport::BaseQtVersion *version = qt4Target()->activeQt4BuildConfiguration()->qtVersion();
if (version)
return version->gdbDebuggingHelperLibrary();
return QString();
......@@ -684,7 +684,7 @@ QString Qt4RunConfiguration::dumperLibrary() const
QStringList Qt4RunConfiguration::dumperLibraryLocations() const
{
QtSupport::BaseQtVersion *version = qt4Target()->activeBuildConfiguration()->qtVersion();
QtSupport::BaseQtVersion *version = qt4Target()->activeQt4BuildConfiguration()->qtVersion();
if (version)
return version->debuggingHelperLibraryLocations();
return QStringList();
......
......@@ -32,7 +32,9 @@
#include "qt4simulatortarget.h"
#include "qt4project.h"
#include "qt4nodes.h"
#include "qt4runconfiguration.h"
#include "qt4buildconfiguration.h"
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <projectexplorer/deployconfiguration.h>
......@@ -63,7 +65,7 @@ QString Qt4SimulatorTarget::defaultDisplayName()
return QApplication::translate("Qt4ProjectManager::Qt4Target", "Qt Simulator", "Qt4 Simulator target display name");
}
Qt4BuildConfigurationFactory *Qt4SimulatorTarget::buildConfigurationFactory() const
ProjectExplorer::IBuildConfigurationFactory *Qt4SimulatorTarget::buildConfigurationFactory() const
{
return m_buildConfigurationFactory;
}
......
......@@ -38,6 +38,7 @@
namespace Qt4ProjectManager {
class Qt4Project;
class Qt4BuildConfigurationFactory;
namespace Internal {
......@@ -49,7 +50,7 @@ public:
explicit Qt4SimulatorTarget(Qt4Project *parent, const QString &id);
virtual ~Qt4SimulatorTarget();
Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
void createApplicationProFiles();
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
......
......@@ -36,6 +36,7 @@
#include "qt4project.h"
#include "qt4runconfiguration.h"
#include "qt4simulatortarget.h"
#include <qtsupport/qtversionmanager.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
......
......@@ -33,6 +33,9 @@
#include "qt4symbiantarget.h"
#include "qt4projectmanagerconstants.h"
#include "qt4project.h"
#include "qt4nodes.h"
#include "qt4buildconfiguration.h"
#include "qt-s60/s60deployconfiguration.h"
#include "qt-s60/s60emulatorrunconfiguration.h"
#include "qt-s60/s60devicerunconfiguration.h"
......@@ -87,7 +90,7 @@ QIcon Qt4SymbianTarget::iconForId(const QString &id)
return QIcon();
}
Qt4BuildConfigurationFactory *Qt4SymbianTarget::buildConfigurationFactory() const
ProjectExplorer::IBuildConfigurationFactory *Qt4SymbianTarget::buildConfigurationFactory() const
{
return m_buildConfigurationFactory;
}
......
......@@ -39,6 +39,7 @@
namespace Qt4ProjectManager {
class Qt4Project;
class Qt4BuildConfigurationFactory;
namespace Internal {
......@@ -50,7 +51,7 @@ public:
explicit Qt4SymbianTarget(Qt4Project *parent, const QString &id);
virtual ~Qt4SymbianTarget();
Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
......
......@@ -46,6 +46,8 @@
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <projectexplorer/toolchainmanager.h>
#include <qtsupport/qtversionmanager.h>
using ProjectExplorer::idFromMap;
using ProjectExplorer::Task;
using namespace Qt4ProjectManager;
......
......@@ -35,6 +35,7 @@
#include "s60manager.h"
#include "qt4project.h"
#include "qt4target.h"
#include "qt4nodes.h"
#include "qt4projectmanagerconstants.h"
#include "qt4buildconfiguration.h"
#include "qt4symbiantarget.h"
......@@ -267,7 +268,7 @@ ProjectExplorer::ToolChain *S60DeployConfiguration::toolChain() const
bool S60DeployConfiguration::isDebug() const
{
const Qt4BuildConfiguration *qt4bc = qt4Target()->activeBuildConfiguration();
const Qt4BuildConfiguration *qt4bc = qt4Target()->activeQt4BuildConfiguration();
return (qt4bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild);
}
......@@ -278,7 +279,7 @@ QString S60DeployConfiguration::symbianTarget() const
const QtSupport::BaseQtVersion *S60DeployConfiguration::qtVersion() const
{
if (const Qt4BuildConfiguration *qt4bc = qt4Target()->activeBuildConfiguration())
if (const Qt4BuildConfiguration *qt4bc = qt4Target()->activeQt4BuildConfiguration())
return qt4bc->qtVersion();
return 0;
}
......
......@@ -41,6 +41,7 @@
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/project.h>
#include <projectexplorer/buildconfiguration.h>
#include <utils/qtcassert.h>
#include <QtCore/QFileInfo>
......
......@@ -33,9 +33,11 @@
#include "s60devicerunconfiguration.h"
#include "qt4project.h"
#include "qt4nodes.h"
#include "qt4projectmanagerconstants.h"
#include "qt4symbiantarget.h"
#include "qt4target.h"
#include "qt4buildconfiguration.h"
#include "s60deployconfiguration.h"
#include "s60devicerunconfigurationwidget.h"
#include "s60manager.h"
......@@ -191,7 +193,7 @@ static inline QString fixBaseNameTarget(const QString &in)
QString S60DeviceRunConfiguration::targetName() const
{
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(projectFilePath());
TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()->targetInformation(projectFilePath());
if (!ti.valid)
return QString();
return ti.target;
......@@ -207,7 +209,7 @@ SymbianQtVersion *S60DeviceRunConfiguration::qtVersion() const
bool S60DeviceRunConfiguration::isDebug() const
{
const Qt4BuildConfiguration *qt4bc = qt4Target()->activeBuildConfiguration();
const Qt4BuildConfiguration *qt4bc = qt4Target()->activeQt4BuildConfiguration();
return (qt4bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild);
}
......@@ -237,7 +239,7 @@ static inline QString localExecutableFromVersion(const SymbianQtVersion *qtv,
QString S60DeviceRunConfiguration::localExecutableFileName() const
{
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(projectFilePath());
TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()->targetInformation(projectFilePath());
if (!ti.valid)
return QString();
......
......@@ -34,9 +34,11 @@
#include "qt4project.h"
#include "qt4target.h"
#include "qt4nodes.h"
#include "s60manager.h"
#include "qt4symbiantarget.h"
#include "qt4projectmanagerconstants.h"
#include "qt4buildconfiguration.h"
#include <projectexplorer/projectexplorerconstants.h>
......@@ -178,7 +180,7 @@ QString S60EmulatorRunConfiguration::executable() const
{
if (!qt4Target())
return QString();
Qt4BuildConfiguration *qt4bc = qt4Target()->activeBuildConfiguration();
Qt4BuildConfiguration *qt4bc = qt4Target()->activeQt4BuildConfiguration();
if (!qt4bc)
return QString();
QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion();
......@@ -190,7 +192,7 @@ QString S60EmulatorRunConfiguration::executable() const
qmakeBuildConfig = "udeb";
baseDir += "/epoc32/release/winscw/" + qmakeBuildConfig;
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath);
TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()->targetInformation(m_proFilePath);
if (!ti.valid)
return QString();
QString executable = QDir::toNativeSeparators(QDir::cleanPath(baseDir + QLatin1Char('/') + ti.target));
......
......@@ -39,6 +39,7 @@
#include "qmakestep.h"
#include "makestep.h"
#include "qt4project.h"
#include "qt4nodes.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildstep.h>
......@@ -138,7 +139,7 @@ void S60PublisherOvi::completeCreation()
m_qt4project = m_activeTargetOfProject->qt4Project();
// set up pro file reader
m_reader = m_qt4project->createProFileReader(m_qt4project->rootProjectNode(), m_qt4bc);
m_reader = m_qt4project->createProFileReader(m_qt4project->rootQt4ProjectNode(), m_qt4bc);
//m_reader->setCumulative(false); // todo need to reenable that, after fixing parsing for symbian scopes
ProFile *profile = m_reader->parsedProFile(m_qt4project->rootProjectNode()->path());
......@@ -215,7 +216,7 @@ void S60PublisherOvi::completeCreation()
bool S60PublisherOvi::isDynamicLibrary(const Qt4Project &project) const
{
Qt4ProFileNode *proFile = project.rootProjectNode();
Qt4ProFileNode *proFile = project.rootQt4ProjectNode();
if (proFile->projectType() == LibraryTemplate) {
const QStringList &config(proFile->variableValue(ConfigVar));
if (!config.contains(QLatin1String("static")) && !config.contains(QLatin1String("staticlib")))
......
......@@ -49,7 +49,7 @@
#include <projectexplorer/toolchainmanager.h>
#include <qtsupport/qtversionfactory.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtversionmanager.h>
#include <QtCore/QDebug>
#include <QtGui/QInputDialog>
......@@ -327,7 +327,7 @@ QString Qt4BuildConfiguration::defaultMakeTarget() const
QString Qt4BuildConfiguration::makefile() const
{
return qt4Target()->qt4Project()->rootProjectNode()->makefile();
return qt4Target()->qt4Project()->rootQt4ProjectNode()->makefile();
}
QtSupport::BaseQtVersion *Qt4BuildConfiguration::qtVersion() const
......
......@@ -36,7 +36,7 @@
#include "qt4projectmanager_global.h"
#include <projectexplorer/buildconfiguration.h>
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/baseqtversion.h>
namespace ProjectExplorer {
class ToolChain;
......
......@@ -32,12 +32,15 @@
#include "qt4nodes.h"
#include "qt4project.h"
#include "qt4target.h"
#include "qt4projectmanager.h"
#include "qt4projectmanagerconstants.h"
#include "qtuicodemodelsupport.h"
#include "qmakestep.h"
#include "qt4buildconfiguration.h"
#include <projectexplorer/nodesvisitor.h>
#include <projectexplorer/runconfiguration.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
......@@ -653,9 +656,9 @@ void Qt4PriFileNode::watchFolders(const QSet<QString> &folders)
toWatch.subtract(m_watchedFolders);
if (!toUnwatch.isEmpty())
m_project->centralizedFolderWatcher()->unwatchFolders(toUnwatch.toList(), this);
m_project->unwatchFolders(toUnwatch.toList(), this);
if (!toWatch.isEmpty())
m_project->centralizedFolderWatcher()->watchFolders(toWatch.toList(), this);
m_project->watchFolders(toWatch.toList(), this);
m_watchedFolders = folders;
}
......@@ -2086,7 +2089,7 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
// Hmm can we find out whether it's debug or release in a saner way?
// Theoretically it's in CONFIG
QString qmakeBuildConfig = "release";
if (m_project->activeTarget()->activeBuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)
if (m_project->activeTarget()->activeQt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)
qmakeBuildConfig = "debug";
wd += QLatin1Char('/') + qmakeBuildConfig;
}
......@@ -2213,7 +2216,7 @@ QString Qt4ProFileNode::buildDir(Qt4BuildConfiguration *bc) const
const QDir srcDirRoot = QFileInfo(m_project->rootProjectNode()->path()).absoluteDir();
const QString relativeDir = srcDirRoot.relativeFilePath(m_projectDir);
if (!bc && m_project->activeTarget())
bc = m_project->activeTarget()->activeBuildConfiguration();
bc = m_project->activeTarget()->activeQt4BuildConfiguration();
if (!bc)
return QString();
return QDir(bc->buildDirectory()).absoluteFilePath(relativeDir);
......
......@@ -33,19 +33,16 @@
#ifndef QT4NODES_H
#define QT4NODES_H
#include "qt4buildconfiguration.h"
#include "qt4projectmanager_global.h"
#include <coreplugin/ifile.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/project.h>
#include <projectexplorer/runconfiguration.h>
#include <QtCore/QHash>
#include <QtCore/QStringList>
#include <QtCore/QDateTime>
#include <QtCore/QMap>
#include <QtCore/QFutureWatcher>
#include <QtCore/QFileSystemWatcher>
// defined in proitems.h
QT_BEGIN_NAMESPACE
......@@ -60,8 +57,13 @@ namespace QtSupport {
class ProFileReader;
}
namespace Qt4ProjectManager {
namespace ProjectExplorer {
class RunConfiguration;
class Project;
}
namespace Qt4ProjectManager {
class Qt4BuildConfiguration;
class Qt4ProFileNode;
class Qt4Project;
......
......@@ -33,6 +33,7 @@
#include "qt4project.h"
#include "qt4projectmanager.h"
#include "qt4target.h"
#include "makestep.h"
#include "qmakestep.h"
#include "qt4nodes.h"
......@@ -43,6 +44,7 @@
#include "findqt4profiles.h"
#include <coreplugin/icore.h>
#include <coreplugin/ifile.h>
#include <coreplugin/icontext.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/coreconstants.h>
......@@ -52,6 +54,7 @@
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/headerpath.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildenvironmentwidget.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <projectexplorer/projectexplorer.h>
......@@ -63,6 +66,7 @@
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileSystemWatcher>
#include <QtGui/QFileDialog>
#include <QtGui/QInputDialog>
......@@ -75,6 +79,62 @@ enum { debug = 0 };
namespace Qt4ProjectManager {
namespace Internal {
class Qt4ProjectFile : public Core::IFile
{
Q_OBJECT
public:
Qt4ProjectFile(Qt4Project *project, const QString &filePath, QObject *parent = 0);
bool save(QString *errorString, const QString &fileName, bool autoSave);
QString fileName() const;
virtual void rename(const QString &newName);
QString defaultPath() const;
QString suggestedFileName() const;
virtual QString mimeType() const;
bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
private:
const QString m_mimeType;
Qt4Project *m_project;
QString m_filePath;
};
/// Watches folders for Qt4PriFile nodes
/// use one file system watcher to watch all folders
/// such minimizing system ressouce usage
class CentralizedFolderWatcher : public QObject
{
Q_OBJECT