blob: fd0579d2d505108180c2fa940be21eda5c4ed8e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* This file is part of smolbote. It's copyrighted by the contributors recorded
* in the version control history of the file, available from its original
* location: https://neueland.iserlohn-fortress.net/smolbote.hg
*
* SPDX-License-Identifier: GPL-3.0
*/
/*
* Why is this class a QObject and not a QWidget, and why don't we add the
* NavigationBar itself to the toolbar?
* That was the original idea: make a NavBar class, friend it from MainWindow
* to gain access to the config, but there's a couple of issues:
* - adding QToolButtons to a widget that's inside a toolbar makes the buttons
* look absolutely hideous: they're smaller and have a border for some reason
* - if you stylesheet the border away (which is a pain), they're still not
* the same size
* And so we ended up having this class only exist to contain all of the logic
* for the nav buttons (which cuts down the code in MainWindow).
*/
#ifndef NAVIGATIONBAR_H
#define NAVIGATIONBAR_H
#include <QObject>
class QStyle;
class QToolBar;
class QToolButton;
class MainWindow;
class WebView;
class NavigationBar : public QObject
{
Q_OBJECT
public:
explicit NavigationBar(MainWindow *parent = nullptr);
void addWidgetsTo(QToolBar *toolBar);
void connectWebView(WebView *view);
private slots:
void update_loadStarted();
void update_loadFinished();
private:
QStyle *qStyle;
WebView *m_view;
QToolButton *backButton, *forwardButton;
QToolButton *stopReloadButton;
QToolButton *homeButton;
QMetaObject::Connection loadStartedConnection, loadFinishedConnection;
};
#endif //NAVIGATIONBAR_H
|