xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/allwinner/browser/browsermainwindow.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the demonstration applications of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL21$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 or version 3 as published by the Free
20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22 ** following information to ensure the GNU Lesser General Public License
23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 **
26 ** As a special exception, The Qt Company gives you certain additional
27 ** rights. These rights are described in The Qt Company LGPL Exception
28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 **
30 ** $QT_END_LICENSE$
31 **
32 ****************************************************************************/
33 
34 #ifndef BROWSERMAINWINDOW_H
35 #define BROWSERMAINWINDOW_H
36 
37 #include <QtWidgets/QMainWindow>
38 #include <QtGui/QIcon>
39 #include <QtCore/QUrl>
40 
41 class AutoSaver;
42 class BookmarksToolBar;
43 class ChaseWidget;
44 class QWebFrame;
45 class TabWidget;
46 class ToolbarSearch;
47 class WebView;
48 
49 /*!
50     The MainWindow of the Browser Application.
51 
52     Handles the tab widget and all the actions
53  */
54 class BrowserMainWindow : public QMainWindow {
55     Q_OBJECT
56 
57 public:
58     BrowserMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
59     ~BrowserMainWindow();
60     QSize sizeHint() const;
61 
62 public:
63     TabWidget *tabWidget() const;
64     WebView *currentTab() const;
65     QByteArray saveState(bool withTabs = true) const;
66     bool restoreState(const QByteArray &state);
67 
68 public slots:
69     void loadPage(const QString &url);
70     void slotHome();
71 
72 protected:
73     void closeEvent(QCloseEvent *event);
74 
75 private slots:
76     void save();
77 
78     void slotLoadProgress(int);
79     void slotUpdateStatusbar(const QString &string);
80     void slotUpdateWindowTitle(const QString &title = QString());
81 
82     void loadUrl(const QUrl &url);
83     void slotPreferences();
84 
85     void slotFileNew();
86     void slotFileOpen();
87     void slotFilePrintPreview();
88     void slotFilePrint();
89     void slotPrivateBrowsing();
90     void slotFileSaveAs();
91     void slotEditFind();
92     void slotEditFindNext();
93     void slotEditFindPrevious();
94     void slotShowBookmarksDialog();
95     void slotAddBookmark();
96     void slotViewZoomIn();
97     void slotViewZoomOut();
98     void slotViewResetZoom();
99     void slotViewZoomTextOnly(bool enable);
100     void slotViewToolbar();
101     void slotViewBookmarksBar();
102     void slotViewStatusbar();
103     void slotViewPageSource();
104     void slotViewFullScreen(bool enable);
105 
106     void slotWebSearch();
107     void slotToggleInspector(bool enable);
108     void slotAboutApplication();
109     void slotDownloadManager();
110     void slotSelectLineEdit();
111 
112     void slotAboutToShowBackMenu();
113     void slotAboutToShowForwardMenu();
114     void slotAboutToShowWindowMenu();
115     void slotOpenActionUrl(QAction *action);
116     void slotShowWindow();
117     void slotSwapFocus();
118 
119     void printRequested(QWebFrame *frame);
120     void geometryChangeRequested(const QRect &geometry);
121     void updateToolbarActionText(bool visible);
122     void updateBookmarksToolbarActionText(bool visible);
123 
124 private:
125     void loadDefaultState();
126     void setupMenu();
127     void setupToolBar();
128     void updateStatusbarActionText(bool visible);
129 
130 private:
131     QToolBar *m_navigationBar;
132     ToolbarSearch *m_toolbarSearch;
133     BookmarksToolBar *m_bookmarksToolbar;
134     ChaseWidget *m_chaseWidget;
135     TabWidget *m_tabWidget;
136     AutoSaver *m_autoSaver;
137 
138     QAction *m_historyBack;
139     QMenu *m_historyBackMenu;
140     QAction *m_historyForward;
141     QMenu *m_historyForwardMenu;
142     QMenu *m_windowMenu;
143 
144     QAction *m_stop;
145     QAction *m_reload;
146     QAction *m_stopReload;
147     QAction *m_viewToolbar;
148     QAction *m_viewBookmarkBar;
149     QAction *m_viewStatusbar;
150     QAction *m_restoreLastSession;
151     QAction *m_addBookmark;
152 
153     QIcon m_reloadIcon;
154     QIcon m_stopIcon;
155 
156     QString m_lastSearch;
157 };
158 
159 #endif // BROWSERMAINWINDOW_H
160 
161