• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KNewStuff

itemsmodel.h

Go to the documentation of this file.
00001 /*
00002     This file is part of KNewStuff2.
00003     Copyright (C) 2008 Jeremy Whiting <jeremy@scitools.com>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 #ifndef KNEWSTUFF2_UI_ITEMSMODEL_H
00020 #define KNEWSTUFF2_UI_ITEMSMODEL_H
00021 
00022 #include <QAbstractListModel>
00023 #include <QtGui/QImage>
00024 
00025 #include <knewstuff2/core/entry.h>
00026 #include <knewstuff2/ui/qasyncpixmap.h>
00027 
00028 namespace KNS
00029 {
00030 
00031 class ItemsModel: public QAbstractListModel
00032 {
00033     Q_OBJECT
00034 public:
00035     explicit ItemsModel(QObject * parent = NULL, bool hasWebService = false);
00036     ~ItemsModel();
00037 
00038     enum EntryRoles {
00040         kNameRole = Qt::UserRole,
00042         kCategory,
00044         kAuthorName,
00046         kAuthorEmail,
00048         kAuthorJabber,
00050         kAuthorHomepage,
00052         kLicense,
00054         kSummary,
00056         kVersion,
00058         kRelease,
00060         kReleaseDate,
00062         kPayload,
00064         kPreview,
00066         kPreviewPixmap,
00068         kLargePreviewPixmap,
00070         kRating,
00072         kDownloads,
00074         kStatus
00075     };
00076 
00077     int rowCount(const QModelIndex & parent = QModelIndex()) const;
00078 
00079     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
00080 
00081     void addEntry(Entry * entry);
00082 
00083     void removeEntry(Entry * entry);
00084 
00085     KNS::Entry* entryForIndex(const QModelIndex & index) const;
00086 
00087     bool hasPreviewImages() const;
00088 
00089     bool hasWebService() const;
00090 
00091 public slots:
00092     void slotEntryChanged(KNS::Entry * entry);
00093 private slots:
00094     void slotEntryPreviewLoaded(const QString &url, const QPixmap & pix);
00095 private:
00096 
00097     // the list of entries
00098     QList<Entry *> m_entries;
00099     QMap<QString, QImage> m_previewImages;
00100     QMap<QString, QImage> m_largePreviewImages;
00101     QMap<QString, QModelIndex> m_imageIndexes;
00102     bool m_hasPreviewImages;
00103     bool m_hasWebService;
00104 };
00105 
00106 } // end KNS namespace
00107 
00108 #endif

KNewStuff

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal