File indexing completed on 2024-05-05 03:50:56
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de> 0004 // 0005 0006 #ifndef WIKIPEDIAITEM_H 0007 #define WIKIPEDIAITEM_H 0008 0009 #include "AbstractDataPluginItem.h" 0010 0011 #include <QHash> 0012 #include <QUrl> 0013 #include <QPixmap> 0014 #include <QIcon> 0015 0016 class QAction; 0017 0018 namespace Marble 0019 { 0020 0021 class MarbleWidget; 0022 class TinyWebBrowser; 0023 0024 class WikipediaItem : public AbstractDataPluginItem 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 WikipediaItem( MarbleWidget* widget, QObject *parent ); 0030 0031 ~WikipediaItem() override; 0032 0033 QString name() const; 0034 0035 void setName( const QString& name ); 0036 0037 bool initialized() const override; 0038 0039 void addDownloadedFile( const QString& url, const QString& type ) override; 0040 0041 void paint( QPainter *painter ) override; 0042 0043 bool operator<( const AbstractDataPluginItem *other ) const override; 0044 0045 qreal longitude() const; 0046 0047 void setLongitude( qreal longitude ); 0048 0049 qreal latitude() const; 0050 0051 void setLatitude( qreal latitude ); 0052 0053 QUrl url() const; 0054 0055 void setUrl( const QUrl& url ); 0056 0057 QUrl thumbnailImageUrl() const; 0058 0059 void setThumbnailImageUrl( const QUrl& thumbnailImageUrl ); 0060 0061 QString summary() const; 0062 0063 void setSummary( const QString& summary ); 0064 0065 QAction *action() override; 0066 0067 void setIcon( const QIcon& icon ); 0068 0069 void setSettings( const QHash<QString, QVariant>& settings ) override; 0070 0071 /** Set a popularity rank. Larger means more popular. Default rank is 0 */ 0072 void setRank( double rank ); 0073 0074 double rank() const; 0075 0076 public Q_SLOTS: 0077 void openBrowser(); 0078 0079 private: 0080 void updateSize(); 0081 void updateToolTip(); 0082 bool showThumbnail() const; 0083 0084 MarbleWidget * m_marbleWidget; 0085 QUrl m_url; 0086 QUrl m_thumbnailImageUrl; 0087 QString m_summary; 0088 double m_rank; 0089 TinyWebBrowser *m_browser; 0090 QAction *m_action; 0091 0092 QPixmap m_thumbnail; 0093 QIcon m_wikiIcon; 0094 bool m_showThumbnail; 0095 }; 0096 0097 } 0098 0099 #endif // WIKIPEDIAITEM_H