Changeset View
Changeset View
Standalone View
Standalone View
view.h
Show All 16 Lines | 2 | /* | |||
---|---|---|---|---|---|
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef KHC_VIEW_H | 22 | #ifndef KHC_VIEW_H | ||
23 | #define KHC_VIEW_H | 23 | #define KHC_VIEW_H | ||
24 | 24 | | |||
25 | #include <KHTMLPart> | 25 | #include <QWebEngineView> | ||
26 | 26 | | |||
27 | class KActionCollection; | 27 | class KActionCollection; | ||
28 | 28 | | |||
29 | namespace DOM { | | |||
30 | class Node; | | |||
31 | class HTMLLinkElement; | | |||
32 | } | | |||
33 | | ||||
34 | namespace KHC { | 29 | namespace KHC { | ||
35 | 30 | | |||
36 | class GrantleeFormatter; | 31 | class GrantleeFormatter; | ||
37 | 32 | | |||
38 | class View : public KHTMLPart | 33 | class View : public QWebEngineView | ||
39 | { | 34 | { | ||
40 | Q_OBJECT | 35 | Q_OBJECT | ||
41 | public: | 36 | public: | ||
42 | View( QWidget *parentWidget, QObject *parent, KHTMLPart::GUIProfile prof, | 37 | View( QWidget *parentWidget, KActionCollection *col ); | ||
43 | KActionCollection *col ); | | |||
44 | 38 | | |||
45 | ~View(); | 39 | ~View(); | ||
46 | 40 | | |||
47 | bool openUrl( const QUrl &url ) override; | | |||
48 | | ||||
49 | void saveState( QDataStream &stream ) override; | | |||
50 | void restoreState( QDataStream &stream ) override; | | |||
51 | | ||||
52 | enum State { Docu, About, Search }; | 41 | enum State { Docu, About, Search }; | ||
53 | 42 | | |||
54 | int state() const { return mState; } | 43 | int state() const { return mState; } | ||
55 | QString title() const { return mTitle; } | | |||
56 | 44 | | |||
57 | static QString langLookup( const QString &fname ); | 45 | static QString langLookup( const QString &fname ); | ||
58 | 46 | | |||
59 | void beginSearchResult(); | 47 | void beginSearchResult(); | ||
60 | void writeSearchResult( const QString & ); | 48 | void writeSearchResult( const QString & ); | ||
61 | void endSearchResult(); | 49 | void endSearchResult(); | ||
62 | 50 | | |||
63 | void beginInternal( const QUrl & ); | 51 | void setInternalHtml(const QString&, const QUrl&); | ||
64 | QUrl internalUrl() const; | 52 | QUrl internalUrl() const; | ||
65 | 53 | | |||
66 | int fontScaleStepping() const { return m_fontScaleStepping; } | | |||
67 | | ||||
68 | GrantleeFormatter *grantleeFormatter() const { return mGrantleeFormatter; } | 54 | GrantleeFormatter *grantleeFormatter() const { return mGrantleeFormatter; } | ||
69 | 55 | | |||
70 | void copySelectedText(); | 56 | void copySelectedText(); | ||
71 | 57 | | |||
72 | public Q_SLOTS: | 58 | public Q_SLOTS: | ||
73 | void lastSearch(); | 59 | void lastSearch(); | ||
74 | void slotIncFontSizes(); | | |||
75 | void slotDecFontSizes(); | | |||
76 | void slotReload( const QUrl &url = QUrl() ); | 60 | void slotReload( const QUrl &url = QUrl() ); | ||
77 | void slotCopyLink(); | | |||
78 | bool nextPage(bool checkOnly = false); | | |||
79 | bool prevPage(bool checkOnly = false); | | |||
80 | 61 | | |||
81 | Q_SIGNALS: | 62 | Q_SIGNALS: | ||
82 | void searchResultCacheAvailable(); | 63 | void searchResultCacheAvailable(); | ||
83 | 64 | | |||
84 | protected: | | |||
85 | bool eventFilter( QObject *o, QEvent *e ) override; | | |||
86 | | ||||
87 | private Q_SLOTS: | | |||
88 | void setTitle( const QString &title ); | | |||
89 | void showMenu( const QString& url, const QPoint& pos); | | |||
90 | | ||||
91 | private: | 65 | private: | ||
92 | QUrl urlFromLinkNode( const DOM::HTMLLinkElement &link ) const; | | |||
93 | | ||||
94 | int mState; | 66 | int mState; | ||
95 | QString mTitle; | | |||
96 | 67 | | |||
97 | QString mSearchResult; | 68 | QString mSearchResult; | ||
98 | QUrl mInternalUrl; | 69 | QUrl mInternalUrl; | ||
99 | 70 | | |||
100 | int m_fontScaleStepping; | | |||
101 | | ||||
102 | GrantleeFormatter *mGrantleeFormatter; | 71 | GrantleeFormatter *mGrantleeFormatter; | ||
103 | KActionCollection *mActionCollection; | 72 | KActionCollection *mActionCollection; | ||
104 | QString mCopyURL; | 73 | QString mCopyURL; | ||
105 | }; | 74 | }; | ||
106 | 75 | | |||
107 | } | 76 | } | ||
108 | 77 | | |||
109 | #endif //KHC_VIEW_H | 78 | #endif //KHC_VIEW_H | ||
110 | 79 | | |||
111 | // vim:ts=2:sw=2:et | 80 | // vim:ts=2:sw=2:et |