2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2016-03-30 09:10:57 +02:00
|
|
|
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-03-02 16:57:41 +01:00
|
|
|
#ifndef QUPZILLA_H
|
|
|
|
#define QUPZILLA_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2014-03-18 20:00:34 +01:00
|
|
|
#include <QPointer>
|
2011-03-02 16:57:41 +01:00
|
|
|
#include <QUrl>
|
|
|
|
|
2012-08-21 20:28:38 +02:00
|
|
|
#include "restoremanager.h"
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
class QLabel;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QSplitter;
|
2015-01-27 11:01:52 +01:00
|
|
|
class QWebEngineFrame;
|
2013-02-09 15:44:17 +01:00
|
|
|
class QTimer;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2012-01-21 23:19:38 +01:00
|
|
|
class Menu;
|
2014-03-10 16:55:11 +01:00
|
|
|
class MainMenu;
|
2011-03-02 16:57:41 +01:00
|
|
|
class TabWidget;
|
2012-01-21 20:27:45 +01:00
|
|
|
class TabbedWebView;
|
2011-03-02 16:57:41 +01:00
|
|
|
class LineEdit;
|
|
|
|
class SearchToolBar;
|
2014-02-27 22:53:56 +01:00
|
|
|
class HistoryMenu;
|
2014-02-09 01:09:08 +01:00
|
|
|
class BookmarksMenu;
|
2011-03-02 16:57:41 +01:00
|
|
|
class BookmarksToolbar;
|
2013-01-24 17:47:50 +01:00
|
|
|
class AutoFill;
|
2011-03-02 16:57:41 +01:00
|
|
|
class MainApplication;
|
|
|
|
class WebTab;
|
2015-05-24 21:26:17 +02:00
|
|
|
class WebView;
|
2011-03-29 19:55:21 +02:00
|
|
|
class AdBlockIcon;
|
2011-04-15 20:45:22 +02:00
|
|
|
class SideBar;
|
2012-04-01 16:36:38 +02:00
|
|
|
class SideBarManager;
|
2011-04-25 15:06:59 +02:00
|
|
|
class ProgressBar;
|
2011-05-09 17:58:19 +02:00
|
|
|
class StatusBarMessage;
|
2011-09-11 19:15:06 +02:00
|
|
|
class NavigationBar;
|
2014-03-30 16:38:34 +02:00
|
|
|
class NavigationContainer;
|
2011-09-11 19:15:06 +02:00
|
|
|
class ClickableLabel;
|
2012-01-21 23:19:38 +01:00
|
|
|
class LocationBar;
|
2012-08-21 20:28:38 +02:00
|
|
|
|
2014-02-19 22:12:32 +01:00
|
|
|
class QUPZILLA_EXPORT BrowserWindow : public QMainWindow
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-03-10 16:55:11 +01:00
|
|
|
explicit BrowserWindow(Qz::BrowserWindowType type, const QUrl &url = QUrl());
|
2014-02-19 22:07:21 +01:00
|
|
|
~BrowserWindow();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-10 16:55:11 +01:00
|
|
|
void setStartTab(WebTab* tab);
|
2016-03-30 09:10:57 +02:00
|
|
|
void setStartPage(WebPage* page);
|
2013-05-13 22:01:36 +02:00
|
|
|
|
2014-03-10 16:55:11 +01:00
|
|
|
void restoreWindowState(const RestoreManager::WindowData &d);
|
2011-10-17 09:59:09 +02:00
|
|
|
void saveSideBarWidth();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2013-02-09 15:44:17 +01:00
|
|
|
bool fullScreenNavigationVisible() const;
|
|
|
|
void showNavigationWithFullScreen();
|
|
|
|
void hideNavigationWithFullScreen();
|
|
|
|
|
2012-01-14 09:54:51 +01:00
|
|
|
void currentTabChanged();
|
|
|
|
void updateLoadingActions();
|
|
|
|
|
2014-02-08 23:01:01 +01:00
|
|
|
void addBookmark(const QUrl &url, const QString &title);
|
2012-01-21 20:27:45 +01:00
|
|
|
void addDeleteOnCloseWidget(QWidget* widget);
|
|
|
|
|
2014-03-10 16:55:11 +01:00
|
|
|
void createToolbarsMenu(QMenu* menu);
|
|
|
|
void createSidebarsMenu(QMenu* menu);
|
|
|
|
void createEncodingMenu(QMenu* menu);
|
2012-03-13 17:51:37 +01:00
|
|
|
|
2014-09-25 17:36:51 +02:00
|
|
|
void removeActions(const QList<QAction*> &actions);
|
|
|
|
|
2012-04-01 16:36:38 +02:00
|
|
|
SideBar* addSideBar();
|
2012-01-09 22:14:02 +01:00
|
|
|
|
2012-09-06 11:39:42 +02:00
|
|
|
QByteArray saveState(int version = 0) const;
|
|
|
|
bool restoreState(const QByteArray &state, int version = 0);
|
|
|
|
|
2012-01-21 23:19:38 +01:00
|
|
|
TabbedWebView* weView() const;
|
|
|
|
TabbedWebView* weView(int index) const;
|
2012-09-06 11:39:42 +02:00
|
|
|
|
2014-02-19 22:07:21 +01:00
|
|
|
Qz::BrowserWindowType windowType() const;
|
2014-03-10 16:55:11 +01:00
|
|
|
LocationBar* locationBar() const;
|
|
|
|
TabWidget* tabWidget() const;
|
|
|
|
BookmarksToolbar* bookmarksToolbar() const;
|
|
|
|
StatusBarMessage* statusBarMessage() const;
|
|
|
|
NavigationBar* navigationBar() const;
|
|
|
|
SideBarManager* sideBarManager() const;
|
|
|
|
QLabel* ipLabel() const;
|
|
|
|
AdBlockIcon* adBlockIcon() const;
|
|
|
|
QMenu* superMenu() const;
|
|
|
|
|
|
|
|
QUrl homepageUrl() const;
|
|
|
|
|
|
|
|
QAction* action(const QString &name) const;
|
2013-03-23 20:39:55 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
signals:
|
|
|
|
void startingCompleted();
|
|
|
|
|
|
|
|
public slots:
|
2014-02-27 22:53:56 +01:00
|
|
|
void goHome();
|
|
|
|
void goHomeInNewTab();
|
|
|
|
void goBack();
|
|
|
|
void goForward();
|
|
|
|
|
2014-03-15 19:58:19 +01:00
|
|
|
void reload();
|
|
|
|
void reloadBypassCache();
|
|
|
|
|
2011-09-17 11:13:38 +02:00
|
|
|
void setWindowTitle(const QString &t);
|
|
|
|
|
2014-03-31 17:46:59 +02:00
|
|
|
void showWebInspector();
|
2015-09-29 23:35:16 +02:00
|
|
|
void toggleWebInspector();
|
2014-02-27 22:53:56 +01:00
|
|
|
void showHistoryManager();
|
|
|
|
|
2014-03-13 12:31:08 +01:00
|
|
|
void toggleShowMenubar();
|
2014-03-13 13:38:14 +01:00
|
|
|
void toggleShowStatusBar();
|
2014-03-13 12:31:08 +01:00
|
|
|
void toggleShowBookmarksToolbar();
|
|
|
|
void toggleShowNavigationToolbar();
|
|
|
|
void toggleTabsOnTop(bool enable);
|
|
|
|
|
2014-03-13 13:38:14 +01:00
|
|
|
void toggleFullScreen();
|
2015-10-05 17:39:52 +02:00
|
|
|
void enterHtmlFullScreen();
|
2014-03-13 13:38:14 +01:00
|
|
|
|
2013-02-07 14:01:01 +01:00
|
|
|
void loadActionUrl(QObject* obj = 0);
|
|
|
|
void loadActionUrlInNewTab(QObject* obj = 0);
|
2011-12-16 20:17:17 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void bookmarkPage();
|
2014-02-09 11:02:51 +01:00
|
|
|
void bookmarkAllTabs();
|
2011-07-31 00:50:40 +02:00
|
|
|
void loadAddress(const QUrl &url);
|
2015-05-24 21:26:17 +02:00
|
|
|
void showSource(WebView *view = Q_NULLPTR);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
private slots:
|
2014-03-10 16:55:11 +01:00
|
|
|
void addTab();
|
|
|
|
void openLocation();
|
|
|
|
void openFile();
|
|
|
|
void closeWindow();
|
2014-03-15 19:58:19 +01:00
|
|
|
void closeTab();
|
2014-03-09 12:49:45 +01:00
|
|
|
void loadSettings();
|
2011-03-02 16:57:41 +01:00
|
|
|
void postLaunch();
|
2014-03-09 12:49:45 +01:00
|
|
|
|
2011-09-11 19:15:06 +02:00
|
|
|
void refreshHistory();
|
|
|
|
void webSearch();
|
2014-03-10 16:55:11 +01:00
|
|
|
void searchOnPage();
|
|
|
|
void changeEncoding();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2016-04-05 09:07:40 +02:00
|
|
|
void saveSettings();
|
2013-02-09 15:44:17 +01:00
|
|
|
void hideNavigationSlot();
|
2014-03-10 16:55:11 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
private:
|
2013-02-17 11:05:35 +01:00
|
|
|
bool event(QEvent* event);
|
2012-01-02 17:23:31 +01:00
|
|
|
void resizeEvent(QResizeEvent* event);
|
2011-11-06 17:01:23 +01:00
|
|
|
void keyPressEvent(QKeyEvent* event);
|
2012-03-05 13:16:34 +01:00
|
|
|
void keyReleaseEvent(QKeyEvent* event);
|
2011-04-22 07:45:15 +02:00
|
|
|
void closeEvent(QCloseEvent* event);
|
|
|
|
|
2014-03-10 16:55:11 +01:00
|
|
|
SearchToolBar* searchToolBar() const;
|
2013-01-25 19:52:30 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void setupUi();
|
|
|
|
void setupMenu();
|
2011-09-11 19:15:06 +02:00
|
|
|
|
2014-07-22 10:02:08 +02:00
|
|
|
QAction *createEncodingAction(const QString &codecName, const QString &activeCodecName,
|
|
|
|
QMenu *menu);
|
|
|
|
void createEncodingSubMenu(const QString &name, QStringList &codecNames, QMenu *menu);
|
|
|
|
|
2014-03-10 16:55:11 +01:00
|
|
|
QUrl m_startUrl;
|
2011-03-02 16:57:41 +01:00
|
|
|
QUrl m_homepage;
|
2014-02-19 22:07:21 +01:00
|
|
|
Qz::BrowserWindowType m_windowType;
|
2013-05-13 22:01:36 +02:00
|
|
|
WebTab* m_startTab;
|
2016-03-30 09:10:57 +02:00
|
|
|
WebPage* m_startPage;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-08-02 16:19:20 +02:00
|
|
|
QVBoxLayout* m_mainLayout;
|
2011-09-11 19:15:06 +02:00
|
|
|
QSplitter* m_mainSplitter;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-10-15 16:37:32 +02:00
|
|
|
AdBlockIcon* m_adblockIcon;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
TabWidget* m_tabWidget;
|
2012-12-20 14:45:35 +01:00
|
|
|
QPointer<SideBar> m_sideBar;
|
2012-04-01 16:36:38 +02:00
|
|
|
SideBarManager* m_sideBarManager;
|
2011-05-09 17:58:19 +02:00
|
|
|
StatusBarMessage* m_statusBarMessage;
|
2014-03-10 16:55:11 +01:00
|
|
|
|
2014-03-30 16:38:34 +02:00
|
|
|
NavigationContainer* m_navigationContainer;
|
2014-03-10 16:55:11 +01:00
|
|
|
NavigationBar* m_navigationToolbar;
|
|
|
|
BookmarksToolbar* m_bookmarksToolbar;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-04-25 15:06:59 +02:00
|
|
|
ProgressBar* m_progressBar;
|
2011-03-02 16:57:41 +01:00
|
|
|
QLabel* m_ipLabel;
|
|
|
|
|
2014-03-10 16:55:11 +01:00
|
|
|
QMenu* m_superMenu;
|
|
|
|
MainMenu* m_mainMenu;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-01-14 11:46:06 +01:00
|
|
|
int m_sideBarWidth;
|
|
|
|
int m_webViewWidth;
|
2014-03-10 16:55:11 +01:00
|
|
|
|
2012-11-28 11:27:30 +01:00
|
|
|
// Shortcuts
|
|
|
|
bool m_useTabNumberShortcuts;
|
|
|
|
bool m_useSpeedDialNumberShortcuts;
|
2014-04-05 03:00:06 +02:00
|
|
|
bool m_useSingleKeyShortcuts;
|
2012-11-28 11:27:30 +01:00
|
|
|
|
2014-03-30 16:38:34 +02:00
|
|
|
// Remember visibility of menubar and statusbar after entering Fullscreen
|
2011-03-02 16:57:41 +01:00
|
|
|
bool m_menuBarVisible;
|
|
|
|
bool m_statusBarVisible;
|
2015-10-05 17:39:52 +02:00
|
|
|
bool m_isHtmlFullScreen;
|
2013-02-11 17:58:05 +01:00
|
|
|
Qt::WindowStates m_windowStates;
|
2013-02-09 15:44:17 +01:00
|
|
|
QTimer* m_hideNavigationTimer;
|
2012-01-21 20:27:45 +01:00
|
|
|
|
2012-12-20 14:45:35 +01:00
|
|
|
QList<QPointer<QWidget> > m_deleteOnCloseWidgets;
|
2014-03-10 19:41:44 +01:00
|
|
|
|
|
|
|
#ifdef QZ_WS_X11
|
|
|
|
private:
|
|
|
|
int getCurrentVirtualDesktop() const;
|
|
|
|
void moveToVirtualDesktop(int desktopId);
|
|
|
|
#endif
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QUPZILLA_H
|