• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.2 API Reference
  • KDE Home
  • Contact Us
 

KNewStuff

  • knewstuff
  • knewstuff2
  • ui
knewstuff2/ui/itemsmodel.h
Go to the documentation of this file.
1 /*
2  This file is part of KNewStuff2.
3  Copyright (C) 2008 Jeremy Whiting <jpwhiting@kde.org>
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 KNEWSTUFF2_UI_ITEMSMODEL_H
20 #define KNEWSTUFF2_UI_ITEMSMODEL_H
21 
22 #include <QAbstractListModel>
23 #include <QtGui/QImage>
24 
25 #include <knewstuff2/core/entry.h>
26 
27 namespace KNS
28 {
29 static const int kPreviewWidth = 96;
30 static const int kPreviewHeight = 72;
31 
32 
33 class ItemsModel: public QAbstractListModel
34 {
35  Q_OBJECT
36 public:
37  explicit ItemsModel(QObject * parent = NULL, bool hasWebService = false);
38  ~ItemsModel();
39 
40  enum EntryRoles {
42  kNameRole = Qt::UserRole,
44  kCategory,
46  kAuthorName,
48  kAuthorEmail,
50  kAuthorJabber,
52  kAuthorHomepage,
54  kLicense,
56  kSummary,
58  kVersion,
60  kRelease,
62  kReleaseDate,
64  kPayload,
66  kPreview,
68  kPreviewPixmap,
70  kLargePreviewPixmap,
72  kRating,
74  kDownloads,
76  kStatus
77  };
78 
79  int rowCount(const QModelIndex & parent = QModelIndex()) const;
80 
81  QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
82 
83  void addEntry(Entry * entry);
84 
85  void removeEntry(Entry * entry);
86 
87  KNS::Entry* entryForIndex(const QModelIndex & index) const;
88 
89  bool hasPreviewImages() const;
90 
91  bool hasWebService() const;
92 
93 public slots:
94  void slotEntryChanged(KNS::Entry * entry);
95 private slots:
96  void slotEntryPreviewLoaded(const QString &url, const QImage & pix);
97 private:
98 
99  // the list of entries
100  QList<Entry *> m_entries;
101  QMap<QString, QImage> m_previewImages;
102  QMap<QString, QImage> m_largePreviewImages;
103  QMap<QString, QModelIndex> m_imageIndexes;
104  bool m_hasPreviewImages;
105  bool m_hasWebService;
106 };
107 
108 } // end KNS namespace
109 
110 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Apr 20 2013 06:04:28 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

Skip menu "KNewStuff"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.10.2 API Reference

Skip menu "kdelibs-4.10.2 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal