forked from qt-creator/qt-creator
Kit: Use FileName for icon path
Change-Id: Ica6cf20c4ae1c7d58386d4970e468a105a3263b3 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -775,7 +775,7 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
foreach (QtSupport::BaseQtVersion *qt, qtVersions) {
|
||||
Kit *newKit = new Kit;
|
||||
newKit->setAutoDetected(true);
|
||||
newKit->setIconPath(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON));
|
||||
newKit->setIconPath(Utils::FileName::fromString(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON)));
|
||||
DeviceTypeKitInformation::setDeviceTypeId(newKit, Core::Id(Constants::ANDROID_DEVICE_TYPE));
|
||||
ToolChainKitInformation::setToolChain(newKit, tc);
|
||||
QtSupport::QtKitInformation::setQtVersion(newKit, qt);
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
bool m_isValid;
|
||||
bool m_hasWarning;
|
||||
QIcon m_icon;
|
||||
QString m_iconPath;
|
||||
Utils::FileName m_iconPath;
|
||||
int m_nestedBlockingLevel;
|
||||
bool m_mustNotify;
|
||||
bool m_mustNotifyAboutDisplayName;
|
||||
@@ -123,7 +123,7 @@ Kit::Kit(Core::Id id) :
|
||||
setValue(sti->dataId(), sti->defaultValue(this));
|
||||
|
||||
setDisplayName(QCoreApplication::translate("ProjectExplorer::Kit", "Unnamed"));
|
||||
setIconPath(QLatin1String(":///DESKTOP///"));
|
||||
setIconPath(Utils::FileName::fromString(QLatin1String(":///DESKTOP///")));
|
||||
}
|
||||
|
||||
Kit::~Kit()
|
||||
@@ -298,25 +298,25 @@ QIcon Kit::icon() const
|
||||
return d->m_icon;
|
||||
}
|
||||
|
||||
QIcon Kit::icon(const QString &path)
|
||||
QIcon Kit::icon(const Utils::FileName &path)
|
||||
{
|
||||
if (path.isEmpty())
|
||||
return QIcon();
|
||||
if (path == QLatin1String(":///DESKTOP///"))
|
||||
if (path == Utils::FileName::fromString(QLatin1String(":///DESKTOP///")))
|
||||
return qApp->style()->standardIcon(QStyle::SP_ComputerIcon);
|
||||
|
||||
QFileInfo fi(path);
|
||||
QFileInfo fi(path.toString());
|
||||
if (fi.isFile() && fi.isReadable())
|
||||
return QIcon(path);
|
||||
return QIcon(path.toString());
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
QString Kit::iconPath() const
|
||||
Utils::FileName Kit::iconPath() const
|
||||
{
|
||||
return d->m_iconPath;
|
||||
}
|
||||
|
||||
void Kit::setIconPath(const QString &path)
|
||||
void Kit::setIconPath(const Utils::FileName &path)
|
||||
{
|
||||
if (d->m_iconPath == path)
|
||||
return;
|
||||
@@ -378,7 +378,7 @@ QVariantMap Kit::toMap() const
|
||||
data.insert(QLatin1String(DISPLAYNAME_KEY), d->m_displayName);
|
||||
data.insert(QLatin1String(AUTODETECTED_KEY), d->m_autodetected);
|
||||
data.insert(QLatin1String(SDK_PROVIDED_KEY), d->m_sdkProvided);
|
||||
data.insert(QLatin1String(ICON_KEY), d->m_iconPath);
|
||||
data.insert(QLatin1String(ICON_KEY), d->m_iconPath.toString());
|
||||
|
||||
QVariantMap extra;
|
||||
|
||||
@@ -465,7 +465,7 @@ bool Kit::fromMap(const QVariantMap &data)
|
||||
else
|
||||
d->m_sdkProvided = d->m_autodetected;
|
||||
setDisplayName(data.value(QLatin1String(DISPLAYNAME_KEY)).toString());
|
||||
setIconPath(data.value(QLatin1String(ICON_KEY)).toString());
|
||||
setIconPath(Utils::FileName::fromString(data.value(QLatin1String(ICON_KEY)).toString()));
|
||||
|
||||
QVariantMap extra = data.value(QLatin1String(DATA_KEY)).toMap();
|
||||
d->m_data.clear(); // remove default values
|
||||
|
||||
@@ -80,9 +80,9 @@ public:
|
||||
Core::Id id() const;
|
||||
|
||||
QIcon icon() const;
|
||||
static QIcon icon(const QString &path);
|
||||
QString iconPath() const;
|
||||
void setIconPath(const QString &path);
|
||||
static QIcon icon(const Utils::FileName &path);
|
||||
Utils::FileName iconPath() const;
|
||||
void setIconPath(const Utils::FileName &path);
|
||||
|
||||
QVariant value(Core::Id key, const QVariant &unset = QVariant()) const;
|
||||
bool hasValue(Core::Id key) const;
|
||||
|
||||
@@ -244,7 +244,7 @@ void KitManager::restoreKits()
|
||||
defaultKit->setDisplayName(tr("Desktop"));
|
||||
defaultKit->setSdkProvided(false);
|
||||
defaultKit->setAutoDetected(false);
|
||||
defaultKit->setIconPath(QLatin1String(":///DESKTOP///"));
|
||||
defaultKit->setIconPath(Utils::FileName::fromString(QLatin1String(":///DESKTOP///")));
|
||||
|
||||
defaultKit->setup();
|
||||
|
||||
|
||||
@@ -242,11 +242,14 @@ void KitManagerConfigWidget::removeKit()
|
||||
|
||||
void KitManagerConfigWidget::setIcon()
|
||||
{
|
||||
const QString path = QFileDialog::getOpenFileName(this, tr("Select Icon"), m_modifiedKit->iconPath(), tr("Images (*.png *.xpm *.jpg)"));
|
||||
const Utils::FileName path = Utils::FileName::fromString(
|
||||
QFileDialog::getOpenFileName(this, tr("Select Icon"),
|
||||
m_modifiedKit->iconPath().toString(),
|
||||
tr("Images (*.png *.xpm *.jpg)")));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
const QIcon icon = QIcon(path);
|
||||
const QIcon icon = Kit::icon(path);
|
||||
if (icon.isNull())
|
||||
return;
|
||||
|
||||
|
||||
@@ -2396,35 +2396,35 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
|
||||
Kit *tmpKit = rawKit;
|
||||
|
||||
if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.AndroidDeviceTarget")) {
|
||||
tmpKit->setIconPath(QLatin1String(":/android/images/QtAndroid.png"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/android/images/QtAndroid.png")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Desktop"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
|
||||
} else if (oldTargetId == QLatin1String("RemoteLinux.EmbeddedLinuxTarget")) {
|
||||
tmpKit->setIconPath(QLatin1String(":///DESKTOP///"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":///DESKTOP///")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("GenericLinuxOsType"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
|
||||
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.HarmattanDeviceTarget")) {
|
||||
tmpKit->setIconPath(QLatin1String(":/projectexplorer/images/MaemoDevice.png"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("HarmattanOsType"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
|
||||
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.MaemoDeviceTarget")) {
|
||||
tmpKit->setIconPath(QLatin1String(":/projectexplorer/images/MaemoDevice.png"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Maemo5OsType"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
|
||||
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.MeegoDeviceTarget")) {
|
||||
tmpKit->setIconPath(QLatin1String(":/projectexplorer/images/MaemoDevice.png"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("MeegoOsType"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
|
||||
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget")) {
|
||||
tmpKit->setIconPath(QLatin1String(":/projectexplorer/images/SymbianDevice.png"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/SymbianDevice.png")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Qt4ProjectManager.SymbianDevice"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString::fromLatin1("Symbian Device"));
|
||||
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.QtSimulatorTarget")) {
|
||||
tmpKit->setIconPath(QLatin1String(":/projectexplorer/images/Simulator.png"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/Simulator.png")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Desktop"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString::fromLatin1("Desktop Device"));
|
||||
} else {
|
||||
tmpKit->setIconPath(QLatin1String(":///DESKTOP///"));
|
||||
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":///DESKTOP///")));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Desktop"));
|
||||
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString::fromLatin1("Desktop Device"));
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ ProjectExplorer::Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, Q
|
||||
|
||||
|
||||
kit->setAutoDetected(m_isAutoDetected);
|
||||
kit->setIconPath(QLatin1String(Constants::QNX_BB_CATEGORY_ICON));
|
||||
kit->setIconPath(Utils::FileName::fromString(QLatin1String(Constants::QNX_BB_CATEGORY_ICON)));
|
||||
setSticky(kit);
|
||||
ProjectExplorer::DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_BB_OS_TYPE);
|
||||
ProjectExplorer::SysRootKitInformation::setSysRoot(kit, m_sysRoot);
|
||||
|
||||
Reference in New Issue
Block a user