| 1 |
#ifndef __BROWSEWIDGETIMPL_H__ |
| 2 |
#define __BROWSEWIDGETIMPL_H__ |
| 3 |
|
| 4 |
#include <QtGui> |
| 5 |
#include <QtNetwork> |
| 6 |
#include <iconv.h> |
| 7 |
#include <errno.h> |
| 8 |
#include <time.h> |
| 9 |
#include "globals.h" |
| 10 |
#include "ui_nextthreaddialog.h" |
| 11 |
#include "ui_browsewidget.h" |
| 12 |
#include "src/kimo2chtextbrowser.h" |
| 13 |
#include "src/mainwindowimpl.h" |
| 14 |
#include "src/xmlprefshandler.h" |
| 15 |
#include "src/cp932codec.h" |
| 16 |
|
| 17 |
class BrowseWidgetImpl : public QWidget, public Ui::BrowseWidget |
| 18 |
{ |
| 19 |
Q_OBJECT; |
| 20 |
public: |
| 21 |
BrowseWidgetImpl(QNetworkAccessManager *manager, QString thread, QString fontFamily, int fontPointSize, QWidget *parent = 0, Qt::WFlags f = 0); |
| 22 |
virtual ~BrowseWidgetImpl(); |
| 23 |
QString getThreadUrl() { return threadUrl; }; |
| 24 |
|
| 25 |
bool isFavorite() { return favorite; } |
| 26 |
void setFavorite(bool state) { favorite = state; } |
| 27 |
void setAutoReload(bool state) { autoReload = state; } |
| 28 |
void downloadSubjectForNextThread(); |
| 29 |
void setProxy(QNetworkProxy *proxy) { networkProxy = proxy; } |
| 30 |
|
| 31 |
QString getTitle() { return threadTitle; }; |
| 32 |
QString getUrl() { return threadUrl; }; |
| 33 |
|
| 34 |
|
| 35 |
public slots: |
| 36 |
void reload(); // Reload thread |
| 37 |
void clearCache(); // Clear cache |
| 38 |
|
| 39 |
private slots: |
| 40 |
void viewUpdate(); // Browser view update |
| 41 |
void closeTab(); // Close tab contains this widget |
| 42 |
// void httpResponseHeader(const QHttpResponseHeader header); |
| 43 |
// void httpRequestFinished(const int id, const bool error); |
| 44 |
void reloadFinished(); |
| 45 |
void setUrl(const QString targetUrl) { threadUrl = targetUrl; }; |
| 46 |
void findNextThreads(); |
| 47 |
|
| 48 |
signals: |
| 49 |
void reloadCompleted(); |
| 50 |
void openNextThread(QString url); // Open next thread |
| 51 |
void requestLink(QUrl url); |
| 52 |
|
| 53 |
private: |
| 54 |
QTabWidget *parentTabWidget; // Parent widget for this tab |
| 55 |
|
| 56 |
QString threadUrl; // Target thread URL |
| 57 |
QString threadTitle; // Thread title |
| 58 |
int readedCount; // Readed res(message) count |
| 59 |
QByteArray cache; // Dat file cache |
| 60 |
|
| 61 |
QNetworkAccessManager *network; // HTTP access manager |
| 62 |
QNetworkReply *reloadReply; // Network reply at thread reloading |
| 63 |
QNetworkReply *findNextReply; // Network reply at find next thread(s) |
| 64 |
QNetworkProxy *networkProxy; // HTTP proxy |
| 65 |
QBuffer *buffer; // HTTP message body buffer |
| 66 |
QBuffer *oldBuffer; // HTTP buffer at HTTP aborted |
| 67 |
QBuffer *nextThreadBuffer; // HTTP buffer for find next thread |
| 68 |
int lastStatus; // HTTP response code |
| 69 |
int datGetId; // HTTP dat file get id |
| 70 |
int subjectGetId; // HTTP subject.txt get id |
| 71 |
QFile *datFile; // dat cache file |
| 72 |
QStringList dat; |
| 73 |
// Header response |
| 74 |
QString lastModified; // Last modified date in last server response header |
| 75 |
QString eTag; |
| 76 |
QDateTime datModifiedTime; // DAT file last modified time |
| 77 |
bool needRefresh; // Need refresh flag |
| 78 |
bool isDatFalled; // Flag of dat falled |
| 79 |
bool favorite; // Thread in favorites flag |
| 80 |
bool autoReload; // State of auto reload |
| 81 |
}; |
| 82 |
|
| 83 |
#endif // __BROWSEWIDGETIMPL_H__ |