File indexing completed on 2025-01-19 03:55:37
0001 #ifndef TWITTERAPI_H 0002 #define TWITTERAPI_H 0003 0004 #include <QAbstractListModel> 0005 #include <QObject> 0006 #include <QNetworkAccessManager> 0007 0008 #include "o1twitter.h" 0009 0010 #include "tweetmodel.h" 0011 0012 /// Mini Twitter API 0013 class TwitterApi: public QObject { 0014 Q_OBJECT 0015 0016 public: 0017 /// List of tweets 0018 Q_PROPERTY(TweetModel *tweetModel READ tweetModel NOTIFY tweetModelChanged) 0019 TweetModel *tweetModel() ; 0020 0021 /// OAuth authenticator 0022 Q_PROPERTY(O1Twitter *authenticator READ authenticator WRITE setAuthenticator) 0023 O1Twitter *authenticator() const; 0024 void setAuthenticator(O1Twitter *v) ; 0025 0026 explicit TwitterApi(QObject *parent = 0); 0027 virtual ~TwitterApi(); 0028 0029 public slots: 0030 Q_INVOKABLE virtual void requestTweets(); 0031 0032 signals: 0033 void tweetModelChanged(); 0034 0035 protected: 0036 O1Twitter *authenticator_; 0037 TweetModel *tweetModel_; 0038 QNetworkAccessManager *manager_; 0039 0040 protected slots: 0041 void tweetsReceived(); 0042 void requestFailed(QNetworkReply::NetworkError error); 0043 }; 0044 0045 #endif // TWITTERAPI_H