summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/repository.cpp
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2016-09-20 14:45:24 +0300
committerIikka Eklund <iikka.eklund@qt.io>2016-11-09 07:08:48 +0000
commite7f93217182233383851a25ae21bd950d05b408a (patch)
tree978adb275ec5b3f52a93a610ef5d50d27c6a2479 /src/libs/installer/repository.cpp
parent6e5ef08718b7b638b57dda4ef4a7bdbfe8046743 (diff)
allow installing compressed packages
This change introduces new feature to add 7z packages to be installed. Packages must be installer repositories (created with repogen), compressed to 7z file and named as qtbsp or 7z. Selecting compressed package is done either with button in component selection page or with --installCompressedRepository parameter given to installer or to maintenancetool. Button will not be created by default. If you want to show the button either build IFW with DEFINES+=INSTALLCOMPRESSED or enable the button in control script with allowCompressedRepositoryInstall() in ComponentSelectionPageCallback Task-number: QTIFW-886 Change-Id: Ia060092c348991d5195393b7dc154205f8bf92a5 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/libs/installer/repository.cpp')
-rw-r--r--src/libs/installer/repository.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/libs/installer/repository.cpp b/src/libs/installer/repository.cpp
index 9a501fdfe..280ff1c75 100644
--- a/src/libs/installer/repository.cpp
+++ b/src/libs/installer/repository.cpp
@@ -46,6 +46,7 @@ namespace QInstaller {
Repository::Repository()
: m_default(false)
, m_enabled(false)
+ , m_compressed(false)
{
registerMetaType();
}
@@ -60,28 +61,31 @@ Repository::Repository(const Repository &other)
, m_username(other.m_username)
, m_password(other.m_password)
, m_displayname(other.m_displayname)
+ , m_compressed(other.m_compressed)
{
registerMetaType();
}
/*!
- Constructs a new repository by setting its address to \a url and its default state.
+ Constructs a new repository by setting its address to \a url
+ and its default and \a compressed states.
*/
-Repository::Repository(const QUrl &url, bool isDefault)
+Repository::Repository(const QUrl &url, bool isDefault, bool compressed)
: m_url(url)
, m_default(isDefault)
, m_enabled(true)
+ , m_compressed(compressed)
{
registerMetaType();
}
/*!
- Constructs a new repository by setting its address to \a repositoryUrl as string and its
- default state.
+ Constructs a new repository by setting its address to \a repositoryUrl as
+ string and its \a compressed state.
Note: user and password can be inside the \a repositoryUrl string: http://user:password@repository.url
*/
-Repository Repository::fromUserInput(const QString &repositoryUrl)
+Repository Repository::fromUserInput(const QString &repositoryUrl, bool compressed)
{
QUrl url = QUrl::fromUserInput(repositoryUrl);
const QStringList supportedSchemes = KDUpdater::FileDownloaderFactory::supportedSchemes();
@@ -93,7 +97,7 @@ Repository Repository::fromUserInput(const QString &repositoryUrl)
url.setUserName(QString());
url.setPassword(QString());
- Repository repository(url, false);
+ Repository repository(url, false, compressed);
repository.setUsername(userName);
repository.setPassword(password);
return repository;
@@ -200,6 +204,22 @@ void Repository::setDisplayName(const QString &displayname)
}
/*!
+ Returns true if repository is compressed
+*/
+bool Repository::isCompressed() const
+{
+ return m_compressed;
+}
+
+/*!
+ Sets this repository to \a compressed state to know weather the repository
+ needs to be uncompressed before use.
+*/
+void Repository::setCompressed(bool compressed)
+{
+ m_compressed = compressed;
+}
+/*!
Compares the values of this repository to \a other and returns true if they are equal (same server,
default state, enabled state as well as username and password). \sa operator!=()
*/
@@ -232,6 +252,7 @@ const Repository &Repository::operator=(const Repository &other)
m_username = other.m_username;
m_password = other.m_password;
m_displayname = other.m_displayname;
+ m_compressed = other.m_compressed;
return *this;
}
@@ -244,7 +265,7 @@ void Repository::registerMetaType()
QDataStream &operator>>(QDataStream &istream, Repository &repository)
{
- QByteArray url, username, password, displayname;
+ QByteArray url, username, password, displayname, compressed;
istream >> url >> repository.m_default >> repository.m_enabled >> username >> password >> displayname;
repository.setUrl(QUrl::fromEncoded(QByteArray::fromBase64(url)));
repository.setUsername(QString::fromUtf8(QByteArray::fromBase64(username)));