From 49ee5ed6e80b8f06337f92d14e2cab1c1512c1e3 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 19 Jan 2018 02:10:31 +0100 Subject: Refactoring MainWindow - Added NavigationBar object that manages the navigation buttons - Removed NavigationButton class that it obsoleted --- src/mainwindow/mainwindow.h | 98 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/mainwindow/mainwindow.h (limited to 'src/mainwindow/mainwindow.h') diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h new file mode 100644 index 0000000..3f2c3a2 --- /dev/null +++ b/src/mainwindow/mainwindow.h @@ -0,0 +1,98 @@ +/* + * 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: git://neueland.iserlohn-fortress.net/smolbote.git + * + * SPDX-License-Identifier: GPL-3.0 + */ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include "browser.h" +#include "webengine/webengineprofile.h" +#include "widgets/loadingbar.h" +#include "widgets/navigationbar.h" +#include "widgets/mainwindowtabbar.h" +#include +#include +#include +#include + +namespace Ui +{ +class MainWindow; +} + +class SearchForm; + +class Configuration; +class BookmarksWidget; +class DownloadsWidget; + +class MainWindowMenuBar; +class UrlLineEdit; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + + friend class WebView; + friend class SearchForm; + + friend class MainWindowMenuBar; + + friend class NavigationBar; + +public: + explicit MainWindow(std::shared_ptr config, QWidget *parent = nullptr); + Q_DISABLE_COPY(MainWindow) + ~MainWindow() override; + + void addTabbedDock(Qt::DockWidgetArea area, QWidget *widget); + +public slots: + void about(); + void showSettingsDialog(); + + void newTab(const QUrl &url = QUrl("")); + MainWindow *newWindow(const QUrl &url = QUrl("")); + + void setProfile(std::shared_ptr profile); + WebEngineProfile *profile(); + + void setBookmarksWidget(std::shared_ptr &widget); + void setDownloadsWidget(std::shared_ptr &widget); + void addPlugins(const QVector &plugins); + + void toggleFullscreen(); + +protected: + void closeEvent(QCloseEvent *event) override; + +private slots: + void handleTabChanged(WebView *view); + void handleTitleUpdated(const QString &title); + +private: + Ui::MainWindow *ui; + SearchForm *m_searchBox; + + MainWindowTabBar *tabBar; + WebView *m_currentView; + + MainWindowMenuBar *menuBar; + + // navigation + NavigationBar *m_navigationBar; + UrlLineEdit *m_addressBar; + LoadingBar *m_progressBar; + + bool m_tabBarAdded = false; + std::shared_ptr m_profile; + std::shared_ptr m_config; + std::shared_ptr m_bookmarksWidget; + std::shared_ptr m_downloadsWidget; +}; + +#endif // MAINWINDOW_H -- cgit v1.2.1