873c054757963ab4313263f9fff8a5a5c7c6c27b
[grr] / src / entrieswindow.h
1 #ifndef _ENTRIES_WINDOW_H
2 #define _ENTRIES_WINDOW_H
3
4 #include <QMainWindow>
5 #include <QListView>
6 #include <QStyledItemDelegate>
7 #include "googlereader.h"
8
9 class EntriesWindow : public QMainWindow {
10         Q_OBJECT
11
12         public:
13                 EntriesWindow(QWidget *parent = 0, Feed *f = 0);
14                 virtual ~EntriesWindow();
15
16         private slots:
17                 void sync();
18                 void markRead();
19                 void entriesUpdated();
20                 void entrySelected(const QModelIndex &);
21
22         private:
23                 QListView *list;
24                 QAction *show_all;
25                 QAction *show_updated;
26                 Feed *feed;
27 };
28
29 class EntryListModel : public QAbstractListModel {
30         Q_OBJECT
31
32         public:
33                 EntryListModel(QObject *parent = 0, QList<Entry *>list = QList<Entry *>(), bool updated = false)
34                         : QAbstractListModel(parent) {
35                         entry_list = list;
36                         show_updated = updated;
37                 }
38
39                 int rowCount(const QModelIndex &model = QModelIndex()) const;
40
41                 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
42
43         public slots:
44                 void showUpdated(bool);
45
46         private:
47                 QList<Entry *> entry_list;
48                 bool show_updated;
49 };
50
51 class EntryListDelegate : public QStyledItemDelegate {
52         Q_OBJECT
53
54         public:
55                 EntryListDelegate(QObject *parent = 0) 
56                         : QStyledItemDelegate(parent) {};
57                            
58                 void paint(QPainter *painter, const QStyleOptionViewItem &option,
59                         const QModelIndex &index) const;
60 };
61
62 #endif
63