forked from qt-creator/qt-creator
QtVersion: Allow for variables in Qt version names
* Supported variables are %{Qt:version}, %{Qt:type} and %{Qt:mkspec} * Qt version display names need no longer be unique. This simplifies the code a bit and makes the Qt versions behave like the Kits do now. * The default Qt version name now contains %{Qt:version}. The method to find the default version name no longer takes a Qt version string. Change-Id: Ibca1e3daffe5a81f3c158e8bbc1779d033b03872 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -57,7 +57,7 @@ AndroidQtVersion::AndroidQtVersion()
|
|||||||
AndroidQtVersion::AndroidQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
AndroidQtVersion::AndroidQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
||||||
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource)
|
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidQtVersion *AndroidQtVersion::clone() const
|
AndroidQtVersion *AndroidQtVersion::clone() const
|
||||||
|
@@ -58,7 +58,7 @@ IosQtVersion::IosQtVersion(const Utils::FileName &path, bool isAutodetected,
|
|||||||
const QString &autodetectionSource)
|
const QString &autodetectionSource)
|
||||||
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource)
|
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
IosQtVersion *IosQtVersion::clone() const
|
IosQtVersion *IosQtVersion::clone() const
|
||||||
|
@@ -220,7 +220,8 @@ QnxAbstractQtVersion *BlackBerryApiLevelConfiguration::createQtVersion(
|
|||||||
{
|
{
|
||||||
QnxAbstractQtVersion *version = new BlackBerryQtVersion(
|
QnxAbstractQtVersion *version = new BlackBerryQtVersion(
|
||||||
arch, qmakePath, true, QString(), envFile().toString());
|
arch, qmakePath, true, QString(), envFile().toString());
|
||||||
version->setDisplayName(tr("Qt %1 for %2").arg(version->qtVersionString(), versionName));
|
version->setUnexpandedDisplayName(tr("Qt %{Qt:version} for %2")
|
||||||
|
.arg(version->qtVersionString(), versionName));
|
||||||
QtVersionManager::addVersion(version);
|
QtVersionManager::addVersion(version);
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
@@ -51,7 +51,7 @@ QnxQtVersion::QnxQtVersion()
|
|||||||
QnxQtVersion::QnxQtVersion(QnxArchitecture arch, const Utils::FileName &path, bool isAutoDetected, const QString &autoDetectionSource)
|
QnxQtVersion::QnxQtVersion(QnxArchitecture arch, const Utils::FileName &path, bool isAutoDetected, const QString &autoDetectionSource)
|
||||||
: QnxAbstractQtVersion(arch, path, isAutoDetected, autoDetectionSource)
|
: QnxAbstractQtVersion(arch, path, isAutoDetected, autoDetectionSource)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxQtVersion *QnxQtVersion::clone() const
|
QnxQtVersion *QnxQtVersion::clone() const
|
||||||
|
@@ -42,12 +42,14 @@
|
|||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/headerpath.h>
|
#include <projectexplorer/headerpath.h>
|
||||||
#include <qtsupport/debugginghelperbuildtask.h>
|
#include <qtsupport/debugginghelperbuildtask.h>
|
||||||
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
|
#include <utils/stringutils.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
#include <utils/winutils.h>
|
#include <utils/winutils.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
@@ -189,14 +191,15 @@ void BaseQtVersion::ctor(const FileName &qmakePath)
|
|||||||
m_hasQtAbis = false;
|
m_hasQtAbis = false;
|
||||||
m_qtVersionString.clear();
|
m_qtVersionString.clear();
|
||||||
m_sourcePath.clear();
|
m_sourcePath.clear();
|
||||||
|
m_expander = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseQtVersion::~BaseQtVersion()
|
BaseQtVersion::~BaseQtVersion()
|
||||||
{
|
{
|
||||||
|
delete m_expander;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const FileName &qmakePath,
|
QString BaseQtVersion::defaultUnexpandedDisplayName(const FileName &qmakePath, bool fromPath)
|
||||||
bool fromPath)
|
|
||||||
{
|
{
|
||||||
QString location;
|
QString location;
|
||||||
if (qmakePath.isEmpty()) {
|
if (qmakePath.isEmpty()) {
|
||||||
@@ -222,8 +225,8 @@ QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Fi
|
|||||||
}
|
}
|
||||||
|
|
||||||
return fromPath ?
|
return fromPath ?
|
||||||
QCoreApplication::translate("QtVersion", "Qt %1 in PATH (%2)").arg(versionString, location) :
|
QCoreApplication::translate("QtVersion", "Qt %{Qt:version} in PATH (%2)").arg(location) :
|
||||||
QCoreApplication::translate("QtVersion", "Qt %1 (%2)").arg(versionString, location);
|
QCoreApplication::translate("QtVersion", "Qt %{Qt:version} (%2)").arg(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
FeatureSet BaseQtVersion::availableFeatures() const
|
FeatureSet BaseQtVersion::availableFeatures() const
|
||||||
@@ -409,7 +412,7 @@ void BaseQtVersion::fromMap(const QVariantMap &map)
|
|||||||
m_id = map.value(QLatin1String(Constants::QTVERSIONID)).toInt();
|
m_id = map.value(QLatin1String(Constants::QTVERSIONID)).toInt();
|
||||||
if (m_id == -1) // this happens on adding from installer, see updateFromInstaller => get a new unique id
|
if (m_id == -1) // this happens on adding from installer, see updateFromInstaller => get a new unique id
|
||||||
m_id = QtVersionManager::getUniqueId();
|
m_id = QtVersionManager::getUniqueId();
|
||||||
m_displayName = map.value(QLatin1String(Constants::QTVERSIONNAME)).toString();
|
m_unexpandedDisplayName = map.value(QLatin1String(Constants::QTVERSIONNAME)).toString();
|
||||||
m_isAutodetected = map.value(QLatin1String(QTVERSIONAUTODETECTED)).toBool();
|
m_isAutodetected = map.value(QLatin1String(QTVERSIONAUTODETECTED)).toBool();
|
||||||
if (m_isAutodetected)
|
if (m_isAutodetected)
|
||||||
m_autodetectionSource = map.value(QLatin1String(QTVERSIONAUTODETECTIONSOURCE)).toString();
|
m_autodetectionSource = map.value(QLatin1String(QTVERSIONAUTODETECTIONSOURCE)).toString();
|
||||||
@@ -534,12 +537,17 @@ void BaseQtVersion::setAutoDetectionSource(const QString &autodetectionSource)
|
|||||||
|
|
||||||
QString BaseQtVersion::displayName() const
|
QString BaseQtVersion::displayName() const
|
||||||
{
|
{
|
||||||
return m_displayName;
|
return Utils::expandMacros(unexpandedDisplayName(), macroExpander());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseQtVersion::setDisplayName(const QString &name)
|
QString BaseQtVersion::unexpandedDisplayName() const
|
||||||
{
|
{
|
||||||
m_displayName = name;
|
return m_unexpandedDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseQtVersion::setUnexpandedDisplayName(const QString &name)
|
||||||
|
{
|
||||||
|
m_unexpandedDisplayName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseQtVersion::toHtml(bool verbose) const
|
QString BaseQtVersion::toHtml(bool verbose) const
|
||||||
@@ -837,6 +845,11 @@ void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
|||||||
m_mkspecValues.insert(ns, evaluator->value(ns));
|
m_mkspecValues.insert(ns, evaluator->value(ns));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractMacroExpander *BaseQtVersion::createMacroExpander() const
|
||||||
|
{
|
||||||
|
return QtKitInformation::createMacroExpander(this);
|
||||||
|
}
|
||||||
|
|
||||||
FileName BaseQtVersion::mkspec() const
|
FileName BaseQtVersion::mkspec() const
|
||||||
{
|
{
|
||||||
updateMkspec();
|
updateMkspec();
|
||||||
@@ -1046,6 +1059,13 @@ QStringList BaseQtVersion::qtConfigValues() const
|
|||||||
return m_qtConfigValues;
|
return m_qtConfigValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractMacroExpander *BaseQtVersion::macroExpander() const
|
||||||
|
{
|
||||||
|
if (!m_expander)
|
||||||
|
m_expander = createMacroExpander();
|
||||||
|
return m_expander;
|
||||||
|
}
|
||||||
|
|
||||||
QList<HeaderPath> BaseQtVersion::systemHeaderPathes(const Kit *k) const
|
QList<HeaderPath> BaseQtVersion::systemHeaderPathes(const Kit *k) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(k);
|
Q_UNUSED(k);
|
||||||
|
@@ -39,7 +39,10 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
namespace Utils { class Environment; }
|
namespace Utils {
|
||||||
|
class Environment;
|
||||||
|
class AbstractMacroExpander;
|
||||||
|
} // namespace Utils
|
||||||
|
|
||||||
namespace Core { class FeatureSet; }
|
namespace Core { class FeatureSet; }
|
||||||
|
|
||||||
@@ -96,7 +99,8 @@ public:
|
|||||||
QString autodetectionSource() const;
|
QString autodetectionSource() const;
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void setDisplayName(const QString &name);
|
QString unexpandedDisplayName() const;
|
||||||
|
void setUnexpandedDisplayName(const QString &name);
|
||||||
|
|
||||||
// All valid Ids are >= 0
|
// All valid Ids are >= 0
|
||||||
int uniqueId() const;
|
int uniqueId() const;
|
||||||
@@ -194,8 +198,7 @@ public:
|
|||||||
|
|
||||||
virtual QtConfigWidget *createConfigurationWidget() const;
|
virtual QtConfigWidget *createConfigurationWidget() const;
|
||||||
|
|
||||||
static QString defaultDisplayName(const QString &versionString,
|
static QString defaultUnexpandedDisplayName(const Utils::FileName &qmakePath,
|
||||||
const Utils::FileName &qmakePath,
|
|
||||||
bool fromPath = false);
|
bool fromPath = false);
|
||||||
|
|
||||||
virtual Core::FeatureSet availableFeatures() const;
|
virtual Core::FeatureSet availableFeatures() const;
|
||||||
@@ -222,6 +225,8 @@ public:
|
|||||||
QStringList configValues() const;
|
QStringList configValues() const;
|
||||||
QStringList qtConfigValues() const;
|
QStringList qtConfigValues() const;
|
||||||
|
|
||||||
|
Utils::AbstractMacroExpander *macroExpander() const; // owned by the Qt version
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BaseQtVersion();
|
BaseQtVersion();
|
||||||
BaseQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
|
BaseQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
|
||||||
@@ -238,6 +243,11 @@ protected:
|
|||||||
|
|
||||||
void ensureMkSpecParsed() const;
|
void ensureMkSpecParsed() const;
|
||||||
virtual void parseMkSpec(ProFileEvaluator *) const;
|
virtual void parseMkSpec(ProFileEvaluator *) const;
|
||||||
|
|
||||||
|
// Create the macro expander. This pointer will be cached by the Qt version (which will take
|
||||||
|
// ownership).
|
||||||
|
virtual Utils::AbstractMacroExpander *createMacroExpander() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setAutoDetectionSource(const QString &autodetectionSource);
|
void setAutoDetectionSource(const QString &autodetectionSource);
|
||||||
static int getUniqueId();
|
static int getUniqueId();
|
||||||
@@ -270,7 +280,7 @@ private:
|
|||||||
mutable QStringList m_configValues;
|
mutable QStringList m_configValues;
|
||||||
mutable QStringList m_qtConfigValues;
|
mutable QStringList m_qtConfigValues;
|
||||||
|
|
||||||
QString m_displayName;
|
QString m_unexpandedDisplayName;
|
||||||
QString m_autodetectionSource;
|
QString m_autodetectionSource;
|
||||||
mutable Utils::FileName m_sourcePath;
|
mutable Utils::FileName m_sourcePath;
|
||||||
|
|
||||||
@@ -290,6 +300,8 @@ private:
|
|||||||
mutable QString m_qmlviewerCommand;
|
mutable QString m_qmlviewerCommand;
|
||||||
|
|
||||||
mutable QList<ProjectExplorer::Abi> m_qtAbis;
|
mutable QList<ProjectExplorer::Abi> m_qtAbis;
|
||||||
|
|
||||||
|
mutable Utils::AbstractMacroExpander *m_expander;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ DesktopQtVersion::DesktopQtVersion()
|
|||||||
DesktopQtVersion::DesktopQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
DesktopQtVersion::DesktopQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
||||||
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopQtVersion::~DesktopQtVersion()
|
DesktopQtVersion::~DesktopQtVersion()
|
||||||
|
@@ -45,19 +45,8 @@ namespace QtSupport {
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QtKitInformationMacroExpander : public ProjectExplorer::KitInformationMacroExpander
|
static bool resolveQtMacro(const BaseQtVersion *version, const QString &name, QString *ret)
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
QtKitInformationMacroExpander(const ProjectExplorer::Kit *k) :
|
|
||||||
ProjectExplorer::KitInformationMacroExpander(k)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
bool resolveMacro(const QString &name, QString *ret);
|
|
||||||
};
|
|
||||||
|
|
||||||
bool QtKitInformationMacroExpander::resolveMacro(const QString &name, QString *ret)
|
|
||||||
{
|
|
||||||
BaseQtVersion *version = QtKitInformation::qtVersion(kit());
|
|
||||||
const QString noInfo = QCoreApplication::translate("QtSupport::QtKitInformation", "none");
|
const QString noInfo = QCoreApplication::translate("QtSupport::QtKitInformation", "none");
|
||||||
|
|
||||||
if (name == QLatin1String("Qt:version")) {
|
if (name == QLatin1String("Qt:version")) {
|
||||||
@@ -76,6 +65,38 @@ bool QtKitInformationMacroExpander::resolveMacro(const QString &name, QString *r
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QtVersionMacroExpander : public Utils::AbstractMacroExpander
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QtVersionMacroExpander(const BaseQtVersion *v) :
|
||||||
|
qtVersion(v)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
bool resolveMacro(const QString &name, QString *ret)
|
||||||
|
{
|
||||||
|
if (name == QLatin1String("Qt:name"))
|
||||||
|
return false;
|
||||||
|
return resolveQtMacro(qtVersion, name, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const BaseQtVersion *qtVersion;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class QtKitInformationMacroExpander : public ProjectExplorer::KitInformationMacroExpander
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QtKitInformationMacroExpander(const ProjectExplorer::Kit *k) :
|
||||||
|
ProjectExplorer::KitInformationMacroExpander(k)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
bool resolveMacro(const QString &name, QString *ret)
|
||||||
|
{
|
||||||
|
return resolveQtMacro(QtKitInformation::qtVersion(kit()), name, ret);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
QtKitInformation::QtKitInformation()
|
QtKitInformation::QtKitInformation()
|
||||||
@@ -169,6 +190,11 @@ Utils::AbstractMacroExpander *QtKitInformation::createMacroExpander(const Projec
|
|||||||
return new Internal::QtKitInformationMacroExpander(k);
|
return new Internal::QtKitInformationMacroExpander(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils::AbstractMacroExpander *QtKitInformation::createMacroExpander(const BaseQtVersion *v)
|
||||||
|
{
|
||||||
|
return new Internal::QtVersionMacroExpander(v);
|
||||||
|
}
|
||||||
|
|
||||||
Core::Id QtKitInformation::id()
|
Core::Id QtKitInformation::id()
|
||||||
{
|
{
|
||||||
return "QtSupport.QtInformation";
|
return "QtSupport.QtInformation";
|
||||||
|
@@ -62,6 +62,8 @@ public:
|
|||||||
|
|
||||||
Utils::AbstractMacroExpander *createMacroExpander(const ProjectExplorer::Kit *k) const;
|
Utils::AbstractMacroExpander *createMacroExpander(const ProjectExplorer::Kit *k) const;
|
||||||
|
|
||||||
|
static Utils::AbstractMacroExpander *createMacroExpander(const BaseQtVersion *v);
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
static int qtVersionId(const ProjectExplorer::Kit *k);
|
static int qtVersionId(const ProjectExplorer::Kit *k);
|
||||||
static void setQtVersionId(ProjectExplorer::Kit *k, const int id);
|
static void setQtVersionId(ProjectExplorer::Kit *k, const int id);
|
||||||
|
@@ -88,8 +88,6 @@ void QtOptionsPage::apply()
|
|||||||
{
|
{
|
||||||
if (!m_widget) // page was never shown
|
if (!m_widget) // page was never shown
|
||||||
return;
|
return;
|
||||||
m_widget->finish();
|
|
||||||
|
|
||||||
m_widget->apply();
|
m_widget->apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,8 +681,8 @@ void QtOptionsPageWidget::editPath()
|
|||||||
}
|
}
|
||||||
// same type, replace
|
// same type, replace
|
||||||
version->setId(current->uniqueId());
|
version->setId(current->uniqueId());
|
||||||
if (current->displayName() != current->defaultDisplayName(current->qtVersionString(), current->qmakeCommand()))
|
if (current->unexpandedDisplayName() != current->defaultUnexpandedDisplayName(current->qmakeCommand()))
|
||||||
version->setDisplayName(current->displayName());
|
version->setUnexpandedDisplayName(current->displayName());
|
||||||
m_versions.replace(m_versions.indexOf(current), version);
|
m_versions.replace(m_versions.indexOf(current), version);
|
||||||
delete current;
|
delete current;
|
||||||
|
|
||||||
@@ -872,9 +870,8 @@ QTreeWidgetItem *QtOptionsPageWidget::treeItemForIndex(int index) const
|
|||||||
|
|
||||||
void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *newItem, QTreeWidgetItem *old)
|
void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *newItem, QTreeWidgetItem *old)
|
||||||
{
|
{
|
||||||
Q_UNUSED(newItem)
|
Q_UNUSED(newItem);
|
||||||
if (old)
|
Q_UNUSED(old);
|
||||||
fixQtVersionName(indexForTreeItem(old));
|
|
||||||
userChangedCurrentVersion();
|
userChangedCurrentVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,7 +881,7 @@ void QtOptionsPageWidget::updateWidgets()
|
|||||||
m_configurationWidget = 0;
|
m_configurationWidget = 0;
|
||||||
BaseQtVersion *version = currentVersion();
|
BaseQtVersion *version = currentVersion();
|
||||||
if (version) {
|
if (version) {
|
||||||
m_versionUi->nameEdit->setText(version->displayName());
|
m_versionUi->nameEdit->setText(version->unexpandedDisplayName());
|
||||||
m_versionUi->qmakePath->setText(version->qmakeCommand().toUserOutput());
|
m_versionUi->qmakePath->setText(version->qmakeCommand().toUserOutput());
|
||||||
m_configurationWidget = version->createConfigurationWidget();
|
m_configurationWidget = version->createConfigurationWidget();
|
||||||
if (m_configurationWidget) {
|
if (m_configurationWidget) {
|
||||||
@@ -912,18 +909,11 @@ void QtOptionsPageWidget::updateCurrentQtName()
|
|||||||
int currentItemIndex = indexForTreeItem(currentItem);
|
int currentItemIndex = indexForTreeItem(currentItem);
|
||||||
if (currentItemIndex < 0)
|
if (currentItemIndex < 0)
|
||||||
return;
|
return;
|
||||||
m_versions[currentItemIndex]->setDisplayName(m_versionUi->nameEdit->text());
|
m_versions[currentItemIndex]->setUnexpandedDisplayName(m_versionUi->nameEdit->text());
|
||||||
currentItem->setText(0, m_versions[currentItemIndex]->displayName());
|
currentItem->setText(0, m_versions[currentItemIndex]->displayName());
|
||||||
updateDescriptionLabel();
|
updateDescriptionLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QtOptionsPageWidget::finish()
|
|
||||||
{
|
|
||||||
if (QTreeWidgetItem *item = m_ui->qtdirList->currentItem())
|
|
||||||
fixQtVersionName(indexForTreeItem(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtOptionsPageWidget::apply()
|
void QtOptionsPageWidget::apply()
|
||||||
{
|
{
|
||||||
disconnect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
disconnect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
||||||
@@ -935,43 +925,6 @@ void QtOptionsPageWidget::apply()
|
|||||||
this, SLOT(updateQtVersions(QList<int>,QList<int>,QList<int>)));
|
this, SLOT(updateQtVersions(QList<int>,QList<int>,QList<int>)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks that the Qt version name is unique
|
|
||||||
* and otherwise changes the name
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void QtOptionsPageWidget::fixQtVersionName(int index)
|
|
||||||
{
|
|
||||||
if (index < 0)
|
|
||||||
return;
|
|
||||||
int count = m_versions.count();
|
|
||||||
QString name = m_versions.at(index)->displayName();
|
|
||||||
if (name.isEmpty())
|
|
||||||
return;
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
if (i != index) {
|
|
||||||
if (m_versions.at(i)->displayName() == m_versions.at(index)->displayName()) {
|
|
||||||
// Same name, find new name
|
|
||||||
QRegExp regexp(QLatin1String("^(.*)\\((\\d)\\)$"));
|
|
||||||
if (regexp.exactMatch(name)) {
|
|
||||||
// Already in Name (#) format
|
|
||||||
name = regexp.cap(1);
|
|
||||||
name += QLatin1Char('(');
|
|
||||||
name += QString::number(regexp.cap(2).toInt() + 1);
|
|
||||||
name += QLatin1Char(')');
|
|
||||||
} else {
|
|
||||||
name += QLatin1String(" (2)");
|
|
||||||
}
|
|
||||||
// set new name
|
|
||||||
m_versions[index]->setDisplayName(name);
|
|
||||||
treeItemForIndex(index)->setText(0, name);
|
|
||||||
|
|
||||||
// Now check again...
|
|
||||||
fixQtVersionName(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BaseQtVersion *> QtOptionsPageWidget::versions() const
|
QList<BaseQtVersion *> QtOptionsPageWidget::versions() const
|
||||||
{
|
{
|
||||||
QList<BaseQtVersion *> result;
|
QList<BaseQtVersion *> result;
|
||||||
|
@@ -65,7 +65,6 @@ public:
|
|||||||
QtOptionsPageWidget(QWidget *parent = 0);
|
QtOptionsPageWidget(QWidget *parent = 0);
|
||||||
~QtOptionsPageWidget();
|
~QtOptionsPageWidget();
|
||||||
QList<BaseQtVersion *> versions() const;
|
QList<BaseQtVersion *> versions() const;
|
||||||
void finish();
|
|
||||||
void apply();
|
void apply();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -73,7 +72,6 @@ private:
|
|||||||
void userChangedCurrentVersion();
|
void userChangedCurrentVersion();
|
||||||
void updateWidgets();
|
void updateWidgets();
|
||||||
void updateDebuggingHelperUi();
|
void updateDebuggingHelperUi();
|
||||||
void fixQtVersionName(int index);
|
|
||||||
int indexForTreeItem(const QTreeWidgetItem *item) const;
|
int indexForTreeItem(const QTreeWidgetItem *item) const;
|
||||||
QTreeWidgetItem *treeItemForIndex(int index) const;
|
QTreeWidgetItem *treeItemForIndex(int index) const;
|
||||||
BaseQtVersion *currentVersion() const;
|
BaseQtVersion *currentVersion() const;
|
||||||
|
@@ -441,7 +441,7 @@ static void findSystemQt()
|
|||||||
|
|
||||||
BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(systemQMakePath);
|
BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(systemQMakePath);
|
||||||
if (version) {
|
if (version) {
|
||||||
version->setDisplayName(BaseQtVersion::defaultDisplayName(version->qtVersionString(), systemQMakePath, true));
|
version->setUnexpandedDisplayName(BaseQtVersion::defaultUnexpandedDisplayName(systemQMakePath, true));
|
||||||
m_versions.insert(version->uniqueId(), version);
|
m_versions.insert(version->uniqueId(), version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ SimulatorQtVersion::SimulatorQtVersion()
|
|||||||
SimulatorQtVersion::SimulatorQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
SimulatorQtVersion::SimulatorQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
||||||
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulatorQtVersion::~SimulatorQtVersion()
|
SimulatorQtVersion::~SimulatorQtVersion()
|
||||||
|
@@ -51,7 +51,7 @@ WinCeQtVersion::WinCeQtVersion(const Utils::FileName &path, const QString &archT
|
|||||||
m_archType = ProjectExplorer::Abi::X86Architecture;
|
m_archType = ProjectExplorer::Abi::X86Architecture;
|
||||||
else if (0 == archType.compare(QLatin1String("mipsii"), Qt::CaseInsensitive))
|
else if (0 == archType.compare(QLatin1String("mipsii"), Qt::CaseInsensitive))
|
||||||
m_archType = ProjectExplorer::Abi::MipsArchitecture;
|
m_archType = ProjectExplorer::Abi::MipsArchitecture;
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
WinCeQtVersion::~WinCeQtVersion()
|
WinCeQtVersion::~WinCeQtVersion()
|
||||||
|
@@ -45,7 +45,7 @@ EmbeddedLinuxQtVersion::EmbeddedLinuxQtVersion()
|
|||||||
EmbeddedLinuxQtVersion::EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
EmbeddedLinuxQtVersion::EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
||||||
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddedLinuxQtVersion::~EmbeddedLinuxQtVersion()
|
EmbeddedLinuxQtVersion::~EmbeddedLinuxQtVersion()
|
||||||
|
@@ -45,7 +45,7 @@ WinRtQtVersion::WinRtQtVersion(const Utils::FileName &path, bool isAutodetected,
|
|||||||
const QString &autodetectionSource)
|
const QString &autodetectionSource)
|
||||||
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
: BaseQtVersion(path, isAutodetected, autodetectionSource)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
QtSupport::BaseQtVersion *WinRtQtVersion::clone() const
|
QtSupport::BaseQtVersion *WinRtQtVersion::clone() const
|
||||||
|
Reference in New Issue
Block a user