2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2013-01-24 17:47:50 +01:00
|
|
|
* Copyright (C) 2010-2013 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>
|
|
|
|
#include <QUrl>
|
|
|
|
|
2012-08-21 20:28:38 +02:00
|
|
|
#include "restoremanager.h"
|
2012-01-21 23:19:38 +01:00
|
|
|
#include "qz_namespace.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
class QMenuBar;
|
|
|
|
class QLabel;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QSplitter;
|
|
|
|
class QWebFrame;
|
|
|
|
|
2012-01-21 23:19:38 +01:00
|
|
|
class Menu;
|
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;
|
|
|
|
class BookmarksToolbar;
|
2013-01-24 17:47:50 +01:00
|
|
|
class AutoFill;
|
2011-03-02 16:57:41 +01:00
|
|
|
class MainApplication;
|
|
|
|
class WebTab;
|
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;
|
|
|
|
class ClickableLabel;
|
2011-10-14 20:14:57 +02:00
|
|
|
class WebInspectorDockWidget;
|
2012-01-21 23:19:38 +01:00
|
|
|
class LocationBar;
|
2012-08-21 20:28:38 +02:00
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
class QT_QUPZILLA_EXPORT QupZilla : public QMainWindow
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
static const QString VERSION;
|
|
|
|
static const QString BUILDTIME;
|
|
|
|
static const QString AUTHOR;
|
|
|
|
static const QString COPYRIGHT;
|
|
|
|
static const QString WWWADDRESS;
|
2011-10-02 17:39:59 +02:00
|
|
|
static const QString WIKIADDRESS;
|
2011-03-02 16:57:41 +01:00
|
|
|
static const QString WEBKITVERSION;
|
2011-10-07 15:37:49 +02:00
|
|
|
|
2012-01-21 23:19:38 +01:00
|
|
|
explicit QupZilla(Qz::BrowserWindow type, QUrl startUrl = QUrl());
|
2011-03-02 16:57:41 +01:00
|
|
|
~QupZilla();
|
|
|
|
|
|
|
|
void loadSettings();
|
2011-04-22 07:45:15 +02:00
|
|
|
void showNavigationWithFullscreen();
|
2011-10-17 09:59:09 +02:00
|
|
|
void saveSideBarWidth();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-01-14 09:54:51 +01:00
|
|
|
void currentTabChanged();
|
|
|
|
void updateLoadingActions();
|
|
|
|
|
2012-03-13 17:51:37 +01:00
|
|
|
void addBookmark(const QUrl &url, const QString &title, const QIcon &icon);
|
2012-01-21 20:27:45 +01:00
|
|
|
void addDeleteOnCloseWidget(QWidget* widget);
|
|
|
|
|
2012-08-21 20:28:38 +02:00
|
|
|
void restoreWindowState(const RestoreManager::WindowData &d);
|
2012-03-13 17:51:37 +01:00
|
|
|
|
2012-04-01 16:36:38 +02:00
|
|
|
SideBar* addSideBar();
|
2012-01-09 22:14:02 +01:00
|
|
|
virtual QMenuBar* menuBar() const;
|
|
|
|
|
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;
|
|
|
|
LocationBar* locationBar() const;
|
2012-09-06 11:39:42 +02:00
|
|
|
|
2013-02-09 13:00:45 +01:00
|
|
|
TabWidget* tabWidget() { return m_tabWidget; }
|
|
|
|
BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; }
|
|
|
|
StatusBarMessage* statusBarMessage() { return m_statusBarMessage; }
|
|
|
|
NavigationBar* navigationBar() { return m_navigationBar; }
|
|
|
|
SideBarManager* sideBarManager() { return m_sideBarManager; }
|
|
|
|
ProgressBar* progressBar() { return m_progressBar; }
|
|
|
|
QLabel* ipLabel() { return m_ipLabel; }
|
|
|
|
AdBlockIcon* adBlockIcon() { return m_adblockIcon; }
|
|
|
|
QAction* actionRestoreTab() { return m_actionRestoreTab; }
|
|
|
|
QAction* actionReload() { return m_actionReload; }
|
2013-02-09 14:08:12 +01:00
|
|
|
QMenu* menuHelp() { return m_menuHelp; }
|
2013-02-09 13:00:45 +01:00
|
|
|
QMenu* superMenu() { return m_superMenu; }
|
|
|
|
|
2013-02-09 14:08:12 +01:00
|
|
|
QWidget* navigationContainer() const;
|
|
|
|
void popupToolbarsMenu(const QPoint &pos);
|
2013-02-09 13:00:45 +01:00
|
|
|
|
|
|
|
bool isClosing() { return m_isClosing; }
|
|
|
|
QUrl homepageUrl() { return m_homepage; }
|
2011-10-31 21:27:52 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
signals:
|
|
|
|
void startingCompleted();
|
2012-01-21 23:19:38 +01:00
|
|
|
void message(Qz::AppMessageType mes, bool state);
|
2011-04-22 07:45:15 +02:00
|
|
|
void setWebViewMouseTracking(bool state);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
public slots:
|
2011-09-17 11:13:38 +02:00
|
|
|
void setWindowTitle(const QString &t);
|
|
|
|
|
2012-02-04 18:45:59 +01:00
|
|
|
void showWebInspector(bool toggle = true);
|
2011-04-09 00:22:50 +02:00
|
|
|
void showBookmarksToolbar();
|
2013-02-07 14:01:01 +01:00
|
|
|
void loadActionUrl(QObject* obj = 0);
|
|
|
|
void loadActionUrlInNewTab(QObject* obj = 0);
|
|
|
|
void loadActionUrlInNewNotSelectedTab(QObject* obj = 0);
|
2011-12-20 18:58:42 +01:00
|
|
|
void loadFolderBookmarks(Menu* menu);
|
2011-12-16 20:17:17 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void bookmarkPage();
|
2011-07-31 00:50:40 +02:00
|
|
|
void loadAddress(const QUrl &url);
|
2012-09-02 11:42:41 +02:00
|
|
|
void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString());
|
2012-01-02 13:56:52 +01:00
|
|
|
void printPage(QWebFrame* frame = 0);
|
2011-03-02 16:57:41 +01:00
|
|
|
void showPageInfo();
|
2012-01-21 23:19:38 +01:00
|
|
|
void receiveMessage(Qz::AppMessageType mes, bool state);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void postLaunch();
|
2012-01-21 23:19:38 +01:00
|
|
|
void goNext();
|
|
|
|
void goBack();
|
2011-10-26 19:23:50 +02:00
|
|
|
void goHome();
|
|
|
|
void goHomeInNewTab();
|
2012-01-21 23:19:38 +01:00
|
|
|
void stop();
|
|
|
|
void reload();
|
|
|
|
void reloadByPassCache();
|
2011-03-02 16:57:41 +01:00
|
|
|
void aboutQupZilla();
|
2012-01-21 23:19:38 +01:00
|
|
|
void addTab();
|
2011-09-21 14:20:49 +02:00
|
|
|
void savePageScreen();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-12-17 15:09:17 +01:00
|
|
|
void aboutToShowFileMenu();
|
|
|
|
void aboutToHideFileMenu();
|
2012-01-26 16:22:09 +01:00
|
|
|
void aboutToShowHistoryMenu();
|
2011-11-06 12:05:16 +01:00
|
|
|
void aboutToHideHistoryMenu();
|
2011-07-28 12:12:00 +02:00
|
|
|
void aboutToShowClosedTabsMenu();
|
2011-03-02 16:57:41 +01:00
|
|
|
void aboutToShowBookmarksMenu();
|
|
|
|
void aboutToShowViewMenu();
|
2013-01-26 21:58:09 +01:00
|
|
|
void aboutToHideViewMenu();
|
2011-12-17 15:09:17 +01:00
|
|
|
void aboutToShowEditMenu();
|
|
|
|
void aboutToHideEditMenu();
|
2013-01-26 21:58:09 +01:00
|
|
|
void aboutToShowToolsMenu();
|
|
|
|
void aboutToHideToolsMenu();
|
2011-03-17 20:46:53 +01:00
|
|
|
void aboutToShowEncodingMenu();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
void searchOnPage();
|
|
|
|
void showCookieManager();
|
|
|
|
void showHistoryManager();
|
|
|
|
void showBookmarksManager();
|
|
|
|
void showRSSManager();
|
|
|
|
void showDownloadManager();
|
|
|
|
void showMenubar();
|
|
|
|
void showNavigationToolbar();
|
|
|
|
void showStatusbar();
|
|
|
|
void showClearPrivateData();
|
2012-01-23 00:14:01 +01:00
|
|
|
void aboutToShowHistoryRecentMenu();
|
|
|
|
void aboutToShowHistoryMostMenu();
|
2011-03-02 16:57:41 +01:00
|
|
|
void showPreferences();
|
2011-10-22 22:29:33 +02:00
|
|
|
void showBookmarkImport();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-09-11 19:15:06 +02:00
|
|
|
void refreshHistory();
|
2011-03-02 16:57:41 +01:00
|
|
|
void bookmarkAllTabs();
|
2012-01-21 23:19:38 +01:00
|
|
|
void newWindow();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-12-16 19:07:36 +01:00
|
|
|
void openLocation();
|
2011-03-02 16:57:41 +01:00
|
|
|
void openFile();
|
|
|
|
void savePage();
|
2011-12-16 20:17:17 +01:00
|
|
|
void sendLink();
|
2011-09-11 19:15:06 +02:00
|
|
|
void webSearch();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-02-01 15:37:45 +01:00
|
|
|
// Edit menu actions
|
|
|
|
void editUndo();
|
|
|
|
void editRedo();
|
|
|
|
void editCut();
|
|
|
|
void editCopy();
|
|
|
|
void editPaste();
|
|
|
|
void editSelectAll();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-01-21 23:19:38 +01:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
void zoomReset();
|
2011-03-02 16:57:41 +01:00
|
|
|
void fullScreen(bool make);
|
2013-02-09 13:00:45 +01:00
|
|
|
void changeEncoding(QObject* obj = 0);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-12-22 13:52:46 +01:00
|
|
|
void triggerCaretBrowsing();
|
2013-02-09 13:00:45 +01:00
|
|
|
void triggerTabsOnTop(bool enable);
|
2012-12-22 13:52:46 +01:00
|
|
|
|
2012-02-01 17:01:08 +01:00
|
|
|
void closeWindow();
|
2011-03-05 13:16:13 +01:00
|
|
|
bool quitApp();
|
2013-02-07 15:01:25 +01:00
|
|
|
void closeTab();
|
|
|
|
void restoreClosedTab(QObject* obj = 0);
|
|
|
|
void restoreAllClosedTabs();
|
|
|
|
void clearClosedTabsList();
|
2012-09-03 22:48:52 +02:00
|
|
|
#ifdef Q_OS_WIN
|
2012-08-30 10:46:58 +02:00
|
|
|
void applyBlurToMainWindow(bool force = false);
|
|
|
|
#endif
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
private:
|
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);
|
|
|
|
|
2013-01-25 19:52:30 +01:00
|
|
|
SearchToolBar* searchToolBar();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void setupUi();
|
|
|
|
void setupMenu();
|
2013-02-08 15:21:00 +01:00
|
|
|
void setupOtherActions();
|
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
void setupMacMenu();
|
|
|
|
#endif
|
2011-09-11 19:15:06 +02:00
|
|
|
|
2012-01-14 11:46:06 +01:00
|
|
|
void disconnectObjects();
|
2012-09-06 11:39:42 +02:00
|
|
|
|
2012-09-03 22:48:52 +02:00
|
|
|
#ifdef Q_OS_WIN
|
2013-01-19 23:22:30 +01:00
|
|
|
#if (QT_VERSION < 0x050000)
|
2012-08-30 10:46:58 +02:00
|
|
|
bool winEvent(MSG* message, long* result);
|
2013-01-19 23:22:30 +01:00
|
|
|
#else
|
|
|
|
bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
|
|
|
|
#endif
|
2012-08-31 15:19:07 +02:00
|
|
|
bool eventFilter(QObject* object, QEvent* event);
|
2012-08-30 10:46:58 +02:00
|
|
|
#endif
|
2012-09-06 11:39:42 +02:00
|
|
|
|
2012-12-22 15:01:55 +01:00
|
|
|
#ifdef QZ_WS_X11
|
2012-09-06 11:39:42 +02:00
|
|
|
int getCurrentVirtualDesktop() const;
|
|
|
|
void moveToVirtualDesktop(int desktopId);
|
|
|
|
#endif
|
2012-01-10 18:31:38 +01:00
|
|
|
|
2013-02-08 14:07:51 +01:00
|
|
|
bool bookmarksMenuChanged();
|
|
|
|
void setBookmarksMenuChanged(bool changed);
|
|
|
|
|
|
|
|
QAction* menuBookmarksAction();
|
|
|
|
void setMenuBookmarksAction(QAction* action);
|
|
|
|
|
2011-07-28 12:12:00 +02:00
|
|
|
bool m_historyMenuChanged;
|
2011-07-30 17:57:14 +02:00
|
|
|
bool m_bookmarksMenuChanged;
|
2011-10-31 21:27:52 +01:00
|
|
|
bool m_isClosing;
|
2012-03-13 17:51:37 +01:00
|
|
|
bool m_isStarting;
|
2011-03-02 16:57:41 +01:00
|
|
|
QUrl m_startingUrl;
|
|
|
|
QUrl m_homepage;
|
2012-01-21 23:19:38 +01:00
|
|
|
Qz::BrowserWindow m_startBehaviour;
|
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
|
|
|
QMenu* m_superMenu;
|
|
|
|
QMenu* m_menuFile;
|
|
|
|
QMenu* m_menuEdit;
|
|
|
|
QMenu* m_menuTools;
|
|
|
|
QMenu* m_menuHelp;
|
|
|
|
QMenu* m_menuView;
|
2013-02-09 14:08:12 +01:00
|
|
|
QMenu* m_toolbarsMenu;
|
2011-12-13 19:18:05 +01:00
|
|
|
Menu* m_menuBookmarks;
|
|
|
|
Menu* m_menuHistory;
|
2011-07-28 12:12:00 +02:00
|
|
|
QMenu* m_menuClosedTabs;
|
2012-01-23 17:30:34 +01:00
|
|
|
Menu* m_menuHistoryRecent;
|
|
|
|
Menu* m_menuHistoryMost;
|
2011-03-17 17:03:04 +01:00
|
|
|
QMenu* m_menuEncoding;
|
2011-12-08 18:11:05 +01:00
|
|
|
QAction* m_menuBookmarksAction;
|
2011-12-17 15:09:17 +01:00
|
|
|
|
2012-01-08 11:38:15 +01:00
|
|
|
QAction* m_actionAbout;
|
|
|
|
QAction* m_actionPreferences;
|
|
|
|
QAction* m_actionQuit;
|
|
|
|
|
2011-12-17 15:09:17 +01:00
|
|
|
QAction* m_actionCloseWindow;
|
2011-03-02 16:57:41 +01:00
|
|
|
QAction* m_actionShowToolbar;
|
|
|
|
QAction* m_actionShowBookmarksToolbar;
|
|
|
|
QAction* m_actionShowStatusbar;
|
2012-09-03 22:48:52 +02:00
|
|
|
#ifndef Q_OS_MAC
|
2011-03-02 16:57:41 +01:00
|
|
|
QAction* m_actionShowMenubar;
|
2012-01-26 16:22:09 +01:00
|
|
|
#endif
|
2013-02-09 13:00:45 +01:00
|
|
|
QAction* m_actionTabsOnTop;
|
2011-03-02 16:57:41 +01:00
|
|
|
QAction* m_actionShowFullScreen;
|
2011-04-20 21:39:35 +02:00
|
|
|
QAction* m_actionShowBookmarksSideBar;
|
|
|
|
QAction* m_actionShowHistorySideBar;
|
|
|
|
QAction* m_actionShowRssSideBar;
|
2011-03-02 16:57:41 +01:00
|
|
|
QAction* m_actionPrivateBrowsing;
|
|
|
|
QAction* m_actionStop;
|
|
|
|
QAction* m_actionReload;
|
2012-12-22 13:52:46 +01:00
|
|
|
QAction* m_actionCaretBrowsing;
|
2011-05-07 12:59:53 +02:00
|
|
|
QAction* m_actionRestoreTab;
|
2013-01-26 21:58:09 +01:00
|
|
|
QAction* m_actionPageInfo;
|
|
|
|
QAction* m_actionPageSource;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
QLabel* m_privateBrowsing;
|
2011-10-15 16:37:32 +02:00
|
|
|
AdBlockIcon* m_adblockIcon;
|
2012-12-20 14:45:35 +01:00
|
|
|
QPointer<WebInspectorDockWidget> m_webInspectorDock;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2013-02-09 13:00:45 +01:00
|
|
|
QWidget* m_navigationContainer;
|
2011-03-02 16:57:41 +01:00
|
|
|
BookmarksToolbar* m_bookmarksToolbar;
|
|
|
|
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;
|
2011-09-11 19:15:06 +02:00
|
|
|
NavigationBar* m_navigationBar;
|
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;
|
|
|
|
|
2012-03-13 17:51:37 +01:00
|
|
|
QString m_lastWindowTitle;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-01-14 11:46:06 +01:00
|
|
|
int m_sideBarWidth;
|
|
|
|
int m_webViewWidth;
|
2011-12-26 21:23:21 +01:00
|
|
|
bool m_usingTransparentBackground;
|
2011-10-17 09:59:09 +02:00
|
|
|
|
2012-11-28 11:27:30 +01:00
|
|
|
// Shortcuts
|
|
|
|
bool m_useTabNumberShortcuts;
|
|
|
|
bool m_useSpeedDialNumberShortcuts;
|
|
|
|
|
|
|
|
// Used for F11 FullScreen remember visibility
|
|
|
|
// of menubar and statusbar
|
2011-03-02 16:57:41 +01:00
|
|
|
bool m_menuBarVisible;
|
|
|
|
bool m_statusBarVisible;
|
2011-04-22 07:45:15 +02:00
|
|
|
bool m_navigationVisible;
|
|
|
|
bool m_bookmarksToolBarVisible;
|
2012-01-21 20:27:45 +01:00
|
|
|
|
2012-12-20 14:45:35 +01:00
|
|
|
QList<QPointer<QWidget> > m_deleteOnCloseWidgets;
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QUPZILLA_H
|