File indexing completed on 2024-04-21 14:51:13

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org>
0004 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
0005 //
0006 
0007 #ifndef MARBLE_TINYWEBBROWSER_H
0008 #define MARBLE_TINYWEBBROWSER_H
0009 
0010 // Qt
0011 #include <QWebEngineView>
0012 
0013 // Marble
0014 #include "marble_export.h"
0015 
0016 class QString;
0017 class QUrl;
0018 
0019 namespace Marble
0020 {
0021 
0022 class TinyWebBrowserPrivate;
0023 
0024 /**
0025  * This class provides a tiny web browser based on QWebEngineView (WebKit).
0026  * It is different from QWebEngineView as it has the button "Open in new Window"
0027  * disabled per default and instead opens every link in the default web
0028  * browser of the user.
0029  */
0030 class MARBLE_EXPORT TinyWebBrowser : public QWebEngineView
0031 {
0032     Q_OBJECT
0033 
0034  public:
0035     explicit TinyWebBrowser( QWidget* parent = nullptr );
0036     ~TinyWebBrowser() override;
0037 
0038  public Q_SLOTS:
0039     void setWikipediaPath( const QString& relativeUrl );
0040     void print();
0041 
0042  Q_SIGNALS:
0043     void statusMessage( const QString& );
0044 
0045  protected:
0046     QWebEngineView *createWindow( QWebEnginePage::WebWindowType type ) override;
0047 
0048  private Q_SLOTS:
0049     void openExternalLink( const QUrl& );
0050 
0051  private:
0052     TinyWebBrowserPrivate * const d;
0053 };
0054 
0055 }
0056 
0057 #endif