aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.hpp
blob: ae86588cfe7d18420501c6cd03f5c89507c6caff (plain) (blame)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP

#include <QMainWindow>
#include <QLabel>
#include <QSettings>

#include "favouritecollection.hpp"
#include "renderers/geminirenderer.hpp"

#include "widgets/elidelabel.hpp"

#include "browsertab.hpp"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class BrowserTab;

enum class UIDensity : int;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QApplication * app, QWidget *parent = nullptr);
    ~MainWindow();

    BrowserTab * addEmptyTab(bool focus_new, bool load_default);
    BrowserTab * addNewTab(bool focus_new, QUrl const & url);
    BrowserTab * curTab() const;
    BrowserTab * tabAt(int index) const;

    void setUrlPreview(QUrl const & url);

    void viewPageSource();

    void updateWindowTitle();

    void setUiDensity(UIDensity density, bool previewing);

    void mousePressEvent(QMouseEvent *event) override;

private slots:
    void on_browser_tabs_currentChanged(int index);

    void on_browser_tabs_tabCloseRequested(int index);

    void on_history_view_doubleClicked(const QModelIndex &index);

    void on_outline_view_clicked(const QModelIndex &index);

    void on_actionSettings_triggered();

    void on_actionNew_Tab_triggered();

    void on_actionQuit_triggered();

    void on_actionAbout_triggered();

    void on_actionClose_Tab_triggered();

    void on_actionForward_triggered();

    void on_actionBackward_triggered();

    void on_actionRefresh_triggered();

    void on_actionAbout_Qt_triggered();

    void on_actionSave_as_triggered();

    void on_actionGo_to_home_triggered();

    void on_actionAdd_to_favourites_triggered();

    void on_actionHelp_triggered();

    void on_history_view_customContextMenuRequested(const QPoint pos);

    void on_favourites_view_customContextMenuRequested(const QPoint pos);

    void on_favourites_view_doubleClicked(const QModelIndex &index);

    void on_actionChangelog_triggered();

    void on_actionManage_Certificates_triggered();

    void on_actionShow_document_source_triggered();

private: // slots

    void on_tab_fileLoaded(DocumentStats const & stats);

    void on_tab_titleChanged(QString const & title);

    void on_tab_locationChanged(QUrl const & url);

    void on_focus_inputbar();


private:
    void setFileStatus(DocumentStats const & stats);

public:
    QApplication * application;

private:
    Ui::MainWindow *ui;

    ElideLabel * url_status;
    QLabel * file_size;
    QLabel * file_mime;
    QLabel * load_time;
};
#endif // MAINWINDOW_HPP