VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h@ 87208

Last change on this file since 87208 was 87208, checked in by vboxsync, 4 years ago

FE/Qt: bugref:9831. Adding a context menu item for find in page action

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/* $Id: UIHelpViewer.h 87208 2021-01-11 09:04:21Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIHelpBrowserWidget class declaration.
4 */
5
6/*
7 * Copyright (C) 2010-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef FEQT_INCLUDED_SRC_helpbrowser_UIHelpViewer_h
19#define FEQT_INCLUDED_SRC_helpbrowser_UIHelpViewer_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* Qt includes: */
25#include <QTextBrowser>
26
27/* GUI includes: */
28#include "QIWithRetranslateUI.h"
29
30/* Forward declarations: */
31class QHelpEngine;
32class UIFindInPageWidget;
33
34#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
35class UIHelpViewer : public QIWithRetranslateUI<QTextBrowser>
36{
37 Q_OBJECT;
38
39signals:
40
41 void sigOpenLinkInNewTab(const QUrl &url);
42 void sigCloseFindInPageWidget();
43 void sigFontPointSizeChanged(int iFontPointSize);
44 void sigGoBackward();
45 void sigGoForward();
46 void sigGoHome();
47 void sigAddBookmark();
48
49public:
50
51 UIHelpViewer(const QHelpEngine *pHelpEngine, QWidget *pParent = 0);
52 virtual QVariant loadResource(int type, const QUrl &name) /* override */;
53 void emitHistoryChangedSignal();
54 void setSource(const QUrl &url) /* override */;
55 int initialFontPointSize() const;
56 void setFont(const QFont &);
57 bool isFindInPageWidgetVisible() const;
58
59public slots:
60 void sltToggleFindInPageWidget(bool fVisible);
61
62protected:
63
64 virtual void contextMenuEvent(QContextMenuEvent *event) /* override */;
65 virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
66 virtual void wheelEvent(QWheelEvent *pEvent) /* override */;
67
68private slots:
69
70 void sltHandleOpenLinkInNewTab();
71 void sltHandleOpenLink();
72 void sltHandleCopyLink();
73 void sltHandleFindWidgetDrag(const QPoint &delta);
74 void sltHandleFindInPageSearchTextChange(const QString &strSearchText);
75 void sltSelectPreviousMatch();
76 void sltSelectNextMatch();
77
78private:
79
80 void retranslateUi();
81 bool isRectInside(const QRect &rect, int iMargin) const;
82 void moveFindWidgetIn(int iMargin);
83 void findAllMatches(const QString &searchString);
84 void highlightFinds(int iSearchTermLength);
85 void selectMatch(int iMatchIndex, int iSearchStringLength);
86 const QHelpEngine* m_pHelpEngine;
87 UIFindInPageWidget *m_pFindInPageWidget;
88 /* Initilized as false and set to true once the user drag moves the find widget. */
89 bool m_fFindWidgetDragged;
90 const int m_iMarginForFindWidget;
91 /** Document positions of the cursors within the document for all matches. */
92 QVector<int> m_matchedCursorPosition;
93 int m_iSelectedMatchIndex;
94 int m_iSearchTermLength;
95 int m_iInitialFontPointSize;
96};
97
98#endif /* #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */
99#endif /* !FEQT_INCLUDED_SRC_helpbrowser_UIHelpViewer_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette