forked from qt-creator/qt-creator
QtSupport: remove unused from/toMap/Store
Change-Id: I42ae0c20c73da20dde01a2f5815ec9c7806b033b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -78,9 +78,6 @@ const char MKSPEC_VALUE_NAMESPACE[] = "QT_NAMESPACE";
|
|||||||
class QtVersionData
|
class QtVersionData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Update version if you add data members!
|
|
||||||
static const int version = 3;
|
|
||||||
|
|
||||||
bool installed = true;
|
bool installed = true;
|
||||||
bool hasExamples = false;
|
bool hasExamples = false;
|
||||||
bool hasDemos = false;
|
bool hasDemos = false;
|
||||||
@@ -117,101 +114,6 @@ public:
|
|||||||
|
|
||||||
QHash<ProKey, ProString> versionInfo;
|
QHash<ProKey, ProString> versionInfo;
|
||||||
bool versionInfoUpToDate = false;
|
bool versionInfoUpToDate = false;
|
||||||
|
|
||||||
static QHash<ProKey, ProString> fromStore(const Store &map)
|
|
||||||
{
|
|
||||||
QHash<ProKey, ProString> result;
|
|
||||||
for (auto it = map.constBegin(); it != map.constEnd(); ++it)
|
|
||||||
result.insert(ProKey(it.key().toByteArray()), ProString(it.value().toString()));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Store toStore(const QHash<ProKey, ProString> &map)
|
|
||||||
{
|
|
||||||
Store result;
|
|
||||||
for (auto it = map.constBegin(); it != map.constEnd(); ++it)
|
|
||||||
result.insert(it.key().toString().toQString().toUtf8(), it.value().toQString());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Store toMap()
|
|
||||||
{
|
|
||||||
Store result;
|
|
||||||
result.insert("CacheDataVersion", version);
|
|
||||||
result.insert("Installed", installed);
|
|
||||||
result.insert("HasExamples", hasExamples);
|
|
||||||
result.insert("HasDemos", hasDemos);
|
|
||||||
result.insert("HasDocumentation", hasDocumentation);
|
|
||||||
result.insert("VersionInfoUpToDate", versionInfoUpToDate);
|
|
||||||
|
|
||||||
unexpandedDisplayName.toMap(result, "UnexpandedDisplayName");
|
|
||||||
|
|
||||||
result.insert("QtVersionString", qtVersionString);
|
|
||||||
result.insert("SourcePath", sourcePath.toSettings());
|
|
||||||
result.insert("Prefix", prefix.toSettings());
|
|
||||||
result.insert("BinPath", binPath.toSettings());
|
|
||||||
result.insert("LibExecPath", libExecPath.toSettings());
|
|
||||||
result.insert("ConfigurationPath", configurationPath.toSettings());
|
|
||||||
result.insert("DataPath", dataPath.toSettings());
|
|
||||||
result.insert("DemosPath", demosPath.toSettings());
|
|
||||||
result.insert("DocsPath", docsPath.toSettings());
|
|
||||||
result.insert("ExamplesPath", examplesPath.toSettings());
|
|
||||||
result.insert("HeaderPath", headerPath.toSettings());
|
|
||||||
result.insert("ImportsPath", importsPath.toSettings());
|
|
||||||
result.insert("LibraryPath", libraryPath.toSettings());
|
|
||||||
result.insert("PluginPath", pluginPath.toSettings());
|
|
||||||
result.insert("QmlPath", qmlPath.toSettings());
|
|
||||||
result.insert("TranslationsPath", translationsPath.toSettings());
|
|
||||||
result.insert("HostBinPath", hostBinPath.toSettings());
|
|
||||||
result.insert("HostLibexecPath", hostLibexecPath.toSettings());
|
|
||||||
result.insert("HostDataPath", hostDataPath.toSettings());
|
|
||||||
result.insert("HostPrefixPath", hostPrefixPath.toSettings());
|
|
||||||
if (qtAbis)
|
|
||||||
result.insert("QtAbis", Utils::transform(*qtAbis, &Abi::toString));
|
|
||||||
result.insert("VersionInfo", QVariant::fromValue(toStore(versionInfo)));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fromMap(Store map)
|
|
||||||
{
|
|
||||||
if (map.value("CacheDataVersion").toInt() < version)
|
|
||||||
return;
|
|
||||||
|
|
||||||
installed = map.value("Installed").toBool();
|
|
||||||
hasExamples = map.value("HasExamples").toBool();
|
|
||||||
hasDemos = map.value("HasDemos").toBool();
|
|
||||||
hasDocumentation = map.value("HasDocumentation").toBool();
|
|
||||||
versionInfoUpToDate = map.value("VersionInfoUpToDate", false).toBool();
|
|
||||||
unexpandedDisplayName.fromMap(map, "UnexpandedDisplayName");
|
|
||||||
qtVersionString = map.value("QtVersionString").toString();
|
|
||||||
sourcePath = FilePath::fromSettings(map.value("SourcePath"));
|
|
||||||
prefix = FilePath::fromSettings(map.value("Prefix"));
|
|
||||||
binPath = FilePath::fromSettings(map.value("BinPath"));
|
|
||||||
libExecPath = FilePath::fromSettings(map.value("LibExecPath"));
|
|
||||||
configurationPath = FilePath::fromSettings(map.value("ConfigurationPath"));
|
|
||||||
dataPath = FilePath::fromSettings(map.value("DataPath"));
|
|
||||||
demosPath = FilePath::fromSettings(map.value("DemosPath"));
|
|
||||||
docsPath = FilePath::fromSettings(map.value("DocsPath"));
|
|
||||||
examplesPath = FilePath::fromSettings(map.value("ExamplesPath"));
|
|
||||||
headerPath = FilePath::fromSettings(map.value("HeaderPath"));
|
|
||||||
importsPath = FilePath::fromSettings(map.value("ImportsPath"));
|
|
||||||
libraryPath = FilePath::fromSettings(map.value("LibraryPath"));
|
|
||||||
pluginPath = FilePath::fromSettings(map.value("PluginPath"));
|
|
||||||
qmlPath = FilePath::fromSettings(map.value("QmlPath"));
|
|
||||||
translationsPath = FilePath::fromSettings(map.value("TranslationsPath"));
|
|
||||||
hostBinPath = FilePath::fromSettings(map.value("HostBinPath"));
|
|
||||||
hostLibexecPath = FilePath::fromSettings(map.value("HostLibexecPath"));
|
|
||||||
hostDataPath = FilePath::fromSettings(map.value("HostDataPath"));
|
|
||||||
hostPrefixPath = FilePath::fromSettings(map.value("HostPrefixPath"));
|
|
||||||
auto it = map.find("QtAbis");
|
|
||||||
if (it != map.end()) {
|
|
||||||
const auto qtAbisList = it.value().toStringList();
|
|
||||||
if (!qtAbisList.isEmpty())
|
|
||||||
qtAbis = Utils::transform(qtAbisList, &Abi::fromString);
|
|
||||||
}
|
|
||||||
versionInfo = fromStore(map.value("VersionInfo").value<Store>());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user