diff options
author | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-05-04 14:26:59 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-05-05 14:17:38 +0000 |
commit | 12f052c8781c5e0dd7a517204081167406e813ed (patch) | |
tree | 592b5e09c3ba76620ca732006f1d5b733e4d1b66 /src/libs | |
parent | 5c9c7a7281613866d9b0cbf4bec11283ab9c718c (diff) |
Remove (KDUpdater}Application, functionality has been merge.
Task-number: QTIFW-215
Change-Id: I7a9215c8c5d5eae0d66d57650f5b8b82dd4d40b4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 3 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore_p.h | 23 | ||||
-rw-r--r-- | src/libs/kdtools/kdtools.pri | 4 | ||||
-rw-r--r-- | src/libs/kdtools/kdupdaterapplication.cpp | 202 | ||||
-rw-r--r-- | src/libs/kdtools/kdupdaterapplication.h | 90 | ||||
-rw-r--r-- | src/libs/kdtools/kdupdaterupdatefinder.cpp | 8 |
6 files changed, 5 insertions, 325 deletions
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 7d465cb0a..612b40879 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -62,6 +62,7 @@ #include <productkeycheck.h> +#include <QSettings> #include <QtConcurrentRun> #include <QtCore/QCoreApplication> #include <QtCore/QDir> @@ -186,7 +187,6 @@ static void deferredRename(const QString &oldName, const QString &newName, bool PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core) : m_updateFinder(0) - , m_updaterApplication(new DummyConfigurationInterface) , m_packagesInfo(std::make_shared<PackagesInfo>()) , m_core(core) , m_updates(false) @@ -208,7 +208,6 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core) PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, qint64 magicInstallerMaker, const QList<OperationBlob> &performedOperations) : m_updateFinder(0) - , m_updaterApplication(new DummyConfigurationInterface) , m_packagesInfo(std::make_shared<PackagesInfo>()) , m_status(PackageManagerCore::Unfinished) , m_needsHardRestart(false) diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h index 3bcbf8ffa..6dbebd94c 100644 --- a/src/libs/installer/packagemanagercore_p.h +++ b/src/libs/installer/packagemanagercore_p.h @@ -42,7 +42,6 @@ #include "qinstallerglobal.h" #include "kdsysinfo.h" -#include "kdupdaterapplication.h" #include "kdupdaterupdatefinder.h" #include "kdupdaterupdatesourcesinfo.h" @@ -67,27 +66,6 @@ class InstallerCalculator; class UninstallerCalculator; class RemoteFileEngineHandler; -/* - The default configuration interface implementation does call QSettings to save files for later deletion, - though according to QSettings there should nothing be written if QSettings is not setup properly (which - we do not in our case). Still, caused by a broken QSettings implementation at least on Linux we write an - empty config file which resulted in QTIFW-196. To workaround the issue we now use this empty dummy class. -*/ -class DummyConfigurationInterface : public KDUpdater::ConfigurationInterface -{ -public: - QVariant value(const QString &key) const - { - Q_UNUSED(key) - return QVariant(); - } - void setValue(const QString &key, const QVariant &value) - { - if (value.isNull()) - qDebug() << "DummyConfigurationInterface called with key:" << key << "and value:" << value; - } -}; - class PackageManagerCorePrivate : public QObject { Q_OBJECT @@ -198,7 +176,6 @@ signals: public: UpdateFinder *m_updateFinder; - Application m_updaterApplication; UpdateSourcesInfo m_updateSourcesInfo; std::shared_ptr<PackagesInfo> m_packagesInfo; QStringList m_filesForDelayedDeletion; diff --git a/src/libs/kdtools/kdtools.pri b/src/libs/kdtools/kdtools.pri index 520426096..3898f1c5c 100644 --- a/src/libs/kdtools/kdtools.pri +++ b/src/libs/kdtools/kdtools.pri @@ -20,7 +20,6 @@ SOURCES += $$PWD/kdjob.cpp \ HEADERS += $$PWD/kdupdater.h \ - $$PWD/kdupdaterapplication.h \ $$PWD/kdupdaterfiledownloader.h \ $$PWD/kdupdaterfiledownloader_p.h \ $$PWD/kdupdaterfiledownloaderfactory.h \ @@ -36,8 +35,7 @@ HEADERS += $$PWD/kdupdater.h \ $$PWD/environment.h \ $$PWD/kdupdaterupdatesinfodata_p.h -SOURCES += $$PWD/kdupdaterapplication.cpp \ - $$PWD/kdupdaterfiledownloader.cpp \ +SOURCES += $$PWD/kdupdaterfiledownloader.cpp \ $$PWD/kdupdaterfiledownloaderfactory.cpp \ $$PWD/kdupdaterpackagesinfo.cpp \ $$PWD/kdupdaterupdate.cpp \ diff --git a/src/libs/kdtools/kdupdaterapplication.cpp b/src/libs/kdtools/kdupdaterapplication.cpp deleted file mode 100644 index e2001904c..000000000 --- a/src/libs/kdtools/kdupdaterapplication.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB) -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "kdupdaterapplication.h" - -#include <QCoreApplication> -#include <QDebug> -#include <QDir> - -using namespace KDUpdater; - -/*! - \inmodule kdupdater - \namespace KDUpdater - \brief The KDUpdater classes provide functions to automatically detect - updates to applications, to retrieve them from external repositories, and to - install them. - - KDUpdater classes are a fork of KDAB's general - \l{http://docs.kdab.com/kdtools/2.2.2/group__kdupdater.html}{KDUpdater module}. -*/ - -/*! - \class KDUpdater::ConfigurationInterface - \inmodule kdupdater - \brief The ConfigurationInterface class provides an interface for configuring - an application. -*/ - -/*! - \fn KDUpdater::ConfigurationInterface::~ConfigurationInterface() - Destroys the configuration interface. -*/ - -/*! - \fn KDUpdater::ConfigurationInterface::value(const QString &key) const - Returns the value of the key \a key. -*/ - -/*! - \fn KDUpdater::ConfigurationInterface::setValue(const QString &key, const QVariant &value) - Sets the value \a value for the key \a key. -*/ - -/*! - \class KDUpdater::Application - \inmodule kdupdater - \brief The Application class represents an application that can be updated. - - A KDUpdater application is an application that interacts with one or more update servers and - downloads or installs updates. This class helps in describing an application in terms of: - \list - \li Application Directory - \li Installation information XML file name and its corresponding - KDUpdater::PackagesInfo object - \endlist - - User can also retrieve some information from this class: - \list - \li Application name - \li Application version - \endlist -*/ - -struct Application::ApplicationData -{ - explicit ApplicationData(ConfigurationInterface *config) : - configurationInterface(config ? config : new ConfigurationInterface) - { - const QStringList oldFiles = configurationInterface->value(QLatin1String("FilesForDelayedDeletion")).toStringList(); - Q_FOREACH(const QString &i, oldFiles) { //TODO this should happen asnyc and report errors, I guess - QFile f(i); - if (f.exists() && !f.remove()) { - qWarning("Could not delete file %s: %s", qPrintable(i), qPrintable(f.errorString())); - filesForDelayedDeletion << i; // try again next time - } - } - configurationInterface->setValue(QLatin1String("FilesForDelayedDeletion"), filesForDelayedDeletion); - } - - ~ApplicationData() - { - delete configurationInterface; - } - - static Application *instance; - - QString applicationDirectory; - QStringList filesForDelayedDeletion; - ConfigurationInterface *configurationInterface; -}; - -Application *Application::ApplicationData::instance = 0; - -/*! - Constructs an application with the parent \a p and configuration class \a config. -*/ -Application::Application(ConfigurationInterface* config, QObject* p) : QObject(p) -{ - d = new Application::ApplicationData( config ); - setApplicationDirectory( QCoreApplication::applicationDirPath() ); - - ApplicationData::instance = this; -} - -/*! - Destroys the application. -*/ -Application::~Application() -{ - if (this == ApplicationData::instance) - ApplicationData::instance = 0; - delete d; -} - -/*! - Returns a previously created application instance. -*/ -Application *Application::instance() -{ - return ApplicationData::instance; -} - -/*! - Sets the application directory path directory to \a dir. The installation information and - update sources XML files found in the new application directory will be used. -*/ -void Application::setApplicationDirectory(const QString &dir) -{ - if (d->applicationDirectory == dir) - return; - - QDir dirObj(dir); - - // FIXME: Perhaps we should check whether dir exists on the local file system or not - d->applicationDirectory = dirObj.absolutePath(); -} - -/*! - Returns the path to the application directory. -*/ -QString Application::applicationDirectory() const -{ - return d->applicationDirectory; -} - -/*! - Prints the error code \a errorCode and error message specified by \a error. -*/ -void Application::printError(int errorCode, const QString &error) -{ - qDebug() << errorCode << error; -} - -/*! - Returns a list of files that are scheduled for delayed deletion. -*/ -QStringList Application::filesForDelayedDeletion() const -{ - return d->filesForDelayedDeletion; -} - -/*! - Schedules \a files for delayed deletion. -*/ -void Application::addFilesForDelayedDeletion(const QStringList &files) -{ - d->filesForDelayedDeletion << files; - d->configurationInterface->setValue(QLatin1String("FilesForDelayedDeletion"), d->filesForDelayedDeletion); -} diff --git a/src/libs/kdtools/kdupdaterapplication.h b/src/libs/kdtools/kdupdaterapplication.h deleted file mode 100644 index 996987673..000000000 --- a/src/libs/kdtools/kdupdaterapplication.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB) -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef KD_UPDATER_APPLICATION_H -#define KD_UPDATER_APPLICATION_H - -#include "kdtoolsglobal.h" - -#include <QSettings> - -namespace KDUpdater { - -class ConfigurationInterface -{ -public: - virtual ~ConfigurationInterface() {} - virtual QVariant value(const QString &key) const - { - QSettings settings; - settings.beginGroup(QLatin1String("KDUpdater")); - return settings.value(key); - } - - virtual void setValue(const QString &key, const QVariant &value) - { - QSettings settings; - settings.beginGroup(QLatin1String("KDUpdater")); - settings.setValue(key, value); - } -}; - -class KDTOOLS_EXPORT Application : public QObject -{ - Q_OBJECT - -public: - explicit Application(ConfigurationInterface *config = 0, QObject *parent = 0); - ~Application(); - - static Application *instance(); - - void setApplicationDirectory(const QString &dir); - QString applicationDirectory() const; - - QStringList filesForDelayedDeletion() const; - void addFilesForDelayedDeletion(const QStringList &files); - -public Q_SLOTS: - void printError(int errorCode, const QString &error); - -private: - struct ApplicationData; - ApplicationData *d; -}; - -} // namespace KDUpdater - -#endif // KD_UPDATER_APPLICATION_H diff --git a/src/libs/kdtools/kdupdaterupdatefinder.cpp b/src/libs/kdtools/kdupdaterupdatefinder.cpp index 68555483a..2fbba4ae5 100644 --- a/src/libs/kdtools/kdupdaterupdatefinder.cpp +++ b/src/libs/kdtools/kdupdaterupdatefinder.cpp @@ -52,7 +52,7 @@ using namespace KDUpdater; /*! \inmodule kdupdater \class KDUpdater::UpdateFinder - \brief The UpdaterFinder class finds updates applicable for a KDUpdater::Application. + \brief The UpdaterFinder class finds updates applicable for installed packages. The KDUpdater::UpdateFinder class helps in searching for updates and installing them on the application. The class basically processes the application's KDUpdater::PackagesInfo and the @@ -455,8 +455,7 @@ UpdateFinder::Private::Resolution UpdateFinder::Private::checkPriorityAndVersion // /*! - Constructs an update finder for the KDUpdater::Application specified by - \a application. + Constructs an update finder. */ UpdateFinder::UpdateFinder() : Task(QLatin1String("UpdateFinder"), Stoppable), @@ -473,8 +472,7 @@ UpdateFinder::~UpdateFinder() } /*! - Returns a list of KDUpdater::Update objects. The update objects returned in this list - are made children of the KDUpdater::Application object associated with this class. + Returns a list of KDUpdater::Update objects. */ QList<Update *> UpdateFinder::updates() const { |