2009-02-25 09:15:00 +01:00
/**************************************************************************
2008-12-02 12:01:29 +01:00
* *
* * This file is part of Qt Creator
* *
2011-01-11 16:28:15 +01:00
* * Copyright ( c ) 2011 Nokia Corporation and / or its subsidiary ( - ies ) .
2008-12-02 12:01:29 +01:00
* *
2009-06-17 00:01:27 +10:00
* * Contact : Nokia Corporation ( qt - info @ nokia . com )
2008-12-02 12:01:29 +01:00
* *
2010-12-17 16:01:08 +01:00
* * No Commercial Usage
2008-12-02 14:17:16 +01:00
* *
2010-12-17 16:01:08 +01:00
* * This file contains pre - release code and may not be distributed .
* * You may use this file in accordance with the terms and conditions
* * contained in the Technology Preview License Agreement accompanying
* * this package .
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
* *
2010-12-17 16:01:08 +01:00
* * In addition , as a special exception , Nokia gives you certain additional
* * rights . These rights are described in the Nokia Qt LGPL Exception
* * version 1.1 , included in the file LGPL_EXCEPTION . txt in this package .
* *
* * If you have questions regarding the use of this file , please contact
* * Nokia at qt - info @ 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
# include "qtversionmanager.h"
2008-12-02 16:19:05 +01:00
2009-04-28 12:43:04 +02:00
# include "qt4projectmanagerconstants.h"
2010-02-08 15:50:06 +01:00
# include "qt4target.h"
2009-05-25 16:43:50 +02:00
# include "profilereader.h"
2008-12-02 12:01:29 +01:00
2011-01-19 10:16:47 +01:00
# include "qt-maemo/maemoglobal.h"
2009-10-16 17:33:12 +02:00
# include "qt-maemo/maemomanager.h"
2010-02-08 17:51:58 +01:00
# include "qt-s60/s60manager.h"
2010-04-19 16:07:55 +02:00
# include "qt-s60/s60projectchecker.h"
2010-12-06 12:18:38 +01:00
# include "qt-s60/abldparser.h"
# include "qt-s60/sbsv2parser.h"
2011-02-01 18:36:00 +01:00
# include "qt-s60/gccetoolchain.h"
# include "qt-s60/winscwtoolchain.h"
2009-05-28 18:36:52 +02:00
2010-09-27 17:22:57 +02:00
# include "qmlobservertool.h"
2010-09-27 15:51:49 +02:00
# include "qmldumptool.h"
2011-01-12 16:24:00 +01:00
# include "qmldebugginglibrary.h"
2009-04-28 12:43:04 +02:00
# include <projectexplorer/debugginghelper.h>
2010-12-06 12:18:38 +01:00
# include <projectexplorer/gnumakeparser.h>
2009-04-28 12:43:04 +02:00
# include <projectexplorer/projectexplorer.h>
2010-04-19 16:07:55 +02:00
# include <projectexplorer/projectexplorerconstants.h>
2011-02-01 18:36:00 +01:00
# include <projectexplorer/toolchainmanager.h>
2009-04-28 12:43:04 +02:00
# include <projectexplorer/cesdkhandler.h>
2011-02-01 18:36:00 +01:00
# include <projectexplorer/gcctoolchain.h>
# include <projectexplorer/toolchainmanager.h>
2011-02-28 16:50:14 +01:00
# include <projectexplorer/headerpath.h>
# include <projectexplorer/ioutputparser.h>
# include <projectexplorer/task.h>
2009-05-28 18:15:02 +02:00
# include <coreplugin/coreconstants.h>
2009-01-20 11:52:04 +01:00
# include <coreplugin/icore.h>
2010-06-11 13:11:37 +02:00
# include <coreplugin/helpmanager.h>
2011-02-28 16:50:14 +01:00
2009-01-19 12:39:20 +01:00
# include <extensionsystem/pluginmanager.h>
2011-02-28 16:50:14 +01:00
# include <utils/synchronousprocess.h>
2008-12-09 15:25:01 +01:00
# include <utils/qtcassert.h>
2010-10-19 11:14:03 +02:00
# include <utils/qtcprocess.h>
2010-11-03 09:17:02 +01:00
# ifdef Q_OS_WIN
# include <utils / winutils.h>
# endif
2008-12-02 12:01:29 +01:00
2010-02-24 14:10:36 +01:00
# include <QtCore/QFile>
2008-12-09 15:25:01 +01:00
# include <QtCore/QProcess>
2008-12-02 12:01:29 +01:00
# include <QtCore/QSettings>
# include <QtCore/QTime>
2009-07-27 13:55:30 +02:00
# include <QtCore/QTimer>
2009-10-27 18:05:04 +01:00
# include <QtCore/QTextStream>
2009-11-19 16:50:58 +01:00
# include <QtCore/QDir>
2009-03-25 15:18:37 +01:00
# include <QtGui/QApplication>
# include <QtGui/QDesktopServices>
2008-12-02 12:01:29 +01:00
2009-04-28 12:43:04 +02:00
using namespace Qt4ProjectManager ;
using namespace Qt4ProjectManager : : Internal ;
using ProjectExplorer : : DebuggingHelperLibrary ;
2008-12-02 12:01:29 +01:00
static const char * QtVersionsSectionName = " QtVersions " ;
static const char * newQtVersionsKey = " NewQtVersions " ;
2009-05-28 11:48:33 +02:00
static const char * PATH_AUTODETECTION_SOURCE = " PATH " ;
2008-12-02 12:01:29 +01:00
2009-08-17 11:49:59 +02:00
enum { debug = 0 } ;
2011-02-01 18:36:00 +01:00
template < class T >
static T * createToolChain ( const QString & id )
{
QList < ProjectExplorer : : ToolChainFactory * > factories =
ExtensionSystem : : PluginManager : : instance ( ) - > getObjects < ProjectExplorer : : ToolChainFactory > ( ) ;
foreach ( ProjectExplorer : : ToolChainFactory * f , factories ) {
if ( f - > id ( ) = = id ) {
Q_ASSERT ( f - > canCreate ( ) ) ;
return static_cast < T * > ( f - > create ( ) ) ;
}
}
return 0 ;
}
2011-02-21 12:16:20 +01:00
// prefer newer qts otherwise compare on id
bool qtVersionNumberCompare ( QtVersion * a , QtVersion * b )
{
return a - > qtVersion ( ) > b - > qtVersion ( ) | | ( a - > qtVersion ( ) = = b - > qtVersion ( ) & & a - > uniqueId ( ) < b - > uniqueId ( ) ) ;
}
2011-02-01 18:36:00 +01:00
// --------------------------------------------------------------------------
// QtVersionManager
// --------------------------------------------------------------------------
2009-04-28 12:43:04 +02:00
QtVersionManager * QtVersionManager : : m_self = 0 ;
2009-03-25 15:18:37 +01:00
2008-12-02 12:01:29 +01:00
QtVersionManager : : QtVersionManager ( )
: m_emptyVersion ( new QtVersion )
{
2009-05-27 18:42:27 +02:00
m_self = this ;
2009-01-20 11:52:04 +01:00
QSettings * s = Core : : ICore : : instance ( ) - > settings ( ) ;
2008-12-02 12:01:29 +01:00
m_idcount = 1 ;
int size = s - > beginReadArray ( QtVersionsSectionName ) ;
for ( int i = 0 ; i < size ; + + i ) {
s - > setArrayIndex ( i ) ;
// Find the right id
// Either something saved or something generated
// Note: This code assumes that either all ids are read from the settings
// or generated on the fly.
int id = s - > value ( " Id " , - 1 ) . toInt ( ) ;
if ( id = = - 1 )
id = getUniqueId ( ) ;
2009-10-01 18:51:42 +02:00
else if ( m_idcount < id )
m_idcount = id + 1 ;
2009-05-28 11:31:35 +02:00
bool isAutodetected ;
2009-05-28 11:48:33 +02:00
QString autodetectionSource ;
if ( s - > contains ( " isAutodetected " ) ) {
2009-05-28 11:31:35 +02:00
isAutodetected = s - > value ( " isAutodetected " , false ) . toBool ( ) ;
2009-05-28 11:48:33 +02:00
autodetectionSource = s - > value ( " autodetectionSource " , QString ( ) ) . toString ( ) ;
} else { // compatibility
2009-05-28 11:31:35 +02:00
isAutodetected = s - > value ( " IsSystemVersion " , false ) . toBool ( ) ;
2009-05-28 11:48:33 +02:00
if ( isAutodetected )
autodetectionSource = QLatin1String ( PATH_AUTODETECTION_SOURCE ) ;
}
2009-09-03 19:16:22 +02:00
QString qmakePath = s - > value ( " QMakePath " ) . toString ( ) ;
if ( qmakePath . isEmpty ( ) ) {
QString path = s - > value ( " Path " ) . toString ( ) ;
2009-09-04 09:52:14 +02:00
if ( ! path . isEmpty ( ) ) {
foreach ( const QString & command , ProjectExplorer : : DebuggingHelperLibrary : : possibleQMakeCommands ( ) )
{
QFileInfo fi ( path + " /bin/ " + command ) ;
if ( fi . exists ( ) )
{
qmakePath = fi . filePath ( ) ;
break ;
}
}
}
2009-09-03 19:16:22 +02:00
}
2008-12-02 12:01:29 +01:00
QtVersion * version = new QtVersion ( s - > value ( " Name " ) . toString ( ) ,
2009-09-03 19:16:22 +02:00
qmakePath ,
2008-12-02 12:01:29 +01:00
id ,
2009-05-28 11:48:33 +02:00
isAutodetected ,
autodetectionSource ) ;
2011-03-08 12:57:12 +01:00
version - > setSystemRoot ( s - > value ( " S60SDKDirectory " ) . toString ( ) ) ;
2010-11-15 15:24:17 +01:00
version - > setSbsV2Directory ( s - > value ( QLatin1String ( " SBSv2Directory " ) ) . toString ( ) ) ;
2011-02-01 18:36:00 +01:00
// Update from 2.1 or earlier:
QString mingwDir = s - > value ( QLatin1String ( " MingwDirectory " ) ) . toString ( ) ;
if ( ! mingwDir . isEmpty ( ) ) {
2011-03-15 17:23:17 +01:00
QFileInfo fi ( mingwDir + QLatin1String ( " /bin/g++.exe " ) ) ;
if ( fi . exists ( ) & & fi . isExecutable ( ) ) {
ProjectExplorer : : MingwToolChain * tc = createToolChain < ProjectExplorer : : MingwToolChain > ( ProjectExplorer : : Constants : : MINGW_TOOLCHAIN_ID ) ;
if ( tc ) {
tc - > setCompilerPath ( fi . absoluteFilePath ( ) ) ;
tc - > setDisplayName ( tr ( " MinGW from %1 " ) . arg ( version - > displayName ( ) ) ) ;
ProjectExplorer : : ToolChainManager : : instance ( ) - > registerToolChain ( tc ) ;
}
2011-02-01 18:36:00 +01:00
}
}
QString mwcDir = s - > value ( QLatin1String ( " MwcDirectory " ) ) . toString ( ) ;
if ( ! mwcDir . isEmpty ( ) ) {
2011-03-15 17:23:17 +01:00
QFileInfo fi ( mwcDir + QLatin1String ( " /x86Build/Symbian_Tools/Command_Line_Tools/mwwinrc.exe " ) ) ;
if ( fi . exists ( ) & & fi . isExecutable ( ) ) {
WinscwToolChain * tc = createToolChain < WinscwToolChain > ( Constants : : WINSCW_TOOLCHAIN_ID ) ;
if ( tc ) {
tc - > setCompilerPath ( fi . absoluteFilePath ( ) ) ;
tc - > setDisplayName ( tr ( " WINSCW from %1 " ) . arg ( version - > displayName ( ) ) ) ;
ProjectExplorer : : ToolChainManager : : instance ( ) - > registerToolChain ( tc ) ;
}
2011-02-01 18:36:00 +01:00
}
}
QString gcceDir = s - > value ( QLatin1String ( " GcceDirectory " ) ) . toString ( ) ;
if ( ! gcceDir . isEmpty ( ) ) {
2011-03-15 17:23:17 +01:00
QFileInfo fi ( gcceDir + QLatin1String ( " /bin/arm-none-symbianelf-g++.exe " ) ) ;
if ( fi . exists ( ) & & fi . isExecutable ( ) ) {
GcceToolChain * tc = createToolChain < GcceToolChain > ( Constants : : GCCE_TOOLCHAIN_ID ) ;
if ( tc ) {
tc - > setCompilerPath ( fi . absoluteFilePath ( ) ) ;
tc - > setDisplayName ( tr ( " GCCE from %1 " ) . arg ( version - > displayName ( ) ) ) ;
ProjectExplorer : : ToolChainManager : : instance ( ) - > registerToolChain ( tc ) ;
}
2011-02-01 18:36:00 +01:00
}
}
2011-02-21 12:16:20 +01:00
m_versions . insert ( version - > uniqueId ( ) , version ) ;
2008-12-02 12:01:29 +01:00
}
s - > endArray ( ) ;
+ + m_idcount ;
addNewVersionsFromInstaller ( ) ;
updateSystemVersion ( ) ;
2009-07-27 13:55:30 +02:00
// cannot call from ctor, needs to get connected extenernally first
2011-03-08 12:57:12 +01:00
QTimer : : singleShot ( 0 , this , SLOT ( updateSettings ( ) ) ) ;
2008-12-02 12:01:29 +01:00
}
QtVersionManager : : ~ QtVersionManager ( )
{
qDeleteAll ( m_versions ) ;
m_versions . clear ( ) ;
delete m_emptyVersion ;
m_emptyVersion = 0 ;
}
2009-04-22 18:05:55 +02:00
QtVersionManager * QtVersionManager : : instance ( )
2009-04-22 16:51:38 +02:00
{
2009-04-28 12:43:04 +02:00
return m_self ;
2009-04-22 16:51:38 +02:00
}
2008-12-02 12:01:29 +01:00
void QtVersionManager : : addVersion ( QtVersion * version )
{
2009-10-12 15:31:20 +02:00
QTC_ASSERT ( version ! = 0 , return ) ;
2011-02-21 12:16:20 +01:00
if ( m_versions . contains ( version - > uniqueId ( ) ) )
2010-03-26 10:37:05 +01:00
return ;
2009-12-03 18:37:27 +01:00
int uniqueId = version - > uniqueId ( ) ;
2011-02-21 12:16:20 +01:00
m_versions . insert ( uniqueId , version ) ;
2009-12-03 18:37:27 +01:00
emit qtVersionsChanged ( QList < int > ( ) < < uniqueId ) ;
2009-02-05 16:22:32 +01:00
writeVersionsIntoSettings ( ) ;
2008-12-02 12:01:29 +01:00
}
2009-05-28 13:22:23 +02:00
void QtVersionManager : : removeVersion ( QtVersion * version )
{
2009-10-12 15:31:20 +02:00
QTC_ASSERT ( version ! = 0 , return ) ;
2011-02-21 12:16:20 +01:00
m_versions . remove ( version - > uniqueId ( ) ) ;
emit qtVersionsChanged ( QList < int > ( ) < < version - > uniqueId ( ) ) ;
2009-05-28 13:22:23 +02:00
writeVersionsIntoSettings ( ) ;
delete version ;
}
2010-02-08 15:50:06 +01:00
bool QtVersionManager : : supportsTargetId ( const QString & id ) const
{
2011-03-10 17:55:02 +01:00
QList < QtVersion * > versions = QtVersionManager : : instance ( ) - > versionsForTargetId ( id ) ;
foreach ( QtVersion * v , versions )
if ( v - > isValid ( ) & & v - > toolChainAvailable ( ) )
2010-02-08 15:50:06 +01:00
return true ;
return false ;
}
2011-02-21 12:16:20 +01:00
QList < QtVersion * > QtVersionManager : : versionsForTargetId ( const QString & id , const QtVersionNumber & minimumQtVersion ) const
2010-02-08 15:50:06 +01:00
{
QList < QtVersion * > targetVersions ;
foreach ( QtVersion * version , m_versions ) {
2011-02-21 12:16:20 +01:00
if ( version - > supportsTargetId ( id ) & & version - > qtVersion ( ) > = minimumQtVersion )
2010-02-08 15:50:06 +01:00
targetVersions . append ( version ) ;
}
2011-02-21 12:16:20 +01:00
qSort ( targetVersions . begin ( ) , targetVersions . end ( ) , & qtVersionNumberCompare ) ;
2010-02-08 15:50:06 +01:00
return targetVersions ;
}
QSet < QString > QtVersionManager : : supportedTargetIds ( ) const
{
QSet < QString > results ;
foreach ( QtVersion * version , m_versions )
results . unite ( version - > supportedTargetIds ( ) ) ;
return results ;
}
2008-12-02 12:01:29 +01:00
void QtVersionManager : : updateDocumentation ( )
{
2010-06-11 13:11:37 +02:00
Core : : HelpManager * helpManager = Core : : HelpManager : : instance ( ) ;
2008-12-17 15:51:48 +01:00
Q_ASSERT ( helpManager ) ;
2008-12-02 12:01:29 +01:00
QStringList files ;
foreach ( QtVersion * version , m_versions ) {
2009-12-17 15:51:42 +01:00
const QString docPath = version - > documentationPath ( ) + QLatin1String ( " /qch/ " ) ;
const QDir versionHelpDir ( docPath ) ;
foreach ( const QString & helpFile ,
versionHelpDir . entryList ( QStringList ( ) < < QLatin1String ( " *.qch " ) , QDir : : Files ) )
files < < docPath + helpFile ;
2008-12-02 12:01:29 +01:00
}
helpManager - > registerDocumentation ( files ) ;
}
2011-03-08 12:57:12 +01:00
void QtVersionManager : : updateSettings ( )
2009-05-28 18:15:02 +02:00
{
2011-03-08 12:57:12 +01:00
writeVersionsIntoSettings ( ) ;
updateDocumentation ( ) ;
2009-05-28 18:15:02 +02:00
QtVersion * version = 0 ;
2010-05-25 17:09:33 +02:00
QList < QtVersion * > candidates ;
2010-02-08 15:50:06 +01:00
// try to find a version which has both, demos and examples
2010-05-25 17:09:33 +02:00
foreach ( version , m_versions ) {
if ( version - > hasExamples ( ) & & version - > hasDemos ( ) )
candidates . append ( version ) ;
}
2010-10-25 19:33:35 +02:00
// in SDKs, we want to prefer the Qt version shipping with the SDK
2010-11-18 15:01:18 +01:00
QSettings * settings = Core : : ICore : : instance ( ) - > settings ( ) ;
QString preferred = settings - > value ( QLatin1String ( " PreferredQMakePath " ) ) . toString ( ) ;
preferred = QDir : : fromNativeSeparators ( preferred ) ;
2010-10-25 19:33:35 +02:00
if ( ! preferred . isEmpty ( ) ) {
2010-11-18 15:01:18 +01:00
# ifdef Q_OS_WIN
preferred = preferred . toLower ( ) ;
if ( ! preferred . endsWith ( QLatin1String ( " .exe " ) ) )
preferred . append ( QLatin1String ( " .exe " ) ) ;
# endif
2010-10-25 19:33:35 +02:00
foreach ( version , candidates ) {
if ( version - > qmakeCommand ( ) = = preferred ) {
emit updateExamples ( version - > examplesPath ( ) , version - > demosPath ( ) , version - > sourcePath ( ) ) ;
return ;
}
}
2010-05-25 17:09:33 +02:00
}
// prefer versions with declarative examples
foreach ( version , candidates ) {
if ( QDir ( version - > examplesPath ( ) + " /declarative " ) . exists ( ) ) {
emit updateExamples ( version - > examplesPath ( ) , version - > demosPath ( ) , version - > sourcePath ( ) ) ;
2009-05-28 18:15:02 +02:00
return ;
}
}
2010-05-25 17:09:33 +02:00
if ( ! candidates . isEmpty ( ) ) {
version = candidates . first ( ) ;
emit updateExamples ( version - > examplesPath ( ) , version - > demosPath ( ) , version - > sourcePath ( ) ) ;
return ;
}
return ;
2009-05-28 18:15:02 +02:00
}
2008-12-02 12:01:29 +01:00
int QtVersionManager : : getUniqueId ( )
{
return m_idcount + + ;
}
void QtVersionManager : : writeVersionsIntoSettings ( )
{
2009-01-20 11:52:04 +01:00
QSettings * s = Core : : ICore : : instance ( ) - > settings ( ) ;
2009-03-20 11:52:47 +01:00
s - > beginWriteArray ( QtVersionsSectionName ) ;
2011-02-21 12:16:20 +01:00
QMap < int , QtVersion * > : : const_iterator it = m_versions . constBegin ( ) ;
2008-12-02 12:01:29 +01:00
for ( int i = 0 ; i < m_versions . size ( ) ; + + i ) {
2011-02-21 12:16:20 +01:00
const QtVersion * version = it . value ( ) ;
2008-12-02 12:01:29 +01:00
s - > setArrayIndex ( i ) ;
2010-01-07 18:17:24 +01:00
s - > setValue ( " Name " , version - > displayName ( ) ) ;
2009-09-03 19:16:22 +02:00
// for downwards compat
s - > setValue ( " Path " , version - > versionInfo ( ) . value ( " QT_INSTALL_DATA " ) ) ;
s - > setValue ( " QMakePath " , version - > qmakeCommand ( ) ) ;
2009-05-28 11:48:33 +02:00
s - > setValue ( " Id " , version - > uniqueId ( ) ) ;
s - > setValue ( " isAutodetected " , version - > isAutodetected ( ) ) ;
if ( version - > isAutodetected ( ) )
s - > setValue ( " autodetectionSource " , version - > autodetectionSource ( ) ) ;
2011-03-08 12:57:12 +01:00
s - > setValue ( " S60SDKDirectory " , version - > systemRoot ( ) ) ;
2010-11-15 15:24:17 +01:00
s - > setValue ( QLatin1String ( " SBSv2Directory " ) , version - > sbsV2Directory ( ) ) ;
2011-03-15 17:23:17 +01:00
// Remove obsolete settings: New toolchains would be created at each startup
// otherwise, overriding manually set ones.
s - > remove ( QLatin1String ( " MingwDirectory " ) ) ;
s - > remove ( QLatin1String ( " MwcDirectory " ) ) ;
s - > remove ( QLatin1String ( " GcceDirectory " ) ) ;
2011-02-21 12:16:20 +01:00
+ + it ;
2008-12-02 12:01:29 +01:00
}
s - > endArray ( ) ;
}
2010-03-26 10:37:05 +01:00
QList < QtVersion * > QtVersionManager : : versions ( ) const
2008-12-02 12:01:29 +01:00
{
2011-02-21 12:16:20 +01:00
QList < QtVersion * > versions ;
foreach ( QtVersion * version , m_versions )
versions < < version ;
qSort ( versions . begin ( ) , versions . end ( ) , & qtVersionNumberCompare ) ;
return versions ;
2008-12-02 12:01:29 +01:00
}
2010-03-26 10:37:05 +01:00
QList < QtVersion * > QtVersionManager : : validVersions ( ) const
{
QList < QtVersion * > results ;
foreach ( QtVersion * v , m_versions ) {
if ( v - > isValid ( ) )
results . append ( v ) ;
}
2011-02-21 12:16:20 +01:00
qSort ( results . begin ( ) , results . end ( ) , & qtVersionNumberCompare ) ;
2010-03-26 10:37:05 +01:00
return results ;
}
2010-01-12 15:46:23 +01:00
bool QtVersionManager : : isValidId ( int id ) const
{
2011-02-21 12:16:20 +01:00
return m_versions . contains ( id ) ;
2010-01-12 15:46:23 +01:00
}
2008-12-02 12:01:29 +01:00
QtVersion * QtVersionManager : : version ( int id ) const
{
2011-02-21 12:16:20 +01:00
QMap < int , QtVersion * > : : const_iterator it = m_versions . find ( id ) ;
if ( it = = m_versions . constEnd ( ) )
return m_emptyVersion ;
return it . value ( ) ;
2008-12-02 12:01:29 +01:00
}
2011-02-01 18:36:00 +01:00
// FIXME: Rework this!
2008-12-02 12:01:29 +01:00
void QtVersionManager : : addNewVersionsFromInstaller ( )
{
// Add new versions which may have been installed by the WB installer in the form:
2009-09-03 19:16:22 +02:00
// NewQtVersions="qt 4.3.2=c:\\qt\\qt432\bin\qmake.exe;qt embedded=c:\\qtembedded;"
2011-02-01 18:36:00 +01:00
// or NewQtVersions="qt 4.3.2=c:\\qt\\qt432bin\qmake.exe;
2009-12-17 18:50:49 +01:00
// i.e.
2011-02-01 18:36:00 +01:00
// NewQtVersions="versionname=pathtoversion=s60sdk;"
2008-12-02 12:01:29 +01:00
// Duplicate entries are not added, the first new version is set as default.
2009-01-20 11:52:04 +01:00
QSettings * settings = Core : : ICore : : instance ( ) - > settings ( ) ;
2010-01-13 17:39:31 +01:00
QSettings * globalSettings = Core : : ICore : : instance ( ) - > settings ( QSettings : : SystemScope ) ;
2009-02-11 19:41:01 +01:00
2010-01-13 17:39:31 +01:00
QDateTime lastUpdateFromGlobalSettings = globalSettings - > value (
QLatin1String ( " General/LastQtVersionUpdate " ) ) . toDateTime ( ) ;
const QFileInfo gsFi ( globalSettings - > fileName ( ) ) ;
2010-01-18 11:24:48 +01:00
if ( ! lastUpdateFromGlobalSettings . isNull ( ) & &
( ! gsFi . exists ( ) | | ( gsFi . lastModified ( ) > lastUpdateFromGlobalSettings ) ) )
2008-12-02 12:01:29 +01:00
return ;
2010-01-13 17:39:31 +01:00
if ( ! globalSettings - > contains ( newQtVersionsKey ) & &
! globalSettings - > contains ( QLatin1String ( " Installer/ " ) + newQtVersionsKey ) )
{
return ;
}
2008-12-02 12:01:29 +01:00
QString newVersionsValue = settings - > value ( newQtVersionsKey ) . toString ( ) ;
2009-02-11 19:41:01 +01:00
if ( newVersionsValue . isEmpty ( ) )
newVersionsValue = settings - > value ( QLatin1String ( " Installer/ " ) + newQtVersionsKey ) . toString ( ) ;
2008-12-02 12:01:29 +01:00
QStringList newVersionsList = newVersionsValue . split ( ' ; ' , QString : : SkipEmptyParts ) ;
2010-02-01 14:00:07 +01:00
foreach ( const QString & newVersion , newVersionsList ) {
2008-12-02 12:01:29 +01:00
QStringList newVersionData = newVersion . split ( ' = ' ) ;
2009-12-17 18:50:49 +01:00
if ( newVersionData . count ( ) > = 2 ) {
2009-10-22 14:23:30 +02:00
if ( QFile : : exists ( newVersionData [ 1 ] ) ) {
2008-12-02 12:01:29 +01:00
QtVersion * version = new QtVersion ( newVersionData [ 0 ] , newVersionData [ 1 ] , m_idcount + + ) ;
2008-12-09 11:07:24 +01:00
if ( newVersionData . count ( ) > = 3 )
2011-03-08 12:57:12 +01:00
version - > setSystemRoot ( QDir : : fromNativeSeparators ( newVersionData [ 2 ] ) ) ;
2009-12-17 18:50:49 +01:00
if ( newVersionData . count ( ) > = 4 )
2011-02-01 18:36:00 +01:00
version - > setSbsV2Directory ( QDir : : fromNativeSeparators ( newVersionData [ 3 ] ) ) ;
2008-12-02 12:01:29 +01:00
bool versionWasAlreadyInList = false ;
foreach ( const QtVersion * const it , m_versions ) {
2009-09-03 19:16:22 +02:00
if ( QDir ( version - > qmakeCommand ( ) ) . canonicalPath ( ) = = QDir ( it - > qmakeCommand ( ) ) . canonicalPath ( ) ) {
2008-12-02 12:01:29 +01:00
versionWasAlreadyInList = true ;
break ;
}
}
if ( ! versionWasAlreadyInList ) {
2011-02-21 12:16:20 +01:00
m_versions . insert ( version - > uniqueId ( ) , version ) ;
2008-12-02 12:01:29 +01:00
} else {
// clean up
delete version ;
}
}
}
}
2010-01-13 17:39:31 +01:00
settings - > setValue ( QLatin1String ( " General/LastQtVersionUpdate " ) , QDateTime : : currentDateTime ( ) ) ;
2008-12-02 12:01:29 +01:00
}
void QtVersionManager : : updateSystemVersion ( )
{
bool haveSystemVersion = false ;
2010-09-23 10:35:23 +02:00
QString systemQMakePath = DebuggingHelperLibrary : : findSystemQt ( Utils : : Environment : : systemEnvironment ( ) ) ;
2009-09-03 19:16:22 +02:00
if ( systemQMakePath . isNull ( ) )
systemQMakePath = tr ( " <not found> " ) ;
2009-04-23 16:05:51 +02:00
2008-12-02 12:01:29 +01:00
foreach ( QtVersion * version , m_versions ) {
2009-05-28 11:48:33 +02:00
if ( version - > isAutodetected ( )
& & version - > autodetectionSource ( ) = = PATH_AUTODETECTION_SOURCE ) {
2009-09-03 19:16:22 +02:00
version - > setQMakeCommand ( systemQMakePath ) ;
2010-01-07 18:17:24 +01:00
version - > setDisplayName ( tr ( " Qt in PATH " ) ) ;
2008-12-02 12:01:29 +01:00
haveSystemVersion = true ;
}
}
if ( haveSystemVersion )
return ;
2009-05-26 17:21:30 +02:00
QtVersion * version = new QtVersion ( tr ( " Qt in PATH " ) ,
2009-09-03 19:16:22 +02:00
systemQMakePath ,
2008-12-02 12:01:29 +01:00
getUniqueId ( ) ,
2009-05-28 11:48:33 +02:00
true ,
PATH_AUTODETECTION_SOURCE ) ;
2011-02-21 12:16:20 +01:00
m_versions . insert ( version - > uniqueId ( ) , version ) ;
2008-12-02 12:01:29 +01:00
}
2010-02-08 15:50:06 +01:00
QtVersion * QtVersionManager : : emptyVersion ( ) const
2008-12-02 12:01:29 +01:00
{
2010-02-08 15:50:06 +01:00
return m_emptyVersion ;
2008-12-02 12:01:29 +01:00
}
2009-12-03 18:37:27 +01:00
class SortByUniqueId
{
public :
bool operator ( ) ( QtVersion * a , QtVersion * b )
{
return a - > uniqueId ( ) < b - > uniqueId ( ) ;
}
} ;
bool QtVersionManager : : equals ( QtVersion * a , QtVersion * b )
{
if ( a - > m_qmakeCommand ! = b - > m_qmakeCommand )
return false ;
if ( a - > m_id ! = b - > m_id )
return false ;
2010-02-22 18:21:17 +01:00
if ( a - > m_displayName ! = b - > displayName ( ) )
return false ;
2009-12-03 18:37:27 +01:00
return true ;
}
2010-02-08 15:50:06 +01:00
void QtVersionManager : : setNewQtVersions ( QList < QtVersion * > newVersions )
2009-04-22 18:05:55 +02:00
{
2009-12-03 18:37:27 +01:00
// We want to preserve the same order as in the settings dialog
// so we sort a copy
QList < QtVersion * > sortedNewVersions = newVersions ;
SortByUniqueId sortByUniqueId ;
qSort ( sortedNewVersions . begin ( ) , sortedNewVersions . end ( ) , sortByUniqueId ) ;
QList < int > changedVersions ;
// So we trying to find the minimal set of changed versions,
// iterate over both sorted list
// newVersions and oldVersions iterator
2011-02-21 12:16:20 +01:00
QList < QtVersion * > : : const_iterator nit , nend ;
QMap < int , QtVersion * > : : const_iterator oit , oend ;
2009-12-03 18:37:27 +01:00
nit = sortedNewVersions . constBegin ( ) ;
nend = sortedNewVersions . constEnd ( ) ;
oit = m_versions . constBegin ( ) ;
oend = m_versions . constEnd ( ) ;
while ( nit ! = nend & & oit ! = oend ) {
int nid = ( * nit ) - > uniqueId ( ) ;
int oid = ( * oit ) - > uniqueId ( ) ;
if ( nid < oid ) {
changedVersions . push_back ( nid ) ;
+ + nit ;
} else if ( oid < nid ) {
changedVersions . push_back ( oid ) ;
+ + oit ;
} else {
if ( ! equals ( * oit , * nit ) )
changedVersions . push_back ( oid ) ;
+ + oit ;
+ + nit ;
2009-04-22 18:05:55 +02:00
}
}
2009-12-03 18:37:27 +01:00
while ( nit ! = nend ) {
changedVersions . push_back ( ( * nit ) - > uniqueId ( ) ) ;
2009-12-10 12:08:40 +01:00
+ + nit ;
2009-12-03 18:37:27 +01:00
}
while ( oit ! = oend ) {
changedVersions . push_back ( ( * oit ) - > uniqueId ( ) ) ;
2009-12-10 12:08:40 +01:00
+ + oit ;
2009-12-03 18:37:27 +01:00
}
2009-04-22 18:05:55 +02:00
qDeleteAll ( m_versions ) ;
m_versions . clear ( ) ;
2011-02-21 12:16:20 +01:00
foreach ( QtVersion * v , sortedNewVersions )
m_versions . insert ( v - > uniqueId ( ) , v ) ;
2009-12-03 18:37:27 +01:00
if ( ! changedVersions . isEmpty ( ) )
2009-04-22 18:05:55 +02:00
updateDocumentation ( ) ;
2011-03-08 12:57:12 +01:00
updateSettings ( ) ;
2009-04-22 18:05:55 +02:00
writeVersionsIntoSettings ( ) ;
2009-12-03 18:37:27 +01:00
if ( ! changedVersions . isEmpty ( ) )
emit qtVersionsChanged ( changedVersions ) ;
2009-04-22 18:05:55 +02:00
}
2011-02-01 18:36:00 +01:00
// --------------------------------------------------------------------------
// QtVersion
// --------------------------------------------------------------------------
2008-12-02 12:01:29 +01:00
2009-09-03 19:16:22 +02:00
QtVersion : : QtVersion ( const QString & name , const QString & qmakeCommand , int id ,
2009-05-28 11:48:33 +02:00
bool isAutodetected , const QString & autodetectionSource )
2010-01-07 18:17:24 +01:00
: m_displayName ( name ) ,
2009-05-28 11:31:35 +02:00
m_isAutodetected ( isAutodetected ) ,
2009-05-28 11:48:33 +02:00
m_autodetectionSource ( autodetectionSource ) ,
2009-05-25 16:43:50 +02:00
m_hasDebuggingHelper ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlDump ( false ) ,
2011-01-12 16:24:00 +01:00
m_hasQmlDebuggingLibrary ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlObserver ( false ) ,
2011-02-01 18:36:00 +01:00
m_abiUpToDate ( false ) ,
2009-09-03 19:16:22 +02:00
m_versionInfoUpToDate ( false ) ,
2009-03-25 15:18:37 +01:00
m_notInstalled ( false ) ,
m_defaultConfigIsDebug ( true ) ,
m_defaultConfigIsDebugAndRelease ( true ) ,
2009-05-28 18:15:02 +02:00
m_hasExamples ( false ) ,
m_hasDemos ( false ) ,
2011-03-11 15:19:25 +01:00
m_hasDocumentation ( false ) ,
m_qmakeIsExecutable ( false ) ,
m_validSystemRoot ( true )
2008-12-02 12:01:29 +01:00
{
2008-12-09 11:07:24 +01:00
if ( id = = - 1 )
2008-12-02 12:01:29 +01:00
m_id = getUniqueId ( ) ;
else
m_id = id ;
2009-09-03 19:16:22 +02:00
setQMakeCommand ( qmakeCommand ) ;
2008-12-02 12:01:29 +01:00
}
2009-09-03 19:16:22 +02:00
QtVersion : : QtVersion ( const QString & name , const QString & qmakeCommand ,
2009-05-28 13:22:23 +02:00
bool isAutodetected , const QString & autodetectionSource )
2010-01-07 18:17:24 +01:00
: m_displayName ( name ) ,
2009-05-28 13:22:23 +02:00
m_isAutodetected ( isAutodetected ) ,
m_autodetectionSource ( autodetectionSource ) ,
2009-05-25 16:43:50 +02:00
m_hasDebuggingHelper ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlDump ( false ) ,
2011-01-12 16:24:00 +01:00
m_hasQmlDebuggingLibrary ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlObserver ( false ) ,
2011-02-01 18:36:00 +01:00
m_abiUpToDate ( false ) ,
2009-09-03 19:16:22 +02:00
m_versionInfoUpToDate ( false ) ,
m_notInstalled ( false ) ,
m_defaultConfigIsDebug ( true ) ,
m_defaultConfigIsDebugAndRelease ( true ) ,
m_hasExamples ( false ) ,
m_hasDemos ( false ) ,
2011-03-11 15:19:25 +01:00
m_hasDocumentation ( false ) ,
m_qmakeIsExecutable ( false ) ,
m_validSystemRoot ( true )
2009-09-03 19:16:22 +02:00
{
m_id = getUniqueId ( ) ;
setQMakeCommand ( qmakeCommand ) ;
}
QtVersion : : QtVersion ( const QString & qmakeCommand , bool isAutodetected , const QString & autodetectionSource )
: m_isAutodetected ( isAutodetected ) ,
m_autodetectionSource ( autodetectionSource ) ,
m_hasDebuggingHelper ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlDump ( false ) ,
2011-01-12 16:24:00 +01:00
m_hasQmlDebuggingLibrary ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlObserver ( false ) ,
2011-02-01 18:36:00 +01:00
m_abiUpToDate ( false ) ,
2009-09-03 19:16:22 +02:00
m_versionInfoUpToDate ( false ) ,
m_notInstalled ( false ) ,
m_defaultConfigIsDebug ( true ) ,
m_defaultConfigIsDebugAndRelease ( true ) ,
m_hasExamples ( false ) ,
m_hasDemos ( false ) ,
2011-03-11 15:19:25 +01:00
m_hasDocumentation ( false ) ,
m_qmakeIsExecutable ( false ) ,
m_validSystemRoot ( true )
2008-12-02 12:01:29 +01:00
{
m_id = getUniqueId ( ) ;
2009-09-03 19:16:22 +02:00
setQMakeCommand ( qmakeCommand ) ;
2010-01-07 18:17:24 +01:00
m_displayName = qtVersionString ( ) ;
2008-12-02 12:01:29 +01:00
}
2009-09-03 19:45:09 +02:00
QtVersion : : QtVersion ( )
2010-02-02 17:09:41 +01:00
: m_id ( - 1 ) ,
2009-09-03 19:45:09 +02:00
m_isAutodetected ( false ) ,
m_hasDebuggingHelper ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlDump ( false ) ,
2011-01-12 16:24:00 +01:00
m_hasQmlDebuggingLibrary ( false ) ,
2010-09-27 17:22:57 +02:00
m_hasQmlObserver ( false ) ,
2011-02-01 18:36:00 +01:00
m_abiUpToDate ( false ) ,
2009-09-03 19:45:09 +02:00
m_versionInfoUpToDate ( false ) ,
m_notInstalled ( false ) ,
m_defaultConfigIsDebug ( true ) ,
m_defaultConfigIsDebugAndRelease ( true ) ,
m_hasExamples ( false ) ,
m_hasDemos ( false ) ,
2011-03-11 15:19:25 +01:00
m_hasDocumentation ( false ) ,
m_qmakeIsExecutable ( false ) ,
m_validSystemRoot ( true )
2009-09-03 19:45:09 +02:00
{
2010-02-02 17:09:41 +01:00
setQMakeCommand ( QString ( ) ) ;
2009-09-03 19:45:09 +02:00
}
2009-05-25 16:43:50 +02:00
QtVersion : : ~ QtVersion ( )
{
}
2009-10-27 18:05:04 +01:00
QString QtVersion : : toHtml ( ) const
{
QString rc ;
QTextStream str ( & rc ) ;
2010-09-24 16:23:36 +02:00
str < < " <html><body><table> " ;
2009-10-27 18:05:04 +01:00
str < < " <tr><td><b> " < < QtVersionManager : : tr ( " Name: " )
2010-01-07 18:17:24 +01:00
< < " </b></td><td> " < < displayName ( ) < < " </td></tr> " ;
2011-02-01 18:36:00 +01:00
if ( ! isValid ( ) ) {
str < < " <tr><td colspan=2><b> " + QtVersionManager : : tr ( " Invalid Qt version " ) + " </b></td></tr> " ;
} else {
QString prefix = QLatin1String ( " <tr><td><b> " ) + QtVersionManager : : tr ( " ABI: " ) + QLatin1String ( " </b></td> " ) ;
foreach ( const ProjectExplorer : : Abi & abi , qtAbis ( ) ) {
str < < prefix < < " <td> " < < abi . toString ( ) < < " </td></tr> " ;
prefix = QLatin1String ( " <tr><td></td> " ) ;
}
str < < " <tr><td><b> " < < QtVersionManager : : tr ( " Source: " )
< < " </b></td><td> " < < sourcePath ( ) < < " </td></tr> " ;
str < < " <tr><td><b> " < < QtVersionManager : : tr ( " mkspec: " )
< < " </b></td><td> " < < mkspec ( ) < < " </td></tr> " ;
str < < " <tr><td><b> " < < QtVersionManager : : tr ( " qmake: " )
< < " </b></td><td> " < < m_qmakeCommand < < " </td></tr> " ;
updateAbiAndMkspec ( ) ;
if ( m_defaultConfigIsDebug | | m_defaultConfigIsDebugAndRelease ) {
str < < " <tr><td><b> " < < QtVersionManager : : tr ( " Default: " ) < < " </b></td><td> "
< < ( m_defaultConfigIsDebug ? " debug " : " release " ) ;
if ( m_defaultConfigIsDebugAndRelease )
str < < " debug_and_release " ;
str < < " </td></tr> " ;
} // default config.
str < < " <tr><td><b> " < < QtVersionManager : : tr ( " Version: " )
< < " </b></td><td> " < < qtVersionString ( ) < < " </td></tr> " ;
const QHash < QString , QString > vInfo = versionInfo ( ) ;
if ( ! vInfo . isEmpty ( ) ) {
const QHash < QString , QString > : : const_iterator vcend = vInfo . constEnd ( ) ;
for ( QHash < QString , QString > : : const_iterator it = vInfo . constBegin ( ) ; it ! = vcend ; + + it )
str < < " <tr><td><pre> " < < it . key ( ) < < " </pre></td><td> " < < it . value ( ) < < " </td></tr> " ;
}
2009-10-27 18:05:04 +01:00
}
2010-09-24 16:23:36 +02:00
str < < " </table></body></html> " ;
2009-10-27 18:05:04 +01:00
return rc ;
}
2010-03-10 16:13:53 +01:00
bool QtVersion : : supportsShadowBuilds ( ) const
{
QSet < QString > targets = supportedTargetIds ( ) ;
// Symbian does not support shadow building
if ( targets . contains ( Constants : : S60_DEVICE_TARGET_ID ) | |
targets . contains ( Constants : : S60_EMULATOR_TARGET_ID ) ) {
2010-08-17 12:48:49 +02:00
// We can not support shadow building with the ABLD system
2010-03-10 16:13:53 +01:00
return false ;
}
return true ;
}
2010-12-06 12:18:38 +01:00
ProjectExplorer : : IOutputParser * QtVersion : : createOutputParser ( ) const
{
if ( supportsTargetId ( Qt4ProjectManager : : Constants : : S60_DEVICE_TARGET_ID ) | |
supportsTargetId ( Qt4ProjectManager : : Constants : : S60_EMULATOR_TARGET_ID ) ) {
if ( isBuildWithSymbianSbsV2 ( ) ) {
return new SbsV2Parser ;
} else {
ProjectExplorer : : IOutputParser * parser = new AbldParser ;
parser - > appendOutputParser ( new ProjectExplorer : : GnuMakeParser ) ;
return parser ;
}
}
return new ProjectExplorer : : GnuMakeParser ;
}
2010-04-19 16:07:55 +02:00
QList < ProjectExplorer : : Task >
2010-08-19 14:45:21 +02:00
QtVersion : : reportIssues ( const QString & proFile , const QString & buildDir )
2010-04-19 16:07:55 +02:00
{
QList < ProjectExplorer : : Task > results ;
2011-01-24 14:59:39 +01:00
QString tmpBuildDir = QDir ( buildDir ) . absolutePath ( ) ;
if ( ! tmpBuildDir . endsWith ( QLatin1Char ( ' / ' ) ) )
tmpBuildDir . append ( QLatin1Char ( ' / ' ) ) ;
2010-08-19 14:45:21 +02:00
2010-04-27 12:39:00 +02:00
if ( ! isValid ( ) ) {
//: %1: Reason for being invalid
const QString msg = QCoreApplication : : translate ( " Qt4ProjectManager::QtVersion " , " The Qt version is invalid: %1 " ) . arg ( invalidReason ( ) ) ;
results . append ( ProjectExplorer : : Task ( ProjectExplorer : : Task : : Error , msg , QString ( ) , - 1 ,
2010-04-19 16:07:55 +02:00
QLatin1String ( ProjectExplorer : : Constants : : TASK_CATEGORY_BUILDSYSTEM ) ) ) ;
2010-04-27 12:39:00 +02:00
}
2010-04-19 16:07:55 +02:00
QFileInfo qmakeInfo ( qmakeCommand ( ) ) ;
if ( ! qmakeInfo . exists ( ) | |
2010-04-27 12:39:00 +02:00
! qmakeInfo . isExecutable ( ) ) {
//: %1: Path to qmake executable
const QString msg = QCoreApplication : : translate ( " Qt4ProjectManager::QtVersion " ,
" The qmake command \" %1 \" was not found or is not executable. " ) . arg ( qmakeCommand ( ) ) ;
results . append ( ProjectExplorer : : Task ( ProjectExplorer : : Task : : Error , msg , QString ( ) , - 1 ,
2010-04-19 16:07:55 +02:00
QLatin1String ( ProjectExplorer : : Constants : : TASK_CATEGORY_BUILDSYSTEM ) ) ) ;
2010-04-27 12:39:00 +02:00
}
2010-04-19 16:07:55 +02:00
2010-08-19 14:45:21 +02:00
QString sourcePath = QFileInfo ( proFile ) . absolutePath ( ) ;
2011-01-24 14:59:39 +01:00
if ( ! sourcePath . endsWith ( QLatin1Char ( ' / ' ) ) )
sourcePath . append ( QLatin1Char ( ' / ' ) ) ;
2010-08-19 14:45:21 +02:00
if ( ( tmpBuildDir . startsWith ( sourcePath ) ) & & ( tmpBuildDir ! = sourcePath ) ) {
const QString msg = QCoreApplication : : translate ( " Qt4ProjectManager::QtVersion " ,
" Qmake does not support build directories below the source directory. " ) ;
results . append ( ProjectExplorer : : Task ( ProjectExplorer : : Task : : Warning , msg , QString ( ) , - 1 ,
QLatin1String ( ProjectExplorer : : Constants : : TASK_CATEGORY_BUILDSYSTEM ) ) ) ;
} else if ( tmpBuildDir . count ( QChar ( ' / ' ) ) ! = sourcePath . count ( QChar ( ' / ' ) ) ) {
const QString msg = QCoreApplication : : translate ( " Qt4ProjectManager::QtVersion " ,
2010-08-23 16:00:24 +02:00
" The build directory needs to be at the same level as the source directory. " ) ;
2010-08-19 16:11:10 +02:00
2010-08-19 14:45:21 +02:00
results . append ( ProjectExplorer : : Task ( ProjectExplorer : : Task : : Warning , msg , QString ( ) , - 1 ,
QLatin1String ( ProjectExplorer : : Constants : : TASK_CATEGORY_BUILDSYSTEM ) ) ) ;
}
2010-04-19 16:07:55 +02:00
QSet < QString > targets = supportedTargetIds ( ) ;
if ( targets . contains ( Constants : : S60_DEVICE_TARGET_ID ) | |
targets . contains ( Constants : : S60_EMULATOR_TARGET_ID ) )
2011-03-11 15:19:25 +01:00
results . append ( S60ProjectChecker : : reportIssues ( proFile ) ) ;
2010-04-19 16:07:55 +02:00
return results ;
}
2010-01-07 18:17:24 +01:00
QString QtVersion : : displayName ( ) const
2008-12-02 12:01:29 +01:00
{
2010-01-07 18:17:24 +01:00
return m_displayName ;
2008-12-02 12:01:29 +01:00
}
2009-09-03 19:16:22 +02:00
QString QtVersion : : qmakeCommand ( ) const
2008-12-02 12:01:29 +01:00
{
2009-09-03 19:16:22 +02:00
return m_qmakeCommand ;
2008-12-02 12:01:29 +01:00
}
QString QtVersion : : sourcePath ( ) const
{
return m_sourcePath ;
}
QString QtVersion : : mkspec ( ) const
{
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
2008-12-02 12:01:29 +01:00
return m_mkspec ;
}
2008-12-08 12:44:28 +01:00
QString QtVersion : : mkspecPath ( ) const
{
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
2008-12-08 12:44:28 +01:00
return m_mkspecFullPath ;
}
2010-08-11 14:44:46 +02:00
bool QtVersion : : isBuildWithSymbianSbsV2 ( ) const
{
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
2010-08-11 14:44:46 +02:00
return m_isBuildUsingSbsV2 ;
}
2008-12-08 14:20:35 +01:00
QString QtVersion : : qtVersionString ( ) const
{
2010-03-15 11:54:25 +01:00
if ( m_qtVersionString . isNull ( ) ) {
QFileInfo qmake ( m_qmakeCommand ) ;
if ( qmake . exists ( ) & & qmake . isExecutable ( ) ) {
m_qtVersionString = DebuggingHelperLibrary : : qtVersionForQMake ( qmake . absoluteFilePath ( ) ) ;
} else {
m_qtVersionString = QLatin1String ( " " ) ;
}
}
2008-12-08 14:20:35 +01:00
return m_qtVersionString ;
}
2011-02-21 12:16:20 +01:00
QtVersionNumber QtVersion : : qtVersion ( ) const
2011-01-12 16:24:00 +01:00
{
2011-02-21 12:16:20 +01:00
//todo cache this;
return QtVersionNumber ( qtVersionString ( ) ) ;
2011-01-12 16:24:00 +01:00
}
2008-12-02 12:01:29 +01:00
QHash < QString , QString > QtVersion : : versionInfo ( ) const
{
updateVersionInfo ( ) ;
return m_versionInfo ;
}
2010-01-07 18:17:24 +01:00
void QtVersion : : setDisplayName ( const QString & name )
2008-12-02 12:01:29 +01:00
{
2010-01-07 18:17:24 +01:00
m_displayName = name ;
2008-12-02 12:01:29 +01:00
}
2009-09-03 19:16:22 +02:00
void QtVersion : : setQMakeCommand ( const QString & qmakeCommand )
2008-12-02 12:01:29 +01:00
{
2009-10-06 18:34:44 +02:00
m_qmakeCommand = QDir : : fromNativeSeparators ( qmakeCommand ) ;
2009-08-27 15:08:47 +02:00
# ifdef Q_OS_WIN
2009-09-03 19:16:22 +02:00
m_qmakeCommand = m_qmakeCommand . toLower ( ) ;
2009-08-27 15:08:47 +02:00
# endif
2010-02-02 17:09:41 +01:00
m_designerCommand . clear ( ) ;
m_linguistCommand . clear ( ) ;
2010-08-19 16:51:27 +02:00
m_qmlviewerCommand . clear ( ) ;
2010-02-02 17:09:41 +01:00
m_uicCommand . clear ( ) ;
2011-02-01 18:36:00 +01:00
m_abiUpToDate = false ;
2009-09-03 19:16:22 +02:00
// TODO do i need to optimize this?
m_versionInfoUpToDate = false ;
2011-02-25 15:27:13 +01:00
m_qtVersionString . clear ( ) ;
2009-09-03 19:16:22 +02:00
updateSourcePath ( ) ;
2008-12-02 12:01:29 +01:00
}
void QtVersion : : updateSourcePath ( )
{
2009-09-03 19:16:22 +02:00
updateVersionInfo ( ) ;
const QString installData = m_versionInfo [ " QT_INSTALL_DATA " ] ;
m_sourcePath = installData ;
QFile qmakeCache ( installData + QLatin1String ( " /.qmake.cache " ) ) ;
2008-12-02 12:01:29 +01:00
if ( qmakeCache . exists ( ) ) {
qmakeCache . open ( QIODevice : : ReadOnly | QIODevice : : Text ) ;
QTextStream stream ( & qmakeCache ) ;
while ( ! stream . atEnd ( ) ) {
QString line = stream . readLine ( ) . trimmed ( ) ;
if ( line . startsWith ( QLatin1String ( " QT_SOURCE_TREE " ) ) ) {
m_sourcePath = line . split ( QLatin1Char ( ' = ' ) ) . at ( 1 ) . trimmed ( ) ;
if ( m_sourcePath . startsWith ( QLatin1String ( " $$quote( " ) ) ) {
m_sourcePath . remove ( 0 , 8 ) ;
m_sourcePath . chop ( 1 ) ;
}
break ;
}
}
}
2009-08-06 18:49:10 +02:00
m_sourcePath = QDir : : cleanPath ( m_sourcePath ) ;
2009-11-09 18:59:11 +01:00
# ifdef Q_OS_WIN
m_sourcePath = m_sourcePath . toLower ( ) ;
# endif
2008-12-02 12:01:29 +01:00
}
// Returns the version that was used to build the project in that directory
// That is returns the directory
2010-01-11 10:22:55 +01:00
// To find out whether we already have a qtversion for that directory call
2008-12-02 12:01:29 +01:00
// QtVersion *QtVersionManager::qtVersionForDirectory(const QString directory);
2010-10-05 17:38:45 +02:00
QString QtVersionManager : : findQMakeBinaryFromMakefile ( const QString & makefile )
2008-12-02 12:01:29 +01:00
{
bool debugAdding = false ;
2010-10-05 17:38:45 +02:00
QFile fi ( makefile ) ;
if ( fi . exists ( ) & & fi . open ( QFile : : ReadOnly ) ) {
QTextStream ts ( & fi ) ;
2009-12-10 19:12:51 +01:00
QRegExp r1 ( " QMAKE \\ s*=(.*) " ) ;
2008-12-02 12:01:29 +01:00
while ( ! ts . atEnd ( ) ) {
QString line = ts . readLine ( ) ;
if ( r1 . exactMatch ( line ) ) {
if ( debugAdding )
qDebug ( ) < < " #~~ QMAKE is: " < < r1 . cap ( 1 ) . trimmed ( ) ;
QFileInfo qmake ( r1 . cap ( 1 ) . trimmed ( ) ) ;
2009-09-03 19:16:22 +02:00
QString qmakePath = qmake . filePath ( ) ;
2009-08-27 15:08:47 +02:00
# ifdef Q_OS_WIN
2010-04-14 17:45:23 +02:00
if ( ! qmakePath . endsWith ( QLatin1String ( " .exe " ) ) )
qmakePath . append ( QLatin1String ( " .exe " ) ) ;
2009-08-27 15:08:47 +02:00
# endif
2010-02-19 11:41:34 +01:00
// Is qmake still installed?
2010-08-24 18:10:08 +02:00
QFileInfo fi ( qmakePath ) ;
if ( fi . exists ( ) ) {
qmakePath = fi . absoluteFilePath ( ) ;
# ifdef Q_OS_WIN
qmakePath = qmakePath . toLower ( ) ;
# endif
2010-02-19 11:41:34 +01:00
return qmakePath ;
2010-08-24 18:10:08 +02:00
}
2008-12-02 12:01:29 +01:00
}
}
}
2010-02-02 17:09:41 +01:00
return QString ( ) ;
2008-12-02 12:01:29 +01:00
}
2009-09-03 19:16:22 +02:00
QtVersion * QtVersionManager : : qtVersionForQMakeBinary ( const QString & qmakePath )
2008-12-02 12:01:29 +01:00
{
foreach ( QtVersion * v , versions ( ) ) {
2010-08-24 18:07:03 +02:00
if ( v - > qmakeCommand ( ) = = qmakePath ) {
return v ;
break ;
}
}
2008-12-02 12:01:29 +01:00
return 0 ;
}
2009-07-22 16:52:44 +02:00
void dumpQMakeAssignments ( const QList < QMakeAssignment > & list )
2008-12-02 12:01:29 +01:00
{
2010-02-01 14:00:07 +01:00
foreach ( const QMakeAssignment & qa , list ) {
2009-07-22 16:52:44 +02:00
qDebug ( ) < < qa . variable < < qa . op < < qa . value ;
}
}
2010-10-05 17:38:45 +02:00
bool QtVersionManager : : makefileIsFor ( const QString & makefile , const QString & proFile )
2010-04-12 19:16:49 +02:00
{
if ( proFile . isEmpty ( ) )
return true ;
2010-10-05 17:38:45 +02:00
QString line = findQMakeLine ( makefile , QLatin1String ( " # Project: " ) ) . trimmed ( ) ;
2010-04-12 19:16:49 +02:00
if ( line . isEmpty ( ) )
return false ;
line = line . mid ( line . indexOf ( QChar ( ' : ' ) ) + 1 ) ;
line = line . trimmed ( ) ;
2010-10-05 17:38:45 +02:00
QFileInfo srcFileInfo ( QFileInfo ( makefile ) . absoluteDir ( ) , line ) ;
2010-04-12 19:16:49 +02:00
QFileInfo proFileInfo ( proFile ) ;
return srcFileInfo = = proFileInfo ;
}
2010-10-19 11:14:03 +02:00
QPair < QtVersion : : QmakeBuildConfigs , QString > QtVersionManager : : scanMakeFile ( const QString & makefile , QtVersion : : QmakeBuildConfigs defaultBuildConfig )
2009-07-22 16:52:44 +02:00
{
2009-08-17 11:49:59 +02:00
if ( debug )
qDebug ( ) < < " ScanMakeFile, the gory details: " ;
2009-12-10 19:12:51 +01:00
QtVersion : : QmakeBuildConfigs result = defaultBuildConfig ;
2010-10-19 11:14:03 +02:00
QString result2 ;
2009-07-22 16:52:44 +02:00
2010-10-05 17:38:45 +02:00
QString line = findQMakeLine ( makefile , QLatin1String ( " # Command: " ) ) ;
2009-07-22 16:52:44 +02:00
if ( ! line . isEmpty ( ) ) {
2009-08-17 11:49:59 +02:00
if ( debug )
qDebug ( ) < < " Found line " < < line ;
2009-07-22 16:52:44 +02:00
line = trimLine ( line ) ;
QList < QMakeAssignment > assignments ;
QList < QMakeAssignment > afterAssignments ;
2010-10-19 11:14:03 +02:00
parseArgs ( line , & assignments , & afterAssignments , & result2 ) ;
2009-07-22 16:52:44 +02:00
2009-08-17 11:49:59 +02:00
if ( debug ) {
dumpQMakeAssignments ( assignments ) ;
if ( ! afterAssignments . isEmpty ( ) )
qDebug ( ) < < " -after " ;
dumpQMakeAssignments ( afterAssignments ) ;
}
2009-07-22 16:52:44 +02:00
// Search in assignments for CONFIG(+=,-=,=)(debug,release,debug_and_release)
// Also remove them from the list
result = qmakeBuildConfigFromCmdArgs ( & assignments , defaultBuildConfig ) ;
2010-04-23 11:28:02 +02:00
if ( debug )
dumpQMakeAssignments ( assignments ) ;
2009-07-22 16:52:44 +02:00
2010-02-01 14:00:07 +01:00
foreach ( const QMakeAssignment & qa , assignments )
2010-10-19 11:14:03 +02:00
Utils : : QtcProcess : : addArg ( & result2 , qa . variable + qa . op + qa . value ) ;
2009-07-22 16:52:44 +02:00
if ( ! afterAssignments . isEmpty ( ) ) {
2010-10-19 11:14:03 +02:00
Utils : : QtcProcess : : addArg ( & result2 , QLatin1String ( " -after " ) ) ;
2010-02-01 14:00:07 +01:00
foreach ( const QMakeAssignment & qa , afterAssignments )
2010-10-19 11:14:03 +02:00
Utils : : QtcProcess : : addArg ( & result2 , qa . variable + qa . op + qa . value ) ;
2009-07-22 16:52:44 +02:00
}
}
// Dump the gathered information:
2009-08-17 11:49:59 +02:00
if ( debug ) {
qDebug ( ) < < " \n \n Dumping information from scanMakeFile " ;
qDebug ( ) < < " QMake CONFIG variable parsing " ;
qDebug ( ) < < " " < < ( result & QtVersion : : NoBuild ? " No Build " : QString : : number ( int ( result ) ) ) ;
qDebug ( ) < < " " < < ( result & QtVersion : : DebugBuild ? " debug " : " release " ) ;
qDebug ( ) < < " " < < ( result & QtVersion : : BuildAll ? " debug_and_release " : " no debug_and_release " ) ;
qDebug ( ) < < " \n Addtional Arguments " ;
qDebug ( ) < < result2 ;
qDebug ( ) < < " \n \n " ;
}
2009-07-22 16:52:44 +02:00
return qMakePair ( result , result2 ) ;
}
2010-10-05 17:38:45 +02:00
QString QtVersionManager : : findQMakeLine ( const QString & makefile , const QString & key )
2009-07-22 16:52:44 +02:00
{
2010-10-05 17:38:45 +02:00
QFile fi ( makefile ) ;
if ( fi . exists ( ) & & fi . open ( QFile : : ReadOnly ) ) {
QTextStream ts ( & fi ) ;
2008-12-02 12:01:29 +01:00
while ( ! ts . atEnd ( ) ) {
2010-02-01 12:43:56 +01:00
const QString line = ts . readLine ( ) ;
2010-04-12 19:16:49 +02:00
if ( line . startsWith ( key ) )
2009-07-22 16:52:44 +02:00
return line ;
}
}
return QString ( ) ;
}
/// This function trims the "#Command /path/to/qmake" from the the line
QString QtVersionManager : : trimLine ( const QString line )
{
// Actually the first space after #Command: /path/to/qmake
2010-02-01 12:43:56 +01:00
const int firstSpace = line . indexOf ( QLatin1Char ( ' ' ) , 11 ) ;
2009-07-22 16:52:44 +02:00
return line . mid ( firstSpace ) . trimmed ( ) ;
}
2010-10-19 11:14:03 +02:00
void QtVersionManager : : parseArgs ( const QString & args , QList < QMakeAssignment > * assignments , QList < QMakeAssignment > * afterAssignments , QString * additionalArguments )
2009-07-22 16:52:44 +02:00
{
QRegExp regExp ( " ([^ \\ s \\ +-]*) \ \ s * ( \ \ + = | = | - = | ~ = ) ( . * ) " ) ;
bool after = false ;
bool ignoreNext = false ;
2010-10-19 11:14:03 +02:00
* additionalArguments = args ;
Utils : : QtcProcess : : ArgIterator ait ( additionalArguments ) ;
while ( ait . next ( ) ) {
2009-07-22 16:52:44 +02:00
if ( ignoreNext ) {
// Ignoring
ignoreNext = false ;
2010-10-19 11:14:03 +02:00
ait . deleteArg ( ) ;
} else if ( ait . value ( ) = = QLatin1String ( " -after " ) ) {
2009-07-22 16:52:44 +02:00
after = true ;
2010-10-19 11:14:03 +02:00
ait . deleteArg ( ) ;
} else if ( ait . value ( ) . contains ( QLatin1Char ( ' = ' ) ) ) {
if ( regExp . exactMatch ( ait . value ( ) ) ) {
2009-07-22 16:52:44 +02:00
QMakeAssignment qa ;
qa . variable = regExp . cap ( 1 ) ;
qa . op = regExp . cap ( 2 ) ;
qa . value = regExp . cap ( 3 ) . trimmed ( ) ;
if ( after )
afterAssignments - > append ( qa ) ;
else
assignments - > append ( qa ) ;
} else {
qDebug ( ) < < " regexp did not match " ;
}
2010-10-19 11:14:03 +02:00
ait . deleteArg ( ) ;
} else if ( ait . value ( ) = = QLatin1String ( " -o " ) ) {
2009-07-22 16:52:44 +02:00
ignoreNext = true ;
2010-10-19 11:14:03 +02:00
ait . deleteArg ( ) ;
2009-07-22 16:52:44 +02:00
# if defined(Q_OS_WIN32)
2010-10-19 11:14:03 +02:00
} else if ( ait . value ( ) = = QLatin1String ( " -win32 " ) ) {
2009-07-22 16:52:44 +02:00
# elif defined(Q_OS_MAC)
2010-10-19 11:14:03 +02:00
} else if ( ait . value ( ) = = QLatin1String ( " -macx " ) ) {
2009-07-22 16:52:44 +02:00
# elif defined(Q_OS_QNX6)
2010-10-19 11:14:03 +02:00
} else if ( ait . value ( ) = = QLatin1String ( " -qnx6 " ) ) {
2009-07-22 16:52:44 +02:00
# else
2010-10-19 11:14:03 +02:00
} else if ( ait . value ( ) = = QLatin1String ( " -unix " ) ) {
2009-07-22 16:52:44 +02:00
# endif
2010-10-19 11:14:03 +02:00
ait . deleteArg ( ) ;
}
}
ait . deleteArg ( ) ; // The .pro file is always the last arg
2009-07-22 16:52:44 +02:00
}
/// This function extracts all the CONFIG+=debug, CONFIG+=release
2009-10-13 13:44:13 +02:00
QtVersion : : QmakeBuildConfigs QtVersionManager : : qmakeBuildConfigFromCmdArgs ( QList < QMakeAssignment > * assignments , QtVersion : : QmakeBuildConfigs defaultBuildConfig )
2009-07-22 16:52:44 +02:00
{
2009-10-13 13:44:13 +02:00
QtVersion : : QmakeBuildConfigs result = defaultBuildConfig ;
2009-07-22 16:52:44 +02:00
QList < QMakeAssignment > oldAssignments = * assignments ;
assignments - > clear ( ) ;
2010-02-01 14:00:07 +01:00
foreach ( const QMakeAssignment & qa , oldAssignments ) {
2009-07-22 16:52:44 +02:00
if ( qa . variable = = " CONFIG " ) {
QStringList values = qa . value . split ( ' ' ) ;
QStringList newValues ;
foreach ( const QString & value , values ) {
if ( value = = " debug " ) {
if ( qa . op = = " += " )
2009-10-13 13:44:13 +02:00
result = result | QtVersion : : DebugBuild ;
2009-07-22 16:52:44 +02:00
else
2009-10-13 13:44:13 +02:00
result = result & ~ QtVersion : : DebugBuild ;
2009-07-22 16:52:44 +02:00
} else if ( value = = " release " ) {
if ( qa . op = = " += " )
2009-10-13 13:44:13 +02:00
result = result & ~ QtVersion : : DebugBuild ;
2009-07-22 16:52:44 +02:00
else
2009-10-13 13:44:13 +02:00
result = result | QtVersion : : DebugBuild ;
2009-07-22 16:52:44 +02:00
} else if ( value = = " debug_and_release " ) {
if ( qa . op = = " += " )
2009-10-13 13:44:13 +02:00
result = result | QtVersion : : BuildAll ;
2009-07-22 16:52:44 +02:00
else
2009-10-13 13:44:13 +02:00
result = result & ~ QtVersion : : BuildAll ;
2009-07-22 16:52:44 +02:00
} else {
newValues . append ( value ) ;
2008-12-02 12:01:29 +01:00
}
2009-07-22 16:52:44 +02:00
QMakeAssignment newQA = qa ;
newQA . value = newValues . join ( " " ) ;
if ( ! newValues . isEmpty ( ) )
assignments - > append ( newQA ) ;
2008-12-02 12:01:29 +01:00
}
2009-07-22 16:52:44 +02:00
} else {
assignments - > append ( qa ) ;
2008-12-02 12:01:29 +01:00
}
}
return result ;
}
2010-09-08 15:22:58 +02:00
static bool queryQMakeVariables ( const QString & binary , QHash < QString , QString > * versionInfo )
2008-12-02 12:01:29 +01:00
{
2010-09-08 15:22:58 +02:00
const int timeOutMS = 30000 ; // Might be slow on some machines.
QFileInfo qmake ( binary ) ;
static const char * const variables [ ] = {
2009-07-31 20:37:47 +02:00
" QT_VERSION " ,
2009-03-22 13:47:57 +01:00
" QT_INSTALL_DATA " ,
" QT_INSTALL_LIBS " ,
" QT_INSTALL_HEADERS " ,
" QT_INSTALL_DEMOS " ,
" QT_INSTALL_EXAMPLES " ,
" QT_INSTALL_CONFIGURATION " ,
" QT_INSTALL_TRANSLATIONS " ,
" QT_INSTALL_PLUGINS " ,
" QT_INSTALL_BINS " ,
" QT_INSTALL_DOCS " ,
2010-03-18 12:43:13 +01:00
" QT_INSTALL_PREFIX " ,
2010-10-13 13:04:48 +02:00
" QT_INSTALL_IMPORTS " ,
2010-03-18 12:43:13 +01:00
" QMAKEFEATURES "
2009-03-22 13:47:57 +01:00
} ;
2010-09-08 15:22:58 +02:00
QStringList args ;
for ( uint i = 0 ; i < sizeof variables / sizeof variables [ 0 ] ; + + i )
args < < " -query " < < variables [ i ] ;
QProcess process ;
process . start ( qmake . absoluteFilePath ( ) , args , QIODevice : : ReadOnly ) ;
if ( ! process . waitForStarted ( ) ) {
qWarning ( " Cannot start '%s': %s " , qPrintable ( binary ) , qPrintable ( process . errorString ( ) ) ) ;
return false ;
}
if ( ! process . waitForFinished ( timeOutMS ) ) {
Utils : : SynchronousProcess : : stopProcess ( process ) ;
qWarning ( " Timeout running '%s' (%dms). " , qPrintable ( binary ) , timeOutMS ) ;
return false ;
}
2010-09-09 09:58:17 +02:00
if ( process . exitStatus ( ) ! = QProcess : : NormalExit ) {
qWarning ( " '%s' crashed. " , qPrintable ( binary ) ) ;
return false ;
}
2010-09-08 15:22:58 +02:00
QByteArray output = process . readAllStandardOutput ( ) ;
QTextStream stream ( & output ) ;
while ( ! stream . atEnd ( ) ) {
const QString line = stream . readLine ( ) ;
const int index = line . indexOf ( QLatin1Char ( ' : ' ) ) ;
if ( index ! = - 1 ) {
const QString value = QDir : : fromNativeSeparators ( line . mid ( index + 1 ) ) ;
if ( value ! = " **Unknown** " )
versionInfo - > insert ( line . left ( index ) , value ) ;
2008-12-02 12:01:29 +01:00
}
2010-09-08 15:22:58 +02:00
}
return true ;
}
void QtVersion : : updateVersionInfo ( ) const
{
if ( m_versionInfoUpToDate )
return ;
2008-12-02 12:01:29 +01:00
2010-09-08 15:22:58 +02:00
// extract data from qmake executable
m_versionInfo . clear ( ) ;
m_notInstalled = false ;
m_hasExamples = false ;
m_hasDocumentation = false ;
m_hasDebuggingHelper = false ;
2010-09-27 17:22:57 +02:00
m_hasQmlDump = false ;
2011-01-12 16:24:00 +01:00
m_hasQmlDebuggingLibrary = false ;
2010-09-27 17:22:57 +02:00
m_hasQmlObserver = false ;
2011-03-11 15:19:25 +01:00
m_qmakeIsExecutable = true ;
QFileInfo fi ( qmakeCommand ( ) ) ;
if ( ! fi . exists ( ) | | ! fi . isExecutable ( ) ) {
m_qmakeIsExecutable = false ;
return ;
}
2010-03-15 11:54:25 +01:00
2010-09-08 15:22:58 +02:00
if ( ! queryQMakeVariables ( qmakeCommand ( ) , & m_versionInfo ) )
return ;
2008-12-02 12:01:29 +01:00
2010-09-08 15:22:58 +02:00
if ( m_versionInfo . contains ( " QT_INSTALL_DATA " ) ) {
QString qtInstallData = m_versionInfo . value ( " QT_INSTALL_DATA " ) ;
m_versionInfo . insert ( " QMAKE_MKSPECS " , QDir : : cleanPath ( qtInstallData + " /mkspecs " ) ) ;
2010-09-27 15:51:49 +02:00
if ( ! qtInstallData . isEmpty ( ) ) {
2010-09-08 15:22:58 +02:00
m_hasDebuggingHelper = ! DebuggingHelperLibrary : : debuggingHelperLibraryByInstallData ( qtInstallData ) . isEmpty ( ) ;
2011-01-24 13:16:27 +01:00
m_hasQmlDump = ! QmlDumpTool : : toolByInstallData ( qtInstallData , false ) . isEmpty ( ) | | ! QmlDumpTool : : toolByInstallData ( qtInstallData , true ) . isEmpty ( ) ;
2011-01-12 16:24:00 +01:00
m_hasQmlDebuggingLibrary
= ! QmlDebuggingLibrary : : libraryByInstallData ( qtInstallData , false ) . isEmpty ( )
| | ! QmlDebuggingLibrary : : libraryByInstallData ( qtInstallData , true ) . isEmpty ( ) ;
2010-09-27 17:22:57 +02:00
m_hasQmlObserver = ! QmlObserverTool : : toolByInstallData ( qtInstallData ) . isEmpty ( ) ;
2010-09-27 15:51:49 +02:00
}
2010-09-08 15:22:58 +02:00
}
// Now check for a qt that is configured with a prefix but not installed
if ( m_versionInfo . contains ( " QT_INSTALL_BINS " ) ) {
QFileInfo fi ( m_versionInfo . value ( " QT_INSTALL_BINS " ) ) ;
if ( ! fi . exists ( ) )
m_notInstalled = true ;
}
if ( m_versionInfo . contains ( " QT_INSTALL_HEADERS " ) ) {
QFileInfo fi ( m_versionInfo . value ( " QT_INSTALL_HEADERS " ) ) ;
if ( ! fi . exists ( ) )
m_notInstalled = true ;
}
if ( m_versionInfo . contains ( " QT_INSTALL_DOCS " ) ) {
QFileInfo fi ( m_versionInfo . value ( " QT_INSTALL_DOCS " ) ) ;
if ( fi . exists ( ) )
m_hasDocumentation = true ;
}
if ( m_versionInfo . contains ( " QT_INSTALL_EXAMPLES " ) ) {
QFileInfo fi ( m_versionInfo . value ( " QT_INSTALL_EXAMPLES " ) ) ;
if ( fi . exists ( ) )
m_hasExamples = true ;
}
if ( m_versionInfo . contains ( " QT_INSTALL_DEMOS " ) ) {
QFileInfo fi ( m_versionInfo . value ( " QT_INSTALL_DEMOS " ) ) ;
if ( fi . exists ( ) )
m_hasDemos = true ;
2008-12-02 12:01:29 +01:00
}
2010-03-15 11:54:25 +01:00
2008-12-02 12:01:29 +01:00
m_versionInfoUpToDate = true ;
}
2009-05-19 14:54:52 +02:00
QString QtVersion : : findQtBinary ( const QStringList & possibleCommands ) const
{
const QString qtdirbin = versionInfo ( ) . value ( QLatin1String ( " QT_INSTALL_BINS " ) ) + QLatin1Char ( ' / ' ) ;
foreach ( const QString & possibleCommand , possibleCommands ) {
const QString fullPath = qtdirbin + possibleCommand ;
if ( QFileInfo ( fullPath ) . isFile ( ) )
return QDir : : cleanPath ( fullPath ) ;
}
2010-02-02 17:09:41 +01:00
return QString ( ) ;
2009-05-19 14:54:52 +02:00
}
2009-05-12 14:12:20 +02:00
QString QtVersion : : uicCommand ( ) const
{
if ( ! isValid ( ) )
2010-02-02 17:09:41 +01:00
return QString ( ) ;
2009-05-12 14:12:20 +02:00
if ( ! m_uicCommand . isNull ( ) )
return m_uicCommand ;
2009-05-19 14:54:52 +02:00
# ifdef Q_OS_WIN
const QStringList possibleCommands ( QLatin1String ( " uic.exe " ) ) ;
# else
2009-05-12 14:12:20 +02:00
QStringList possibleCommands ;
2009-05-19 14:54:52 +02:00
possibleCommands < < QLatin1String ( " uic-qt4 " ) < < QLatin1String ( " uic4 " ) < < QLatin1String ( " uic " ) ;
# endif
m_uicCommand = findQtBinary ( possibleCommands ) ;
return m_uicCommand ;
}
// Return a list of GUI binary names
// 'foo', 'foo.exe', 'Foo.app/Contents/MacOS/Foo'
static inline QStringList possibleGuiBinaries ( const QString & name )
{
2009-05-12 14:12:20 +02:00
# ifdef Q_OS_WIN
2009-05-19 14:54:52 +02:00
return QStringList ( name + QLatin1String ( " .exe " ) ) ;
2009-06-03 20:45:49 +02:00
# elif defined(Q_OS_MAC) // 'Foo.app/Contents/MacOS/Foo'
2009-05-19 14:54:52 +02:00
QString upCaseName = name ;
upCaseName [ 0 ] = upCaseName . at ( 0 ) . toUpper ( ) ;
QString macBinary = upCaseName ;
macBinary + = QLatin1String ( " .app/Contents/MacOS/ " ) ;
macBinary + = upCaseName ;
return QStringList ( macBinary ) ;
2009-05-12 14:12:20 +02:00
# else
2009-05-19 14:54:52 +02:00
return QStringList ( name ) ;
2009-05-12 14:12:20 +02:00
# endif
2009-05-19 14:54:52 +02:00
}
QString QtVersion : : designerCommand ( ) const
{
if ( ! isValid ( ) )
2010-02-02 17:09:41 +01:00
return QString ( ) ;
2009-05-19 14:54:52 +02:00
if ( m_designerCommand . isNull ( ) )
m_designerCommand = findQtBinary ( possibleGuiBinaries ( QLatin1String ( " designer " ) ) ) ;
return m_designerCommand ;
}
QString QtVersion : : linguistCommand ( ) const
{
if ( ! isValid ( ) )
2010-02-02 17:09:41 +01:00
return QString ( ) ;
2009-05-19 14:54:52 +02:00
if ( m_linguistCommand . isNull ( ) )
m_linguistCommand = findQtBinary ( possibleGuiBinaries ( QLatin1String ( " linguist " ) ) ) ;
return m_linguistCommand ;
2009-05-12 14:12:20 +02:00
}
2010-08-19 16:51:27 +02:00
QString QtVersion : : qmlviewerCommand ( ) const
{
if ( ! isValid ( ) )
return QString ( ) ;
2010-09-27 17:22:57 +02:00
2010-08-19 16:51:27 +02:00
if ( m_qmlviewerCommand . isNull ( ) ) {
# ifdef Q_OS_MAC
const QString qmlViewerName = QLatin1String ( " QMLViewer " ) ;
# else
const QString qmlViewerName = QLatin1String ( " qmlviewer " ) ;
# endif
m_qmlviewerCommand = findQtBinary ( possibleGuiBinaries ( qmlViewerName ) ) ;
}
return m_qmlviewerCommand ;
}
2011-03-08 12:57:12 +01:00
void QtVersion : : setSystemRoot ( const QString & root )
2011-02-01 18:36:00 +01:00
{
2011-03-08 12:57:12 +01:00
if ( root = = m_systemRoot )
return ;
m_systemRoot = root ;
m_abiUpToDate = false ;
}
2011-02-01 18:36:00 +01:00
2011-03-08 12:57:12 +01:00
QString QtVersion : : systemRoot ( ) const
{
updateAbiAndMkspec ( ) ;
2011-02-01 18:36:00 +01:00
return m_systemRoot ;
}
2010-02-08 15:50:06 +01:00
bool QtVersion : : supportsTargetId ( const QString & id ) const
{
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
2010-02-11 18:01:52 +01:00
return m_targetIds . contains ( id ) ;
2010-02-08 15:50:06 +01:00
}
QSet < QString > QtVersion : : supportedTargetIds ( ) const
{
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
2010-02-11 18:01:52 +01:00
return m_targetIds ;
2010-02-08 15:50:06 +01:00
}
2011-02-01 18:36:00 +01:00
QList < ProjectExplorer : : Abi > QtVersion : : qtAbis ( ) const
2009-10-22 14:22:16 +02:00
{
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
return m_abis ;
2009-10-22 14:22:16 +02:00
}
// if none, then it's INVALID everywhere this function is called
2011-02-01 18:36:00 +01:00
void QtVersion : : updateAbiAndMkspec ( ) const
2009-10-22 14:22:16 +02:00
{
2011-02-01 18:36:00 +01:00
if ( m_id = = - 1 | | m_abiUpToDate )
2009-10-22 14:22:16 +02:00
return ;
2011-03-08 12:57:12 +01:00
m_abiUpToDate = true ;
2010-02-11 18:01:52 +01:00
m_targetIds . clear ( ) ;
2011-02-01 18:36:00 +01:00
m_abis . clear ( ) ;
2011-03-11 15:19:25 +01:00
m_validSystemRoot = true ;
2009-11-09 18:59:11 +01:00
2009-11-11 18:36:03 +01:00
// qDebug()<<"Finding mkspec for"<<qmakeCommand();
2009-11-09 18:59:11 +01:00
// no .qmake.cache so look at the default mkspec
QString baseMkspecDir = versionInfo ( ) . value ( " QMAKE_MKSPECS " ) ;
if ( baseMkspecDir . isEmpty ( ) )
baseMkspecDir = versionInfo ( ) . value ( " QT_INSTALL_DATA " ) + " /mkspecs " ;
2009-11-10 18:57:40 +01:00
# ifdef Q_OS_WIN
baseMkspecDir = baseMkspecDir . toLower ( ) ;
# endif
2009-11-09 18:59:11 +01:00
QString mkspecFullPath = baseMkspecDir + " /default " ;
// qDebug() << "default mkspec is located at" << mkspecFullPath;
# ifdef Q_OS_WIN
QFile f2 ( mkspecFullPath + " /qmake.conf " ) ;
if ( f2 . exists ( ) & & f2 . open ( QIODevice : : ReadOnly ) ) {
while ( ! f2 . atEnd ( ) ) {
QByteArray line = f2 . readLine ( ) ;
if ( line . startsWith ( " QMAKESPEC_ORIGINAL " ) ) {
const QList < QByteArray > & temp = line . split ( ' = ' ) ;
if ( temp . size ( ) = = 2 ) {
2010-03-15 16:07:54 +01:00
QString possibleFullPath = temp . at ( 1 ) . trimmed ( ) ;
2010-02-12 13:55:22 +01:00
// We sometimes get a mix of different slash styles here...
2010-03-15 16:07:54 +01:00
possibleFullPath = possibleFullPath . replace ( ' \\ ' , ' / ' ) ;
if ( QFileInfo ( possibleFullPath ) . exists ( ) ) // Only if the path exists
2010-03-15 17:03:11 +01:00
mkspecFullPath = possibleFullPath ;
2009-11-09 18:59:11 +01:00
}
break ;
}
}
f2 . close ( ) ;
}
# elif defined(Q_OS_MAC)
QFile f2 ( mkspecFullPath + " /qmake.conf " ) ;
if ( f2 . exists ( ) & & f2 . open ( QIODevice : : ReadOnly ) ) {
while ( ! f2 . atEnd ( ) ) {
QByteArray line = f2 . readLine ( ) ;
if ( line . startsWith ( " MAKEFILE_GENERATOR " ) ) {
const QList < QByteArray > & temp = line . split ( ' = ' ) ;
if ( temp . size ( ) = = 2 ) {
const QByteArray & value = temp . at ( 1 ) ;
if ( value . contains ( " XCODE " ) ) {
// we don't want to generate xcode projects...
// qDebug() << "default mkspec is xcode, falling back to g++";
mkspecFullPath = baseMkspecDir + " /macx-g++ " ;
}
//resolve mkspec link
2011-01-17 15:17:44 +01:00
mkspecFullPath = resolveLink ( mkspecFullPath ) ;
2009-11-09 18:59:11 +01:00
}
break ;
}
}
f2 . close ( ) ;
}
# else
2011-01-17 15:17:44 +01:00
mkspecFullPath = resolveLink ( mkspecFullPath ) ;
2009-11-09 18:59:11 +01:00
# endif
# ifdef Q_OS_WIN
2009-11-10 18:57:40 +01:00
mkspecFullPath = mkspecFullPath . toLower ( ) ;
2009-11-09 18:59:11 +01:00
# endif
m_mkspecFullPath = mkspecFullPath ;
QString mkspec = m_mkspecFullPath ;
if ( mkspec . startsWith ( baseMkspecDir ) ) {
mkspec = mkspec . mid ( baseMkspecDir . length ( ) + 1 ) ;
2009-11-11 18:36:03 +01:00
// qDebug() << "Setting mkspec to"<<mkspec;
2009-11-09 18:59:11 +01:00
} else {
QString sourceMkSpecPath = sourcePath ( ) + " /mkspecs " ;
if ( mkspec . startsWith ( sourceMkSpecPath ) ) {
mkspec = mkspec . mid ( sourceMkSpecPath . length ( ) + 1 ) ;
} else {
// Do nothing
}
}
m_mkspec = mkspec ;
2010-08-11 14:44:46 +02:00
m_isBuildUsingSbsV2 = false ;
2009-12-07 20:49:39 +01:00
ProFileOption option ;
option . properties = versionInfo ( ) ;
2010-06-18 20:21:05 +02:00
ProMessageHandler msgHandler ( true ) ;
2010-03-10 16:55:37 +01:00
ProFileCacheManager : : instance ( ) - > incRefCount ( ) ;
2010-06-18 20:21:05 +02:00
ProFileParser parser ( ProFileCacheManager : : instance ( ) - > cache ( ) , & msgHandler ) ;
2010-06-18 20:21:58 +02:00
ProFileEvaluator evaluator ( & option , & parser , & msgHandler ) ;
2010-06-18 20:21:05 +02:00
if ( ProFile * pro = parser . parsedProFile ( m_mkspecFullPath + " /qmake.conf " ) ) {
2010-06-18 20:21:58 +02:00
evaluator . setCumulative ( false ) ;
2010-06-24 16:41:33 +02:00
evaluator . accept ( pro , ProFileEvaluator : : LoadProOnly ) ;
2010-06-18 20:21:05 +02:00
pro - > deref ( ) ;
}
2010-06-18 20:21:58 +02:00
QString qmakeCXX = evaluator . values ( " QMAKE_CXX " ) . join ( " " ) ;
QString makefileGenerator = evaluator . value ( " MAKEFILE_GENERATOR " ) ;
QString ce_sdk = evaluator . values ( " CE_SDK " ) . join ( QLatin1String ( " " ) ) ;
QString ce_arch = evaluator . value ( " CE_ARCH " ) ;
2011-02-01 18:36:00 +01:00
2011-03-07 17:54:57 +01:00
const QString coreLibrary = qtCorePath ( ) ;
2011-02-01 18:36:00 +01:00
// Evaluate all the information we have:
2009-10-22 14:22:16 +02:00
if ( ! ce_sdk . isEmpty ( ) & & ! ce_arch . isEmpty ( ) ) {
2011-02-01 18:36:00 +01:00
// Treat windows CE as desktop.
2011-02-23 16:47:08 +01:00
m_abis . append ( ProjectExplorer : : Abi ( ProjectExplorer : : Abi : : ArmArchitecture , ProjectExplorer : : Abi : : WindowsOS ,
ProjectExplorer : : Abi : : WindowsCEFlavor , ProjectExplorer : : Abi : : PEFormat , false ) ) ;
2010-02-25 16:51:27 +01:00
m_targetIds . insert ( Constants : : DESKTOP_TARGET_ID ) ;
2009-11-19 16:37:13 +01:00
} else if ( makefileGenerator = = QLatin1String ( " SYMBIAN_ABLD " ) | |
2010-02-17 17:38:48 +01:00
makefileGenerator = = QLatin1String ( " SYMBIAN_SBSV2 " ) | |
makefileGenerator = = QLatin1String ( " SYMBIAN_UNIX " ) ) {
2010-08-11 14:44:46 +02:00
m_isBuildUsingSbsV2 = ( makefileGenerator = = QLatin1String ( " SYMBIAN_SBSV2 " ) ) ;
2011-02-01 18:36:00 +01:00
if ( S60Manager : : instance ( ) ) {
2011-02-23 16:47:08 +01:00
m_abis . append ( ProjectExplorer : : Abi ( ProjectExplorer : : Abi : : ArmArchitecture , ProjectExplorer : : Abi : : SymbianOS ,
ProjectExplorer : : Abi : : UnknownFlavor ,
ProjectExplorer : : Abi : : ElfFormat ,
2011-02-01 18:36:00 +01:00
32 ) ) ;
2010-03-17 08:20:27 +01:00
m_targetIds . insert ( QLatin1String ( Constants : : S60_DEVICE_TARGET_ID ) ) ;
2011-02-01 18:36:00 +01:00
m_targetIds . insert ( QLatin1String ( Constants : : S60_EMULATOR_TARGET_ID ) ) ;
2009-11-13 15:47:35 +01:00
}
2011-01-19 10:16:47 +01:00
} else if ( MaemoGlobal : : isValidMaemo5QtVersion ( this ) ) {
2011-02-23 16:47:08 +01:00
m_abis . append ( ProjectExplorer : : Abi ( ProjectExplorer : : Abi : : ArmArchitecture , ProjectExplorer : : Abi : : LinuxOS ,
ProjectExplorer : : Abi : : MaemoLinuxFlavor , ProjectExplorer : : Abi : : ElfFormat ,
2011-02-01 18:36:00 +01:00
32 ) ) ;
2011-01-18 15:20:57 +01:00
m_targetIds . insert ( QLatin1String ( Constants : : MAEMO5_DEVICE_TARGET_ID ) ) ;
2011-01-19 10:16:47 +01:00
} else if ( MaemoGlobal : : isValidHarmattanQtVersion ( this ) ) {
2011-02-23 16:47:08 +01:00
m_abis . append ( ProjectExplorer : : Abi ( ProjectExplorer : : Abi : : ArmArchitecture , ProjectExplorer : : Abi : : LinuxOS ,
ProjectExplorer : : Abi : : HarmattanLinuxFlavor ,
ProjectExplorer : : Abi : : ElfFormat ,
2011-02-01 18:36:00 +01:00
32 ) ) ;
2011-01-18 15:20:57 +01:00
m_targetIds . insert ( QLatin1String ( Constants : : HARMATTAN_DEVICE_TARGET_ID ) ) ;
2011-01-31 17:46:19 +01:00
} else if ( MaemoGlobal : : isValidMeegoQtVersion ( this ) ) {
2011-02-23 16:47:08 +01:00
m_abis . append ( ProjectExplorer : : Abi ( ProjectExplorer : : Abi : : ArmArchitecture , ProjectExplorer : : Abi : : LinuxOS ,
ProjectExplorer : : Abi : : MeegoLinuxFlavor ,
ProjectExplorer : : Abi : : ElfFormat , 32 ) ) ;
2011-01-31 17:46:19 +01:00
m_targetIds . insert ( QLatin1String ( Constants : : MEEGO_DEVICE_TARGET_ID ) ) ;
2011-02-01 18:36:00 +01:00
} else if ( qmakeCXX . contains ( " g++ " )
| | qmakeCXX = = " cl " | | qmakeCXX = = " icl " // intel cl
| | qmakeCXX = = QLatin1String ( " icpc " ) ) {
2011-03-07 17:54:57 +01:00
m_abis = ProjectExplorer : : Abi : : abisOfBinary ( coreLibrary ) ;
2011-02-01 18:36:00 +01:00
# if defined (Q_OS_WIN)
if ( makefileGenerator = = " MINGW " ) {
QList < ProjectExplorer : : Abi > tmp = m_abis ;
m_abis . clear ( ) ;
foreach ( const ProjectExplorer : : Abi & abi , tmp )
2011-02-23 19:10:09 +01:00
m_abis . append ( ProjectExplorer : : Abi ( abi . architecture ( ) , abi . os ( ) , ProjectExplorer : : Abi : : WindowsMSysFlavor ,
2011-02-01 18:36:00 +01:00
abi . binaryFormat ( ) , abi . wordWidth ( ) ) ) ;
}
# endif
2010-04-09 18:43:05 +02:00
m_targetIds . insert ( QLatin1String ( Constants : : DESKTOP_TARGET_ID ) ) ;
2009-10-16 16:48:49 +02:00
}
2011-02-01 18:36:00 +01:00
2011-03-07 17:54:57 +01:00
if ( m_abis . isEmpty ( ) & & ! coreLibrary . isEmpty ( ) ) {
qWarning ( " Warning: Could not find ABI for '%s' ('%s', %s)/%s by looking at %s: "
2011-02-28 12:29:41 +01:00
" Qt Creator does not know about the system includes, "
" nor the system defines. " ,
qPrintable ( m_mkspecFullPath ) , qPrintable ( displayName ( ) ) ,
2011-03-07 17:54:57 +01:00
qPrintable ( qmakeCommand ( ) ) , qPrintable ( qmakeCXX ) , qPrintable ( coreLibrary ) ) ;
2009-10-22 14:22:16 +02:00
}
2010-06-18 20:21:58 +02:00
QStringList configValues = evaluator . values ( " CONFIG " ) ;
2009-11-09 18:59:11 +01:00
m_defaultConfigIsDebugAndRelease = false ;
foreach ( const QString & value , configValues ) {
if ( value = = " debug " )
m_defaultConfigIsDebug = true ;
else if ( value = = " release " )
m_defaultConfigIsDebug = false ;
else if ( value = = " build_all " )
m_defaultConfigIsDebugAndRelease = true ;
}
2010-06-10 15:20:34 +02:00
// Is this actually a simulator Qt?
if ( configValues . contains ( QLatin1String ( " simulator " ) ) ) {
m_targetIds . clear ( ) ;
m_targetIds . insert ( QLatin1String ( Constants : : QT_SIMULATOR_TARGET_ID ) ) ;
}
2010-03-10 16:55:37 +01:00
ProFileCacheManager : : instance ( ) - > decRefCount ( ) ;
2011-03-08 12:57:12 +01:00
// Set up systemroot
if ( supportsTargetId ( Constants : : MAEMO5_DEVICE_TARGET_ID )
| | supportsTargetId ( Constants : : HARMATTAN_DEVICE_TARGET_ID ) ) {
if ( m_systemRoot . isNull ( ) ) {
QFile file ( QDir : : cleanPath ( MaemoGlobal : : targetRoot ( this ) )
+ QLatin1String ( " /information " ) ) ;
if ( file . exists ( ) & & file . open ( QIODevice : : ReadOnly | QIODevice : : Text ) ) {
QTextStream stream ( & file ) ;
while ( ! stream . atEnd ( ) ) {
const QString & line = stream . readLine ( ) . trimmed ( ) ;
const QStringList & list = line . split ( QLatin1Char ( ' ' ) ) ;
if ( list . count ( ) < = 1 )
continue ;
if ( list . at ( 0 ) = = QLatin1String ( " sysroot " ) ) {
m_systemRoot = MaemoGlobal : : maddeRoot ( this )
+ QLatin1String ( " /sysroots/ " ) + list . at ( 1 ) ;
}
}
}
}
} else if ( supportsTargetId ( Constants : : S60_DEVICE_TARGET_ID )
| | supportsTargetId ( Constants : : S60_EMULATOR_TARGET_ID ) ) {
2011-03-11 15:19:25 +01:00
if ( m_systemRoot . isEmpty ( ) )
m_validSystemRoot = false ;
2011-03-08 12:57:12 +01:00
if ( ! m_systemRoot . endsWith ( QLatin1Char ( ' / ' ) ) )
m_systemRoot . append ( QLatin1Char ( ' / ' ) ) ;
2011-03-11 15:19:25 +01:00
QFileInfo cppheader ( m_systemRoot + QLatin1String ( " epoc32/include/stdapis/string.h " ) ) ;
if ( ! cppheader . exists ( ) )
m_validSystemRoot = false ;
2011-03-08 12:57:12 +01:00
} else {
m_systemRoot = QLatin1String ( " " ) ;
}
2008-12-02 12:01:29 +01:00
}
2011-01-17 15:17:44 +01:00
QString QtVersion : : resolveLink ( const QString & path ) const
{
QFileInfo f ( path ) ;
int links = 16 ;
while ( links - - & & f . isSymLink ( ) )
f . setFile ( f . symLinkTarget ( ) ) ;
if ( links < = 0 )
return QString ( ) ;
2011-01-17 15:54:49 +01:00
return f . filePath ( ) ;
2011-01-17 15:17:44 +01:00
}
2011-02-01 18:36:00 +01:00
QString QtVersion : : qtCorePath ( ) const
2009-06-04 10:50:44 +02:00
{
2011-03-02 12:25:22 +01:00
QList < QDir > dirs ;
dirs < < QDir ( libraryInstallPath ( ) ) < < QDir ( versionInfo ( ) . value ( QLatin1String ( " QT_INSTALL_BINS " ) ) ) ;
2011-03-03 11:29:07 +01:00
QFileInfoList staticLibs ;
2011-03-02 12:25:22 +01:00
foreach ( const QDir & d , dirs ) {
QFileInfoList infoList = d . entryInfoList ( ) ;
foreach ( const QFileInfo & info , infoList ) {
const QString file = info . fileName ( ) ;
if ( info . isDir ( )
& & file . startsWith ( QLatin1String ( " QtCore " ) )
& & file . endsWith ( QLatin1String ( " .framework " ) ) ) {
// handle Framework
const QString libName = file . left ( file . lastIndexOf ( ' . ' ) ) ;
return info . absoluteFilePath ( ) + ' / ' + libName ;
}
2011-03-02 14:09:18 +01:00
if ( info . isReadable ( ) ) {
if ( file . startsWith ( QLatin1String ( " libQtCore " ) )
| | file . startsWith ( QLatin1String ( " QtCore " ) ) ) {
// Only handle static libs if we can not find dynamic ones:
2011-03-03 11:29:07 +01:00
if ( file . endsWith ( " .a " ) | | file . endsWith ( " .lib " ) )
2011-03-02 15:59:30 +01:00
staticLibs . append ( info ) ;
2011-03-02 14:09:18 +01:00
else if ( file . endsWith ( QLatin1String ( " .dll " ) )
| | file . endsWith ( QString : : fromLatin1 ( " .so. " ) + qtVersionString ( ) ) )
return info . absoluteFilePath ( ) ;
}
2011-03-02 12:25:22 +01:00
}
2011-02-22 17:53:12 +01:00
}
2011-02-01 18:36:00 +01:00
}
2011-03-03 11:29:07 +01:00
// Return path to first static library found:
if ( ! staticLibs . isEmpty ( ) )
return staticLibs . at ( 0 ) . absoluteFilePath ( ) ;
2011-02-01 18:36:00 +01:00
return QString ( ) ;
2009-06-04 10:50:44 +02:00
}
2011-02-01 18:36:00 +01:00
2010-11-15 15:24:17 +01:00
QString QtVersion : : sbsV2Directory ( ) const
{
return m_sbsV2Directory ;
}
void QtVersion : : setSbsV2Directory ( const QString & directory )
{
m_sbsV2Directory = directory ;
}
2011-02-01 18:36:00 +01:00
void QtVersion : : addToEnvironment ( Utils : : Environment & env ) const
2008-12-02 12:01:29 +01:00
{
2011-02-01 18:36:00 +01:00
// Generic:
env . set ( " QTDIR " , QDir : : toNativeSeparators ( versionInfo ( ) . value ( " QT_INSTALL_DATA " ) ) ) ;
env . prependOrSetPath ( versionInfo ( ) . value ( " QT_INSTALL_BINS " ) ) ;
2008-12-02 12:01:29 +01:00
2011-02-01 18:36:00 +01:00
// Symbian specific:
if ( supportsTargetId ( Constants : : S60_DEVICE_TARGET_ID )
| | supportsTargetId ( Constants : : S60_EMULATOR_TARGET_ID ) ) {
// Generic Symbian environment:
QString epocRootPath ( systemRoot ( ) ) ;
QDir epocDir ( epocRootPath ) ;
2011-02-24 17:17:25 +01:00
// Clean up epoc root path for the environment:
2011-02-01 18:36:00 +01:00
if ( ! epocRootPath . endsWith ( QLatin1Char ( ' / ' ) ) )
epocRootPath . append ( QLatin1Char ( ' / ' ) ) ;
2011-02-24 17:17:25 +01:00
if ( ! isBuildWithSymbianSbsV2 ( ) ) {
# ifdef Q_OS_WIN
if ( epocRootPath . count ( ) > 2
& & epocRootPath . at ( 0 ) . toLower ( ) > = QLatin1Char ( ' a ' )
& & epocRootPath . at ( 0 ) . toLower ( ) < = QLatin1Char ( ' z ' )
& & epocRootPath . at ( 1 ) = = QLatin1Char ( ' : ' ) ) {
epocRootPath = epocRootPath . mid ( 2 ) ;
}
# endif
}
env . set ( QLatin1String ( " EPOCROOT " ) , QDir : : toNativeSeparators ( epocRootPath ) ) ;
2011-02-01 18:36:00 +01:00
env . prependOrSetPath ( epocDir . filePath ( QLatin1String ( " epoc32/tools " ) ) ) ; // e.g. make.exe
// Windows only:
2011-02-23 16:47:08 +01:00
if ( ProjectExplorer : : Abi : : hostAbi ( ) . os ( ) = = ProjectExplorer : : Abi : : WindowsOS ) {
2011-02-01 18:36:00 +01:00
QString winDir = QLatin1String ( qgetenv ( " WINDIR " ) ) ;
if ( ! winDir . isEmpty ( ) )
env . prependOrSetPath ( QDir ( winDir ) . filePath ( QLatin1String ( " system32 " ) ) ) ;
if ( epocDir . exists ( QLatin1String ( " epoc32/gcc/bin " ) ) )
env . prependOrSetPath ( epocDir . filePath ( QLatin1String ( " epoc32/gcc/bin " ) ) ) ; // e.g. cpp.exe, *NOT* gcc.exe
// Find perl in the special Symbian flavour:
if ( epocDir . exists ( QLatin1String ( " ../../tools/perl/bin " ) ) ) {
epocDir . cd ( QLatin1String ( " ../../tools/perl/bin " ) ) ;
env . prependOrSetPath ( epocDir . absolutePath ( ) ) ;
} else {
env . prependOrSetPath ( epocDir . filePath ( QLatin1String ( " perl/bin " ) ) ) ;
}
}
2008-12-02 12:01:29 +01:00
2011-02-01 18:36:00 +01:00
// SBSv2:
if ( isBuildWithSymbianSbsV2 ( ) ) {
QString sbsHome ( env . value ( QLatin1String ( " SBS_HOME " ) ) ) ;
if ( ! m_sbsV2Directory . isEmpty ( ) ) {
env . prependOrSetPath ( m_sbsV2Directory + QLatin1String ( " /bin " ) ) ;
env . unset ( QLatin1String ( " SBS_HOME " ) ) ; // unset SBS_HOME to prevent SBS from picking it up
} else if ( ! sbsHome . isEmpty ( ) ) {
env . prependOrSetPath ( sbsHome + QLatin1Char ( ' / ' ) + QLatin1String ( " bin " ) ) ;
}
}
}
2008-12-02 12:01:29 +01:00
}
2011-02-01 18:36:00 +01:00
static const char * S60_EPOC_HEADERS [ ] = {
" include " , " mkspecs/common/symbian " , " epoc32/include " ,
" epoc32/include/osextensions/stdapis " , " epoc32/include/osextensions/stdapis/sys " ,
" epoc32/include/stdapis " , " epoc32/include/stdapis/sys " ,
" epoc32/include/osextensions/stdapis/stlport " , " epoc32/include/stdapis/stlport " ,
" epoc32/include/oem " , " epoc32/include/middleware " , " epoc32/include/domain/middleware " ,
" epoc32/include/osextensions " , " epoc32/include/domain/osextensions " ,
" epoc32/include/domain/osextensions/loc " , " epoc32/include/domain/middleware/loc " ,
" epoc32/include/domain/osextensions/loc/sc " , " epoc32/include/domain/middleware/loc/sc "
} ;
2008-12-02 12:01:29 +01:00
2011-02-01 18:36:00 +01:00
QList < ProjectExplorer : : HeaderPath > QtVersion : : systemHeaderPathes ( ) const
{
QList < ProjectExplorer : : HeaderPath > result ;
if ( supportsTargetId ( Constants : : S60_DEVICE_TARGET_ID )
| | supportsTargetId ( Constants : : S60_EMULATOR_TARGET_ID ) ) {
QString root = systemRoot ( ) + QLatin1Char ( ' / ' ) ;
const int count = sizeof ( S60_EPOC_HEADERS ) / sizeof ( const char * ) ;
for ( int i = 0 ; i < count ; + + i ) {
const QDir dir ( root + QLatin1String ( S60_EPOC_HEADERS [ i ] ) ) ;
if ( dir . exists ( ) )
result . append ( ProjectExplorer : : HeaderPath ( dir . absolutePath ( ) ,
ProjectExplorer : : HeaderPath : : GlobalHeaderPath ) ) ;
2010-11-22 15:38:21 +01:00
}
2010-11-17 10:37:11 +01:00
}
2011-02-01 18:36:00 +01:00
return result ;
2008-12-02 12:01:29 +01:00
}
int QtVersion : : uniqueId ( ) const
{
return m_id ;
}
int QtVersion : : getUniqueId ( )
{
2009-04-22 16:51:38 +02:00
return QtVersionManager : : instance ( ) - > getUniqueId ( ) ;
2008-12-02 12:01:29 +01:00
}
bool QtVersion : : isValid ( ) const
{
2009-11-09 18:59:11 +01:00
updateVersionInfo ( ) ;
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
2010-01-12 15:46:23 +01:00
return m_id ! = - 1
2010-02-02 17:09:41 +01:00
& & ! qmakeCommand ( ) . isEmpty ( )
& & ! displayName ( ) . isEmpty ( )
2010-01-12 15:46:23 +01:00
& & ! m_notInstalled
2011-01-17 15:17:44 +01:00
& & m_versionInfo . contains ( " QT_INSTALL_BINS " )
2011-02-01 18:36:00 +01:00
& & ( ! m_mkspecFullPath . isEmpty ( ) | | ! m_abiUpToDate )
2011-03-11 15:19:25 +01:00
& & ! m_abis . isEmpty ( )
& & m_qmakeIsExecutable
& & m_validSystemRoot ;
2010-01-12 15:46:23 +01:00
}
2011-03-10 17:55:02 +01:00
bool QtVersion : : toolChainAvailable ( ) const
{
if ( ! isValid ( ) )
return false ;
foreach ( const ProjectExplorer : : Abi & abi , qtAbis ( ) )
if ( ! ProjectExplorer : : ToolChainManager : : instance ( ) - > findToolChains ( abi ) . isEmpty ( ) )
return true ;
return false ;
}
2010-01-12 15:46:23 +01:00
QString QtVersion : : invalidReason ( ) const
{
if ( isValid ( ) )
return QString ( ) ;
2010-02-01 12:43:56 +01:00
if ( qmakeCommand ( ) . isEmpty ( ) )
2010-02-25 10:34:25 +01:00
return QCoreApplication : : translate ( " QtVersion " , " No qmake path set " ) ;
2011-03-11 15:19:25 +01:00
if ( ! m_qmakeIsExecutable )
return QCoreApplication : : translate ( " QtVersion " , " qmake does not exist or is not executable " ) ;
2010-02-01 12:43:56 +01:00
if ( displayName ( ) . isEmpty ( ) )
2010-02-26 14:18:47 +01:00
return QCoreApplication : : translate ( " QtVersion " , " Qt version has no name " ) ;
2010-01-12 15:46:23 +01:00
if ( m_notInstalled )
2010-02-26 14:18:47 +01:00
return QCoreApplication : : translate ( " QtVersion " , " Qt version is not properly installed, please run make install " ) ;
2010-01-12 15:46:23 +01:00
if ( ! m_versionInfo . contains ( " QT_INSTALL_BINS " ) )
2010-02-26 14:18:47 +01:00
return QCoreApplication : : translate ( " QtVersion " ,
2011-01-12 16:24:00 +01:00
" Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong? " ) ;
2011-02-01 18:36:00 +01:00
if ( m_abiUpToDate & & m_mkspecFullPath . isEmpty ( ) )
2011-01-17 15:17:44 +01:00
return QCoreApplication : : translate ( " QtVersion " , " The default mkspec symlink is broken. " ) ;
2011-03-03 17:01:45 +01:00
if ( m_abiUpToDate & & m_abis . isEmpty ( ) )
return QCoreApplication : : translate ( " QtVersion " , " Failed to detect the ABI(s) used by the Qt version. " ) ;
2011-03-11 15:19:25 +01:00
if ( ! m_validSystemRoot )
return QCoreApplication : : translate ( " QtVersion " , " The \" Open C/C++ plugin \" is not installed in the Symbian SDK or the Symbian SDK path is misconfigured " ) ;
2010-01-12 15:46:23 +01:00
return QString ( ) ;
2008-12-02 12:01:29 +01:00
}
2010-12-03 15:28:54 +01:00
QString QtVersion : : description ( ) const
{
if ( ! isValid ( ) )
return invalidReason ( ) ;
QSet < QString > targets = supportedTargetIds ( ) ;
QString envs ;
if ( targets . contains ( Constants : : DESKTOP_TARGET_ID ) )
envs = QCoreApplication : : translate ( " QtVersion " , " Desktop " , " Qt Version is meant for the desktop " ) ;
else if ( targets . contains ( Constants : : S60_DEVICE_TARGET_ID ) | |
targets . contains ( Constants : : S60_EMULATOR_TARGET_ID ) )
envs = QCoreApplication : : translate ( " QtVersion " , " Symbian " , " Qt Version is meant for Symbian " ) ;
2011-01-18 15:20:57 +01:00
else if ( targets . contains ( Constants : : MAEMO5_DEVICE_TARGET_ID ) )
envs = QCoreApplication : : translate ( " QtVersion " , " Maemo " , " Qt Version is meant for Maemo5 " ) ;
else if ( targets . contains ( Constants : : HARMATTAN_DEVICE_TARGET_ID ) )
envs = QCoreApplication : : translate ( " QtVersion " , " Harmattan " , " Qt Version is meant for Harmattan " ) ;
2011-01-31 17:46:19 +01:00
else if ( targets . contains ( Constants : : MEEGO_DEVICE_TARGET_ID ) )
envs = QCoreApplication : : translate ( " QtVersion " , " Meego " , " Qt Version is meant for Meego " ) ;
2010-12-03 15:28:54 +01:00
else if ( targets . contains ( Constants : : QT_SIMULATOR_TARGET_ID ) )
envs = QCoreApplication : : translate ( " QtVersion " , " Qt Simulator " , " Qt Version is meant for Qt Simulator " ) ;
else
envs = QCoreApplication : : translate ( " QtVersion " , " unkown " , " No idea what this Qt Version is meant for! " ) ;
return QCoreApplication : : translate ( " QtVersion " , " Qt version %1, using mkspec %2 (%3) " )
. arg ( qtVersionString ( ) , mkspec ( ) , envs ) ;
}
2009-10-13 13:44:13 +02:00
QtVersion : : QmakeBuildConfigs QtVersion : : defaultBuildConfig ( ) const
2008-12-02 12:01:29 +01:00
{
2011-02-01 18:36:00 +01:00
updateAbiAndMkspec ( ) ;
2009-10-13 13:44:13 +02:00
QtVersion : : QmakeBuildConfigs result = QtVersion : : QmakeBuildConfig ( 0 ) ;
2008-12-02 12:01:29 +01:00
if ( m_defaultConfigIsDebugAndRelease )
result = QtVersion : : BuildAll ;
if ( m_defaultConfigIsDebug )
2009-10-13 13:44:13 +02:00
result = result | QtVersion : : DebugBuild ;
2008-12-02 12:01:29 +01:00
return result ;
}
2009-03-25 15:18:37 +01:00
2011-02-24 10:12:52 +01:00
bool QtVersion : : hasGdbDebuggingHelper ( ) const
2009-03-25 15:18:37 +01:00
{
2010-03-15 11:54:25 +01:00
updateVersionInfo ( ) ;
2009-03-25 15:18:37 +01:00
return m_hasDebuggingHelper ;
}
2011-01-12 16:24:00 +01:00
2010-09-27 15:51:49 +02:00
bool QtVersion : : hasQmlDump ( ) const
{
updateVersionInfo ( ) ;
return m_hasQmlDump ;
}
2011-01-12 16:24:00 +01:00
bool QtVersion : : hasQmlDebuggingLibrary ( ) const
{
updateVersionInfo ( ) ;
return m_hasQmlDebuggingLibrary ;
}
2010-09-27 17:22:57 +02:00
bool QtVersion : : hasQmlObserver ( ) const
{
updateVersionInfo ( ) ;
return m_hasQmlObserver ;
}
2010-10-26 15:39:37 +02:00
Utils : : Environment QtVersion : : qmlToolsEnvironment ( ) const
{
2011-02-01 18:36:00 +01:00
// FIXME: This seems broken!
2010-10-26 15:39:37 +02:00
Utils : : Environment environment = Utils : : Environment : : systemEnvironment ( ) ;
addToEnvironment ( environment ) ;
// add preferred toolchain, as that is how the tools are built, compare QtVersion::buildDebuggingHelperLibrary
2011-02-01 18:36:00 +01:00
QList < ProjectExplorer : : ToolChain * > alltc =
ProjectExplorer : : ToolChainManager : : instance ( ) - > findToolChains ( qtAbis ( ) . at ( 0 ) ) ;
2010-10-26 15:39:37 +02:00
if ( ! alltc . isEmpty ( ) )
2011-02-01 18:36:00 +01:00
alltc . first ( ) - > addToEnvironment ( environment ) ;
2010-10-26 15:39:37 +02:00
return environment ;
}
2011-02-24 10:12:52 +01:00
QString QtVersion : : gdbDebuggingHelperLibrary ( ) const
2009-04-24 14:59:47 +02:00
{
QString qtInstallData = versionInfo ( ) . value ( " QT_INSTALL_DATA " ) ;
if ( qtInstallData . isEmpty ( ) )
2010-02-02 17:09:41 +01:00
return QString ( ) ;
2009-09-03 19:16:22 +02:00
return DebuggingHelperLibrary : : debuggingHelperLibraryByInstallData ( qtInstallData ) ;
2009-04-24 14:59:47 +02:00
}
2011-01-24 13:16:27 +01:00
QString QtVersion : : qmlDumpTool ( bool debugVersion ) const
2010-09-27 17:22:57 +02:00
{
QString qtInstallData = versionInfo ( ) . value ( " QT_INSTALL_DATA " ) ;
if ( qtInstallData . isEmpty ( ) )
return QString ( ) ;
2011-01-24 13:16:27 +01:00
return QmlDumpTool : : toolByInstallData ( qtInstallData , debugVersion ) ;
2010-09-27 17:22:57 +02:00
}
2011-01-12 16:24:00 +01:00
QString QtVersion : : qmlDebuggingHelperLibrary ( bool debugVersion ) const
{
QString qtInstallData = versionInfo ( ) . value ( " QT_INSTALL_DATA " ) ;
if ( qtInstallData . isEmpty ( ) )
return QString ( ) ;
return QmlDebuggingLibrary : : libraryByInstallData ( qtInstallData , debugVersion ) ;
}
2010-09-27 17:22:57 +02:00
QString QtVersion : : qmlObserverTool ( ) const
{
QString qtInstallData = versionInfo ( ) . value ( " QT_INSTALL_DATA " ) ;
if ( qtInstallData . isEmpty ( ) )
return QString ( ) ;
return QmlObserverTool : : toolByInstallData ( qtInstallData ) ;
}
2009-07-15 17:41:45 +02:00
QStringList QtVersion : : debuggingHelperLibraryLocations ( ) const
{
QString qtInstallData = versionInfo ( ) . value ( " QT_INSTALL_DATA " ) ;
if ( qtInstallData . isEmpty ( ) )
2009-09-10 18:07:51 +02:00
return QStringList ( ) ;
2010-09-27 15:51:49 +02:00
return DebuggingHelperLibrary : : locationsByInstallData ( qtInstallData ) ;
2009-07-15 17:41:45 +02:00
}
2010-04-23 13:24:51 +02:00
bool QtVersion : : supportsBinaryDebuggingHelper ( ) const
{
2011-02-01 18:36:00 +01:00
if ( ! isValid ( ) )
return false ;
2011-02-23 16:47:08 +01:00
return qtAbis ( ) . at ( 0 ) . os ( ) ! = ProjectExplorer : : Abi : : SymbianOS ;
2010-04-23 13:24:51 +02:00
}
2009-05-28 18:15:02 +02:00
bool QtVersion : : hasDocumentation ( ) const
{
updateVersionInfo ( ) ;
return m_hasDocumentation ;
}
QString QtVersion : : documentationPath ( ) const
{
updateVersionInfo ( ) ;
return m_versionInfo [ " QT_INSTALL_DOCS " ] ;
}
bool QtVersion : : hasDemos ( ) const
{
updateVersionInfo ( ) ;
return m_hasDemos ;
}
QString QtVersion : : demosPath ( ) const
{
updateVersionInfo ( ) ;
return m_versionInfo [ " QT_INSTALL_DEMOS " ] ;
}
2010-02-24 14:10:36 +01:00
QString QtVersion : : headerInstallPath ( ) const
{
updateVersionInfo ( ) ;
return m_versionInfo [ " QT_INSTALL_HEADERS " ] ;
}
2010-10-18 17:12:44 +02:00
QString QtVersion : : frameworkInstallPath ( ) const
{
# ifdef Q_OS_MAC
updateVersionInfo ( ) ;
return m_versionInfo [ " QT_INSTALL_LIBS " ] ;
# else
return QString ( ) ;
# endif
}
2011-02-01 18:36:00 +01:00
QString QtVersion : : libraryInstallPath ( ) const
{
updateVersionInfo ( ) ;
return m_versionInfo [ " QT_INSTALL_LIBS " ] ;
}
2009-05-28 18:15:02 +02:00
bool QtVersion : : hasExamples ( ) const
{
updateVersionInfo ( ) ;
return m_hasExamples ;
}
QString QtVersion : : examplesPath ( ) const
{
updateVersionInfo ( ) ;
return m_versionInfo [ " QT_INSTALL_EXAMPLES " ] ;
}
2009-04-08 11:49:24 +02:00
2011-01-17 15:06:16 +01:00
void QtVersion : : invalidateCache ( )
{
2010-10-25 13:13:06 +02:00
m_versionInfoUpToDate = false ;
2009-04-24 14:59:47 +02:00
}
2011-02-21 12:16:20 +01:00
///////////////
// QtVersionNumber
///////////////
QtVersionNumber : : QtVersionNumber ( int ma , int mi , int p )
: majorVersion ( ma ) , minorVersion ( mi ) , patchVersion ( p )
{
}
QtVersionNumber : : QtVersionNumber ( const QString & versionString )
{
2011-02-22 17:35:34 +01:00
if ( ! checkVersionString ( versionString ) ) {
2011-02-21 12:16:20 +01:00
majorVersion = minorVersion = patchVersion = - 1 ;
2011-02-22 17:35:34 +01:00
return ;
}
2011-02-21 12:16:20 +01:00
QStringList parts = versionString . split ( QLatin1Char ( ' . ' ) ) ;
majorVersion = parts . at ( 0 ) . toInt ( ) ;
minorVersion = parts . at ( 1 ) . toInt ( ) ;
patchVersion = parts . at ( 2 ) . toInt ( ) ;
}
QtVersionNumber : : QtVersionNumber ( )
{
majorVersion = minorVersion = patchVersion = - 1 ;
}
bool QtVersionNumber : : checkVersionString ( const QString & version ) const
{
int dots = 0 ;
QString validChars = " 0123456789. " ;
foreach ( const QChar & c , version ) {
if ( ! validChars . contains ( c ) )
return false ;
if ( c = = ' . ' )
+ + dots ;
}
if ( dots ! = 2 )
return false ;
return true ;
}
bool QtVersionNumber : : operator < ( const QtVersionNumber & b ) const
{
if ( majorVersion < b . majorVersion )
return true ;
if ( majorVersion > b . majorVersion )
return false ;
if ( minorVersion < b . minorVersion )
return true ;
if ( minorVersion > b . minorVersion )
return false ;
if ( patchVersion < b . patchVersion )
return true ;
return false ;
}
bool QtVersionNumber : : operator > ( const QtVersionNumber & b ) const
{
return b < * this ;
}
bool QtVersionNumber : : operator = = ( const QtVersionNumber & b ) const
{
return majorVersion = = b . majorVersion
& & minorVersion = = b . minorVersion
& & patchVersion = = b . patchVersion ;
}
bool QtVersionNumber : : operator ! = ( const QtVersionNumber & b ) const
{
return ! ( * this = = b ) ;
}
bool QtVersionNumber : : operator < = ( const QtVersionNumber & b ) const
{
return ! ( * this > b ) ;
}
bool QtVersionNumber : : operator > = ( const QtVersionNumber & b ) const
{
return b < = * this ;
}