summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-07-03 09:49:41 +0300
committerKatja Marttila <katja.marttila@qt.io>2020-08-24 13:44:24 +0300
commit40c43e4c312c9f1cc4e2e44ac31b4482ccbbc6c0 (patch)
tree060519ebd49fcfaac5129bc395e5c849d318b46f /src/libs
parentf2ab63396c1f101216b2c6ade37528492e464785 (diff)
Add verbose levels and cleanup log categories
Setting several verbose switches enables more logging and performs component checking. Also cleanup some logging categories and unify the rules. Task-number: QTIFW-1914 Change-Id: I9195f4bb02affaa87e66cf9023a3512e65e0645b Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/commandlineparser.cpp4
-rw-r--r--src/libs/installer/commandlineparser.h1
-rw-r--r--src/libs/installer/component.cpp7
-rw-r--r--src/libs/installer/consumeoutputoperation.cpp2
-rw-r--r--src/libs/installer/createshortcutoperation.cpp2
-rw-r--r--src/libs/installer/elevatedexecuteoperation.cpp12
-rw-r--r--src/libs/installer/environmentvariablesoperation.cpp2
-rw-r--r--src/libs/installer/extractarchiveoperation.cpp2
-rw-r--r--src/libs/installer/globals.cpp23
-rw-r--r--src/libs/installer/globals.h9
-rw-r--r--src/libs/installer/installiconsoperation.cpp4
-rw-r--r--src/libs/installer/metadatajob.cpp2
-rw-r--r--src/libs/installer/packagemanagercore.cpp40
-rw-r--r--src/libs/installer/packagemanagercore.h2
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp16
-rw-r--r--src/libs/installer/packagemanagergui.cpp22
-rw-r--r--src/libs/installer/progresscoordinator.cpp16
-rw-r--r--src/libs/installer/settingsoperation.cpp4
-rw-r--r--src/libs/installer/utils.cpp14
-rw-r--r--src/libs/installer/utils.h1
-rw-r--r--src/libs/kdtools/filedownloader.cpp4
-rw-r--r--src/libs/kdtools/job.cpp2
-rw-r--r--src/libs/kdtools/runoncechecker.cpp4
-rw-r--r--src/libs/kdtools/task.cpp14
-rw-r--r--src/libs/kdtools/updatefinder.cpp4
25 files changed, 107 insertions, 106 deletions
diff --git a/src/libs/installer/commandlineparser.cpp b/src/libs/installer/commandlineparser.cpp
index 08aa1b3a9..1a63aa295 100644
--- a/src/libs/installer/commandlineparser.cpp
+++ b/src/libs/installer/commandlineparser.cpp
@@ -72,7 +72,9 @@ CommandLineParser::CommandLineParser()
// Output related options
m_parser.addOption(QCommandLineOption(QStringList()
<< CommandLineOptions::scVerboseShort << CommandLineOptions::scVerboseLong,
- QLatin1String("Verbose mode. Prints out more information.")));
+ QString::fromLatin1("Verbose mode. Prints out more information. Adding -%1 or --%2 more "
+ "than once increases verbosity.").arg(CommandLineOptions::scVerboseShort,
+ CommandLineOptions::scVerboseLong)));
m_parser.addOption(QCommandLineOption(QStringList()
<< CommandLineOptions::scLoggingRulesShort << CommandLineOptions::scLoggingRulesLong,
QLatin1String("Enables logging according to passed rules. Comma separated logging rules "
diff --git a/src/libs/installer/commandlineparser.h b/src/libs/installer/commandlineparser.h
index b21091757..d1ad31eb5 100644
--- a/src/libs/installer/commandlineparser.h
+++ b/src/libs/installer/commandlineparser.h
@@ -45,6 +45,7 @@ public:
QStringList positionalArguments() const { return m_parser.positionalArguments(); }
bool parse(const QStringList &argumens) { return m_parser.parse(argumens); }
QString value(const QString &option) const { return m_parser.value(option); }
+ QStringList optionNames() const { return m_parser.optionNames(); }
private:
QCommandLineParser m_parser;
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 389580e7c..234d57622 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -562,7 +562,7 @@ void Component::loadComponentScript(const QString &fileName)
} catch (const Error &error) {
if (packageManagerCore()->settings().allowUnstableComponents()) {
setUnstable(Component::UnstableError::ScriptLoadingFailed, error.message());
- qCWarning(QInstaller::lcInstallerInstallLog) << error.message();
+ qCWarning(QInstaller::lcDeveloperBuild) << error.message();
} else {
throw error;
}
@@ -879,8 +879,7 @@ QStringList Component::archives() const
void Component::addDownloadableArchive(const QString &path)
{
Q_ASSERT(isFromOnlineRepository());
-
- qCDebug(QInstaller::lcGeneral) << "addDownloadable" << path;
+ qCDebug(QInstaller::lcDeveloperBuild) << "addDownloadable" << path;
d->m_downloadableArchives.append(d->m_vars.value(scVersion) + path);
}
@@ -1341,7 +1340,7 @@ bool Component::isDefault() const
}
if (!valueFromScript.isError())
return valueFromScript.toBool();
- qCWarning(QInstaller::lcInstallerInstallLog) << "Value from script is not valid."
+ qCWarning(QInstaller::lcDeveloperBuild) << "Value from script is not valid."
<< (valueFromScript.toString().isEmpty()
? QString::fromLatin1("Unknown error.") : valueFromScript.toString());
return false;
diff --git a/src/libs/installer/consumeoutputoperation.cpp b/src/libs/installer/consumeoutputoperation.cpp
index eeeb4d2f7..21f85470e 100644
--- a/src/libs/installer/consumeoutputoperation.cpp
+++ b/src/libs/installer/consumeoutputoperation.cpp
@@ -118,7 +118,7 @@ bool ConsumeOutputOperation::performOperation()
uiDetachedWait(waitTimeInMilliSeconds);
}
if (process.state() > QProcess::NotRunning ) {
- qCWarning(QInstaller::lcGeneral) << executable.absoluteFilePath()
+ qCWarning(QInstaller::lcInstallerInstallLog) << executable.absoluteFilePath()
<< "process is still running, need to kill it.";
process.kill();
}
diff --git a/src/libs/installer/createshortcutoperation.cpp b/src/libs/installer/createshortcutoperation.cpp
index 509a3ef4e..c4680d3e2 100644
--- a/src/libs/installer/createshortcutoperation.cpp
+++ b/src/libs/installer/createshortcutoperation.cpp
@@ -277,7 +277,7 @@ bool CreateShortcutOperation::undoOperation()
const QString &linkLocation = arguments().at(1);
if (!deleteFileNowOrLater(linkLocation) )
- qCWarning(QInstaller::lcInstallerUninstallLog) << "Cannot delete:" << linkLocation;
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Cannot delete:" << linkLocation;
QDir dir; // remove all directories we created
const QStringList directoriesToDelete = value(QLatin1String("createddirs")).toStringList();
diff --git a/src/libs/installer/elevatedexecuteoperation.cpp b/src/libs/installer/elevatedexecuteoperation.cpp
index 05149fb26..6a4fd99d9 100644
--- a/src/libs/installer/elevatedexecuteoperation.cpp
+++ b/src/libs/installer/elevatedexecuteoperation.cpp
@@ -147,7 +147,7 @@ bool ElevatedExecuteOperation::Private::run(const QStringList &arguments)
process = new QProcessWrapper();
if (!workingDirectory.isEmpty()) {
process->setWorkingDirectory(workingDirectory);
- qCDebug(QInstaller::lcGeneral) << "ElevatedExecuteOperation setWorkingDirectory:"
+ qCDebug(QInstaller::lcInstallerInstallLog) << "ElevatedExecuteOperation setWorkingDirectory:"
<< workingDirectory;
}
@@ -169,7 +169,7 @@ bool ElevatedExecuteOperation::Private::run(const QStringList &arguments)
//readProcessOutput should only called from this current Thread -> Qt::DirectConnection
QObject::connect(process, SIGNAL(readyRead()), q, SLOT(readProcessOutput()), Qt::DirectConnection);
process->start(args.front(), args.mid(1));
- qCDebug(QInstaller::lcGeneral) << args.front() << "started, arguments:"
+ qCDebug(QInstaller::lcInstallerInstallLog) << args.front() << "started, arguments:"
<< QStringList(args.mid(1)).join(QLatin1String(" "));
bool success = false;
@@ -216,7 +216,7 @@ bool ElevatedExecuteOperation::Private::run(const QStringList &arguments)
QByteArray standardErrorOutput = process->readAllStandardError();
// in error case it would be useful to see something in verbose output
if (!standardErrorOutput.isEmpty())
- qCWarning(QInstaller::lcGeneral).noquote() << standardErrorOutput;
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote() << standardErrorOutput;
returnValue = false;
}
@@ -243,15 +243,15 @@ void ElevatedExecuteOperation::Private::readProcessOutput()
Q_ASSERT(process);
Q_ASSERT(QThread::currentThread() == process->thread());
if (QThread::currentThread() != process->thread()) {
- qCDebug(QInstaller::lcGeneral) << Q_FUNC_INFO << "can only be called from the "
+ qCDebug(QInstaller::lcInstallerInstallLog) << Q_FUNC_INFO << "can only be called from the "
"same thread as the process is.";
}
const QByteArray output = process->readAll();
if (!output.isEmpty()) {
if (q->error() == UserDefinedError)
- qCWarning(QInstaller::lcGeneral)<< output;
+ qCWarning(QInstaller::lcInstallerInstallLog)<< output;
else
- qCDebug(QInstaller::lcGeneral) << output;
+ qCDebug(QInstaller::lcInstallerInstallLog) << output;
emit q->outputTextChanged(QString::fromLocal8Bit(output));
}
}
diff --git a/src/libs/installer/environmentvariablesoperation.cpp b/src/libs/installer/environmentvariablesoperation.cpp
index 95ea54800..df45b83f9 100644
--- a/src/libs/installer/environmentvariablesoperation.cpp
+++ b/src/libs/installer/environmentvariablesoperation.cpp
@@ -60,7 +60,7 @@ static void broadcastEnvironmentChange()
LRESULT sendresult = SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
0, (LPARAM) L"Environment", SMTO_BLOCK | SMTO_ABORTIFHUNG, 5000, &aResult);
if (sendresult == 0 || aResult != 0)
- qCWarning(QInstaller::lcGeneral) << "Failed to broadcast the WM_SETTINGCHANGE message.";
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Failed to broadcast the WM_SETTINGCHANGE message.";
}
#endif
diff --git a/src/libs/installer/extractarchiveoperation.cpp b/src/libs/installer/extractarchiveoperation.cpp
index 9ae35cb77..e3b9d5e36 100644
--- a/src/libs/installer/extractarchiveoperation.cpp
+++ b/src/libs/installer/extractarchiveoperation.cpp
@@ -216,7 +216,7 @@ bool ExtractArchiveOperation::readDataFileContents(QString &targetDir, QStringLi
} else {
// We should not be here. Either user has manually deleted the installer related
// files or same component is installed several times.
- qCWarning(QInstaller::lcGeneral) << "Cannot open file " << file.fileName() << " for reading:"
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Cannot open file " << file.fileName() << " for reading:"
<< file.errorString() << ". Component is already uninstalled "
<< "or file is manually deleted.";
}
diff --git a/src/libs/installer/globals.cpp b/src/libs/installer/globals.cpp
index a3134dfae..8634e3611 100644
--- a/src/libs/installer/globals.cpp
+++ b/src/libs/installer/globals.cpp
@@ -30,13 +30,7 @@
#include "globals.h"
-const char IFW_COMPONENT_CHECKER[] = "ifw.componentChecker";
-const char IFW_RESOURCES[] = "ifw.resources";
-const char IFW_TRANSLATIONS[] = "ifw.translations";
-const char IFW_NETWORK[] = "ifw.network";
const char IFW_SERVER[] = "ifw.server";
-const char IFW_GENERAL[] = "ifw.general";
-const char IFW_INSTALLER_UNINSTALLLOG[] = "ifw.installer.uninstalllog";
const char IFW_PACKAGE_DISPLAYNAME[] = "ifw.package.displayname";
const char IFW_PACKAGE_DESCRIPTION[] = "ifw.package.description";
@@ -62,6 +56,7 @@ const char IFW_PACKAGE_LICENSES[] = "ifw.package.licenses";
const char IFW_PACKAGE_COMPRESSEDSIZE[] = "ifw.package.compressedsize";
const char IFW_PACKAGE_UNCOMPRESSEDSIZE[] = "ifw.package.uncompressedsize";
const char IFW_INSTALLER_INSTALLLOG[] = "ifw.installer.installlog";
+const char IFW_DEVELOPER_BUILD[] = "ifw.developer.build";
// Internal-only, hidden in --help text
const char IFW_PROGRESS_INDICATOR[] = "ifw.progress.indicator";
@@ -69,13 +64,7 @@ const char IFW_PROGRESS_INDICATOR[] = "ifw.progress.indicator";
namespace QInstaller
{
-Q_LOGGING_CATEGORY(lcComponentChecker, IFW_COMPONENT_CHECKER)
-Q_LOGGING_CATEGORY(lcResources, IFW_RESOURCES)
-Q_LOGGING_CATEGORY(lcTranslations, IFW_TRANSLATIONS)
-Q_LOGGING_CATEGORY(lcNetwork, IFW_NETWORK)
Q_LOGGING_CATEGORY(lcServer, IFW_SERVER)
-Q_LOGGING_CATEGORY(lcGeneral, IFW_GENERAL)
-Q_LOGGING_CATEGORY(lcInstallerUninstallLog, IFW_INSTALLER_UNINSTALLLOG)
Q_LOGGING_CATEGORY(lcPackageDisplayname, IFW_PACKAGE_DISPLAYNAME);
Q_LOGGING_CATEGORY(lcPackageDescription, IFW_PACKAGE_DESCRIPTION)
@@ -103,14 +92,12 @@ Q_LOGGING_CATEGORY(lcPackageCompressedSize, IFW_PACKAGE_COMPRESSEDSIZE)
Q_LOGGING_CATEGORY(lcInstallerInstallLog, IFW_INSTALLER_INSTALLLOG)
Q_LOGGING_CATEGORY(lcProgressIndicator, IFW_PROGRESS_INDICATOR)
+Q_LOGGING_CATEGORY(lcDeveloperBuild, IFW_DEVELOPER_BUILD)
+
QStringList loggingCategories()
{
static QStringList categories = QStringList()
- << QLatin1String(IFW_COMPONENT_CHECKER)
- << QLatin1String(IFW_RESOURCES)
- << QLatin1String(IFW_TRANSLATIONS)
- << QLatin1String(IFW_NETWORK)
<< QLatin1String(IFW_PACKAGE_DISPLAYNAME)
<< QLatin1String(IFW_PACKAGE_DESCRIPTION)
<< QLatin1String(IFW_PACKAGE_VERSION)
@@ -135,9 +122,7 @@ QStringList loggingCategories()
<< QLatin1String(IFW_PACKAGE_UNCOMPRESSEDSIZE)
<< QLatin1String(IFW_PACKAGE_COMPRESSEDSIZE)
<< QLatin1String(IFW_INSTALLER_INSTALLLOG)
- << QLatin1String(IFW_SERVER)
- << QLatin1String(IFW_GENERAL)
- << QLatin1String(IFW_INSTALLER_UNINSTALLLOG);
+ << QLatin1String(IFW_SERVER);
return categories;
}
diff --git a/src/libs/installer/globals.h b/src/libs/installer/globals.h
index cdfad1a53..c7608ca15 100644
--- a/src/libs/installer/globals.h
+++ b/src/libs/installer/globals.h
@@ -35,12 +35,8 @@
namespace QInstaller {
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcComponentChecker)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcResources)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcTranslations)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcNetwork)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcServer)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcGeneral)
+INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcInstallerInstallLog)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageDisplayname)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageDescription)
@@ -65,9 +61,8 @@ INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageCheckable)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageLicenses)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageUncompressedSize)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageCompressedSize)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcInstallerInstallLog)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcInstallerUninstallLog)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcProgressIndicator)
+INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcDeveloperBuild)
QStringList INSTALLER_EXPORT loggingCategories();
diff --git a/src/libs/installer/installiconsoperation.cpp b/src/libs/installer/installiconsoperation.cpp
index 08ac6e8d5..f6e4c589a 100644
--- a/src/libs/installer/installiconsoperation.cpp
+++ b/src/libs/installer/installiconsoperation.cpp
@@ -257,10 +257,10 @@ bool InstallIconsOperation::undoOperation()
}
if (!warningMessages.isEmpty()) {
- qCWarning(QInstaller::lcInstallerUninstallLog) << "Undo of operation" << name() << "with arguments"
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Undo of operation" << name() << "with arguments"
<< arguments().join(QLatin1String(", ")) << "had some problems.";
foreach (const QString &message, warningMessages) {
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote() << message;
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote() << message;
}
}
diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp
index 4064fa8b0..1f375f56b 100644
--- a/src/libs/installer/metadatajob.cpp
+++ b/src/libs/installer/metadatajob.cpp
@@ -335,7 +335,7 @@ void MetadataJob::xmlTaskFinished()
update.insert(QLatin1String("replace"), qMakePair(original, replacement));
if (s.updateRepositoryCategories(update) == Settings::UpdatesApplied)
- qCDebug(QInstaller::lcGeneral()) << "Repository categories updated.";
+ qCDebug(QInstaller::lcDeveloperBuild) << "Repository categories updated.";
if (s.updateDefaultRepositories(update) == Settings::UpdatesApplied
|| s.updateUserRepositories(update) == Settings::UpdatesApplied) {
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 89b9b782c..59a0d05dd 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -1177,7 +1177,7 @@ PackageManagerCore::PackageManagerCore(qint64 magicmaker, const QList<OperationB
"remove the packages from components.xml which operations are missing, "
"or reinstall the packages.";
} else {
- qCDebug(QInstaller::lcGeneral) << "Operations sanity check succeeded.";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Operations sanity check succeeded.";
}
connect(this, &PackageManagerCore::metaJobProgress,
ProgressCoordinator::instance(), &ProgressCoordinator::printProgressPercentage);
@@ -1605,7 +1605,7 @@ bool PackageManagerCore::addWizardPage(Component *component, const QString &name
return true;
}
} else {
- qCDebug(QInstaller::lcGeneral) << "Headless installation: skip wizard page addition: " << name;
+ qCDebug(QInstaller::lcDeveloperBuild) << "Headless installation: skip wizard page addition: " << name;
}
return false;
}
@@ -1629,7 +1629,7 @@ bool PackageManagerCore::removeWizardPage(Component *component, const QString &n
return true;
}
} else {
- qCDebug(QInstaller::lcGeneral) << "Headless installation: skip wizard page removal: " << name;
+ qCDebug(QInstaller::lcDeveloperBuild) << "Headless installation: skip wizard page removal: " << name;
}
return false;
}
@@ -1716,7 +1716,7 @@ bool PackageManagerCore::addWizardPageItem(Component *component, const QString &
return true;
}
} else {
- qCDebug(QInstaller::lcGeneral) << "Headless installation: skip wizard page item addition: " << name;
+ qCDebug(QInstaller::lcDeveloperBuild) << "Headless installation: skip wizard page item addition: " << name;
}
return false;
}
@@ -2218,17 +2218,17 @@ bool PackageManagerCore::componentUninstallableFromCommandLine(const QString &co
if (model->data(idx, Qt::CheckStateRole) == QVariant::Invalid) {
// Component cannot be unselected, check why
if (component->forcedInstallation()) {
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote().nospace()
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote().nospace()
<< "Cannot uninstall ForcedInstallation component " << component->name();
} else if (component->autoDependencies().count() > 0) {
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote().nospace() << "Cannot uninstall component "
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote().nospace() << "Cannot uninstall component "
<< componentName << " because it is added as auto dependency to "
<< component->autoDependencies().join(QLatin1Char(','));
} else if (component->isVirtual() && !virtualComponentsVisible()) {
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote().nospace()
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote().nospace()
<< "Cannot uninstall virtual component " << component->name();
} else {
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote().nospace()
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote().nospace()
<< "Cannot uninstall component " << component->name();
}
return false;
@@ -2355,7 +2355,7 @@ bool PackageManagerCore::uninstallComponentsSilently(const QStringList& componen
uninstallComponentFound = true;
}
} else {
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote().nospace() << "Cannot uninstall component " << componentName <<". Component not found in install tree.";
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote().nospace() << "Cannot uninstall component " << componentName <<". Component not found in install tree.";
}
}
@@ -2363,7 +2363,7 @@ bool PackageManagerCore::uninstallComponentsSilently(const QStringList& componen
if (!d->calculateComponentsAndRun())
return false;
- qCDebug(QInstaller::lcInstallerUninstallLog) << "Components uninstalled successfully";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Components uninstalled successfully";
}
return true;
}
@@ -2378,9 +2378,9 @@ bool PackageManagerCore::removeInstallationSilently()
if (d->runningProcessesFound())
throw Error(tr("Running processes found."));
- qCDebug(QInstaller::lcInstallerUninstallLog) << "Complete uninstallation was chosen.";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Complete uninstallation was chosen.";
if (!(d->m_autoConfirmCommand || d->askUserConfirmCommand())) {
- qCDebug(QInstaller::lcInstallerUninstallLog) << "Uninstallation aborted.";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Uninstallation aborted.";
return false;
}
setCompleteUninstallation(true);
@@ -3031,8 +3031,16 @@ bool PackageManagerCore::isVerbose() const
}
/*!
+ Returns verbose level.
+*/
+uint PackageManagerCore::verboseLevel() const
+{
+ return QInstaller::verboseLevel();
+}
+
+/*!
Determines that the package manager displays detailed information if
- \a on is \c true.
+ \a on is \c true. Calling setVerbose() more than once increases verbosity.
*/
void PackageManagerCore::setVerbose(bool on)
{
@@ -3357,10 +3365,10 @@ bool PackageManagerCore::updateComponentData(struct Data &data, Component *compo
component->setUninstalled();
const QString localPath = component->localTempPath();
- if (isVerbose()) {
+ if (verboseLevel() > 1) {
static QString lastLocalPath;
if (lastLocalPath != localPath)
- qCDebug(QInstaller::lcGeneral) << "Url is:" << localPath;
+ qCDebug(QInstaller::lcDeveloperBuild()) << "Url is:" << localPath;
lastLocalPath = localPath;
}
@@ -3436,7 +3444,7 @@ void PackageManagerCore::storeReplacedComponents(QHash<QString, Component *> &co
// installer binary or the installed component list, just ignore it. This
// can happen when in installer mode and probably package manager mode too.
if (isUpdater())
- qCWarning(QInstaller::lcGeneral) << componentName << "- Does not exist in the repositories anymore.";
+ qCWarning(QInstaller::lcDeveloperBuild) << componentName << "- Does not exist in the repositories anymore.";
continue;
}
if (!componentToReplace && !d->componentsToReplace().contains(componentName)) {
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index fe044fa27..e02dbeb36 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -266,6 +266,8 @@ public:
bool isVerbose() const;
void setVerbose(bool on);
+ uint verboseLevel() const;
+
Q_INVOKABLE bool gainAdminRights();
Q_INVOKABLE void dropAdminRights();
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 6b5c4683f..030b79701 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -440,11 +440,11 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
restoreCheckState();
- if (m_core->isVerbose()) {
+ if (m_core->verboseLevel() > 1) {
foreach (QInstaller::Component *component, components) {
const QStringList warnings = ComponentChecker::checkComponent(component);
foreach (const QString &warning, warnings)
- qCWarning(lcComponentChecker).noquote() << warning;
+ qCWarning(lcDeveloperBuild).noquote() << warning;
}
}
@@ -514,7 +514,7 @@ void PackageManagerCorePrivate::clearUpdaterComponentLists()
const QList<QPair<Component*, Component*> > list = m_componentsToReplaceUpdaterMode.values();
for (int i = 0; i < list.count(); ++i) {
if (usedComponents.contains(list.at(i).second))
- qCWarning(QInstaller::lcGeneral) << "a replacement was already in the list - is that correct?";
+ qCWarning(QInstaller::lcDeveloperBuild) << "a replacement was already in the list - is that correct?";
else
usedComponents.insert(list.at(i).second);
}
@@ -1109,7 +1109,7 @@ void PackageManagerCorePrivate::writeMaintenanceToolBinary(QFile *const input, q
QFile mt(maintenanceToolRenamedName);
if (setDefaultFilePermissions(&mt, DefaultFilePermissions::Executable))
- qCDebug(QInstaller::lcGeneral) << "Wrote permissions for maintenance tool.";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Wrote permissions for maintenance tool.";
else
qCWarning(QInstaller::lcInstallerInstallLog) << "Failed to write permissions for maintenance tool.";
@@ -1138,7 +1138,7 @@ void PackageManagerCorePrivate::writeMaintenanceToolBinaryData(QFileDevice *outp
file.remove(); // clear all possible leftovers
m_core->setValue(QString::fromLatin1("DefaultResourceReplacement"), QString());
} else {
- qCWarning(QInstaller::lcGeneral) << "Cannot replace default resource with"
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Cannot replace default resource with"
<< QDir::toNativeSeparators(newDefaultResource);
}
}
@@ -1353,7 +1353,7 @@ void PackageManagerCorePrivate::writeMaintenanceTool(OperationList performedOper
try {
if (isInstaller()) {
if (QFile::exists(dataFile)) {
- qCWarning(QInstaller::lcGeneral) << "Found binary data file" << dataFile
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Found binary data file" << dataFile
<< "but deliberately not used. Running as installer requires to read the "
"resources from the application binary.";
}
@@ -1436,7 +1436,7 @@ void PackageManagerCorePrivate::writeMaintenanceTool(OperationList performedOper
if (newBinaryWritten) {
const bool restart = replacementExists && isUpdater() && (!statusCanceledOrFailed()) && m_needsHardRestart;
deferredRename(maintenanceToolName() + QLatin1String(".new"), maintenanceToolName(), restart);
- qCDebug(QInstaller::lcResources) << "Maintenance tool restart:"
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Maintenance tool restart:"
<< (restart ? "true." : "false.");
}
} catch (const Error &err) {
@@ -1927,7 +1927,7 @@ void PackageManagerCorePrivate::installComponent(Component *component, double pr
bool becameAdmin = false;
if (!adminRightsGained && operation->value(QLatin1String("admin")).toBool()) {
becameAdmin = m_core->gainAdminRights();
- qCDebug(QInstaller::lcGeneral) << operation->name() << "as admin:" << becameAdmin;
+ qCDebug(QInstaller::lcInstallerInstallLog) << operation->name() << "as admin:" << becameAdmin;
}
connectOperationToInstaller(operation, progressOperationSize);
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index 07b8bd369..86038f5df 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -328,11 +328,11 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent)
if (sheet.open(QIODevice::ReadOnly)) {
setStyleSheet(QString::fromLatin1(sheet.readAll()));
} else {
- qCWarning(QInstaller::lcInstallerInstallLog) << "The specified style sheet file "
+ qCWarning(QInstaller::lcDeveloperBuild) << "The specified style sheet file "
"can not be opened.";
}
} else {
- qCWarning(QInstaller::lcInstallerInstallLog) << "A style sheet file is specified, "
+ qCWarning(QInstaller::lcDeveloperBuild) << "A style sheet file is specified, "
"but it does not exist.";
}
}
@@ -545,7 +545,7 @@ void PackageManagerGui::setTextItems(QObject *object, const QStringList &items)
return;
}
- qCWarning(QInstaller::lcInstallerInstallLog) << "Cannot set text items on object of type"
+ qCWarning(QInstaller::lcDeveloperBuild) << "Cannot set text items on object of type"
<< object->metaObject()->className() << ".";
}
@@ -602,7 +602,7 @@ void PackageManagerGui::clickButton(int wb, int delay)
if (QAbstractButton *b = button(static_cast<QWizard::WizardButton>(wb)))
QTimer::singleShot(delay, b, &QAbstractButton::click);
else
- qCWarning(QInstaller::lcInstallerInstallLog) << "Button with type: " << d->buttonType(wb) << "not found!";
+ qCWarning(QInstaller::lcDeveloperBuild) << "Button with type: " << d->buttonType(wb) << "not found!";
}
/*!
@@ -616,7 +616,7 @@ void PackageManagerGui::clickButton(const QString &objectName, int delay) const
if (button)
QTimer::singleShot(delay, button, &QAbstractButton::click);
else
- qCWarning(QInstaller::lcInstallerInstallLog) << "Button with objectname: " << objectName << "not found!";
+ qCWarning(QInstaller::lcDeveloperBuild) << "Button with objectname: " << objectName << "not found!";
}
/*!
@@ -635,7 +635,7 @@ bool PackageManagerGui::isButtonEnabled(int wb)
if (QAbstractButton *b = button(static_cast<QWizard::WizardButton>(wb)))
return b->isEnabled();
- qCWarning(QInstaller::lcInstallerInstallLog) << "Button with type: " << d->buttonType(wb) << "not found!";
+ qCWarning(QInstaller::lcDeveloperBuild) << "Button with type: " << d->buttonType(wb) << "not found!";
return false;
}
@@ -668,7 +668,7 @@ void PackageManagerGui::loadControlScript(const QString &scriptPath)
{
d->m_controlScriptContext = m_core->controlScriptEngine()->loadInContext(
QLatin1String("Controller"), scriptPath);
- qCDebug(QInstaller::lcGeneral) << "Loaded control script" << scriptPath;
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Loaded control script" << scriptPath;
}
/*!
@@ -682,7 +682,7 @@ void PackageManagerGui::callControlScriptMethod(const QString &methodName)
const QJSValue returnValue = m_core->controlScriptEngine()->callScriptMethod(
d->m_controlScriptContext, methodName);
if (returnValue.isUndefined()) {
- qCDebug(QInstaller::lcGeneral) << "Control script callback" << methodName
+ qCDebug(QInstaller::lcDeveloperBuild) << "Control script callback" << methodName
<< "does not exist.";
return;
}
@@ -871,7 +871,7 @@ QWidget *PackageManagerGui::pageByObjectName(const QString &name) const
if (p && p->objectName() == name)
return p;
}
- qCWarning(QInstaller::lcInstallerInstallLog) << "No page found for object name" << name;
+ qCDebug(QInstaller::lcDeveloperBuild) << "No page found for object name" << name;
return nullptr;
}
@@ -899,7 +899,7 @@ QWidget *PackageManagerGui::pageWidgetByObjectName(const QString &name) const
return dp->widget();
return p;
}
- qCWarning(QInstaller::lcInstallerInstallLog) << "No page found for object name" << name;
+ qCDebug(QInstaller::lcDeveloperBuild) << "No page found for object name" << name;
return nullptr;
}
@@ -2207,7 +2207,7 @@ bool ComponentSelectionPage::addVirtualComponentToUninstall(const QString &name)
if (component && component->isInstalled() && component->isVirtual()) {
component->setCheckState(Qt::Unchecked);
core->componentsToInstallNeedsRecalculation();
- qCDebug(QInstaller::lcGeneral) << "Virtual component " << name << " was selected for uninstall by script.";
+ qCDebug(QInstaller::lcDeveloperBuild) << "Virtual component " << name << " was selected for uninstall by script.";
return true;
}
return false;
diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp
index a00a5bf23..dc4f1aecc 100644
--- a/src/libs/installer/progresscoordinator.cpp
+++ b/src/libs/installer/progresscoordinator.cpp
@@ -109,7 +109,7 @@ void ProgressCoordinator::registerPartProgress(QObject *sender, const char *sign
void ProgressCoordinator::partProgressChanged(double fraction)
{
if (fraction < 0 || fraction > 1) {
- qCWarning(QInstaller::lcGeneral) << "The fraction is outside from possible value:"
+ qCWarning(QInstaller::lcInstallerInstallLog) << "The fraction is outside from possible value:"
<< fraction;
return;
}
@@ -126,7 +126,7 @@ void ProgressCoordinator::partProgressChanged(double fraction)
double partProgressSize = m_senderPartProgressSizeHash.value(sender(), 0);
if (partProgressSize == 0) {
- qCWarning(QInstaller::lcGeneral) << "It seems that this sender was not registered "
+ qCWarning(QInstaller::lcInstallerInstallLog) << "It seems that this sender was not registered "
"in the right way:" << sender();
return;
}
@@ -143,19 +143,19 @@ void ProgressCoordinator::partProgressChanged(double fraction)
//Q_ASSERT(newCurrentCompletePercentage >= 0);
//Q_ASSERT(newCurrentCompletePercentage <= 100);
if (newCurrentCompletePercentage < 0) {
- qCDebug(QInstaller::lcGeneral) << newCurrentCompletePercentage << "is smaller than 0 "
+ qCDebug(QInstaller::lcDeveloperBuild) << newCurrentCompletePercentage << "is smaller than 0 "
"- this should not happen more than once";
newCurrentCompletePercentage = 0;
}
if (newCurrentCompletePercentage > 100) {
- qCDebug(QInstaller::lcGeneral) << newCurrentCompletePercentage << "is bigger than 100 "
+ qCDebug(QInstaller::lcDeveloperBuild) << newCurrentCompletePercentage << "is bigger than 100 "
"- this should not happen more than once";
newCurrentCompletePercentage = 100;
}
// In undo mode, the progress has to go backward, new has to be smaller than current
if (qRound(m_currentCompletePercentage) < qRound(newCurrentCompletePercentage)) {
- qCWarning(QInstaller::lcGeneral) << "Something is wrong with the calculation "
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Something is wrong with the calculation "
"of the progress.";
}
@@ -179,20 +179,20 @@ void ProgressCoordinator::partProgressChanged(double fraction)
//Q_ASSERT(newCurrentCompletePercentage >= 0);
//Q_ASSERT(newCurrentCompletePercentage <= 100);
if (newCurrentCompletePercentage < 0) {
- qCDebug(QInstaller::lcGeneral) << newCurrentCompletePercentage << "is smaller than 0 "
+ qCDebug(QInstaller::lcDeveloperBuild) << newCurrentCompletePercentage << "is smaller than 0 "
"- this should not happen more than once";
newCurrentCompletePercentage = 0;
}
if (newCurrentCompletePercentage > 100) {
- qCDebug(QInstaller::lcGeneral) << newCurrentCompletePercentage << "is bigger than 100 "
+ qCDebug(QInstaller::lcDeveloperBuild) << newCurrentCompletePercentage << "is bigger than 100 "
"- this should not happen more than once";
newCurrentCompletePercentage = 100;
}
// In normal mode, the progress has to go forward, new has to be larger than current
if (qRound(m_currentCompletePercentage) > qRound(newCurrentCompletePercentage))
- qCWarning(QInstaller::lcGeneral) << "Something is wrong with the calculation of the progress.";
+ qCWarning(QInstaller::lcInstallerInstallLog) << "Something is wrong with the calculation of the progress.";
m_currentCompletePercentage = newCurrentCompletePercentage;
diff --git a/src/libs/installer/settingsoperation.cpp b/src/libs/installer/settingsoperation.cpp
index e45416663..bece9b851 100644
--- a/src/libs/installer/settingsoperation.cpp
+++ b/src/libs/installer/settingsoperation.cpp
@@ -179,14 +179,14 @@ bool SettingsOperation::undoOperation()
if (cleanUp) {
QFile settingsFile(path);
if (!settingsFile.remove())
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote() << settingsFile.errorString();
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote() << settingsFile.errorString();
if (!value(QLatin1String("createddir")).toString().isEmpty()) {
KDUpdater::MkdirOperation mkDirOperation(packageManager());
mkDirOperation.setArguments(QStringList() << QFileInfo(path).absolutePath());
mkDirOperation.setValue(QLatin1String("createddir"), value(QLatin1String("createddir")));
if (!mkDirOperation.undoOperation()) {
- qCWarning(QInstaller::lcInstallerUninstallLog).noquote() << mkDirOperation.errorString();
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote() << mkDirOperation.errorString();
}
}
}
diff --git a/src/libs/installer/utils.cpp b/src/libs/installer/utils.cpp
index dae5f8d34..db6dcadec 100644
--- a/src/libs/installer/utils.cpp
+++ b/src/libs/installer/utils.cpp
@@ -127,16 +127,24 @@ QStringList QInstaller::localeCandidates(const QString &locale_)
}
-static bool verb = false;
+static uint verbLevel = 0;
void QInstaller::setVerbose(bool v)
{
- verb = v;
+ if (v)
+ verbLevel++;
+ else if (verbLevel > 0)
+ verbLevel--;
}
bool QInstaller::isVerbose()
{
- return verb;
+ return verbLevel > 0 ? true : false;
+}
+
+uint QInstaller::verboseLevel()
+{
+ return verbLevel;
}
std::ostream &QInstaller::operator<<(std::ostream &os, const QString &string)
diff --git a/src/libs/installer/utils.h b/src/libs/installer/utils.h
index 7cd237dcc..74cc4917c 100644
--- a/src/libs/installer/utils.h
+++ b/src/libs/installer/utils.h
@@ -64,6 +64,7 @@ namespace QInstaller {
void INSTALLER_EXPORT setVerbose(bool v);
bool INSTALLER_EXPORT isVerbose();
+ uint INSTALLER_EXPORT verboseLevel();
INSTALLER_EXPORT std::ostream& operator<<(std::ostream &os, const QString &string);
diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp
index 276d5bbef..91865fb5f 100644
--- a/src/libs/kdtools/filedownloader.cpp
+++ b/src/libs/kdtools/filedownloader.cpp
@@ -1398,7 +1398,7 @@ void KDUpdater::HttpDownloader::httpReqFinished()
if (d->http == 0)
return;
const QUrl url = d->http->url();
- if (url.isValid() && QInstaller::lcNetwork().isDebugEnabled()){
+ if (url.isValid() && QInstaller::lcServer().isDebugEnabled()){
const QFileInfo fi(d->http->url().toString());
if (fi.suffix() != QLatin1String("sha1")){
const QString hostName = url.host();
@@ -1406,7 +1406,7 @@ void KDUpdater::HttpDownloader::httpReqFinished()
QStringList hostAddresses;
foreach (const QHostAddress &address, info.addresses())
hostAddresses << address.toString();
- qCDebug(QInstaller::lcNetwork) << "Using host:" << hostName
+ qCDebug(QInstaller::lcServer) << "Using host:" << hostName
<< "for" << url.fileName() << "\nIP:" << hostAddresses;
}
}
diff --git a/src/libs/kdtools/job.cpp b/src/libs/kdtools/job.cpp
index c655f8202..8dc72da87 100644
--- a/src/libs/kdtools/job.cpp
+++ b/src/libs/kdtools/job.cpp
@@ -184,7 +184,7 @@ void Job::cancel()
}
emitFinished();
} else {
- qCDebug(QInstaller::lcGeneral) << "The current job cannot be canceled, "
+ qCDebug(QInstaller::lcInstallerInstallLog) << "The current job cannot be canceled, "
"missing \"Cancelable\" capability.";
}
}
diff --git a/src/libs/kdtools/runoncechecker.cpp b/src/libs/kdtools/runoncechecker.cpp
index dda0ef730..35ec924ce 100644
--- a/src/libs/kdtools/runoncechecker.cpp
+++ b/src/libs/kdtools/runoncechecker.cpp
@@ -50,7 +50,7 @@ RunOnceChecker::RunOnceChecker(const QString &filename)
RunOnceChecker::~RunOnceChecker()
{
if (!m_lockfile.unlock())
- qCWarning(QInstaller::lcGeneral).noquote() << m_lockfile.errorString();
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote() << m_lockfile.errorString();
}
class ProcessnameEquals
@@ -98,7 +98,7 @@ bool RunOnceChecker::isRunning(RunOnceChecker::ConditionFlags flags)
if (flags.testFlag(ConditionFlag::Lockfile)) {
const bool locked = m_lockfile.lock();
if (!locked)
- qCWarning(QInstaller::lcGeneral).noquote() << m_lockfile.errorString();
+ qCWarning(QInstaller::lcInstallerInstallLog).noquote() << m_lockfile.errorString();
return !locked;
}
return false;
diff --git a/src/libs/kdtools/task.cpp b/src/libs/kdtools/task.cpp
index 01ddfb0d7..fbc3ed669 100644
--- a/src/libs/kdtools/task.cpp
+++ b/src/libs/kdtools/task.cpp
@@ -176,12 +176,12 @@ QString Task::progressText() const
void Task::run()
{
if (m_started) {
- qCDebug(QInstaller::lcGeneral) << "Trying to start an already started task";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Trying to start an already started task";
return;
}
if (m_stopped) {
- qCDebug(QInstaller::lcGeneral) << "Trying to start a finished or canceled task";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Trying to start a finished or canceled task";
return;
}
@@ -208,13 +208,13 @@ void Task::stop()
}
if (!m_started) {
- qCDebug(QInstaller::lcGeneral) << "Trying to stop an unstarted task";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Trying to stop an unstarted task";
return;
}
if(m_finished || m_stopped)
{
- qCDebug(QInstaller::lcGeneral) << "Trying to stop a finished or canceled task";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Trying to stop a finished or canceled task";
return;
}
@@ -245,12 +245,12 @@ void Task::pause()
}
if (!m_started) {
- qCDebug(QInstaller::lcGeneral) << "Trying to pause an unstarted task";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Trying to pause an unstarted task";
return;
}
if (m_finished || m_stopped) {
- qCDebug(QInstaller::lcGeneral) << "Trying to pause a finished or canceled task";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Trying to pause a finished or canceled task";
return;
}
@@ -278,7 +278,7 @@ void Task::pause()
void Task::resume()
{
if (!m_paused) {
- qCDebug(QInstaller::lcGeneral) << "Trying to resume an unpaused task";
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Trying to resume an unpaused task";
return;
}
diff --git a/src/libs/kdtools/updatefinder.cpp b/src/libs/kdtools/updatefinder.cpp
index 616159d23..674ae578f 100644
--- a/src/libs/kdtools/updatefinder.cpp
+++ b/src/libs/kdtools/updatefinder.cpp
@@ -418,7 +418,7 @@ UpdateFinder::Private::Resolution UpdateFinder::Private::checkPriorityAndVersion
if (match > 0) {
// new package has higher version, use
- qCDebug(QInstaller::lcGeneral).nospace() << "Remove Package 'Name: " << name
+ qCDebug(QInstaller::lcDeveloperBuild).nospace() << "Remove Package 'Name: " << name
<< ", Version: "<< existingPackage->data(QLatin1String("Version")).toString()
<< ", Source: " << QFileInfo(existingPackage->packageSource().url.toLocalFile()).fileName()
<< "' found a package with higher version 'Name: "
@@ -429,7 +429,7 @@ UpdateFinder::Private::Resolution UpdateFinder::Private::checkPriorityAndVersion
if ((match == 0) && (source.priority > existingPackage->packageSource().priority)) {
// new package version equals but priority is higher, use
- qCDebug(QInstaller::lcGeneral).nospace() << "Remove Package 'Name: " << name
+ qCDebug(QInstaller::lcDeveloperBuild).nospace() << "Remove Package 'Name: " << name
<< ", Priority: " << existingPackage->packageSource().priority
<< ", Source: " << QFileInfo(existingPackage->packageSource().url.toLocalFile()).fileName()
<< "' found a package with higher priority 'Name: "