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

NavigationBar: Bring back exit fullscreen button

This time it is configurable and hidden by default.
This commit is contained in:
David Rosca 2018-01-08 17:50:23 +01:00
parent a4738c8a3e
commit e33174100e
9 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#4d4d4d;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 6 2 L 8 4 L 10 2 L 6 2 z M 8 4 L 4 4 L 4 8 L 4 12 L 8 12 L 12 12 L 12 8 L 12 4 L 8 4 z M 12 8 L 14 10 L 14 6 L 12 8 z M 8 12 L 6 14 L 10 14 L 8 12 z M 4 8 L 2 6 L 2 10 L 4 8 z M 5 6 L 11 6 L 11 11 L 5 11 L 5 6 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 552 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#4d4d4d;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 6 2 L 8 4 L 10 2 L 6 2 z M 8 4 L 4 4 L 4 8 L 4 12 L 8 12 L 12 12 L 12 8 L 12 4 L 8 4 z M 12 8 L 14 10 L 14 6 L 12 8 z M 8 12 L 6 14 L 10 14 L 8 12 z M 4 8 L 2 6 L 2 10 L 4 8 z M 5 6 L 11 6 L 11 11 L 5 11 L 5 6 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 552 B

View File

@ -1207,6 +1207,7 @@ bool BrowserWindow::event(QEvent* event)
statusBar()->hide();
m_navigationContainer->hide();
m_navigationToolbar->enterFullScreen();
}
else if (m_oldWindowState & Qt::WindowFullScreen && !(windowState() & Qt::WindowFullScreen)) {
// Leave fullscreen
@ -1217,6 +1218,7 @@ bool BrowserWindow::event(QEvent* event)
m_navigationContainer->show();
m_navigationToolbar->setSuperMenuVisible(!m_menuBarVisible);
m_navigationToolbar->leaveFullScreen();
m_isHtmlFullScreen = false;
}

View File

@ -159,6 +159,15 @@ NavigationBar::NavigationBar(BrowserWindow* window)
m_navigationSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
m_navigationSplitter->setCollapsible(0, false);
m_exitFullscreen = new ToolButton(this);
m_exitFullscreen->setObjectName("navigation-button-exitfullscreen");
m_exitFullscreen->setToolTip(tr("Exit Fullscreen"));
m_exitFullscreen->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_exitFullscreen->setToolbarButtonLook(true);
m_exitFullscreen->setFocusPolicy(Qt::NoFocus);
m_exitFullscreen->setAutoRaise(true);
m_exitFullscreen->setVisible(false);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
@ -176,6 +185,7 @@ NavigationBar::NavigationBar(BrowserWindow* window)
connect(buttonHome, SIGNAL(controlClicked()), m_window, SLOT(goHomeInNewTab()));
connect(buttonAddTab, SIGNAL(clicked()), m_window, SLOT(addTab()));
connect(buttonAddTab, SIGNAL(middleMouseClicked()), m_window->tabWidget(), SLOT(addTabFromClipboard()));
connect(m_exitFullscreen, SIGNAL(clicked(bool)), m_window, SLOT(toggleFullScreen()));
connect(mApp, &MainApplication::settingsReloaded, this, &NavigationBar::loadSettings);
@ -185,6 +195,7 @@ NavigationBar::NavigationBar(BrowserWindow* window)
addWidget(buttonAddTab, QSL("button-addtab"), tr("Add tab button"));
addWidget(m_navigationSplitter, QSL("locationbar"), tr("Address and Search bar"));
addWidget(buttonTools, QSL("button-tools"), tr("Tools button"));
addWidget(m_exitFullscreen, QSL("button-exitfullscreen"), tr("Exit Fullscreen button"));
loadSettings();
}
@ -228,6 +239,20 @@ void NavigationBar::showStopButton()
m_reloadStop->showStopButton();
}
void NavigationBar::enterFullScreen()
{
if (m_layout->indexOf(m_exitFullscreen) != -1) {
m_exitFullscreen->show();
}
}
void NavigationBar::leaveFullScreen()
{
if (m_layout->indexOf(m_exitFullscreen) != -1) {
m_exitFullscreen->hide();
}
}
void NavigationBar::setSuperMenuVisible(bool visible)
{
m_supMenu->setVisible(visible);
@ -520,6 +545,12 @@ void NavigationBar::reloadLayout()
setSplitterSizes(locationBarSize - 50, 50);
}
if (m_window->isFullScreen()) {
enterFullScreen();
} else {
leaveFullScreen();
}
setUpdatesEnabled(true);
}

View File

@ -48,9 +48,13 @@ public:
void setSplitterSizes(int locationBar, int websearchBar);
void setCurrentView(TabbedWebView *view);
void showReloadButton();
void showStopButton();
void enterFullScreen();
void leaveFullScreen();
WebSearchBar* webSearchBar() { return m_searchLine; }
QSplitter* splitter() { return m_navigationSplitter; }
@ -109,6 +113,7 @@ private:
ReloadStopButton* m_reloadStop;
Menu *m_menuTools;
ToolButton* m_supMenu;
ToolButton *m_exitFullscreen;
struct WidgetData {
QString id;

View File

@ -96,6 +96,11 @@
qproperty-icon: url(images/navigation-tools.png);
}
#navigation-button-exitfullscreen
{
qproperty-icon: url(images/navigation-exit-fullscreen.png);
}
#navigation-button-supermenu
{
qproperty-multiIcon: url(images/navigation-supermenu.png);

View File

@ -53,6 +53,12 @@
qproperty-fallbackIcon: url(images/tools.svg);
}
#navigation-button-exitfullscreen
{
qproperty-themeIcon: "view-restore";
qproperty-fallbackIcon: url(images/exit-fullscreen.svg);
}
#navigation-button-supermenu
{
qproperty-themeIcon: "application-menu";

View File

@ -97,6 +97,11 @@
qproperty-icon: url(images/navigation-tools.png);
}
#navigation-button-exitfullscreen
{
qproperty-icon: url(images/navigation-exit-fullscreen.png);
}
#navigation-button-supermenu
{
qproperty-multiIcon: url(images/navigation-supermenu.png);

View File

@ -74,6 +74,12 @@
qproperty-fallbackIcon: url(images/tools.svg);
}
#navigation-button-exitfullscreen
{
qproperty-themeIcon: "view-restore";
qproperty-fallbackIcon: url(images/exit-fullscreen.svg);
}
#navigation-button-supermenu
{
qproperty-themeIcon: "application-menu";