KNewStuff

itemsmodel.h
1 /*
2  knewstuff3/ui/itemsmodel.h.
3  Copyright (C) 2008 Jeremy Whiting <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef KNEWSTUFF3_ITEMSMODEL_P_H
20 #define KNEWSTUFF3_ITEMSMODEL_P_H
21 
22 #include <QAbstractListModel>
23 
24 #include "entryinternal.h"
25 #include "knewstuffcore_export.h"
26 
27 class KJob;
28 
29 namespace KNSCore
30 {
31 class Engine;
32 
33 class KNEWSTUFFCORE_EXPORT ItemsModel: public QAbstractListModel
34 {
35  Q_OBJECT
36 public:
37  explicit ItemsModel(Engine *engine, QObject *parent = nullptr);
38  ~ItemsModel() override;
39 
40  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
41  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
47  int row(const EntryInternal &entry) const;
48 
49  void addEntry(const EntryInternal &entry);
50  void removeEntry(const EntryInternal &entry);
51 
52  bool hasPreviewImages() const;
53  bool hasWebService() const;
54 
55 Q_SIGNALS:
56  void jobStarted(KJob *, const QString &label);
57 
58 public Q_SLOTS:
59  void slotEntryChanged(const KNSCore::EntryInternal &entry);
60  void slotEntriesLoaded(const KNSCore::EntryInternal::List &entries);
61  void clearEntries();
62  void slotEntryPreviewLoaded(const KNSCore::EntryInternal &entry, KNSCore::EntryInternal::PreviewType type);
63 
64 private:
65  Engine *m_engine;
66  // the list of entries
67  QList<EntryInternal> m_entries;
68  bool m_hasPreviewImages;
69 };
70 
71 } // end KNS namespace
72 
73 Q_DECLARE_METATYPE(KNSCore::EntryInternal)
74 
75 #endif
Contains the core functionality for handling interaction with NewStuff providers. ...
Encapsulates a KNSCore::Engine for use in Qt Quick.
Definition: quickengine.h:38
DisplayRole
A model which shows the contents found in an Engine.
KNewStuff data entry container.
Definition: entryinternal.h:60
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.