Updated changelog
[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 #include "contentwindow.h"
9
10 class EntriesWindow : public QMainWindow {
11         Q_OBJECT
12
13         public:
14                 EntriesWindow(QWidget *parent = 0, Feed *f = 0);
15                 virtual ~EntriesWindow();
16
17         private slots:
18                 void sync();
19                 void markRead();
20                 void entriesUpdated();
21                 void entrySelected(const QModelIndex &);
22                 void showNextEntry();
23                 void showPrevEntry();
24
25         private:
26                 QListView *list;
27                 QAction *show_all;
28                 QAction *show_updated;
29                 Feed *feed;
30                 int current_row;
31                 ContentWindow *content;
32 };
33
34 class EntryListModel : public QAbstractListModel {
35         Q_OBJECT
36
37         public:
38                 EntryListModel(QObject *parent = 0, QList<Entry *>list = QList<Entry *>(), bool updated = false)
39                         : QAbstractListModel(parent) {
40                         entry_list = list;
41                         show_updated = updated;
42                 }
43
44                 int rowCount(const QModelIndex &model = QModelIndex()) const;
45
46                 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
47
48         public slots:
49                 void showUpdated(bool);
50
51         private:
52                 QList<Entry *> entry_list;
53                 bool show_updated;
54 };
55
56 class EntryListDelegate : public QStyledItemDelegate {
57         Q_OBJECT
58
59         public:
60                 EntryListDelegate(QObject *parent = 0) 
61                         : QStyledItemDelegate(parent) {};
62                            
63                 void paint(QPainter *painter, const QStyleOptionViewItem &option,
64                         const QModelIndex &index) const;
65 };
66
67 #endif
68