1 /* ============================================================
2 * QuiteRSS is a open-source cross-platform RSS/Atom news feeds reader
3 * Copyright (C) 2011-2020 QuiteRSS Team <quiterssteam@gmail.com>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 * ============================================================ */
18 #ifndef WEBVIEW_H
19 #define WEBVIEW_H
20 
21 #include <QWebView>
22 #include <QWebHistory>
23 #include <QWebPage>
24 #include <QWebFrame>
25 #include <QWebElement>
26 
27 #define LEFT_BUTTON 0
28 #define MIDDLE_BUTTON 1
29 #define MIDDLE_BUTTON_MOD 2
30 #define LEFT_BUTTON_CTRL 3
31 #define LEFT_BUTTON_SHIFT 4
32 #define LEFT_BUTTON_ALT 5
33 
34 class WebView : public QWebView
35 {
36   Q_OBJECT
37 public:
38   explicit WebView(QWidget *parent);
39 
40   void disconnectObjects();
41 
42   int buttonClick_;
43 
isLoading()44   bool isLoading() { return isLoading_; }
hasRss()45   bool hasRss() { return hasRss_; }
46 
47 signals:
48   void showContextMenu(const QPoint &);
49   void signalGoHome();
50   void rssChanged(bool);
51 
52 protected:
53   virtual void mousePressEvent(QMouseEvent*);
54   virtual void mouseReleaseEvent(QMouseEvent*);
55   virtual void wheelEvent(QWheelEvent*);
56   void mouseMoveEvent(QMouseEvent* event);
57 
58 private slots:
59   void slotLoadStarted();
60   void slotLoadProgress(int value);
61   void slotLoadFinished();
62   void checkRss();
63 
64 private:
65   bool isLoading_;
66   bool rssChecked_;
67   bool hasRss_;
68   int posX_;
69   QPoint dragStartPos_;
70 
71 };
72 
73 #endif // WEBVIEW_H
74