-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainWindow.h
170 lines (139 loc) · 4.05 KB
/
MainWindow.h
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui>
#include <QtWebKit>
#include <QFile>
#include "TabNav.h"
#include "WebPage.h"
#include "AddressField.h"
#include "AboutMango.h"
#include "PreferencesWindow.h"
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
QIcon getFavicon();
void showWindowFindText();
void hideWindowFindText();
private:
// GUI Methods
void createActions();
void createMenu();
void createToolbar();
void createStatusBar();
void getPreferences();
void prepareButtons();
// Usefull methods
QWidget *createNewTabWeb(QString url = "");
WebPage *currentPage();
// Events
void keyPressEvent(QKeyEvent *event);
public slots:
void getSourceCode();
void toggleFullScreen();
void openLink(QUrl url);
void saveCurrentPage();
// Edit slots
void copy();
void paste();
void cut();
void selectAllWebView();
void toggleWindowFindText();
void highlightText();
// Browsing slots
void newTab(QString url = "");
void closeTab(int index = -1);
void back();
void forward();
void stop();
void reload();
void home();
// Refresh slots
void loadPage(QString url = "");
void switchTabs(int index);
void changeTitle(const QString & fullTitle);
void changeUrl(const QUrl & url);
void changeIcon();
// Zoom
void zoom();
void unZoom();
void setDefaultZoom();
// Preferences
void showPreferences();
void togglePrivateBrowsing();
void printPage();
void printPreview();
private slots:
void loadBegin();
void loading(int pourcentage);
void loadComplete(bool ok);
void showLink(const QString & link, const QString & title, const QString & textContent);
void about();
void showSourceCode();
// Download
void downloadFileAuto(QNetworkReply *reponse);
void downloadFinished();
void cancelDownload();
void downloading(qint64 downloaded, qint64 total);
// Error handler
void checkError(QNetworkReply *reply);
private:
TabNav *tabs;
// File actions
QAction *actionNewTab;
QAction *actionCloseTab;
QAction *actionPrintPreview;
QAction *actionPrintPage;
QAction *actionExit;
QAction *actionSaveCurrentPage;
// Edit actions
QAction *actionFind;
QAction *actionCut;
QAction *actionCopy;
QAction *actionPaste;
QAction *actionSelectAll;
QAction *actionHighlighText;
// Browser actions
QAction *actionBack;
QAction *actionForward;
QAction *actionStop;
QAction *actionReload;
QAction *actionHome;
QAction *actionGo;
QAction *actionSourceCode;
// View actions
QAction *actionZoom;
QAction *actionUnZoom;
QAction *actionFullScreen;
QAction *actionDefaultZoom;
// Tools actions
QAction *actionPreferences;
QAction *actionPrivateBrowsing;
// ? Actions
QAction *actionAbout;
QAction *actionAboutQt;
// Preferences
QString fileHomePage;
QString fileSearchEngine;
QString fileDownloadPath;
bool isZoomEnabled;
bool isFlashEnabled;
bool isJsEnabled;
AddressField *addressField;
AboutMango *aboutWindow;
QProgressBar *progressionBar;
QLineEdit *findTextField;
QPushButton *buttonSubmitFind;
QLabel *findLabel;
QPushButton *nothingFound;
QLabel *privateBrowsingIcon;
// Download
QFile fileToDownload;
QNetworkReply *reply;
QProgressDialog *downloadDialog;
QString downloadedFileName;
bool isDownloading;
bool hasCanceledDownload;
};
#endif