summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-04-30 15:49:40 +0200
committerKai Koehne <kai.koehne@theqtcompany.com>2015-04-30 15:49:54 +0200
commitbe481e3af7c302f70e1d83406de40203218deef2 (patch)
tree5a10568c2c1d0ee7a0070f928c5437db80c2266c /src
parenta1418fbffd4c786b5de8200e05a9ff26d8b90c3c (diff)
parentef48a0c26c0771c9bfa86130f00be8fa00330289 (diff)
Merge remote-tracking branch 'origin/2.0'
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/component.cpp10
-rw-r--r--src/libs/installer/componentchecker.cpp43
-rw-r--r--src/libs/installer/componentmodel.cpp2
-rw-r--r--src/libs/installer/downloadfiletask.cpp106
-rw-r--r--src/libs/installer/downloadfiletask_p.h28
-rw-r--r--src/libs/installer/globals.cpp25
-rw-r--r--src/libs/installer/globals.h7
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp3
-rw-r--r--src/libs/installer/protocol.cpp12
-rw-r--r--src/libs/installer/remoteobject.cpp10
-rw-r--r--src/sdk/commandlineparser.cpp12
-rw-r--r--src/sdk/constants.h1
-rw-r--r--src/sdk/installerbase.cpp29
13 files changed, 185 insertions, 103 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 048cfeda6..e2a9cf2e1 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -940,11 +940,6 @@ void Component::addOperation(Operation *operation)
*/
void Component::addElevatedOperation(Operation *operation)
{
- if (value(scRequiresAdminRights, scFalse) != scTrue) {
- qWarning() << QString::fromLatin1("Component %1 uses addElevatedOperation in the script, "
- "but it does not have the needed RequiresAdminRights tag"
- ).arg(name());
- }
addOperation(operation);
operation->setValue(QLatin1String("admin"), true);
}
@@ -1341,8 +1336,9 @@ void Component::setLocalTempPath(const QString &tempLocalPath)
void Component::updateModelData(const QString &key, const QString &data)
{
if (key == scVirtual) {
- if (data.toLower() == scTrue)
- setData(d->m_core->virtualComponentsFont(), Qt::FontRole);
+ setData(data.toLower() == scTrue
+ ? d->m_core->virtualComponentsFont()
+ : QFont(), Qt::FontRole);
if (Component *const parent = parentComponent()) {
parent->removeComponent(this);
parent->appendComponent(this);
diff --git a/src/libs/installer/componentchecker.cpp b/src/libs/installer/componentchecker.cpp
index c3bf79cb5..4e2260165 100644
--- a/src/libs/installer/componentchecker.cpp
+++ b/src/libs/installer/componentchecker.cpp
@@ -37,6 +37,7 @@
#include "component.h"
#include "constants.h"
#include "packagemanagercore.h"
+#include "globals.h"
namespace QInstaller {
@@ -59,6 +60,7 @@ QStringList ComponentChecker::checkComponent(Component *component)
const bool defaultPropertyScriptValue = component->variables().value(scDefault).compare(scScript, Qt::CaseInsensitive) == 0;
const bool defaultPropertyValue = component->variables().value(scDefault).compare(scTrue, Qt::CaseInsensitive) == 0;
const QStringList autoDependencies = component->autoDependencies();
+ const QList<Component *> allComponents = core->components(PackageManagerCore::ComponentType::All);
if (!autoDependencies.isEmpty()) {
if (component->forcedInstallation()) {
checkResult << QString::fromLatin1("Component %1 specifies \"ForcedInstallation\" property "
@@ -81,7 +83,6 @@ QStringList ComponentChecker::checkComponent(Component *component)
.arg(component->name());
}
const QStringList dependencies = component->dependencies();
- const QList<Component *> allComponents = core->components(PackageManagerCore::ComponentType::All);
foreach (const QString &dependency, dependencies) {
Component *dependencyComponent = PackageManagerCore::componentByName(
dependency, allComponents);
@@ -118,16 +119,25 @@ QStringList ComponentChecker::checkComponent(Component *component)
}
}
if (component->childCount()) {
- const QStringList autoDependencies = component->autoDependencies();
if (!autoDependencies.isEmpty()) {
+ /* Use case:
+
+ A (depends on C)
+ A.B
+ C
+
+ Let's say we installed everything.
+ Running maintenance tool and unselecting C will mark A for uninstallation too,
+ while A.B stays marked as installed.
+ After running maintenance tool again, it will check A automatically
+ (since its child is selected), this will also mark C for installation (dependecy).
+ Moreover, the "Next" button will be disabled.
+ */
checkResult << QString::fromLatin1("Component %1 auto depends on other components "
"while having child components. This will not work properly.")
.arg(component->name());
}
- // TODO: search also for components which autodepend on "component"
- // (something like core->autodependees(component))
-
if (!component->dependencies().isEmpty()) {
checkResult << QString::fromLatin1("Component %1 depends on other components "
"while having child components. This will not work properly.")
@@ -135,11 +145,34 @@ QStringList ComponentChecker::checkComponent(Component *component)
}
if (!core->dependees(component).isEmpty()) {
+ /*
+ Use case:
+
+ A
+ A.B
+ C (depends on A)
+
+ Selecting C marks A for installation too, A.B is not marked for installation.
+ So after installation, A and C are installed, while A.B is not.
+ Maintenance tool will uncheck A automatically
+ (since none of its children are installed) this will also mark C
+ for uninstallation (dependency).
+ Moreover, the "Next" button will be disabled.
+ */
checkResult << QString::fromLatin1("Other components depend on component %1 "
"which has child components. This will not work properly.")
.arg(component->name());
}
}
+ foreach (const QString &autoDependency, autoDependencies) {
+ Component *autoDependencyComponent = PackageManagerCore::componentByName(
+ autoDependency, allComponents);
+ if (autoDependencyComponent && autoDependencyComponent->childCount()) {
+ checkResult << QString::fromLatin1("Component %1 auto depends on component %2 "
+ "which has children components. This will not work properly.")
+ .arg(component->name(), autoDependencyComponent->name());
+ }
+ }
}
return checkResult;
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp
index 30213c9a6..0c249e8e6 100644
--- a/src/libs/installer/componentmodel.cpp
+++ b/src/libs/installer/componentmodel.cpp
@@ -577,7 +577,7 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone
// we can start in descending order to check node and tri-state nodes properly
for (int i = sortedNodes.count(); i > 0; i--) {
Component * const node = sortedNodes.at(i - 1);
- if (!node->isCheckable() || !node->isEnabled())
+ if (!node->isCheckable() || !node->isEnabled() || !node->autoDependencies().isEmpty())
continue;
Qt::CheckState newState = state;
diff --git a/src/libs/installer/downloadfiletask.cpp b/src/libs/installer/downloadfiletask.cpp
index d5ab2acda..f308315c9 100644
--- a/src/libs/installer/downloadfiletask.cpp
+++ b/src/libs/installer/downloadfiletask.cpp
@@ -1,3 +1,4 @@
+
/**************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
@@ -34,11 +35,9 @@
#include "downloadfiletask.h"
#include "downloadfiletask_p.h"
-#include "observer.h"
#include <QCoreApplication>
#include <QEventLoop>
-#include <QFile>
#include <QFileInfo>
#include <QNetworkProxyFactory>
#include <QSslError>
@@ -62,16 +61,10 @@ Downloader::Downloader()
Downloader::~Downloader()
{
m_nam.disconnect();
- foreach (QNetworkReply *const reply, m_downloads.keys()) {
- reply->disconnect();
- reply->abort();
- reply->deleteLater();
- }
-
- foreach (const Data &data, m_downloads.values()) {
- data.file->close();
- delete data.file;
- delete data.observer;
+ for (const auto &pair : m_downloads) {
+ pair.first->disconnect();
+ pair.first->abort();
+ pair.first->deleteLater();
}
}
@@ -119,7 +112,34 @@ void Downloader::onReadyRead()
if (!reply)
return;
- const Data &data = m_downloads[reply];
+ Data &data = *m_downloads[reply];
+ if (!data.file) {
+ std::unique_ptr<QFile> file = Q_NULLPTR;
+ const QString target = data.taskItem.target();
+ if (target.isEmpty()) {
+ std::unique_ptr<QTemporaryFile> tmp(new QTemporaryFile);
+ tmp->setAutoRemove(false);
+ file = std::move(tmp);
+ } else {
+ std::unique_ptr<QFile> tmp(new QFile(target));
+ file = std::move(tmp);
+ }
+
+ if (file->exists() && (!QFileInfo(file->fileName()).isFile())) {
+ m_futureInterface->reportException(TaskException(tr("Target file '%1' already exists "
+ "but is not a file.").arg(file->fileName())));
+ return;
+ }
+
+ if (!file->open(QIODevice::WriteOnly | QIODevice::Truncate)) {
+ //: %2 is a sentence describing the error
+ m_futureInterface->reportException(TaskException(tr("Could not open target '%1' for "
+ "write. Error: %2.").arg(file->fileName(), file->errorString())));
+ return;
+ }
+ data.file = std::move(file);
+ }
+
if (!data.file->isOpen()) {
//: %2 is a sentence describing the error.
m_futureInterface->reportException(
@@ -154,8 +174,8 @@ void Downloader::onReadyRead()
data.observer->addCheckSumData(buffer.data(), read);
int progress = m_finished * 100;
- foreach (const Data &data, m_downloads.values())
- progress += data.observer->progressValue();
+ for (const auto &pair : m_downloads)
+ progress += pair.second->observer->progressValue();
if (!reply->attribute(QNetworkRequest::RedirectionTargetAttribute).isValid()) {
m_futureInterface->setProgressValueAndText(progress / m_items.count(),
data.observer->progressText());
@@ -165,18 +185,16 @@ void Downloader::onReadyRead()
void Downloader::onFinished(QNetworkReply *reply)
{
- const Data &data = m_downloads[reply];
- const QString filename = data.file->fileName();
+ Data &data = *m_downloads[reply];
+ const QString filename = data.file ? data.file->fileName() : QString();
if (!m_futureInterface->isCanceled()) {
if (reply->attribute(QNetworkRequest::RedirectionTargetAttribute).isValid()) {
const QUrl url = reply->url()
.resolved(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl());
const QList<QUrl> redirects = m_redirects.values(reply);
if (!redirects.contains(url)) {
- data.file->close();
- data.file->remove();
- delete data.file;
- delete data.observer;
+ if (data.file)
+ data.file->remove();
FileTaskItem taskItem = data.taskItem;
taskItem.insert(TaskRole::SourceFile, url.toString());
@@ -186,7 +204,7 @@ void Downloader::onFinished(QNetworkReply *reply)
m_redirects.insertMulti(redirectReply, redirect);
m_redirects.insertMulti(redirectReply, url);
- m_downloads.remove(reply);
+ m_downloads.erase(reply);
m_redirects.remove(reply);
reply->deleteLater();
return;
@@ -214,16 +232,12 @@ void Downloader::onFinished(QNetworkReply *reply)
}
m_futureInterface->reportResult(FileTaskResult(filename, data.observer->checkSum(), data.taskItem));
- data.file->close();
- delete data.file;
- delete data.observer;
-
- m_downloads.remove(reply);
+ m_downloads.erase(reply);
m_redirects.remove(reply);
reply->deleteLater();
m_finished++;
- if (m_downloads.isEmpty() || m_futureInterface->isCanceled()) {
+ if (m_downloads.empty() || m_futureInterface->isCanceled()) {
m_futureInterface->reportFinished();
emit finished(); // emit finished, so the event loop can shutdown
}
@@ -239,7 +253,7 @@ void Downloader::onError(QNetworkReply::NetworkError error)
return; // already handled by onAuthenticationRequired
if (reply) {
- const Data &data = m_downloads[reply];
+ const Data &data = *m_downloads[reply];
//: %2 is a sentence describing the error
m_futureInterface->reportException(
TaskException(tr("Network error while downloading '%1': %2.").arg(
@@ -266,17 +280,17 @@ void Downloader::onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
Q_UNUSED(bytesReceived)
QNetworkReply *const reply = qobject_cast<QNetworkReply *>(sender());
if (reply) {
- const Data &data = m_downloads[reply];
+ const Data &data = *m_downloads[reply];
data.observer->setBytesToTransfer(bytesTotal);
}
}
void Downloader::onAuthenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator)
{
- if (!authenticator || !reply || !m_downloads.contains(reply))
+ if (!authenticator || !reply || m_downloads.find(reply) == m_downloads.cend())
return;
- FileTaskItem *item = &m_downloads[reply].taskItem;
+ FileTaskItem *item = &m_downloads[reply]->taskItem;
const QAuthenticator auth = item->value(TaskRole::Authenticator).value<QAuthenticator>();
if (auth.user().isEmpty()) {
AuthenticationRequiredException e(AuthenticationRequiredException::Type::Server,
@@ -327,33 +341,9 @@ QNetworkReply *Downloader::startDownload(const FileTaskItem &item)
return 0;
}
- QScopedPointer<QFile> file;
- const QString target = item.target();
- if (target.isEmpty()) {
- QTemporaryFile *tmp = new QTemporaryFile;
- tmp->setAutoRemove(false);
- file.reset(tmp);
- } else {
- file.reset(new QFile(target));
- }
-
- if (file->exists() && (!QFileInfo(file->fileName()).isFile())) {
- m_futureInterface->reportException(
- TaskException(tr("Target file '%1' already exists but is not a file.").arg(
- file->fileName())));
- return 0;
- }
-
- if (!file->open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- //: %2 is a sentence describing the error
- m_futureInterface->reportException(
- TaskException(tr("Could not open target '%1' for write. Error: %2.").arg(
- file->fileName(), file->errorString())));
- return 0;
- }
-
QNetworkReply *reply = m_nam.get(QNetworkRequest(source));
- m_downloads.insert(reply, Data(file.take(), new FileTaskObserver(QCryptographicHash::Sha1), item));
+ std::unique_ptr<Data> data(new Data(item));
+ m_downloads[reply] = std::move(data);
connect(reply, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
diff --git a/src/libs/installer/downloadfiletask_p.h b/src/libs/installer/downloadfiletask_p.h
index d91d335b3..a2f2969aa 100644
--- a/src/libs/installer/downloadfiletask_p.h
+++ b/src/libs/installer/downloadfiletask_p.h
@@ -36,30 +36,40 @@
#define DOWNLOADFILETASK_P_H
#include "downloadfiletask.h"
+#include <observer.h>
+#include <QFile>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
+#include <memory>
+#include <unordered_map>
+
QT_BEGIN_NAMESPACE
-class QFile;
class QSslError;
QT_END_NAMESPACE
namespace QInstaller {
-class FileTaskObserver;
-
struct Data
{
+ Q_DISABLE_COPY(Data)
+
Data()
- : file(0), observer(0) {}
- Data(QFile *f, FileTaskObserver *o, const FileTaskItem &fti)
- : file(f), observer(o), taskItem(fti)
+ : file(Q_NULLPTR)
+ , observer(Q_NULLPTR)
{}
- QFile *file;
- FileTaskObserver *observer;
+
+ Data(const FileTaskItem &fti)
+ : taskItem(fti)
+ , file(Q_NULLPTR)
+ , observer(new FileTaskObserver(QCryptographicHash::Sha1))
+ {}
+
FileTaskItem taskItem;
+ std::unique_ptr<QFile> file;
+ std::unique_ptr<FileTaskObserver> observer;
};
class Downloader : public QObject
@@ -98,8 +108,8 @@ private:
int m_finished;
QNetworkAccessManager m_nam;
QList<FileTaskItem> m_items;
- QHash<QNetworkReply*, Data> m_downloads;
QMultiHash<QNetworkReply*, QUrl> m_redirects;
+ std::unordered_map<QNetworkReply*, std::unique_ptr<Data>> m_downloads;
};
} // namespace QInstaller
diff --git a/src/libs/installer/globals.cpp b/src/libs/installer/globals.cpp
index 05e19304e..b91210640 100644
--- a/src/libs/installer/globals.cpp
+++ b/src/libs/installer/globals.cpp
@@ -33,8 +33,31 @@
**************************************************************************/
#include "globals.h"
+const char IFW_COMPONENT_CHECKER[] = "ifw.componentChecker";
+const char IFW_RESOURCES[] = "ifw.resources";
+const char IFW_TRANSLATIONS[] = "ifw.translations";
+
+namespace QInstaller
+{
+
+Q_LOGGING_CATEGORY(lcComponentChecker, IFW_COMPONENT_CHECKER)
+Q_LOGGING_CATEGORY(lcResources, IFW_RESOURCES)
+Q_LOGGING_CATEGORY(lcTranslations, IFW_TRANSLATIONS)
+
+QStringList loggingCategories()
+{
+ static QStringList categories = QStringList()
+ << QLatin1String(IFW_COMPONENT_CHECKER)
+ << QLatin1String(IFW_RESOURCES)
+ << QLatin1String(IFW_TRANSLATIONS);
+ return categories;
+}
+
Q_GLOBAL_STATIC_WITH_ARGS(QRegExp, staticCommaRegExp, (QLatin1String("\\b(,|, )\\b")));
-QRegExp QInstaller::commaRegExp()
+QRegExp commaRegExp()
{
return *staticCommaRegExp();
}
+
+} // namespace QInstaller
+
diff --git a/src/libs/installer/globals.h b/src/libs/installer/globals.h
index 4df5878b9..c27b9dda4 100644
--- a/src/libs/installer/globals.h
+++ b/src/libs/installer/globals.h
@@ -37,9 +37,16 @@
#include "installer_global.h"
#include <QRegExp>
+#include <QLoggingCategory>
namespace QInstaller {
+INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcComponentChecker)
+INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcResources)
+INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcTranslations)
+
+QStringList INSTALLER_EXPORT loggingCategories();
+
QRegExp INSTALLER_EXPORT commaRegExp();
} // QInstaller
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index be7b0317d..f7abc955b 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -53,6 +53,7 @@
#include "installercalculator.h"
#include "uninstallercalculator.h"
#include "componentchecker.h"
+#include "globals.h"
#include "kdselfrestarter.h"
#include "kdupdaterfiledownloaderfactory.h"
@@ -395,7 +396,7 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
foreach (QInstaller::Component *component, components) {
const QStringList warnings = ComponentChecker::checkComponent(component);
foreach (const QString &warning, warnings)
- qWarning() << warning;
+ qCWarning(lcComponentChecker) << warning;
}
} catch (const Error &error) {
clearAllComponentLists();
diff --git a/src/libs/installer/protocol.cpp b/src/libs/installer/protocol.cpp
index c252af07a..ba19c38ee 100644
--- a/src/libs/installer/protocol.cpp
+++ b/src/libs/installer/protocol.cpp
@@ -58,9 +58,15 @@ void sendPacket(QIODevice *device, const QByteArray &command, const QByteArray &
packet.append('\0');
packet.append(data);
- qint64 written = device->write(packet);
- Q_ASSERT(written == packet.size()); // we assume we can write it all at once
- Q_UNUSED(written);
+ forever {
+ const int bytesWritten = device->write(packet);
+ Q_ASSERT(bytesWritten >= 0);
+ if (bytesWritten == packet.size())
+ break;
+ packet.remove(0, bytesWritten);
+ }
+ // needed for big packages over TCP on Windows
+ device->waitForBytesWritten(-1);
}
/*!
diff --git a/src/libs/installer/remoteobject.cpp b/src/libs/installer/remoteobject.cpp
index add11fa68..990710609 100644
--- a/src/libs/installer/remoteobject.cpp
+++ b/src/libs/installer/remoteobject.cpp
@@ -77,15 +77,7 @@ bool RemoteObject::authorize()
m_socket = new LocalSocket;
m_socket->connectToServer(RemoteClient::instance().socketName());
- QElapsedTimer stopWatch;
- stopWatch.start();
- while ((m_socket->state() == QLocalSocket::ConnectingState)
- && (stopWatch.elapsed() < 30000)) {
- if ((stopWatch.elapsed() % 2500) == 0)
- QCoreApplication::processEvents();
- }
-
- if (m_socket->state() == QLocalSocket::ConnectedState) {
+ if (m_socket->waitForConnected()) {
bool authorized = callRemoteMethod<bool>(QString::fromLatin1(Protocol::Authorize),
RemoteClient::instance().authorizationKey());
if (authorized)
diff --git a/src/sdk/commandlineparser.cpp b/src/sdk/commandlineparser.cpp
index 23e9a5dfc..4a1f0080f 100644
--- a/src/sdk/commandlineparser.cpp
+++ b/src/sdk/commandlineparser.cpp
@@ -35,6 +35,7 @@
#include "commandlineparser.h"
#include "constants.h"
+#include "globals.h"
namespace CommandLineOptions {
const char KeyValue[] = "Key=Value";
@@ -76,6 +77,17 @@ CommandLineParser::CommandLineParser()
m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::ShowVirtualComponents),
QLatin1String("Show virtual components in installer and package manager.")));
+ m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::LoggingRules),
+ QLatin1String("Enables logging according to passed rules. "
+ "Comma separated logging rules have the following syntax: "
+ "loggingCategory=true/false. "
+ "Passing empty logging rules enables all logging categories. "
+ "The following rules enable a single category: "
+ "ifw.*=false,ifw.category=true "
+ "The following logging categories are available:\n")
+ + QInstaller::loggingCategories().join(QLatin1Char('\n')),
+ QLatin1String("rules")));
+
m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::CreateLocalRepository),
QLatin1String("Create a local repository inside the installation directory. This option "
"has no effect on online installers.")));
diff --git a/src/sdk/constants.h b/src/sdk/constants.h
index 089a3b6d4..db3f8af20 100644
--- a/src/sdk/constants.h
+++ b/src/sdk/constants.h
@@ -50,6 +50,7 @@ const char Updater[] = "updater";
const char ManagePackages[] = "manage-packages";
const char NoForceInstallation[] = "no-force-installations";
const char ShowVirtualComponents[] = "show-virtual-components";
+const char LoggingRules[] = "logging-rules";
const char CreateLocalRepository[] = "create-local-repository";
const char AddRepository[] = "addRepository";
const char AddTmpRepository[] = "addTempRepository";
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index d2fb82562..343a0a1ca 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -51,6 +51,7 @@
#include <productkeycheck.h>
#include <settings.h>
#include <utils.h>
+#include <globals.h>
#include <kdrunoncechecker.h>
#include <kdupdaterfiledownloaderfactory.h>
@@ -59,6 +60,7 @@
#include <QTemporaryFile>
#include <QTranslator>
#include <QUuid>
+#include <QLoggingCategory>
InstallerBase::InstallerBase(int &argc, char *argv[])
: SDKApp<QApplication>(argc, argv)
@@ -105,14 +107,23 @@ int InstallerBase::run()
QInstaller::BinaryContent::readBinaryContent(&binary, &oldOperations, &manager, &magicMarker,
cookie);
+ CommandLineParser parser;
+ parser.parse(arguments());
+
+ QString loggingRules(QLatin1String("ifw.* = false")); // disable all by default
if (QInstaller::isVerbose()) {
- qDebug() << "Language:" << QLocale().uiLanguages().value(0,
- QLatin1String("No UI language set")).toUtf8().constData();
- qDebug() << "Arguments: " << arguments().join(QLatin1String(", ")).toUtf8().constData();
+ loggingRules = QString(); // enable all in verbose mode
+ if (parser.isSet(QLatin1String(CommandLineOptions::LoggingRules))) {
+ loggingRules = parser.value(QLatin1String(CommandLineOptions::LoggingRules))
+ .split(QLatin1Char(','), QString::SkipEmptyParts)
+ .join(QLatin1Char('\n')); // take rules from command line
+ }
}
+ QLoggingCategory::setFilterRules(loggingRules);
- CommandLineParser parser;
- parser.parse(arguments());
+ qCDebug(QInstaller::lcTranslations) << "Language:" << QLocale().uiLanguages()
+ .value(0, QLatin1String("No UI language set")).toUtf8().constData();
+ qDebug() << "Arguments: " << arguments().join(QLatin1String(", ")).toUtf8().constData();
SDKApp::registerMetaResources(manager.collectionByName("QResources"));
if (parser.isSet(QLatin1String(CommandLineOptions::StartClient))) {
@@ -134,8 +145,8 @@ int InstallerBase::run()
ProductKeyCheck::instance()->addPackagesFromXml(QLatin1String(":/metadata/Updates.xml"));
BinaryFormatEngineHandler::instance()->registerResources(manager.collections());
}
- if (QInstaller::isVerbose())
- dumpResourceTree();
+
+ dumpResourceTree();
QString controlScript;
if (parser.isSet(QLatin1String(CommandLineOptions::Script))) {
@@ -284,13 +295,13 @@ int InstallerBase::run()
void InstallerBase::dumpResourceTree() const
{
- qDebug() << "Resource tree:";
+ qCDebug(QInstaller::lcResources) << "Resource tree:";
QDirIterator it(QLatin1String(":/"), QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden,
QDirIterator::Subdirectories);
while (it.hasNext()) {
if (it.next().startsWith(QLatin1String(":/qt-project.org")))
continue;
- qDebug() << " " << it.filePath().toUtf8().constData();
+ qCDebug(QInstaller::lcResources) << " " << it.filePath().toUtf8().constData();
}
}