|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 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 static QUrl guessUrlFromString(const QString &url); |
|
72 TabWidget *tabWidget() const; |
|
73 WebView *currentTab() const; |
|
74 QByteArray saveState(bool withTabs = true) const; |
|
75 bool restoreState(const QByteArray &state); |
|
76 |
|
77 public slots: |
|
78 void loadPage(const QString &url); |
|
79 void slotHome(); |
|
80 |
|
81 protected: |
|
82 void closeEvent(QCloseEvent *event); |
|
83 |
|
84 private slots: |
|
85 void save(); |
|
86 |
|
87 void slotLoadProgress(int); |
|
88 void slotUpdateStatusbar(const QString &string); |
|
89 void slotUpdateWindowTitle(const QString &title = QString()); |
|
90 |
|
91 void loadUrl(const QUrl &url); |
|
92 void slotPreferences(); |
|
93 |
|
94 void slotFileNew(); |
|
95 void slotFileOpen(); |
|
96 void slotFilePrintPreview(); |
|
97 void slotFilePrint(); |
|
98 void slotPrivateBrowsing(); |
|
99 void slotFileSaveAs(); |
|
100 void slotEditFind(); |
|
101 void slotEditFindNext(); |
|
102 void slotEditFindPrevious(); |
|
103 void slotShowBookmarksDialog(); |
|
104 void slotAddBookmark(); |
|
105 void slotViewZoomIn(); |
|
106 void slotViewZoomOut(); |
|
107 void slotViewResetZoom(); |
|
108 void slotViewZoomTextOnly(bool enable); |
|
109 void slotViewToolbar(); |
|
110 void slotViewBookmarksBar(); |
|
111 void slotViewStatusbar(); |
|
112 void slotViewPageSource(); |
|
113 void slotViewFullScreen(bool enable); |
|
114 |
|
115 void slotWebSearch(); |
|
116 void slotToggleInspector(bool enable); |
|
117 void slotAboutApplication(); |
|
118 void slotDownloadManager(); |
|
119 void slotSelectLineEdit(); |
|
120 |
|
121 void slotAboutToShowBackMenu(); |
|
122 void slotAboutToShowForwardMenu(); |
|
123 void slotAboutToShowWindowMenu(); |
|
124 void slotOpenActionUrl(QAction *action); |
|
125 void slotShowWindow(); |
|
126 void slotSwapFocus(); |
|
127 |
|
128 void printRequested(QWebFrame *frame); |
|
129 void geometryChangeRequested(const QRect &geometry); |
|
130 void updateToolbarActionText(bool visible); |
|
131 void updateBookmarksToolbarActionText(bool visible); |
|
132 |
|
133 private: |
|
134 void loadDefaultState(); |
|
135 void setupMenu(); |
|
136 void setupToolBar(); |
|
137 void updateStatusbarActionText(bool visible); |
|
138 |
|
139 private: |
|
140 QToolBar *m_navigationBar; |
|
141 ToolbarSearch *m_toolbarSearch; |
|
142 BookmarksToolBar *m_bookmarksToolbar; |
|
143 ChaseWidget *m_chaseWidget; |
|
144 TabWidget *m_tabWidget; |
|
145 AutoSaver *m_autoSaver; |
|
146 |
|
147 QAction *m_historyBack; |
|
148 QMenu *m_historyBackMenu; |
|
149 QAction *m_historyForward; |
|
150 QMenu *m_historyForwardMenu; |
|
151 QMenu *m_windowMenu; |
|
152 |
|
153 QAction *m_stop; |
|
154 QAction *m_reload; |
|
155 QAction *m_stopReload; |
|
156 QAction *m_viewToolbar; |
|
157 QAction *m_viewBookmarkBar; |
|
158 QAction *m_viewStatusbar; |
|
159 QAction *m_restoreLastSession; |
|
160 QAction *m_addBookmark; |
|
161 |
|
162 QIcon m_reloadIcon; |
|
163 QIcon m_stopIcon; |
|
164 |
|
165 QString m_lastSearch; |
|
166 }; |
|
167 |
|
168 #endif // BROWSERMAINWINDOW_H |
|
169 |