Add a special target for Qt simulator

This commit is contained in:
Tobias Hunger
2010-02-24 14:10:36 +01:00
parent 44a155c612
commit 69100c353c
5 changed files with 45 additions and 1 deletions

View File

@@ -94,6 +94,7 @@ const char * const DESKTOP_TARGET_ID("Qt4ProjectManager.Target.DesktopTarget");
const char * const S60_EMULATOR_TARGET_ID("Qt4ProjectManager.Target.S60EmulatorTarget"); const char * const S60_EMULATOR_TARGET_ID("Qt4ProjectManager.Target.S60EmulatorTarget");
const char * const S60_DEVICE_TARGET_ID("Qt4ProjectManager.Target.S60DeviceTarget"); const char * const S60_DEVICE_TARGET_ID("Qt4ProjectManager.Target.S60DeviceTarget");
const char * const MAEMO_DEVICE_TARGET_ID("Qt4ProjectManager.Target.MaemoDeviceTarget"); const char * const MAEMO_DEVICE_TARGET_ID("Qt4ProjectManager.Target.MaemoDeviceTarget");
const char * const QT_SIMULATOR_TARGET_ID("Qt4ProjectManager.Target.QtSimulatorTarget");
} // namespace Constants } // namespace Constants
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -65,6 +65,8 @@ QString displayNameForId(const QString &id) {
return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Symbian Device", "Qt4 Symbian Device target display name"); return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Symbian Device", "Qt4 Symbian Device target display name");
if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID)) if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Maemo", "Qt4 Maemo target display name"); return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Maemo", "Qt4 Maemo target display name");
if (id == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Qt Simulator", "Qt4 Simulator target display name");
return QString(); return QString();
} }
@@ -77,6 +79,8 @@ QIcon iconForId(const QString &id) {
return QIcon(":/projectexplorer/images/SymbianDevice.png"); return QIcon(":/projectexplorer/images/SymbianDevice.png");
if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID)) if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return QIcon(":/projectexplorer/images/MaemoDevice.png"); return QIcon(":/projectexplorer/images/MaemoDevice.png");
if (id == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
return QIcon(":/projectexplorer/images/SymbianEmulator.png");
return QIcon(); return QIcon();
} }
@@ -315,7 +319,8 @@ Qt4BuildConfigurationFactory *Qt4Target::buildConfigurationFactory() const
void Qt4Target::addRunConfigurationForPath(const QString &proFilePath) void Qt4Target::addRunConfigurationForPath(const QString &proFilePath)
{ {
if (id() == QLatin1String(Constants::DESKTOP_TARGET_ID)) if (id() == QLatin1String(Constants::DESKTOP_TARGET_ID) ||
id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
addRunConfiguration(new Qt4RunConfiguration(this, proFilePath)); addRunConfiguration(new Qt4RunConfiguration(this, proFilePath));
else if (id() == QLatin1String(Constants::S60_EMULATOR_TARGET_ID)) else if (id() == QLatin1String(Constants::S60_EMULATOR_TARGET_ID))
addRunConfiguration(new S60EmulatorRunConfiguration(this, proFilePath)); addRunConfiguration(new S60EmulatorRunConfiguration(this, proFilePath));
@@ -370,6 +375,8 @@ QString Qt4Target::defaultBuildDirectory() const
shortName = QLatin1String("symbian"); shortName = QLatin1String("symbian");
else if (id() == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID)) else if (id() == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
shortName = QLatin1String("maemo"); shortName = QLatin1String("maemo");
else if (id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
shortName = QLatin1String("simulator");
// currently we can't have the build directory to be deeper then the source directory // currently we can't have the build directory to be deeper then the source directory
// since that is broken in qmake // since that is broken in qmake

View File

@@ -528,6 +528,8 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
envs = tr("Symbian", "Qt Version is meant for Symbian"); envs = tr("Symbian", "Qt Version is meant for Symbian");
else if (targets.contains(Constants::MAEMO_DEVICE_TARGET_ID)) else if (targets.contains(Constants::MAEMO_DEVICE_TARGET_ID))
envs = tr("Maemo", "Qt Version is meant for Maemo"); envs = tr("Maemo", "Qt Version is meant for Maemo");
else if (targets.contains(Constants::QT_SIMULATOR_TARGET_ID))
envs = tr("Qt Simulator", "Qt Version is meant for Qt Simulator");
else else
envs = tr("unkown", "No idea what this Qt Version is meant for!"); envs = tr("unkown", "No idea what this Qt Version is meant for!");
m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2 (%3)") m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2 (%3)")

View File

@@ -47,6 +47,7 @@
#include <help/helpmanager.h> #include <help/helpmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtCore/QFile>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtCore/QTime> #include <QtCore/QTime>
@@ -1420,6 +1421,31 @@ void QtVersion::updateToolChainAndMkspec() const
delete reader; delete reader;
ProFileCacheManager::instance()->decRefCount(); ProFileCacheManager::instance()->decRefCount();
m_toolChainUpToDate = true; m_toolChainUpToDate = true;
// Check qconfig.h for QT_SIMULATOR define on desktop builds and switch the
// Qt version to Qt simulator target:
if (m_targetIds.contains(Constants::DESKTOP_TARGET_ID)) {
QString path(headerInstallPath());
path.append(QLatin1String("/Qt/qconfig.h"));
QFile qconfig(path);
if (!qconfig.exists())
return;
qconfig.open(QIODevice::ReadOnly);
QTextStream stream(&qconfig);
QString line;
bool isSimulator = false;
while (!(line = stream.readLine()).isNull()) {
if (line.startsWith(QLatin1String("#define QT_SIMULATOR"))) {
isSimulator = true;
break;
}
}
qconfig.close();
if (isSimulator) {
m_targetIds.remove(QLatin1String(Constants::DESKTOP_TARGET_ID));
m_targetIds.insert(QLatin1String(Constants::QT_SIMULATOR_TARGET_ID));
}
}
} }
QString QtVersion::mwcDirectory() const QString QtVersion::mwcDirectory() const
@@ -1590,6 +1616,12 @@ QString QtVersion::demosPath() const
return m_versionInfo["QT_INSTALL_DEMOS"]; return m_versionInfo["QT_INSTALL_DEMOS"];
} }
QString QtVersion::headerInstallPath() const
{
updateVersionInfo();
return m_versionInfo["QT_INSTALL_HEADERS"];
}
bool QtVersion::hasExamples() const bool QtVersion::hasExamples() const
{ {
updateVersionInfo(); updateVersionInfo();

View File

@@ -123,6 +123,8 @@ public:
bool hasDemos() const; bool hasDemos() const;
QString demosPath() const; QString demosPath() const;
QString headerInstallPath() const;
// All valid Ids are >= 0 // All valid Ids are >= 0
int uniqueId() const; int uniqueId() const;
bool isQt64Bit() const; bool isQt64Bit() const;