1 | // SPDX-License-Identifier: LGPL-2.1-or-later |
2 | // SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <gladhorn@kde.org> |
3 | // SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org> |
4 | |
5 | #pragma once |
6 | |
7 | #include <attica/content.h> |
8 | #include <attica/provider.h> |
9 | #include <attica/providermanager.h> |
10 | |
11 | #include "entry.h" |
12 | #include "searchrequest.h" |
13 | |
14 | namespace KNSCore |
15 | { |
16 | class AtticaProvider; |
17 | |
18 | class AtticaRequester : public QObject |
19 | { |
20 | Q_OBJECT |
21 | public: |
22 | explicit AtticaRequester(const KNSCore::SearchRequest &request, AtticaProvider *provider, QObject *parent = nullptr); |
23 | void start(); |
24 | [[nodiscard]] KNSCore::SearchRequest request() const; |
25 | |
26 | Q_SIGNALS: |
27 | void entriesLoaded(const KNSCore::Entry::List &list); |
28 | void loadingDone(); |
29 | void loadingFailed(); |
30 | void entryDetailsLoaded(const KNSCore::Entry &entry); |
31 | |
32 | private Q_SLOTS: |
33 | void detailsLoaded(Attica::BaseJob *job); |
34 | void categoryContentsLoaded(Attica::BaseJob *job); |
35 | |
36 | private: |
37 | void startInternal(); |
38 | void checkForUpdates(); |
39 | [[nodiscard]] Entry::List installedEntries() const; |
40 | [[nodiscard]] Entry entryFromAtticaContent(const Attica::Content &content); |
41 | |
42 | KNSCore::SearchRequest m_request; |
43 | AtticaProvider *m_provider; |
44 | QSet<Attica::BaseJob *> m_updateJobs; |
45 | }; |
46 | |
47 | } // namespace KNSCore |
48 | |