-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
44 lines (35 loc) · 1.16 KB
/
mainwindow.cpp
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
#include <QWebEngineNavigationRequest>
#include <QDesktopServices>
#include "mainwindow.h"
#include "constants.h"
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
{
splitter.addWidget(&remitView);
splitter.addWidget(&githubView);
// TODO: Restore & save splitter state using splitter.saveState and splitter.restoreState. Until then, this is a decent starting point
splitter.setStretchFactor(0, 1);
splitter.setStretchFactor(1, 2);
setWindowTitle("Remit");
setCentralWidget(&splitter);
connect(
&remitView, &RemitView::githubNavigationRequested,
this, &MainWindow::openInGithubView
);
connect(
&remitView, &RemitView::externalNavigationRequested,
this, &MainWindow::openInDefaultBrowser
);
connect(
&githubView, &GithubView::externalNavigationRequested,
this, &MainWindow::openInDefaultBrowser
);
}
void MainWindow::connectSignals() {
}
void MainWindow::openInGithubView(const QUrl& url) {
if (url != githubView.url())
githubView.setUrl(url);
}
void MainWindow::openInDefaultBrowser(const QUrl& url) {
QDesktopServices::openUrl(url);
}