Version: 9.16.0
QtxWebBrowser.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// File: QtxWebBrowser.h
24// Author: Roman NIKOLAEV
25//
26
27#ifndef QTXWEBBROWSER_H
28#define QTXWEBBROWSER_H
29
30#include "Qtx.h"
31
32#include <QtGlobal>
33#include <QDialog>
34#include <QMainWindow>
35#include <QUrl>
36
37#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
38// Web Kit
39#define WebView QWebView
40#define WebPage QWebPage
41#else
42// Web Engine
43#define WebView QWebEngineView
44#define WebPage QWebEnginePage
45#endif
46
47class QButtonGroup;
48class QCheckBox;
49class QLabel;
50class QPushButton;
51class WebView;
52class QtxResourceMgr;
53class QtxSearchTool;
54
56{
57 Q_OBJECT
58
59 class Downloader;
60 class Searcher;
61
62public:
63 virtual ~QtxWebBrowser();
64
65 static QtxWebBrowser* webBrowser();
66 static void loadUrl( const QString&, const QString& = QString() );
67 static void setResourceMgr( QtxResourceMgr* );
68 static void shutdown();
69
70protected:
72 QtxResourceMgr* resourceMgr() const;
73
74private:
75 void saveLink( const QString& );
76 void openLink( const QString&, bool = false );
77
78public Q_SLOTS:
79 virtual void load( const QString& );
80
81protected Q_SLOTS:
82 virtual void about();
83 virtual void linkClicked( const QUrl& );
84 virtual void linkHovered( const QString&, const QString&, const QString& );
85 virtual void linkHovered( const QString&) ;
86
87private Q_SLOTS:
88 void open();
89 void adjustTitle();
90 void finished( bool );
91 void linkAction();
92
93private:
99};
100
102{
103 Q_OBJECT;
104
105 enum { mOpen, mSave };
106
107public:
108 Downloader( const QString&, int = mOpen, const QString& = QString(), QWidget* = 0 );
109 ~Downloader();
110
111 int action() const;
112 bool isRepeatAction() const;
113 QString program() const;
114
115private Q_SLOTS:
116 void setAction( int );
117 void browse();
118
119private:
120 QString myProgram;
122 QButtonGroup* myAction;
123 QPushButton* myBrowse;
124 QCheckBox* myRepeat;
125
126 friend class QtxWebBrowser;
127};
128
129#endif // QTXWEBBROWSER_H
#define WebView
Definition: QtxWebBrowser.h:43
#define QTX_EXPORT
Definition: Qtx.h:36
Application resources manager.
Definition: QtxResourceMgr.h:53
Context search tool.
Definition: QtxSearchTool.h:41
A dialog box that is used to process file links.
Definition: QtxWebBrowser.h:102
~Downloader()
Destructor.
Definition: QtxWebBrowser.cxx:252
QButtonGroup * myAction
Definition: QtxWebBrowser.h:122
void browse()
Browse program to be used to open the file.
Definition: QtxWebBrowser.cxx:300
void setAction(int)
Set current action.
Definition: QtxWebBrowser.cxx:292
bool isRepeatAction() const
Get "repeat action for all such files" flag status.
Definition: QtxWebBrowser.cxx:272
QLabel * myFileName
Definition: QtxWebBrowser.h:121
@ mOpen
Definition: QtxWebBrowser.h:105
@ mSave
Definition: QtxWebBrowser.h:105
QCheckBox * myRepeat
Definition: QtxWebBrowser.h:124
Downloader(const QString &, int=mOpen, const QString &=QString(), QWidget *=0)
Constructor.
Definition: QtxWebBrowser.cxx:200
int action() const
Get action selected by the user.
Definition: QtxWebBrowser.cxx:262
QString myProgram
Definition: QtxWebBrowser.h:120
QString program() const
Get program to be used to open chosen file.
Definition: QtxWebBrowser.cxx:281
QPushButton * myBrowse
Definition: QtxWebBrowser.h:123
A class is used with QtxSearchTool in order to search text within the web page.
Definition: QtxWebBrowser.cxx:75
The QtxWebBrowser provides a window that can display html pages from local file system.
Definition: QtxWebBrowser.h:56
static QtxWebBrowser * myBrowser
The only one instance of web browser.
Definition: QtxWebBrowser.h:94
QUrl myLastUrl
Definition: QtxWebBrowser.h:98
QtxSearchTool * myFindPanel
Definition: QtxWebBrowser.h:97
QWebEngineView * myWebView
Definition: QtxWebBrowser.h:96
static QtxResourceMgr * myResourceMgr
Resources manager.
Definition: QtxWebBrowser.h:95