| 
									
										
										
										
											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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 16:19:05 +01:00
										 |  |  | #include "ui_qtversionmanager.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <coreplugin/dialogs/ioptionspage.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-14 15:08:46 +01:00
										 |  |  | #include <projectexplorer/projectexplorer.h>
 | 
					
						
							| 
									
										
										
										
											2009-02-10 15:34:25 +01:00
										 |  |  | #include <projectexplorer/toolchain.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 16:19:05 +01:00
										 |  |  | #include <QtCore/QPointer>
 | 
					
						
							|  |  |  | #include <QtGui/QWidget>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Qt4ProjectManager { | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QtDirWidget; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-20 16:13:46 +01:00
										 |  |  | class QtVersion | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     friend class QtDirWidget; //for changing name and path
 | 
					
						
							|  |  |  |     friend class QtVersionManager; | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     QtVersion(const QString &name, const QString &path); | 
					
						
							|  |  |  |     QtVersion(const QString &name, const QString &path, int id, bool isSystemVersion = false); | 
					
						
							|  |  |  |     QtVersion() | 
					
						
							|  |  |  |         :m_name(QString::null), m_path(QString::null), m_id(-1) | 
					
						
							|  |  |  |     { } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     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; | 
					
						
							| 
									
										
										
										
											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 prependPath() const; | 
					
						
							|  |  |  |     void setPrependPath(const QString &string); | 
					
						
							|  |  |  |     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-02-10 15:34:25 +01:00
										 |  |  |     void addToEnvironment(ProjectExplorer::Environment &env); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     int uniqueId() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     enum QmakeBuildConfig | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         NoBuild = 1, | 
					
						
							|  |  |  |         DebugBuild = 2, | 
					
						
							|  |  |  |         BuildAll = 8 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QmakeBuildConfig defaultBuildConfig() const; | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     static int getUniqueId(); | 
					
						
							|  |  |  |     void setName(const QString &name); | 
					
						
							|  |  |  |     void setPath(const QString &path); | 
					
						
							|  |  |  |     void updateSourcePath(); | 
					
						
							|  |  |  |     void updateVersionInfo() const; | 
					
						
							|  |  |  |     void updateMkSpec() const; | 
					
						
							|  |  |  |     QString m_name; | 
					
						
							|  |  |  |     mutable bool m_versionInfoUpToDate; | 
					
						
							|  |  |  |     mutable bool m_mkspecUpToDate; | 
					
						
							|  |  |  |     QString m_path; | 
					
						
							|  |  |  |     QString m_sourcePath; | 
					
						
							|  |  |  |     mutable QString m_mkspec; // updated lazily
 | 
					
						
							| 
									
										
										
										
											2008-12-08 12:44:28 +01:00
										 |  |  |     mutable QString m_mkspecFullPath; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QString m_mingwDirectory; | 
					
						
							|  |  |  |     QString m_prependPath; | 
					
						
							|  |  |  |     QString m_msvcVersion; | 
					
						
							|  |  |  |     mutable QHash<QString,QString> m_versionInfo; // updated lazily
 | 
					
						
							|  |  |  |     int m_id; | 
					
						
							|  |  |  |     bool m_isSystemVersion; | 
					
						
							|  |  |  |     mutable bool m_notInstalled; | 
					
						
							|  |  |  |     mutable bool m_defaultConfigIsDebug; | 
					
						
							|  |  |  |     mutable bool m_defaultConfigIsDebugAndRelease; | 
					
						
							|  |  |  |     mutable QString m_qmakeCommand; | 
					
						
							| 
									
										
										
										
											2008-12-08 14:20:35 +01:00
										 |  |  |     // This is updated on first call to qmakeCommand
 | 
					
						
							|  |  |  |     // That function is called from updateVersionInfo()
 | 
					
						
							|  |  |  |     mutable QString m_qtVersionString; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QtDirWidget : public QWidget | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defaultVersion); | 
					
						
							| 
									
										
										
										
											2009-02-04 16:55:01 +01:00
										 |  |  |     ~QtDirWidget(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QList<QtVersion *> versions() const; | 
					
						
							|  |  |  |     int defaultVersion() const; | 
					
						
							|  |  |  |     void finish(); | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     void showEnvironmentPage(QTreeWidgetItem * item); | 
					
						
							|  |  |  |     void fixQtVersionName(int index); | 
					
						
							|  |  |  |     Ui::QtVersionManager m_ui; | 
					
						
							|  |  |  |     QList<QtVersion *> m_versions; | 
					
						
							|  |  |  |     int m_defaultVersion; | 
					
						
							|  |  |  |     QString m_specifyNameString; | 
					
						
							|  |  |  |     QString m_specifyPathString; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							|  |  |  |     void versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old); | 
					
						
							|  |  |  |     void addQtDir(); | 
					
						
							|  |  |  |     void removeQtDir(); | 
					
						
							|  |  |  |     void updateState(); | 
					
						
							| 
									
										
										
										
											2008-12-19 15:32:21 +01:00
										 |  |  |     void makeMingwVisible(bool visible); | 
					
						
							|  |  |  |     void onQtBrowsed(); | 
					
						
							|  |  |  |     void onMingwBrowsed(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     void defaultChanged(int index); | 
					
						
							|  |  |  |     void updateCurrentQtName(); | 
					
						
							|  |  |  |     void updateCurrentQtPath(); | 
					
						
							|  |  |  |     void updateCurrentMingwDirectory(); | 
					
						
							|  |  |  |     void msvcVersionChanged(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QtVersionManager : public Core::IOptionsPage | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     QtVersionManager(); | 
					
						
							|  |  |  |     ~QtVersionManager(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-18 16:43:01 +01:00
										 |  |  |     QString id() const; | 
					
						
							|  |  |  |     QString trName() const; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QString category() const; | 
					
						
							|  |  |  |     QString trCategory() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QWidget *createPage(QWidget *parent); | 
					
						
							| 
									
										
										
										
											2009-01-13 15:41:33 +01:00
										 |  |  |     void apply(); | 
					
						
							|  |  |  |     void finish() { } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void writeVersionsIntoSettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<QtVersion *> versions() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QtVersion * version(int id) const; | 
					
						
							|  |  |  |     QtVersion * currentQtVersion() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // internal
 | 
					
						
							|  |  |  |     int getUniqueId(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QtVersion::QmakeBuildConfig scanMakefileForQmakeConfig(const QString &directory, QtVersion::QmakeBuildConfig defaultBuildConfig); | 
					
						
							|  |  |  |     QString findQtVersionFromMakefile(const QString &directory); | 
					
						
							|  |  |  |     QtVersion *qtVersionForDirectory(const QString &directory); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Used by the projectloadwizard
 | 
					
						
							|  |  |  |     void addVersion(QtVersion *version); | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     // returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion)
 | 
					
						
							|  |  |  |     static QStringList possibleQMakeCommands(); | 
					
						
							|  |  |  |     // return true if the qmake at qmakePath is qt4 (used by QtVersion)
 | 
					
						
							| 
									
										
										
										
											2008-12-08 14:20:35 +01:00
										 |  |  |     static QString qtVersionForQMake(const QString &qmakePath); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | signals: | 
					
						
							|  |  |  |     void defaultQtVersionChanged(); | 
					
						
							|  |  |  |     void qtVersionsChanged(); | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void addNewVersionsFromInstaller(); | 
					
						
							|  |  |  |     void updateSystemVersion(); | 
					
						
							|  |  |  |     void updateDocumentation(); | 
					
						
							|  |  |  |     QString findSystemQt() const; | 
					
						
							|  |  |  |     static int indexOfVersionInList(const QtVersion * const version, const QList<QtVersion *> &list); | 
					
						
							|  |  |  |     void updateUniqueIdToIndexMap(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QPointer<QtDirWidget> m_widget; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QtVersion *m_emptyVersion; | 
					
						
							|  |  |  |     int m_defaultVersion; | 
					
						
							|  |  |  |     QList<QtVersion *> m_versions; | 
					
						
							|  |  |  |     QMap<int, int> m_uniqueIdToIndex; | 
					
						
							|  |  |  |     int m_idcount; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 16:19:05 +01:00
										 |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace Qt4ProjectManager
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 16:19:05 +01:00
										 |  |  | #endif // QTVERSIONMANAGER_H
 |