From 4f82c36a19ec07c1615e195ff49291770d6f0794 Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Fri, 11 Oct 2013 23:05:04 +0800 Subject: Move QtVersionFactory to QtSupport module After this is done, QbsProjectManager/CMakeProjectManager will be able to have full Qt support work without having to depend on Qt4ProjectManager. It's should belong here. Change-Id: I577d47cb8a40eb697aa862fbec36c56ff05004f0 Reviewed-by: Daniel Teske --- .../qt-desktop/desktopqtversion.cpp | 103 --- .../qt-desktop/desktopqtversion.h | 63 -- .../qt-desktop/desktopqtversionfactory.cpp | 77 --- .../qt-desktop/desktopqtversionfactory.h | 55 -- .../qt4projectmanager/qt-desktop/qt-desktop.pri | 14 - .../qt-desktop/qt4runconfiguration.cpp | 724 --------------------- .../qt-desktop/qt4runconfiguration.h | 216 ------ .../qt-desktop/simulatorqtversion.cpp | 99 --- .../qt-desktop/simulatorqtversion.h | 62 -- .../qt-desktop/simulatorqtversionfactory.cpp | 82 --- .../qt-desktop/simulatorqtversionfactory.h | 55 -- .../qt4projectmanager/qt4buildconfiguration.cpp | 2 +- .../qt4projectmanager/qt4projectmanager.pro | 7 +- .../qt4projectmanager/qt4projectmanager.qbs | 15 +- .../qt4projectmanager/qt4projectmanagerplugin.cpp | 9 +- .../qt4projectmanager/qt4runconfiguration.cpp | 724 +++++++++++++++++++++ .../qt4projectmanager/qt4runconfiguration.h | 216 ++++++ src/plugins/qt4projectmanager/winceqtversion.cpp | 113 ---- src/plugins/qt4projectmanager/winceqtversion.h | 65 -- .../qt4projectmanager/winceqtversionfactory.cpp | 82 --- .../qt4projectmanager/winceqtversionfactory.h | 57 -- src/plugins/qtsupport/desktopqtversion.cpp | 103 +++ src/plugins/qtsupport/desktopqtversion.h | 62 ++ src/plugins/qtsupport/desktopqtversionfactory.cpp | 77 +++ src/plugins/qtsupport/desktopqtversionfactory.h | 54 ++ src/plugins/qtsupport/qtsupport.pro | 16 +- src/plugins/qtsupport/qtsupport.qbs | 12 + src/plugins/qtsupport/qtsupportplugin.cpp | 10 +- src/plugins/qtsupport/simulatorqtversion.cpp | 98 +++ src/plugins/qtsupport/simulatorqtversion.h | 61 ++ .../qtsupport/simulatorqtversionfactory.cpp | 81 +++ src/plugins/qtsupport/simulatorqtversionfactory.h | 54 ++ src/plugins/qtsupport/winceqtversion.cpp | 114 ++++ src/plugins/qtsupport/winceqtversion.h | 65 ++ src/plugins/qtsupport/winceqtversionfactory.cpp | 83 +++ src/plugins/qtsupport/winceqtversionfactory.h | 57 ++ 36 files changed, 1888 insertions(+), 1899 deletions(-) delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.h delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.cpp delete mode 100644 src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.h create mode 100644 src/plugins/qt4projectmanager/qt4runconfiguration.cpp create mode 100644 src/plugins/qt4projectmanager/qt4runconfiguration.h delete mode 100644 src/plugins/qt4projectmanager/winceqtversion.cpp delete mode 100644 src/plugins/qt4projectmanager/winceqtversion.h delete mode 100644 src/plugins/qt4projectmanager/winceqtversionfactory.cpp delete mode 100644 src/plugins/qt4projectmanager/winceqtversionfactory.h create mode 100644 src/plugins/qtsupport/desktopqtversion.cpp create mode 100644 src/plugins/qtsupport/desktopqtversion.h create mode 100644 src/plugins/qtsupport/desktopqtversionfactory.cpp create mode 100644 src/plugins/qtsupport/desktopqtversionfactory.h create mode 100644 src/plugins/qtsupport/simulatorqtversion.cpp create mode 100644 src/plugins/qtsupport/simulatorqtversion.h create mode 100644 src/plugins/qtsupport/simulatorqtversionfactory.cpp create mode 100644 src/plugins/qtsupport/simulatorqtversionfactory.h create mode 100644 src/plugins/qtsupport/winceqtversion.cpp create mode 100644 src/plugins/qtsupport/winceqtversion.h create mode 100644 src/plugins/qtsupport/winceqtversionfactory.cpp create mode 100644 src/plugins/qtsupport/winceqtversionfactory.h diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp deleted file mode 100644 index deab7c39cb..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "desktopqtversion.h" - -#include -#include - -#include - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -DesktopQtVersion::DesktopQtVersion() - : BaseQtVersion() -{ - -} - -DesktopQtVersion::DesktopQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource) - : BaseQtVersion(path, isAutodetected, autodetectionSource) -{ - setDisplayName(defaultDisplayName(qtVersionString(), path, false)); -} - -DesktopQtVersion::~DesktopQtVersion() -{ - -} - -DesktopQtVersion *DesktopQtVersion::clone() const -{ - return new DesktopQtVersion(*this); -} - -QString DesktopQtVersion::type() const -{ - return QLatin1String(QtSupport::Constants::DESKTOPQT); -} - -QStringList DesktopQtVersion::warningReason() const -{ - QStringList ret = BaseQtVersion::warningReason(); - if (qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0) && qmlsceneCommand().isEmpty()) - ret << QCoreApplication::translate("QtVersion", "No qmlscene installed."); - if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 0) && qmlviewerCommand().isEmpty()) - ret << QCoreApplication::translate("QtVersion", "No qmlviewer installed."); - return ret; -} - -QList DesktopQtVersion::detectQtAbis() const -{ - return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString())); -} - -QString DesktopQtVersion::description() const -{ - return QCoreApplication::translate("QtVersion", "Desktop", "Qt Version is meant for the desktop"); -} - -Core::FeatureSet DesktopQtVersion::availableFeatures() const -{ - Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); - features |= Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP); - features |= Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT); - return features; -} - -QString DesktopQtVersion::platformName() const -{ - return QLatin1String(QtSupport::Constants::DESKTOP_PLATFORM); -} - -QString DesktopQtVersion::platformDisplayName() const -{ - return QLatin1String(QtSupport::Constants::DESKTOP_PLATFORM_TR); -} diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h deleted file mode 100644 index 6e81518439..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef DESKTOPQTVERSION_H -#define DESKTOPQTVERSION_H - -#include - -namespace Qt4ProjectManager { - -namespace Internal { - -class DesktopQtVersion : public QtSupport::BaseQtVersion -{ -public: - DesktopQtVersion(); - DesktopQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); - ~DesktopQtVersion(); - DesktopQtVersion *clone() const; - - QString type() const; - - QStringList warningReason() const; - - QList detectQtAbis() const; - - QString description() const; - - Core::FeatureSet availableFeatures() const; - QString platformName() const; - QString platformDisplayName() const; -}; - -} -} - -#endif // DESKTOPQTVERSION_H diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp deleted file mode 100644 index 41586f88de..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ -#include "desktopqtversionfactory.h" -#include "desktopqtversion.h" -#include - -#include - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -DesktopQtVersionFactory::DesktopQtVersionFactory(QObject *parent) - : QtSupport::QtVersionFactory(parent) -{ - -} - -DesktopQtVersionFactory::~DesktopQtVersionFactory() -{ - -} - -bool DesktopQtVersionFactory::canRestore(const QString &type) -{ - return type == QLatin1String(QtSupport::Constants::DESKTOPQT); -} - -QtSupport::BaseQtVersion *DesktopQtVersionFactory::restore(const QString &type, const QVariantMap &data) -{ - if (!canRestore(type)) - return 0; - DesktopQtVersion *v = new DesktopQtVersion; - v->fromMap(data); - return v; -} - -int DesktopQtVersionFactory::priority() const -{ - // Lowest of all, we want to be the fallback - return 0; -} - -QtSupport::BaseQtVersion *DesktopQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource) -{ - Q_UNUSED(evaluator); - // we are the fallback :) so we don't care what kind of qt it is - QFileInfo fi = qmakePath.toFileInfo(); - if (fi.exists() && fi.isExecutable() && fi.isFile()) - return new DesktopQtVersion(qmakePath, isAutoDetected, autoDetectionSource); - return 0; -} diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.h b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.h deleted file mode 100644 index d33cb60107..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef DESKTOPQTVERSIONFACTORY_H -#define DESKTOPQTVERSIONFACTORY_H - -#include - -namespace Qt4ProjectManager{ -namespace Internal { - -class DesktopQtVersionFactory : public QtSupport::QtVersionFactory -{ -public: - explicit DesktopQtVersionFactory(QObject *parent = 0); - ~DesktopQtVersionFactory(); - - virtual bool canRestore(const QString &type); - virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data); - - virtual int priority() const; - virtual QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString()); -}; - -} // Internal -} // Qt4ProjectManager - - -#endif // DESKTOPQTVERSIONFACTORY_H diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri b/src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri deleted file mode 100644 index 46424cc4b0..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri +++ /dev/null @@ -1,14 +0,0 @@ - -HEADERS += \ - $$PWD/qt4runconfiguration.h \ - $$PWD/desktopqtversionfactory.h \ - $$PWD/simulatorqtversionfactory.h \ - $$PWD/desktopqtversion.h \ - $$PWD/simulatorqtversion.h - -SOURCES += \ - $$PWD/qt4runconfiguration.cpp \ - $$PWD/desktopqtversionfactory.cpp \ - $$PWD/simulatorqtversionfactory.cpp \ - $$PWD/desktopqtversion.cpp \ - $$PWD/simulatorqtversion.cpp diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp deleted file mode 100644 index 3e215d1a85..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp +++ /dev/null @@ -1,724 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qt4runconfiguration.h" - -#include "../qt4nodes.h" -#include "../qt4project.h" -#include "../qt4buildconfiguration.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Qt4ProjectManager::Internal; -using namespace Qt4ProjectManager; -using ProjectExplorer::LocalApplicationRunConfiguration; -using Utils::PersistentSettingsReader; -using Utils::PersistentSettingsWriter; - -namespace { - -const char QT4_RC_PREFIX[] = "Qt4ProjectManager.Qt4RunConfiguration:"; -const char COMMAND_LINE_ARGUMENTS_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"; -const char PRO_FILE_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.ProFile"; -const char USE_TERMINAL_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"; -const char USE_DYLD_IMAGE_SUFFIX_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix"; -const char USER_WORKING_DIRECTORY_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"; - -QString pathFromId(Core::Id id) -{ - return id.suffixAfter(QT4_RC_PREFIX); -} - -} // namespace - -// -// Qt4RunConfiguration -// - -Qt4RunConfiguration::Qt4RunConfiguration(ProjectExplorer::Target *parent, Core::Id id) : - LocalApplicationRunConfiguration(parent, id), - m_proFilePath(pathFromId(id)), - m_runMode(Gui), - m_isUsingDyldImageSuffix(false) -{ - Qt4Project *project = static_cast(parent->project()); - m_parseSuccess = project->validParse(m_proFilePath); - m_parseInProgress = project->parseInProgress(m_proFilePath); - - ctor(); -} - -Qt4RunConfiguration::Qt4RunConfiguration(ProjectExplorer::Target *parent, Qt4RunConfiguration *source) : - LocalApplicationRunConfiguration(parent, source), - m_commandLineArguments(source->m_commandLineArguments), - m_proFilePath(source->m_proFilePath), - m_runMode(source->m_runMode), - m_isUsingDyldImageSuffix(source->m_isUsingDyldImageSuffix), - m_userWorkingDirectory(source->m_userWorkingDirectory), - m_parseSuccess(source->m_parseSuccess), - m_parseInProgress(source->m_parseInProgress) -{ - ctor(); -} - -Qt4RunConfiguration::~Qt4RunConfiguration() -{ -} - -bool Qt4RunConfiguration::isEnabled() const -{ - return m_parseSuccess && !m_parseInProgress; -} - -QString Qt4RunConfiguration::disabledReason() const -{ - if (m_parseInProgress) - return tr("The .pro file '%1' is currently being parsed.") - .arg(QFileInfo(m_proFilePath).fileName()); - - if (!m_parseSuccess) - return static_cast(target()->project())->disabledReasonForRunConfiguration(m_proFilePath); - return QString(); -} - -void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress) -{ - ProjectExplorer::LocalEnvironmentAspect *aspect - = extraAspect(); - QTC_ASSERT(aspect, return); - - if (m_proFilePath != pro->path()) { - if (!parseInProgress) { - // We depend on all .pro files for the LD_LIBRARY_PATH so we emit a signal for all .pro files - // This can be optimized by checking whether LD_LIBRARY_PATH changed - aspect->buildEnvironmentHasChanged(); - } - return; - } - - bool enabled = isEnabled(); - QString reason = disabledReason(); - m_parseSuccess = success; - m_parseInProgress = parseInProgress; - if (enabled != isEnabled() || reason != disabledReason()) - emit enabledChanged(); - - if (!parseInProgress) { - emit effectiveTargetInformationChanged(); - aspect->buildEnvironmentHasChanged(); - } -} - -void Qt4RunConfiguration::ctor() -{ - setDefaultDisplayName(defaultDisplayName()); - - QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit()); - m_forcedGuiMode = (version && version->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)); - - connect(target()->project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), - this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); - connect(target(), SIGNAL(kitChanged()), - this, SLOT(kitChanged())); -} - -void Qt4RunConfiguration::kitChanged() -{ - QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit()); - m_forcedGuiMode = (version && version->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)); - emit runModeChanged(runMode()); // Always emit -} - -////// -/// Qt4RunConfigurationWidget -///// - -Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4RunConfiguration, QWidget *parent) - : QWidget(parent), - m_qt4RunConfiguration(qt4RunConfiguration), - m_ignoreChange(false), - m_usingDyldImageSuffix(0), - m_isShown(false) -{ - QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); - vboxTopLayout->setMargin(0); - - QHBoxLayout *hl = new QHBoxLayout(); - hl->addStretch(); - m_disabledIcon = new QLabel(this); - m_disabledIcon->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/compile_warning.png"))); - hl->addWidget(m_disabledIcon); - m_disabledReason = new QLabel(this); - m_disabledReason->setVisible(false); - hl->addWidget(m_disabledReason); - hl->addStretch(); - vboxTopLayout->addLayout(hl); - - m_detailsContainer = new Utils::DetailsWidget(this); - m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); - vboxTopLayout->addWidget(m_detailsContainer); - QWidget *detailsWidget = new QWidget(m_detailsContainer); - m_detailsContainer->setWidget(detailsWidget); - QFormLayout *toplayout = new QFormLayout(detailsWidget); - toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - toplayout->setMargin(0); - - m_executableLineEdit = new QLineEdit(m_qt4RunConfiguration->executable(), this); - m_executableLineEdit->setEnabled(false); - toplayout->addRow(tr("Executable:"), m_executableLineEdit); - - QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); - m_argumentsLineEdit = new QLineEdit(qt4RunConfiguration->rawCommandLineArguments(), this); - argumentsLabel->setBuddy(m_argumentsLineEdit); - toplayout->addRow(argumentsLabel, m_argumentsLineEdit); - - m_workingDirectoryEdit = new Utils::PathChooser(this); - m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); - m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->baseWorkingDirectory()); - m_workingDirectoryEdit->setBaseDirectory(m_qt4RunConfiguration->target()->project()->projectDirectory()); - ProjectExplorer::EnvironmentAspect *aspect - = qt4RunConfiguration->extraAspect(); - if (aspect) { - connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); - environmentWasChanged(); - } - m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); - - QToolButton *resetButton = new QToolButton(this); - resetButton->setToolTip(tr("Reset to default")); - resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); - - QHBoxLayout *boxlayout = new QHBoxLayout(); - boxlayout->setMargin(0); - boxlayout->addWidget(m_workingDirectoryEdit); - boxlayout->addWidget(resetButton); - toplayout->addRow(tr("Working directory:"), boxlayout); - - QHBoxLayout *innerBox = new QHBoxLayout(); - m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this); - m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console); - m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode()); - innerBox->addWidget(m_useTerminalCheck); - - m_useQvfbCheck = new QCheckBox(tr("Run on QVFb"), this); - m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer.")); - m_useQvfbCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console); - m_useQvfbCheck->setVisible(false); - innerBox->addWidget(m_useQvfbCheck); - innerBox->addStretch(); - toplayout->addRow(QString(), innerBox); - - if (Utils::HostOsInfo::isMacHost()) { - m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this); - m_usingDyldImageSuffix->setChecked(m_qt4RunConfiguration->isUsingDyldImageSuffix()); - toplayout->addRow(QString(), m_usingDyldImageSuffix); - connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)), - this, SLOT(usingDyldImageSuffixToggled(bool))); - } - - runConfigurationEnabledChange(); - - connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), - this, SLOT(workDirectoryEdited())); - - connect(resetButton, SIGNAL(clicked()), - this, SLOT(workingDirectoryReseted())); - - connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), - this, SLOT(argumentsEdited(QString))); - connect(m_useTerminalCheck, SIGNAL(toggled(bool)), - this, SLOT(termToggled(bool))); - connect(m_useQvfbCheck, SIGNAL(toggled(bool)), - this, SLOT(qvfbToggled(bool))); - - connect(qt4RunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)), - this, SLOT(workingDirectoryChanged(QString))); - - connect(qt4RunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)), - this, SLOT(commandLineArgumentsChanged(QString))); - connect(qt4RunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)), - this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode))); - connect(qt4RunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)), - this, SLOT(usingDyldImageSuffixChanged(bool))); - connect(qt4RunConfiguration, SIGNAL(effectiveTargetInformationChanged()), - this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection); - - connect(qt4RunConfiguration, SIGNAL(enabledChanged()), - this, SLOT(runConfigurationEnabledChange())); -} - -Qt4RunConfigurationWidget::~Qt4RunConfigurationWidget() -{ -} - -void Qt4RunConfigurationWidget::environmentWasChanged() -{ - ProjectExplorer::EnvironmentAspect *aspect - = m_qt4RunConfiguration->extraAspect(); - QTC_ASSERT(aspect, return); - m_workingDirectoryEdit->setEnvironment(aspect->environment()); -} - -void Qt4RunConfigurationWidget::runConfigurationEnabledChange() -{ - bool enabled = m_qt4RunConfiguration->isEnabled(); - m_disabledIcon->setVisible(!enabled); - m_disabledReason->setVisible(!enabled); - m_disabledReason->setText(m_qt4RunConfiguration->disabledReason()); -} - -void Qt4RunConfigurationWidget::workDirectoryEdited() -{ - if (m_ignoreChange) - return; - m_ignoreChange = true; - m_qt4RunConfiguration->setBaseWorkingDirectory(m_workingDirectoryEdit->rawPath()); - m_ignoreChange = false; -} - -void Qt4RunConfigurationWidget::workingDirectoryReseted() -{ - // This emits a signal connected to workingDirectoryChanged() - // that sets the m_workingDirectoryEdit - m_qt4RunConfiguration->setBaseWorkingDirectory(QString()); -} - -void Qt4RunConfigurationWidget::argumentsEdited(const QString &args) -{ - m_ignoreChange = true; - m_qt4RunConfiguration->setCommandLineArguments(args); - m_ignoreChange = false; -} - -void Qt4RunConfigurationWidget::termToggled(bool on) -{ - m_ignoreChange = true; - m_qt4RunConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console - : LocalApplicationRunConfiguration::Gui); - m_ignoreChange = false; -} - -void Qt4RunConfigurationWidget::qvfbToggled(bool on) -{ - Q_UNUSED(on); - m_ignoreChange = true; - m_ignoreChange = false; -} - -void Qt4RunConfigurationWidget::usingDyldImageSuffixToggled(bool state) -{ - m_ignoreChange = true; - m_qt4RunConfiguration->setUsingDyldImageSuffix(state); - m_ignoreChange = false; -} - -void Qt4RunConfigurationWidget::workingDirectoryChanged(const QString &workingDirectory) -{ - if (!m_ignoreChange) - m_workingDirectoryEdit->setPath(workingDirectory); -} - -void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args) -{ - if (m_ignoreChange) - return; - m_argumentsLineEdit->setText(args); -} - -void Qt4RunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode) -{ - if (!m_ignoreChange) { - m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode()); - m_useTerminalCheck->setChecked(runMode == LocalApplicationRunConfiguration::Console); - } -} - -void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state) -{ - if (!m_ignoreChange && m_usingDyldImageSuffix) - m_usingDyldImageSuffix->setChecked(state); -} - -void Qt4RunConfigurationWidget::effectiveTargetInformationChanged() -{ - if (m_isShown) { - m_executableLineEdit->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable())); - m_ignoreChange = true; - m_workingDirectoryEdit->setPath(QDir::toNativeSeparators(m_qt4RunConfiguration->baseWorkingDirectory())); - m_ignoreChange = false; - } -} - -void Qt4RunConfigurationWidget::showEvent(QShowEvent *event) -{ - m_isShown = true; - effectiveTargetInformationChanged(); - QWidget::showEvent(event); -} - -void Qt4RunConfigurationWidget::hideEvent(QHideEvent *event) -{ - m_isShown = false; - QWidget::hideEvent(event); -} - -QWidget *Qt4RunConfiguration::createConfigurationWidget() -{ - return new Qt4RunConfigurationWidget(this, 0); -} - -QVariantMap Qt4RunConfiguration::toMap() const -{ - const QDir projectDir = QDir(target()->project()->projectDirectory()); - QVariantMap map(LocalApplicationRunConfiguration::toMap()); - map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments); - map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath)); - map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console); - map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix); - map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory); - return map; -} - -bool Qt4RunConfiguration::fromMap(const QVariantMap &map) -{ - const QDir projectDir = QDir(target()->project()->projectDirectory()); - m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toString(); - m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString())); - m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool() ? Console : Gui; - m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool(); - - m_userWorkingDirectory = map.value(QLatin1String(USER_WORKING_DIRECTORY_KEY)).toString(); - - m_parseSuccess = static_cast(target()->project())->validParse(m_proFilePath); - m_parseInProgress = static_cast(target()->project())->parseInProgress(m_proFilePath); - - return LocalApplicationRunConfiguration::fromMap(map); -} - -QString Qt4RunConfiguration::executable() const -{ - Qt4Project *pro = static_cast(target()->project()); - const Qt4ProFileNode *node = pro->rootQt4ProjectNode()->findProFileFor(m_proFilePath); - return extractWorkingDirAndExecutable(node).second; -} - -LocalApplicationRunConfiguration::RunMode Qt4RunConfiguration::runMode() const -{ - if (m_forcedGuiMode) - return LocalApplicationRunConfiguration::Gui; - return m_runMode; -} - -bool Qt4RunConfiguration::forcedGuiMode() const -{ - return m_forcedGuiMode; -} - -bool Qt4RunConfiguration::isUsingDyldImageSuffix() const -{ - return m_isUsingDyldImageSuffix; -} - -void Qt4RunConfiguration::setUsingDyldImageSuffix(bool state) -{ - m_isUsingDyldImageSuffix = state; - emit usingDyldImageSuffixChanged(state); -} - -QString Qt4RunConfiguration::workingDirectory() const -{ - ProjectExplorer::EnvironmentAspect *aspect - = extraAspect(); - QTC_ASSERT(aspect, baseWorkingDirectory()); - return QDir::cleanPath(aspect->environment().expandVariables( - Utils::expandMacros(baseWorkingDirectory(), macroExpander()))); -} - -QString Qt4RunConfiguration::baseWorkingDirectory() const -{ - // if the user overrode us, then return his working directory - if (!m_userWorkingDirectory.isEmpty()) - return m_userWorkingDirectory; - - // else what the pro file reader tells us - Qt4Project *pro = static_cast(target()->project()); - const Qt4ProFileNode *node = pro->rootQt4ProjectNode()->findProFileFor(m_proFilePath); - return extractWorkingDirAndExecutable(node).first; -} - -QString Qt4RunConfiguration::commandLineArguments() const -{ - return Utils::QtcProcess::expandMacros(m_commandLineArguments, macroExpander()); -} - -QString Qt4RunConfiguration::rawCommandLineArguments() const -{ - return m_commandLineArguments; -} - -void Qt4RunConfiguration::setBaseWorkingDirectory(const QString &wd) -{ - const QString &oldWorkingDirectory = workingDirectory(); - - m_userWorkingDirectory = wd; - - const QString &newWorkingDirectory = workingDirectory(); - if (oldWorkingDirectory != newWorkingDirectory) - emit baseWorkingDirectoryChanged(newWorkingDirectory); -} - -void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString) -{ - m_commandLineArguments = argumentsString; - emit commandLineArgumentsChanged(argumentsString); -} - -void Qt4RunConfiguration::setRunMode(RunMode runMode) -{ - m_runMode = runMode; - emit runModeChanged(runMode); -} - -void Qt4RunConfiguration::addToBaseEnvironment(Utils::Environment &env) const -{ - if (m_isUsingDyldImageSuffix) - env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug")); - - // The user could be linking to a library found via a -L/some/dir switch - // to find those libraries while actually running we explicitly prepend those - // dirs to the library search path - const Qt4ProFileNode *node = static_cast(target()->project())->rootQt4ProjectNode()->findProFileFor(m_proFilePath); - if (node) { - const QStringList libDirectories = node->variableValue(LibDirectoriesVar); - if (!libDirectories.isEmpty()) { - const QString proDirectory = node->buildDir(); - foreach (QString dir, libDirectories) { - // Fix up relative entries like "LIBS+=-L.." - const QFileInfo fi(dir); - if (!fi.isAbsolute()) - dir = QDir::cleanPath(proDirectory + QLatin1Char('/') + dir); - env.prependOrSetLibrarySearchPath(dir); - } // foreach - } // libDirectories - } // node - - QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit()); - if (qtVersion) - env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS")); -} - -QString Qt4RunConfiguration::proFilePath() const -{ - return m_proFilePath; -} - -QString Qt4RunConfiguration::dumperLibrary() const -{ - return QtSupport::QtKitInformation::dumperLibrary(target()->kit()); -} - -QStringList Qt4RunConfiguration::dumperLibraryLocations() const -{ - return QtSupport::QtKitInformation::dumperLibraryLocations(target()->kit()); -} - -QString Qt4RunConfiguration::defaultDisplayName() -{ - QString defaultName; - if (!m_proFilePath.isEmpty()) - defaultName = QFileInfo(m_proFilePath).completeBaseName(); - else - defaultName = tr("Qt Run Configuration"); - return defaultName; -} - -Utils::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const -{ - return new QtSupport::QtOutputFormatter(target()->project()); -} - -QPair Qt4RunConfiguration::extractWorkingDirAndExecutable(const Qt4ProFileNode *node) const -{ - if (!node) - return qMakePair(QString(), QString()); - TargetInformation ti = node->targetInformation(); - if (!ti.valid) - return qMakePair(QString(), QString()); - - const QStringList &config = node->variableValue(ConfigVar); - - QString destDir = ti.destDir; - QString workingDir; - if (!destDir.isEmpty()) { - bool workingDirIsBaseDir = false; - if (destDir == ti.buildTarget) { - workingDirIsBaseDir = true; - } - if (QDir::isRelativePath(destDir)) - destDir = QDir::cleanPath(ti.buildDir + QLatin1Char('/') + destDir); - - if (workingDirIsBaseDir) - workingDir = ti.buildDir; - else - workingDir = destDir; - } else { - destDir = ti.buildDir; - workingDir = ti.buildDir; - } - - if (Utils::HostOsInfo::isMacHost() - && config.contains(QLatin1String("app_bundle"))) { - const QString infix = QLatin1Char('/') + ti.target - + QLatin1String(".app/Contents/MacOS"); - workingDir += infix; - destDir += infix; - } - - QString executable = QDir::cleanPath(destDir + QLatin1Char('/') + ti.target); - executable = Utils::HostOsInfo::withExecutableSuffix(executable); - //qDebug() << "##### Qt4RunConfiguration::extractWorkingDirAndExecutable:" workingDir << executable; - return qMakePair(workingDir, executable); -} - -/// -/// Qt4RunConfigurationFactory -/// This class is used to restore run settings (saved in .user files) -/// - -Qt4RunConfigurationFactory::Qt4RunConfigurationFactory(QObject *parent) : - QmakeRunConfigurationFactory(parent) -{ setObjectName(QLatin1String("Qt4RunConfigurationFactory")); } - -Qt4RunConfigurationFactory::~Qt4RunConfigurationFactory() -{ } - -bool Qt4RunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const -{ - if (!canHandle(parent)) - return false; - Qt4Project *project = static_cast(parent->project()); - return project->hasApplicationProFile(pathFromId(id)); -} - -ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id) -{ - Qt4RunConfiguration *rc = new Qt4RunConfiguration(parent, id); - const Qt4ProFileNode *node = static_cast(parent->project())->rootQt4ProjectNode()->findProFileFor(rc->proFilePath()); - if (node) // should always be found - rc->setRunMode(node->variableValue(ConfigVar).contains(QLatin1String("console")) - && !node->variableValue(QtVar).contains(QLatin1String("testlib")) - ? ProjectExplorer::LocalApplicationRunConfiguration::Console - : ProjectExplorer::LocalApplicationRunConfiguration::Gui); - return rc; -} - -bool Qt4RunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const -{ - if (!canHandle(parent)) - return false; - return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(QT4_RC_PREFIX)); -} - -ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::doRestore(ProjectExplorer::Target *parent, - const QVariantMap &map) -{ - return new Qt4RunConfiguration(parent, ProjectExplorer::idFromMap(map)); -} - -bool Qt4RunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const -{ - return canCreate(parent, source->id()); -} - -ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) -{ - if (!canClone(parent, source)) - return 0; - Qt4RunConfiguration *old = static_cast(source); - return new Qt4RunConfiguration(parent, old); -} - -QList Qt4RunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const -{ - QList result; - if (!canHandle(parent)) - return result; - - Qt4Project *project = static_cast(parent->project()); - QStringList proFiles = project->applicationProFilePathes(QLatin1String(QT4_RC_PREFIX)); - foreach (const QString &pf, proFiles) - result << Core::Id::fromString(pf); - return result; -} - -QString Qt4RunConfigurationFactory::displayNameForId(const Core::Id id) const -{ - return QFileInfo(pathFromId(id)).completeBaseName(); -} - -bool Qt4RunConfigurationFactory::canHandle(ProjectExplorer::Target *t) const -{ - if (!t->project()->supportsKit(t->kit())) - return false; - if (!qobject_cast(t->project())) - return false; - Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(t->kit()); - return devType == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE; -} - -QList Qt4RunConfigurationFactory::runConfigurationsForNode(ProjectExplorer::Target *t, ProjectExplorer::Node *n) -{ - QList result; - foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) - if (Qt4RunConfiguration *qt4c = qobject_cast(rc)) - if (qt4c->proFilePath() == n->path()) - result << rc; - return result; - -} diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h deleted file mode 100644 index 1527a4b524..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QT4RUNCONFIGURATION_H -#define QT4RUNCONFIGURATION_H - -#include - -#include - - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QCheckBox; -class QLineEdit; -class QRadioButton; -class QComboBox; -QT_END_NAMESPACE - -namespace Utils { -class PathChooser; -class DetailsWidget; -} - -namespace Qt4ProjectManager { - -class Qt4Project; -class Qt4ProFileNode; -class Qt4PriFileNode; -class TargetInformation; - -namespace Internal { -class Qt4RunConfigurationFactory; - -class Qt4RunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration -{ - Q_OBJECT - // to change the display name and arguments and set the userenvironmentchanges - friend class Qt4RunConfigurationWidget; - friend class Qt4RunConfigurationFactory; - -public: - Qt4RunConfiguration(ProjectExplorer::Target *parent, Core::Id id); - virtual ~Qt4RunConfiguration(); - - virtual bool isEnabled() const; - virtual QString disabledReason() const; - virtual QWidget *createConfigurationWidget(); - - virtual QString executable() const; - virtual RunMode runMode() const; - bool forcedGuiMode() const; - virtual QString workingDirectory() const; - virtual QString commandLineArguments() const; - QString dumperLibrary() const; - QStringList dumperLibraryLocations() const; - - bool isUsingDyldImageSuffix() const; - void setUsingDyldImageSuffix(bool state); - - QString proFilePath() const; - - QVariantMap toMap() const; - - Utils::OutputFormatter *createOutputFormatter() const; - - void setRunMode(RunMode runMode); - - void addToBaseEnvironment(Utils::Environment &env) const; - -signals: - void commandLineArgumentsChanged(const QString&); - void baseWorkingDirectoryChanged(const QString&); - void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode); - void usingDyldImageSuffixChanged(bool); - - // Note: These signals might not get emitted for every change! - void effectiveTargetInformationChanged(); - -private slots: - void kitChanged(); - void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress); - -protected: - Qt4RunConfiguration(ProjectExplorer::Target *parent, Qt4RunConfiguration *source); - virtual bool fromMap(const QVariantMap &map); - -private: - QPair extractWorkingDirAndExecutable(const Qt4ProFileNode *node) const; - void setBaseWorkingDirectory(const QString &workingDirectory); - QString baseWorkingDirectory() const; - void setCommandLineArguments(const QString &argumentsString); - QString rawCommandLineArguments() const; - QString defaultDisplayName(); - - void ctor(); - - void updateTarget(); - QString m_commandLineArguments; - QString m_proFilePath; // Full path to the Application Pro File - - // Cached startup sub project information - ProjectExplorer::LocalApplicationRunConfiguration::RunMode m_runMode; - bool m_forcedGuiMode; - bool m_userSetName; - bool m_isUsingDyldImageSuffix; - QString m_userWorkingDirectory; - bool m_parseSuccess; - bool m_parseInProgress; -}; - -class Qt4RunConfigurationWidget : public QWidget -{ - Q_OBJECT - -public: - Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4runconfigration, QWidget *parent); - ~Qt4RunConfigurationWidget(); - -protected: - void showEvent(QShowEvent *event); - void hideEvent(QHideEvent *event); - -private slots: - void runConfigurationEnabledChange(); - void workDirectoryEdited(); - void workingDirectoryReseted(); - void argumentsEdited(const QString &arguments); - void environmentWasChanged(); - - void workingDirectoryChanged(const QString &workingDirectory); - void commandLineArgumentsChanged(const QString &args); - void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode); - - void effectiveTargetInformationChanged(); - void termToggled(bool); - void qvfbToggled(bool); - void usingDyldImageSuffixToggled(bool); - void usingDyldImageSuffixChanged(bool); - -private: - Qt4RunConfiguration *m_qt4RunConfiguration; - bool m_ignoreChange; - QLabel *m_disabledIcon; - QLabel *m_disabledReason; - QLineEdit *m_executableLineEdit; - Utils::PathChooser *m_workingDirectoryEdit; - QLineEdit *m_argumentsLineEdit; - QCheckBox *m_useTerminalCheck; - QCheckBox *m_useQvfbCheck; - QCheckBox *m_usingDyldImageSuffix; - QLineEdit *m_qmlDebugPort; - Utils::DetailsWidget *m_detailsContainer; - bool m_isShown; -}; - -class Qt4RunConfigurationFactory : public QmakeRunConfigurationFactory -{ - Q_OBJECT - -public: - explicit Qt4RunConfigurationFactory(QObject *parent = 0); - ~Qt4RunConfigurationFactory(); - - bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; - bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; - bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const; - ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); - - QList availableCreationIds(ProjectExplorer::Target *parent) const; - QString displayNameForId(const Core::Id id) const; - - QList runConfigurationsForNode(ProjectExplorer::Target *t, - ProjectExplorer::Node *n); - -private: - bool canHandle(ProjectExplorer::Target *t) const; - - ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); - ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent, - const QVariantMap &map); -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // QT4RUNCONFIGURATION_H diff --git a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp deleted file mode 100644 index f24d686fed..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "simulatorqtversion.h" - -#include -#include - -#include - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -SimulatorQtVersion::SimulatorQtVersion() - : QtSupport::BaseQtVersion() -{ - -} - -SimulatorQtVersion::SimulatorQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource) - : QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource) -{ - setDisplayName(defaultDisplayName(qtVersionString(), path, false)); -} - -SimulatorQtVersion::~SimulatorQtVersion() -{ - -} - -SimulatorQtVersion *SimulatorQtVersion::clone() const -{ - return new SimulatorQtVersion(*this); -} - -QString SimulatorQtVersion::type() const -{ - return QLatin1String(QtSupport::Constants::SIMULATORQT); -} - -QStringList SimulatorQtVersion::warningReason() const -{ - QStringList ret = BaseQtVersion::warningReason(); - if (qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0) && qmlsceneCommand().isEmpty()) - ret << QCoreApplication::translate("QtVersion", "No qmlscene installed."); - if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 0) && qmlviewerCommand().isEmpty()) - ret << QCoreApplication::translate("QtVersion", "No qmlviewer installed."); - return ret; -} - -QList SimulatorQtVersion::detectQtAbis() const -{ - ensureMkSpecParsed(); - return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString())); -} - -QString SimulatorQtVersion::description() const -{ - return QCoreApplication::translate("QtVersion", "Qt Simulator", "Qt Version is meant for Qt Simulator"); -} - -Core::FeatureSet SimulatorQtVersion::availableFeatures() const -{ - Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); - features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE); - - return features; -} - -bool SimulatorQtVersion::supportsPlatform(const QString &platformName) const -{ - return platformName.isEmpty(); -} diff --git a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h deleted file mode 100644 index e32b00edb2..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef SIMULATORQTVERSION_H -#define SIMULATORQTVERSION_H - -#include - -namespace Qt4ProjectManager{ - -namespace Internal { - -class SimulatorQtVersion : public QtSupport::BaseQtVersion -{ -public: - SimulatorQtVersion(); - SimulatorQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); - ~SimulatorQtVersion(); - SimulatorQtVersion *clone() const; - - QString type() const; - - QStringList warningReason() const; - - QList detectQtAbis() const; - - QString description() const; - - Core::FeatureSet availableFeatures() const; - bool supportsPlatform(const QString &platformName) const; -}; - -} -} - -#endif // SIMULATORQTVERSION_H diff --git a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.cpp deleted file mode 100644 index 21e7b3bbe9..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "simulatorqtversionfactory.h" -#include "simulatorqtversion.h" - -#include -#include - -#include - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -SimulatorQtVersionFactory::SimulatorQtVersionFactory(QObject *parent) - : QtVersionFactory(parent) -{ - -} - -SimulatorQtVersionFactory::~SimulatorQtVersionFactory() -{ - -} - -bool SimulatorQtVersionFactory::canRestore(const QString &type) -{ - return type == QLatin1String(QtSupport::Constants::SIMULATORQT); -} - -QtSupport::BaseQtVersion *SimulatorQtVersionFactory::restore(const QString &type, const QVariantMap &data) -{ - if (!canRestore(type)) - return 0; - QtSupport::BaseQtVersion *v = new SimulatorQtVersion; - v->fromMap(data); - return v; -} - - -int SimulatorQtVersionFactory::priority() const -{ - return 50; -} - -QtSupport::BaseQtVersion *SimulatorQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource) -{ - QFileInfo fi = qmakePath.toFileInfo(); - if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) - return 0; - QStringList configValues = evaluator->values(QLatin1String("CONFIG")); - if (!configValues.contains(QLatin1String("simulator"))) - return 0; - - return new SimulatorQtVersion(qmakePath, isAutoDetected, autoDetectionSource); -} diff --git a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.h b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.h deleted file mode 100644 index d30c547dc2..0000000000 --- a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversionfactory.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef SIMULATORQTVERSIONFACTORY_H -#define SIMULATORQTVERSIONFACTORY_H - -#include - -namespace Qt4ProjectManager { -namespace Internal { - -class SimulatorQtVersionFactory : public QtSupport::QtVersionFactory -{ -public: - explicit SimulatorQtVersionFactory(QObject *parent = 0); - ~SimulatorQtVersionFactory(); - - virtual bool canRestore(const QString &type); - virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data); - - virtual int priority() const; - virtual QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString()); -}; - -} // Internal -} // Qt4ProjectManager - - -#endif // SIMULATORQTVERSIONFACTORY_H diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index 6e8b302dff..a5e9b46713 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -30,6 +30,7 @@ #include "qt4buildconfiguration.h" #include "qmakebuildinfo.h" +#include "qmakekitinformation.h" #include "qt4project.h" #include "qt4projectconfigwidget.h" #include "qt4projectmanagerconstants.h" @@ -49,7 +50,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index e574c4bc9b..519b614302 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -61,8 +61,7 @@ HEADERS += \ librarydetailscontroller.h \ findqt4profiles.h \ qt4projectmanager_global.h \ - winceqtversionfactory.h \ - winceqtversion.h \ + qt4runconfiguration.h \ profilecompletionassist.h SOURCES += \ @@ -119,8 +118,7 @@ SOURCES += \ addlibrarywizard.cpp \ librarydetailscontroller.cpp \ findqt4profiles.cpp \ - winceqtversionfactory.cpp \ - winceqtversion.cpp \ + qt4runconfiguration.cpp \ profilecompletionassist.cpp FORMS += makestep.ui \ @@ -136,5 +134,4 @@ FORMS += makestep.ui \ RESOURCES += qt4projectmanager.qrc \ wizards/wizards.qrc -include(qt-desktop/qt-desktop.pri) include(customwidgetwizard/customwidgetwizard.pri) diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.qbs b/src/plugins/qt4projectmanager/qt4projectmanager.qbs index 8d0e6b98f6..88db16ce78 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.qbs +++ b/src/plugins/qt4projectmanager/qt4projectmanager.qbs @@ -51,8 +51,7 @@ QtcPlugin { "qt4projectmanagerconstants.h", "qt4projectmanagerplugin.cpp", "qt4projectmanagerplugin.h", "qtmodulesinfo.cpp", "qtmodulesinfo.h", - "winceqtversion.cpp", "winceqtversion.h", - "winceqtversionfactory.cpp", "winceqtversionfactory.h" + "qt4runconfiguration.cpp", "qt4runconfiguration.h", ] } @@ -84,18 +83,6 @@ QtcPlugin { ] } - Group { - name: "Qt/Desktop" - prefix: "qt-desktop/" - files: [ - "desktopqtversion.cpp", "desktopqtversion.h", - "desktopqtversionfactory.cpp", "desktopqtversionfactory.h", - "qt4runconfiguration.cpp", "qt4runconfiguration.h", - "simulatorqtversion.cpp", "simulatorqtversion.h", - "simulatorqtversionfactory.cpp", "simulatorqtversionfactory.h" - ] - } - Group { name: "Wizards" prefix: "wizards/" diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index d23d8045a6..cc4c14588b 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -34,6 +34,7 @@ #include "qmakestep.h" #include "makestep.h" #include "qt4buildconfiguration.h" +#include "qt4runconfiguration.h" #include "wizards/consoleappwizard.h" #include "wizards/guiappwizard.h" #include "wizards/librarywizard.h" @@ -49,10 +50,6 @@ #include "qt4project.h" #include "externaleditors.h" #include "profilecompletionassist.h" -#include "qt-desktop/qt4runconfiguration.h" -#include "qt-desktop/desktopqtversionfactory.h" -#include "qt-desktop/simulatorqtversionfactory.h" -#include "winceqtversionfactory.h" #include "qmakekitinformation.h" #include "profilehighlighterfactory.h" @@ -149,10 +146,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * addAutoReleasedObject(new DesignerExternalEditor); addAutoReleasedObject(new LinguistExternalEditor); - addAutoReleasedObject(new DesktopQtVersionFactory); - addAutoReleasedObject(new SimulatorQtVersionFactory); - addAutoReleasedObject(new WinCeQtVersionFactory); - addAutoReleasedObject(new ProFileCompletionAssistProvider); addAutoReleasedObject(new ProFileHoverHandler(this)); addAutoReleasedObject(new ProFileHighlighterFactory); diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp new file mode 100644 index 0000000000..606371886c --- /dev/null +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -0,0 +1,724 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qt4runconfiguration.h" + +#include "qt4nodes.h" +#include "qt4project.h" +#include "qt4buildconfiguration.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace Qt4ProjectManager::Internal; +using namespace Qt4ProjectManager; +using ProjectExplorer::LocalApplicationRunConfiguration; +using Utils::PersistentSettingsReader; +using Utils::PersistentSettingsWriter; + +namespace { + +const char QT4_RC_PREFIX[] = "Qt4ProjectManager.Qt4RunConfiguration:"; +const char COMMAND_LINE_ARGUMENTS_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"; +const char PRO_FILE_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.ProFile"; +const char USE_TERMINAL_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"; +const char USE_DYLD_IMAGE_SUFFIX_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix"; +const char USER_WORKING_DIRECTORY_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"; + +QString pathFromId(Core::Id id) +{ + return id.suffixAfter(QT4_RC_PREFIX); +} + +} // namespace + +// +// Qt4RunConfiguration +// + +Qt4RunConfiguration::Qt4RunConfiguration(ProjectExplorer::Target *parent, Core::Id id) : + LocalApplicationRunConfiguration(parent, id), + m_proFilePath(pathFromId(id)), + m_runMode(Gui), + m_isUsingDyldImageSuffix(false) +{ + Qt4Project *project = static_cast(parent->project()); + m_parseSuccess = project->validParse(m_proFilePath); + m_parseInProgress = project->parseInProgress(m_proFilePath); + + ctor(); +} + +Qt4RunConfiguration::Qt4RunConfiguration(ProjectExplorer::Target *parent, Qt4RunConfiguration *source) : + LocalApplicationRunConfiguration(parent, source), + m_commandLineArguments(source->m_commandLineArguments), + m_proFilePath(source->m_proFilePath), + m_runMode(source->m_runMode), + m_isUsingDyldImageSuffix(source->m_isUsingDyldImageSuffix), + m_userWorkingDirectory(source->m_userWorkingDirectory), + m_parseSuccess(source->m_parseSuccess), + m_parseInProgress(source->m_parseInProgress) +{ + ctor(); +} + +Qt4RunConfiguration::~Qt4RunConfiguration() +{ +} + +bool Qt4RunConfiguration::isEnabled() const +{ + return m_parseSuccess && !m_parseInProgress; +} + +QString Qt4RunConfiguration::disabledReason() const +{ + if (m_parseInProgress) + return tr("The .pro file '%1' is currently being parsed.") + .arg(QFileInfo(m_proFilePath).fileName()); + + if (!m_parseSuccess) + return static_cast(target()->project())->disabledReasonForRunConfiguration(m_proFilePath); + return QString(); +} + +void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress) +{ + ProjectExplorer::LocalEnvironmentAspect *aspect + = extraAspect(); + QTC_ASSERT(aspect, return); + + if (m_proFilePath != pro->path()) { + if (!parseInProgress) { + // We depend on all .pro files for the LD_LIBRARY_PATH so we emit a signal for all .pro files + // This can be optimized by checking whether LD_LIBRARY_PATH changed + aspect->buildEnvironmentHasChanged(); + } + return; + } + + bool enabled = isEnabled(); + QString reason = disabledReason(); + m_parseSuccess = success; + m_parseInProgress = parseInProgress; + if (enabled != isEnabled() || reason != disabledReason()) + emit enabledChanged(); + + if (!parseInProgress) { + emit effectiveTargetInformationChanged(); + aspect->buildEnvironmentHasChanged(); + } +} + +void Qt4RunConfiguration::ctor() +{ + setDefaultDisplayName(defaultDisplayName()); + + QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit()); + m_forcedGuiMode = (version && version->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)); + + connect(target()->project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), + this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); + connect(target(), SIGNAL(kitChanged()), + this, SLOT(kitChanged())); +} + +void Qt4RunConfiguration::kitChanged() +{ + QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit()); + m_forcedGuiMode = (version && version->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)); + emit runModeChanged(runMode()); // Always emit +} + +////// +/// Qt4RunConfigurationWidget +///// + +Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4RunConfiguration, QWidget *parent) + : QWidget(parent), + m_qt4RunConfiguration(qt4RunConfiguration), + m_ignoreChange(false), + m_usingDyldImageSuffix(0), + m_isShown(false) +{ + QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); + vboxTopLayout->setMargin(0); + + QHBoxLayout *hl = new QHBoxLayout(); + hl->addStretch(); + m_disabledIcon = new QLabel(this); + m_disabledIcon->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/compile_warning.png"))); + hl->addWidget(m_disabledIcon); + m_disabledReason = new QLabel(this); + m_disabledReason->setVisible(false); + hl->addWidget(m_disabledReason); + hl->addStretch(); + vboxTopLayout->addLayout(hl); + + m_detailsContainer = new Utils::DetailsWidget(this); + m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); + vboxTopLayout->addWidget(m_detailsContainer); + QWidget *detailsWidget = new QWidget(m_detailsContainer); + m_detailsContainer->setWidget(detailsWidget); + QFormLayout *toplayout = new QFormLayout(detailsWidget); + toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); + toplayout->setMargin(0); + + m_executableLineEdit = new QLineEdit(m_qt4RunConfiguration->executable(), this); + m_executableLineEdit->setEnabled(false); + toplayout->addRow(tr("Executable:"), m_executableLineEdit); + + QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); + m_argumentsLineEdit = new QLineEdit(qt4RunConfiguration->rawCommandLineArguments(), this); + argumentsLabel->setBuddy(m_argumentsLineEdit); + toplayout->addRow(argumentsLabel, m_argumentsLineEdit); + + m_workingDirectoryEdit = new Utils::PathChooser(this); + m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); + m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->baseWorkingDirectory()); + m_workingDirectoryEdit->setBaseDirectory(m_qt4RunConfiguration->target()->project()->projectDirectory()); + ProjectExplorer::EnvironmentAspect *aspect + = qt4RunConfiguration->extraAspect(); + if (aspect) { + connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); + environmentWasChanged(); + } + m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); + + QToolButton *resetButton = new QToolButton(this); + resetButton->setToolTip(tr("Reset to default")); + resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); + + QHBoxLayout *boxlayout = new QHBoxLayout(); + boxlayout->setMargin(0); + boxlayout->addWidget(m_workingDirectoryEdit); + boxlayout->addWidget(resetButton); + toplayout->addRow(tr("Working directory:"), boxlayout); + + QHBoxLayout *innerBox = new QHBoxLayout(); + m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this); + m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console); + m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode()); + innerBox->addWidget(m_useTerminalCheck); + + m_useQvfbCheck = new QCheckBox(tr("Run on QVFb"), this); + m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer.")); + m_useQvfbCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console); + m_useQvfbCheck->setVisible(false); + innerBox->addWidget(m_useQvfbCheck); + innerBox->addStretch(); + toplayout->addRow(QString(), innerBox); + + if (Utils::HostOsInfo::isMacHost()) { + m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this); + m_usingDyldImageSuffix->setChecked(m_qt4RunConfiguration->isUsingDyldImageSuffix()); + toplayout->addRow(QString(), m_usingDyldImageSuffix); + connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)), + this, SLOT(usingDyldImageSuffixToggled(bool))); + } + + runConfigurationEnabledChange(); + + connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), + this, SLOT(workDirectoryEdited())); + + connect(resetButton, SIGNAL(clicked()), + this, SLOT(workingDirectoryReseted())); + + connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), + this, SLOT(argumentsEdited(QString))); + connect(m_useTerminalCheck, SIGNAL(toggled(bool)), + this, SLOT(termToggled(bool))); + connect(m_useQvfbCheck, SIGNAL(toggled(bool)), + this, SLOT(qvfbToggled(bool))); + + connect(qt4RunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)), + this, SLOT(workingDirectoryChanged(QString))); + + connect(qt4RunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)), + this, SLOT(commandLineArgumentsChanged(QString))); + connect(qt4RunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)), + this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode))); + connect(qt4RunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)), + this, SLOT(usingDyldImageSuffixChanged(bool))); + connect(qt4RunConfiguration, SIGNAL(effectiveTargetInformationChanged()), + this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection); + + connect(qt4RunConfiguration, SIGNAL(enabledChanged()), + this, SLOT(runConfigurationEnabledChange())); +} + +Qt4RunConfigurationWidget::~Qt4RunConfigurationWidget() +{ +} + +void Qt4RunConfigurationWidget::environmentWasChanged() +{ + ProjectExplorer::EnvironmentAspect *aspect + = m_qt4RunConfiguration->extraAspect(); + QTC_ASSERT(aspect, return); + m_workingDirectoryEdit->setEnvironment(aspect->environment()); +} + +void Qt4RunConfigurationWidget::runConfigurationEnabledChange() +{ + bool enabled = m_qt4RunConfiguration->isEnabled(); + m_disabledIcon->setVisible(!enabled); + m_disabledReason->setVisible(!enabled); + m_disabledReason->setText(m_qt4RunConfiguration->disabledReason()); +} + +void Qt4RunConfigurationWidget::workDirectoryEdited() +{ + if (m_ignoreChange) + return; + m_ignoreChange = true; + m_qt4RunConfiguration->setBaseWorkingDirectory(m_workingDirectoryEdit->rawPath()); + m_ignoreChange = false; +} + +void Qt4RunConfigurationWidget::workingDirectoryReseted() +{ + // This emits a signal connected to workingDirectoryChanged() + // that sets the m_workingDirectoryEdit + m_qt4RunConfiguration->setBaseWorkingDirectory(QString()); +} + +void Qt4RunConfigurationWidget::argumentsEdited(const QString &args) +{ + m_ignoreChange = true; + m_qt4RunConfiguration->setCommandLineArguments(args); + m_ignoreChange = false; +} + +void Qt4RunConfigurationWidget::termToggled(bool on) +{ + m_ignoreChange = true; + m_qt4RunConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console + : LocalApplicationRunConfiguration::Gui); + m_ignoreChange = false; +} + +void Qt4RunConfigurationWidget::qvfbToggled(bool on) +{ + Q_UNUSED(on); + m_ignoreChange = true; + m_ignoreChange = false; +} + +void Qt4RunConfigurationWidget::usingDyldImageSuffixToggled(bool state) +{ + m_ignoreChange = true; + m_qt4RunConfiguration->setUsingDyldImageSuffix(state); + m_ignoreChange = false; +} + +void Qt4RunConfigurationWidget::workingDirectoryChanged(const QString &workingDirectory) +{ + if (!m_ignoreChange) + m_workingDirectoryEdit->setPath(workingDirectory); +} + +void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args) +{ + if (m_ignoreChange) + return; + m_argumentsLineEdit->setText(args); +} + +void Qt4RunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode) +{ + if (!m_ignoreChange) { + m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode()); + m_useTerminalCheck->setChecked(runMode == LocalApplicationRunConfiguration::Console); + } +} + +void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state) +{ + if (!m_ignoreChange && m_usingDyldImageSuffix) + m_usingDyldImageSuffix->setChecked(state); +} + +void Qt4RunConfigurationWidget::effectiveTargetInformationChanged() +{ + if (m_isShown) { + m_executableLineEdit->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable())); + m_ignoreChange = true; + m_workingDirectoryEdit->setPath(QDir::toNativeSeparators(m_qt4RunConfiguration->baseWorkingDirectory())); + m_ignoreChange = false; + } +} + +void Qt4RunConfigurationWidget::showEvent(QShowEvent *event) +{ + m_isShown = true; + effectiveTargetInformationChanged(); + QWidget::showEvent(event); +} + +void Qt4RunConfigurationWidget::hideEvent(QHideEvent *event) +{ + m_isShown = false; + QWidget::hideEvent(event); +} + +QWidget *Qt4RunConfiguration::createConfigurationWidget() +{ + return new Qt4RunConfigurationWidget(this, 0); +} + +QVariantMap Qt4RunConfiguration::toMap() const +{ + const QDir projectDir = QDir(target()->project()->projectDirectory()); + QVariantMap map(LocalApplicationRunConfiguration::toMap()); + map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments); + map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath)); + map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console); + map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix); + map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory); + return map; +} + +bool Qt4RunConfiguration::fromMap(const QVariantMap &map) +{ + const QDir projectDir = QDir(target()->project()->projectDirectory()); + m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toString(); + m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString())); + m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool() ? Console : Gui; + m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool(); + + m_userWorkingDirectory = map.value(QLatin1String(USER_WORKING_DIRECTORY_KEY)).toString(); + + m_parseSuccess = static_cast(target()->project())->validParse(m_proFilePath); + m_parseInProgress = static_cast(target()->project())->parseInProgress(m_proFilePath); + + return LocalApplicationRunConfiguration::fromMap(map); +} + +QString Qt4RunConfiguration::executable() const +{ + Qt4Project *pro = static_cast(target()->project()); + const Qt4ProFileNode *node = pro->rootQt4ProjectNode()->findProFileFor(m_proFilePath); + return extractWorkingDirAndExecutable(node).second; +} + +LocalApplicationRunConfiguration::RunMode Qt4RunConfiguration::runMode() const +{ + if (m_forcedGuiMode) + return LocalApplicationRunConfiguration::Gui; + return m_runMode; +} + +bool Qt4RunConfiguration::forcedGuiMode() const +{ + return m_forcedGuiMode; +} + +bool Qt4RunConfiguration::isUsingDyldImageSuffix() const +{ + return m_isUsingDyldImageSuffix; +} + +void Qt4RunConfiguration::setUsingDyldImageSuffix(bool state) +{ + m_isUsingDyldImageSuffix = state; + emit usingDyldImageSuffixChanged(state); +} + +QString Qt4RunConfiguration::workingDirectory() const +{ + ProjectExplorer::EnvironmentAspect *aspect + = extraAspect(); + QTC_ASSERT(aspect, baseWorkingDirectory()); + return QDir::cleanPath(aspect->environment().expandVariables( + Utils::expandMacros(baseWorkingDirectory(), macroExpander()))); +} + +QString Qt4RunConfiguration::baseWorkingDirectory() const +{ + // if the user overrode us, then return his working directory + if (!m_userWorkingDirectory.isEmpty()) + return m_userWorkingDirectory; + + // else what the pro file reader tells us + Qt4Project *pro = static_cast(target()->project()); + const Qt4ProFileNode *node = pro->rootQt4ProjectNode()->findProFileFor(m_proFilePath); + return extractWorkingDirAndExecutable(node).first; +} + +QString Qt4RunConfiguration::commandLineArguments() const +{ + return Utils::QtcProcess::expandMacros(m_commandLineArguments, macroExpander()); +} + +QString Qt4RunConfiguration::rawCommandLineArguments() const +{ + return m_commandLineArguments; +} + +void Qt4RunConfiguration::setBaseWorkingDirectory(const QString &wd) +{ + const QString &oldWorkingDirectory = workingDirectory(); + + m_userWorkingDirectory = wd; + + const QString &newWorkingDirectory = workingDirectory(); + if (oldWorkingDirectory != newWorkingDirectory) + emit baseWorkingDirectoryChanged(newWorkingDirectory); +} + +void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString) +{ + m_commandLineArguments = argumentsString; + emit commandLineArgumentsChanged(argumentsString); +} + +void Qt4RunConfiguration::setRunMode(RunMode runMode) +{ + m_runMode = runMode; + emit runModeChanged(runMode); +} + +void Qt4RunConfiguration::addToBaseEnvironment(Utils::Environment &env) const +{ + if (m_isUsingDyldImageSuffix) + env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug")); + + // The user could be linking to a library found via a -L/some/dir switch + // to find those libraries while actually running we explicitly prepend those + // dirs to the library search path + const Qt4ProFileNode *node = static_cast(target()->project())->rootQt4ProjectNode()->findProFileFor(m_proFilePath); + if (node) { + const QStringList libDirectories = node->variableValue(LibDirectoriesVar); + if (!libDirectories.isEmpty()) { + const QString proDirectory = node->buildDir(); + foreach (QString dir, libDirectories) { + // Fix up relative entries like "LIBS+=-L.." + const QFileInfo fi(dir); + if (!fi.isAbsolute()) + dir = QDir::cleanPath(proDirectory + QLatin1Char('/') + dir); + env.prependOrSetLibrarySearchPath(dir); + } // foreach + } // libDirectories + } // node + + QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit()); + if (qtVersion) + env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS")); +} + +QString Qt4RunConfiguration::proFilePath() const +{ + return m_proFilePath; +} + +QString Qt4RunConfiguration::dumperLibrary() const +{ + return QtSupport::QtKitInformation::dumperLibrary(target()->kit()); +} + +QStringList Qt4RunConfiguration::dumperLibraryLocations() const +{ + return QtSupport::QtKitInformation::dumperLibraryLocations(target()->kit()); +} + +QString Qt4RunConfiguration::defaultDisplayName() +{ + QString defaultName; + if (!m_proFilePath.isEmpty()) + defaultName = QFileInfo(m_proFilePath).completeBaseName(); + else + defaultName = tr("Qt Run Configuration"); + return defaultName; +} + +Utils::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const +{ + return new QtSupport::QtOutputFormatter(target()->project()); +} + +QPair Qt4RunConfiguration::extractWorkingDirAndExecutable(const Qt4ProFileNode *node) const +{ + if (!node) + return qMakePair(QString(), QString()); + TargetInformation ti = node->targetInformation(); + if (!ti.valid) + return qMakePair(QString(), QString()); + + const QStringList &config = node->variableValue(ConfigVar); + + QString destDir = ti.destDir; + QString workingDir; + if (!destDir.isEmpty()) { + bool workingDirIsBaseDir = false; + if (destDir == ti.buildTarget) { + workingDirIsBaseDir = true; + } + if (QDir::isRelativePath(destDir)) + destDir = QDir::cleanPath(ti.buildDir + QLatin1Char('/') + destDir); + + if (workingDirIsBaseDir) + workingDir = ti.buildDir; + else + workingDir = destDir; + } else { + destDir = ti.buildDir; + workingDir = ti.buildDir; + } + + if (Utils::HostOsInfo::isMacHost() + && config.contains(QLatin1String("app_bundle"))) { + const QString infix = QLatin1Char('/') + ti.target + + QLatin1String(".app/Contents/MacOS"); + workingDir += infix; + destDir += infix; + } + + QString executable = QDir::cleanPath(destDir + QLatin1Char('/') + ti.target); + executable = Utils::HostOsInfo::withExecutableSuffix(executable); + //qDebug() << "##### Qt4RunConfiguration::extractWorkingDirAndExecutable:" workingDir << executable; + return qMakePair(workingDir, executable); +} + +/// +/// Qt4RunConfigurationFactory +/// This class is used to restore run settings (saved in .user files) +/// + +Qt4RunConfigurationFactory::Qt4RunConfigurationFactory(QObject *parent) : + QmakeRunConfigurationFactory(parent) +{ setObjectName(QLatin1String("Qt4RunConfigurationFactory")); } + +Qt4RunConfigurationFactory::~Qt4RunConfigurationFactory() +{ } + +bool Qt4RunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const +{ + if (!canHandle(parent)) + return false; + Qt4Project *project = static_cast(parent->project()); + return project->hasApplicationProFile(pathFromId(id)); +} + +ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id) +{ + Qt4RunConfiguration *rc = new Qt4RunConfiguration(parent, id); + const Qt4ProFileNode *node = static_cast(parent->project())->rootQt4ProjectNode()->findProFileFor(rc->proFilePath()); + if (node) // should always be found + rc->setRunMode(node->variableValue(ConfigVar).contains(QLatin1String("console")) + && !node->variableValue(QtVar).contains(QLatin1String("testlib")) + ? ProjectExplorer::LocalApplicationRunConfiguration::Console + : ProjectExplorer::LocalApplicationRunConfiguration::Gui); + return rc; +} + +bool Qt4RunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const +{ + if (!canHandle(parent)) + return false; + return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(QT4_RC_PREFIX)); +} + +ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::doRestore(ProjectExplorer::Target *parent, + const QVariantMap &map) +{ + return new Qt4RunConfiguration(parent, ProjectExplorer::idFromMap(map)); +} + +bool Qt4RunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const +{ + return canCreate(parent, source->id()); +} + +ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) +{ + if (!canClone(parent, source)) + return 0; + Qt4RunConfiguration *old = static_cast(source); + return new Qt4RunConfiguration(parent, old); +} + +QList Qt4RunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const +{ + QList result; + if (!canHandle(parent)) + return result; + + Qt4Project *project = static_cast(parent->project()); + QStringList proFiles = project->applicationProFilePathes(QLatin1String(QT4_RC_PREFIX)); + foreach (const QString &pf, proFiles) + result << Core::Id::fromString(pf); + return result; +} + +QString Qt4RunConfigurationFactory::displayNameForId(const Core::Id id) const +{ + return QFileInfo(pathFromId(id)).completeBaseName(); +} + +bool Qt4RunConfigurationFactory::canHandle(ProjectExplorer::Target *t) const +{ + if (!t->project()->supportsKit(t->kit())) + return false; + if (!qobject_cast(t->project())) + return false; + Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(t->kit()); + return devType == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE; +} + +QList Qt4RunConfigurationFactory::runConfigurationsForNode(ProjectExplorer::Target *t, ProjectExplorer::Node *n) +{ + QList result; + foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) + if (Qt4RunConfiguration *qt4c = qobject_cast(rc)) + if (qt4c->proFilePath() == n->path()) + result << rc; + return result; + +} diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h new file mode 100644 index 0000000000..1527a4b524 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QT4RUNCONFIGURATION_H +#define QT4RUNCONFIGURATION_H + +#include + +#include + + +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QCheckBox; +class QLineEdit; +class QRadioButton; +class QComboBox; +QT_END_NAMESPACE + +namespace Utils { +class PathChooser; +class DetailsWidget; +} + +namespace Qt4ProjectManager { + +class Qt4Project; +class Qt4ProFileNode; +class Qt4PriFileNode; +class TargetInformation; + +namespace Internal { +class Qt4RunConfigurationFactory; + +class Qt4RunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration +{ + Q_OBJECT + // to change the display name and arguments and set the userenvironmentchanges + friend class Qt4RunConfigurationWidget; + friend class Qt4RunConfigurationFactory; + +public: + Qt4RunConfiguration(ProjectExplorer::Target *parent, Core::Id id); + virtual ~Qt4RunConfiguration(); + + virtual bool isEnabled() const; + virtual QString disabledReason() const; + virtual QWidget *createConfigurationWidget(); + + virtual QString executable() const; + virtual RunMode runMode() const; + bool forcedGuiMode() const; + virtual QString workingDirectory() const; + virtual QString commandLineArguments() const; + QString dumperLibrary() const; + QStringList dumperLibraryLocations() const; + + bool isUsingDyldImageSuffix() const; + void setUsingDyldImageSuffix(bool state); + + QString proFilePath() const; + + QVariantMap toMap() const; + + Utils::OutputFormatter *createOutputFormatter() const; + + void setRunMode(RunMode runMode); + + void addToBaseEnvironment(Utils::Environment &env) const; + +signals: + void commandLineArgumentsChanged(const QString&); + void baseWorkingDirectoryChanged(const QString&); + void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode); + void usingDyldImageSuffixChanged(bool); + + // Note: These signals might not get emitted for every change! + void effectiveTargetInformationChanged(); + +private slots: + void kitChanged(); + void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress); + +protected: + Qt4RunConfiguration(ProjectExplorer::Target *parent, Qt4RunConfiguration *source); + virtual bool fromMap(const QVariantMap &map); + +private: + QPair extractWorkingDirAndExecutable(const Qt4ProFileNode *node) const; + void setBaseWorkingDirectory(const QString &workingDirectory); + QString baseWorkingDirectory() const; + void setCommandLineArguments(const QString &argumentsString); + QString rawCommandLineArguments() const; + QString defaultDisplayName(); + + void ctor(); + + void updateTarget(); + QString m_commandLineArguments; + QString m_proFilePath; // Full path to the Application Pro File + + // Cached startup sub project information + ProjectExplorer::LocalApplicationRunConfiguration::RunMode m_runMode; + bool m_forcedGuiMode; + bool m_userSetName; + bool m_isUsingDyldImageSuffix; + QString m_userWorkingDirectory; + bool m_parseSuccess; + bool m_parseInProgress; +}; + +class Qt4RunConfigurationWidget : public QWidget +{ + Q_OBJECT + +public: + Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4runconfigration, QWidget *parent); + ~Qt4RunConfigurationWidget(); + +protected: + void showEvent(QShowEvent *event); + void hideEvent(QHideEvent *event); + +private slots: + void runConfigurationEnabledChange(); + void workDirectoryEdited(); + void workingDirectoryReseted(); + void argumentsEdited(const QString &arguments); + void environmentWasChanged(); + + void workingDirectoryChanged(const QString &workingDirectory); + void commandLineArgumentsChanged(const QString &args); + void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode); + + void effectiveTargetInformationChanged(); + void termToggled(bool); + void qvfbToggled(bool); + void usingDyldImageSuffixToggled(bool); + void usingDyldImageSuffixChanged(bool); + +private: + Qt4RunConfiguration *m_qt4RunConfiguration; + bool m_ignoreChange; + QLabel *m_disabledIcon; + QLabel *m_disabledReason; + QLineEdit *m_executableLineEdit; + Utils::PathChooser *m_workingDirectoryEdit; + QLineEdit *m_argumentsLineEdit; + QCheckBox *m_useTerminalCheck; + QCheckBox *m_useQvfbCheck; + QCheckBox *m_usingDyldImageSuffix; + QLineEdit *m_qmlDebugPort; + Utils::DetailsWidget *m_detailsContainer; + bool m_isShown; +}; + +class Qt4RunConfigurationFactory : public QmakeRunConfigurationFactory +{ + Q_OBJECT + +public: + explicit Qt4RunConfigurationFactory(QObject *parent = 0); + ~Qt4RunConfigurationFactory(); + + bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; + bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; + bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const; + ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); + + QList availableCreationIds(ProjectExplorer::Target *parent) const; + QString displayNameForId(const Core::Id id) const; + + QList runConfigurationsForNode(ProjectExplorer::Target *t, + ProjectExplorer::Node *n); + +private: + bool canHandle(ProjectExplorer::Target *t) const; + + ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); + ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent, + const QVariantMap &map); +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // QT4RUNCONFIGURATION_H diff --git a/src/plugins/qt4projectmanager/winceqtversion.cpp b/src/plugins/qt4projectmanager/winceqtversion.cpp deleted file mode 100644 index 4c1c0dc8c3..0000000000 --- a/src/plugins/qt4projectmanager/winceqtversion.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "winceqtversion.h" -#include -#include -#include - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -WinCeQtVersion::WinCeQtVersion() - : QtSupport::BaseQtVersion(), - m_archType(ProjectExplorer::Abi::ArmArchitecture) -{ -} - -WinCeQtVersion::WinCeQtVersion(const Utils::FileName &path, const QString &archType, - bool isAutodetected, const QString &autodetectionSource) - : QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource), - m_archType(ProjectExplorer::Abi::ArmArchitecture) -{ - if (0 == archType.compare(QLatin1String("x86"), Qt::CaseInsensitive)) - m_archType = ProjectExplorer::Abi::X86Architecture; - else if (0 == archType.compare(QLatin1String("mipsii"), Qt::CaseInsensitive)) - m_archType = ProjectExplorer::Abi::MipsArchitecture; - setDisplayName(defaultDisplayName(qtVersionString(), path, false)); -} - -WinCeQtVersion::~WinCeQtVersion() -{ -} - -WinCeQtVersion *WinCeQtVersion::clone() const -{ - return new WinCeQtVersion(*this); -} - -QString WinCeQtVersion::type() const -{ - return QLatin1String(QtSupport::Constants::WINCEQT); -} - -QList WinCeQtVersion::detectQtAbis() const -{ - return QList() - << ProjectExplorer::Abi(m_archType, - ProjectExplorer::Abi::WindowsOS, - ProjectExplorer::Abi::WindowsCEFlavor, - ProjectExplorer::Abi::PEFormat, - false); -} - -QString WinCeQtVersion::description() const -{ - return QCoreApplication::translate("QtVersion", - "Qt for WinCE", "Qt Version is meant for WinCE"); -} - -void WinCeQtVersion::fromMap(const QVariantMap &map) -{ - BaseQtVersion::fromMap(map); - - // Default to an ARM architecture, then use the makespec to see what - // the architecture is. This assumes that a WinCE makespec will be - // named -- with no other '-' characters. - m_archType = ProjectExplorer::Abi::ArmArchitecture; - - const QStringList splitSpec = mkspec().toString().split(QLatin1Char('-')); - if (splitSpec.length() == 3) { - const QString archString = splitSpec.value(1); - if (archString.contains(QLatin1String("x86"), Qt::CaseInsensitive)) - m_archType = ProjectExplorer::Abi::X86Architecture; - else if (archString.contains(QLatin1String("mips"), Qt::CaseInsensitive)) - m_archType = ProjectExplorer::Abi::MipsArchitecture; - } -} - -QString WinCeQtVersion::platformName() const -{ - return QLatin1String(QtSupport::Constants::WINDOWS_CE_PLATFORM); -} - -QString WinCeQtVersion::platformDisplayName() const -{ - return QLatin1String(QtSupport::Constants::WINDOWS_CE_PLATFORM_TR); -} diff --git a/src/plugins/qt4projectmanager/winceqtversion.h b/src/plugins/qt4projectmanager/winceqtversion.h deleted file mode 100644 index f8be3814cc..0000000000 --- a/src/plugins/qt4projectmanager/winceqtversion.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef WINCEQTVERSION_H -#define WINCEQTVERSION_H - -#include - -namespace Qt4ProjectManager { -namespace Internal { - -class WinCeQtVersion : public QtSupport::BaseQtVersion -{ -public: - WinCeQtVersion(); - WinCeQtVersion(const Utils::FileName &path, const QString &archType, - bool isAutodetected = false, const QString &autodetectionSource = QString()); - ~WinCeQtVersion(); - WinCeQtVersion *clone() const; - - QString type() const; - - QList detectQtAbis() const; - - QString description() const; - - void fromMap(const QVariantMap &data); - - QString platformName() const; - QString platformDisplayName() const; - -private: - ProjectExplorer::Abi::Architecture m_archType; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // WINCEQTVERSION_H diff --git a/src/plugins/qt4projectmanager/winceqtversionfactory.cpp b/src/plugins/qt4projectmanager/winceqtversionfactory.cpp deleted file mode 100644 index 2f2d810fcb..0000000000 --- a/src/plugins/qt4projectmanager/winceqtversionfactory.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "winceqtversionfactory.h" -#include "winceqtversion.h" -#include -#include -#include - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -WinCeQtVersionFactory::WinCeQtVersionFactory(QObject *parent) - : QtVersionFactory(parent) -{ - -} - -WinCeQtVersionFactory::~WinCeQtVersionFactory() -{ - -} - -bool WinCeQtVersionFactory::canRestore(const QString &type) -{ - return type == QLatin1String(QtSupport::Constants::WINCEQT); -} - -QtSupport::BaseQtVersion *WinCeQtVersionFactory::restore(const QString &type, const QVariantMap &data) -{ - if (!canRestore(type)) - return 0; - WinCeQtVersion *v = new WinCeQtVersion; - v->fromMap(data); - return v; -} - -int WinCeQtVersionFactory::priority() const -{ - return 50; -} - -QtSupport::BaseQtVersion *WinCeQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource) -{ - QFileInfo fi = qmakePath.toFileInfo(); - if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) - return 0; - - QString ce_sdk = evaluator->values(QLatin1String("CE_SDK")).join(QLatin1String(" ")); - QString ce_arch = evaluator->value(QLatin1String("CE_ARCH")); - - if (!ce_sdk.isEmpty() && !ce_arch.isEmpty()) - return new WinCeQtVersion(qmakePath, ce_arch, isAutoDetected, autoDetectionSource); - - return 0; -} diff --git a/src/plugins/qt4projectmanager/winceqtversionfactory.h b/src/plugins/qt4projectmanager/winceqtversionfactory.h deleted file mode 100644 index 7bd45a18e4..0000000000 --- a/src/plugins/qt4projectmanager/winceqtversionfactory.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** 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. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef WINCEQTVERSIONFACTORY_H -#define WINCEQTVERSIONFACTORY_H - -#include - -namespace Qt4ProjectManager { -namespace Internal { - -class WinCeQtVersionFactory : public QtSupport::QtVersionFactory -{ -public: - explicit WinCeQtVersionFactory(QObject *parent = 0); - ~WinCeQtVersionFactory(); - - virtual bool canRestore(const QString &type); - virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data); - - virtual int priority() const; - - virtual QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, - bool isAutoDetected = false, const QString &autoDetectionSource = QString()); - -}; - -} // Internal -} // Qt4ProjectManager - -#endif // WINCEQTVERSIONFACTORY_H diff --git a/src/plugins/qtsupport/desktopqtversion.cpp b/src/plugins/qtsupport/desktopqtversion.cpp new file mode 100644 index 0000000000..8e4943fbe2 --- /dev/null +++ b/src/plugins/qtsupport/desktopqtversion.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "desktopqtversion.h" +#include "qtsupportconstants.h" + +#include + +#include + +using namespace QtSupport; +using namespace QtSupport::Internal; + +DesktopQtVersion::DesktopQtVersion() + : BaseQtVersion() +{ + +} + +DesktopQtVersion::DesktopQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource) + : BaseQtVersion(path, isAutodetected, autodetectionSource) +{ + setDisplayName(defaultDisplayName(qtVersionString(), path, false)); +} + +DesktopQtVersion::~DesktopQtVersion() +{ + +} + +DesktopQtVersion *DesktopQtVersion::clone() const +{ + return new DesktopQtVersion(*this); +} + +QString DesktopQtVersion::type() const +{ + return QLatin1String(Constants::DESKTOPQT); +} + +QStringList DesktopQtVersion::warningReason() const +{ + QStringList ret = BaseQtVersion::warningReason(); + if (qtVersion() >= QtVersionNumber(5, 0, 0) && qmlsceneCommand().isEmpty()) + ret << QCoreApplication::translate("QtVersion", "No qmlscene installed."); + if (qtVersion() >= QtVersionNumber(4, 7, 0) && qmlviewerCommand().isEmpty()) + ret << QCoreApplication::translate("QtVersion", "No qmlviewer installed."); + return ret; +} + +QList DesktopQtVersion::detectQtAbis() const +{ + return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString())); +} + +QString DesktopQtVersion::description() const +{ + return QCoreApplication::translate("QtVersion", "Desktop", "Qt Version is meant for the desktop"); +} + +Core::FeatureSet DesktopQtVersion::availableFeatures() const +{ + Core::FeatureSet features = BaseQtVersion::availableFeatures(); + features |= Core::FeatureSet(Constants::FEATURE_DESKTOP); + features |= Core::Feature(Constants::FEATURE_QMLPROJECT); + return features; +} + +QString DesktopQtVersion::platformName() const +{ + return QLatin1String(Constants::DESKTOP_PLATFORM); +} + +QString DesktopQtVersion::platformDisplayName() const +{ + return QLatin1String(Constants::DESKTOP_PLATFORM_TR); +} diff --git a/src/plugins/qtsupport/desktopqtversion.h b/src/plugins/qtsupport/desktopqtversion.h new file mode 100644 index 0000000000..7c4ccca547 --- /dev/null +++ b/src/plugins/qtsupport/desktopqtversion.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef DESKTOPQTVERSION_H +#define DESKTOPQTVERSION_H + +#include "baseqtversion.h" + +namespace QtSupport { +namespace Internal { + +class DesktopQtVersion : public BaseQtVersion +{ +public: + DesktopQtVersion(); + DesktopQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); + ~DesktopQtVersion(); + DesktopQtVersion *clone() const; + + QString type() const; + + QStringList warningReason() const; + + QList detectQtAbis() const; + + QString description() const; + + Core::FeatureSet availableFeatures() const; + QString platformName() const; + QString platformDisplayName() const; +}; + +} // Internal +} // QtSupport + +#endif // DESKTOPQTVERSION_H diff --git a/src/plugins/qtsupport/desktopqtversionfactory.cpp b/src/plugins/qtsupport/desktopqtversionfactory.cpp new file mode 100644 index 0000000000..b2f2006fbe --- /dev/null +++ b/src/plugins/qtsupport/desktopqtversionfactory.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ +#include "desktopqtversionfactory.h" +#include "desktopqtversion.h" +#include + +#include + +using namespace QtSupport; +using namespace QtSupport::Internal; + +DesktopQtVersionFactory::DesktopQtVersionFactory(QObject *parent) + : QtVersionFactory(parent) +{ + +} + +DesktopQtVersionFactory::~DesktopQtVersionFactory() +{ + +} + +bool DesktopQtVersionFactory::canRestore(const QString &type) +{ + return type == QLatin1String(Constants::DESKTOPQT); +} + +BaseQtVersion *DesktopQtVersionFactory::restore(const QString &type, const QVariantMap &data) +{ + if (!canRestore(type)) + return 0; + DesktopQtVersion *v = new DesktopQtVersion; + v->fromMap(data); + return v; +} + +int DesktopQtVersionFactory::priority() const +{ + // Lowest of all, we want to be the fallback + return 0; +} + +BaseQtVersion *DesktopQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource) +{ + Q_UNUSED(evaluator); + // we are the fallback :) so we don't care what kind of qt it is + QFileInfo fi = qmakePath.toFileInfo(); + if (fi.exists() && fi.isExecutable() && fi.isFile()) + return new DesktopQtVersion(qmakePath, isAutoDetected, autoDetectionSource); + return 0; +} diff --git a/src/plugins/qtsupport/desktopqtversionfactory.h b/src/plugins/qtsupport/desktopqtversionfactory.h new file mode 100644 index 0000000000..f9976c7daf --- /dev/null +++ b/src/plugins/qtsupport/desktopqtversionfactory.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef DESKTOPQTVERSIONFACTORY_H +#define DESKTOPQTVERSIONFACTORY_H + +#include "qtversionfactory.h" + +namespace QtSupport { +namespace Internal { + +class DesktopQtVersionFactory : public QtVersionFactory +{ +public: + explicit DesktopQtVersionFactory(QObject *parent = 0); + ~DesktopQtVersionFactory(); + + virtual bool canRestore(const QString &type); + virtual BaseQtVersion *restore(const QString &type, const QVariantMap &data); + + virtual int priority() const; + virtual BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString()); +}; + +} // Internal +} // QtSupport + +#endif // DESKTOPQTVERSIONFACTORY_H diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro index af48b82a6f..b6c5cd40c8 100644 --- a/src/plugins/qtsupport/qtsupport.pro +++ b/src/plugins/qtsupport/qtsupport.pro @@ -30,7 +30,13 @@ HEADERS += \ exampleslistmodel.h \ screenshotcropper.h \ qtconfigwidget.h \ - qtfeatureprovider.h + qtfeatureprovider.h \ + desktopqtversionfactory.h \ + simulatorqtversionfactory.h \ + desktopqtversion.h \ + simulatorqtversion.h \ + winceqtversionfactory.h \ + winceqtversion.h SOURCES += \ qtsupportplugin.cpp \ @@ -53,7 +59,13 @@ SOURCES += \ qtparser.cpp \ exampleslistmodel.cpp \ screenshotcropper.cpp \ - qtconfigwidget.cpp + qtconfigwidget.cpp \ + desktopqtversionfactory.cpp \ + simulatorqtversionfactory.cpp \ + desktopqtversion.cpp \ + simulatorqtversion.cpp \ + winceqtversionfactory.cpp \ + winceqtversion.cpp greaterThan(QT_MAJOR_VERSION, 4) { QT += quick diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs index 7c03c0052b..e764c190cb 100644 --- a/src/plugins/qtsupport/qtsupport.qbs +++ b/src/plugins/qtsupport/qtsupport.qbs @@ -112,6 +112,18 @@ QtcPlugin { "images/qt_qrc.png", ] + Group { + name: "QtVersion" + files: [ + "desktopqtversion.cpp", "desktopqtversion.h", + "desktopqtversionfactory.cpp", "desktopqtversionfactory.h", + "simulatorqtversion.cpp", "simulatorqtversion.h", + "simulatorqtversionfactory.cpp", "simulatorqtversionfactory.h", + "winceqtversion.cpp", "winceqtversion.h", + "winceqtversionfactory.cpp", "winceqtversionfactory.h", + ] + } + Group { name: "Getting Started Welcome Page" condition: QtcFunctions.versionIsAtLeast(Qt.core.version, "5.1") diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index 7aae247e14..af6e7feffb 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -30,11 +30,14 @@ #include "qtsupportplugin.h" #include "customexecutablerunconfiguration.h" -#include "qtoptionspage.h" +#include "desktopqtversionfactory.h" +#include "qtfeatureprovider.h" #include "qtkitinformation.h" +#include "qtoptionspage.h" #include "qtversionmanager.h" -#include "qtfeatureprovider.h" +#include "simulatorqtversionfactory.h" #include "uicodemodelsupport.h" +#include "winceqtversionfactory.h" #include "profilereader.h" @@ -70,6 +73,9 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes return false; addAutoReleasedObject(new QtVersionManager); + addAutoReleasedObject(new DesktopQtVersionFactory); + addAutoReleasedObject(new SimulatorQtVersionFactory); + addAutoReleasedObject(new WinCeQtVersionFactory); addAutoReleasedObject(new UiCodeModelManager); QtFeatureProvider *featureMgr = new QtFeatureProvider; diff --git a/src/plugins/qtsupport/simulatorqtversion.cpp b/src/plugins/qtsupport/simulatorqtversion.cpp new file mode 100644 index 0000000000..8c8a73e63e --- /dev/null +++ b/src/plugins/qtsupport/simulatorqtversion.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "simulatorqtversion.h" +#include "qtsupportconstants.h" + +#include + +#include + +using namespace QtSupport; +using namespace QtSupport::Internal; + +SimulatorQtVersion::SimulatorQtVersion() + : BaseQtVersion() +{ + +} + +SimulatorQtVersion::SimulatorQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource) + : BaseQtVersion(path, isAutodetected, autodetectionSource) +{ + setDisplayName(defaultDisplayName(qtVersionString(), path, false)); +} + +SimulatorQtVersion::~SimulatorQtVersion() +{ + +} + +SimulatorQtVersion *SimulatorQtVersion::clone() const +{ + return new SimulatorQtVersion(*this); +} + +QString SimulatorQtVersion::type() const +{ + return QLatin1String(Constants::SIMULATORQT); +} + +QStringList SimulatorQtVersion::warningReason() const +{ + QStringList ret = BaseQtVersion::warningReason(); + if (qtVersion() >= QtVersionNumber(5, 0, 0) && qmlsceneCommand().isEmpty()) + ret << QCoreApplication::translate("QtVersion", "No qmlscene installed."); + if (qtVersion() >= QtVersionNumber(4, 7, 0) && qmlviewerCommand().isEmpty()) + ret << QCoreApplication::translate("QtVersion", "No qmlviewer installed."); + return ret; +} + +QList SimulatorQtVersion::detectQtAbis() const +{ + ensureMkSpecParsed(); + return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString())); +} + +QString SimulatorQtVersion::description() const +{ + return QCoreApplication::translate("QtVersion", "Qt Simulator", "Qt Version is meant for Qt Simulator"); +} + +Core::FeatureSet SimulatorQtVersion::availableFeatures() const +{ + Core::FeatureSet features = BaseQtVersion::availableFeatures(); + features |= Core::FeatureSet(Constants::FEATURE_MOBILE); + return features; +} + +bool SimulatorQtVersion::supportsPlatform(const QString &platformName) const +{ + return platformName.isEmpty(); +} diff --git a/src/plugins/qtsupport/simulatorqtversion.h b/src/plugins/qtsupport/simulatorqtversion.h new file mode 100644 index 0000000000..2a3487bb4f --- /dev/null +++ b/src/plugins/qtsupport/simulatorqtversion.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef SIMULATORQTVERSION_H +#define SIMULATORQTVERSION_H + +#include "baseqtversion.h" + +namespace QtSupport { +namespace Internal { + +class SimulatorQtVersion : public BaseQtVersion +{ +public: + SimulatorQtVersion(); + SimulatorQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); + ~SimulatorQtVersion(); + SimulatorQtVersion *clone() const; + + QString type() const; + + QStringList warningReason() const; + + QList detectQtAbis() const; + + QString description() const; + + Core::FeatureSet availableFeatures() const; + bool supportsPlatform(const QString &platformName) const; +}; + +} // Internal +} // QtSupport + +#endif // SIMULATORQTVERSION_H diff --git a/src/plugins/qtsupport/simulatorqtversionfactory.cpp b/src/plugins/qtsupport/simulatorqtversionfactory.cpp new file mode 100644 index 0000000000..745d15c13d --- /dev/null +++ b/src/plugins/qtsupport/simulatorqtversionfactory.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "simulatorqtversionfactory.h" +#include "simulatorqtversion.h" +#include "qtsupportconstants.h" +#include "profilereader.h" + +#include + +using namespace QtSupport; +using namespace QtSupport::Internal; + +SimulatorQtVersionFactory::SimulatorQtVersionFactory(QObject *parent) + : QtVersionFactory(parent) +{ + +} + +SimulatorQtVersionFactory::~SimulatorQtVersionFactory() +{ + +} + +bool SimulatorQtVersionFactory::canRestore(const QString &type) +{ + return type == QLatin1String(Constants::SIMULATORQT); +} + +BaseQtVersion *SimulatorQtVersionFactory::restore(const QString &type, const QVariantMap &data) +{ + if (!canRestore(type)) + return 0; + BaseQtVersion *v = new SimulatorQtVersion; + v->fromMap(data); + return v; +} + + +int SimulatorQtVersionFactory::priority() const +{ + return 50; +} + +BaseQtVersion *SimulatorQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource) +{ + QFileInfo fi = qmakePath.toFileInfo(); + if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) + return 0; + QStringList configValues = evaluator->values(QLatin1String("CONFIG")); + if (!configValues.contains(QLatin1String("simulator"))) + return 0; + + return new SimulatorQtVersion(qmakePath, isAutoDetected, autoDetectionSource); +} diff --git a/src/plugins/qtsupport/simulatorqtversionfactory.h b/src/plugins/qtsupport/simulatorqtversionfactory.h new file mode 100644 index 0000000000..70a0c5946f --- /dev/null +++ b/src/plugins/qtsupport/simulatorqtversionfactory.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef SIMULATORQTVERSIONFACTORY_H +#define SIMULATORQTVERSIONFACTORY_H + +#include "qtversionfactory.h" + +namespace QtSupport { +namespace Internal { + +class SimulatorQtVersionFactory : public QtVersionFactory +{ +public: + explicit SimulatorQtVersionFactory(QObject *parent = 0); + ~SimulatorQtVersionFactory(); + + virtual bool canRestore(const QString &type); + virtual BaseQtVersion *restore(const QString &type, const QVariantMap &data); + + virtual int priority() const; + virtual BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString()); +}; + +} // Internal +} // QtSupport + +#endif // SIMULATORQTVERSIONFACTORY_H diff --git a/src/plugins/qtsupport/winceqtversion.cpp b/src/plugins/qtsupport/winceqtversion.cpp new file mode 100644 index 0000000000..362004014d --- /dev/null +++ b/src/plugins/qtsupport/winceqtversion.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "winceqtversion.h" +#include "qtsupportconstants.h" + +#include +#include + +using namespace QtSupport; +using namespace QtSupport::Internal; + +WinCeQtVersion::WinCeQtVersion() + : BaseQtVersion(), + m_archType(ProjectExplorer::Abi::ArmArchitecture) +{ +} + +WinCeQtVersion::WinCeQtVersion(const Utils::FileName &path, const QString &archType, + bool isAutodetected, const QString &autodetectionSource) + : BaseQtVersion(path, isAutodetected, autodetectionSource), + m_archType(ProjectExplorer::Abi::ArmArchitecture) +{ + if (0 == archType.compare(QLatin1String("x86"), Qt::CaseInsensitive)) + m_archType = ProjectExplorer::Abi::X86Architecture; + else if (0 == archType.compare(QLatin1String("mipsii"), Qt::CaseInsensitive)) + m_archType = ProjectExplorer::Abi::MipsArchitecture; + setDisplayName(defaultDisplayName(qtVersionString(), path, false)); +} + +WinCeQtVersion::~WinCeQtVersion() +{ +} + +WinCeQtVersion *WinCeQtVersion::clone() const +{ + return new WinCeQtVersion(*this); +} + +QString WinCeQtVersion::type() const +{ + return QLatin1String(Constants::WINCEQT); +} + +QList WinCeQtVersion::detectQtAbis() const +{ + return QList() + << ProjectExplorer::Abi(m_archType, + ProjectExplorer::Abi::WindowsOS, + ProjectExplorer::Abi::WindowsCEFlavor, + ProjectExplorer::Abi::PEFormat, + false); +} + +QString WinCeQtVersion::description() const +{ + return QCoreApplication::translate("QtVersion", + "Qt for WinCE", "Qt Version is meant for WinCE"); +} + +void WinCeQtVersion::fromMap(const QVariantMap &map) +{ + BaseQtVersion::fromMap(map); + + // Default to an ARM architecture, then use the makespec to see what + // the architecture is. This assumes that a WinCE makespec will be + // named -- with no other '-' characters. + m_archType = ProjectExplorer::Abi::ArmArchitecture; + + const QStringList splitSpec = mkspec().toString().split(QLatin1Char('-')); + if (splitSpec.length() == 3) { + const QString archString = splitSpec.value(1); + if (archString.contains(QLatin1String("x86"), Qt::CaseInsensitive)) + m_archType = ProjectExplorer::Abi::X86Architecture; + else if (archString.contains(QLatin1String("mips"), Qt::CaseInsensitive)) + m_archType = ProjectExplorer::Abi::MipsArchitecture; + } +} + +QString WinCeQtVersion::platformName() const +{ + return QLatin1String(Constants::WINDOWS_CE_PLATFORM); +} + +QString WinCeQtVersion::platformDisplayName() const +{ + return QLatin1String(Constants::WINDOWS_CE_PLATFORM_TR); +} diff --git a/src/plugins/qtsupport/winceqtversion.h b/src/plugins/qtsupport/winceqtversion.h new file mode 100644 index 0000000000..669ad56d1a --- /dev/null +++ b/src/plugins/qtsupport/winceqtversion.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef WINCEQTVERSION_H +#define WINCEQTVERSION_H + +#include "baseqtversion.h" + +namespace QtSupport { +namespace Internal { + +class WinCeQtVersion : public BaseQtVersion +{ +public: + WinCeQtVersion(); + WinCeQtVersion(const Utils::FileName &path, const QString &archType, + bool isAutodetected = false, const QString &autodetectionSource = QString()); + ~WinCeQtVersion(); + WinCeQtVersion *clone() const; + + QString type() const; + + QList detectQtAbis() const; + + QString description() const; + + void fromMap(const QVariantMap &data); + + QString platformName() const; + QString platformDisplayName() const; + +private: + ProjectExplorer::Abi::Architecture m_archType; +}; + +} // Internal +} // QtSupport + +#endif // WINCEQTVERSION_H diff --git a/src/plugins/qtsupport/winceqtversionfactory.cpp b/src/plugins/qtsupport/winceqtversionfactory.cpp new file mode 100644 index 0000000000..bcc827a7f7 --- /dev/null +++ b/src/plugins/qtsupport/winceqtversionfactory.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "winceqtversionfactory.h" +#include "winceqtversion.h" +#include "qtsupportconstants.h" +#include "profilereader.h" + +#include + +using namespace QtSupport; +using namespace QtSupport::Internal; + +WinCeQtVersionFactory::WinCeQtVersionFactory(QObject *parent) + : QtVersionFactory(parent) +{ + +} + +WinCeQtVersionFactory::~WinCeQtVersionFactory() +{ + +} + +bool WinCeQtVersionFactory::canRestore(const QString &type) +{ + return type == QLatin1String(Constants::WINCEQT); +} + +BaseQtVersion *WinCeQtVersionFactory::restore(const QString &type, const QVariantMap &data) +{ + if (!canRestore(type)) + return 0; + WinCeQtVersion *v = new WinCeQtVersion; + v->fromMap(data); + return v; +} + +int WinCeQtVersionFactory::priority() const +{ + return 50; +} + +BaseQtVersion *WinCeQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource) +{ + QFileInfo fi = qmakePath.toFileInfo(); + if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) + return 0; + + QString ce_sdk = evaluator->values(QLatin1String("CE_SDK")).join(QLatin1String(" ")); + QString ce_arch = evaluator->value(QLatin1String("CE_ARCH")); + + if (!ce_sdk.isEmpty() && !ce_arch.isEmpty()) + return new WinCeQtVersion(qmakePath, ce_arch, isAutoDetected, autoDetectionSource); + + return 0; +} diff --git a/src/plugins/qtsupport/winceqtversionfactory.h b/src/plugins/qtsupport/winceqtversionfactory.h new file mode 100644 index 0000000000..0e74c0214d --- /dev/null +++ b/src/plugins/qtsupport/winceqtversionfactory.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef WINCEQTVERSIONFACTORY_H +#define WINCEQTVERSIONFACTORY_H + +#include "qtversionfactory.h" + +namespace QtSupport { +namespace Internal { + +class WinCeQtVersionFactory : public QtVersionFactory +{ +public: + explicit WinCeQtVersionFactory(QObject *parent = 0); + ~WinCeQtVersionFactory(); + + virtual bool canRestore(const QString &type); + virtual BaseQtVersion *restore(const QString &type, const QVariantMap &data); + + virtual int priority() const; + + virtual BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, + bool isAutoDetected = false, const QString &autoDetectionSource = QString()); + +}; + +} // Internal +} // QtSupport + +#endif // WINCEQTVERSIONFACTORY_H -- cgit v1.2.1