2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at qt-sales@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef QTVERSIONMANAGER_H
|
|
|
|
|
#define QTVERSIONMANAGER_H
|
|
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
#include <projectexplorer/environment.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
#include <QtCore/QHash>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
namespace Qt4ProjectManager {
|
2009-04-22 14:52:35 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Internal {
|
2009-04-23 13:23:46 +02:00
|
|
|
class QtOptionsPageWidget;
|
2009-04-23 16:05:51 +02:00
|
|
|
class QtOptionsPage;
|
2009-04-28 12:43:04 +02:00
|
|
|
class Qt4ProjectManagerPlugin;
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
class QtVersion
|
2009-03-20 16:13:46 +01:00
|
|
|
{
|
2009-04-23 13:23:46 +02:00
|
|
|
friend class Internal::QtOptionsPageWidget; //for changing name and path
|
2008-12-02 12:01:29 +01:00
|
|
|
friend class QtVersionManager;
|
|
|
|
|
public:
|
|
|
|
|
QtVersion(const QString &name, const QString &path);
|
|
|
|
|
QtVersion(const QString &name, const QString &path, int id, bool isSystemVersion = false);
|
|
|
|
|
QtVersion()
|
2009-05-25 16:43:50 +02:00
|
|
|
:m_name(QString::null), m_id(-1), m_toolChain(0)
|
|
|
|
|
{ setPath(QString::null); }
|
|
|
|
|
~QtVersion();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
bool isValid() const; //TOOD check that the dir exists and the name is non empty
|
|
|
|
|
bool isInstalled() const;
|
|
|
|
|
bool isSystemVersion() const { return m_isSystemVersion; }
|
|
|
|
|
|
|
|
|
|
QString name() const;
|
|
|
|
|
QString path() const;
|
|
|
|
|
QString sourcePath() const;
|
|
|
|
|
QString mkspec() const;
|
2008-12-08 12:44:28 +01:00
|
|
|
QString mkspecPath() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
QString qmakeCommand() const;
|
2009-05-12 14:12:20 +02:00
|
|
|
QString uicCommand() const;
|
2009-05-19 14:54:52 +02:00
|
|
|
QString designerCommand() const;
|
|
|
|
|
QString linguistCommand() const;
|
2009-05-25 16:43:50 +02:00
|
|
|
QString qmakeCXX() const;
|
|
|
|
|
ProjectExplorer::ToolChain *toolChain() const;
|
2009-05-19 14:54:52 +02:00
|
|
|
|
2008-12-08 14:20:35 +01:00
|
|
|
QString qtVersionString() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
|
|
|
|
|
QHash<QString,QString> versionInfo() const;
|
|
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
ProjectExplorer::ToolChain::ToolChainType toolchainType() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QString mingwDirectory() const;
|
|
|
|
|
void setMingwDirectory(const QString &directory);
|
|
|
|
|
QString msvcVersion() const;
|
2009-02-10 15:34:25 +01:00
|
|
|
QString wincePlatform() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
void setMsvcVersion(const QString &version);
|
2009-05-25 16:43:50 +02:00
|
|
|
void addToEnvironment(ProjectExplorer::Environment &env) const;
|
2009-04-23 13:48:05 +02:00
|
|
|
|
2009-03-25 15:18:37 +01:00
|
|
|
bool hasDebuggingHelper() const;
|
2009-04-24 14:59:47 +02:00
|
|
|
QString debuggingHelperLibrary() const;
|
2009-03-25 15:18:37 +01:00
|
|
|
// Builds a debugging library
|
|
|
|
|
// returns the output of the commands
|
|
|
|
|
QString buildDebuggingHelperLibrary();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
int uniqueId() const;
|
2009-05-18 10:46:12 +02:00
|
|
|
bool isMSVC64Bit() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
enum QmakeBuildConfig
|
|
|
|
|
{
|
|
|
|
|
NoBuild = 1,
|
|
|
|
|
DebugBuild = 2,
|
|
|
|
|
BuildAll = 8
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QmakeBuildConfig defaultBuildConfig() const;
|
|
|
|
|
private:
|
|
|
|
|
static int getUniqueId();
|
2009-04-23 13:48:05 +02:00
|
|
|
// Also used by QtOptionsPageWidget
|
2008-12-02 12:01:29 +01:00
|
|
|
void setName(const QString &name);
|
|
|
|
|
void setPath(const QString &path);
|
|
|
|
|
void updateSourcePath();
|
|
|
|
|
void updateMkSpec() const;
|
2009-05-25 16:43:50 +02:00
|
|
|
void updateVersionInfo() const;
|
|
|
|
|
void updateQMakeCXX() const;
|
|
|
|
|
void updateToolChain() const;
|
2009-05-19 14:54:52 +02:00
|
|
|
QString findQtBinary(const QStringList &possibleName) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
QString m_name;
|
|
|
|
|
QString m_path;
|
|
|
|
|
QString m_sourcePath;
|
|
|
|
|
QString m_mingwDirectory;
|
|
|
|
|
QString m_msvcVersion;
|
|
|
|
|
int m_id;
|
|
|
|
|
bool m_isSystemVersion;
|
2009-05-25 16:43:50 +02:00
|
|
|
bool m_hasDebuggingHelper;
|
|
|
|
|
|
|
|
|
|
mutable bool m_mkspecUpToDate;
|
|
|
|
|
mutable QString m_mkspec; // updated lazily
|
|
|
|
|
mutable QString m_mkspecFullPath;
|
|
|
|
|
|
|
|
|
|
mutable bool m_versionInfoUpToDate;
|
|
|
|
|
mutable QHash<QString,QString> m_versionInfo; // updated lazily
|
2008-12-02 12:01:29 +01:00
|
|
|
mutable bool m_notInstalled;
|
|
|
|
|
mutable bool m_defaultConfigIsDebug;
|
|
|
|
|
mutable bool m_defaultConfigIsDebugAndRelease;
|
2009-05-25 16:43:50 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
mutable QString m_qmakeCommand;
|
2009-05-25 16:43:50 +02:00
|
|
|
mutable QString m_qtVersionString;
|
2009-05-12 14:12:20 +02:00
|
|
|
mutable QString m_uicCommand;
|
2009-05-19 14:54:52 +02:00
|
|
|
mutable QString m_designerCommand;
|
|
|
|
|
mutable QString m_linguistCommand;
|
2009-05-25 16:43:50 +02:00
|
|
|
|
|
|
|
|
mutable bool m_qmakeCXXUpToDate;
|
|
|
|
|
mutable QString m_qmakeCXX;
|
|
|
|
|
|
|
|
|
|
mutable bool m_toolChainUpToDate;
|
|
|
|
|
mutable ProjectExplorer::ToolChain *m_toolChain;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
class QtVersionManager : public QObject
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2009-04-23 14:25:47 +02:00
|
|
|
// for getUniqueId();
|
|
|
|
|
friend class QtVersion;
|
2009-04-23 16:05:51 +02:00
|
|
|
friend class Internal::QtOptionsPage;
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
2009-04-22 18:05:55 +02:00
|
|
|
static QtVersionManager *instance();
|
2008-12-02 12:01:29 +01:00
|
|
|
QtVersionManager();
|
|
|
|
|
~QtVersionManager();
|
|
|
|
|
|
|
|
|
|
QList<QtVersion *> versions() const;
|
|
|
|
|
|
2009-04-23 14:25:47 +02:00
|
|
|
QtVersion *version(int id) const;
|
|
|
|
|
QtVersion *currentQtVersion() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QtVersion *qtVersionForDirectory(const QString &directory);
|
|
|
|
|
// Used by the projectloadwizard
|
|
|
|
|
void addVersion(QtVersion *version);
|
2009-04-22 18:05:55 +02:00
|
|
|
|
2009-04-23 14:25:47 +02:00
|
|
|
// Static Methods
|
|
|
|
|
static QtVersion::QmakeBuildConfig scanMakefileForQmakeConfig(const QString &directory, QtVersion::QmakeBuildConfig defaultBuildConfig);
|
|
|
|
|
static QString findQtVersionFromMakefile(const QString &directory);
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
|
|
|
|
void defaultQtVersionChanged();
|
|
|
|
|
void qtVersionsChanged();
|
|
|
|
|
private:
|
2009-04-23 14:25:47 +02:00
|
|
|
// Used by QtOptionsPage
|
|
|
|
|
void setNewQtVersions(QList<QtVersion *> newVersions, int newDefaultVersion);
|
|
|
|
|
// Used by QtVersion
|
|
|
|
|
int getUniqueId();
|
|
|
|
|
void writeVersionsIntoSettings();
|
2008-12-02 12:01:29 +01:00
|
|
|
void addNewVersionsFromInstaller();
|
|
|
|
|
void updateSystemVersion();
|
|
|
|
|
void updateDocumentation();
|
2009-04-23 16:05:51 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
static int indexOfVersionInList(const QtVersion * const version, const QList<QtVersion *> &list);
|
|
|
|
|
void updateUniqueIdToIndexMap();
|
|
|
|
|
|
|
|
|
|
QtVersion *m_emptyVersion;
|
|
|
|
|
int m_defaultVersion;
|
|
|
|
|
QList<QtVersion *> m_versions;
|
|
|
|
|
QMap<int, int> m_uniqueIdToIndex;
|
|
|
|
|
int m_idcount;
|
2009-04-28 12:43:04 +02:00
|
|
|
// managed by QtProjectManagerPlugin
|
|
|
|
|
static QtVersionManager *m_self;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
2009-04-22 18:05:55 +02:00
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
} // namespace Qt4ProjectManager
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2008-12-02 16:19:05 +01:00
|
|
|
#endif // QTVERSIONMANAGER_H
|