1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

[Cleanup] Renamed QupZilla class to BrowserWindow

This commit is contained in:
nowrep 2014-02-19 22:07:21 +01:00
parent 118478351f
commit 404fa68a1b
129 changed files with 720 additions and 713 deletions

View File

@ -20,7 +20,7 @@
#include "adblockmanager.h" #include "adblockmanager.h"
#include "adblocksubscription.h" #include "adblocksubscription.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "webpage.h" #include "webpage.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "tabwidget.h" #include "tabwidget.h"
@ -29,9 +29,9 @@
#include <QMenu> #include <QMenu>
#include <QTimer> #include <QTimer>
AdBlockIcon::AdBlockIcon(QupZilla* mainClass, QWidget* parent) AdBlockIcon::AdBlockIcon(BrowserWindow* window, QWidget* parent)
: ClickableLabel(parent) : ClickableLabel(parent)
, p_QupZilla(mainClass) , m_window(window)
, m_menuAction(0) , m_menuAction(0)
, m_flashTimer(0) , m_flashTimer(0)
, m_timerTicks(0) , m_timerTicks(0)
@ -104,7 +104,7 @@ void AdBlockIcon::createMenu(QMenu* menu)
AdBlockManager* manager = AdBlockManager::instance(); AdBlockManager* manager = AdBlockManager::instance();
AdBlockCustomList* customList = manager->customList(); AdBlockCustomList* customList = manager->customList();
WebPage* page = p_QupZilla->weView()->page(); WebPage* page = m_window->weView()->page();
const QUrl pageUrl = page->url(); const QUrl pageUrl = page->url();
menu->addAction(tr("Show AdBlock &Settings"), manager, SLOT(showDialog())); menu->addAction(tr("Show AdBlock &Settings"), manager, SLOT(showDialog()));

View File

@ -25,13 +25,13 @@
class QMenu; class QMenu;
class QUrl; class QUrl;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT AdBlockIcon : public ClickableLabel class QT_QUPZILLA_EXPORT AdBlockIcon : public ClickableLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AdBlockIcon(QupZilla* mainClass, QWidget* parent = 0); explicit AdBlockIcon(BrowserWindow* window, QWidget* parent = 0);
~AdBlockIcon(); ~AdBlockIcon();
void popupBlocked(const QString &ruleString, const QUrl &url); void popupBlocked(const QString &ruleString, const QUrl &url);
@ -51,7 +51,7 @@ private slots:
void stopAnimation(); void stopAnimation();
private: private:
QupZilla* p_QupZilla; BrowserWindow* m_window;
QAction* m_menuAction; QAction* m_menuAction;
QVector<QPair<AdBlockRule, QUrl> > m_blockedPopups; QVector<QPair<AdBlockRule, QUrl> > m_blockedPopups;

View File

@ -23,7 +23,7 @@
#include "webpage.h" #include "webpage.h"
#include "qztools.h" #include "qztools.h"
#include "networkmanager.h" #include "networkmanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "settings.h" #include "settings.h"
#include <QDateTime> #include <QDateTime>

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "tabbar.h" #include "tabbar.h"
#include "webpage.h" #include "webpage.h"
@ -106,15 +106,9 @@
#define MENU_RECEIVER mApp->macMenuReceiver() #define MENU_RECEIVER mApp->macMenuReceiver()
#endif #endif
const QString QupZilla::VERSION = "1.7.0"; const QString BrowserWindow::WEBKITVERSION = qWebKitVersion();
const QString QupZilla::BUILDTIME = __DATE__" "__TIME__;
const QString QupZilla::AUTHOR = "David Rosca";
const QString QupZilla::COPYRIGHT = "2010-2014";
const QString QupZilla::WWWADDRESS = "http://www.qupzilla.com";
const QString QupZilla::WIKIADDRESS = "https://github.com/QupZilla/qupzilla/wiki";
const QString QupZilla::WEBKITVERSION = qWebKitVersion();
QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, QUrl startUrl)
: QMainWindow(0) : QMainWindow(0)
, m_historyMenuChanged(true) , m_historyMenuChanged(true)
, m_bookmarksMenuChanged(true) , m_bookmarksMenuChanged(true)
@ -164,12 +158,12 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
} }
} }
void QupZilla::openWithTab(WebTab* tab) void BrowserWindow::openWithTab(WebTab* tab)
{ {
m_startTab = tab; m_startTab = tab;
} }
void QupZilla::postLaunch() void BrowserWindow::postLaunch()
{ {
#ifdef QZ_WS_X11 #ifdef QZ_WS_X11
setUpdatesEnabled(false); setUpdatesEnabled(false);
@ -280,7 +274,7 @@ void QupZilla::postLaunch()
QTimer::singleShot(0, tabWidget()->getTabBar(), SLOT(ensureVisible())); QTimer::singleShot(0, tabWidget()->getTabBar(), SLOT(ensureVisible()));
} }
void QupZilla::setupUi() void BrowserWindow::setupUi()
{ {
int locationBarWidth; int locationBarWidth;
int websearchBarWidth; int websearchBarWidth;
@ -377,7 +371,7 @@ void QupZilla::setupUi()
QToolTip::setPalette(pal); QToolTip::setPalette(pal);
} }
void QupZilla::setupMenu() void BrowserWindow::setupMenu()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
if (menuBar()) { if (menuBar()) {
@ -674,7 +668,7 @@ void QupZilla::setupMenu()
#endif #endif
} }
void QupZilla::setupOtherActions() void BrowserWindow::setupOtherActions()
{ {
m_actionRestoreTab = new QAction(QIcon::fromTheme("user-trash"), tr("Restore &Closed Tab"), this); m_actionRestoreTab = new QAction(QIcon::fromTheme("user-trash"), tr("Restore &Closed Tab"), this);
m_actionRestoreTab->setShortcut(QKeySequence("Ctrl+Shift+T")); m_actionRestoreTab->setShortcut(QKeySequence("Ctrl+Shift+T"));
@ -708,7 +702,7 @@ void QupZilla::setupOtherActions()
} }
} }
QKeySequence QupZilla::actionShortcut(QKeySequence shortcut, QKeySequence fallBack, QKeySequence BrowserWindow::actionShortcut(QKeySequence shortcut, QKeySequence fallBack,
QKeySequence shortcutRTL, QKeySequence fallbackRTL) QKeySequence shortcutRTL, QKeySequence fallbackRTL)
{ {
if (isRightToLeft() && (!shortcutRTL.isEmpty() || !fallbackRTL.isEmpty())) { if (isRightToLeft() && (!shortcutRTL.isEmpty() || !fallbackRTL.isEmpty())) {
@ -769,7 +763,7 @@ void QupZilla::refreshStateOfAllActions()
} }
#endif #endif
void QupZilla::loadSettings() void BrowserWindow::loadSettings()
{ {
Settings settings; Settings settings;
@ -881,17 +875,17 @@ void QupZilla::loadSettings()
#endif #endif
} }
void QupZilla::goNext() void BrowserWindow::goNext()
{ {
weView()->forward(); weView()->forward();
} }
void QupZilla::goBack() void BrowserWindow::goBack()
{ {
weView()->back(); weView()->back();
} }
QMenuBar* QupZilla::menuBar() const QMenuBar* BrowserWindow::menuBar() const
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
return mApp->macMenuReceiver()->menuBar(); return mApp->macMenuReceiver()->menuBar();
@ -900,12 +894,12 @@ QMenuBar* QupZilla::menuBar() const
#endif #endif
} }
TabbedWebView* QupZilla::weView() const TabbedWebView* BrowserWindow::weView() const
{ {
return weView(m_tabWidget->currentIndex()); return weView(m_tabWidget->currentIndex());
} }
TabbedWebView* QupZilla::weView(int index) const TabbedWebView* BrowserWindow::weView(int index) const
{ {
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index)); WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
if (!webTab) { if (!webTab) {
@ -915,29 +909,29 @@ TabbedWebView* QupZilla::weView(int index) const
return webTab->view(); return webTab->view();
} }
LocationBar* QupZilla::locationBar() const LocationBar* BrowserWindow::locationBar() const
{ {
return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget()); return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget());
} }
Qz::BrowserWindow QupZilla::windowType() const Qz::BrowserWindowType BrowserWindow::windowType() const
{ {
return m_windowType; return m_windowType;
} }
void QupZilla::popupToolbarsMenu(const QPoint &pos) void BrowserWindow::popupToolbarsMenu(const QPoint &pos)
{ {
aboutToShowViewMenu(); aboutToShowViewMenu();
m_toolbarsMenu->exec(pos); m_toolbarsMenu->exec(pos);
aboutToHideViewMenu(); aboutToHideViewMenu();
} }
bool QupZilla::isTransparentBackgroundAllowed() bool BrowserWindow::isTransparentBackgroundAllowed()
{ {
return m_usingTransparentBackground && !isFullScreen(); return m_usingTransparentBackground && !isFullScreen();
} }
bool QupZilla::tabsOnTop() const bool BrowserWindow::tabsOnTop() const
{ {
if (m_tabsOnTopState == -1) { if (m_tabsOnTopState == -1) {
m_tabsOnTopState = qzSettings->tabsOnTop ? 1 : 0; m_tabsOnTopState = qzSettings->tabsOnTop ? 1 : 0;
@ -946,7 +940,7 @@ bool QupZilla::tabsOnTop() const
return m_tabsOnTopState == 1; return m_tabsOnTopState == 1;
} }
void QupZilla::setWindowTitle(const QString &t) void BrowserWindow::setWindowTitle(const QString &t)
{ {
QString title = t; QString title = t;
@ -962,7 +956,7 @@ void QupZilla::setWindowTitle(const QString &t)
QMainWindow::setWindowTitle(title); QMainWindow::setWindowTitle(title);
} }
void QupZilla::receiveMessage(Qz::AppMessageType mes, bool state) void BrowserWindow::receiveMessage(Qz::AppMessageType mes, bool state)
{ {
switch (mes) { switch (mes) {
case Qz::AM_SetAdBlockIconEnabled: case Qz::AM_SetAdBlockIconEnabled:
@ -994,19 +988,19 @@ void QupZilla::receiveMessage(Qz::AppMessageType mes, bool state)
} }
} }
void QupZilla::aboutToShowFileMenu() void BrowserWindow::aboutToShowFileMenu()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
m_actionCloseWindow->setEnabled(mApp->windowCount() > 1); m_actionCloseWindow->setEnabled(mApp->windowCount() > 1);
#endif #endif
} }
void QupZilla::aboutToHideFileMenu() void BrowserWindow::aboutToHideFileMenu()
{ {
m_actionCloseWindow->setEnabled(true); m_actionCloseWindow->setEnabled(true);
} }
void QupZilla::aboutToShowHistoryMenu() void BrowserWindow::aboutToShowHistoryMenu()
{ {
TabbedWebView* view = weView(); TabbedWebView* view = weView();
if (!view) { if (!view) {
@ -1017,13 +1011,13 @@ void QupZilla::aboutToShowHistoryMenu()
m_menuHistory->actions().at(1)->setEnabled(view->history()->canGoForward()); m_menuHistory->actions().at(1)->setEnabled(view->history()->canGoForward());
} }
void QupZilla::aboutToHideHistoryMenu() void BrowserWindow::aboutToHideHistoryMenu()
{ {
m_menuHistory->actions().at(0)->setEnabled(true); m_menuHistory->actions().at(0)->setEnabled(true);
m_menuHistory->actions().at(1)->setEnabled(true); m_menuHistory->actions().at(1)->setEnabled(true);
} }
void QupZilla::aboutToShowClosedTabsMenu() void BrowserWindow::aboutToShowClosedTabsMenu()
{ {
m_menuClosedTabs->clear(); m_menuClosedTabs->clear();
int i = 0; int i = 0;
@ -1046,7 +1040,7 @@ void QupZilla::aboutToShowClosedTabsMenu()
} }
} }
void QupZilla::aboutToShowHistoryRecentMenu() void BrowserWindow::aboutToShowHistoryRecentMenu()
{ {
m_menuHistoryRecent->clear(); m_menuHistoryRecent->clear();
QSqlQuery query; QSqlQuery query;
@ -1071,7 +1065,7 @@ void QupZilla::aboutToShowHistoryRecentMenu()
} }
} }
void QupZilla::aboutToShowHistoryMostMenu() void BrowserWindow::aboutToShowHistoryMostMenu()
{ {
m_menuHistoryMost->clear(); m_menuHistoryMost->clear();
@ -1096,7 +1090,7 @@ void QupZilla::aboutToShowHistoryMostMenu()
} }
} }
void QupZilla::aboutToShowViewMenu() void BrowserWindow::aboutToShowViewMenu()
{ {
m_actionShowToolbar->setChecked(m_navigationBar->isVisible()); m_actionShowToolbar->setChecked(m_navigationBar->isVisible());
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
@ -1116,14 +1110,14 @@ void QupZilla::aboutToShowViewMenu()
#endif #endif
} }
void QupZilla::aboutToHideViewMenu() void BrowserWindow::aboutToHideViewMenu()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
m_actionPageSource->setEnabled(false); m_actionPageSource->setEnabled(false);
#endif #endif
} }
void QupZilla::aboutToShowEditMenu() void BrowserWindow::aboutToShowEditMenu()
{ {
WebView* view = weView(); WebView* view = weView();
@ -1137,7 +1131,7 @@ void QupZilla::aboutToShowEditMenu()
m_menuEdit->actions().at(7)->setEnabled(view->pageAction(QWebPage::SelectAll)->isEnabled()); m_menuEdit->actions().at(7)->setEnabled(view->pageAction(QWebPage::SelectAll)->isEnabled());
} }
void QupZilla::aboutToHideEditMenu() void BrowserWindow::aboutToHideEditMenu()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
foreach (QAction* act, m_menuEdit->actions()) { foreach (QAction* act, m_menuEdit->actions()) {
@ -1149,19 +1143,19 @@ void QupZilla::aboutToHideEditMenu()
m_actionPreferences->setEnabled(true); m_actionPreferences->setEnabled(true);
} }
void QupZilla::aboutToShowToolsMenu() void BrowserWindow::aboutToShowToolsMenu()
{ {
m_actionPageInfo->setEnabled(true); m_actionPageInfo->setEnabled(true);
} }
void QupZilla::aboutToHideToolsMenu() void BrowserWindow::aboutToHideToolsMenu()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
m_actionPageInfo->setEnabled(false); m_actionPageInfo->setEnabled(false);
#endif #endif
} }
void QupZilla::aboutToShowEncodingMenu() void BrowserWindow::aboutToShowEncodingMenu()
{ {
m_menuEncoding->clear(); m_menuEncoding->clear();
QMenu* menuISO = new QMenu("ISO", this); QMenu* menuISO = new QMenu("ISO", this);
@ -1228,7 +1222,7 @@ void QupZilla::aboutToShowEncodingMenu()
} }
} }
void QupZilla::changeEncoding(QObject* obj) void BrowserWindow::changeEncoding(QObject* obj)
{ {
if (!obj) { if (!obj) {
obj = sender(); obj = sender();
@ -1245,7 +1239,7 @@ void QupZilla::changeEncoding(QObject* obj)
} }
} }
void QupZilla::triggerCaretBrowsing() void BrowserWindow::triggerCaretBrowsing()
{ {
#if QTWEBKIT_FROM_2_3 #if QTWEBKIT_FROM_2_3
bool enable = !mApp->webSettings()->testAttribute(QWebSettings::CaretBrowsingEnabled); bool enable = !mApp->webSettings()->testAttribute(QWebSettings::CaretBrowsingEnabled);
@ -1259,98 +1253,98 @@ void QupZilla::triggerCaretBrowsing()
#endif #endif
} }
void QupZilla::bookmarkPage() void BrowserWindow::bookmarkPage()
{ {
TabbedWebView* view = weView(); TabbedWebView* view = weView();
BookmarksTools::addBookmarkDialog(this, view->url(), view->title()); BookmarksTools::addBookmarkDialog(this, view->url(), view->title());
} }
void QupZilla::bookmarkAllTabs() void BrowserWindow::bookmarkAllTabs()
{ {
BookmarksTools::bookmarkAllTabsDialog(this, m_tabWidget); BookmarksTools::bookmarkAllTabsDialog(this, m_tabWidget);
} }
void QupZilla::addBookmark(const QUrl &url, const QString &title) void BrowserWindow::addBookmark(const QUrl &url, const QString &title)
{ {
BookmarksTools::addBookmarkDialog(this, url, title); BookmarksTools::addBookmarkDialog(this, url, title);
} }
void QupZilla::newWindow() void BrowserWindow::newWindow()
{ {
mApp->makeNewWindow(Qz::BW_NewWindow); mApp->makeNewWindow(Qz::BW_NewWindow);
} }
void QupZilla::goHome() void BrowserWindow::goHome()
{ {
loadAddress(m_homepage); loadAddress(m_homepage);
} }
void QupZilla::editUndo() void BrowserWindow::editUndo()
{ {
weView()->triggerPageAction(QWebPage::Undo); weView()->triggerPageAction(QWebPage::Undo);
} }
void QupZilla::editRedo() void BrowserWindow::editRedo()
{ {
weView()->triggerPageAction(QWebPage::Redo); weView()->triggerPageAction(QWebPage::Redo);
} }
void QupZilla::editCut() void BrowserWindow::editCut()
{ {
weView()->triggerPageAction(QWebPage::Cut); weView()->triggerPageAction(QWebPage::Cut);
} }
void QupZilla::editCopy() void BrowserWindow::editCopy()
{ {
weView()->triggerPageAction(QWebPage::Copy); weView()->triggerPageAction(QWebPage::Copy);
} }
void QupZilla::editPaste() void BrowserWindow::editPaste()
{ {
weView()->triggerPageAction(QWebPage::Paste); weView()->triggerPageAction(QWebPage::Paste);
} }
void QupZilla::editSelectAll() void BrowserWindow::editSelectAll()
{ {
weView()->selectAll(); weView()->selectAll();
} }
void QupZilla::zoomIn() void BrowserWindow::zoomIn()
{ {
weView()->zoomIn(); weView()->zoomIn();
} }
void QupZilla::zoomOut() void BrowserWindow::zoomOut()
{ {
weView()->zoomOut(); weView()->zoomOut();
} }
void QupZilla::zoomReset() void BrowserWindow::zoomReset()
{ {
weView()->zoomReset(); weView()->zoomReset();
} }
void QupZilla::goHomeInNewTab() void BrowserWindow::goHomeInNewTab()
{ {
m_tabWidget->addView(m_homepage, Qz::NT_SelectedTab); m_tabWidget->addView(m_homepage, Qz::NT_SelectedTab);
} }
void QupZilla::stop() void BrowserWindow::stop()
{ {
weView()->stop(); weView()->stop();
} }
void QupZilla::reload() void BrowserWindow::reload()
{ {
weView()->reload(); weView()->reload();
} }
void QupZilla::reloadByPassCache() void BrowserWindow::reloadByPassCache()
{ {
weView()->triggerPageAction(QWebPage::ReloadAndBypassCache); weView()->triggerPageAction(QWebPage::ReloadAndBypassCache);
} }
void QupZilla::loadActionUrl(QObject* obj) void BrowserWindow::loadActionUrl(QObject* obj)
{ {
if (!obj) { if (!obj) {
obj = sender(); obj = sender();
@ -1361,7 +1355,7 @@ void QupZilla::loadActionUrl(QObject* obj)
} }
} }
void QupZilla::loadActionUrlInNewTab(QObject* obj) void BrowserWindow::loadActionUrlInNewTab(QObject* obj)
{ {
if (!obj) { if (!obj) {
obj = sender(); obj = sender();
@ -1372,7 +1366,7 @@ void QupZilla::loadActionUrlInNewTab(QObject* obj)
} }
} }
void QupZilla::loadActionUrlInNewNotSelectedTab(QObject* obj) void BrowserWindow::loadActionUrlInNewNotSelectedTab(QObject* obj)
{ {
if (!obj) { if (!obj) {
obj = sender(); obj = sender();
@ -1383,7 +1377,7 @@ void QupZilla::loadActionUrlInNewNotSelectedTab(QObject* obj)
} }
} }
void QupZilla::loadAddress(const QUrl &url) void BrowserWindow::loadAddress(const QUrl &url)
{ {
if (weView()->webTab()->isPinned()) { if (weView()->webTab()->isPinned()) {
int index = m_tabWidget->addView(url, qzSettings->newTabPosition); int index = m_tabWidget->addView(url, qzSettings->newTabPosition);
@ -1395,7 +1389,7 @@ void QupZilla::loadAddress(const QUrl &url)
} }
} }
void QupZilla::showCookieManager() void BrowserWindow::showCookieManager()
{ {
CookieManager* m = mApp->cookieManager(); CookieManager* m = mApp->cookieManager();
m->refreshTable(); m->refreshTable();
@ -1405,39 +1399,39 @@ void QupZilla::showCookieManager()
} }
void QupZilla::showHistoryManager() void BrowserWindow::showHistoryManager()
{ {
mApp->browsingLibrary()->showHistory(this); mApp->browsingLibrary()->showHistory(this);
} }
void QupZilla::showRSSManager() void BrowserWindow::showRSSManager()
{ {
mApp->browsingLibrary()->showRSS(this); mApp->browsingLibrary()->showRSS(this);
} }
void QupZilla::showBookmarksManager() void BrowserWindow::showBookmarksManager()
{ {
mApp->browsingLibrary()->showBookmarks(this); mApp->browsingLibrary()->showBookmarks(this);
} }
void QupZilla::showClearPrivateData() void BrowserWindow::showClearPrivateData()
{ {
ClearPrivateData clear(this, this); ClearPrivateData clear(this, this);
clear.exec(); clear.exec();
} }
void QupZilla::showDownloadManager() void BrowserWindow::showDownloadManager()
{ {
mApp->downManager()->show(); mApp->downManager()->show();
} }
void QupZilla::showPreferences() void BrowserWindow::showPreferences()
{ {
Preferences* prefs = new Preferences(this, this); Preferences* prefs = new Preferences(this, this);
prefs->show(); prefs->show();
} }
void QupZilla::showSource(QWebFrame* frame, const QString &selectedHtml) void BrowserWindow::showSource(QWebFrame* frame, const QString &selectedHtml)
{ {
if (!frame) { if (!frame) {
frame = weView()->page()->mainFrame(); frame = weView()->page()->mainFrame();
@ -1448,14 +1442,14 @@ void QupZilla::showSource(QWebFrame* frame, const QString &selectedHtml)
source->show(); source->show();
} }
void QupZilla::showPageInfo() void BrowserWindow::showPageInfo()
{ {
SiteInfo* info = new SiteInfo(weView(), this); SiteInfo* info = new SiteInfo(weView(), this);
info->setAttribute(Qt::WA_DeleteOnClose); info->setAttribute(Qt::WA_DeleteOnClose);
info->show(); info->show();
} }
void QupZilla::showBookmarksToolbar() void BrowserWindow::showBookmarksToolbar()
{ {
bool status = m_bookmarksToolbar->isVisible(); bool status = m_bookmarksToolbar->isVisible();
@ -1467,7 +1461,7 @@ void QupZilla::showBookmarksToolbar()
settings.setValue("Browser-View-Settings/showBookmarksToolbar", !status); settings.setValue("Browser-View-Settings/showBookmarksToolbar", !status);
} }
SideBar* QupZilla::addSideBar() SideBar* BrowserWindow::addSideBar()
{ {
if (m_sideBar) { if (m_sideBar) {
return m_sideBar.data(); return m_sideBar.data();
@ -1490,7 +1484,7 @@ SideBar* QupZilla::addSideBar()
return m_sideBar.data(); return m_sideBar.data();
} }
void QupZilla::saveSideBarWidth() void BrowserWindow::saveSideBarWidth()
{ {
// That +1 is important here, without it, the sidebar width would // That +1 is important here, without it, the sidebar width would
// decrease by 1 pixel every close // decrease by 1 pixel every close
@ -1499,7 +1493,7 @@ void QupZilla::saveSideBarWidth()
m_webViewWidth = width() - m_sideBarWidth; m_webViewWidth = width() - m_sideBarWidth;
} }
void QupZilla::showNavigationToolbar() void BrowserWindow::showNavigationToolbar()
{ {
if (!menuBar()->isVisible() && !m_actionShowToolbar->isChecked()) { if (!menuBar()->isVisible() && !m_actionShowToolbar->isChecked()) {
showMenubar(); showMenubar();
@ -1516,7 +1510,7 @@ void QupZilla::showNavigationToolbar()
setUpdatesEnabled(true); setUpdatesEnabled(true);
} }
void QupZilla::showMenubar() void BrowserWindow::showMenubar()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
if (!m_navigationBar->isVisible() && !m_actionShowMenubar->isChecked()) { if (!m_navigationBar->isVisible() && !m_actionShowMenubar->isChecked()) {
@ -1535,7 +1529,7 @@ void QupZilla::showMenubar()
#endif #endif
} }
void QupZilla::showStatusbar() void BrowserWindow::showStatusbar()
{ {
setUpdatesEnabled(false); setUpdatesEnabled(false);
@ -1548,7 +1542,7 @@ void QupZilla::showStatusbar()
setUpdatesEnabled(true); setUpdatesEnabled(true);
} }
void QupZilla::showWebInspector(bool toggle) void BrowserWindow::showWebInspector(bool toggle)
{ {
if (m_webInspectorDock) { if (m_webInspectorDock) {
if (toggle) { if (toggle) {
@ -1572,13 +1566,13 @@ void QupZilla::showWebInspector(bool toggle)
#endif #endif
} }
void QupZilla::showBookmarkImport() void BrowserWindow::showBookmarkImport()
{ {
BookmarksImportDialog* b = new BookmarksImportDialog(this); BookmarksImportDialog* b = new BookmarksImportDialog(this);
b->show(); b->show();
} }
void QupZilla::triggerTabsOnTop(bool enable) void BrowserWindow::triggerTabsOnTop(bool enable)
{ {
if (enable) { if (enable) {
m_mainLayout->insertWidget(0, m_tabWidget->getTabBar()); m_mainLayout->insertWidget(0, m_tabWidget->getTabBar());
@ -1604,12 +1598,12 @@ void QupZilla::triggerTabsOnTop(bool enable)
#endif #endif
} }
void QupZilla::refreshHistory() void BrowserWindow::refreshHistory()
{ {
m_navigationBar->refreshHistory(); m_navigationBar->refreshHistory();
} }
void QupZilla::currentTabChanged() void BrowserWindow::currentTabChanged()
{ {
TabbedWebView* view = weView(); TabbedWebView* view = weView();
if (!view) { if (!view) {
@ -1632,7 +1626,7 @@ void QupZilla::currentTabChanged()
setTabOrder(m_navigationBar->searchLine(), view); setTabOrder(m_navigationBar->searchLine(), view);
} }
void QupZilla::updateLoadingActions() void BrowserWindow::updateLoadingActions()
{ {
TabbedWebView* view = weView(); TabbedWebView* view = weView();
if (!view) { if (!view) {
@ -1655,37 +1649,37 @@ void QupZilla::updateLoadingActions()
} }
} }
void QupZilla::addDeleteOnCloseWidget(QWidget* widget) void BrowserWindow::addDeleteOnCloseWidget(QWidget* widget)
{ {
if (!m_deleteOnCloseWidgets.contains(widget)) { if (!m_deleteOnCloseWidgets.contains(widget)) {
m_deleteOnCloseWidgets.append(widget); m_deleteOnCloseWidgets.append(widget);
} }
} }
void QupZilla::restoreWindowState(const RestoreManager::WindowData &d) void BrowserWindow::restoreWindowState(const RestoreManager::WindowData &d)
{ {
restoreState(d.windowState); restoreState(d.windowState);
m_tabWidget->restoreState(d.tabsState, d.currentTab); m_tabWidget->restoreState(d.tabsState, d.currentTab);
} }
void QupZilla::aboutQupZilla() void BrowserWindow::aboutQupZilla()
{ {
AboutDialog about(this); AboutDialog about(this);
about.exec(); about.exec();
} }
void QupZilla::addTab() void BrowserWindow::addTab()
{ {
m_tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab, true); m_tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab, true);
} }
void QupZilla::webSearch() void BrowserWindow::webSearch()
{ {
m_navigationBar->searchLine()->setFocus(); m_navigationBar->searchLine()->setFocus();
m_navigationBar->searchLine()->selectAll(); m_navigationBar->searchLine()->selectAll();
} }
void QupZilla::searchOnPage() void BrowserWindow::searchOnPage()
{ {
SearchToolBar* toolBar = searchToolBar(); SearchToolBar* toolBar = searchToolBar();
@ -1706,7 +1700,7 @@ void QupZilla::searchOnPage()
#endif #endif
} }
void QupZilla::openFile() void BrowserWindow::openFile()
{ {
const QString fileTypes = QString("%1(*.html *.htm *.shtml *.shtm *.xhtml);;" const QString fileTypes = QString("%1(*.html *.htm *.shtml *.shtm *.xhtml);;"
"%2(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff);;" "%2(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff);;"
@ -1720,18 +1714,18 @@ void QupZilla::openFile()
} }
} }
void QupZilla::openLocation() void BrowserWindow::openLocation()
{ {
locationBar()->setFocus(); locationBar()->setFocus();
locationBar()->selectAll(); locationBar()->selectAll();
} }
bool QupZilla::fullScreenNavigationVisible() const bool BrowserWindow::fullScreenNavigationVisible() const
{ {
return m_navigationContainer->isVisible(); return m_navigationContainer->isVisible();
} }
void QupZilla::showNavigationWithFullScreen() void BrowserWindow::showNavigationWithFullScreen()
{ {
if (m_hideNavigationTimer->isActive()) { if (m_hideNavigationTimer->isActive()) {
m_hideNavigationTimer->stop(); m_hideNavigationTimer->stop();
@ -1741,14 +1735,14 @@ void QupZilla::showNavigationWithFullScreen()
m_tabWidget->getTabBar()->updateVisibilityWithFullscreen(true); m_tabWidget->getTabBar()->updateVisibilityWithFullscreen(true);
} }
void QupZilla::hideNavigationWithFullScreen() void BrowserWindow::hideNavigationWithFullScreen()
{ {
if (!m_hideNavigationTimer->isActive()) { if (!m_hideNavigationTimer->isActive()) {
m_hideNavigationTimer->start(); m_hideNavigationTimer->start();
} }
} }
void QupZilla::hideNavigationSlot() void BrowserWindow::hideNavigationSlot()
{ {
TabbedWebView* view = weView(); TabbedWebView* view = weView();
bool mouseInView = view && view->underMouse(); bool mouseInView = view && view->underMouse();
@ -1759,7 +1753,7 @@ void QupZilla::hideNavigationSlot()
} }
} }
bool QupZilla::event(QEvent* event) bool BrowserWindow::event(QEvent* event)
{ {
switch (event->type()) { switch (event->type()) {
case QEvent::WindowStateChange: { case QEvent::WindowStateChange: {
@ -1822,7 +1816,7 @@ bool QupZilla::event(QEvent* event)
return QMainWindow::event(event); return QMainWindow::event(event);
} }
void QupZilla::toggleFullScreen() void BrowserWindow::toggleFullScreen()
{ {
if (isFullScreen()) { if (isFullScreen()) {
showNormal(); showNormal();
@ -1832,21 +1826,21 @@ void QupZilla::toggleFullScreen()
} }
} }
void QupZilla::savePage() void BrowserWindow::savePage()
{ {
weView()->savePageAs(); weView()->savePageAs();
} }
void QupZilla::sendLink() void BrowserWindow::sendLink()
{ {
weView()->sendPageByMail(); weView()->sendPageByMail();
} }
void QupZilla::printPage(QWebFrame* frame) void BrowserWindow::printPage(QWebFrame* frame)
{ {
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this); QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
dialog->resize(800, 750); dialog->resize(800, 750);
dialog->printer()->setCreator(tr("QupZilla %1 (%2)").arg(VERSION, WWWADDRESS)); dialog->printer()->setCreator(tr("QupZilla %1 (%2)").arg(Qz::VERSION, Qz::WWWADDRESS));
if (!frame) { if (!frame) {
dialog->printer()->setDocName(QzTools::getFileNameFromUrl(weView()->url())); dialog->printer()->setDocName(QzTools::getFileNameFromUrl(weView()->url()));
@ -1864,20 +1858,20 @@ void QupZilla::printPage(QWebFrame* frame)
dialog->deleteLater(); dialog->deleteLater();
} }
void QupZilla::savePageScreen() void BrowserWindow::savePageScreen()
{ {
PageScreen* p = new PageScreen(weView(), this); PageScreen* p = new PageScreen(weView(), this);
p->show(); p->show();
} }
void QupZilla::resizeEvent(QResizeEvent* event) void BrowserWindow::resizeEvent(QResizeEvent* event)
{ {
m_bookmarksToolbar->setMaximumWidth(width()); m_bookmarksToolbar->setMaximumWidth(width());
QMainWindow::resizeEvent(event); QMainWindow::resizeEvent(event);
} }
void QupZilla::keyPressEvent(QKeyEvent* event) void BrowserWindow::keyPressEvent(QKeyEvent* event)
{ {
if (mApp->plugins()->processKeyPress(Qz::ON_QupZilla, this, event)) { if (mApp->plugins()->processKeyPress(Qz::ON_QupZilla, this, event)) {
return; return;
@ -2057,7 +2051,7 @@ void QupZilla::keyPressEvent(QKeyEvent* event)
QMainWindow::keyPressEvent(event); QMainWindow::keyPressEvent(event);
} }
void QupZilla::keyReleaseEvent(QKeyEvent* event) void BrowserWindow::keyReleaseEvent(QKeyEvent* event)
{ {
if (mApp->plugins()->processKeyRelease(Qz::ON_QupZilla, this, event)) { if (mApp->plugins()->processKeyRelease(Qz::ON_QupZilla, this, event)) {
return; return;
@ -2066,7 +2060,7 @@ void QupZilla::keyReleaseEvent(QKeyEvent* event)
QMainWindow::keyReleaseEvent(event); QMainWindow::keyReleaseEvent(event);
} }
void QupZilla::closeEvent(QCloseEvent* event) void BrowserWindow::closeEvent(QCloseEvent* event)
{ {
if (mApp->isClosing()) { if (mApp->isClosing()) {
return; return;
@ -2121,7 +2115,7 @@ void QupZilla::closeEvent(QCloseEvent* event)
event->accept(); event->accept();
} }
SearchToolBar* QupZilla::searchToolBar() SearchToolBar* BrowserWindow::searchToolBar()
{ {
SearchToolBar* toolBar = 0; SearchToolBar* toolBar = 0;
const int searchPos = 3; const int searchPos = 3;
@ -2133,7 +2127,7 @@ SearchToolBar* QupZilla::searchToolBar()
return toolBar; return toolBar;
} }
void QupZilla::disconnectObjects() void BrowserWindow::disconnectObjects()
{ {
// Disconnecting all important widgets before deleting this window // Disconnecting all important widgets before deleting this window
// so it cannot happen that slots will be invoked after the object // so it cannot happen that slots will be invoked after the object
@ -2164,7 +2158,7 @@ void QupZilla::disconnectObjects()
mApp->plugins()->emitMainWindowDeleted(this); mApp->plugins()->emitMainWindowDeleted(this);
} }
void QupZilla::closeWindow() void BrowserWindow::closeWindow()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
close(); close();
@ -2175,7 +2169,7 @@ void QupZilla::closeWindow()
#endif #endif
} }
bool QupZilla::quitApp() bool BrowserWindow::quitApp()
{ {
if (m_sideBar) { if (m_sideBar) {
saveSideBarWidth(); saveSideBarWidth();
@ -2200,7 +2194,7 @@ bool QupZilla::quitApp()
return true; return true;
} }
void QupZilla::closeTab() void BrowserWindow::closeTab()
{ {
// Don't close pinned tabs with keyboard shortcuts (Ctrl+W, Ctrl+F4) // Don't close pinned tabs with keyboard shortcuts (Ctrl+W, Ctrl+F4)
if (weView() && !weView()->webTab()->isPinned()) { if (weView() && !weView()->webTab()->isPinned()) {
@ -2208,7 +2202,7 @@ void QupZilla::closeTab()
} }
} }
void QupZilla::restoreClosedTab(QObject* obj) void BrowserWindow::restoreClosedTab(QObject* obj)
{ {
if (!obj) { if (!obj) {
obj = sender(); obj = sender();
@ -2216,17 +2210,17 @@ void QupZilla::restoreClosedTab(QObject* obj)
m_tabWidget->restoreClosedTab(obj); m_tabWidget->restoreClosedTab(obj);
} }
void QupZilla::restoreAllClosedTabs() void BrowserWindow::restoreAllClosedTabs()
{ {
m_tabWidget->restoreAllClosedTabs(); m_tabWidget->restoreAllClosedTabs();
} }
void QupZilla::clearClosedTabsList() void BrowserWindow::clearClosedTabsList()
{ {
m_tabWidget->clearClosedTabsList(); m_tabWidget->clearClosedTabsList();
} }
bool QupZilla::bookmarksMenuChanged() bool BrowserWindow::bookmarksMenuChanged()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
return mApp->macMenuReceiver()->bookmarksMenuChanged(); return mApp->macMenuReceiver()->bookmarksMenuChanged();
@ -2235,7 +2229,7 @@ bool QupZilla::bookmarksMenuChanged()
#endif #endif
} }
void QupZilla::setBookmarksMenuChanged(bool changed) void BrowserWindow::setBookmarksMenuChanged(bool changed)
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
mApp->macMenuReceiver()->setBookmarksMenuChanged(changed); mApp->macMenuReceiver()->setBookmarksMenuChanged(changed);
@ -2244,7 +2238,7 @@ void QupZilla::setBookmarksMenuChanged(bool changed)
#endif #endif
} }
QAction* QupZilla::menuBookmarksAction() QAction* BrowserWindow::menuBookmarksAction()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
return mApp->macMenuReceiver()->menuBookmarksAction(); return mApp->macMenuReceiver()->menuBookmarksAction();
@ -2253,7 +2247,7 @@ QAction* QupZilla::menuBookmarksAction()
#endif #endif
} }
void QupZilla::setMenuBookmarksAction(QAction* action) void BrowserWindow::setMenuBookmarksAction(QAction* action)
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
mApp->macMenuReceiver()->setMenuBookmarksAction(action); mApp->macMenuReceiver()->setMenuBookmarksAction(action);
@ -2262,7 +2256,7 @@ void QupZilla::setMenuBookmarksAction(QAction* action)
#endif #endif
} }
QByteArray QupZilla::saveState(int version) const QByteArray BrowserWindow::saveState(int version) const
{ {
#if defined(QZ_WS_X11) && !defined(NO_X11) #if defined(QZ_WS_X11) && !defined(NO_X11)
QByteArray data; QByteArray data;
@ -2277,7 +2271,7 @@ QByteArray QupZilla::saveState(int version) const
#endif #endif
} }
bool QupZilla::restoreState(const QByteArray &state, int version) bool BrowserWindow::restoreState(const QByteArray &state, int version)
{ {
#if defined(QZ_WS_X11) && !defined(NO_X11) #if defined(QZ_WS_X11) && !defined(NO_X11)
QByteArray windowState; QByteArray windowState;
@ -2296,7 +2290,7 @@ bool QupZilla::restoreState(const QByteArray &state, int version)
} }
#if defined(QZ_WS_X11) && !defined(NO_X11) #if defined(QZ_WS_X11) && !defined(NO_X11)
int QupZilla::getCurrentVirtualDesktop() const int BrowserWindow::getCurrentVirtualDesktop() const
{ {
Display* display = static_cast<Display*>(QzTools::X11Display(this)); Display* display = static_cast<Display*>(QzTools::X11Display(this));
Atom actual_type; Atom actual_type;
@ -2324,7 +2318,7 @@ int QupZilla::getCurrentVirtualDesktop() const
return desktop; return desktop;
} }
void QupZilla::moveToVirtualDesktop(int desktopId) void BrowserWindow::moveToVirtualDesktop(int desktopId)
{ {
// Don't move when window is already visible or it is first app window // Don't move when window is already visible or it is first app window
if (desktopId < 0 || isVisible() || m_windowType == Qz::BW_FirstAppWindow) { if (desktopId < 0 || isVisible() || m_windowType == Qz::BW_FirstAppWindow) {
@ -2490,6 +2484,6 @@ bool QupZilla::eventFilter(QObject* object, QEvent* event)
} }
#endif #endif
QupZilla::~QupZilla() BrowserWindow::~BrowserWindow()
{ {
} }

View File

@ -51,21 +51,15 @@ class ClickableLabel;
class WebInspectorDockWidget; class WebInspectorDockWidget;
class LocationBar; class LocationBar;
class QT_QUPZILLA_EXPORT QupZilla : public QMainWindow class QT_QUPZILLA_EXPORT BrowserWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
static const QString VERSION;
static const QString BUILDTIME;
static const QString AUTHOR;
static const QString COPYRIGHT;
static const QString WWWADDRESS;
static const QString WIKIADDRESS;
static const QString WEBKITVERSION; static const QString WEBKITVERSION;
explicit QupZilla(Qz::BrowserWindow type, QUrl startUrl = QUrl()); explicit BrowserWindow(Qz::BrowserWindowType type, QUrl startUrl = QUrl());
~QupZilla(); ~BrowserWindow();
void openWithTab(WebTab* tab); void openWithTab(WebTab* tab);
@ -94,7 +88,7 @@ public:
TabbedWebView* weView(int index) const; TabbedWebView* weView(int index) const;
LocationBar* locationBar() const; LocationBar* locationBar() const;
Qz::BrowserWindow windowType() const; Qz::BrowserWindowType windowType() const;
TabWidget* tabWidget() { return m_tabWidget; } TabWidget* tabWidget() { return m_tabWidget; }
BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; } BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; }
StatusBarMessage* statusBarMessage() { return m_statusBarMessage; } StatusBarMessage* statusBarMessage() { return m_statusBarMessage; }
@ -268,7 +262,7 @@ private:
bool m_isStarting; bool m_isStarting;
QUrl m_startingUrl; QUrl m_startingUrl;
QUrl m_homepage; QUrl m_homepage;
Qz::BrowserWindow m_windowType; Qz::BrowserWindowType m_windowType;
WebTab* m_startTab; WebTab* m_startTab;
QVBoxLayout* m_mainLayout; QVBoxLayout* m_mainLayout;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "commandlineoptions.h" #include "commandlineoptions.h"
#include "qupzilla.h" #include "browserwindow.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
@ -63,7 +63,7 @@ void CommandLineOptions::showHelp()
" For more information please visit wiki at \n" " For more information please visit wiki at \n"
" https://github.com/QupZilla/qupzilla/wiki \n"; " https://github.com/QupZilla/qupzilla/wiki \n";
cout << help << " > " << QupZilla::WWWADDRESS.toUtf8().data() << endl; cout << help << " > " << Qz::WWWADDRESS.toUtf8().data() << endl;
} }
void CommandLineOptions::parseActions() void CommandLineOptions::parseActions()
@ -97,11 +97,11 @@ void CommandLineOptions::parseActions()
} }
if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) { if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) {
cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data() cout << "QupZilla v" << Qz::VERSION.toUtf8().data()
#ifdef GIT_REVISION #ifdef GIT_REVISION
<< " rev " << GIT_REVISION << " " << " rev " << GIT_REVISION << " "
#endif #endif
<< "(build " << QupZilla::BUILDTIME.toUtf8().data() << ")" << "(build " << Qz::BUILDTIME.toUtf8().data() << ")"
<< endl; << endl;
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_ExitAction; pair.action = Qz::CL_ExitAction;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "bookmarkstoolbar.h" #include "bookmarkstoolbar.h"
#include "cookiemanager.h" #include "cookiemanager.h"
@ -119,7 +119,7 @@ MainApplication::MainApplication(int &argc, char** argv)
#endif #endif
{ {
setApplicationName("QupZilla"); setApplicationName("QupZilla");
setApplicationVersion(QupZilla::VERSION); setApplicationVersion(Qz::VERSION);
setOrganizationDomain("qupzilla"); setOrganizationDomain("qupzilla");
#if defined(QZ_WS_X11) && !defined(NO_SYSTEM_DATAPATH) #if defined(QZ_WS_X11) && !defined(NO_SYSTEM_DATAPATH)
@ -303,7 +303,7 @@ MainApplication::MainApplication(int &argc, char** argv)
translateApp(); translateApp();
QupZilla* qupzilla = new QupZilla(Qz::BW_FirstAppWindow, startUrl); BrowserWindow* qupzilla = new BrowserWindow(Qz::BW_FirstAppWindow, startUrl);
m_mainWindows.prepend(qupzilla); m_mainWindows.prepend(qupzilla);
connect(qupzilla, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(sendMessages(Qz::AppMessageType,bool))); connect(qupzilla, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(sendMessages(Qz::AppMessageType,bool)));
@ -479,9 +479,9 @@ void MainApplication::setupJumpList()
QtWin::setupJumpList(); QtWin::setupJumpList();
} }
QupZilla* MainApplication::getWindow() BrowserWindow* MainApplication::getWindow()
{ {
QupZilla* activeW = qobject_cast<QupZilla*>(activeWindow()); BrowserWindow* activeW = qobject_cast<BrowserWindow*>(activeWindow());
if (activeW) { if (activeW) {
return activeW; return activeW;
} }
@ -512,9 +512,9 @@ bool MainApplication::isStateChanged()
return false; return false;
} }
QList<QupZilla*> MainApplication::mainWindows() QList<BrowserWindow*> MainApplication::mainWindows()
{ {
QList<QupZilla*> list; QList<BrowserWindow*> list;
for (int i = 0; i < m_mainWindows.count(); i++) { for (int i = 0; i < m_mainWindows.count(); i++) {
if (!m_mainWindows.at(i)) { if (!m_mainWindows.at(i)) {
@ -610,7 +610,7 @@ void MainApplication::receiveAppMessage(QString message)
actWin = downManager(); actWin = downManager();
} }
else if (text == QLatin1String("ToggleFullScreen") && actWin) { else if (text == QLatin1String("ToggleFullScreen") && actWin) {
QupZilla* qz = static_cast<QupZilla*>(actWin); BrowserWindow* qz = static_cast<BrowserWindow*>(actWin);
qz->toggleFullScreen(); qz->toggleFullScreen();
} }
else if (text.startsWith(QLatin1String("OpenUrlInCurrentTab"))) { else if (text.startsWith(QLatin1String("OpenUrlInCurrentTab"))) {
@ -635,7 +635,7 @@ void MainApplication::receiveAppMessage(QString message)
actWin->activateWindow(); actWin->activateWindow();
actWin->setFocus(); actWin->setFocus();
QupZilla* qz = qobject_cast<QupZilla*>(actWin); BrowserWindow* qz = qobject_cast<BrowserWindow*>(actWin);
if (qz && !actUrl.isEmpty()) { if (qz && !actUrl.isEmpty()) {
qz->loadAddress(actUrl); qz->loadAddress(actUrl);
@ -651,13 +651,13 @@ void MainApplication::addNewTab(const QUrl &url)
getWindow()->tabWidget()->addView(url, url.isEmpty() ? Qz::NT_SelectedNewEmptyTab : Qz::NT_SelectedTabAtTheEnd); getWindow()->tabWidget()->addView(url, url.isEmpty() ? Qz::NT_SelectedNewEmptyTab : Qz::NT_SelectedTabAtTheEnd);
} }
QupZilla* MainApplication::makeNewWindow(Qz::BrowserWindow type, const QUrl &startUrl) BrowserWindow* MainApplication::makeNewWindow(Qz::BrowserWindowType type, const QUrl &startUrl)
{ {
if (m_mainWindows.count() == 0 && type != Qz::BW_MacFirstWindow) { if (m_mainWindows.count() == 0 && type != Qz::BW_MacFirstWindow) {
type = Qz::BW_FirstAppWindow; type = Qz::BW_FirstAppWindow;
} }
QupZilla* newWindow = new QupZilla(type, startUrl); BrowserWindow* newWindow = new BrowserWindow(type, startUrl);
m_mainWindows.prepend(newWindow); m_mainWindows.prepend(newWindow);
return newWindow; return newWindow;
@ -1166,7 +1166,7 @@ QUrl MainApplication::userStyleSheet(const QString &filePath) const
return QUrl(dataString); return QUrl(dataString);
} }
void MainApplication::aboutToCloseWindow(QupZilla* window) void MainApplication::aboutToCloseWindow(BrowserWindow* window)
{ {
if (!window) { if (!window) {
return; return;
@ -1199,7 +1199,7 @@ bool MainApplication::saveStateSlot()
stream << m_mainWindows.count(); stream << m_mainWindows.count();
for (int i = 0; i < m_mainWindows.count(); i++) { for (int i = 0; i < m_mainWindows.count(); i++) {
QupZilla* qz = m_mainWindows.at(i).data(); BrowserWindow* qz = m_mainWindows.at(i).data();
if (!qz) { if (!qz) {
continue; continue;
} }
@ -1213,7 +1213,7 @@ bool MainApplication::saveStateSlot()
} }
file.close(); file.close();
QupZilla* qupzilla_ = getWindow(); BrowserWindow* qupzilla_ = getWindow();
if (qupzilla_ && m_mainWindows.count() == 1) { if (qupzilla_ && m_mainWindows.count() == 1) {
qupzilla_->tabWidget()->savePinnedTabs(); qupzilla_->tabWidget()->savePinnedTabs();
} }
@ -1225,7 +1225,7 @@ bool MainApplication::saveStateSlot()
return true; return true;
} }
bool MainApplication::restoreStateSlot(QupZilla* window, RestoreData recoveryData) bool MainApplication::restoreStateSlot(BrowserWindow* window, RestoreData recoveryData)
{ {
if (m_isPrivateSession || recoveryData.isEmpty()) { if (m_isPrivateSession || recoveryData.isEmpty()) {
return false; return false;
@ -1242,7 +1242,7 @@ bool MainApplication::restoreStateSlot(QupZilla* window, RestoreData recoveryDat
// some new tabs. // some new tabs.
// Instead create new one and restore pinned tabs there // Instead create new one and restore pinned tabs there
QupZilla* newWin = makeNewWindow(Qz::BW_OtherRestoredWindow); BrowserWindow* newWin = makeNewWindow(Qz::BW_OtherRestoredWindow);
newWin->restoreWindowState(recoveryData.first()); newWin->restoreWindowState(recoveryData.first());
recoveryData.remove(0); recoveryData.remove(0);
} }
@ -1260,7 +1260,7 @@ bool MainApplication::restoreStateSlot(QupZilla* window, RestoreData recoveryDat
} }
foreach (const RestoreManager::WindowData &data, recoveryData) { foreach (const RestoreManager::WindowData &data, recoveryData) {
QupZilla* window = makeNewWindow(Qz::BW_OtherRestoredWindow); BrowserWindow* window = makeNewWindow(Qz::BW_OtherRestoredWindow);
window->restoreWindowState(data); window->restoreWindowState(data);
// for correct geometry calculation in QupZilla::setupUi() // for correct geometry calculation in QupZilla::setupUi()
mApp->processEvents(); mApp->processEvents();
@ -1318,7 +1318,7 @@ bool MainApplication::checkSettingsDir()
QFile versionFile(PROFILEDIR + "profiles/default/version"); QFile versionFile(PROFILEDIR + "profiles/default/version");
versionFile.open(QFile::WriteOnly); versionFile.open(QFile::WriteOnly);
versionFile.write(QupZilla::VERSION.toUtf8()); versionFile.write(Qz::VERSION.toUtf8());
versionFile.close(); versionFile.close();
return dir.isReadable(); return dir.isReadable();

View File

@ -32,7 +32,7 @@ class QMenu;
class QWebSettings; class QWebSettings;
class QNetworkDiskCache; class QNetworkDiskCache;
class QupZilla; class BrowserWindow;
class CookieManager; class CookieManager;
class BrowsingLibrary; class BrowsingLibrary;
class History; class History;
@ -73,12 +73,12 @@ public:
void connectDatabase(); void connectDatabase();
void reloadSettings(); void reloadSettings();
bool restoreStateSlot(QupZilla* window, RestoreData recoveryData); bool restoreStateSlot(BrowserWindow* window, RestoreData recoveryData);
QupZilla* makeNewWindow(Qz::BrowserWindow type, const QUrl &startUrl = QUrl()); BrowserWindow* makeNewWindow(Qz::BrowserWindowType type, const QUrl &startUrl = QUrl());
void aboutToCloseWindow(QupZilla* window); void aboutToCloseWindow(BrowserWindow* window);
bool isStateChanged(); bool isStateChanged();
QList<QupZilla*> mainWindows(); QList<BrowserWindow*> mainWindows();
static MainApplication* getInstance() { return static_cast<MainApplication*>(QCoreApplication::instance()); } static MainApplication* getInstance() { return static_cast<MainApplication*>(QCoreApplication::instance()); }
@ -102,7 +102,7 @@ public:
QString currentStyle() const; QString currentStyle() const;
QString tempPath() const; QString tempPath() const;
QupZilla* getWindow(); BrowserWindow* getWindow();
CookieManager* cookieManager(); CookieManager* cookieManager();
BrowsingLibrary* browsingLibrary(); BrowsingLibrary* browsingLibrary();
History* history(); History* history();
@ -191,7 +191,7 @@ private:
#endif #endif
DatabaseWriter* m_dbWriter; DatabaseWriter* m_dbWriter;
UserAgentManager* m_uaManager; UserAgentManager* m_uaManager;
QList<QPointer<QupZilla> > m_mainWindows; QList<QPointer<BrowserWindow> > m_mainWindows;
QString m_activeProfil; QString m_activeProfil;
QString m_activeLanguage; QString m_activeLanguage;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "profileupdater.h" #include "profileupdater.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "updater.h" #include "updater.h"
#include "qztools.h" #include "qztools.h"
#include "mainapplication.h" #include "mainapplication.h"
@ -47,14 +47,14 @@ void ProfileUpdater::checkProfile()
versionFile.close(); versionFile.close();
versionFile.remove(); versionFile.remove();
updateProfile(QupZilla::VERSION, profileVersion.trimmed()); updateProfile(Qz::VERSION, profileVersion.trimmed());
} }
else { else {
copyDataToProfile(); copyDataToProfile();
} }
versionFile.open(QFile::WriteOnly); versionFile.open(QFile::WriteOnly);
versionFile.write(QupZilla::VERSION.toUtf8()); versionFile.write(Qz::VERSION.toUtf8());
versionFile.close(); versionFile.close();
} }

View File

@ -19,6 +19,7 @@
#define QZ_NAMESPACE_H #define QZ_NAMESPACE_H
#include <QFlags> #include <QFlags>
#include <QString>
#ifdef QUPZILLA_SHAREDLIBRARY #ifdef QUPZILLA_SHAREDLIBRARY
#define QT_QUPZILLA_EXPORT Q_DECL_EXPORT #define QT_QUPZILLA_EXPORT Q_DECL_EXPORT
@ -46,6 +47,14 @@ static const int sessionVersion = 0x0003;
// Version of bookmarks.json file // Version of bookmarks.json file
static const int bookmarksVersion = 1; static const int bookmarksVersion = 1;
static const QString APPNAME = "QupZilla";
static const QString VERSION = "1.7.0";
static const QString BUILDTIME = __DATE__" "__TIME__;
static const QString AUTHOR = "David Rosca";
static const QString COPYRIGHT = "2010-2014";
static const QString WWWADDRESS = "http://www.qupzilla.com";
static const QString WIKIADDRESS = "https://github.com/QupZilla/qupzilla/wiki";
enum AppMessageType { enum AppMessageType {
AM_SetAdBlockIconEnabled, AM_SetAdBlockIconEnabled,
AM_CheckPrivateBrowsing, AM_CheckPrivateBrowsing,
@ -54,7 +63,7 @@ enum AppMessageType {
AM_BookmarksChanged AM_BookmarksChanged
}; };
enum BrowserWindow { enum BrowserWindowType {
BW_FirstAppWindow, BW_FirstAppWindow,
BW_OtherRestoredWindow, BW_OtherRestoredWindow,
BW_NewWindow, BW_NewWindow,

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "autofill.h" #include "autofill.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "webpage.h" #include "webpage.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "popupwebview.h" #include "popupwebview.h"

View File

@ -26,7 +26,7 @@ class QUrl;
class QWebElement; class QWebElement;
class QNetworkRequest; class QNetworkRequest;
class QupZilla; class BrowserWindow;
class WebPage; class WebPage;
class PasswordManager; class PasswordManager;
struct PageFormData; struct PageFormData;

View File

@ -20,7 +20,7 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "autofill.h" #include "autofill.h"
#include "aesinterface.h" #include "aesinterface.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "ui_masterpassworddialog.h" #include "ui_masterpassworddialog.h"
#include <QVector> #include <QVector>

View File

@ -22,16 +22,16 @@
#include "bookmarksmodel.h" #include "bookmarksmodel.h"
#include "bookmarkstools.h" #include "bookmarkstools.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "qztools.h" #include "qztools.h"
#include <QMenu> #include <QMenu>
#include <QTimer> #include <QTimer>
BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent) BookmarksManager::BookmarksManager(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::BookmarksManager) , ui(new Ui::BookmarksManager)
, p_QupZilla(mainClass) , m_window(window)
, m_bookmarks(mApp->bookmarks()) , m_bookmarks(mApp->bookmarks())
, m_selectedBookmark(0) , m_selectedBookmark(0)
, m_blockDescriptionChangedSignal(false) , m_blockDescriptionChangedSignal(false)
@ -59,10 +59,10 @@ BookmarksManager::~BookmarksManager()
delete ui; delete ui;
} }
void BookmarksManager::setMainWindow(QupZilla* window) void BookmarksManager::setMainWindow(BrowserWindow* window)
{ {
if (window) { if (window) {
p_QupZilla = window; m_window = window;
} }
} }
@ -319,12 +319,12 @@ void BookmarksManager::keyPressEvent(QKeyEvent* event)
QWidget::keyPressEvent(event); QWidget::keyPressEvent(event);
} }
QupZilla* BookmarksManager::getQupZilla() BrowserWindow* BookmarksManager::getQupZilla()
{ {
if (!p_QupZilla) { if (!m_window) {
p_QupZilla = mApp->getWindow(); m_window = mApp->getWindow();
} }
return p_QupZilla.data(); return m_window.data();
} }
void BookmarksManager::showEvent(QShowEvent* event) void BookmarksManager::showEvent(QShowEvent* event)

View File

@ -30,7 +30,7 @@ class BookmarksManager;
class QUrl; class QUrl;
class QupZilla; class BrowserWindow;
class Bookmarks; class Bookmarks;
class BookmarkItem; class BookmarkItem;
@ -39,10 +39,10 @@ class QT_QUPZILLA_EXPORT BookmarksManager : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit BookmarksManager(QupZilla* mainClass, QWidget* parent = 0); explicit BookmarksManager(BrowserWindow* window, QWidget* parent = 0);
~BookmarksManager(); ~BookmarksManager();
void setMainWindow(QupZilla* window); void setMainWindow(BrowserWindow* window);
public slots: public slots:
void search(const QString &string); void search(const QString &string);
@ -72,13 +72,13 @@ private:
bool bookmarkEditable(BookmarkItem* item) const; bool bookmarkEditable(BookmarkItem* item) const;
void addBookmark(BookmarkItem* item); void addBookmark(BookmarkItem* item);
BookmarkItem* parentForNewBookmark() const; BookmarkItem* parentForNewBookmark() const;
QupZilla* getQupZilla(); BrowserWindow* getQupZilla();
void showEvent(QShowEvent* event); void showEvent(QShowEvent* event);
void keyPressEvent(QKeyEvent* event); void keyPressEvent(QKeyEvent* event);
Ui::BookmarksManager* ui; Ui::BookmarksManager* ui;
QPointer<QupZilla> p_QupZilla; QPointer<BrowserWindow> m_window;
Bookmarks* m_bookmarks; Bookmarks* m_bookmarks;
BookmarkItem* m_selectedBookmark; BookmarkItem* m_selectedBookmark;

View File

@ -22,7 +22,7 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "browsinglibrary.h" #include "browsinglibrary.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "qzsettings.h" #include "qzsettings.h"
#include "tabwidget.h" #include "tabwidget.h"
@ -38,7 +38,7 @@ BookmarksMenu::BookmarksMenu(QWidget* parent)
connect(mApp->bookmarks(), SIGNAL(bookmarkChanged(BookmarkItem*)), this, SLOT(bookmarksChanged())); connect(mApp->bookmarks(), SIGNAL(bookmarkChanged(BookmarkItem*)), this, SLOT(bookmarksChanged()));
} }
void BookmarksMenu::setMainWindow(QupZilla* window) void BookmarksMenu::setMainWindow(BrowserWindow* window)
{ {
m_window = window; m_window = window;
} }

View File

@ -23,7 +23,7 @@
#include "enhancedmenu.h" #include "enhancedmenu.h"
#include "qz_namespace.h" #include "qz_namespace.h"
class QupZilla; class BrowserWindow;
class BookmarkItem; class BookmarkItem;
class QT_QUPZILLA_EXPORT BookmarksMenu : public Menu class QT_QUPZILLA_EXPORT BookmarksMenu : public Menu
@ -33,7 +33,7 @@ class QT_QUPZILLA_EXPORT BookmarksMenu : public Menu
public: public:
explicit BookmarksMenu(QWidget* parent = 0); explicit BookmarksMenu(QWidget* parent = 0);
void setMainWindow(QupZilla* window); void setMainWindow(BrowserWindow* window);
private slots: private slots:
void bookmarkPage(); void bookmarkPage();
@ -57,7 +57,7 @@ private:
void init(); void init();
void refresh(); void refresh();
QPointer<QupZilla> m_window; QPointer<BrowserWindow> m_window;
bool m_changed; bool m_changed;
}; };

View File

@ -28,9 +28,9 @@
#include <QTimer> #include <QTimer>
#include <QFrame> #include <QFrame>
BookmarksToolbar::BookmarksToolbar(QupZilla* mainClass, QWidget* parent) BookmarksToolbar::BookmarksToolbar(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, m_window(mainClass) , m_window(window)
, m_bookmarks(mApp->bookmarks()) , m_bookmarks(mApp->bookmarks())
, m_clickedBookmark(0) , m_clickedBookmark(0)
{ {

View File

@ -25,7 +25,7 @@
class QHBoxLayout; class QHBoxLayout;
class QTimer; class QTimer;
class QupZilla; class BrowserWindow;
class Bookmarks; class Bookmarks;
class BookmarkItem; class BookmarkItem;
class BookmarksToolbarButton; class BookmarksToolbarButton;
@ -34,7 +34,7 @@ class QT_QUPZILLA_EXPORT BookmarksToolbar : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BookmarksToolbar(QupZilla* mainClass, QWidget* parent = 0); explicit BookmarksToolbar(BrowserWindow* window, QWidget* parent = 0);
private slots: private slots:
void contextMenuRequested(const QPoint &pos); void contextMenuRequested(const QPoint &pos);
@ -55,7 +55,7 @@ private:
void dropEvent(QDropEvent* e); void dropEvent(QDropEvent* e);
void dragEnterEvent(QDragEnterEvent* e); void dragEnterEvent(QDragEnterEvent* e);
QupZilla* m_window; BrowserWindow* m_window;
Bookmarks* m_bookmarks; Bookmarks* m_bookmarks;
BookmarkItem* m_clickedBookmark; BookmarkItem* m_clickedBookmark;
QHBoxLayout* m_layout; QHBoxLayout* m_layout;

View File

@ -47,7 +47,7 @@ BookmarkItem* BookmarksToolbarButton::bookmark() const
return m_bookmark; return m_bookmark;
} }
void BookmarksToolbarButton::setMainWindow(QupZilla* window) void BookmarksToolbarButton::setMainWindow(BrowserWindow* window)
{ {
m_window = window; m_window = window;
} }

View File

@ -23,7 +23,7 @@
#include "qz_namespace.h" #include "qz_namespace.h"
class Menu; class Menu;
class QupZilla; class BrowserWindow;
class BookmarkItem; class BookmarkItem;
class QT_QUPZILLA_EXPORT BookmarksToolbarButton : public QPushButton class QT_QUPZILLA_EXPORT BookmarksToolbarButton : public QPushButton
@ -34,7 +34,7 @@ public:
explicit BookmarksToolbarButton(BookmarkItem* bookmark, QWidget* parent = 0); explicit BookmarksToolbarButton(BookmarkItem* bookmark, QWidget* parent = 0);
BookmarkItem* bookmark() const; BookmarkItem* bookmark() const;
void setMainWindow(QupZilla* window); void setMainWindow(BrowserWindow* window);
bool showOnlyIcon() const; bool showOnlyIcon() const;
void setShowOnlyIcon(bool show); void setShowOnlyIcon(bool show);
@ -65,7 +65,7 @@ private:
void paintEvent(QPaintEvent* event); void paintEvent(QPaintEvent* event);
BookmarkItem* m_bookmark; BookmarkItem* m_bookmark;
QupZilla* m_window; BrowserWindow* m_window;
Qt::MouseButtons m_buttons; Qt::MouseButtons m_buttons;
Qt::KeyboardModifiers m_modifiers; Qt::KeyboardModifiers m_modifiers;

View File

@ -23,7 +23,7 @@
#include "enhancedmenu.h" #include "enhancedmenu.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "qzsettings.h" #include "qzsettings.h"
#include "qupzilla.h" #include "browserwindow.h"
#include <iostream> #include <iostream>
#include <QSqlQuery> #include <QSqlQuery>
@ -215,7 +215,7 @@ bool BookmarksTools::bookmarkAllTabsDialog(QWidget* parent, TabWidget* tabWidget
return true; return true;
} }
void BookmarksTools::openBookmark(QupZilla* window, BookmarkItem* item) void BookmarksTools::openBookmark(BrowserWindow* window, BookmarkItem* item)
{ {
Q_ASSERT(window); Q_ASSERT(window);
@ -232,7 +232,7 @@ void BookmarksTools::openBookmark(QupZilla* window, BookmarkItem* item)
} }
} }
void BookmarksTools::openBookmarkInNewTab(QupZilla* window, BookmarkItem* item) void BookmarksTools::openBookmarkInNewTab(BrowserWindow* window, BookmarkItem* item)
{ {
Q_ASSERT(window); Q_ASSERT(window);
@ -259,7 +259,7 @@ void BookmarksTools::openBookmarkInNewWindow(BookmarkItem* item)
mApp->makeNewWindow(Qz::BW_NewWindow, item->url()); mApp->makeNewWindow(Qz::BW_NewWindow, item->url());
} }
void BookmarksTools::openFolderInTabs(QupZilla* window, BookmarkItem* folder) void BookmarksTools::openFolderInTabs(BrowserWindow* window, BookmarkItem* folder)
{ {
Q_ASSERT(window); Q_ASSERT(window);
Q_ASSERT(folder->isFolder()); Q_ASSERT(folder->isFolder());

View File

@ -70,7 +70,7 @@ private:
BookmarkItem* m_selectedFolder; BookmarkItem* m_selectedFolder;
}; };
class QupZilla; class BrowserWindow;
class TabWidget; class TabWidget;
class Action; class Action;
class Menu; class Menu;
@ -83,10 +83,10 @@ public:
static bool bookmarkAllTabsDialog(QWidget* parent, TabWidget* tabWidget, BookmarkItem* folder = 0); static bool bookmarkAllTabsDialog(QWidget* parent, TabWidget* tabWidget, BookmarkItem* folder = 0);
// Open Bookmarks // Open Bookmarks
static void openBookmark(QupZilla* window, BookmarkItem* item); static void openBookmark(BrowserWindow* window, BookmarkItem* item);
static void openBookmarkInNewTab(QupZilla* window, BookmarkItem* item); static void openBookmarkInNewTab(BrowserWindow* window, BookmarkItem* item);
static void openBookmarkInNewWindow(BookmarkItem* item); static void openBookmarkInNewWindow(BookmarkItem* item);
static void openFolderInTabs(QupZilla* window, BookmarkItem* folder); static void openFolderInTabs(BrowserWindow* window, BookmarkItem* folder);
// Create Menu // Create Menu
static void addActionToMenu(QObject* receiver, Menu* menu, BookmarkItem* item); static void addActionToMenu(QObject* receiver, Menu* menu, BookmarkItem* item);

View File

@ -23,7 +23,7 @@
#include "pluginproxy.h" #include "pluginproxy.h"
#include "speeddial.h" #include "speeddial.h"
#include "webview.h" #include "webview.h"
#include "qupzilla.h" #include "browserwindow.h"
#include <QTimer> #include <QTimer>

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "cookiejar.h" #include "cookiejar.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "settings.h" #include "settings.h"
#include "qztools.h" #include "qztools.h"
@ -29,9 +29,9 @@
//#define COOKIE_DEBUG //#define COOKIE_DEBUG
CookieJar::CookieJar(QupZilla* mainClass, QObject* parent) CookieJar::CookieJar(BrowserWindow* window, QObject* parent)
: QNetworkCookieJar(parent) : QNetworkCookieJar(parent)
, p_QupZilla(mainClass) , m_window(window)
{ {
m_activeProfil = mApp->currentProfilePath(); m_activeProfil = mApp->currentProfilePath();
loadSettings(); loadSettings();

View File

@ -24,12 +24,12 @@
#include <QStringList> #include <QStringList>
#include <QNetworkCookieJar> #include <QNetworkCookieJar>
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT CookieJar : public QNetworkCookieJar class QT_QUPZILLA_EXPORT CookieJar : public QNetworkCookieJar
{ {
public: public:
explicit CookieJar(QupZilla* mainClass, QObject* parent = 0); explicit CookieJar(BrowserWindow* window, QObject* parent = 0);
void loadSettings(); void loadSettings();
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url); bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
@ -48,7 +48,7 @@ public:
private: private:
bool rejectCookie(const QString &domain, const QNetworkCookie &cookie) const; bool rejectCookie(const QString &domain, const QNetworkCookie &cookie) const;
QupZilla* p_QupZilla; BrowserWindow* m_window;
bool m_allowCookies; bool m_allowCookies;
bool m_filterTrackingCookie; bool m_filterTrackingCookie;

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "cookiemanager.h" #include "cookiemanager.h"
#include "ui_cookiemanager.h" #include "ui_cookiemanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "cookiejar.h" #include "cookiejar.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qztools.h" #include "qztools.h"

View File

@ -29,7 +29,7 @@ class CookieManager;
class QTreeWidgetItem; class QTreeWidgetItem;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT CookieManager : public QWidget class QT_QUPZILLA_EXPORT CookieManager : public QWidget
{ {

View File

@ -20,7 +20,7 @@
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "downloadoptionsdialog.h" #include "downloadoptionsdialog.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "downloaditem.h" #include "downloaditem.h"
#include "downloadmanager.h" #include "downloadmanager.h"
#include "qztools.h" #include "qztools.h"

View File

@ -18,7 +18,7 @@
#include "downloaditem.h" #include "downloaditem.h"
#include "ui_downloaditem.h" #include "ui_downloaditem.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "webpage.h" #include "webpage.h"
#include "downloadmanager.h" #include "downloadmanager.h"
@ -389,7 +389,7 @@ void DownloadItem::customContextMenuRequested(const QPoint &pos)
void DownloadItem::goToDownloadPage() void DownloadItem::goToDownloadPage()
{ {
QupZilla* qz = mApp->getWindow(); BrowserWindow* qz = mApp->getWindow();
if (qz) { if (qz) {
qz->tabWidget()->addView(m_downloadPage, Qz::NT_SelectedTab); qz->tabWidget()->addView(m_downloadPage, Qz::NT_SelectedTab);

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "downloadmanager.h" #include "downloadmanager.h"
#include "ui_downloadmanager.h" #include "ui_downloadmanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "downloadoptionsdialog.h" #include "downloadoptionsdialog.h"
#include "downloaditem.h" #include "downloaditem.h"

View File

@ -18,7 +18,7 @@
#include "history.h" #include "history.h"
#include "historymodel.h" #include "historymodel.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "settings.h" #include "settings.h"

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "historymanager.h" #include "historymanager.h"
#include "ui_historymanager.h" #include "ui_historymanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "history.h" #include "history.h"
#include "browsinglibrary.h" #include "browsinglibrary.h"
@ -29,10 +29,10 @@
#include <QMessageBox> #include <QMessageBox>
HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent) HistoryManager::HistoryManager(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::HistoryManager) , ui(new Ui::HistoryManager)
, p_QupZilla(mainClass) , m_window(window)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -44,18 +44,18 @@ HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent)
ui->historyTree->setFocus(); ui->historyTree->setFocus();
} }
QupZilla* HistoryManager::getQupZilla() BrowserWindow* HistoryManager::getQupZilla()
{ {
if (!p_QupZilla) { if (!m_window) {
p_QupZilla = mApp->getWindow(); m_window = mApp->getWindow();
} }
return p_QupZilla.data(); return m_window.data();
} }
void HistoryManager::setMainWindow(QupZilla* window) void HistoryManager::setMainWindow(BrowserWindow* window)
{ {
if (window) { if (window) {
p_QupZilla = window; m_window = window;
} }
} }

View File

@ -31,17 +31,17 @@ class HistoryManager;
class QTreeWidgetItem; class QTreeWidgetItem;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT HistoryManager : public QWidget class QT_QUPZILLA_EXPORT HistoryManager : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit HistoryManager(QupZilla* mainClass, QWidget* parent = 0); explicit HistoryManager(BrowserWindow* window, QWidget* parent = 0);
~HistoryManager(); ~HistoryManager();
void setMainWindow(QupZilla* window); void setMainWindow(BrowserWindow* window);
void restoreState(const QByteArray &state); void restoreState(const QByteArray &state);
QByteArray saveState(); QByteArray saveState();
@ -54,10 +54,10 @@ private slots:
void clearHistory(); void clearHistory();
private: private:
QupZilla* getQupZilla(); BrowserWindow* getQupZilla();
Ui::HistoryManager* ui; Ui::HistoryManager* ui;
QPointer<QupZilla> p_QupZilla; QPointer<BrowserWindow> m_window;
}; };
#endif // HISTORYMANAGER_H #endif // HISTORYMANAGER_H

View File

@ -70,7 +70,6 @@ SOURCES += \
webview/tabpreview.cpp \ webview/tabpreview.cpp \
3rdparty/qtwin.cpp \ 3rdparty/qtwin.cpp \
3rdparty/lineedit.cpp \ 3rdparty/lineedit.cpp \
app/qupzilla.cpp \
app/mainapplication.cpp \ app/mainapplication.cpp \
app/autosaver.cpp \ app/autosaver.cpp \
preferences/autofillmanager.cpp \ preferences/autofillmanager.cpp \
@ -257,14 +256,14 @@ SOURCES += \
bookmarks/bookmarkstoolbarbutton.cpp \ bookmarks/bookmarkstoolbarbutton.cpp \
bookmarks/bookmarksexport/bookmarksexporter.cpp \ bookmarks/bookmarksexport/bookmarksexporter.cpp \
bookmarks/bookmarksexport/bookmarksexportdialog.cpp \ bookmarks/bookmarksexport/bookmarksexportdialog.cpp \
bookmarks/bookmarksexport/htmlexporter.cpp bookmarks/bookmarksexport/htmlexporter.cpp \
app/browserwindow.cpp
HEADERS += \ HEADERS += \
webview/tabpreview.h \ webview/tabpreview.h \
3rdparty/qtwin.h \ 3rdparty/qtwin.h \
3rdparty/lineedit.h \ 3rdparty/lineedit.h \
app/qupzilla.h \
app/mainapplication.h \ app/mainapplication.h \
app/autosaver.h \ app/autosaver.h \
preferences/autofillmanager.h \ preferences/autofillmanager.h \
@ -455,7 +454,8 @@ HEADERS += \
bookmarks/bookmarkstoolbarbutton.h \ bookmarks/bookmarkstoolbarbutton.h \
bookmarks/bookmarksexport/bookmarksexporter.h \ bookmarks/bookmarksexport/bookmarksexporter.h \
bookmarks/bookmarksexport/bookmarksexportdialog.h \ bookmarks/bookmarksexport/bookmarksexportdialog.h \
bookmarks/bookmarksexport/htmlexporter.h bookmarks/bookmarksexport/htmlexporter.h \
app/browserwindow.h
FORMS += \ FORMS += \
preferences/autofillmanager.ui \ preferences/autofillmanager.ui \

View File

@ -21,7 +21,7 @@
#include "bookmarkitem.h" #include "bookmarkitem.h"
#include "bookmarks.h" #include "bookmarks.h"
#include "qzsettings.h" #include "qzsettings.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include <QSqlQuery> #include <QSqlQuery>
@ -238,11 +238,11 @@ TabPosition LocationCompleterModel::tabPositionForUrl(const QUrl &url) const
TabPosition LocationCompleterModel::tabPositionForEncodedUrl(const QString &encodedUrl) const TabPosition LocationCompleterModel::tabPositionForEncodedUrl(const QString &encodedUrl) const
{ {
QList<QupZilla*> windows = mApp->mainWindows(); QList<BrowserWindow*> windows = mApp->mainWindows();
int currentWindowIdx = windows.indexOf(mApp->getWindow()); int currentWindowIdx = windows.indexOf(mApp->getWindow());
windows.prepend(mApp->getWindow()); windows.prepend(mApp->getWindow());
for (int win = 0; win < windows.count(); ++win) { for (int win = 0; win < windows.count(); ++win) {
QupZilla* mainWin = windows.at(win); BrowserWindow* mainWin = windows.at(win);
QList<WebTab*> tabs = mainWin->tabWidget()->allTabs(); QList<WebTab*> tabs = mainWin->tabWidget()->allTabs();
for (int tab = 0; tab < tabs.count(); ++tab) { for (int tab = 0; tab < tabs.count(); ++tab) {
if (tabs[tab]->url().toEncoded() == encodedUrl) { if (tabs[tab]->url().toEncoded() == encodedUrl) {

View File

@ -19,7 +19,7 @@
#include "locationcompletermodel.h" #include "locationcompletermodel.h"
#include "locationcompleterdelegate.h" #include "locationcompleterdelegate.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "history.h" #include "history.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "qzsettings.h" #include "qzsettings.h"
@ -264,7 +264,7 @@ void LocationCompleterView::mouseReleaseEvent(QMouseEvent* event)
void LocationCompleterView::activateTab(TabPosition pos) void LocationCompleterView::activateTab(TabPosition pos)
{ {
QupZilla* win = mApp->mainWindows().at(pos.windowIndex); BrowserWindow* win = mApp->mainWindows().at(pos.windowIndex);
if (mApp->getWindow() != win || mApp->getWindow()->tabWidget()->currentIndex() != pos.tabIndex) { if (mApp->getWindow() != win || mApp->getWindow()->tabWidget()->currentIndex() != pos.tabIndex) {
emit aboutToActivateTab(pos); emit aboutToActivateTab(pos);
close(); close();

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "locationbar.h" #include "locationbar.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "rssmanager.h" #include "rssmanager.h"
#include "mainapplication.h" #include "mainapplication.h"
@ -45,9 +45,9 @@
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
LocationBar::LocationBar(QupZilla* mainClass) LocationBar::LocationBar(BrowserWindow* window)
: LineEdit(mainClass) : LineEdit(window)
, p_QupZilla(mainClass) , m_window(window)
, m_webView(0) , m_webView(0)
, m_pasteAndGoAction(0) , m_pasteAndGoAction(0)
, m_clearAction(0) , m_clearAction(0)
@ -65,7 +65,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
m_bookmarkIcon = new BookmarksIcon(this); m_bookmarkIcon = new BookmarksIcon(this);
m_goIcon = new GoIcon(this); m_goIcon = new GoIcon(this);
m_rssIcon = new RssIcon(this); m_rssIcon = new RssIcon(this);
m_siteIcon = new SiteIcon(p_QupZilla, this); m_siteIcon = new SiteIcon(m_window, this);
m_autofillIcon = new AutoFillIcon(this); m_autofillIcon = new AutoFillIcon(this);
DownIcon* down = new DownIcon(this); DownIcon* down = new DownIcon(this);
@ -515,7 +515,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
case Qt::AltModifier: case Qt::AltModifier:
m_completer.closePopup(); m_completer.closePopup();
p_QupZilla->tabWidget()->addView(createUrl()); m_window->tabWidget()->addView(createUrl());
m_holdingAlt = false; m_holdingAlt = false;
break; break;

View File

@ -24,7 +24,7 @@
#include "lineedit.h" #include "lineedit.h"
#include "completer/locationcompleter.h" #include "completer/locationcompleter.h"
class QupZilla; class BrowserWindow;
class LineEdit; class LineEdit;
class LocationCompleter; class LocationCompleter;
class ClickableLabel; class ClickableLabel;
@ -43,7 +43,7 @@ class QT_QUPZILLA_EXPORT LocationBar : public LineEdit
Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight) Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight)
public: public:
explicit LocationBar(QupZilla* mainClass); explicit LocationBar(BrowserWindow* window);
~LocationBar(); ~LocationBar();
void setWebView(TabbedWebView* view); void setWebView(TabbedWebView* view);
@ -111,7 +111,7 @@ private:
SiteIcon* m_siteIcon; SiteIcon* m_siteIcon;
AutoFillIcon* m_autofillIcon; AutoFillIcon* m_autofillIcon;
QupZilla* p_QupZilla; BrowserWindow* m_window;
TabbedWebView* m_webView; TabbedWebView* m_webView;
QAction* m_pasteAndGoAction; QAction* m_pasteAndGoAction;

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "navigationbar.h" #include "navigationbar.h"
#include "toolbutton.h" #include "toolbutton.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "websearchbar.h" #include "websearchbar.h"
@ -69,9 +69,9 @@ static inline void setButtonIconSize(ToolButton* button)
button->setIconSize(QSize(size, size)); button->setIconSize(QSize(size, size));
} }
NavigationBar::NavigationBar(QupZilla* mainClass) NavigationBar::NavigationBar(BrowserWindow* window)
: QWidget(mainClass) : QWidget(window)
, p_QupZilla(mainClass) , m_window(window)
{ {
setObjectName("navigationbar"); setObjectName("navigationbar");
m_layout = new QHBoxLayout(this); m_layout = new QHBoxLayout(this);
@ -137,15 +137,15 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
m_supMenu->setToolTip(tr("Main Menu")); m_supMenu->setToolTip(tr("Main Menu"));
m_supMenu->setAutoRaise(true); m_supMenu->setAutoRaise(true);
m_supMenu->setFocusPolicy(Qt::NoFocus); m_supMenu->setFocusPolicy(Qt::NoFocus);
m_supMenu->setMenu(p_QupZilla->superMenu()); m_supMenu->setMenu(m_window->superMenu());
m_supMenu->setShowMenuInside(true); m_supMenu->setShowMenuInside(true);
setButtonIconSize(m_supMenu); setButtonIconSize(m_supMenu);
#endif #endif
m_searchLine = new WebSearchBar(p_QupZilla); m_searchLine = new WebSearchBar(m_window);
m_navigationSplitter = new QSplitter(this); m_navigationSplitter = new QSplitter(this);
m_navigationSplitter->addWidget(p_QupZilla->tabWidget()->locationBars()); m_navigationSplitter->addWidget(m_window->tabWidget()->locationBars());
m_navigationSplitter->addWidget(m_searchLine); m_navigationSplitter->addWidget(m_searchLine);
m_navigationSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); m_navigationSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
@ -182,14 +182,14 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
connect(m_buttonNext, SIGNAL(middleMouseClicked()), this, SLOT(goForwardInNewTab())); connect(m_buttonNext, SIGNAL(middleMouseClicked()), this, SLOT(goForwardInNewTab()));
connect(m_buttonNext, SIGNAL(controlClicked()), this, SLOT(goForwardInNewTab())); connect(m_buttonNext, SIGNAL(controlClicked()), this, SLOT(goForwardInNewTab()));
connect(m_reloadStop->buttonStop(), SIGNAL(clicked()), p_QupZilla, SLOT(stop())); connect(m_reloadStop->buttonStop(), SIGNAL(clicked()), m_window, SLOT(stop()));
connect(m_reloadStop->buttonReload(), SIGNAL(clicked()), p_QupZilla, SLOT(reload())); connect(m_reloadStop->buttonReload(), SIGNAL(clicked()), m_window, SLOT(reload()));
connect(m_buttonHome, SIGNAL(clicked()), p_QupZilla, SLOT(goHome())); connect(m_buttonHome, SIGNAL(clicked()), m_window, SLOT(goHome()));
connect(m_buttonHome, SIGNAL(middleMouseClicked()), p_QupZilla, SLOT(goHomeInNewTab())); connect(m_buttonHome, SIGNAL(middleMouseClicked()), m_window, SLOT(goHomeInNewTab()));
connect(m_buttonHome, SIGNAL(controlClicked()), p_QupZilla, SLOT(goHomeInNewTab())); connect(m_buttonHome, SIGNAL(controlClicked()), m_window, SLOT(goHomeInNewTab()));
connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab())); connect(m_buttonAddTab, SIGNAL(clicked()), m_window, SLOT(addTab()));
connect(m_buttonAddTab, SIGNAL(middleMouseClicked()), p_QupZilla->tabWidget(), SLOT(addTabFromClipboard())); connect(m_buttonAddTab, SIGNAL(middleMouseClicked()), m_window->tabWidget(), SLOT(addTabFromClipboard()));
connect(m_exitFullscreen, SIGNAL(clicked(bool)), p_QupZilla, SLOT(toggleFullScreen())); connect(m_exitFullscreen, SIGNAL(clicked(bool)), m_window, SLOT(toggleFullScreen()));
} }
void NavigationBar::setSplitterSizes(int locationBar, int websearchBar) void NavigationBar::setSplitterSizes(int locationBar, int websearchBar)
@ -244,11 +244,11 @@ void NavigationBar::setLayoutSpacing(int spacing)
void NavigationBar::aboutToShowHistoryBackMenu() void NavigationBar::aboutToShowHistoryBackMenu()
{ {
if (!m_menuBack || !p_QupZilla->weView()) { if (!m_menuBack || !m_window->weView()) {
return; return;
} }
m_menuBack->clear(); m_menuBack->clear();
QWebHistory* history = p_QupZilla->weView()->history(); QWebHistory* history = m_window->weView()->history();
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0; int count = 0;
@ -278,12 +278,12 @@ void NavigationBar::aboutToShowHistoryBackMenu()
void NavigationBar::aboutToShowHistoryNextMenu() void NavigationBar::aboutToShowHistoryNextMenu()
{ {
if (!m_menuForward || !p_QupZilla->weView()) { if (!m_menuForward || !m_window->weView()) {
return; return;
} }
m_menuForward->clear(); m_menuForward->clear();
QWebHistory* history = p_QupZilla->weView()->history(); QWebHistory* history = m_window->weView()->history();
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0; int count = 0;
@ -312,19 +312,19 @@ void NavigationBar::aboutToShowHistoryNextMenu()
void NavigationBar::clearHistory() void NavigationBar::clearHistory()
{ {
QWebHistory* history = p_QupZilla->weView()->page()->history(); QWebHistory* history = m_window->weView()->page()->history();
history->clear(); history->clear();
refreshHistory(); refreshHistory();
} }
void NavigationBar::contextMenuRequested(const QPoint &pos) void NavigationBar::contextMenuRequested(const QPoint &pos)
{ {
p_QupZilla->popupToolbarsMenu(mapToGlobal(pos)); m_window->popupToolbarsMenu(mapToGlobal(pos));
} }
void NavigationBar::goAtHistoryIndex() void NavigationBar::goAtHistoryIndex()
{ {
QWebHistory* history = p_QupZilla->weView()->page()->history(); QWebHistory* history = m_window->weView()->page()->history();
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
history->goToItem(history->itemAt(action->data().toInt())); history->goToItem(history->itemAt(action->data().toInt()));
@ -343,10 +343,10 @@ void NavigationBar::goAtHistoryIndexInNewTab(int index)
return; return;
} }
TabWidget* tabWidget = p_QupZilla->tabWidget(); TabWidget* tabWidget = m_window->tabWidget();
int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex()); int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex());
QWebHistory* history = p_QupZilla->weView(tabIndex)->page()->history(); QWebHistory* history = m_window->weView(tabIndex)->page()->history();
history->goToItem(history->itemAt(index)); history->goToItem(history->itemAt(index));
if (qzSettings->newTabPosition == Qz::NT_SelectedTab) { if (qzSettings->newTabPosition == Qz::NT_SelectedTab) {
@ -356,24 +356,24 @@ void NavigationBar::goAtHistoryIndexInNewTab(int index)
void NavigationBar::refreshHistory() void NavigationBar::refreshHistory()
{ {
if (mApp->isClosing() || p_QupZilla->isClosing() || !p_QupZilla->weView()) { if (mApp->isClosing() || m_window->isClosing() || !m_window->weView()) {
return; return;
} }
QWebHistory* history = p_QupZilla->weView()->page()->history(); QWebHistory* history = m_window->weView()->page()->history();
m_buttonBack->setEnabled(history->canGoBack()); m_buttonBack->setEnabled(history->canGoBack());
m_buttonNext->setEnabled(history->canGoForward()); m_buttonNext->setEnabled(history->canGoForward());
} }
void NavigationBar::goBack() void NavigationBar::goBack()
{ {
QWebHistory* history = p_QupZilla->weView()->page()->history(); QWebHistory* history = m_window->weView()->page()->history();
history->back(); history->back();
} }
void NavigationBar::goBackInNewTab() void NavigationBar::goBackInNewTab()
{ {
QWebHistory* history = p_QupZilla->weView()->page()->history(); QWebHistory* history = m_window->weView()->page()->history();
if (!history->canGoBack()) { if (!history->canGoBack()) {
return; return;
@ -389,13 +389,13 @@ void NavigationBar::goBackInNewTab()
void NavigationBar::goForward() void NavigationBar::goForward()
{ {
QWebHistory* history = p_QupZilla->weView()->page()->history(); QWebHistory* history = m_window->weView()->page()->history();
history->forward(); history->forward();
} }
void NavigationBar::goForwardInNewTab() void NavigationBar::goForwardInNewTab()
{ {
QWebHistory* history = p_QupZilla->weView()->page()->history(); QWebHistory* history = m_window->weView()->page()->history();
if (!history->canGoForward()) { if (!history->canGoForward()) {
return; return;

View File

@ -27,7 +27,7 @@ class QSplitter;
class ToolButton; class ToolButton;
class WebSearchBar; class WebSearchBar;
class QupZilla; class BrowserWindow;
class ReloadStopButton; class ReloadStopButton;
class Menu; class Menu;
class QUrl; class QUrl;
@ -36,7 +36,7 @@ class QT_QUPZILLA_EXPORT NavigationBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit NavigationBar(QupZilla* mainClass); explicit NavigationBar(BrowserWindow* window);
Q_PROPERTY(int layoutMargin READ layoutMargin WRITE setLayoutMargin) Q_PROPERTY(int layoutMargin READ layoutMargin WRITE setLayoutMargin)
Q_PROPERTY(int layoutSpacing READ layoutSpacing WRITE setLayoutSpacing) Q_PROPERTY(int layoutSpacing READ layoutSpacing WRITE setLayoutSpacing)
@ -87,7 +87,7 @@ private:
QString titleForUrl(QString title, const QUrl &url); QString titleForUrl(QString title, const QUrl &url);
QIcon iconForPage(const QUrl &url, const QIcon &sIcon); QIcon iconForPage(const QUrl &url, const QIcon &sIcon);
QupZilla* p_QupZilla; BrowserWindow* m_window;
QHBoxLayout* m_layout; QHBoxLayout* m_layout;
QSplitter* m_navigationSplitter; QSplitter* m_navigationSplitter;

View File

@ -17,13 +17,13 @@
* ============================================================ */ * ============================================================ */
#include "navigationcontainer.h" #include "navigationcontainer.h"
#include "qzsettings.h" #include "qzsettings.h"
#include "qupzilla.h" #include "browserwindow.h"
#include <QPainter> #include <QPainter>
NavigationContainer::NavigationContainer(QupZilla* parent) NavigationContainer::NavigationContainer(BrowserWindow* parent)
: QWidget(parent) : QWidget(parent)
, p_QupZilla(parent) , m_window(parent)
{ {
} }
@ -31,12 +31,12 @@ void NavigationContainer::paintEvent(QPaintEvent* event)
{ {
QWidget::paintEvent(event); QWidget::paintEvent(event);
if (p_QupZilla->tabsOnTop()) { if (m_window->tabsOnTop()) {
// Draw line at the bottom of navigation bar if tabs are on top // Draw line at the bottom of navigation bar if tabs are on top
// To visually distinguish navigation bar from the page // To visually distinguish navigation bar from the page
QPainter p(this); QPainter p(this);
QRect lineRect(0, height() - 1, width(), 1); QRect lineRect(0, height() - 1, width(), 1);
QColor c = p_QupZilla->palette().window().color().darker(125); QColor c = m_window->palette().window().color().darker(125);
p.fillRect(lineRect, c); p.fillRect(lineRect, c);
} }
} }

View File

@ -22,17 +22,17 @@
#include "qzsettings.h" #include "qzsettings.h"
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT NavigationContainer : public QWidget class QT_QUPZILLA_EXPORT NavigationContainer : public QWidget
{ {
public: public:
explicit NavigationContainer(QupZilla* parent = 0); explicit NavigationContainer(BrowserWindow* parent = 0);
private: private:
void paintEvent(QPaintEvent* event); void paintEvent(QPaintEvent* event);
QupZilla* p_QupZilla; BrowserWindow* m_window;
}; };

View File

@ -27,9 +27,9 @@
#include <QApplication> #include <QApplication>
#include <QContextMenuEvent> #include <QContextMenuEvent>
SiteIcon::SiteIcon(QupZilla* window, LocationBar* parent) SiteIcon::SiteIcon(BrowserWindow* window, LocationBar* parent)
: ToolButton(parent) : ToolButton(parent)
, p_QupZilla(window) , m_window(window)
, m_locationBar(parent) , m_locationBar(parent)
, m_view(0) , m_view(0)
{ {
@ -49,7 +49,7 @@ void SiteIcon::setWebView(WebView* view)
void SiteIcon::iconClicked() void SiteIcon::iconClicked()
{ {
if (!m_view || !p_QupZilla) { if (!m_view || !m_window) {
return; return;
} }
@ -59,7 +59,7 @@ void SiteIcon::iconClicked()
return; return;
} }
SiteInfoWidget* info = new SiteInfoWidget(p_QupZilla); SiteInfoWidget* info = new SiteInfoWidget(m_window);
info->showAt(parentWidget()); info->showAt(parentWidget());
} }

View File

@ -23,14 +23,14 @@
class LocationBar; class LocationBar;
class WebView; class WebView;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT SiteIcon : public ToolButton class QT_QUPZILLA_EXPORT SiteIcon : public ToolButton
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SiteIcon(QupZilla* window, LocationBar* parent); explicit SiteIcon(BrowserWindow* window, LocationBar* parent);
void setWebView(WebView* view); void setWebView(WebView* view);
@ -42,7 +42,7 @@ private:
void mousePressEvent(QMouseEvent* e); void mousePressEvent(QMouseEvent* e);
void mouseMoveEvent(QMouseEvent* e); void mouseMoveEvent(QMouseEvent* e);
QupZilla* p_QupZilla; BrowserWindow* m_window;
LocationBar* m_locationBar; LocationBar* m_locationBar;
WebView* m_view; WebView* m_view;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "websearchbar.h" #include "websearchbar.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webpage.h" #include "webpage.h"
@ -52,9 +52,9 @@ void WebSearchBar_Button::contextMenuEvent(QContextMenuEvent* event)
event->accept(); event->accept();
} }
WebSearchBar::WebSearchBar(QupZilla* mainClass) WebSearchBar::WebSearchBar(BrowserWindow* window)
: LineEdit(mainClass) : LineEdit(window)
, p_QupZilla(mainClass) , m_window(window)
, m_pasteAndGoAction(0) , m_pasteAndGoAction(0)
, m_clearAction(0) , m_clearAction(0)
, m_reloadingEngines(false) , m_reloadingEngines(false)
@ -202,25 +202,25 @@ void WebSearchBar::instantSearchChanged(bool enable)
void WebSearchBar::search() void WebSearchBar::search()
{ {
p_QupZilla->weView()->setFocus(); m_window->weView()->setFocus();
SearchEnginesManager::SearchResult res = m_searchManager->searchResult(m_activeEngine, text()); SearchEnginesManager::SearchResult res = m_searchManager->searchResult(m_activeEngine, text());
p_QupZilla->weView()->load(res.request, res.operation, res.data); m_window->weView()->load(res.request, res.operation, res.data);
} }
void WebSearchBar::searchInNewTab() void WebSearchBar::searchInNewTab()
{ {
p_QupZilla->weView()->setFocus(); m_window->weView()->setFocus();
int index = p_QupZilla->tabWidget()->addView(QUrl()); int index = m_window->tabWidget()->addView(QUrl());
SearchEnginesManager::SearchResult res = m_searchManager->searchResult(m_activeEngine, text()); SearchEnginesManager::SearchResult res = m_searchManager->searchResult(m_activeEngine, text());
p_QupZilla->weView(index)->load(res.request, res.operation, res.data); m_window->weView(index)->load(res.request, res.operation, res.data);
} }
void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu) void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu)
{ {
WebView* view = p_QupZilla->weView(); WebView* view = m_window->weView();
QWebFrame* frame = view->page()->mainFrame(); QWebFrame* frame = view->page()->mainFrame();
QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]")); QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]"));

View File

@ -28,7 +28,7 @@
class QStringListModel; class QStringListModel;
class QupZilla; class BrowserWindow;
class LineEdit; class LineEdit;
class ClickableLabel; class ClickableLabel;
class SearchEnginesManager; class SearchEnginesManager;
@ -52,7 +52,7 @@ class QT_QUPZILLA_EXPORT WebSearchBar : public LineEdit
Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight) Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight)
public: public:
explicit WebSearchBar(QupZilla* mainClass); explicit WebSearchBar(BrowserWindow* window);
private slots: private slots:
void searchChanged(const ButtonWithMenu::Item &item); void searchChanged(const ButtonWithMenu::Item &item);
@ -85,7 +85,7 @@ private:
OpenSearchEngine* m_openSearchEngine; OpenSearchEngine* m_openSearchEngine;
SearchEngine m_activeEngine; SearchEngine m_activeEngine;
QupZilla* p_QupZilla; BrowserWindow* m_window;
WebSearchBar_Button* m_buttonSearch; WebSearchBar_Button* m_buttonSearch;
ButtonWithMenu* m_boxSearchType; ButtonWithMenu* m_boxSearchType;

View File

@ -18,7 +18,7 @@
#include "cabundleupdater.h" #include "cabundleupdater.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "networkmanager.h" #include "networkmanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "qztools.h" #include "qztools.h"
#include <QTimer> #include <QTimer>
@ -69,7 +69,7 @@ void CaBundleUpdater::start()
if (updateNow) { if (updateNow) {
m_progress = CheckLastUpdate; m_progress = CheckLastUpdate;
QUrl url = QUrl::fromEncoded(QString(QupZilla::WWWADDRESS + "/certs/bundle_version").toUtf8()); QUrl url = QUrl::fromEncoded(QString(Qz::WWWADDRESS + "/certs/bundle_version").toUtf8());
m_reply = m_manager->get(QNetworkRequest(url)); m_reply = m_manager->get(QNetworkRequest(url));
connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished()));
} }
@ -96,7 +96,7 @@ void CaBundleUpdater::replyFinished()
if (m_latestBundleVersion > currentBundleVersion) { if (m_latestBundleVersion > currentBundleVersion) {
m_progress = LoadBundle; m_progress = LoadBundle;
QUrl url = QUrl::fromEncoded(QString(QupZilla::WWWADDRESS + "/certs/ca-bundle.crt").toUtf8()); QUrl url = QUrl::fromEncoded(QString(Qz::WWWADDRESS + "/certs/ca-bundle.crt").toUtf8());
m_reply = m_manager->get(QNetworkRequest(url)); m_reply = m_manager->get(QNetworkRequest(url));
connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished()));
} }

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "networkmanager.h" #include "networkmanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "autofill.h" #include "autofill.h"
#include "networkmanagerproxy.h" #include "networkmanagerproxy.h"
#include "mainapplication.h" #include "mainapplication.h"

View File

@ -20,7 +20,7 @@
#include "iconprovider.h" #include "iconprovider.h"
#include "downloadoptionsdialog.h" #include "downloadoptionsdialog.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QFileDialog> #include <QFileDialog>

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "qupzillaschemehandler.h" #include "qupzillaschemehandler.h"
#include "qztools.h" #include "qztools.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webpage.h" #include "webpage.h"
@ -32,6 +32,12 @@
#include <QSettings> #include <QSettings>
#include <QWebSecurityOrigin> #include <QWebSecurityOrigin>
#if QT_VERSION < 0x050000
#include "qwebkitversion.h"
#else
#include <QWebPage>
#endif
static QString authorString(const char* name, const QString &mail) static QString authorString(const char* name, const QString &mail)
{ {
return QString("%1 &lt;<a href=\"mailto:%2\">%2</a>&gt;").arg(QString::fromUtf8(name), mail); return QString("%1 &lt;<a href=\"mailto:%2\">%2</a>&gt;").arg(QString::fromUtf8(name), mail);
@ -158,13 +164,13 @@ QString QupZillaSchemeReply::reportbugPage()
bPage.replace(QLatin1String("%FIELDS-ARE-REQUIRED%"), tr("Please fill out all required fields!")); bPage.replace(QLatin1String("%FIELDS-ARE-REQUIRED%"), tr("Please fill out all required fields!"));
bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystem()); bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystem());
bPage.replace(QLatin1String("%INFO_APP%"), QupZilla::VERSION bPage.replace(QLatin1String("%INFO_APP%"), Qz::VERSION
#ifdef GIT_REVISION #ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")" + " (" + GIT_REVISION + ")"
#endif #endif
); );
bPage.replace(QLatin1String("%INFO_QT%"), QString("%1 (built with %2)").arg(qVersion(), QT_VERSION_STR)); bPage.replace(QLatin1String("%INFO_QT%"), QString("%1 (built with %2)").arg(qVersion(), QT_VERSION_STR));
bPage.replace(QLatin1String("%INFO_WEBKIT%"), QupZilla::WEBKITVERSION), bPage.replace(QLatin1String("%INFO_WEBKIT%"), qWebKitVersion()),
bPage = QzTools::applyDirectionToPage(bPage); bPage = QzTools::applyDirectionToPage(bPage);
return bPage; return bPage;
@ -186,7 +192,7 @@ QString QupZillaSchemeReply::startPage()
sPage.replace(QLatin1String("%TITLE%"), tr("Start Page")); sPage.replace(QLatin1String("%TITLE%"), tr("Start Page"));
sPage.replace(QLatin1String("%BUTTON-LABEL%"), tr("Search on Web")); sPage.replace(QLatin1String("%BUTTON-LABEL%"), tr("Search on Web"));
sPage.replace(QLatin1String("%SEARCH-BY%"), tr("Search results provided by DuckDuckGo")); sPage.replace(QLatin1String("%SEARCH-BY%"), tr("Search results provided by DuckDuckGo"));
sPage.replace(QLatin1String("%WWW%"), QupZilla::WIKIADDRESS); sPage.replace(QLatin1String("%WWW%"), Qz::WIKIADDRESS);
sPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla")); sPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla"));
sPage.replace(QLatin1String("%PRIVATE-BROWSING%"), mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : QString()); sPage.replace(QLatin1String("%PRIVATE-BROWSING%"), mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : QString());
sPage = QzTools::applyDirectionToPage(sPage); sPage = QzTools::applyDirectionToPage(sPage);
@ -211,14 +217,14 @@ QString QupZillaSchemeReply::aboutPage()
aPage.replace(QLatin1String("%COPYRIGHT%"), tr("Copyright")); aPage.replace(QLatin1String("%COPYRIGHT%"), tr("Copyright"));
aPage.replace(QLatin1String("%VERSION-INFO%"), aPage.replace(QLatin1String("%VERSION-INFO%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), QupZilla::VERSION QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), Qz::VERSION
#ifdef GIT_REVISION #ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")" + " (" + GIT_REVISION + ")"
#endif #endif
) + ) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION)); QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), qWebKitVersion()));
aPage.replace(QLatin1String("%MAIN-DEVELOPER%"), tr("Main developer")); aPage.replace(QLatin1String("%MAIN-DEVELOPER%"), tr("Main developer"));
aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(QupZilla::AUTHOR.toUtf8(), "nowrep@gmail.com")); aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(Qz::AUTHOR.toUtf8(), "nowrep@gmail.com"));
aPage.replace(QLatin1String("%CONTRIBUTORS%"), tr("Contributors")); aPage.replace(QLatin1String("%CONTRIBUTORS%"), tr("Contributors"));
aPage.replace(QLatin1String("%CONTRIBUTORS-TEXT%"), aPage.replace(QLatin1String("%CONTRIBUTORS-TEXT%"),
authorString("Mladen Pejaković", "pejakm@autistici.org") + "<br/>" + authorString("Mladen Pejaković", "pejakm@autistici.org") + "<br/>" +
@ -380,14 +386,14 @@ QString QupZillaSchemeReply::configPage()
cPage.replace(QLatin1String("%PL-DESC%"), tr("Description")); cPage.replace(QLatin1String("%PL-DESC%"), tr("Description"));
cPage.replace(QLatin1String("%VERSION-INFO%"), cPage.replace(QLatin1String("%VERSION-INFO%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"), QupZilla::VERSION QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"), Qz::VERSION
#ifdef GIT_REVISION #ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")" + " (" + GIT_REVISION + ")"
#endif #endif
) + ) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Qt version"), QT_VERSION_STR) + QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Qt version"), QT_VERSION_STR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) + QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), qWebKitVersion()) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Build time"), QupZilla::BUILDTIME) + QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Build time"), Qz::BUILDTIME) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), QzTools::operatingSystem())); QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), QzTools::operatingSystem()));
cPage.replace(QLatin1String("%PATHS-TEXT%"), cPage.replace(QLatin1String("%PATHS-TEXT%"),

View File

@ -17,12 +17,18 @@
* ============================================================ */ * ============================================================ */
#include "aboutdialog.h" #include "aboutdialog.h"
#include "ui_aboutdialog.h" #include "ui_aboutdialog.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webpage.h" #include "webpage.h"
#include "qtwin.h" #include "qtwin.h"
#if QT_VERSION < 0x050000
#include "qwebkitversion.h"
#else
#include <QWebPage>
#endif
AboutDialog::AboutDialog(QWidget* parent) AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent), : QDialog(parent),
ui(new Ui::AboutDialog) ui(new Ui::AboutDialog)
@ -60,15 +66,15 @@ void AboutDialog::showAbout()
ui->authorsButton->setText(tr("Authors and Contributors")); ui->authorsButton->setText(tr("Authors and Contributors"));
if (m_aboutHtml.isEmpty()) { if (m_aboutHtml.isEmpty()) {
m_aboutHtml += "<center><div style='margin:10px;'>"; m_aboutHtml += "<center><div style='margin:10px;'>";
m_aboutHtml += tr("<p><b>Application version %1</b><br/>").arg(QupZilla::VERSION m_aboutHtml += tr("<p><b>Application version %1</b><br/>").arg(Qz::VERSION
#ifdef GIT_REVISION #ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")" + " (" + GIT_REVISION + ")"
#endif #endif
); );
m_aboutHtml += tr("<b>WebKit version %1</b></p>").arg(QupZilla::WEBKITVERSION); m_aboutHtml += tr("<b>WebKit version %1</b></p>").arg(qWebKitVersion());
m_aboutHtml += QString("<p>&copy; %1 %2<br/>").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR); m_aboutHtml += QString("<p>&copy; %1 %2<br/>").arg(Qz::COPYRIGHT, Qz::AUTHOR);
m_aboutHtml += tr("<small>Build time: %1 </small></p>").arg(QupZilla::BUILDTIME); m_aboutHtml += tr("<small>Build time: %1 </small></p>").arg(Qz::BUILDTIME);
m_aboutHtml += QString("<p><a href=%1>%1</a></p>").arg(QupZilla::WWWADDRESS); m_aboutHtml += QString("<p><a href=%1>%1</a></p>").arg(Qz::WWWADDRESS);
m_aboutHtml += "<p>" + (mApp->windowCount() > 0 ? mApp->getWindow()->weView()->page()->userAgentForUrl(QUrl()) : QString()) + "</p>"; m_aboutHtml += "<p>" + (mApp->windowCount() > 0 ? mApp->getWindow()->weView()->page()->userAgentForUrl(QUrl()) : QString()) + "</p>";
m_aboutHtml += "</div></center>"; m_aboutHtml += "</div></center>";
} }
@ -80,7 +86,7 @@ void AboutDialog::showAuthors()
ui->authorsButton->setText(tr("< About QupZilla")); ui->authorsButton->setText(tr("< About QupZilla"));
if (m_authorsHtml.isEmpty()) { if (m_authorsHtml.isEmpty()) {
m_authorsHtml += "<center><div style='margin:10px;'>"; m_authorsHtml += "<center><div style='margin:10px;'>";
m_authorsHtml += tr("<p><b>Main developer:</b><br/>%1 &lt;%2&gt;</p>").arg(QupZilla::AUTHOR, "<a href=mailto:nowrep@gmail.com>nowrep@gmail.com</a>"); m_authorsHtml += tr("<p><b>Main developer:</b><br/>%1 &lt;%2&gt;</p>").arg(Qz::AUTHOR, "<a href=mailto:nowrep@gmail.com>nowrep@gmail.com</a>");
m_authorsHtml += tr("<p><b>Contributors:</b><br/>%1</p>").arg( m_authorsHtml += tr("<p><b>Contributors:</b><br/>%1</p>").arg(
QString::fromUtf8("Mladen Pejaković<br/>" QString::fromUtf8("Mladen Pejaković<br/>"
"Alexander Samilov<br/>" "Alexander Samilov<br/>"

View File

@ -29,11 +29,11 @@
#include <QMenu> #include <QMenu>
#include <QCloseEvent> #include <QCloseEvent>
BrowsingLibrary::BrowsingLibrary(QupZilla* mainClass, QWidget* parent) BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::BrowsingLibrary) , ui(new Ui::BrowsingLibrary)
, m_historyManager(new HistoryManager(mainClass)) , m_historyManager(new HistoryManager(window))
, m_bookmarksManager(new BookmarksManager(mainClass)) , m_bookmarksManager(new BookmarksManager(window))
, m_rssManager(mApp->rssManager()) , m_rssManager(mApp->rssManager())
, m_rssLoaded(false) , m_rssLoaded(false)
{ {
@ -112,31 +112,31 @@ void BrowsingLibrary::exportBookmarks()
d->show(); d->show();
} }
void BrowsingLibrary::showHistory(QupZilla* mainClass) void BrowsingLibrary::showHistory(BrowserWindow* window)
{ {
ui->tabs->SetCurrentIndex(0); ui->tabs->SetCurrentIndex(0);
show(); show();
m_historyManager->setMainWindow(mainClass); m_historyManager->setMainWindow(window);
raise(); raise();
activateWindow(); activateWindow();
} }
void BrowsingLibrary::showBookmarks(QupZilla* mainClass) void BrowsingLibrary::showBookmarks(BrowserWindow* window)
{ {
ui->tabs->SetCurrentIndex(1); ui->tabs->SetCurrentIndex(1);
show(); show();
m_bookmarksManager->setMainWindow(mainClass); m_bookmarksManager->setMainWindow(window);
raise(); raise();
activateWindow(); activateWindow();
} }
void BrowsingLibrary::showRSS(QupZilla* mainClass) void BrowsingLibrary::showRSS(BrowserWindow* window)
{ {
ui->tabs->SetCurrentIndex(2); ui->tabs->SetCurrentIndex(2);
show(); show();
m_rssManager->setMainWindow(mainClass); m_rssManager->setMainWindow(window);
if (!m_rssLoaded) { if (!m_rssLoaded) {
m_rssManager->refreshTable(); m_rssManager->refreshTable();

View File

@ -30,18 +30,18 @@ class BrowsingLibrary;
class HistoryManager; class HistoryManager;
class BookmarksManager; class BookmarksManager;
class RSSManager; class RSSManager;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT BrowsingLibrary : public QWidget class QT_QUPZILLA_EXPORT BrowsingLibrary : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BrowsingLibrary(QupZilla* mainClass, QWidget* parent = 0); explicit BrowsingLibrary(BrowserWindow* window, QWidget* parent = 0);
~BrowsingLibrary(); ~BrowsingLibrary();
void showHistory(QupZilla* mainClass); void showHistory(BrowserWindow* window);
void showBookmarks(QupZilla* mainClass); void showBookmarks(BrowserWindow* window);
void showRSS(QupZilla* mainClass); void showRSS(BrowserWindow* window);
void optimizeDatabase(); void optimizeDatabase();

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "clearprivatedata.h" #include "clearprivatedata.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "cookiejar.h" #include "cookiejar.h"
#include "history.h" #include "history.h"
@ -38,9 +38,9 @@
#include <QCloseEvent> #include <QCloseEvent>
#include <QFileInfo> #include <QFileInfo>
ClearPrivateData::ClearPrivateData(QupZilla* mainClass, QWidget* parent) ClearPrivateData::ClearPrivateData(BrowserWindow* window, QWidget* parent)
: QDialog(parent) : QDialog(parent)
, p_QupZilla(mainClass) , m_window(window)
, ui(new Ui::ClearPrivateData) , ui(new Ui::ClearPrivateData)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -27,12 +27,12 @@ namespace Ui
class ClearPrivateData; class ClearPrivateData;
} }
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT ClearPrivateData : public QDialog class QT_QUPZILLA_EXPORT ClearPrivateData : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ClearPrivateData(QupZilla* mainClass, QWidget* parent = 0); explicit ClearPrivateData(BrowserWindow* window, QWidget* parent = 0);
static void clearLocalStorage(); static void clearLocalStorage();
static void clearWebDatabases(); static void clearWebDatabases();
@ -50,7 +50,7 @@ private:
void restoreState(const QByteArray &state); void restoreState(const QByteArray &state);
QByteArray saveState(); QByteArray saveState();
QupZilla* p_QupZilla; BrowserWindow* m_window;
Ui::ClearPrivateData* ui; Ui::ClearPrivateData* ui;
}; };

View File

@ -18,7 +18,7 @@
* ============================================================ */ * ============================================================ */
#include "macmenureceiver.h" #include "macmenureceiver.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "settings.h" #include "settings.h"
#include <QAction> #include <QAction>
@ -78,7 +78,7 @@ bool MacMenuReceiver::callSlot(const char* member, bool makeIfNoWindow, QGeneric
{ {
//qDebug("MacMenuReceiver::callSlot: \'QupZilla::%s()\'", member); //qDebug("MacMenuReceiver::callSlot: \'QupZilla::%s()\'", member);
QupZilla* qzWindow = mApp->getWindow(); BrowserWindow* qzWindow = mApp->getWindow();
if (!qzWindow) { if (!qzWindow) {
if (!makeIfNoWindow) { if (!makeIfNoWindow) {
return false; return false;

View File

@ -20,7 +20,7 @@
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webpage.h" #include "webpage.h"
#include "qztools.h" #include "qztools.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "settings.h" #include "settings.h"
#include <QFileDialog> #include <QFileDialog>
@ -169,7 +169,7 @@ void PageScreen::saveAsDocument(const QString &format)
} }
QPrinter printer; QPrinter printer;
printer.setCreator(QupZilla::tr("QupZilla %1 (%2)").arg(QupZilla::VERSION, QupZilla::WWWADDRESS)); printer.setCreator(BrowserWindow::tr("QupZilla %1 (%2)").arg(Qz::VERSION, Qz::WWWADDRESS));
printer.setOutputFileName(pathWithoutSuffix + suffix); printer.setOutputFileName(pathWithoutSuffix + suffix);
printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(m_pageImages.first().size(), QPrinter::DevicePixel); printer.setPaperSize(m_pageImages.first().size(), QPrinter::DevicePixel);

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "statusbarmessage.h" #include "statusbarmessage.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "squeezelabelv1.h" #include "squeezelabelv1.h"
@ -101,28 +101,28 @@ bool TipLabel::eventFilter(QObject* o, QEvent* e)
return false; return false;
} }
StatusBarMessage::StatusBarMessage(QupZilla* mainClass) StatusBarMessage::StatusBarMessage(BrowserWindow* window)
: p_QupZilla(mainClass) : m_window(window)
, m_statusBarText(new TipLabel(mainClass)) , m_statusBarText(new TipLabel(window))
{ {
} }
void StatusBarMessage::showMessage(const QString &message) void StatusBarMessage::showMessage(const QString &message)
{ {
if (p_QupZilla->statusBar()->isVisible()) { if (m_window->statusBar()->isVisible()) {
p_QupZilla->statusBar()->showMessage(message); m_window->statusBar()->showMessage(message);
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
else if (mApp->activeWindow() == p_QupZilla) { else if (mApp->activeWindow() == m_window) {
#else #else
else { else {
#endif #endif
WebView* view = p_QupZilla->weView(); WebView* view = m_window->weView();
QWebFrame* mainFrame = view->page()->mainFrame(); QWebFrame* mainFrame = view->page()->mainFrame();
int horizontalScrollSize = 0; int horizontalScrollSize = 0;
int verticalScrollSize = 0; int verticalScrollSize = 0;
const int scrollbarSize = p_QupZilla->style()->pixelMetric(QStyle::PM_ScrollBarExtent); const int scrollbarSize = m_window->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
if (mainFrame->scrollBarMaximum(Qt::Horizontal)) { if (mainFrame->scrollBarMaximum(Qt::Horizontal)) {
horizontalScrollSize = scrollbarSize; horizontalScrollSize = scrollbarSize;
@ -149,8 +149,8 @@ void StatusBarMessage::showMessage(const QString &message)
void StatusBarMessage::clearMessage() void StatusBarMessage::clearMessage()
{ {
if (p_QupZilla->statusBar()->isVisible()) { if (m_window->statusBar()->isVisible()) {
p_QupZilla->statusBar()->showMessage(QString()); m_window->statusBar()->showMessage(QString());
} }
else { else {
m_statusBarText->hideDelayed(); m_statusBarText->hideDelayed();

View File

@ -26,7 +26,7 @@
class QTimer; class QTimer;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT TipLabel : public SqueezeLabelV1 class QT_QUPZILLA_EXPORT TipLabel : public SqueezeLabelV1
{ {
@ -48,13 +48,13 @@ private:
class QT_QUPZILLA_EXPORT StatusBarMessage class QT_QUPZILLA_EXPORT StatusBarMessage
{ {
public: public:
explicit StatusBarMessage(QupZilla* mainClass); explicit StatusBarMessage(BrowserWindow* window);
void showMessage(const QString &message); void showMessage(const QString &message);
void clearMessage(); void clearMessage();
private: private:
QupZilla* p_QupZilla; BrowserWindow* m_window;
TipLabel* m_statusBarText; TipLabel* m_statusBarText;
}; };

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "updater.h" #include "updater.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "qztools.h" #include "qztools.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "tabwidget.h" #include "tabwidget.h"
@ -111,17 +111,17 @@ QString Updater::Version::versionString() const
return QString("%1.%2.%3").arg(majorVersion, minorVersion, revisionNumber); return QString("%1.%2.%3").arg(majorVersion, minorVersion, revisionNumber);
} }
Updater::Updater(QupZilla* mainClass, QObject* parent) Updater::Updater(BrowserWindow* window, QObject* parent)
: QObject(parent) : QObject(parent)
, p_QupZilla(mainClass) , m_window(window)
{ {
QTimer::singleShot(60 * 1000, this, SLOT(start())); // Start checking after 1 minute QTimer::singleShot(60 * 1000, this, SLOT(start())); // Start checking after 1 minute
} }
void Updater::start() void Updater::start()
{ {
QUrl url = QUrl(QString("%1/update.php?v=%2&os=%3").arg(QupZilla::WWWADDRESS, QUrl url = QUrl(QString("%1/update.php?v=%2&os=%3").arg(Qz::WWWADDRESS,
QupZilla::VERSION, Qz::VERSION,
QzTools::operatingSystem())); QzTools::operatingSystem()));
startDownloadingUpdateInfo(url); startDownloadingUpdateInfo(url);
@ -141,7 +141,7 @@ void Updater::downCompleted(QNetworkReply* reply)
if (html.startsWith(QLatin1String("Version:"))) { if (html.startsWith(QLatin1String("Version:"))) {
html.remove(QLatin1String("Version:")); html.remove(QLatin1String("Version:"));
Version current(QupZilla::VERSION); Version current(Qz::VERSION);
Version updated(html); Version updated(html);
if (current.isValid && updated.isValid && current < updated) { if (current.isValid && updated.isValid && current < updated) {
@ -154,7 +154,7 @@ void Updater::downCompleted(QNetworkReply* reply)
void Updater::downloadNewVersion() void Updater::downloadNewVersion()
{ {
p_QupZilla->tabWidget()->addView(QUrl(QupZilla::WWWADDRESS + "/download"), tr("Update"), Qz::NT_NotSelectedTab); m_window->tabWidget()->addView(QUrl(Qz::WWWADDRESS + "/download"), tr("Update"), Qz::NT_NotSelectedTab);
} }
Updater::~Updater() Updater::~Updater()

View File

@ -25,13 +25,13 @@
class QNetworkReply; class QNetworkReply;
class QUrl; class QUrl;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT Updater : public QObject class QT_QUPZILLA_EXPORT Updater : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Updater(QupZilla* mainClass, QObject* parent = 0); explicit Updater(BrowserWindow* window, QObject* parent = 0);
~Updater(); ~Updater();
struct QT_QUPZILLA_EXPORT Version { struct QT_QUPZILLA_EXPORT Version {
@ -60,7 +60,7 @@ private slots:
private: private:
void startDownloadingUpdateInfo(const QUrl &url); void startDownloadingUpdateInfo(const QUrl &url);
QupZilla* p_QupZilla; BrowserWindow* m_window;
}; };
#endif // UPDATER_H #endif // UPDATER_H

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "useragentmanager.h" #include "useragentmanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "qztools.h" #include "qztools.h"
#include "settings.h" #include "settings.h"
@ -25,7 +25,7 @@
UserAgentManager::UserAgentManager() UserAgentManager::UserAgentManager()
: m_usePerDomainUserAgent(false) : m_usePerDomainUserAgent(false)
{ {
m_fakeUserAgent = QString("Mozilla/5.0 (%1) AppleWebKit/%2 (KHTML, like Gecko) Chrome/10.0 Safari/%2").arg(QzTools::operatingSystem(), QupZilla::WEBKITVERSION); m_fakeUserAgent = QString("Mozilla/5.0 (%1) AppleWebKit/%2 (KHTML, like Gecko) Chrome/10.0 Safari/%2").arg(QzTools::operatingSystem(), BrowserWindow::WEBKITVERSION);
} }
void UserAgentManager::loadSettings() void UserAgentManager::loadSettings()

View File

@ -44,7 +44,7 @@
#include "squeezelabelv2.h" #include "squeezelabelv2.h"
#include "webpage.h" #include "webpage.h"
#include "qztools.h" #include "qztools.h"
#include "qupzilla.h" #include "browserwindow.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QToolButton> #include <QToolButton>

View File

@ -213,12 +213,12 @@ void PluginProxy::emitWebPageDeleted(WebPage* page)
emit webPageDeleted(page); emit webPageDeleted(page);
} }
void PluginProxy::emitMainWindowCreated(QupZilla* window) void PluginProxy::emitMainWindowCreated(BrowserWindow* window)
{ {
emit mainWindowCreated(window); emit mainWindowCreated(window);
} }
void PluginProxy::emitMainWindowDeleted(QupZilla* window) void PluginProxy::emitMainWindowDeleted(BrowserWindow* window)
{ {
emit mainWindowDeleted(window); emit mainWindowDeleted(window);
} }

View File

@ -21,7 +21,7 @@
#include "plugins.h" #include "plugins.h"
#include "qz_namespace.h" #include "qz_namespace.h"
class QupZilla; class BrowserWindow;
class WebPage; class WebPage;
class QT_QUPZILLA_EXPORT PluginProxy : public Plugins class QT_QUPZILLA_EXPORT PluginProxy : public Plugins
@ -54,15 +54,15 @@ public:
void emitWebPageCreated(WebPage* page); void emitWebPageCreated(WebPage* page);
void emitWebPageDeleted(WebPage* page); void emitWebPageDeleted(WebPage* page);
void emitMainWindowCreated(QupZilla* window); void emitMainWindowCreated(BrowserWindow* window);
void emitMainWindowDeleted(QupZilla* window); void emitMainWindowDeleted(BrowserWindow* window);
signals: signals:
void webPageCreated(WebPage* page); void webPageCreated(WebPage* page);
void webPageDeleted(WebPage* page); void webPageDeleted(WebPage* page);
void mainWindowCreated(QupZilla* window); void mainWindowCreated(BrowserWindow* window);
void mainWindowDeleted(QupZilla* window); void mainWindowDeleted(BrowserWindow* window);
private slots: private slots:
void pluginUnloaded(PluginInterface* plugin); void pluginUnloaded(PluginInterface* plugin);

View File

@ -26,9 +26,9 @@
#include <QStyle> #include <QStyle>
#include <QWebFrame> #include <QWebFrame>
PopupStatusBarMessage::PopupStatusBarMessage(PopupWindow* mainClass) PopupStatusBarMessage::PopupStatusBarMessage(PopupWindow* window)
: m_popupWindow(mainClass) : m_popupWindow(window)
, m_statusBarText(new TipLabel(mainClass)) , m_statusBarText(new TipLabel(window))
{ {
} }

View File

@ -26,7 +26,7 @@ class TipLabel;
class QT_QUPZILLA_EXPORT PopupStatusBarMessage class QT_QUPZILLA_EXPORT PopupStatusBarMessage
{ {
public: public:
explicit PopupStatusBarMessage(PopupWindow* mainClass); explicit PopupStatusBarMessage(PopupWindow* window);
void showMessage(const QString &message); void showMessage(const QString &message);
void clearMessage(); void clearMessage();

View File

@ -18,7 +18,7 @@
#include "popupwebpage.h" #include "popupwebpage.h"
#include "popupwebview.h" #include "popupwebview.h"
#include "popupwindow.h" #include "popupwindow.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
@ -31,9 +31,9 @@
// //
// Got an idea how to determine it from kWebKitPart. // Got an idea how to determine it from kWebKitPart.
PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, QupZilla* mainClass) PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, BrowserWindow* window)
: WebPage() : WebPage()
, p_QupZilla(mainClass) , m_window(window)
, m_type(type) , m_type(type)
, m_createNewWindow(false) , m_createNewWindow(false)
, m_menuBarVisible(false) , m_menuBarVisible(false)
@ -54,9 +54,9 @@ PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, QupZilla* mainClass)
QTimer::singleShot(0, this, SLOT(checkBehaviour())); QTimer::singleShot(0, this, SLOT(checkBehaviour()));
} }
QupZilla* PopupWebPage::mainWindow() const BrowserWindow* PopupWebPage::mainWindow() const
{ {
return p_QupZilla; return m_window;
} }
void PopupWebPage::slotGeometryChangeRequested(const QRect &rect) void PopupWebPage::slotGeometryChangeRequested(const QRect &rect)
@ -129,7 +129,7 @@ void PopupWebPage::checkBehaviour()
view->fakeLoadingProgress(m_progress); view->fakeLoadingProgress(m_progress);
} }
p_QupZilla->addDeleteOnCloseWidget(popup); m_window->addDeleteOnCloseWidget(popup);
disconnect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect))); disconnect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
disconnect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool))); disconnect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
@ -141,8 +141,8 @@ void PopupWebPage::checkBehaviour()
disconnect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); disconnect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
} }
else { else {
int index = p_QupZilla->tabWidget()->addView(QUrl(), Qz::NT_CleanSelectedTab); int index = m_window->tabWidget()->addView(QUrl(), Qz::NT_CleanSelectedTab);
TabbedWebView* view = p_QupZilla->weView(index); TabbedWebView* view = m_window->weView(index);
view->setWebPage(this); view->setWebPage(this);
if (m_isLoading) { if (m_isLoading) {

View File

@ -21,15 +21,15 @@
#include "qz_namespace.h" #include "qz_namespace.h"
#include "webpage.h" #include "webpage.h"
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT PopupWebPage : public WebPage class QT_QUPZILLA_EXPORT PopupWebPage : public WebPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PopupWebPage(WebWindowType type, QupZilla* mainClass); explicit PopupWebPage(WebWindowType type, BrowserWindow* window);
QupZilla* mainWindow() const; BrowserWindow* mainWindow() const;
private slots: private slots:
void slotGeometryChangeRequested(const QRect &rect); void slotGeometryChangeRequested(const QRect &rect);
@ -44,7 +44,7 @@ private slots:
void checkBehaviour(); void checkBehaviour();
private: private:
QupZilla* p_QupZilla; BrowserWindow* m_window;
QWebPage::WebWindowType m_type; QWebPage::WebWindowType m_type;
bool m_createNewWindow; bool m_createNewWindow;

View File

@ -18,7 +18,7 @@
#include "popupwebview.h" #include "popupwebview.h"
#include "popupwebpage.h" #include "popupwebpage.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "iconprovider.h" #include "iconprovider.h"
@ -65,7 +65,7 @@ void PopupWebView::loadInNewTab(const QNetworkRequest &req, QNetworkAccessManage
{ {
Q_UNUSED(position) Q_UNUSED(position)
QupZilla* window = mApp->getWindow(); BrowserWindow* window = mApp->getWindow();
if (window) { if (window) {
QNetworkRequest r(req); QNetworkRequest r(req);

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "preferences.h" #include "preferences.h"
#include "ui_preferences.h" #include "ui_preferences.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "bookmarkstoolbar.h" #include "bookmarkstoolbar.h"
#include "history.h" #include "history.h"
#include "tabwidget.h" #include "tabwidget.h"
@ -70,10 +70,10 @@ static QString createLanguageItem(const QString &lang)
return QString("%1, %2 (%3)").arg(language, country, lang); return QString("%1, %2 (%3)").arg(language, country, lang);
} }
Preferences::Preferences(QupZilla* mainClass, QWidget* parent) Preferences::Preferences(BrowserWindow* window, QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::Preferences) , ui(new Ui::Preferences)
, p_QupZilla(mainClass) , m_window(window)
, m_autoFillManager(0) , m_autoFillManager(0)
, m_pluginsList(0) , m_pluginsList(0)
, m_autoFillEnabled(false) , m_autoFillEnabled(false)
@ -169,7 +169,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
afterLaunchChanged(ui->afterLaunch->currentIndex()); afterLaunchChanged(ui->afterLaunch->currentIndex());
connect(ui->afterLaunch, SIGNAL(currentIndexChanged(int)), this, SLOT(afterLaunchChanged(int))); connect(ui->afterLaunch, SIGNAL(currentIndexChanged(int)), this, SLOT(afterLaunchChanged(int)));
connect(ui->newTab, SIGNAL(currentIndexChanged(int)), this, SLOT(newTabChanged(int))); connect(ui->newTab, SIGNAL(currentIndexChanged(int)), this, SLOT(newTabChanged(int)));
if (p_QupZilla) { if (m_window) {
connect(ui->useCurrentBut, SIGNAL(clicked()), this, SLOT(useActualHomepage())); connect(ui->useCurrentBut, SIGNAL(clicked()), this, SLOT(useActualHomepage()));
connect(ui->newTabUseCurrent, SIGNAL(clicked()), this, SLOT(useActualNewTab())); connect(ui->newTabUseCurrent, SIGNAL(clicked()), this, SLOT(useActualNewTab()));
} }
@ -206,9 +206,9 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
//APPEREANCE //APPEREANCE
settings.beginGroup("Browser-View-Settings"); settings.beginGroup("Browser-View-Settings");
ui->showStatusbar->setChecked(settings.value("showStatusBar", true).toBool()); ui->showStatusbar->setChecked(settings.value("showStatusBar", true).toBool());
if (p_QupZilla) { if (m_window) {
ui->showBookmarksToolbar->setChecked(p_QupZilla->bookmarksToolbar()->isVisible()); ui->showBookmarksToolbar->setChecked(m_window->bookmarksToolbar()->isVisible());
ui->showNavigationToolbar->setChecked(p_QupZilla->navigationBar()->isVisible()); ui->showNavigationToolbar->setChecked(m_window->navigationBar()->isVisible());
} }
else { else {
ui->showBookmarksToolbar->setChecked(settings.value("showBookmarksToolbar", true).toBool()); ui->showBookmarksToolbar->setChecked(settings.value("showBookmarksToolbar", true).toBool());
@ -260,7 +260,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
bool pbInABuseCC = settings.value("UseCustomProgressColor", false).toBool(); bool pbInABuseCC = settings.value("UseCustomProgressColor", false).toBool();
ui->checkBoxCustomProgressColor->setChecked(pbInABuseCC); ui->checkBoxCustomProgressColor->setChecked(pbInABuseCC);
ui->progressBarColorSelector->setEnabled(pbInABuseCC); ui->progressBarColorSelector->setEnabled(pbInABuseCC);
QColor pbColor = settings.value("CustomProgressColor", p_QupZilla->palette().color(QPalette::Highlight)).value<QColor>(); QColor pbColor = settings.value("CustomProgressColor", m_window->palette().color(QPalette::Highlight)).value<QColor>();
setProgressBarColorIcon(pbColor); setProgressBarColorIcon(pbColor);
connect(ui->customColorToolButton, SIGNAL(clicked(bool)), SLOT(selectCustomProgressBarColor())); connect(ui->customColorToolButton, SIGNAL(clicked(bool)), SLOT(selectCustomProgressBarColor()));
connect(ui->resetProgressBarcolor, SIGNAL(clicked()), SLOT(setProgressBarColorIcon())); connect(ui->resetProgressBarcolor, SIGNAL(clicked()), SLOT(setProgressBarColorIcon()));
@ -478,7 +478,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*))); connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true); ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true);
ui->version->setText(" QupZilla v" + QupZilla::VERSION); ui->version->setText(" QupZilla v" + Qz::VERSION);
ui->listWidget->setCurrentRow(currentSettingsPage); ui->listWidget->setCurrentRow(currentSettingsPage);
QDesktopWidget* desktop = QApplication::desktop(); QDesktopWidget* desktop = QApplication::desktop();
@ -575,12 +575,12 @@ void Preferences::allowCacheChanged(bool state)
void Preferences::useActualHomepage() void Preferences::useActualHomepage()
{ {
ui->homepage->setText(p_QupZilla->weView()->url().toString()); ui->homepage->setText(m_window->weView()->url().toString());
} }
void Preferences::useActualNewTab() void Preferences::useActualNewTab()
{ {
ui->newTabUrl->setText(p_QupZilla->weView()->url().toString()); ui->newTabUrl->setText(m_window->weView()->url().toString());
} }
void Preferences::chooseDownPath() void Preferences::chooseDownPath()
@ -807,7 +807,7 @@ void Preferences::createProfile()
QFile versionFile(dir.absolutePath() + "/version"); QFile versionFile(dir.absolutePath() + "/version");
versionFile.open(QFile::WriteOnly); versionFile.open(QFile::WriteOnly);
versionFile.write(QupZilla::VERSION.toUtf8()); versionFile.write(Qz::VERSION.toUtf8());
versionFile.close(); versionFile.close();
ui->startProfile->insertItem(0, name); ui->startProfile->insertItem(0, name);
@ -1096,7 +1096,7 @@ void Preferences::setProgressBarColorIcon(QColor color)
const int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize); const int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
QPixmap pm(QSize(size, size)); QPixmap pm(QSize(size, size));
if (!color.isValid()) { if (!color.isValid()) {
color = p_QupZilla->palette().color(QPalette::Highlight); color = m_window->palette().color(QPalette::Highlight);
} }
pm.fill(color); pm.fill(color);
ui->customColorToolButton->setIcon(pm); ui->customColorToolButton->setIcon(pm);

View File

@ -32,7 +32,7 @@ class QAbstractButton;
class QListWidgetItem; class QListWidgetItem;
class AutoFillManager; class AutoFillManager;
class QupZilla; class BrowserWindow;
class PluginsManager; class PluginsManager;
class DesktopNotification; class DesktopNotification;
class ThemeManager; class ThemeManager;
@ -42,7 +42,7 @@ class QT_QUPZILLA_EXPORT Preferences : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit Preferences(QupZilla* mainClass, QWidget* parent = 0); explicit Preferences(BrowserWindow* window, QWidget* parent = 0);
~Preferences(); ~Preferences();
private slots: private slots:
@ -97,7 +97,7 @@ private:
void closeEvent(QCloseEvent* event); void closeEvent(QCloseEvent* event);
Ui::Preferences* ui; Ui::Preferences* ui;
QupZilla* p_QupZilla; BrowserWindow* m_window;
AutoFillManager* m_autoFillManager; AutoFillManager* m_autoFillManager;
PluginsManager* m_pluginsList; PluginsManager* m_pluginsList;
ThemeManager* m_themesManager; ThemeManager* m_themesManager;

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "rssmanager.h" #include "rssmanager.h"
#include "ui_rssmanager.h" #include "ui_rssmanager.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "treewidget.h" #include "treewidget.h"
@ -38,10 +38,10 @@
#include <QBuffer> #include <QBuffer>
#include <QSqlQuery> #include <QSqlQuery>
RSSManager::RSSManager(QupZilla* mainClass, QWidget* parent) RSSManager::RSSManager(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::RSSManager) , ui(new Ui::RSSManager)
, p_QupZilla(mainClass) , m_window(window)
{ {
ui->setupUi(this); ui->setupUi(this);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@ -63,12 +63,12 @@ RSSManager::RSSManager(QupZilla* mainClass, QWidget* parent)
connect(ui->edit, SIGNAL(clicked()), this, SLOT(editFeed())); connect(ui->edit, SIGNAL(clicked()), this, SLOT(editFeed()));
} }
QupZilla* RSSManager::getQupZilla() BrowserWindow* RSSManager::getQupZilla()
{ {
if (!p_QupZilla) { if (!m_window) {
p_QupZilla = mApp->getWindow(); m_window = mApp->getWindow();
} }
return p_QupZilla.data(); return m_window.data();
} }
void RSSManager::deleteAllTabs() void RSSManager::deleteAllTabs()
@ -80,10 +80,10 @@ void RSSManager::deleteAllTabs()
} }
} }
void RSSManager::setMainWindow(QupZilla* window) void RSSManager::setMainWindow(BrowserWindow* window)
{ {
if (window) { if (window) {
p_QupZilla = window; m_window = window;
} }
} }

View File

@ -35,7 +35,7 @@ namespace Ui
class RSSManager; class RSSManager;
} }
class QupZilla; class BrowserWindow;
class FollowRedirectReply; class FollowRedirectReply;
class NetworkManager; class NetworkManager;
class QT_QUPZILLA_EXPORT RSSManager : public QWidget class QT_QUPZILLA_EXPORT RSSManager : public QWidget
@ -44,11 +44,11 @@ class QT_QUPZILLA_EXPORT RSSManager : public QWidget
friend class BrowsingLibrary; friend class BrowsingLibrary;
public: public:
explicit RSSManager(QupZilla* mainClass, QWidget* parent = 0); explicit RSSManager(BrowserWindow* window, QWidget* parent = 0);
~RSSManager(); ~RSSManager();
bool addRssFeed(const QUrl &url, const QString &title, const QIcon &icon); bool addRssFeed(const QUrl &url, const QString &title, const QIcon &icon);
void setMainWindow(QupZilla* window); void setMainWindow(BrowserWindow* window);
public slots: public slots:
void refreshTable(); void refreshTable();
@ -66,7 +66,7 @@ private slots:
void loadFeedInNewTab(); void loadFeedInNewTab();
private: private:
QupZilla* getQupZilla(); BrowserWindow* getQupZilla();
void deleteAllTabs(); void deleteAllTabs();
QList<QPair<FollowRedirectReply*, QUrl> > m_replies; QList<QPair<FollowRedirectReply*, QUrl> > m_replies;
@ -74,7 +74,7 @@ private:
Ui::RSSManager* ui; Ui::RSSManager* ui;
QToolButton* m_reloadButton; QToolButton* m_reloadButton;
QPointer<QupZilla> p_QupZilla; QPointer<BrowserWindow> m_window;
}; };
#endif // RSSMANAGER_H #endif // RSSMANAGER_H

View File

@ -21,13 +21,13 @@
#include "restoremanager.h" #include "restoremanager.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "webview.h" #include "webview.h"
#include "qupzilla.h" #include "browserwindow.h"
RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) RecoveryWidget::RecoveryWidget(WebView* view, BrowserWindow* window)
: QWidget() : QWidget()
, ui(new Ui::RecoveryWidget) , ui(new Ui::RecoveryWidget)
, m_view(view) , m_view(view)
, p_QupZilla(mainClass) , m_window(window)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -96,14 +96,14 @@ void RecoveryWidget::restoreSession()
} }
} }
if (!mApp->restoreStateSlot(p_QupZilla, data)) { if (!mApp->restoreStateSlot(m_window, data)) {
newSession(); newSession();
} }
} }
void RecoveryWidget::newSession() void RecoveryWidget::newSession()
{ {
m_view->load(p_QupZilla->homepageUrl()); m_view->load(m_window->homepageUrl());
mApp->destroyRestoreManager(); mApp->destroyRestoreManager();
} }

View File

@ -29,14 +29,14 @@ class RecoveryWidget;
class QTreeWidgetItem; class QTreeWidgetItem;
class WebView; class WebView;
class QupZilla; class BrowserWindow;
class RecoveryWidget : public QWidget class RecoveryWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RecoveryWidget(WebView* view, QupZilla* mainClass); explicit RecoveryWidget(WebView* view, BrowserWindow* window);
~RecoveryWidget(); ~RecoveryWidget();
private slots: private slots:
@ -47,7 +47,7 @@ private:
Ui::RecoveryWidget* ui; Ui::RecoveryWidget* ui;
WebView* m_view; WebView* m_view;
QupZilla* p_QupZilla; BrowserWindow* m_window;
}; };
#endif // RECOVERYWIDGET_H #endif // RECOVERYWIDGET_H

View File

@ -24,10 +24,10 @@
#include <QMenu> #include <QMenu>
BookmarksSidebar::BookmarksSidebar(QupZilla* mainClass, QWidget* parent) BookmarksSidebar::BookmarksSidebar(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::BookmarksSideBar) , ui(new Ui::BookmarksSideBar)
, m_window(mainClass) , m_window(window)
, m_bookmarks(mApp->bookmarks()) , m_bookmarks(mApp->bookmarks())
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -27,7 +27,7 @@ namespace Ui
class BookmarksSideBar; class BookmarksSideBar;
} }
class QupZilla; class BrowserWindow;
class Bookmarks; class Bookmarks;
class BookmarkItem; class BookmarkItem;
@ -36,7 +36,7 @@ class QT_QUPZILLA_EXPORT BookmarksSidebar : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit BookmarksSidebar(QupZilla* mainClass, QWidget* parent = 0); explicit BookmarksSidebar(BrowserWindow* window, QWidget* parent = 0);
~BookmarksSidebar(); ~BookmarksSidebar();
private slots: private slots:
@ -53,7 +53,7 @@ private slots:
private: private:
Ui::BookmarksSideBar* ui; Ui::BookmarksSideBar* ui;
QupZilla* m_window; BrowserWindow* m_window;
Bookmarks* m_bookmarks; Bookmarks* m_bookmarks;
}; };

View File

@ -17,17 +17,17 @@
* ============================================================ */ * ============================================================ */
#include "historysidebar.h" #include "historysidebar.h"
#include "ui_historysidebar.h" #include "ui_historysidebar.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "historymodel.h" #include "historymodel.h"
#include "qzsettings.h" #include "qzsettings.h"
HistorySideBar::HistorySideBar(QupZilla* mainClass, QWidget* parent) HistorySideBar::HistorySideBar(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::HistorySideBar) , ui(new Ui::HistorySideBar)
, p_QupZilla(mainClass) , m_window(window)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -43,10 +43,10 @@ HistorySideBar::HistorySideBar(QupZilla* mainClass, QWidget* parent)
void HistorySideBar::openLink(const QUrl &url, HistoryView::OpenBehavior openIn) void HistorySideBar::openLink(const QUrl &url, HistoryView::OpenBehavior openIn)
{ {
if (openIn == HistoryView::OpenInNewTab) { if (openIn == HistoryView::OpenInNewTab) {
p_QupZilla->tabWidget()->addView(url, qzSettings->newTabPosition); m_window->tabWidget()->addView(url, qzSettings->newTabPosition);
} }
else { else {
p_QupZilla->weView()->load(url); m_window->weView()->load(url);
} }
} }

View File

@ -28,14 +28,14 @@ namespace Ui
class HistorySideBar; class HistorySideBar;
} }
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT HistorySideBar : public QWidget class QT_QUPZILLA_EXPORT HistorySideBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit HistorySideBar(QupZilla* mainClass, QWidget* parent = 0); explicit HistorySideBar(BrowserWindow* window, QWidget* parent = 0);
~HistorySideBar(); ~HistorySideBar();
private slots: private slots:
@ -43,7 +43,7 @@ private slots:
private: private:
Ui::HistorySideBar* ui; Ui::HistorySideBar* ui;
QupZilla* p_QupZilla; BrowserWindow* m_window;
}; };
#endif // HISTORYSIDEBAR_H #endif // HISTORYSIDEBAR_H

View File

@ -21,16 +21,16 @@
#include "bookmarkssidebar.h" #include "bookmarkssidebar.h"
#include "historysidebar.h" #include "historysidebar.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "settings.h" #include "settings.h"
#include <QMenu> #include <QMenu>
QHash<QString, QPointer<SideBarInterface> > SideBarManager::s_sidebars; QHash<QString, QPointer<SideBarInterface> > SideBarManager::s_sidebars;
SideBar::SideBar(SideBarManager* manager, QupZilla* mainClass) SideBar::SideBar(SideBarManager* manager, BrowserWindow* window)
: QWidget(mainClass) : QWidget(window)
, p_QupZilla(mainClass) , m_window(window)
, m_manager(manager) , m_manager(manager)
{ {
setObjectName("sidebar"); setObjectName("sidebar");
@ -62,14 +62,14 @@ void SideBar::setWidget(QWidget* widget)
void SideBar::showBookmarks() void SideBar::showBookmarks()
{ {
m_titleBar->setTitle(tr("Bookmarks")); m_titleBar->setTitle(tr("Bookmarks"));
BookmarksSidebar* bar = new BookmarksSidebar(p_QupZilla); BookmarksSidebar* bar = new BookmarksSidebar(m_window);
setWidget(bar); setWidget(bar);
} }
void SideBar::showHistory() void SideBar::showHistory()
{ {
m_titleBar->setTitle(tr("History")); m_titleBar->setTitle(tr("History"));
HistorySideBar* bar = new HistorySideBar(p_QupZilla); HistorySideBar* bar = new HistorySideBar(m_window);
setWidget(bar); setWidget(bar);
} }
@ -85,9 +85,9 @@ void SideBar::close()
QWidget::close(); QWidget::close();
} }
SideBarManager::SideBarManager(QupZilla* parent) SideBarManager::SideBarManager(BrowserWindow* parent)
: QObject(parent) : QObject(parent)
, p_QupZilla(parent) , m_window(parent)
, m_menu(0) , m_menu(0)
{ {
} }
@ -103,7 +103,7 @@ void SideBarManager::addSidebar(const QString &id, SideBarInterface* interface)
{ {
s_sidebars[id] = interface; s_sidebars[id] = interface;
foreach (QupZilla* window, mApp->mainWindows()) { foreach (BrowserWindow* window, mApp->mainWindows()) {
window->sideBarManager()->refreshMenu(); window->sideBarManager()->refreshMenu();
} }
} }
@ -112,7 +112,7 @@ void SideBarManager::removeSidebar(const QString &id)
{ {
s_sidebars.remove(id); s_sidebars.remove(id);
foreach (QupZilla* window, mApp->mainWindows()) { foreach (BrowserWindow* window, mApp->mainWindows()) {
window->sideBarManager()->sideBarRemoved(id); window->sideBarManager()->sideBarRemoved(id);
} }
} }
@ -124,7 +124,7 @@ void SideBarManager::refreshMenu()
} }
foreach (QAction* action, m_menu->actions()) { foreach (QAction* action, m_menu->actions()) {
p_QupZilla->removeAction(action); m_window->removeAction(action);
} }
m_menu->clear(); m_menu->clear();
@ -150,7 +150,7 @@ void SideBarManager::refreshMenu()
m_menu->addAction(act); m_menu->addAction(act);
} }
p_QupZilla->addActions(m_menu->actions()); m_window->addActions(m_menu->actions());
updateActions(); updateActions();
} }
@ -180,7 +180,7 @@ void SideBarManager::showSideBar(const QString &id, bool toggle)
} }
if (!m_sideBar) { if (!m_sideBar) {
m_sideBar = p_QupZilla->addSideBar(); m_sideBar = m_window->addSideBar();
} }
if (id == m_activeBar) { if (id == m_activeBar) {
@ -209,7 +209,7 @@ void SideBarManager::showSideBar(const QString &id, bool toggle)
} }
m_sideBar.data()->setTitle(sidebar->title()); m_sideBar.data()->setTitle(sidebar->title());
m_sideBar.data()->setWidget(sidebar->createSideBarWidget(p_QupZilla)); m_sideBar.data()->setWidget(sidebar->createSideBarWidget(m_window));
} }
m_activeBar = id; m_activeBar = id;
@ -239,7 +239,7 @@ void SideBarManager::closeSideBar()
Settings settings; Settings settings;
settings.setValue("Browser-View-Settings/SideBar", m_activeBar); settings.setValue("Browser-View-Settings/SideBar", m_activeBar);
p_QupZilla->saveSideBarWidth(); m_window->saveSideBarWidth();
updateActions(); updateActions();
} }

View File

@ -30,13 +30,13 @@ class QMenu;
class DockTitleBarWidget; class DockTitleBarWidget;
class SideBarInterface; class SideBarInterface;
class SideBarManager; class SideBarManager;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT SideBar : public QWidget class QT_QUPZILLA_EXPORT SideBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SideBar(SideBarManager* manager, QupZilla* mainClass); explicit SideBar(SideBarManager* manager, BrowserWindow* window);
void showBookmarks(); void showBookmarks();
void showHistory(); void showHistory();
@ -48,7 +48,7 @@ public slots:
void close(); void close();
private: private:
QupZilla* p_QupZilla; BrowserWindow* m_window;
QVBoxLayout* m_layout; QVBoxLayout* m_layout;
DockTitleBarWidget* m_titleBar; DockTitleBarWidget* m_titleBar;
SideBarManager* m_manager; SideBarManager* m_manager;
@ -58,7 +58,7 @@ class QT_QUPZILLA_EXPORT SideBarManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SideBarManager(QupZilla* parent); explicit SideBarManager(BrowserWindow* parent);
void setSideBarMenu(QMenu* menu); void setSideBarMenu(QMenu* menu);
void refreshMenu(); void refreshMenu();
@ -77,7 +77,7 @@ private slots:
private: private:
void updateActions(); void updateActions();
QupZilla* p_QupZilla; BrowserWindow* m_window;
QPointer<SideBar> m_sideBar; QPointer<SideBar> m_sideBar;
QMenu* m_menu; QMenu* m_menu;

View File

@ -24,7 +24,7 @@
class QAction; class QAction;
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT SideBarInterface : public QObject class QT_QUPZILLA_EXPORT SideBarInterface : public QObject
{ {
@ -34,7 +34,7 @@ public:
virtual QString title() const = 0; virtual QString title() const = 0;
virtual QAction* createMenuAction() = 0; virtual QAction* createMenuAction() = 0;
virtual QWidget* createSideBarWidget(QupZilla* mainWindow) = 0; virtual QWidget* createSideBarWidget(BrowserWindow* mainWindow) = 0;
}; };
#endif // SIDEBARINTERFACE_H #endif // SIDEBARINTERFACE_H

View File

@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "menubar.h" #include "menubar.h"
#include "qupzilla.h" #include "browserwindow.h"
MenuBar::MenuBar(QupZilla* parent) MenuBar::MenuBar(BrowserWindow* parent)
: QMenuBar(parent) : QMenuBar(parent)
, p_QupZilla(parent) , m_window(parent)
{ {
setObjectName("mainwindow-menubar"); setObjectName("mainwindow-menubar");
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
@ -33,6 +33,6 @@ MenuBar::MenuBar(QupZilla* parent)
void MenuBar::contextMenuRequested(const QPoint &pos) void MenuBar::contextMenuRequested(const QPoint &pos)
{ {
if (!actionAt(pos)) { if (!actionAt(pos)) {
p_QupZilla->popupToolbarsMenu(mapToGlobal(pos)); m_window->popupToolbarsMenu(mapToGlobal(pos));
} }
} }

View File

@ -22,19 +22,19 @@
#include <QMenuBar> #include <QMenuBar>
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT MenuBar : public QMenuBar class QT_QUPZILLA_EXPORT MenuBar : public QMenuBar
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MenuBar(QupZilla* parent); explicit MenuBar(BrowserWindow* parent);
private slots: private slots:
void contextMenuRequested(const QPoint &pos); void contextMenuRequested(const QPoint &pos);
private: private:
QupZilla* p_QupZilla; BrowserWindow* m_window;
}; };

View File

@ -18,7 +18,7 @@
#include "qztools.h" #include "qztools.h"
#include "siteinfowidget.h" #include "siteinfowidget.h"
#include "ui_siteinfowidget.h" #include "ui_siteinfowidget.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "webpage.h" #include "webpage.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
@ -26,17 +26,17 @@
#include <QToolTip> #include <QToolTip>
#include <QSqlQuery> #include <QSqlQuery>
SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent) SiteInfoWidget::SiteInfoWidget(BrowserWindow* window, QWidget* parent)
: LocationBarPopup(parent) : LocationBarPopup(parent)
, ui(new Ui::SiteInfoWidget) , ui(new Ui::SiteInfoWidget)
, p_QupZilla(mainClass) , m_window(window)
{ {
this->setAttribute(Qt::WA_DeleteOnClose); this->setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this); ui->setupUi(this);
setPopupAlignment(Qt::AlignLeft); setPopupAlignment(Qt::AlignLeft);
WebView* view = p_QupZilla->weView(); WebView* view = m_window->weView();
WebPage* webPage = view->page(); WebPage* webPage = view->page();
QUrl url = view->url(); QUrl url = view->url();
@ -82,7 +82,7 @@ SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent)
ui->historyLabel->setText(tr("This is your <b>%1</b> visit of this site.").arg(text)); ui->historyLabel->setText(tr("This is your <b>%1</b> visit of this site.").arg(text));
} }
} }
connect(ui->pushButton, SIGNAL(clicked()), p_QupZilla, SLOT(showPageInfo())); connect(ui->pushButton, SIGNAL(clicked()), m_window, SLOT(showPageInfo()));
} }
SiteInfoWidget::~SiteInfoWidget() SiteInfoWidget::~SiteInfoWidget()

View File

@ -28,18 +28,18 @@ namespace Ui
class SiteInfoWidget; class SiteInfoWidget;
} }
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT SiteInfoWidget : public LocationBarPopup class QT_QUPZILLA_EXPORT SiteInfoWidget : public LocationBarPopup
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SiteInfoWidget(QupZilla* mainClass, QWidget* parent = 0); explicit SiteInfoWidget(BrowserWindow* window, QWidget* parent = 0);
~SiteInfoWidget(); ~SiteInfoWidget();
private: private:
Ui::SiteInfoWidget* ui; Ui::SiteInfoWidget* ui;
QupZilla* p_QupZilla; BrowserWindow* m_window;
}; };
#endif // SITEINFOWIDGET_H #endif // SITEINFOWIDGET_H

View File

@ -18,7 +18,7 @@
#include "tabbar.h" #include "tabbar.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "tabpreview.h" #include "tabpreview.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "webtab.h" #include "webtab.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "toolbutton.h" #include "toolbutton.h"
@ -40,11 +40,11 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QToolTip> #include <QToolTip>
TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget) TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
: ComboTabBar() : ComboTabBar()
, p_QupZilla(mainClass) , m_window(window)
, m_tabWidget(tabWidget) , m_tabWidget(tabWidget)
, m_tabPreview(new TabPreview(mainClass, mainClass)) , m_tabPreview(new TabPreview(window, window))
, m_showTabPreviews(false) , m_showTabPreviews(false)
, m_hideTabBarWithOneTab(false) , m_hideTabBarWithOneTab(false)
, m_clickedTab(0) , m_clickedTab(0)
@ -77,7 +77,7 @@ TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
// ComboTabBar features // ComboTabBar features
setUsesScrollButtons(true); setUsesScrollButtons(true);
setCloseButtonsToolTip(QupZilla::tr("Close Tab")); setCloseButtonsToolTip(BrowserWindow::tr("Close Tab"));
connect(this, SIGNAL(overFlowChanged(bool)), this, SLOT(overFlowChange(bool))); connect(this, SIGNAL(overFlowChanged(bool)), this, SLOT(overFlowChange(bool)));
connect(this, SIGNAL(scrollBarValueChanged(int)), this, SLOT(hideTabPreview())); connect(this, SIGNAL(scrollBarValueChanged(int)), this, SLOT(hideTabPreview()));
} }
@ -122,7 +122,7 @@ void TabBar::updateVisibilityWithFullscreen(bool visible)
void TabBar::setVisible(bool visible) void TabBar::setVisible(bool visible)
{ {
if (visible && p_QupZilla->isFullScreen()) { if (visible && m_window->isFullScreen()) {
return; return;
} }
@ -149,7 +149,7 @@ void TabBar::contextMenuRequested(const QPoint &position)
m_clickedTab = index; m_clickedTab = index;
QMenu menu; QMenu menu;
menu.addAction(QIcon::fromTheme("tab-new", QIcon(":/icons/menu/tab-new.png")), tr("&New tab"), p_QupZilla, SLOT(addTab())); menu.addAction(QIcon::fromTheme("tab-new", QIcon(":/icons/menu/tab-new.png")), tr("&New tab"), m_window, SLOT(addTab()));
menu.addSeparator(); menu.addSeparator();
if (index != -1) { if (index != -1) {
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab)); WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
@ -157,7 +157,7 @@ void TabBar::contextMenuRequested(const QPoint &position)
return; return;
} }
if (p_QupZilla->weView(m_clickedTab)->isLoading()) { if (m_window->weView(m_clickedTab)->isLoading()) {
menu.addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop Tab"), this, SLOT(stopTab())); menu.addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop Tab"), this, SLOT(stopTab()));
} }
else { else {
@ -174,9 +174,9 @@ void TabBar::contextMenuRequested(const QPoint &position)
menu.addSeparator(); menu.addSeparator();
menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs())); menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab())); menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab()));
menu.addAction(tr("Bookmark &All Tabs"), p_QupZilla, SLOT(bookmarkAllTabs())); menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
menu.addSeparator(); menu.addSeparator();
QAction* action = p_QupZilla->actionRestoreTab(); QAction* action = m_window->actionRestoreTab();
action->setEnabled(m_tabWidget->canRestoreTab()); action->setEnabled(m_tabWidget->canRestoreTab());
menu.addAction(action); menu.addAction(action);
menu.addSeparator(); menu.addSeparator();
@ -186,7 +186,7 @@ void TabBar::contextMenuRequested(const QPoint &position)
} }
else { else {
menu.addAction(tr("Reloa&d All Tabs"), m_tabWidget, SLOT(reloadAllTabs())); menu.addAction(tr("Reloa&d All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
menu.addAction(tr("Bookmark &All Tabs"), p_QupZilla, SLOT(bookmarkAllTabs())); menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
menu.addSeparator(); menu.addSeparator();
QAction* action = menu.addAction(QIcon::fromTheme("user-trash"), tr("Restore &Closed Tab"), m_tabWidget, SLOT(restoreClosedTab())); QAction* action = menu.addAction(QIcon::fromTheme("user-trash"), tr("Restore &Closed Tab"), m_tabWidget, SLOT(restoreClosedTab()));
action->setEnabled(m_tabWidget->canRestoreTab()); action->setEnabled(m_tabWidget->canRestoreTab());
@ -197,7 +197,7 @@ void TabBar::contextMenuRequested(const QPoint &position)
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);
menu.exec(p); menu.exec(p);
p_QupZilla->actionRestoreTab()->setEnabled(true); m_window->actionRestoreTab()->setEnabled(true);
} }
void TabBar::closeAllButCurrent() void TabBar::closeAllButCurrent()
@ -451,14 +451,14 @@ void TabBar::currentTabChanged(int index)
void TabBar::bookmarkTab() void TabBar::bookmarkTab()
{ {
TabbedWebView* view = p_QupZilla->weView(m_clickedTab); TabbedWebView* view = m_window->weView(m_clickedTab);
if (!view) { if (!view) {
return; return;
} }
WebTab* tab = view->webTab(); WebTab* tab = view->webTab();
p_QupZilla->addBookmark(tab->url(), tab->title()); m_window->addBookmark(tab->url(), tab->title());
} }
void TabBar::pinTab() void TabBar::pinTab()
@ -510,8 +510,8 @@ void TabBar::showTabPreview(bool delayed)
m_tabPreview->setWebTab(webTab, m_tabPreview->previewIndex() == currentIndex()); m_tabPreview->setWebTab(webTab, m_tabPreview->previewIndex() == currentIndex());
QRect r(tabRect(m_tabPreview->previewIndex())); QRect r(tabRect(m_tabPreview->previewIndex()));
r.setTopLeft(mapTo(p_QupZilla, r.topLeft())); r.setTopLeft(mapTo(m_window, r.topLeft()));
r.setBottomRight(mapTo(p_QupZilla, r.bottomRight())); r.setBottomRight(mapTo(m_window, r.bottomRight()));
m_tabPreview->showOnRect(r); m_tabPreview->showOnRect(r);
} }
@ -734,7 +734,7 @@ void TabBar::dropEvent(QDropEvent* event)
} }
} }
else { else {
WebTab* tab = p_QupZilla->weView(index)->webTab(); WebTab* tab = m_window->weView(index)->webTab();
if (tab->isRestored()) { if (tab->isRestored()) {
tab->view()->load(mime->urls().at(0)); tab->view()->load(mime->urls().at(0));
} }

View File

@ -24,7 +24,7 @@
#include "qz_namespace.h" #include "qz_namespace.h"
class QupZilla; class BrowserWindow;
class TabWidget; class TabWidget;
class TabPreview; class TabPreview;
@ -32,7 +32,7 @@ class QT_QUPZILLA_EXPORT TabBar : public ComboTabBar
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TabBar(QupZilla* mainClass, TabWidget* tabWidget); explicit TabBar(BrowserWindow* window, TabWidget* tabWidget);
void loadSettings(); void loadSettings();
@ -104,7 +104,7 @@ private:
QSize tabSizeHint(int index, bool fast) const; QSize tabSizeHint(int index, bool fast) const;
int comboTabBarPixelMetric(ComboTabBar::SizeType sizeType) const; int comboTabBarPixelMetric(ComboTabBar::SizeType sizeType) const;
QupZilla* p_QupZilla; BrowserWindow* m_window;
TabWidget* m_tabWidget; TabWidget* m_tabWidget;
TabPreview* m_tabPreview; TabPreview* m_tabPreview;
QTimer* m_tabPreviewShowTimer; QTimer* m_tabPreviewShowTimer;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "webpage.h" #include "webpage.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "networkmanager.h" #include "networkmanager.h"
@ -38,9 +38,9 @@
#include <QWebFrame> #include <QWebFrame>
#include <QContextMenuEvent> #include <QContextMenuEvent>
TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab) TabbedWebView::TabbedWebView(BrowserWindow* window, WebTab* webTab)
: WebView(webTab) : WebView(webTab)
, p_QupZilla(mainClass) , m_window(window)
, m_webTab(webTab) , m_webTab(webTab)
, m_menu(new Menu(this)) , m_menu(new Menu(this))
, m_mouseTrack(false) , m_mouseTrack(false)
@ -55,11 +55,11 @@ TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
connect(this, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged())); connect(this, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
connect(this, SIGNAL(iconChanged()), this, SLOT(showIcon())); connect(this, SIGNAL(iconChanged()), this, SLOT(showIcon()));
connect(this, SIGNAL(statusBarMessage(QString)), p_QupZilla->statusBar(), SLOT(showMessage(QString))); connect(this, SIGNAL(statusBarMessage(QString)), m_window->statusBar(), SLOT(showMessage(QString)));
connect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool))); connect(m_window, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));
// Tracking mouse also on tabs created in fullscreen // Tracking mouse also on tabs created in fullscreen
trackMouse(p_QupZilla->isFullScreen()); trackMouse(m_window->isFullScreen());
} }
void TabbedWebView::setWebPage(WebPage* page) void TabbedWebView::setWebPage(WebPage* page)
@ -73,7 +73,7 @@ void TabbedWebView::setWebPage(WebPage* page)
void TabbedWebView::inspectElement() void TabbedWebView::inspectElement()
{ {
p_QupZilla->showWebInspector(false); m_window->showWebInspector(false);
triggerPageAction(QWebPage::InspectElement); triggerPageAction(QWebPage::InspectElement);
} }
@ -84,7 +84,7 @@ WebTab* TabbedWebView::webTab() const
TabWidget* TabbedWebView::tabWidget() const TabWidget* TabbedWebView::tabWidget() const
{ {
return p_QupZilla->tabWidget(); return m_window->tabWidget();
} }
QString TabbedWebView::getIp() const QString TabbedWebView::getIp() const
@ -105,7 +105,7 @@ bool TabbedWebView::isCurrent()
void TabbedWebView::urlChanged(const QUrl &url) void TabbedWebView::urlChanged(const QUrl &url)
{ {
if (isCurrent()) { if (isCurrent()) {
p_QupZilla->navigationBar()->refreshHistory(); m_window->navigationBar()->refreshHistory();
} }
if (lastUrl() != url) { if (lastUrl() != url) {
@ -118,7 +118,7 @@ void TabbedWebView::loadProgress(int prog)
Q_UNUSED(prog) Q_UNUSED(prog)
if (isCurrent()) { if (isCurrent()) {
p_QupZilla->updateLoadingActions(); m_window->updateLoadingActions();
} }
} }
@ -149,7 +149,7 @@ void TabbedWebView::slotLoadFinished()
QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo))); QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo)));
if (isCurrent()) { if (isCurrent()) {
p_QupZilla->updateLoadingActions(); m_window->updateLoadingActions();
} }
} }
@ -171,7 +171,7 @@ void TabbedWebView::titleChanged()
const QString t = title(); const QString t = title();
if (isCurrent()) { if (isCurrent()) {
p_QupZilla->setWindowTitle(tr("%1 - QupZilla").arg(t)); m_window->setWindowTitle(tr("%1 - QupZilla").arg(t));
} }
tabWidget()->setTabText(tabIndex(), t); tabWidget()->setTabText(tabIndex(), t);
@ -198,14 +198,14 @@ void TabbedWebView::linkHovered(const QString &link, const QString &title, const
if (isCurrent()) { if (isCurrent()) {
if (link.isEmpty()) { if (link.isEmpty()) {
p_QupZilla->statusBarMessage()->clearMessage(); m_window->statusBarMessage()->clearMessage();
} }
else { else {
// QUrl::fromEncoded(link.toUtf8()); // QUrl::fromEncoded(link.toUtf8());
// Don't decode link from percent encoding (to show all utf8 chars), as it doesn't // Don't decode link from percent encoding (to show all utf8 chars), as it doesn't
// works correctly in all cases // works correctly in all cases
// See #1095 // See #1095
p_QupZilla->statusBarMessage()->showMessage(link); m_window->statusBarMessage()->showMessage(link);
} }
} }
} }
@ -215,23 +215,23 @@ int TabbedWebView::tabIndex() const
return tabWidget()->indexOf(m_webTab); return tabWidget()->indexOf(m_webTab);
} }
QupZilla* TabbedWebView::mainWindow() const BrowserWindow* TabbedWebView::mainWindow() const
{ {
return p_QupZilla; return m_window;
} }
void TabbedWebView::moveToWindow(QupZilla* window) void TabbedWebView::moveToWindow(BrowserWindow* window)
{ {
disconnect(this, SIGNAL(statusBarMessage(QString)), p_QupZilla->statusBar(), SLOT(showMessage(QString))); disconnect(this, SIGNAL(statusBarMessage(QString)), m_window->statusBar(), SLOT(showMessage(QString)));
disconnect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool))); disconnect(m_window, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));
p_QupZilla = window; m_window = window;
connect(this, SIGNAL(statusBarMessage(QString)), p_QupZilla->statusBar(), SLOT(showMessage(QString))); connect(this, SIGNAL(statusBarMessage(QString)), m_window->statusBar(), SLOT(showMessage(QString)));
connect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool))); connect(m_window, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));
// Tracking mouse also on tabs created in fullscreen // Tracking mouse also on tabs created in fullscreen
trackMouse(p_QupZilla->isFullScreen()); trackMouse(m_window->isFullScreen());
} }
QWidget* TabbedWebView::overlayForJsAlert() QWidget* TabbedWebView::overlayForJsAlert()
@ -251,8 +251,8 @@ void TabbedWebView::loadInNewTab(const QNetworkRequest &req, QNetworkAccessManag
r.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); r.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
int index = tabWidget()->addView(QUrl(), position); int index = tabWidget()->addView(QUrl(), position);
p_QupZilla->weView(index)->webTab()->locationBar()->showUrl(r.url()); m_window->weView(index)->webTab()->locationBar()->showUrl(r.url());
p_QupZilla->weView(index)->load(r, op, data); m_window->weView(index)->load(r, op, data);
} }
void TabbedWebView::contextMenuEvent(QContextMenuEvent* event) void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
@ -264,7 +264,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
createContextMenu(m_menu, hitTest, event->pos()); createContextMenu(m_menu, hitTest, event->pos());
if (!hitTest.isContentEditable() && !hitTest.isContentSelected()) { if (!hitTest.isContentEditable() && !hitTest.isContentSelected()) {
m_menu->addAction(p_QupZilla->adBlockIcon()->menuAction()); m_menu->addAction(m_window->adBlockIcon()->menuAction());
} }
m_menu->addSeparator(); m_menu->addSeparator();
@ -301,11 +301,11 @@ void TabbedWebView::setAsCurrentTab()
void TabbedWebView::mouseMoveEvent(QMouseEvent* event) void TabbedWebView::mouseMoveEvent(QMouseEvent* event)
{ {
if (m_mouseTrack) { if (m_mouseTrack) {
if (p_QupZilla->fullScreenNavigationVisible()) { if (m_window->fullScreenNavigationVisible()) {
p_QupZilla->hideNavigationWithFullScreen(); m_window->hideNavigationWithFullScreen();
} }
else if (event->y() < 5) { else if (event->y() < 5) {
p_QupZilla->showNavigationWithFullScreen(); m_window->showNavigationWithFullScreen();
} }
} }
@ -315,7 +315,7 @@ void TabbedWebView::mouseMoveEvent(QMouseEvent* event)
void TabbedWebView::disconnectObjects() void TabbedWebView::disconnectObjects()
{ {
disconnect(this); disconnect(this);
disconnect(p_QupZilla->statusBar()); disconnect(m_window->statusBar());
WebView::disconnectObjects(); WebView::disconnectObjects();
} }

View File

@ -24,7 +24,7 @@
class QLabel; class QLabel;
class QHostInfo; class QHostInfo;
class QupZilla; class BrowserWindow;
class TabWidget; class TabWidget;
class WebPage; class WebPage;
class WebTab; class WebTab;
@ -34,7 +34,7 @@ class QT_QUPZILLA_EXPORT TabbedWebView : public WebView
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TabbedWebView(QupZilla* mainClass, WebTab* webTab); explicit TabbedWebView(BrowserWindow* window, WebTab* webTab);
~TabbedWebView(); ~TabbedWebView();
void setWebPage(WebPage* pag); void setWebPage(WebPage* pag);
@ -45,8 +45,8 @@ public:
QString getIp() const; QString getIp() const;
int tabIndex() const; int tabIndex() const;
QupZilla* mainWindow() const; BrowserWindow* mainWindow() const;
void moveToWindow(QupZilla* window); void moveToWindow(BrowserWindow* window);
QWidget* overlayForJsAlert(); QWidget* overlayForJsAlert();
void disconnectObjects(); void disconnectObjects();
@ -88,7 +88,7 @@ private:
bool isCurrent(); bool isCurrent();
QupZilla* p_QupZilla; BrowserWindow* m_window;
WebTab* m_webTab; WebTab* m_webTab;
Menu* m_menu; Menu* m_menu;

View File

@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "qupzilla.h" #include "browserwindow.h"
#include "tabpreview.h" #include "tabpreview.h"
#include "qztools.h" #include "qztools.h"
#include "webtab.h" #include "webtab.h"
@ -31,9 +31,9 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QStyleOptionFrame> #include <QStyleOptionFrame>
TabPreview::TabPreview(QupZilla* mainClass, QWidget* parent) TabPreview::TabPreview(BrowserWindow* window, QWidget* parent)
: QFrame(parent) : QFrame(parent)
, p_QupZilla(mainClass) , m_window(window)
, m_previewIndex(-1) , m_previewIndex(-1)
, m_animationsEnabled(true) , m_animationsEnabled(true)
, m_stepX(0) , m_stepX(0)
@ -280,8 +280,8 @@ QPoint TabPreview::calculatePosition(const QRect &tabRect, const QSize &previewS
if (p.x() < 0) { if (p.x() < 0) {
p.setX(0); p.setX(0);
} }
if (p.x() + previewSize.width() > p_QupZilla->width()) { if (p.x() + previewSize.width() > m_window->width()) {
int extraWidth = p.x() + previewSize.width() - p_QupZilla->width(); int extraWidth = p.x() + previewSize.width() - m_window->width();
p.setX(p.x() - extraWidth); p.setX(p.x() - extraWidth);
} }

View File

@ -26,7 +26,7 @@
#include <QGraphicsOpacityEffect> #include <QGraphicsOpacityEffect>
#endif #endif
class QupZilla; class BrowserWindow;
class WebTab; class WebTab;
class QLabel; class QLabel;
@ -34,7 +34,7 @@ class TabPreview : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TabPreview(QupZilla* mainClass, QWidget* parent); explicit TabPreview(BrowserWindow* window, QWidget* parent);
void setWebTab(WebTab* webTab, bool noPixmap); void setWebTab(WebTab* webTab, bool noPixmap);
void showOnRect(const QRect &rect); void showOnRect(const QRect &rect);
@ -65,7 +65,7 @@ private:
void calculateSteps(const QRect &oldGeometry, const QRect &newGeometry); void calculateSteps(const QRect &oldGeometry, const QRect &newGeometry);
QPoint calculatePosition(const QRect &tabRect, const QSize &previewSize); QPoint calculatePosition(const QRect &tabRect, const QSize &previewSize);
QupZilla* p_QupZilla; BrowserWindow* m_window;
QLabel* m_pixmapLabel; QLabel* m_pixmapLabel;
QLabel* m_title; QLabel* m_title;

View File

@ -19,7 +19,7 @@
#include "tabbar.h" #include "tabbar.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webpage.h" #include "webpage.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "webtab.h" #include "webtab.h"
@ -112,9 +112,9 @@ void MenuTabs::mouseReleaseEvent(QMouseEvent* event)
QMenu::mouseReleaseEvent(event); QMenu::mouseReleaseEvent(event);
} }
TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) TabWidget::TabWidget(BrowserWindow* window, QWidget* parent)
: TabStackedWidget(parent) : TabStackedWidget(parent)
, p_QupZilla(mainClass) , m_window(window)
, m_lastTabIndex(-1) , m_lastTabIndex(-1)
, m_lastBackgroundTabIndex(-1) , m_lastBackgroundTabIndex(-1)
, m_isClosingToLastTabIndex(false) , m_isClosingToLastTabIndex(false)
@ -123,10 +123,10 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
, m_locationBars(new QStackedWidget) , m_locationBars(new QStackedWidget)
{ {
setObjectName("tabwidget"); setObjectName("tabwidget");
m_tabBar = new TabBar(p_QupZilla, this); m_tabBar = new TabBar(m_window, this);
setTabBar(m_tabBar); setTabBar(m_tabBar);
connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory())); connect(this, SIGNAL(currentChanged(int)), m_window, SLOT(refreshHistory()));
connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
@ -153,7 +153,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
m_buttonAddTab = new AddTabButton(this, m_tabBar); m_buttonAddTab = new AddTabButton(this, m_tabBar);
connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab())); connect(m_buttonAddTab, SIGNAL(clicked()), m_window, SLOT(addTab()));
connect(m_menuTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabsMenu())); connect(m_menuTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabsMenu()));
// Copy of buttons // Copy of buttons
@ -169,7 +169,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
m_buttonAddTab2 = new AddTabButton(this, m_tabBar); m_buttonAddTab2 = new AddTabButton(this, m_tabBar);
m_buttonAddTab2->setProperty("outside-tabbar", true); m_buttonAddTab2->setProperty("outside-tabbar", true);
connect(m_buttonAddTab2, SIGNAL(clicked()), p_QupZilla, SLOT(addTab())); connect(m_buttonAddTab2, SIGNAL(clicked()), m_window, SLOT(addTab()));
m_tabBar->addMainBarWidget(m_buttonAddTab2, Qt::AlignRight); m_tabBar->addMainBarWidget(m_buttonAddTab2, Qt::AlignRight);
m_tabBar->addMainBarWidget(m_buttonListTabs2, Qt::AlignRight); m_tabBar->addMainBarWidget(m_buttonListTabs2, Qt::AlignRight);
@ -322,8 +322,8 @@ int TabWidget::addView(const QUrl &url, const QString &title, const Qz::NewTabPo
int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewTabPositionFlags &openFlags, bool selectLine, int position, bool pinned) int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewTabPositionFlags &openFlags, bool selectLine, int position, bool pinned)
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (p_QupZilla->isTransparentBackgroundAllowed()) { if (m_window->isTransparentBackgroundAllowed()) {
QtWin::extendFrameIntoClientArea(p_QupZilla); QtWin::extendFrameIntoClientArea(m_window);
} }
#endif #endif
setUpdatesEnabled(false); setUpdatesEnabled(false);
@ -352,15 +352,15 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
} }
} }
LocationBar* locBar = new LocationBar(p_QupZilla); LocationBar* locBar = new LocationBar(m_window);
m_locationBars->addWidget(locBar); m_locationBars->addWidget(locBar);
int index; int index;
if (position == -1) { if (position == -1) {
index = addTab(new WebTab(p_QupZilla, locBar), QString(), pinned); index = addTab(new WebTab(m_window, locBar), QString(), pinned);
} }
else { else {
index = insertTab(position, new WebTab(p_QupZilla, locBar), QString(), pinned); index = insertTab(position, new WebTab(m_window, locBar), QString(), pinned);
} }
TabbedWebView* webView = weTab(index)->view(); TabbedWebView* webView = weTab(index)->view();
@ -379,15 +379,15 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
connect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int))); connect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
connect(webView, SIGNAL(changed()), mApp, SLOT(setStateChanged())); connect(webView, SIGNAL(changed()), mApp, SLOT(setStateChanged()));
connect(webView, SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); connect(webView, SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
if (url.isValid()) { if (url.isValid()) {
req.setUrl(url); req.setUrl(url);
webView->load(req); webView->load(req);
} }
if (selectLine && p_QupZilla->locationBar()->text().isEmpty()) { if (selectLine && m_window->locationBar()->text().isEmpty()) {
p_QupZilla->locationBar()->setFocus(); m_window->locationBar()->setFocus();
} }
if (openFlags & Qz::NT_SelectedTab || openFlags & Qz::NT_NotSelectedTab) { if (openFlags & Qz::NT_SelectedTab || openFlags & Qz::NT_NotSelectedTab) {
@ -408,7 +408,7 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
setUpdatesEnabled(true); setUpdatesEnabled(true);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QTimer::singleShot(0, p_QupZilla, SLOT(applyBlurToMainWindow())); QTimer::singleShot(0, m_window, SLOT(applyBlurToMainWindow()));
#endif #endif
return index; return index;
} }
@ -430,7 +430,7 @@ int TabWidget::addView(WebTab* tab)
connect(tab->view(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int))); connect(tab->view(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
connect(tab->view(), SIGNAL(changed()), mApp, SLOT(setStateChanged())); connect(tab->view(), SIGNAL(changed()), mApp, SLOT(setStateChanged()));
connect(tab->view(), SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); connect(tab->view(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
return index; return index;
} }
@ -470,7 +470,7 @@ void TabWidget::closeTab(int index, bool force)
return; return;
} }
else { else {
p_QupZilla->close(); m_window->close();
return; return;
} }
} }
@ -487,7 +487,7 @@ void TabWidget::closeTab(int index, bool force)
m_locationBars->removeWidget(webView->webTab()->locationBar()); m_locationBars->removeWidget(webView->webTab()->locationBar());
disconnect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int))); disconnect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
disconnect(webView, SIGNAL(changed()), mApp, SLOT(setStateChanged())); disconnect(webView, SIGNAL(changed()), mApp, SLOT(setStateChanged()));
disconnect(webView, SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); disconnect(webView, SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
if (m_isClosingToLastTabIndex && m_lastTabIndex < count() && index == currentIndex()) { if (m_isClosingToLastTabIndex && m_lastTabIndex < count() && index == currentIndex()) {
setCurrentIndex(m_lastTabIndex); setCurrentIndex(m_lastTabIndex);
@ -525,7 +525,7 @@ void TabWidget::currentTabChanged(int index)
} }
webTab->setCurrentTab(); webTab->setCurrentTab();
p_QupZilla->currentTabChanged(); m_window->currentTabChanged();
} }
void TabWidget::tabMoved(int before, int after) void TabWidget::tabMoved(int before, int after)
@ -708,9 +708,9 @@ void TabWidget::detachTab(int index)
m_locationBars->removeWidget(tab->locationBar()); m_locationBars->removeWidget(tab->locationBar());
disconnect(tab->view(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int))); disconnect(tab->view(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
disconnect(tab->view(), SIGNAL(changed()), mApp, SLOT(setStateChanged())); disconnect(tab->view(), SIGNAL(changed()), mApp, SLOT(setStateChanged()));
disconnect(tab->view(), SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); disconnect(tab->view(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
QupZilla* window = mApp->makeNewWindow(Qz::BW_NewWindow); BrowserWindow* window = mApp->makeNewWindow(Qz::BW_NewWindow);
tab->moveToWindow(window); tab->moveToWindow(window);
window->openWithTab(tab); window->openWithTab(tab);
@ -985,7 +985,7 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
m_isRestoringState = true; m_isRestoringState = true;
setUpdatesEnabled(false); setUpdatesEnabled(false);
Qz::BrowserWindow type = p_QupZilla->windowType(); Qz::BrowserWindowType type = m_window->windowType();
if (type == Qz::BW_FirstAppWindow || type == Qz::BW_MacFirstWindow) { if (type == Qz::BW_FirstAppWindow || type == Qz::BW_MacFirstWindow) {
restorePinnedTabs(); restorePinnedTabs();
@ -1021,8 +1021,8 @@ void TabWidget::disconnectObjects()
{ {
disconnect(this); disconnect(this);
disconnect(mApp); disconnect(mApp);
disconnect(p_QupZilla); disconnect(m_window);
disconnect(p_QupZilla->ipLabel()); disconnect(m_window->ipLabel());
} }
TabWidget::~TabWidget() TabWidget::~TabWidget()

View File

@ -31,7 +31,7 @@
class QStackedWidget; class QStackedWidget;
class QMenu; class QMenu;
class QupZilla; class BrowserWindow;
class TabbedWebView; class TabbedWebView;
class TabBar; class TabBar;
class TabWidget; class TabWidget;
@ -69,7 +69,7 @@ class QT_QUPZILLA_EXPORT TabWidget : public TabStackedWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TabWidget(QupZilla* mainclass, QWidget* parent = 0); explicit TabWidget(BrowserWindow* mainclass, QWidget* parent = 0);
~TabWidget(); ~TabWidget();
void loadSettings(); void loadSettings();
@ -152,7 +152,7 @@ private:
bool m_newEmptyTabAfterActive; bool m_newEmptyTabAfterActive;
QUrl m_urlOnNewTab; QUrl m_urlOnNewTab;
QupZilla* p_QupZilla; BrowserWindow* m_window;
int m_lastTabIndex; int m_lastTabIndex;
int m_lastBackgroundTabIndex; int m_lastBackgroundTabIndex;

View File

@ -20,11 +20,11 @@
#include "webpage.h" #include "webpage.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webtab.h" #include "webtab.h"
#include "qupzilla.h" #include "browserwindow.h"
WebInspectorDockWidget::WebInspectorDockWidget(QupZilla* mainClass) WebInspectorDockWidget::WebInspectorDockWidget(BrowserWindow* window)
: QDockWidget(mainClass) : QDockWidget(window)
, p_QupZilla(mainClass) , m_window(window)
{ {
setWindowTitle(tr("Web Inspector")); setWindowTitle(tr("Web Inspector"));
setObjectName("WebInspector"); setObjectName("WebInspector");
@ -46,20 +46,20 @@ void WebInspectorDockWidget::toggleVisibility()
void WebInspectorDockWidget::close() void WebInspectorDockWidget::close()
{ {
p_QupZilla->weView()->webTab()->setInspectorVisible(false); m_window->weView()->webTab()->setInspectorVisible(false);
p_QupZilla->weView()->setFocus(); m_window->weView()->setFocus();
hide(); hide();
} }
void WebInspectorDockWidget::show() void WebInspectorDockWidget::show()
{ {
QWebPage* page = p_QupZilla->weView()->page(); QWebPage* page = m_window->weView()->page();
QPointer<WebInspector> inspector = m_inspectors[page]; QPointer<WebInspector> inspector = m_inspectors[page];
if (!inspector) { if (!inspector) {
inspector = new WebInspector(this); inspector = new WebInspector(this);
inspector.data()->setPage(p_QupZilla->weView()->page()); inspector.data()->setPage(m_window->weView()->page());
m_inspectors[page] = inspector; m_inspectors[page] = inspector;
} }
@ -69,14 +69,14 @@ void WebInspectorDockWidget::show()
m_currentInspector = inspector; m_currentInspector = inspector;
} }
p_QupZilla->weView()->webTab()->setInspectorVisible(true); m_window->weView()->webTab()->setInspectorVisible(true);
QDockWidget::show(); QDockWidget::show();
} }
void WebInspectorDockWidget::tabChanged() void WebInspectorDockWidget::tabChanged()
{ {
if (p_QupZilla->weView()->webTab()->inspectorVisible()) { if (m_window->weView()->webTab()->inspectorVisible()) {
show(); show();
} }
else { else {

View File

@ -36,12 +36,12 @@ private:
} }
}; };
class QupZilla; class BrowserWindow;
class QT_QUPZILLA_EXPORT WebInspectorDockWidget : public QDockWidget class QT_QUPZILLA_EXPORT WebInspectorDockWidget : public QDockWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit WebInspectorDockWidget(QupZilla* mainClass); explicit WebInspectorDockWidget(BrowserWindow* window);
~WebInspectorDockWidget(); ~WebInspectorDockWidget();
void toggleVisibility(); void toggleVisibility();
@ -55,7 +55,7 @@ public slots:
void show(); void show();
private: private:
QupZilla* p_QupZilla; BrowserWindow* m_window;
QHash<QWebPage*, QPointer<WebInspector> > m_inspectors; QHash<QWebPage*, QPointer<WebInspector> > m_inspectors;
QPointer<WebInspector> m_currentInspector; QPointer<WebInspector> m_currentInspector;

View File

@ -18,7 +18,7 @@
#include "webpage.h" #include "webpage.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "qupzilla.h" #include "browserwindow.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "downloadmanager.h" #include "downloadmanager.h"
#include "webpluginfactory.h" #include "webpluginfactory.h"

View File

@ -28,7 +28,7 @@
class QWebSecurityOrigin; class QWebSecurityOrigin;
class QEventLoop; class QEventLoop;
class QupZilla; class BrowserWindow;
class AdBlockRule; class AdBlockRule;
class TabbedWebView; class TabbedWebView;
class SpeedDial; class SpeedDial;

Some files were not shown because too many files have changed in this diff Show More