Updated changelog
[grr] / src / feedswindow.h
1 #ifndef _WINDOW_H
2 #define _WINDOW_H
3
4 #include <QMainWindow>
5 #include <QListView>
6 #include <QStyledItemDelegate>
7 #include <QLabel>
8 #include <QLineEdit>
9 #include <QDialogButtonBox>
10 #include <QPushButton>
11 #include <QDialog>
12 #include <QSettings>
13 #include "googlereader.h"
14
15 class FeedsWindow : public QMainWindow {
16         Q_OBJECT
17
18         public:
19                 FeedsWindow(QWidget *parent = 0);
20                 virtual ~FeedsWindow();
21
22         private slots:
23                 void showUpdated(bool);
24                 void showSettings();
25                 void sync();
26                 void feedsUpdated();
27                 void feedSelected(const QModelIndex &);
28                 void refreshModel();
29                 void loginFailed(QString);
30                 void about();
31
32         private:
33                 QListView *list;
34                 GoogleReader *reader;
35                 QAction *show_all;
36                 QAction *show_updated;
37                 QSettings *settings;
38 };
39
40 class FeedListModel : public QAbstractListModel {
41         Q_OBJECT
42
43         public:
44                 FeedListModel(QObject *parent = 0, QList<Feed *>list = QList<Feed *>(), bool updated = false)
45                         : QAbstractListModel(parent) {
46                         feed_list = list;
47                         show_updated = updated;
48                 }
49
50                 int rowCount(const QModelIndex &model = QModelIndex()) const;
51
52                 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
53
54         public slots:
55                 void showUpdated(bool);
56
57         private:
58                 QList<Feed *> feed_list;
59                 bool show_updated;
60 };
61
62 class FeedListDelegate : public QStyledItemDelegate {
63         Q_OBJECT
64
65         public:
66                 FeedListDelegate(QObject *parent = 0) 
67                         : QStyledItemDelegate(parent) {};
68                            
69                 void paint(QPainter *painter, const QStyleOptionViewItem &option,
70                         const QModelIndex &index) const;
71 };
72
73 class SettingsDialog : public QDialog {
74         Q_OBJECT
75
76         public:
77                 SettingsDialog(QWidget *parent = 0, QSettings *s = 0);
78                 
79         public slots:
80                 void accept();
81
82         private:
83                 QLabel *loginLabel;
84                 QLineEdit *loginEdit;
85                 QLabel *passwdLabel;
86                 QLineEdit *passwdEdit;
87                 QDialogButtonBox *buttonBox;
88                 QPushButton *saveButton;
89                 QPushButton *cancelButton;
90                 QSettings *settings;
91 };
92
93 #endif
94