forked from qt-creator/qt-creator
SdkTool: Use Qt Creator doctypes
Simplify filename conversion while at it Change-Id: I0a7473aa42626a04214887f1cc82abe536233a78 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
49986d90fc
commit
382b1d43eb
@@ -139,7 +139,7 @@ bool AddDebuggerOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int AddDebuggerOperation::execute() const
|
int AddDebuggerOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("debuggers"));
|
QVariantMap map = load(QLatin1String("Debuggers"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = initializeDebuggers();
|
map = initializeDebuggers();
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ int AddDebuggerOperation::execute() const
|
|||||||
if (result.isEmpty() || map == result)
|
if (result.isEmpty() || map == result)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("debuggers")) ? 0 : 3;
|
return save(result, QLatin1String("Debuggers")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ bool AddDeviceOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int AddDeviceOperation::execute() const
|
int AddDeviceOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("devices"));
|
QVariantMap map = load(QLatin1String("Devices"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = initializeDevices();
|
map = initializeDevices();
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ int AddDeviceOperation::execute() const
|
|||||||
if (result.isEmpty() || map == result)
|
if (result.isEmpty() || map == result)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("devices")) ? 0 : 3;
|
return save(result, QLatin1String("Devices")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
@@ -373,7 +373,7 @@ QVariantMap AddDeviceOperation::initializeDevices()
|
|||||||
|
|
||||||
bool AddDeviceOperation::exists(const QString &id)
|
bool AddDeviceOperation::exists(const QString &id)
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("device"));
|
QVariantMap map = load(QLatin1String("Devices"));
|
||||||
return exists(map, id);
|
return exists(map, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ bool AddKitOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int AddKitOperation::execute() const
|
int AddKitOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("profiles"));
|
QVariantMap map = load(QLatin1String("Profiles"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = initializeKits();
|
map = initializeKits();
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ int AddKitOperation::execute() const
|
|||||||
if (result.isEmpty() || map == result)
|
if (result.isEmpty() || map == result)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("profiles")) ? 0 : 3;
|
return save(result, QLatin1String("Profiles")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
@@ -510,9 +510,9 @@ QVariantMap AddKitOperation::addKit(const QVariantMap &map,
|
|||||||
const QString &sysRoot, const QString &tc, const QString &qt,
|
const QString &sysRoot, const QString &tc, const QString &qt,
|
||||||
const QString &mkspec, const KeyValuePairList &extra)
|
const QString &mkspec, const KeyValuePairList &extra)
|
||||||
{
|
{
|
||||||
QVariantMap tcMap = load(QLatin1String("toolchains"));
|
QVariantMap tcMap = load(QLatin1String("ToolChains"));
|
||||||
QVariantMap qtMap = load(QLatin1String("qtversions"));
|
QVariantMap qtMap = load(QLatin1String("QtVersions"));
|
||||||
QVariantMap devMap = load(QLatin1String("devices"));
|
QVariantMap devMap = load(QLatin1String("Devices"));
|
||||||
|
|
||||||
return addKit(map, tcMap, qtMap, devMap, id, displayName, icon, debuggerId, debuggerType,
|
return addKit(map, tcMap, qtMap, devMap, id, displayName, icon, debuggerId, debuggerType,
|
||||||
debugger, deviceType, device, sysRoot, tc, qt, mkspec, extra);
|
debugger, deviceType, device, sysRoot, tc, qt, mkspec, extra);
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ bool AddQtOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int AddQtOperation::execute() const
|
int AddQtOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("qtversions"));
|
QVariantMap map = load(QLatin1String("QtVersions"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = initializeQtVersions();
|
map = initializeQtVersions();
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ int AddQtOperation::execute() const
|
|||||||
if (result.isEmpty() || result == map)
|
if (result.isEmpty() || result == map)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("qtversions")) ? 0 : 3;
|
return save(result, QLatin1String("QtVersions")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
@@ -315,7 +315,7 @@ QVariantMap AddQtOperation::initializeQtVersions()
|
|||||||
|
|
||||||
bool AddQtOperation::exists(const QString &id)
|
bool AddQtOperation::exists(const QString &id)
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("qtversion"));
|
QVariantMap map = load(QLatin1String("QtVersions"));
|
||||||
return exists(map, id);
|
return exists(map, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ bool AddToolChainOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int AddToolChainOperation::execute() const
|
int AddToolChainOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("toolchains"));
|
QVariantMap map = load(QLatin1String("ToolChains"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = initializeToolChains();
|
map = initializeToolChains();
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ int AddToolChainOperation::execute() const
|
|||||||
if (result.isEmpty() || map == result)
|
if (result.isEmpty() || map == result)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("toolchains")) ? 0 : 3;
|
return save(result, QLatin1String("ToolChains")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
@@ -291,6 +291,6 @@ bool AddToolChainOperation::exists(const QVariantMap &map, const QString &id)
|
|||||||
|
|
||||||
bool AddToolChainOperation::exists(const QString &id)
|
bool AddToolChainOperation::exists(const QString &id)
|
||||||
{
|
{
|
||||||
QVariantMap map = Operation::load(QLatin1String("toolchains"));
|
QVariantMap map = Operation::load(QLatin1String("ToolChains"));
|
||||||
return exists(map, id);
|
return exists(map, id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ bool Operation::save(const QVariantMap &map, const QString &file) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils::PersistentSettingsWriter writer(path, QLatin1String("QtCreator")
|
||||||
Utils::PersistentSettingsWriter writer(path, QLatin1String("unknown"));
|
+ file[0].toUpper() + file.mid(1));
|
||||||
return writer.save(map, 0)
|
return writer.save(map, 0)
|
||||||
&& QFile::setPermissions(path.toString(),
|
&& QFile::setPermissions(path.toString(),
|
||||||
QFile::ReadOwner | QFile::WriteOwner
|
QFile::ReadOwner | QFile::WriteOwner
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ bool RmDebuggerOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int RmDebuggerOperation::execute() const
|
int RmDebuggerOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("debuggers"));
|
QVariantMap map = load(QLatin1String("Debuggers"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = AddDebuggerOperation::initializeDebuggers();
|
map = AddDebuggerOperation::initializeDebuggers();
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ int RmDebuggerOperation::execute() const
|
|||||||
if (result == map)
|
if (result == map)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("debuggers")) ? 0 : 3;
|
return save(result, QLatin1String("Debuggers")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ bool RmDeviceOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int RmDeviceOperation::execute() const
|
int RmDeviceOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("devices"));
|
QVariantMap map = load(QLatin1String("Devices"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = AddDeviceOperation::initializeDevices();
|
map = AddDeviceOperation::initializeDevices();
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ int RmDeviceOperation::execute() const
|
|||||||
if (result == map)
|
if (result == map)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("devices")) ? 0 : 3;
|
return save(result, QLatin1String("Devices")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ bool RmKitOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int RmKitOperation::execute() const
|
int RmKitOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("profiles"));
|
QVariantMap map = load(QLatin1String("Profiles"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
map = AddKitOperation::initializeKits();
|
map = AddKitOperation::initializeKits();
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ int RmKitOperation::execute() const
|
|||||||
if (result == map)
|
if (result == map)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("profiles")) ? 0 : 3;
|
return save(result, QLatin1String("Profiles")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ bool RmQtOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int RmQtOperation::execute() const
|
int RmQtOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("qtversion"));
|
QVariantMap map = load(QLatin1String("QtVersions"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ int RmQtOperation::execute() const
|
|||||||
if (result == map)
|
if (result == map)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("qtversion")) ? 0 : 3;
|
return save(result, QLatin1String("QtVersions")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ bool RmToolChainOperation::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
int RmToolChainOperation::execute() const
|
int RmToolChainOperation::execute() const
|
||||||
{
|
{
|
||||||
QVariantMap map = load(QLatin1String("toolchains"));
|
QVariantMap map = load(QLatin1String("ToolChains"));
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ int RmToolChainOperation::execute() const
|
|||||||
if (result == map)
|
if (result == map)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return save(result, QLatin1String("toolchains")) ? 0 : 3;
|
return save(result, QLatin1String("ToolChains")) ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
|||||||
@@ -61,18 +61,20 @@ Settings::Settings() :
|
|||||||
Utils::FileName Settings::getPath(const QString &file)
|
Utils::FileName Settings::getPath(const QString &file)
|
||||||
{
|
{
|
||||||
Utils::FileName result = sdkPath;
|
Utils::FileName result = sdkPath;
|
||||||
if (file == QLatin1String("profiles") || file == QLatin1String("kits"))
|
const QString lowerFile = file.toLower();
|
||||||
|
const QStringList identical = QStringList()
|
||||||
|
<< QLatin1String("profiles")
|
||||||
|
<< QLatin1String("qtversion")
|
||||||
|
<< QLatin1String("toolchains")
|
||||||
|
<< QLatin1String("devices")
|
||||||
|
<< QLatin1String("android")
|
||||||
|
<< QLatin1String("debuggers");
|
||||||
|
if (lowerFile == QLatin1String("kits"))
|
||||||
result.appendPath(QLatin1String("profiles"));
|
result.appendPath(QLatin1String("profiles"));
|
||||||
else if (file == QLatin1String("qtversions") || file == QLatin1String("qtversion"))
|
else if (lowerFile == QLatin1String("qtversions"))
|
||||||
result.appendPath(QLatin1String("qtversion"));
|
result.appendPath(QLatin1String("qtversion"));
|
||||||
else if (file == QLatin1String("toolchains") || file == QLatin1String("toolChains"))
|
else if (identical.contains(lowerFile))
|
||||||
result.appendPath(QLatin1String("toolchains"));
|
result.appendPath(lowerFile);
|
||||||
else if (file == QLatin1String("devices"))
|
|
||||||
result.appendPath(QLatin1String("devices"));
|
|
||||||
else if (file == QLatin1String("android"))
|
|
||||||
result.appendPath(QLatin1String("android"));
|
|
||||||
else if (file == QLatin1String("debuggers"))
|
|
||||||
result.appendPath(QLatin1String("debuggers"));
|
|
||||||
else
|
else
|
||||||
return Utils::FileName();
|
return Utils::FileName();
|
||||||
result.appendString(QLatin1String(".xml"));
|
result.appendString(QLatin1String(".xml"));
|
||||||
|
|||||||
Reference in New Issue
Block a user