aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/mainwindow.h
blob: dc185da9d9dbb180dd73b882b9cb129e677270e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * 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/gitea/aqua/smolbote
 *
 * SPDX-License-Identifier: GPL-3.0
 */

#ifndef SMOLBOTE_MAINWINDOW_H
#define SMOLBOTE_MAINWINDOW_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
{
    friend class Browser;
    friend class MenuBar;

    Q_OBJECT

public:
    enum ActionLocation {
        ToolsMenu
    };

    explicit MainWindow(QWidget *parent = nullptr);
    Q_DISABLE_COPY(MainWindow)
    ~MainWindow() override;

    void addDockWidget(Qt::DockWidgetArea area, QWidget *widget);
    void removeDockWidget(QWidget *widget);

    const QVector<SubWindow *> subWindows() const;
    SubWindow *currentSubWindow() const;

public slots:
    void createTab(const QUrl &url);
    SubWindow *createSubWindow(WebProfile *profile = nullptr, bool openProfileNewtab = false);

private slots:
    void setView(WebView *view);

protected:
    void closeEvent(QCloseEvent *event) override;

private:
    MenuBar *m_menuBar = nullptr;
    QMenu *toolsMenu = nullptr;
    QMenu *pageLoadProfileMenu = nullptr;

    NavigationBar *navigationToolBar = nullptr;
    AddressBar *addressBar = nullptr;
    SearchForm *searchBox = nullptr;

    QMdiArea *mdiArea;
    WebView *currentView = nullptr;

    QMetaObject::Connection viewChangedConnection;
    QMetaObject::Connection searchBoxConnection;
    QMetaObject::Connection statusBarConnection;
};

#endif // SMOLBOTE_MAINWINDOW_H