aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/mainwindow.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-19 02:10:31 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-19 02:10:31 +0100
commit49ee5ed6e80b8f06337f92d14e2cab1c1512c1e3 (patch)
treee35d5472c2a3ed129f5a6a6826f9999b033cc548 /src/mainwindow/mainwindow.h
parentConfiguration creates missing items based on defaults (diff)
downloadsmolbote-49ee5ed6e80b8f06337f92d14e2cab1c1512c1e3.tar.xz
Refactoring MainWindow
- Added NavigationBar object that manages the navigation buttons - Removed NavigationButton class that it obsoleted
Diffstat (limited to 'src/mainwindow/mainwindow.h')
-rw-r--r--src/mainwindow/mainwindow.h98
1 files changed, 98 insertions, 0 deletions
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 <QMainWindow>
+#include <QUrl>
+#include <interfaces.h>
+#include <memory>
+
+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<Configuration> 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<WebEngineProfile> profile);
+ WebEngineProfile *profile();
+
+ void setBookmarksWidget(std::shared_ptr<BookmarksWidget> &widget);
+ void setDownloadsWidget(std::shared_ptr<DownloadsWidget> &widget);
+ void addPlugins(const QVector<Browser::Plugin> &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<WebEngineProfile> m_profile;
+ std::shared_ptr<Configuration> m_config;
+ std::shared_ptr<BookmarksWidget> m_bookmarksWidget;
+ std::shared_ptr<DownloadsWidget> m_downloadsWidget;
+};
+
+#endif // MAINWINDOW_H