diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-03 21:23:35 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-03 21:23:35 +0300 |
commit | 6e1d411f9218645851f0dde54688739390b62736 (patch) | |
tree | 7cc4af0155a3ce9dc5a0fb4014975b0aa9d2d165 /src/mainwindow/mainwindow.h | |
parent | Fix various compiler warnings (diff) | |
download | smolbote-6e1d411f9218645851f0dde54688739390b62736.tar.xz |
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
Diffstat (limited to 'src/mainwindow/mainwindow.h')
-rw-r--r-- | src/mainwindow/mainwindow.h | 32 |
1 files changed, 19 insertions, 13 deletions
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 <QMainWindow> #include <QUrl> -#include <memory> 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<SubWindow *> subWindows() const; - SubWindow *currentSubWindow() const; + [[nodiscard]] const QVector<SubWindow *> subWindows() const + { + return m_subwindows; + } + [[nodiscard]] SubWindow *currentSubWindow() const + { + return qobject_cast<SubWindow *>(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<SubWindow *> m_subwindows; QMetaObject::Connection viewChangedConnection; - QMetaObject::Connection searchBoxConnection; QMetaObject::Connection statusBarConnection; }; |