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