mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
Improved showing navigation in fullscreen.
It will now hide navigation toolbar after 1 second instead of hiding it instantly when on mouse leave.
This commit is contained in:
parent
8a6beac501
commit
945b40f2a5
@ -752,6 +752,7 @@ void MainApplication::saveSettings()
|
||||
qIconProvider->saveIconsToDatabase();
|
||||
clearTempPath();
|
||||
|
||||
qzSettings->saveSettings();
|
||||
AdBlockManager::instance()->save();
|
||||
QFile::remove(currentProfilePath() + "WebpageIcons.db");
|
||||
Settings::syncSettings();
|
||||
|
@ -138,8 +138,14 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
|
||||
setupUi();
|
||||
setupMenu();
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(postLaunch()));
|
||||
m_hideNavigationTimer = new QTimer(this);
|
||||
m_hideNavigationTimer->setInterval(1000);
|
||||
m_hideNavigationTimer->setSingleShot(true);
|
||||
connect(m_hideNavigationTimer, SIGNAL(timeout()), this, SLOT(hideNavigationSlot()));
|
||||
|
||||
connect(mApp, SIGNAL(message(Qz::AppMessageType, bool)), this, SLOT(receiveMessage(Qz::AppMessageType, bool)));
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(postLaunch()));
|
||||
}
|
||||
|
||||
void QupZilla::postLaunch()
|
||||
@ -1689,24 +1695,36 @@ void QupZilla::openLocation()
|
||||
locationBar()->selectAll();
|
||||
}
|
||||
|
||||
void QupZilla::showNavigationWithFullscreen()
|
||||
bool QupZilla::fullScreenNavigationVisible() const
|
||||
{
|
||||
bool state;
|
||||
if (m_navigationVisible) {
|
||||
state = !m_navigationBar->isVisible();
|
||||
}
|
||||
else {
|
||||
state = !m_tabWidget->getTabBar()->isVisible();
|
||||
return m_navigationContainer->isVisible();
|
||||
}
|
||||
|
||||
void QupZilla::showNavigationWithFullScreen()
|
||||
{
|
||||
if (m_hideNavigationTimer->isActive()) {
|
||||
m_hideNavigationTimer->stop();
|
||||
}
|
||||
|
||||
if (m_navigationVisible) {
|
||||
m_navigationBar->setVisible(state);
|
||||
m_navigationContainer->show();
|
||||
m_tabWidget->getTabBar()->updateVisibilityWithFullscreen(true);
|
||||
}
|
||||
|
||||
void QupZilla::hideNavigationWithFullScreen()
|
||||
{
|
||||
if (!m_hideNavigationTimer->isActive()) {
|
||||
m_hideNavigationTimer->start();
|
||||
}
|
||||
}
|
||||
|
||||
m_tabWidget->getTabBar()->updateVisibilityWithFullscreen(state);
|
||||
void QupZilla::hideNavigationSlot()
|
||||
{
|
||||
TabbedWebView* view = weView();
|
||||
bool mouseInView = view && view->geometry().contains(view->mapFromGlobal(QCursor::pos()));
|
||||
|
||||
if (m_bookmarksToolBarVisible) {
|
||||
m_bookmarksToolbar->setVisible(state);
|
||||
if (isFullScreen() && mouseInView) {
|
||||
m_navigationContainer->hide();
|
||||
m_tabWidget->getTabBar()->updateVisibilityWithFullscreen(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1715,15 +1733,13 @@ void QupZilla::fullScreen(bool make)
|
||||
if (make) {
|
||||
m_menuBarVisible = menuBar()->isVisible();
|
||||
m_statusBarVisible = statusBar()->isVisible();
|
||||
m_navigationVisible = m_navigationBar->isVisible();
|
||||
m_bookmarksToolBarVisible = m_bookmarksToolbar->isVisible();
|
||||
|
||||
setWindowState(windowState() | Qt::WindowFullScreen);
|
||||
|
||||
menuBar()->hide();
|
||||
statusBar()->hide();
|
||||
bookmarksToolbar()->hide();
|
||||
m_navigationBar->hide();
|
||||
m_navigationContainer->hide();
|
||||
m_tabWidget->getTabBar()->hide();
|
||||
#ifndef Q_OS_MAC
|
||||
m_navigationBar->buttonSuperMenu()->hide();
|
||||
@ -1741,8 +1757,7 @@ void QupZilla::fullScreen(bool make)
|
||||
|
||||
menuBar()->setVisible(m_menuBarVisible);
|
||||
statusBar()->setVisible(m_statusBarVisible);
|
||||
m_bookmarksToolbar->setVisible(m_bookmarksToolBarVisible);
|
||||
m_navigationBar->setVisible(m_navigationVisible);
|
||||
m_navigationContainer->show();
|
||||
m_tabWidget->showTabBar();
|
||||
#ifndef Q_OS_MAC
|
||||
m_navigationBar->buttonSuperMenu()->setVisible(!m_menuBarVisible);
|
||||
@ -1755,6 +1770,7 @@ void QupZilla::fullScreen(bool make)
|
||||
#endif
|
||||
}
|
||||
|
||||
m_hideNavigationTimer->stop();
|
||||
m_actionShowFullScreen->setChecked(make);
|
||||
m_navigationBar->buttonExitFullscreen()->setVisible(make);
|
||||
|
||||
|
@ -29,6 +29,7 @@ class QLabel;
|
||||
class QVBoxLayout;
|
||||
class QSplitter;
|
||||
class QWebFrame;
|
||||
class QTimer;
|
||||
|
||||
class Menu;
|
||||
class TabWidget;
|
||||
@ -66,9 +67,12 @@ public:
|
||||
~QupZilla();
|
||||
|
||||
void loadSettings();
|
||||
void showNavigationWithFullscreen();
|
||||
void saveSideBarWidth();
|
||||
|
||||
bool fullScreenNavigationVisible() const;
|
||||
void showNavigationWithFullScreen();
|
||||
void hideNavigationWithFullScreen();
|
||||
|
||||
void currentTabChanged();
|
||||
void updateLoadingActions();
|
||||
|
||||
@ -203,6 +207,8 @@ private slots:
|
||||
void restoreClosedTab(QObject* obj = 0);
|
||||
void restoreAllClosedTabs();
|
||||
void clearClosedTabsList();
|
||||
void hideNavigationSlot();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void applyBlurToMainWindow(bool force = false);
|
||||
#endif
|
||||
@ -318,12 +324,10 @@ private:
|
||||
bool m_useTabNumberShortcuts;
|
||||
bool m_useSpeedDialNumberShortcuts;
|
||||
|
||||
// Used for F11 FullScreen remember visibility
|
||||
// of menubar and statusbar
|
||||
// Used for F11 FullScreen remember visibility of menubar and statusbar
|
||||
bool m_menuBarVisible;
|
||||
bool m_statusBarVisible;
|
||||
bool m_navigationVisible;
|
||||
bool m_bookmarksToolBarVisible;
|
||||
QTimer* m_hideNavigationTimer;
|
||||
|
||||
QList<QPointer<QWidget> > m_deleteOnCloseWidgets;
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ void QzSettings::loadSettings()
|
||||
|
||||
settings.beginGroup("Browser-Tabs-Settings");
|
||||
newTabPosition = settings.value("OpenNewTabsSelected", false).toBool() ? Qz::NT_SelectedTab : Qz::NT_NotSelectedTab;
|
||||
tabsOnTop = settings.value("TabsOnTop", true).toBool();
|
||||
tabsOnTop = settings.value("TabsOnTop", false).toBool();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
|
@ -87,14 +87,18 @@ void TabBar::loadSettings()
|
||||
|
||||
void TabBar::updateVisibilityWithFullscreen(bool visible)
|
||||
{
|
||||
// It is needed to save original geometry, otherwise
|
||||
// tabbar will get 3px height in fullscreen once it was hidden
|
||||
QTabBar::setVisible(visible);
|
||||
|
||||
if (visible) {
|
||||
setGeometry(m_originalGeometry);
|
||||
emit showButtons();
|
||||
}
|
||||
else {
|
||||
m_originalGeometry = geometry();
|
||||
emit hideButtons();
|
||||
}
|
||||
|
||||
QTabBar::setVisible(visible);
|
||||
}
|
||||
|
||||
void TabBar::setVisible(bool visible)
|
||||
@ -107,6 +111,7 @@ void TabBar::setVisible(bool visible)
|
||||
emit showButtons();
|
||||
}
|
||||
else {
|
||||
m_originalGeometry = geometry();
|
||||
emit hideButtons();
|
||||
}
|
||||
|
||||
@ -534,7 +539,7 @@ void TabBar::mouseMoveEvent(QMouseEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
//Tab Preview
|
||||
// Tab Preview
|
||||
|
||||
const int tab = tabAt(event->pos());
|
||||
|
||||
@ -587,7 +592,8 @@ bool TabBar::event(QEvent* event)
|
||||
|
||||
case QEvent::ToolTip:
|
||||
if (m_showTabPreviews) {
|
||||
if (!m_tabPreview->isVisible()) {
|
||||
QHelpEvent* ev = static_cast<QHelpEvent*>(event);
|
||||
if (tabAt(ev->pos()) != -1 && !m_tabPreview->isVisible()) {
|
||||
showTabPreview();
|
||||
}
|
||||
return true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -19,6 +19,7 @@
|
||||
#define TABBAR_H
|
||||
|
||||
#include <QTabBar>
|
||||
#include <QRect>
|
||||
#include <QAbstractButton>
|
||||
|
||||
#include "qz_namespace.h"
|
||||
@ -111,6 +112,7 @@ private:
|
||||
mutable int m_normalTabWidth;
|
||||
mutable int m_activeTabWidth;
|
||||
|
||||
QRect m_originalGeometry;
|
||||
QPoint m_dragStartPosition;
|
||||
};
|
||||
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include <QWebFrame>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
bool TabbedWebView::m_navigationVisible = false;
|
||||
|
||||
TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
|
||||
: WebView(webTab)
|
||||
, p_QupZilla(mainClass)
|
||||
@ -314,13 +312,11 @@ void TabbedWebView::getFocus(const QUrl &urla)
|
||||
void TabbedWebView::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
if (m_mouseTrack) {
|
||||
if (m_navigationVisible) {
|
||||
m_navigationVisible = false;
|
||||
p_QupZilla->showNavigationWithFullscreen();
|
||||
if (p_QupZilla->fullScreenNavigationVisible()) {
|
||||
p_QupZilla->hideNavigationWithFullScreen();
|
||||
}
|
||||
else if (event->y() < 5) {
|
||||
m_navigationVisible = true;
|
||||
p_QupZilla->showNavigationWithFullscreen();
|
||||
p_QupZilla->showNavigationWithFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -98,8 +98,6 @@ private:
|
||||
Menu* m_menu;
|
||||
|
||||
bool m_mouseTrack;
|
||||
static bool m_navigationVisible;
|
||||
|
||||
bool m_hasRss;
|
||||
bool m_rssChecked;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user