Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxWebBrowser.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, 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 
47 class QButtonGroup;
48 class QCheckBox;
49 class QLabel;
50 class QPushButton;
51 class WebView;
52 class QtxResourceMgr;
53 class QtxSearchTool;
54 
56 {
57  Q_OBJECT
58 
59  class Downloader;
60  class Searcher;
61 
62 public:
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 
70 protected:
71  QtxWebBrowser();
72  QtxResourceMgr* resourceMgr() const;
73 
74 private:
75  void saveLink( const QString& );
76  void openLink( const QString&, bool = false );
77 
78 public Q_SLOTS:
79  virtual void load( const QString& );
80 
81 protected 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 
87 private Q_SLOTS:
88  void open();
89  void adjustTitle();
90  void finished( bool );
91  void linkAction();
92 
93 private:
98  QUrl myLastUrl;
99 };
100 
102 {
103  Q_OBJECT;
104 
105  enum { mOpen, mSave };
106 
107 public:
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 
115 private Q_SLOTS:
116  void setAction( int );
117  void browse();
118 
119 private:
120  QString myProgram;
122  QButtonGroup* myAction;
123  QPushButton* myBrowse;
124  QCheckBox* myRepeat;
125 
126  friend class QtxWebBrowser;
127 };
128 
129 #endif // QTXWEBBROWSER_H