1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

NavigationBar: Add Tools button

It now contains toolbars and sidebars menus and configure
action that doesn't work yet.
This commit is contained in:
David Rosca 2018-01-04 21:35:39 +01:00
parent 65d1493f0a
commit 0b8a693bca
13 changed files with 81 additions and 9 deletions

View File

@ -7,7 +7,7 @@
</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 "
d="M 4.2480469 2 L 3.5 2.71875 L 7.796875 6.84375 L 9.0351562 8 L 7.796875 9.15625 L 3.5 13.28125 L 3.7285156 13.5 L 4.1191406 13.875 L 4.2480469 14 L 8.546875 9.875 L 10.5 8 L 8.546875 6.125 L 4.2480469 2 z M 12 2 L 12 14 L 13 14 L 13 2 L 12 2 z "
class="ColorScheme-Text"
/>
</svg>

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 580 B

View File

@ -576,7 +576,6 @@ void BrowserWindow::loadSettings()
//Browser Window settings
settings.beginGroup("Browser-View-Settings");
bool showStatusBar = settings.value("showStatusBar", false).toBool();
bool showWebSearchBar = settings.value("showWebSearchBar", true).toBool();
bool showBookmarksToolbar = settings.value("showBookmarksToolbar", true).toBool();
bool showNavigationToolbar = settings.value("showNavigationToolbar", true).toBool();
bool showMenuBar = settings.value("showMenubar", false).toBool();

View File

@ -544,7 +544,7 @@ void MainMenu::init()
QMenu* toolbarsMenu = new QMenu(tr("Toolbars"));
connect(toolbarsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolbarsMenu()));
QMenu* sidebarMenu = new QMenu(tr("Sidebar"));
QMenu* sidebarMenu = new QMenu(tr("Sidebars"));
connect(sidebarMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowSidebarsMenu()));
QMenu* encodingMenu = new QMenu(tr("Character &Encoding"));
connect(encodingMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEncodingMenu()));

View File

@ -15,7 +15,7 @@
<file>breeze-fallback/16x16/process-stop.svg</file>
<file>breeze-fallback/16x16/user-trash-full.svg</file>
<file>breeze-fallback/16x16/view-refresh.svg</file>
<file>breeze-fallback/16x16/view-restore.svg</file>
<file>breeze-fallback/16x16/arrow-right-double.svg</file>
<file>breeze-fallback/22x22/configure.svg</file>
<file>breeze-fallback/22x22/edit-find.svg</file>
<file>breeze-fallback/22x22/go-down.svg</file>
@ -28,7 +28,7 @@
<file>breeze-fallback/22x22/process-stop.svg</file>
<file>breeze-fallback/22x22/user-trash-full.svg</file>
<file>breeze-fallback/22x22/view-refresh.svg</file>
<file>breeze-fallback/22x22/view-restore.svg</file>
<file>breeze-fallback/22x22/arrow-right-double.svg</file>
<file>breeze-fallback/32x32/preferences-system-network.svg</file>
<file>breeze-fallback/16x16/window-close.svg</file>
</qresource>

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 4.2480469 2 L 3.5 2.71875 L 7.796875 6.84375 L 9.0351562 8 L 7.796875 9.15625 L 3.5 13.28125 L 3.7285156 13.5 L 4.1191406 13.875 L 4.2480469 14 L 8.546875 9.875 L 10.5 8 L 8.546875 6.125 L 4.2480469 2 z M 12 2 L 12 14 L 13 14 L 13 2 L 12 2 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 580 B

View File

@ -8,7 +8,7 @@
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 9 3 L 11 5 L 13 3 L 9 3 z M 6 6 L 6 9 L 6 15 L 6 16 L 16 16 L 16 15 L 16 6 L 7 6 L 6 6 z M 3 9 L 3 13 L 5 11 L 3 9 z M 7 9 L 15 9 L 15 15 L 7 15 L 7 9 z M 19 9 L 17 11 L 19 13 L 19 9 z M 11 17 L 9 19 L 13 19 L 11 17 z "
class="ColorScheme-Text"
d="M 5.7070312 3 L 5 3.7070312 L 11.125 9.8320312 L 12.292969 11 L 11.125 12.167969 L 5 18.292969 L 5.7070312 19 L 11.832031 12.875 L 13.707031 11 L 11.832031 9.125 L 5.7070312 3 z M 16 3 L 16 19 L 17 19 L 17 3 L 16 3 z "
class="ColorScheme-Text"
/>
</svg>

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 557 B

View File

@ -121,6 +121,19 @@ NavigationBar::NavigationBar(BrowserWindow* window)
m_buttonForward->setMenu(m_menuForward);
connect(m_buttonForward, SIGNAL(aboutToShowMenu()), this, SLOT(aboutToShowHistoryNextMenu()));
ToolButton *buttonTools = new ToolButton(this);
buttonTools->setObjectName("navigation-button-tools");
buttonTools->setPopupMode(QToolButton::InstantPopup);
buttonTools->setToolbarButtonLook(true);
buttonTools->setToolTip(tr("Tools"));
buttonTools->setAutoRaise(true);
buttonTools->setFocusPolicy(Qt::NoFocus);
buttonTools->setShowMenuInside(true);
m_menuTools = new Menu(this);
buttonTools->setMenu(m_menuTools);
connect(buttonTools, &ToolButton::aboutToShowMenu, this, &NavigationBar::aboutToShowToolsMenu);
m_supMenu = new ToolButton(this);
m_supMenu->setObjectName("navigation-button-supermenu");
m_supMenu->setPopupMode(QToolButton::InstantPopup);
@ -145,6 +158,7 @@ NavigationBar::NavigationBar(BrowserWindow* window)
addWidget(buttonHome, QSL("button-home"));
addWidget(buttonAddTab, QSL("button-addtab"));
addWidget(m_navigationSplitter, QSL("locationbar"));
addWidget(buttonTools, QSL("button-tools"));
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
@ -224,6 +238,7 @@ void NavigationBar::addWidget(QWidget *widget, const QString &id)
void NavigationBar::removeWidget(const QString &id)
{
m_widgets.remove(id);
reloadLayout();
}
void NavigationBar::aboutToShowHistoryBackMenu()
@ -294,6 +309,17 @@ void NavigationBar::aboutToShowHistoryNextMenu()
m_menuForward->addAction(tr("Clear history"), this, SLOT(clearHistory()));
}
void NavigationBar::aboutToShowToolsMenu()
{
m_menuTools->clear();
m_window->createToolbarsMenu(m_menuTools->addMenu(tr("Toolbars")));
m_window->createSidebarsMenu(m_menuTools->addMenu(tr("Sidebars")));
m_menuTools->addSeparator();
m_menuTools->addAction(IconProvider::settingsIcon(), tr("Configure Toolbar"), this, SLOT(openConfigurationDialog()));
}
void NavigationBar::clearHistory()
{
QWebEngineHistory* history = m_window->weView()->page()->history();
@ -308,13 +334,18 @@ void NavigationBar::contextMenuRequested(const QPoint &pos)
menu.exec(mapToGlobal(pos));
}
void NavigationBar::openConfigurationDialog()
{
}
void NavigationBar::reloadLayout()
{
const QStringList defaultIds = {
QSL("button-backforward"),
QSL("button-reloadstop"),
QSL("button-home"),
QSL("locationbar")
QSL("locationbar"),
QSL("button-tools")
};
QStringList ids = Settings().value(QSL("NavigationBar/Layout"), defaultIds).toStringList();

View File

@ -74,12 +74,14 @@ public slots:
private slots:
void aboutToShowHistoryNextMenu();
void aboutToShowHistoryBackMenu();
void aboutToShowToolsMenu();
void loadHistoryIndex();
void loadHistoryIndexInNewTab(int index = -1);
void clearHistory();
void contextMenuRequested(const QPoint &pos);
void openConfigurationDialog();
private:
void reloadLayout();
@ -90,13 +92,14 @@ private:
QHBoxLayout* m_layout;
QSplitter* m_navigationSplitter;
WebSearchBar* m_searchLine;
ToolButton* m_supMenu;
Menu* m_menuBack;
Menu* m_menuForward;
ToolButton* m_buttonBack;
ToolButton* m_buttonForward;
ReloadStopButton* m_reloadStop;
Menu *m_menuTools;
ToolButton* m_supMenu;
QHash<QString, QWidget*> m_widgets;
};

View File

@ -47,6 +47,11 @@
qproperty-icon: url(images/add.png);
}
#navigation-button-tools
{
qproperty-themeIcon: "arrow-right-double";
}
#navigation-button-supermenu
{
qproperty-icon: url(images/menu.png);

View File

@ -91,6 +91,11 @@
qproperty-multiIcon: url(images/navigation-addtab.png);
}
#navigation-button-tools
{
qproperty-themeIcon: "arrow-right-double";
}
#navigation-button-supermenu
{
qproperty-multiIcon: url(images/navigation-supermenu.png);

View File

@ -47,6 +47,12 @@
qproperty-themeIcon: "list-add";
}
#navigation-button-tools
{
qproperty-themeIcon: "arrow-right-double";
qproperty-fallbackIcon: url(images/tools.svg);
}
#navigation-button-supermenu
{
qproperty-themeIcon: "application-menu";

View File

@ -92,6 +92,11 @@
qproperty-multiIcon: url(images/navigation-addtab.png);
}
#navigation-button-tools
{
qproperty-themeIcon: "arrow-right-double";
}
#navigation-button-supermenu
{
qproperty-multiIcon: url(images/navigation-supermenu.png);

View File

@ -101,6 +101,11 @@
qproperty-iconSize: 23px 22px;
}
#navigation-button-tools
{
qproperty-themeIcon: "arrow-right-double";
}
#navigation-button-supermenu
{
qproperty-icon: url(images/navigation-supermenu.png);