/* * 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 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