Commit 69100c35 authored by Tobias Hunger's avatar Tobias Hunger

Add a special target for Qt simulator

parent 44a155c6
......@@ -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_DEVICE_TARGET_ID("Qt4ProjectManager.Target.S60DeviceTarget");
const char * const MAEMO_DEVICE_TARGET_ID("Qt4ProjectManager.Target.MaemoDeviceTarget");
const char * const QT_SIMULATOR_TARGET_ID("Qt4ProjectManager.Target.QtSimulatorTarget");
} // namespace Constants
} // namespace Qt4ProjectManager
......
......@@ -65,6 +65,8 @@ QString displayNameForId(const QString &id) {
return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Symbian Device", "Qt4 Symbian Device target display name");
if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
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();
}
......@@ -77,6 +79,8 @@ QIcon iconForId(const QString &id) {
return QIcon(":/projectexplorer/images/SymbianDevice.png");
if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return QIcon(":/projectexplorer/images/MaemoDevice.png");
if (id == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
return QIcon(":/projectexplorer/images/SymbianEmulator.png");
return QIcon();
}
......@@ -315,7 +319,8 @@ Qt4BuildConfigurationFactory *Qt4Target::buildConfigurationFactory() const
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));
else if (id() == QLatin1String(Constants::S60_EMULATOR_TARGET_ID))
addRunConfiguration(new S60EmulatorRunConfiguration(this, proFilePath));
......@@ -370,6 +375,8 @@ QString Qt4Target::defaultBuildDirectory() const
shortName = QLatin1String("symbian");
else if (id() == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
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
// since that is broken in qmake
......
......@@ -528,6 +528,8 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
envs = tr("Symbian", "Qt Version is meant for Symbian");
else if (targets.contains(Constants::MAEMO_DEVICE_TARGET_ID))
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
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)")
......
......@@ -47,6 +47,7 @@
#include <help/helpmanager.h>
#include <utils/qtcassert.h>
#include <QtCore/QFile>
#include <QtCore/QProcess>
#include <QtCore/QSettings>
#include <QtCore/QTime>
......@@ -1420,6 +1421,31 @@ void QtVersion::updateToolChainAndMkspec() const
delete reader;
ProFileCacheManager::instance()->decRefCount();
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
......@@ -1590,6 +1616,12 @@ QString QtVersion::demosPath() const
return m_versionInfo["QT_INSTALL_DEMOS"];
}
QString QtVersion::headerInstallPath() const
{
updateVersionInfo();
return m_versionInfo["QT_INSTALL_HEADERS"];
}
bool QtVersion::hasExamples() const
{
updateVersionInfo();
......
......@@ -123,6 +123,8 @@ public:
bool hasDemos() const;
QString demosPath() const;
QString headerInstallPath() const;
// All valid Ids are >= 0
int uniqueId() const;
bool isQt64Bit() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment