File indexing completed on 2024-04-28 05:38:14

0001 /***************************************************************************
0002  *     Copyright (C) 2018 by Renaud Guezennec                              *
0003  *     https://rolisteam.org/                                           *
0004  *                                                                         *
0005  *   rolisteam is free software; you can redistribute it and/or modify     *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
0019  ***************************************************************************/
0020 #ifndef WEBVIEW_H
0021 #define WEBVIEW_H
0022 
0023 #include <QAction>
0024 #include <QMouseEvent>
0025 #include <QPointer>
0026 #include <QWebEngineView>
0027 #include <QWidget>
0028 
0029 #include "network/networkmessagewriter.h"
0030 #include "rwidgets/mediacontainers/mediacontainer.h"
0031 #include "rwidgets_global.h"
0032 namespace Ui
0033 {
0034 class WebView;
0035 }
0036 
0037 class WebpageController;
0038 class RWIDGET_EXPORT WebView : public MediaContainer
0039 {
0040     Q_OBJECT
0041 
0042 public:
0043     enum ShareType
0044     {
0045         URL,
0046         HTML
0047     };
0048 
0049     explicit WebView(WebpageController* ctrl, QWidget* parent= nullptr);
0050     virtual ~WebView();
0051 
0052 protected:
0053     void mousePressEvent(QMouseEvent* mouseEvent);
0054     void showEvent(QShowEvent* event);
0055     void updateTitle();
0056 
0057 private:
0058     QPointer<WebpageController> m_webCtrl;
0059     Ui::WebView* m_ui;
0060 };
0061 
0062 #endif // WEBVIEW_H