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 WIKIPEDIAMODEL_H
0007 #define WIKIPEDIAMODEL_H
0008 
0009 #include "AbstractDataPluginModel.h"
0010 
0011 #include <QIcon>
0012 
0013 namespace Marble
0014 {
0015 
0016 class MarbleWidget;
0017 
0018 const quint32 numberOfArticlesPerFetch = 7;
0019   
0020 class WikipediaModel : public AbstractDataPluginModel
0021 {
0022     Q_OBJECT
0023     
0024  public:
0025     explicit WikipediaModel( const MarbleModel *marbleModel, QObject *parent = nullptr );
0026     ~WikipediaModel() override;
0027 
0028     void setShowThumbnail( bool show );
0029 
0030     void setMarbleWidget( MarbleWidget* widget );
0031 
0032  protected:
0033     /**
0034      * Generates the download url for the description file from the web service depending on
0035      * the @p box surrounding the view and the @p number of files to show.
0036      **/
0037     void getAdditionalItems( const GeoDataLatLonAltBox& box,
0038                              qint32 number = 10 ) override;
0039        
0040     /**
0041      * The reimplementation has to parse the @p file and should generate widgets. This widgets
0042      * have to be scheduled to downloadItemData or could be directly added to the list,
0043      * depending on if they have to download information to be shown.
0044      **/
0045     void parseFile( const QByteArray& file ) override;
0046     
0047  private:
0048     MarbleWidget* m_marbleWidget;
0049     QIcon m_wikipediaIcon;
0050     QString m_languageCode;
0051 
0052     bool m_showThumbnail;
0053 };
0054 
0055 }
0056 
0057 #endif // WIKIPEDIAMODEL_H