From 6e1d411f9218645851f0dde54688739390b62736 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 3 Apr 2020 21:23:35 +0300 Subject: Remove QMdiArea in MainWindow Kconfig: Change About Dialog shortcut default to F1 (was Ctrl+H) Change close current tab shortcut to Ctrl+W (was Ctrl+X) MainWindow: automatically close window when last subwindow is closed MenuBar: remove Tile/Cascade subwindows actions add show/hide/close subwindow actions SubWindow: remove Subwindow menu shortcut (was F1 by default) add close shortcut (default Ctrl+Shift+W) Minor fixes: Fix PKGBUILD sources --- src/mainwindow/mainwindow.h | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/mainwindow/mainwindow.h') diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h index dc185da..98bd6ee 100644 --- a/src/mainwindow/mainwindow.h +++ b/src/mainwindow/mainwindow.h @@ -9,24 +9,20 @@ #ifndef SMOLBOTE_MAINWINDOW_H #define SMOLBOTE_MAINWINDOW_H +#include "subwindow/subwindow.h" #include #include -#include class Browser; -class QMdiArea; -class Configuration; -class SubWindow; class AddressBar; class SearchForm; class WebView; class NavigationBar; class WebProfile; class MenuBar; -class MainWindow : public QMainWindow +class MainWindow final : public QMainWindow { friend class Browser; - friend class MenuBar; Q_OBJECT @@ -36,18 +32,29 @@ public: }; explicit MainWindow(QWidget *parent = nullptr); - Q_DISABLE_COPY(MainWindow) - ~MainWindow() override; + MainWindow(const MainWindow &) = delete; + ~MainWindow() = default; void addDockWidget(Qt::DockWidgetArea area, QWidget *widget); void removeDockWidget(QWidget *widget); - const QVector subWindows() const; - SubWindow *currentSubWindow() const; + [[nodiscard]] const QVector subWindows() const + { + return m_subwindows; + } + [[nodiscard]] SubWindow *currentSubWindow() const + { + return qobject_cast(centralWidget()); + } + [[nodiscard]] WebView *currentView() const + { + return currentSubWindow()->currentView(); + } public slots: void createTab(const QUrl &url); SubWindow *createSubWindow(WebProfile *profile = nullptr, bool openProfileNewtab = false); + void setCurrentSubWindow(SubWindow *subwindow); private slots: void setView(WebView *view); @@ -56,6 +63,7 @@ protected: void closeEvent(QCloseEvent *event) override; private: + QString defaultWindowTitle; MenuBar *m_menuBar = nullptr; QMenu *toolsMenu = nullptr; QMenu *pageLoadProfileMenu = nullptr; @@ -64,11 +72,9 @@ private: AddressBar *addressBar = nullptr; SearchForm *searchBox = nullptr; - QMdiArea *mdiArea; - WebView *currentView = nullptr; + QVector m_subwindows; QMetaObject::Connection viewChangedConnection; - QMetaObject::Connection searchBoxConnection; QMetaObject::Connection statusBarConnection; }; -- cgit v1.2.1