|
@@ -11,11 +11,11 @@ browser or email client.
|
11
|
11
|
|
12
|
12
|
@(abouttypica.h@>=
|
13
|
13
|
#include <QMainWindow>
|
14
|
|
-#include <QWebView>
|
15
|
14
|
#include <QFile>
|
16
|
15
|
#include <QtDebug>
|
17
|
16
|
#include <QMessageBox>
|
18
|
17
|
#include <QDesktopServices>
|
|
18
|
+#include "webview.h"
|
19
|
19
|
|
20
|
20
|
#ifndef AboutTypicaHeader
|
21
|
21
|
#define AboutTypicaHeader
|
|
@@ -25,8 +25,6 @@ class AboutTypica : public QMainWindow
|
25
|
25
|
Q_OBJECT
|
26
|
26
|
public:
|
27
|
27
|
AboutTypica();
|
28
|
|
- public slots:
|
29
|
|
- void linkClicked(const QUrl &url);
|
30
|
28
|
};
|
31
|
29
|
|
32
|
30
|
#endif
|
|
@@ -48,35 +46,9 @@ AboutTypica::AboutTypica() : QMainWindow(NULL)
|
48
|
46
|
QFile aboutFile(":/resources/html/about.html");
|
49
|
47
|
aboutFile.open(QIODevice::ReadOnly);
|
50
|
48
|
QByteArray content = aboutFile.readAll();
|
51
|
|
- QWebView *banner = new QWebView;
|
|
49
|
+ TypicaWebView *banner = new TypicaWebView;
|
52
|
50
|
banner->setHtml(content, QUrl("qrc:/resources/html/about.html"));
|
53
|
51
|
aboutFile.close();
|
54
|
52
|
setCentralWidget(banner);
|
55
|
|
- QWebPage *page = banner->page();
|
56
|
|
- page->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
|
57
|
|
- connect(page, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
|
58
|
53
|
}
|
59
|
54
|
|
60
|
|
-@ In order to display the About Qt window, we detect a special URL from a link
|
61
|
|
-clicked in the about box.
|
62
|
|
-
|
63
|
|
-@<AboutTypica implementation@>=
|
64
|
|
-void AboutTypica::linkClicked(const QUrl &url)
|
65
|
|
-{
|
66
|
|
- if(url.scheme() == "typica")
|
67
|
|
- {
|
68
|
|
- QString address(url.toEncoded());
|
69
|
|
- if(address == "typica://aboutqt")
|
70
|
|
- {
|
71
|
|
- QMessageBox::aboutQt(this);
|
72
|
|
- }
|
73
|
|
- else
|
74
|
|
- {
|
75
|
|
- qDebug() << "Unexpected link. Got: " << address;
|
76
|
|
- }
|
77
|
|
- }
|
78
|
|
- else
|
79
|
|
- {
|
80
|
|
- QDesktopServices::openUrl(url);
|
81
|
|
- }
|
82
|
|
-}
|