File indexing completed on 2024-05-12 15:31:21
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de> 0004 // 0005 0006 #ifndef WEATHERMODEL_H 0007 #define WEATHERMODEL_H 0008 0009 #include "AbstractDataPluginModel.h" 0010 0011 #include "WeatherData.h" 0012 0013 #include <QStringList> 0014 0015 class QByteArray; 0016 class QTimer; 0017 0018 namespace Marble 0019 { 0020 0021 class AbstractWeatherService; 0022 class GeoDataLatLonAltBox; 0023 class MarbleWidget; 0024 class MarbleModel; 0025 0026 class WeatherModel : public AbstractDataPluginModel 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 explicit WeatherModel( const MarbleModel *marbleModel, QObject *parent ); 0032 ~WeatherModel() override; 0033 0034 void setUpdateInterval( quint32 hours ); 0035 0036 void setFavoriteItems( const QStringList& list ) override; 0037 0038 public Q_SLOTS: 0039 /** 0040 * Downloads the file from @p url. @p item -> addDownloadedFile() will be called when the 0041 * download is finished. Additionally initialized() items will be added to the item list 0042 * after the download. 0043 * @param url The URL 0044 * @param type The type of the download 0045 * @param item The plugin item 0046 **/ 0047 void downloadItemData( const QUrl& url, const QString& type, AbstractDataPluginItem *item ); 0048 0049 void downloadDescriptionFileRequested( const QUrl& url ); 0050 0051 void setMarbleWidget(MarbleWidget *widget); 0052 0053 Q_SIGNALS: 0054 void favoriteItemChanged( const QString& id, bool isFavorite ); 0055 0056 protected: 0057 void getAdditionalItems( const GeoDataLatLonAltBox& box, 0058 qint32 number = 10 ) override; 0059 void getItem( const QString &id ) override; 0060 void parseFile( const QByteArray& file ) override; 0061 0062 private: 0063 void addService( AbstractWeatherService *service ); 0064 0065 QList<AbstractWeatherService*> m_services; 0066 QTimer *m_timer; 0067 }; 0068 0069 } // namespace Marble 0070 0071 #endif // WEATHERMODEL_H