summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/createlocalrepositoryoperation.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-11-13 13:22:01 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2014-11-13 17:22:54 +0100
commita2ded4f5d94c39c8788842fa852eeaffff36a045 (patch)
tree93e8080abbf2b6ea5ac26c90c947c867ae96f2bb /src/libs/installer/createlocalrepositoryoperation.cpp
parentfe97303ee7bf61db6e24880acb805a88c633d9ba (diff)
Be a bit smarter while reporting partly progress information.
Change-Id: I1eb85e54dc183fbaf6223a113762d38bc67fe8a3 Reviewed-by: Niels Weber <niels.weber@digia.com>
Diffstat (limited to 'src/libs/installer/createlocalrepositoryoperation.cpp')
-rw-r--r--src/libs/installer/createlocalrepositoryoperation.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libs/installer/createlocalrepositoryoperation.cpp b/src/libs/installer/createlocalrepositoryoperation.cpp
index f3db5f9eb..88afd811c 100644
--- a/src/libs/installer/createlocalrepositoryoperation.cpp
+++ b/src/libs/installer/createlocalrepositoryoperation.cpp
@@ -221,7 +221,7 @@ bool CreateLocalRepositoryOperation::performOperation()
throw QInstaller::Error(tr("Could not read: %1. Error: %2").arg(updatesXml.fileName(), error));
// build for each available package a name - version mapping
- QHash<QString, QString> versionMap;
+ QHash<QString, QString> nameVersionHash;
const QDomElement root = doc.documentElement();
const QDomNodeList rootChildNodes = root.childNodes();
for (int i = 0; i < rootChildNodes.count(); ++i) {
@@ -240,7 +240,7 @@ bool CreateLocalRepositoryOperation::performOperation()
version = e.text();
}
if (ProductKeyCheck::instance()->isValidPackage(name))
- versionMap.insert(name, version);
+ nameVersionHash.insert(name, version);
}
}
@@ -256,19 +256,22 @@ bool CreateLocalRepositoryOperation::performOperation()
ResourceCollectionManager manager;
BinaryContent::readBinaryContent(&file, 0, &manager, 0, BinaryContent::MagicCookie);
- emit progressChanged(0.75);
+ emit progressChanged(0.65);
QDir repo(repoPath);
- if (!versionMap.isEmpty()) {
+ if (!nameVersionHash.isEmpty()) {
// extract meta and binary data
- foreach (const QString &name, versionMap.keys()) {
+
+ const QStringList names = nameVersionHash.keys();
+ for (int i = 0; i < names.count(); ++i) {
+ const QString name = names.at(i);
if (!repo.mkpath(name)) {
throw QInstaller::Error(tr("Could not create target dir: %1.")
.arg(repo.filePath(name)));
}
// zip the meta files that come with the offline installer
helper.m_files.prepend(Static::createArchive(repoPath,
- repo.filePath(name), versionMap.value(name), &helper));
+ repo.filePath(name), nameVersionHash.value(name), &helper));
emit outputTextChanged(helper.m_files.first());
// copy the 7z files that are inside the component index into the target
@@ -288,9 +291,12 @@ bool CreateLocalRepositoryOperation::performOperation()
if (!isOpen) // If we reach that point, either the resource was opened already.
resource->close(); // or we did open it and have to close it again.
}
+ emit progressChanged(.65f + ((double(i) / double(name.count())) * .25f));
}
}
+ emit progressChanged(0.95);
+
try {
// remove these, if we fail it doesn't hurt
Static::removeDirectory(QDir::cleanPath(repoPath + QLatin1String("/installer-config")),