VirtualBox

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

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

FE/Qt: bugref:9831. Adding new tab action to middle mouse click

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/* $Id: UIHelpViewer.h 87217 2021-01-11 17:31:52Z 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, bool fBackground);
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
61 void sltToggleFindInPageWidget(bool fVisible);
62
63protected:
64
65 virtual void contextMenuEvent(QContextMenuEvent *event) /* override */;
66 virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
67 virtual void wheelEvent(QWheelEvent *pEvent) /* override */;
68 virtual void mousePressEvent(QMouseEvent *pEvent) /* override */;
69
70private slots:
71
72 void sltHandleOpenLinkInNewTab();
73 void sltHandleOpenLink();
74 void sltHandleCopyLink();
75 void sltHandleFindWidgetDrag(const QPoint &delta);
76 void sltHandleFindInPageSearchTextChange(const QString &strSearchText);
77 void sltSelectPreviousMatch();
78 void sltSelectNextMatch();
79
80private:
81
82 void retranslateUi();
83 bool isRectInside(const QRect &rect, int iMargin) const;
84 void moveFindWidgetIn(int iMargin);
85 void findAllMatches(const QString &searchString);
86 void highlightFinds(int iSearchTermLength);
87 void selectMatch(int iMatchIndex, int iSearchStringLength);
88 const QHelpEngine* m_pHelpEngine;
89 UIFindInPageWidget *m_pFindInPageWidget;
90 /* Initilized as false and set to true once the user drag moves the find widget. */
91 bool m_fFindWidgetDragged;
92 int m_iMarginForFindWidget;
93 /** Document positions of the cursors within the document for all matches. */
94 QVector<int> m_matchedCursorPosition;
95 int m_iSelectedMatchIndex;
96 int m_iSearchTermLength;
97 int m_iInitialFontPointSize;
98};
99
100#endif /* #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */
101#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