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

KNewStuff

itemsmodel.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 Jeremy Whiting <jeremy@scitools.com>               *
00003  *                                                                         *
00004  *   This library is free software; you can redistribute it and/or         *
00005  *   modify it under the terms of the GNU Lesser General Public            *
00006  *   License as published by the Free Software Foundation; either          *
00007  *   version 2 of the License, or (at your option) any later version.      *
00008  *                                                                         *
00009  *   This library is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00012  *   Lesser General Public License for more details.                       *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
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 private slots:
00092     void slotEntryPreviewLoaded(const QString &url, const QPixmap & pix);
00093 private:
00094 
00095     // the list of entries
00096     QList<Entry *> m_entries;
00097     QMap<QString, QImage> m_previewImages;
00098     QMap<QString, QImage> m_largePreviewImages;
00099     QMap<QString, QModelIndex> m_imageIndexes;
00100     bool m_hasPreviewImages;
00101     bool m_hasWebService;
00102 };
00103 
00104 } // end KNS namespace
00105 
00106 #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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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