summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/repositorycategory.h
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2018-03-09 10:21:54 +0200
committerKatja Marttila <katja.marttila@qt.io>2018-09-26 04:46:21 +0000
commit0f8d11ca8e8312fc0d0dc56e0c2a1154ff3de77c (patch)
treea0f00dbacd2c03ee3013e648464e2df61c7d1b8b /src/libs/installer/repositorycategory.h
parentb3d140a2c899219a02c1b31efa4e36723eb71c07 (diff)
Enable usage of categorized repositories
This change allows to categorize repositories in component selection page. Using categorized repositories will by default show only uncagetorized repository items in tree. Selecting one or several categories using checkbox will update the treeview to show all selected categorized repository content. Repository's metadata is fetched only after the category is selected. Categorized repositories can be defined in config.xml: <RepositoryCategories> <RemoteRepositories> <Displayname>category 1</Displayname> <Repository> <Url>(url)</Url></Repository> </RemoteReposiories> ... <RepositoryCategories Change-Id: I6eae9daee70b1afa322144d52c11f25d0b655ebf Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/libs/installer/repositorycategory.h')
-rw-r--r--src/libs/installer/repositorycategory.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/libs/installer/repositorycategory.h b/src/libs/installer/repositorycategory.h
new file mode 100644
index 000000000..315af761b
--- /dev/null
+++ b/src/libs/installer/repositorycategory.h
@@ -0,0 +1,86 @@
+/**************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+#ifndef ARCHIVEREPOSITORY_H
+#define ARCHIVEREPOSITORY_H
+
+#include "installer_global.h"
+#include "repository.h"
+
+#include <QtCore/QMetaType>
+#include <QtCore/QUrl>
+#include <QSet>
+
+namespace QInstaller {
+
+class INSTALLER_EXPORT RepositoryCategory
+{
+
+public:
+ explicit RepositoryCategory();
+ RepositoryCategory(const RepositoryCategory &other);
+
+ static void registerMetaType();
+
+ QString displayname() const;
+ void setDisplayName(const QString &displayname);
+
+ QSet<Repository> repositories() const;
+ void setRepositories(const QSet<Repository> repositories);
+ void addRepository(const Repository repository);
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ bool operator==(const RepositoryCategory &other) const;
+ bool operator!=(const RepositoryCategory &other) const;
+
+ uint qHash(const RepositoryCategory &repository);
+
+ friend INSTALLER_EXPORT QDataStream &operator>>(QDataStream &istream, RepositoryCategory &repository);
+ friend INSTALLER_EXPORT QDataStream &operator<<(QDataStream &ostream, const RepositoryCategory &repository);
+
+private:
+ QVariantHash m_data;
+ QString m_displayname;
+ bool m_enabled;
+};
+
+inline uint qHash(const RepositoryCategory &repository)
+{
+ return qHash(repository.displayname());
+}
+
+INSTALLER_EXPORT QDataStream &operator>>(QDataStream &istream, RepositoryCategory &repository);
+INSTALLER_EXPORT QDataStream &operator<<(QDataStream &ostream, const RepositoryCategory &repository);
+
+} // namespace QInstaller
+
+Q_DECLARE_METATYPE(QInstaller::RepositoryCategory)
+
+#endif // ARCHIVEREPOSITORY_H