summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThe Qt Project <gerrit-noreply@qt-project.org>2020-01-17 10:50:43 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2020-01-17 10:50:43 +0000
commitc7524d53054d6051e335b552a54f8ee9d0b16ce0 (patch)
tree3c62b1642c225bf0540eec9266b2bcc776f8cee9 /src
parent1b1c1e42c3df29d03ab5817cdcf4cc0b770fa429 (diff)
parent0b62a4c042c2ab191ba06fdc09ca5d9a88ef2995 (diff)
Merge "Merge remote-tracking branch 'origin/3.2' into master"
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/abstractfiletask.cpp8
-rw-r--r--src/libs/installer/component.cpp47
-rw-r--r--src/libs/installer/component.h10
-rw-r--r--src/libs/installer/componentselectionpage_p.cpp104
-rw-r--r--src/libs/installer/componentselectionpage_p.h5
-rw-r--r--src/libs/installer/extractarchiveoperation.cpp73
-rw-r--r--src/libs/installer/extractarchiveoperation.h6
-rw-r--r--src/libs/installer/installercalculator.cpp10
-rw-r--r--src/libs/installer/lib7z_create.h4
-rw-r--r--src/libs/installer/lib7z_facade.cpp99
-rw-r--r--src/libs/installer/lib7z_list.h1
-rw-r--r--src/libs/installer/packagemanagercore.cpp46
-rw-r--r--src/libs/installer/packagemanagercore.h8
-rw-r--r--src/libs/installer/packagemanagergui.cpp28
-rw-r--r--src/libs/installer/repositorycategory.cpp6
-rw-r--r--src/libs/installer/repositorycategory.h6
-rw-r--r--src/libs/kdtools/filedownloader.cpp20
-rw-r--r--src/libs/kdtools/localpackagehub.cpp3
18 files changed, 350 insertions, 134 deletions
diff --git a/src/libs/installer/abstractfiletask.cpp b/src/libs/installer/abstractfiletask.cpp
index ada54e598..83345db05 100644
--- a/src/libs/installer/abstractfiletask.cpp
+++ b/src/libs/installer/abstractfiletask.cpp
@@ -50,6 +50,8 @@ namespace QInstaller {
\value TaskItem
\value SourceFile
\value TargetFile
+ \value Name
+ \value ChecksumMismatch
\value UserRole The first role that can be used for user-specific purposes.
*/
@@ -128,6 +130,12 @@ namespace QInstaller {
*/
/*!
+ \fn FileTaskResult::checksumMismatch() const
+
+ Returns \c true if checksum mismatch is detected otherwise returns \c false.
+*/
+
+/*!
Constructs an empty abstract file task object.
*/
AbstractFileTask::AbstractFileTask()
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index cd40d4a7b..e8abe2383 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -70,6 +70,21 @@ static const QLatin1String scExpandedByDefault("ExpandedByDefault");
static const QLatin1String scUnstable("Unstable");
/*!
+ \enum Component::UnstableError
+
+ This enum type holds the component unstable error reason:
+
+ \value DepencyToUnstable
+ Component has a dependency to an unstable component.
+ \value ShaMismatch
+ Component has packages with non-matching SHA values.
+ \value ScriptLoadingFailed
+ Component script has errors or loading fails.
+ \value MissingDependency
+ Component has dependencies to missing components.
+*/
+
+/*!
\inmodule QtInstallerFramework
\class Component::SortingPriorityLessThan
\brief The SortingPriorityLessThan class sets an increasing sorting order for child components.
@@ -185,6 +200,14 @@ static const QLatin1String scUnstable("Unstable");
*/
/*!
+ \property Component::unstable
+
+ \brief Whether the component is unstable. This is a read-only property.
+
+ \note Unstable components cannot be selected for installation.
+*/
+
+/*!
\fn Component::loaded()
\sa {component::loaded}{component.loaded}
@@ -524,12 +547,12 @@ void Component::loadComponentScript(const QString &fileName)
Component *dependencyComponent = packageManagerCore()->componentByName
(PackageManagerCore::checkableName(dependency));
if (dependencyComponent && dependencyComponent->isUnstable())
- setUnstable(PackageManagerCore::UnstableError::DepencyToUnstable, QLatin1String("Dependent on unstable component"));
+ setUnstable(Component::UnstableError::DepencyToUnstable, QLatin1String("Dependent on unstable component"));
}
}
} catch (const Error &error) {
if (packageManagerCore()->settings().allowUnstableComponents()) {
- setUnstable(PackageManagerCore::UnstableError::ScriptLoadingFailed, error.message());
+ setUnstable(Component::Component::ScriptLoadingFailed, error.message());
qWarning() << error.message();
} else {
throw error;
@@ -1090,6 +1113,8 @@ bool Component::addOperation(QQmlV4Function *func)
The variables that the parameters contain, such as \c @TargetDir@, are replaced with their
values.
+ Returns \c true if the operation is created; otherwise returns \c false.
+
\sa {component::addOperation}{component.addOperation}
*/
bool Component::addOperation(const QString &operation, const QStringList &parameters)
@@ -1118,6 +1143,8 @@ bool Component::addElevatedOperation(QQmlV4Function *func)
The variables that the parameters contain, such as \c @TargetDir@, are replaced with their
values. The operation is executed with elevated rights.
+ Returns \c true if the operation is created; otherwise returns \c false.
+
\sa {component::addElevatedOperation}{component.addElevatedOperation}
*/
bool Component::addElevatedOperation(const QString &operation, const QStringList &parameters)
@@ -1135,6 +1162,8 @@ bool Component::addElevatedOperation(const QString &operation, const QStringList
would be done by calling createOperations(). If you set this to \c false, it is completely up
to the component's script to create all operations.
+ Returns \c false when component's script will create all operations; otherwise returns \c true.
+
\sa {component::autoCreateOperations}{component.autoCreateOperations}
*/
bool Component::autoCreateOperations() const
@@ -1215,7 +1244,7 @@ QStringList Component::dependencies() const
Adds the component specified by \a newDependOn to the automatic depend-on list.
\sa {component::addAutoDependOn}{component.addAutoDependOn}
- \sa dependencies
+ \sa autoDependencies
*/
void Component::addAutoDependOn(const QString &newDependOn)
@@ -1387,12 +1416,20 @@ bool Component::isUninstalled() const
return scUninstalled == d->m_vars.value(scCurrentState);
}
+/*!
+ Returns \c true if this component is unstable.
+*/
+
bool Component::isUnstable() const
{
return scTrue == d->m_vars.value(scUnstable);
}
-void Component::setUnstable(PackageManagerCore::UnstableError error, const QString &errorMessage)
+/*!
+ Sets this component, all its child components and all the components depending on
+ this component unstable with the error code \a error and message \a errorMessage.
+*/
+void Component::setUnstable(Component::UnstableError error, const QString &errorMessage)
{
QList<Component*> dependencies = d->m_core->dependees(this);
// Mark this component unstable
@@ -1410,7 +1447,7 @@ void Component::setUnstable(PackageManagerCore::UnstableError error, const QStri
foreach (Component *descendant, this->descendantComponents()) {
descendant->markComponentUnstable();
}
- QMetaEnum metaEnum = QMetaEnum::fromType<PackageManagerCore::UnstableError>();
+ QMetaEnum metaEnum = QMetaEnum::fromType<Component::UnstableError>();
emit packageManagerCore()->unstableComponentFound(QLatin1String(metaEnum.valueToKey(error)), errorMessage, this->name());
}
diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h
index e6bc4874d..6dafd61b2 100644
--- a/src/libs/installer/component.h
+++ b/src/libs/installer/component.h
@@ -67,6 +67,14 @@ public:
explicit Component(PackageManagerCore *core);
~Component();
+ enum UnstableError {
+ DepencyToUnstable = 0,
+ ShaMismatch,
+ ScriptLoadingFailed,
+ MissingDependency
+ };
+ Q_ENUM(UnstableError)
+
struct SortingPriorityLessThan
{
bool operator() (const Component *lhs, const Component *rhs) const
@@ -183,7 +191,7 @@ public:
Q_INVOKABLE bool componentChangeRequested();
bool isUnstable() const;
- void setUnstable(PackageManagerCore::UnstableError error, const QString &errorMessage = QString());
+ void setUnstable(Component::UnstableError error, const QString &errorMessage = QString());
bool isVirtual() const;
bool isSelected() const;
diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp
index 917dae4c1..cb8f321d0 100644
--- a/src/libs/installer/componentselectionpage_p.cpp
+++ b/src/libs/installer/componentselectionpage_p.cpp
@@ -47,6 +47,8 @@
#include <QHeaderView>
#include <QStandardPaths>
#include <QFileDialog>
+#include <QStackedLayout>
+#include <QStackedWidget>
namespace QInstaller {
@@ -62,18 +64,13 @@ ComponentSelectionPagePrivate::ComponentSelectionPagePrivate(ComponentSelectionP
{
m_treeView->setObjectName(QLatin1String("ComponentsTreeView"));
- connect(m_allModel, SIGNAL(checkStateChanged(QInstaller::ComponentModel::ModelState)), this,
- SLOT(onModelStateChanged(QInstaller::ComponentModel::ModelState)));
- connect(m_updaterModel, SIGNAL(checkStateChanged(QInstaller::ComponentModel::ModelState)),
- this, SLOT(onModelStateChanged(QInstaller::ComponentModel::ModelState)));
+ QVBoxLayout *descriptionVLayout = new QVBoxLayout;
+ descriptionVLayout->setObjectName(QLatin1String("DescriptionLayout"));
- m_descriptionVLayout = new QVBoxLayout;
- m_descriptionVLayout->setObjectName(QLatin1String("DescriptionLayout"));
-
- m_descriptionScrollArea = new QScrollArea(q);
- m_descriptionScrollArea->setWidgetResizable(true);
- m_descriptionScrollArea->setFrameShape(QFrame::NoFrame);
- m_descriptionScrollArea->setObjectName(QLatin1String("DescriptionScrollArea"));
+ QScrollArea *descriptionScrollArea = new QScrollArea(q);
+ descriptionScrollArea->setWidgetResizable(true);
+ descriptionScrollArea->setFrameShape(QFrame::NoFrame);
+ descriptionScrollArea->setObjectName(QLatin1String("DescriptionScrollArea"));
m_descriptionLabel = new QLabel(q);
m_descriptionLabel->setWordWrap(true);
@@ -81,17 +78,14 @@ ComponentSelectionPagePrivate::ComponentSelectionPagePrivate(ComponentSelectionP
m_descriptionLabel->setOpenExternalLinks(true);
m_descriptionLabel->setObjectName(QLatin1String("ComponentDescriptionLabel"));
m_descriptionLabel->setAlignment(Qt::AlignTop);
- m_descriptionScrollArea->setWidget(m_descriptionLabel);
- m_descriptionVLayout->addWidget(m_descriptionScrollArea);
+ descriptionScrollArea->setWidget(m_descriptionLabel);
+ descriptionVLayout->addWidget(descriptionScrollArea);
m_sizeLabel = new QLabel(q);
m_sizeLabel->setMargin(5);
m_sizeLabel->setWordWrap(true);
m_sizeLabel->setObjectName(QLatin1String("ComponentSizeLabel"));
- m_descriptionVLayout->addWidget(m_sizeLabel);
-
- m_treeViewVLayout = new QVBoxLayout;
- m_treeViewVLayout->setObjectName(QLatin1String("TreeviewLayout"));
+ descriptionVLayout->addWidget(m_sizeLabel);
QHBoxLayout *buttonHLayout = new QHBoxLayout;
m_checkDefault = new QPushButton;
@@ -129,34 +123,48 @@ ComponentSelectionPagePrivate::ComponentSelectionPagePrivate(ComponentSelectionP
m_uncheckAll->setText(ComponentSelectionPage::tr("&Deselect All"));
buttonHLayout->addWidget(m_uncheckAll);
- m_metadataProgressLabel = new QLabel();
- m_metadataProgressLabel->hide();
- m_treeViewVLayout->addWidget(m_metadataProgressLabel);
-
- m_progressBar = new QProgressBar();
+ QWidget *progressStackedWidget = new QWidget();
+ QVBoxLayout *metaLayout = new QVBoxLayout(progressStackedWidget);
+ m_metadataProgressLabel = new QLabel(progressStackedWidget);
+ m_progressBar = new QProgressBar(progressStackedWidget);
m_progressBar->setRange(0, 0);
- m_progressBar->hide();
m_progressBar->setObjectName(QLatin1String("CompressedInstallProgressBar"));
- m_treeViewVLayout->addWidget(m_progressBar);
+ metaLayout->addSpacing(20);
+ metaLayout->addWidget(m_metadataProgressLabel);
+ metaLayout->addWidget(m_progressBar);
+ metaLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding));
+
+ QVBoxLayout *treeViewVLayout = new QVBoxLayout;
+ treeViewVLayout->setObjectName(QLatin1String("TreeviewLayout"));
+ treeViewVLayout->addWidget(m_treeView, 3);
+
+ QWidget *mainStackedWidget = new QWidget();
+ m_mainGLayout = new QGridLayout(mainStackedWidget);
+ m_mainGLayout->addLayout(buttonHLayout, 0, 1);
+ m_mainGLayout->addLayout(treeViewVLayout, 1, 1);
+ m_mainGLayout->addLayout(descriptionVLayout, 1, 2);
+ m_mainGLayout->setColumnStretch(1, 3);
+ m_mainGLayout->setColumnStretch(2, 2);
+
+ m_stackedLayout = new QStackedLayout(q);
+ m_stackedLayout->addWidget(mainStackedWidget);
+ m_stackedLayout->addWidget(progressStackedWidget);
+ m_stackedLayout->setCurrentIndex(0);
+
+ connect(m_allModel, SIGNAL(checkStateChanged(QInstaller::ComponentModel::ModelState)), this,
+ SLOT(onModelStateChanged(QInstaller::ComponentModel::ModelState)));
+ connect(m_updaterModel, SIGNAL(checkStateChanged(QInstaller::ComponentModel::ModelState)),
+ this, SLOT(onModelStateChanged(QInstaller::ComponentModel::ModelState)));
connect(m_core, SIGNAL(metaJobProgress(int)), this, SLOT(onProgressChanged(int)));
connect(m_core, SIGNAL(metaJobInfoMessage(QString)), this, SLOT(setMessage(QString)));
connect(m_core, &PackageManagerCore::metaJobTotalProgress, this,
&ComponentSelectionPagePrivate::setTotalProgress);
- m_treeViewVLayout->addWidget(m_treeView, 3);
-
// force a recalculation of components to install to keep the state correct
connect(q, &ComponentSelectionPage::left,
m_core, &PackageManagerCore::clearComponentsToInstallCalculated);
- m_mainGLayout = new QGridLayout(q);
- m_mainGLayout->addLayout(buttonHLayout, 0, 1);
- m_mainGLayout->addLayout(m_treeViewVLayout, 1, 1);
- m_mainGLayout->addLayout(m_descriptionVLayout, 1, 2);
- m_mainGLayout->setColumnStretch(1, 3);
- m_mainGLayout->setColumnStretch(2, 2);
-
#ifdef INSTALLCOMPRESSED
allowCompressedRepositoryInstall();
#endif
@@ -371,32 +379,10 @@ void ComponentSelectionPagePrivate::enableRepositoryCategory(const QString &repo
void ComponentSelectionPagePrivate::updateWidgetVisibility(bool show)
{
- if (show) {
- QSpacerItem *verticalSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum,
- QSizePolicy::Expanding);
- m_treeViewVLayout->addSpacerItem(verticalSpacer2);
- m_mainGLayout->removeItem(m_descriptionVLayout);
- //Hide next button during category fetch
- QPushButton *const b = qobject_cast<QPushButton *>(q->gui()->button(QWizard::NextButton));
- b->setEnabled(!show);
- } else {
- QSpacerItem *item = m_treeViewVLayout->spacerItem();
- m_treeViewVLayout->removeItem(item);
- m_mainGLayout->addLayout(m_descriptionVLayout, 1, 2);
- //Call completeChanged() to determine if NextButton should be shown or not after category fetch.
- q->completeChanged();
- }
- if (m_categoryWidget)
- m_categoryWidget->setVisible(!show);
- m_progressBar->setVisible(show);
- m_metadataProgressLabel->setVisible(show);
-
- m_treeView->setVisible(!show);
- m_checkDefault->setVisible(!show);
- m_checkAll->setVisible(!show);
- m_uncheckAll->setVisible(!show);
- m_descriptionScrollArea->setVisible(!show);
- m_sizeLabel->setVisible(!show);
+ if (show)
+ m_stackedLayout->setCurrentIndex(1);
+ else
+ m_stackedLayout->setCurrentIndex(0);
if (QAbstractButton *bspButton = q->gui()->button(QWizard::CustomButton2))
bspButton->setEnabled(!show);
diff --git a/src/libs/installer/componentselectionpage_p.h b/src/libs/installer/componentselectionpage_p.h
index 591cd08f7..bce13246b 100644
--- a/src/libs/installer/componentselectionpage_p.h
+++ b/src/libs/installer/componentselectionpage_p.h
@@ -45,6 +45,7 @@ class QProgressBar;
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
+class QStackedLayout;
namespace QInstaller {
@@ -89,9 +90,7 @@ private:
PackageManagerCore *m_core;
QTreeView *m_treeView;
QLabel *m_sizeLabel;
- QScrollArea *m_descriptionScrollArea;
QLabel *m_descriptionLabel;
- QVBoxLayout *m_descriptionVLayout;
QPushButton *m_checkAll;
QPushButton *m_uncheckAll;
QPushButton *m_checkDefault;
@@ -100,11 +99,11 @@ private:
QLabel *m_metadataProgressLabel;
QProgressBar *m_progressBar;
QGridLayout *m_mainGLayout;
- QVBoxLayout *m_treeViewVLayout;
bool m_allowCompressedRepositoryInstall;
ComponentModel *m_allModel;
ComponentModel *m_updaterModel;
ComponentModel *m_currentModel;
+ QStackedLayout *m_stackedLayout;
};
} // namespace QInstaller
diff --git a/src/libs/installer/extractarchiveoperation.cpp b/src/libs/installer/extractarchiveoperation.cpp
index e790920d1..b5bf96954 100644
--- a/src/libs/installer/extractarchiveoperation.cpp
+++ b/src/libs/installer/extractarchiveoperation.cpp
@@ -144,37 +144,18 @@ bool ExtractArchiveOperation::undoOperation()
// For backward compatibility, check if "files" can be converted to QStringList.
// If yes, files are listed in .dat instead of in a separate file.
bool useStringListType(value(QLatin1String("files")).type() == QVariant::StringList);
+ QString targetDir = arguments().at(1);
QStringList files;
if (useStringListType) {
files = value(QLatin1String("files")).toStringList();
- startUndoProcess(files);
} else {
- const QString filePath = value(QLatin1String("files")).toString();
- QString targetDir = arguments().at(1);
- // Does not change target on non macOS platforms.
- if (QInstaller::isInBundle(targetDir, &targetDir))
- targetDir = QDir::cleanPath(targetDir + QLatin1String("/.."));
- QString fileName = replacePath(filePath, QLatin1String(scRelocatable), targetDir);
- QFile file(fileName);
-
- if (file.open(QIODevice::ReadOnly)) {
- QDataStream in(&file);
- in >> files;
- for (int i = 0; i < files.count(); ++i)
- files[i] = replacePath(files.at(i), QLatin1String(scRelocatable), targetDir);
- startUndoProcess(files);
- QFileInfo fileInfo(file);
- file.remove();
- QDir directory(fileInfo.absoluteDir());
- if (directory.exists() && directory.isEmpty())
- directory.rmdir(directory.path());
- } else {
- setError(UserDefinedError);
- setErrorString(tr("Cannot open file \"%1\" for reading: %2")
- .arg(QDir::toNativeSeparators(file.fileName())).arg(file.errorString()));
+ if (!readDataFileContents(targetDir, &files))
return false;
- }
}
+ startUndoProcess(files);
+ if (!useStringListType)
+ deleteDataFile(m_relocatedDataFileName);
+
return true;
}
@@ -193,9 +174,51 @@ void ExtractArchiveOperation::startUndoProcess(const QStringList &files)
thread->deleteLater();
}
+void ExtractArchiveOperation::deleteDataFile(const QString &fileName)
+{
+ if (fileName.isEmpty()) {
+ qWarning() << Q_FUNC_INFO << "data file name cannot be empty.";
+ return;
+ }
+ QFile file(fileName);
+ QFileInfo fileInfo(file);
+ if (file.remove()) {
+ QDir directory(fileInfo.absoluteDir());
+ if (directory.exists() && directory.isEmpty())
+ directory.rmdir(directory.path());
+ } else {
+ qWarning() << "Cannot remove data file" << file.fileName();
+ }
+}
+
bool ExtractArchiveOperation::testOperation()
{
return true;
}
+bool ExtractArchiveOperation::readDataFileContents(QString &targetDir, QStringList *resultList)
+{
+ const QString filePath = value(QLatin1String("files")).toString();
+ // Does not change target on non macOS platforms.
+ if (QInstaller::isInBundle(targetDir, &targetDir))
+ targetDir = QDir::cleanPath(targetDir + QLatin1String("/.."));
+ m_relocatedDataFileName = replacePath(filePath, QLatin1String(scRelocatable), targetDir);
+ QFile file(m_relocatedDataFileName);
+
+ if (file.open(QIODevice::ReadOnly)) {
+ QDataStream in(&file);
+ in >> *resultList;
+ for (int i = 0; i < resultList->count(); ++i)
+ resultList->replace(i, replacePath(resultList->at(i), QLatin1String(scRelocatable), targetDir));
+
+ } else {
+ // We should not be here. Either user has manually deleted the installer related
+ // files or same component is installed several times.
+ qWarning() << "Cannot open file " << file.fileName() << " for reading:"
+ << file.errorString() << ". Component is already uninstalled "
+ << "or file is manually deleted.";
+ }
+ return true;
+}
+
} // namespace QInstaller
diff --git a/src/libs/installer/extractarchiveoperation.h b/src/libs/installer/extractarchiveoperation.h
index e706159ed..fa05d403a 100644
--- a/src/libs/installer/extractarchiveoperation.h
+++ b/src/libs/installer/extractarchiveoperation.h
@@ -48,12 +48,18 @@ public:
bool undoOperation();
bool testOperation();
+ bool readDataFileContents(QString &targetDir, QStringList *resultList);
+
Q_SIGNALS:
void outputTextChanged(const QString &progress);
void progressChanged(double);
private:
void startUndoProcess(const QStringList &files);
+ void deleteDataFile(const QString &fileName);
+
+private:
+ QString m_relocatedDataFileName;
private:
class Callback;
diff --git a/src/libs/installer/installercalculator.cpp b/src/libs/installer/installercalculator.cpp
index a35cb99fb..d381cfa9a 100644
--- a/src/libs/installer/installercalculator.cpp
+++ b/src/libs/installer/installercalculator.cpp
@@ -158,14 +158,6 @@ bool InstallerCalculator::appendComponentsToInstall(const QList<Component *> &co
bool InstallerCalculator::appendComponentToInstall(Component *component, const QString &version)
{
QSet<QString> allDependencies = component->dependencies().toSet();
- // All parents are kind of dependencies as well. If we select sub item in treeview, parent gets
- // checked or partially checked as well. When adding component as dependency in script or
- // config.xml we need to add the parent as dependency so the behavior is the same as in visual UI.
- if (component->parentComponent() &&
- !allDependencies.contains(component->parentComponent()->name()) &&
- !m_visitedComponents.contains(component->parentComponent())) {
- allDependencies.insert(component->parentComponent()->name());
- }
QString requiredDependencyVersion = version;
foreach (const QString &dependencyComponentName, allDependencies) {
// PackageManagerCore::componentByName returns 0 if dependencyComponentName contains a
@@ -179,7 +171,7 @@ bool InstallerCalculator::appendComponentToInstall(Component *component, const Q
qWarning().noquote() << errorMessage;
m_componentsToInstallError.append(errorMessage);
if (component->packageManagerCore()->settings().allowUnstableComponents()) {
- component->setUnstable(PackageManagerCore::UnstableError::MissingDependency, errorMessage);
+ component->setUnstable(Component::UnstableError::MissingDependency, errorMessage);
continue;
} else {
return false;
diff --git a/src/libs/installer/lib7z_create.h b/src/libs/installer/lib7z_create.h
index ad308ffd1..bc61db7ab 100644
--- a/src/libs/installer/lib7z_create.h
+++ b/src/libs/installer/lib7z_create.h
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
namespace Lib7z
{
- enum struct QTmpFile {
+ enum struct TmpFile {
No,
Yes
};
@@ -70,7 +70,7 @@ namespace Lib7z
void INSTALLER_EXPORT createArchive(QFileDevice *archive, const QStringList &sources,
Compression level = Compression::Normal, UpdateCallback *callback = 0);
void INSTALLER_EXPORT createArchive(const QString &archive, const QStringList &sources,
- QTmpFile mode, Compression level = Compression::Normal, UpdateCallback *callback = 0);
+ TmpFile mode, Compression level = Compression::Normal, UpdateCallback *callback = 0);
} // namespace Lib7z
diff --git a/src/libs/installer/lib7z_facade.cpp b/src/libs/installer/lib7z_facade.cpp
index b3b3319e8..1869c964f 100644
--- a/src/libs/installer/lib7z_facade.cpp
+++ b/src/libs/installer/lib7z_facade.cpp
@@ -114,6 +114,47 @@ void registerCodecByteSwap();
namespace Lib7z {
+/*!
+ \fn void Lib7z::PercentPrinter::PrintRatio()
+
+ Prints ratio.
+*/
+
+/*!
+ \fn void Lib7z::PercentPrinter::ClosePrint()
+
+ Closes print.
+*/
+
+/*!
+ \fn void Lib7z::PercentPrinter::RePrintRatio()
+
+ Reprints ratio.
+*/
+
+/*!
+ \fn void Lib7z::PercentPrinter::PrintNewLine()
+
+ Prints new line.
+*/
+
+/*!
+ \fn void Lib7z::PercentPrinter::PrintString(const char *s)
+
+ Prints string \a s.
+*/
+
+/*!
+ \fn void Lib7z::PercentPrinter::PrintString(const wchar_t *s)
+
+ Prints string \a s.
+*/
+
+/*!
+ \fn bool Lib7z::operator==(const File &lhs, const File &rhs);
+
+ Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false.
+*/
// -- 7z init codecs, archives
@@ -732,6 +773,30 @@ STDMETHODIMP ExtractCallback::SetOperationResult(Int32 /*resultEOperationResult*
}
/*!
+ \enum Lib7z::TmpFile
+
+ This enum type holds the temp file mode:
+
+ \value No
+ File is not a temporary file.
+ \value Yes
+ File is a tmp file.
+*/
+
+/*!
+ \enum Lib7z::Compression
+
+ This enum specifies the compression ratio of an archive:
+
+ \value Non
+ \value Fastest
+ \value Fast
+ \value Normal
+ \value Maximum
+ \value Ultra
+*/
+
+/*!
\namespace Lib7z
\inmodule QtInstallerFramework
\brief The Lib7z namespace contains miscellaneous identifiers used throughout the Lib7z library.
@@ -745,6 +810,30 @@ STDMETHODIMP ExtractCallback::SetOperationResult(Int32 /*resultEOperationResult*
is returned, the extraction will be aborted. The default implementation returns \c true.
*/
+/*!
+ \fn bool Lib7z::ExtractCallback::setArchive(CArc *carc)
+
+ Sets \a carc as archive.
+*/
+
+/*!
+ \fn void Lib7z::ExtractCallback::setTarget(const QString &dir)
+
+ Sets the target directory to \a dir.
+*/
+
+/*!
+ \fn void Lib7z::ExtractCallback::setCurrentFile(const QString &filename)
+
+ Sets the current file to \a filename.
+*/
+
+/*!
+ \fn virtual Lib7z::ExtractCallback::setCompleted(quint64 completed, quint64 total)
+
+ Returns completed. Always returns true. \a completed and \a total are unused.
+*/
+
// -- UpdateCallback
@@ -877,7 +966,7 @@ void INSTALLER_EXPORT createArchive(QFileDevice *archive, const QStringList &sou
LIB7Z_ASSERTS(archive, Writable)
const QString tmpArchive = createTmp7z();
- Lib7z::createArchive(tmpArchive, sources, QTmpFile::No, level, callback);
+ Lib7z::createArchive(tmpArchive, sources, TmpFile::No, level, callback);
try {
QFile source(tmpArchive);
@@ -892,7 +981,7 @@ void INSTALLER_EXPORT createArchive(QFileDevice *archive, const QStringList &sou
Creates an archive with the given filename \a archive. \a sourcePaths can contain one or more
files, one or more directories or a combination of files and folders. Also the \c * wildcard
is supported. To be able to use the function during an elevated installation, set \a mode to
- \c QTmpFile::Yes. The value of \a level specifies the compression ratio, the default is set
+ \c TmpFile::Yes. The value of \a level specifies the compression ratio, the default is set
to \c 5 (Normal compression). The \a callback can be used to get information about the archive
creation process. If no \a callback is given, an empty implementation is used.
@@ -901,12 +990,12 @@ void INSTALLER_EXPORT createArchive(QFileDevice *archive, const QStringList &sou
\note Filenames are stored case-sensitive with UTF-8 encoding.
\note The ownership of \a callback is transferred to the function and gets delete on exit.
*/
-void createArchive(const QString &archive, const QStringList &sources, QTmpFile mode,
+void createArchive(const QString &archive, const QStringList &sources, TmpFile mode,
Compression level, UpdateCallback *callback)
{
try {
QString target = archive;
- if (mode == QTmpFile::Yes)
+ if (mode == TmpFile::Yes)
target = createTmp7z();
CArcCmdLineOptions options;
@@ -959,7 +1048,7 @@ void createArchive(const QString &archive, const QStringList &sources, QTmpFile
throw SevenZipException(errorMsg);
}
- if (mode == QTmpFile::Yes) {
+ if (mode == TmpFile::Yes) {
QFile org(archive);
if (org.exists() && !org.remove()) {
throw SevenZipException(QCoreApplication::translate("Lib7z", "Cannot remove "
diff --git a/src/libs/installer/lib7z_list.h b/src/libs/installer/lib7z_list.h
index 6e2646025..8522877c1 100644
--- a/src/libs/installer/lib7z_list.h
+++ b/src/libs/installer/lib7z_list.h
@@ -53,6 +53,7 @@ namespace Lib7z
quint64 uncompressedSize = 0;
QFile::Permissions permissions = 0;
};
+
INSTALLER_EXPORT bool operator==(const File &lhs, const File &rhs);
QVector<File> INSTALLER_EXPORT listArchive(QFileDevice *archive);
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 7cfe4f9e3..8e9131353 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -225,6 +225,15 @@ using namespace QInstaller;
*/
/*!
+ \fn PackageManagerCore::metaJobTotalProgress(int progress)
+
+ Triggered when the total \a progress value of the communication with a
+ remote repository changes.
+
+ \sa {installer::metaJobTotalProgress}{installer.metaJobTotalProgress}
+*/
+
+/*!
\fn PackageManagerCore::metaJobInfoMessage(const QString &message)
Triggered with informative updates, \a message, of the communication with a remote repository.
@@ -390,6 +399,12 @@ using namespace QInstaller;
Emitted when the GUI object is set to \a gui.
*/
+/*!
+ \fn PackageManagerCore::unstableComponentFound(const QString &type, const QString &errorMessage, const QString &component)
+
+ Emitted when an unstable \a component is found containing an unstable \a type and \a errorMessage.
+*/
+
Q_GLOBAL_STATIC(QMutex, globalModelMutex);
@@ -538,6 +553,7 @@ void PackageManagerCore::componentsToInstallNeedsRecalculation()
}
/*!
+ Forces a recalculation of components to install.
\sa {installer::clearComponentsToInstallCalculated}{installer.clearComponentsToInstallCalculated}
*/
void PackageManagerCore::clearComponentsToInstallCalculated()
@@ -1558,7 +1574,8 @@ void PackageManagerCore::addUserRepositories(const QStringList &repositories)
/*!
Sets additional \a repositories for this instance of the installer or updater
- if \a replace is \c false. Will be removed after invoking it again.
+ if \a replace is \c false. \a compressed repositories can be added as well.
+ Will be removed after invoking it again.
\sa {installer::setTemporaryRepositories}{installer.setTemporaryRepositories}
\sa addUserRepositories()
@@ -1798,6 +1815,11 @@ QList<Component*> PackageManagerCore::orderedComponentsToInstall() const
return d->installerCalculator()->orderedComponentsToInstall();
}
+/*!
+ Calculates components to install and uninstall. In case of an error, returns \c false
+ and and sets the \a displayString for error detail.
+*/
+
bool PackageManagerCore::calculateComponents(QString *displayString)
{
QString htmlOutput;
@@ -2809,7 +2831,7 @@ bool PackageManagerCore::updateComponentData(struct Data &data, Component *compo
foreach (const QString packageName, d->m_metadataJob.shaMismatchPackages()) {
if (packageName == component->name()) {
QString errorString = QLatin1String("SHA mismatch detected for component ") + packageName;
- component->setUnstable(PackageManagerCore::UnstableError::ShaMismatch, errorString);
+ component->setUnstable(Component::UnstableError::ShaMismatch, errorString);
}
}
}
@@ -3183,16 +3205,26 @@ ComponentModel *PackageManagerCore::componentModel(PackageManagerCore *core, con
return model;
}
+/*!
+ Returns the file list used for delayed deletion.
+*/
QStringList PackageManagerCore::filesForDelayedDeletion() const
{
return d->m_filesForDelayedDeletion;
}
+/*!
+ Adds \a files for delayed deletion.
+*/
void PackageManagerCore::addFilesForDelayedDeletion(const QStringList &files)
{
d->m_filesForDelayedDeletion.append(files);
}
+/*!
+ Adds a colon symbol to the component \c name as a separator between
+ component \a name and version.
+*/
QString PackageManagerCore::checkableName(const QString &name)
{
// to ensure backward compatibility, fix component name with dash (-) symbol
@@ -3203,6 +3235,10 @@ QString PackageManagerCore::checkableName(const QString &name)
return name;
}
+/*!
+ Parses \a name and \a version from \a requirement component. \c requirement
+ contains both \a name and \a version separated either with ':' or with '-'.
+*/
void PackageManagerCore::parseNameAndVersion(const QString &requirement, QString *name, QString *version)
{
if (requirement.isEmpty()) {
@@ -3230,6 +3266,12 @@ void PackageManagerCore::parseNameAndVersion(const QString &requirement, QString
}
}
+/*!
+ Excludes version numbers from names from \a requirements components.
+ \a requirements list contains names that have both name and version.
+
+ Returns a list containing names without version numbers.
+*/
QStringList PackageManagerCore::parseNames(const QStringList &requirements)
{
QString name;
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index b2d064792..8702a3162 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -65,14 +65,6 @@ public:
Protocol::Mode mode = Protocol::Mode::Production);
~PackageManagerCore();
- enum UnstableError {
- DepencyToUnstable = 0,
- ShaMismatch,
- ScriptLoadingFailed,
- MissingDependency
- };
- Q_ENUM(UnstableError)
-
// status
enum Status {
Success = EXIT_SUCCESS,
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index a20290ef7..26f0c484b 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -389,10 +389,14 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent)
QTimer::singleShot(30, this, SLOT(setMaxSize()));
}
+/*!
+ Limits installer maximum size to screen size.
+*/
void PackageManagerGui::setMaxSize()
{
setMaximumSize(qApp->desktop()->availableGeometry(this).size());
}
+
/*!
Destructs a package manager UI.
*/
@@ -1055,16 +1059,14 @@ void PackageManagerGui::currentPageChanged(int newId)
*/
PackageManagerPage::PackageManagerPage(PackageManagerCore *core)
: m_complete(true)
+ , m_titleColor(QString())
, m_needsSettingsButton(false)
, m_core(core)
, validatorComponent(nullptr)
{
- if (!m_core->settings().titleColor().isEmpty()) {
+ if (!m_core->settings().titleColor().isEmpty())
m_titleColor = m_core->settings().titleColor();
- } else {
- QColor defaultColor = style()->standardPalette().text().color();
- m_titleColor = defaultColor.name();
- }
+
setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
setPixmap(QWizard::BannerPixmap, bannerPixmap());
setPixmap(QWizard::LogoPixmap, logoPixmap());
@@ -1528,7 +1530,7 @@ void IntroductionPage::onProgressChanged(int progress)
}
/*!
- Sets total \a progress value to progress bar.
+ Sets total \a totalProgress value to progress bar.
*/
void IntroductionPage::setTotalProgress(int totalProgress)
{
@@ -1927,6 +1929,10 @@ void ComponentSelectionPage::entering()
d->showCompressedRepositoryButton();
}
+/*!
+ Called when end users leave the page and the PackageManagerGui:currentPageChanged()
+ signal is triggered.
+*/
void ComponentSelectionPage::leaving()
{
d->hideCompressedRepositoryButton();
@@ -1993,11 +1999,21 @@ void ComponentSelectionPage::deselectComponent(const QString &id)
d->m_currentModel->setData(idx, Qt::Unchecked, Qt::CheckStateRole);
}
+/*!
+ Adds the possibility to install a compressed repository on component selection
+ page. A new button which opens a file browser is added for compressed
+ repository selection.
+*/
void ComponentSelectionPage::allowCompressedRepositoryInstall()
{
d->allowCompressedRepositoryInstall();
}
+/*!
+ Adds an additional virtual component with the \a name to be installed.
+
+ Returns \c true if the virtual component is found and not installed.
+*/
bool ComponentSelectionPage::addVirtualComponentToUninstall(const QString &name)
{
PackageManagerCore *core = packageManagerCore();
diff --git a/src/libs/installer/repositorycategory.cpp b/src/libs/installer/repositorycategory.cpp
index ce06480c8..79b1cc6a8 100644
--- a/src/libs/installer/repositorycategory.cpp
+++ b/src/libs/installer/repositorycategory.cpp
@@ -88,11 +88,17 @@ void RepositoryCategory::setDisplayName(const QString &displayname)
m_displayname = displayname;
}
+/*!
+ Returns the Tooltip for the category to be displayed.
+*/
QString RepositoryCategory::tooltip() const
{
return m_tooltip;
}
+/*!
+ Sets the Tooltip of the category to \a tooltip.
+*/
void RepositoryCategory::setTooltip(const QString &tooltip)
{
m_tooltip = tooltip;
diff --git a/src/libs/installer/repositorycategory.h b/src/libs/installer/repositorycategory.h
index 1996103a5..faa8d252b 100644
--- a/src/libs/installer/repositorycategory.h
+++ b/src/libs/installer/repositorycategory.h
@@ -26,8 +26,8 @@
**
**************************************************************************/
-#ifndef ARCHIVEREPOSITORY_H
-#define ARCHIVEREPOSITORY_H
+#ifndef REPOSITORYCATEGORY_H
+#define REPOSITORYCATEGORY_H
#include "installer_global.h"
#include "repository.h"
@@ -87,4 +87,4 @@ INSTALLER_EXPORT QDataStream &operator<<(QDataStream &ostream, const RepositoryC
Q_DECLARE_METATYPE(QInstaller::RepositoryCategory)
-#endif // ARCHIVEREPOSITORY_H
+#endif // REPOSITORYCATEGORY_H
diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp
index fce1a6208..f12b6df5d 100644
--- a/src/libs/kdtools/filedownloader.cpp
+++ b/src/libs/kdtools/filedownloader.cpp
@@ -148,6 +148,16 @@ static double calcProgress(qint64 done, qint64 total)
*/
/*!
+ \fn FileDownloader::downloadCompleted()
+ This signal is emitted when downloading a file ends.
+*/
+
+/*!
+ \fn FileDownloader::downloadAborted(const QString &errorMessage)
+ This signal is emitted when downloading a file is aborted with \a errorMessage.
+*/
+
+/*!
\fn FileDownloader::estimatedDownloadTime(int seconds)
This signal is emitted with the estimated download time in \a seconds.
*/
@@ -424,7 +434,7 @@ void KDUpdater::FileDownloader::stopDownloadDeadlineTimer()
}
/*!
- Sets the download into a paused state.
+ Sets the download into a \a paused state.
*/
void KDUpdater::FileDownloader::setDownloadPaused(bool paused)
{
@@ -432,7 +442,7 @@ void KDUpdater::FileDownloader::setDownloadPaused(bool paused)
}
/*!
- Gets the download paused state.
+ Returns the download paused state.
*/
bool KDUpdater::FileDownloader::isDownloadPaused()
{
@@ -440,7 +450,7 @@ bool KDUpdater::FileDownloader::isDownloadPaused()
}
/*!
- Sets the download into a paused state.
+ Sets the download into a \a resumed state.
*/
void KDUpdater::FileDownloader::setDownloadResumed(bool resumed)
{
@@ -448,7 +458,7 @@ void KDUpdater::FileDownloader::setDownloadResumed(bool resumed)
}
/*!
- Gets the download resumed state.
+ Returns the download resumed state.
*/
bool KDUpdater::FileDownloader::isDownloadResumed()
{
@@ -481,7 +491,7 @@ void KDUpdater::FileDownloader::clearBytesDownloadedBeforeResume()
}
/*!
- Updates the amount of bytes downloaded before download resume.
+ Updates the amount of \a bytes downloaded before download resumes.
*/
void KDUpdater::FileDownloader::updateBytesDownloadedBeforeResume(qint64 bytes)
{
diff --git a/src/libs/kdtools/localpackagehub.cpp b/src/libs/kdtools/localpackagehub.cpp
index 14e6b5738..d6208a610 100644
--- a/src/libs/kdtools/localpackagehub.cpp
+++ b/src/libs/kdtools/localpackagehub.cpp
@@ -311,7 +311,8 @@ void LocalPackageHub::refresh()
\a virtualComp,
\a uncompressedSize,
\a inheritVersionFrom,
- and \a checkable for the package.
+ \a checkable,
+ and \a expandedByDefault for the package.
*/
void LocalPackageHub::addPackage(const QString &name,
const QString &version,