forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.12'
Conflicts: src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp Change-Id: I2a0ccb84560174c5170d5baaff526c0e095f0ba0
This commit is contained in:
@@ -94,6 +94,10 @@ const char VersionsKey[] = "versions";
|
||||
const char NdkPathKey[] = "ndk_path";
|
||||
const char SpecificQtVersionsKey[] = "specific_qt_versions";
|
||||
const char DefaultVersionKey[] = "default";
|
||||
const char LinuxOsKey[] = "linux";
|
||||
const char WindowsOsKey[] = "windows";
|
||||
const char macOsKey[] = "mac";
|
||||
|
||||
|
||||
namespace {
|
||||
const char jdkSettingsPath[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit";
|
||||
@@ -282,13 +286,27 @@ void AndroidConfig::save(QSettings &settings) const
|
||||
|
||||
void AndroidConfig::parseDependenciesJson()
|
||||
{
|
||||
QString sdkConfigUserFile(Core::ICore::userResourcePath() + JsonFilePath);
|
||||
QString sdkConfigFile(Core::ICore::resourcePath() + JsonFilePath);
|
||||
QFile jsonFile(sdkConfigFile);
|
||||
if (!jsonFile.open(QIODevice::ReadOnly))
|
||||
qCDebug(avdConfigLog, "Couldn't open JSON config file %s.", qPrintable(sdkConfigFile));
|
||||
|
||||
QJsonDocument loadDoc(QJsonDocument::fromJson(jsonFile.readAll()));
|
||||
QJsonObject jsonObject = loadDoc.object();
|
||||
if (!QFile::exists(sdkConfigUserFile)) {
|
||||
QDir(QFileInfo(sdkConfigUserFile).absolutePath()).mkpath(".");
|
||||
QFile::copy(sdkConfigFile, sdkConfigUserFile);
|
||||
}
|
||||
|
||||
if (QFileInfo(sdkConfigFile).lastModified() > QFileInfo(sdkConfigUserFile).lastModified()) {
|
||||
QFile::remove(sdkConfigUserFile + ".old");
|
||||
QFile::rename(sdkConfigUserFile, sdkConfigUserFile + ".old");
|
||||
QFile::copy(sdkConfigFile, sdkConfigUserFile);
|
||||
}
|
||||
|
||||
QFile jsonFile(sdkConfigUserFile);
|
||||
if (!jsonFile.open(QIODevice::ReadOnly)) {
|
||||
qCDebug(avdConfigLog, "Couldn't open JSON config file %s.", qPrintable(jsonFile.fileName()));
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject jsonObject = QJsonDocument::fromJson(jsonFile.readAll()).object();
|
||||
|
||||
if (jsonObject.contains(CommonKey) && jsonObject[CommonKey].isObject()) {
|
||||
QJsonObject commonObject = jsonObject[CommonKey].toObject();
|
||||
@@ -296,21 +314,32 @@ void AndroidConfig::parseDependenciesJson()
|
||||
if (commonObject.contains(SdkToolsUrlKey) && commonObject[SdkToolsUrlKey].isObject()) {
|
||||
QJsonObject sdkToolsObj(commonObject[SdkToolsUrlKey].toObject());
|
||||
if (Utils::HostOsInfo::isMacHost()) {
|
||||
m_sdkToolsUrl = sdkToolsObj["mac"].toString();
|
||||
m_sdkToolsUrl = sdkToolsObj[macOsKey].toString();
|
||||
m_sdkToolsSha256 = QByteArray::fromHex(sdkToolsObj["mac_sha256"].toString().toUtf8());
|
||||
} else if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
m_sdkToolsUrl = sdkToolsObj["windows"].toString();
|
||||
m_sdkToolsUrl = sdkToolsObj[WindowsOsKey].toString();
|
||||
m_sdkToolsSha256 = QByteArray::fromHex(sdkToolsObj["windows_sha256"].toString().toUtf8());
|
||||
} else {
|
||||
m_sdkToolsUrl = sdkToolsObj["linux"].toString();
|
||||
m_sdkToolsUrl = sdkToolsObj[LinuxOsKey].toString();
|
||||
m_sdkToolsSha256 = QByteArray::fromHex(sdkToolsObj["linux_sha256"].toString().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
// Parse common essential packages
|
||||
QJsonArray commonEssentials = commonObject[SdkEssentialPkgsKey].toArray();
|
||||
for (const QJsonValueRef &pkg : commonEssentials)
|
||||
m_commonEssentialPkgs.append(pkg.toString());
|
||||
auto appendEssentialsFromArray = [this](QJsonArray array) {
|
||||
for (const QJsonValueRef &pkg : array)
|
||||
m_commonEssentialPkgs.append(pkg.toString());
|
||||
};
|
||||
|
||||
QJsonObject commonEssentials = commonObject[SdkEssentialPkgsKey].toObject();
|
||||
appendEssentialsFromArray(commonEssentials[DefaultVersionKey].toArray());
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
appendEssentialsFromArray(commonEssentials[WindowsOsKey].toArray());
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
appendEssentialsFromArray(commonEssentials[macOsKey].toArray());
|
||||
else
|
||||
appendEssentialsFromArray(commonEssentials[LinuxOsKey].toArray());
|
||||
}
|
||||
|
||||
auto fillQtVersionsRange = [](const QString &shortVersion) {
|
||||
@@ -975,11 +1004,6 @@ QStringList AndroidConfig::defaultEssentials() const
|
||||
return m_defaultSdkDepends.essentialPackages + m_commonEssentialPkgs;
|
||||
}
|
||||
|
||||
void AndroidConfig::updateDependenciesConfig()
|
||||
{
|
||||
parseDependenciesJson();
|
||||
}
|
||||
|
||||
bool SdkForQtVersions::containsVersion(const QtVersionNumber &qtVersion) const
|
||||
{
|
||||
return versions.contains(qtVersion)
|
||||
|
Reference in New Issue
Block a user