1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #include "helpviewerimpl.h" |
5 | #include "helpviewerimpl_p.h" |
6 | |
7 | #include "helpenginewrapper.h" |
8 | #include "tracer.h" |
9 | |
10 | #include <QtCore/QCoreApplication> |
11 | |
12 | #include <QtGui/QMouseEvent> |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | const QString HelpViewerImpl::AboutBlank = |
17 | QCoreApplication::translate(context: "HelpViewer", key: "<title>about:blank</title>"); |
18 | |
19 | const QString HelpViewerImpl::LocalHelpFile = QLatin1String("qthelp://" |
20 | "org.qt-project.qtassistant.%1%2%3/qtassistant/assistant-quick-guide.html") |
21 | .arg(args: QString::number(QT_VERSION_MAJOR), |
22 | args: QString::number(QT_VERSION_MINOR), |
23 | args: QString::number(QT_VERSION_PATCH)); |
24 | |
25 | const QString HelpViewerImpl::PageNotFoundMessage = |
26 | QCoreApplication::translate(context: "HelpViewer", key: "<title>Error 404...</title><div " |
27 | "align=\"center\"><br><br><h1>The page could not be found.</h1><br><h3>'%1'" |
28 | "</h3></div>"); |
29 | |
30 | HelpViewerImpl::~HelpViewerImpl() |
31 | { |
32 | TRACE_OBJ |
33 | delete d; |
34 | } |
35 | |
36 | // -- public slots |
37 | |
38 | void HelpViewerImpl::home() |
39 | { |
40 | TRACE_OBJ |
41 | setSource(name: HelpEngineWrapper::instance().homePage()); |
42 | } |
43 | |
44 | // -- private slots |
45 | |
46 | void HelpViewerImpl::setLoadFinished() |
47 | { |
48 | emit sourceChanged(source()); |
49 | } |
50 | |
51 | // -- private |
52 | |
53 | bool HelpViewerImpl::handleForwardBackwardMouseButtons(QMouseEvent *event) |
54 | { |
55 | TRACE_OBJ |
56 | if (event->button() == Qt::XButton1) { |
57 | backward(); |
58 | return true; |
59 | } |
60 | |
61 | if (event->button() == Qt::XButton2) { |
62 | forward(); |
63 | return true; |
64 | } |
65 | |
66 | return false; |
67 | } |
68 | |
69 | QT_END_NAMESPACE |
70 |