1 // SPDX-License-Identifier: LGPL-2.1-or-later 2 // 3 // SPDX-FileCopyrightText: 2011 Guillaume Martres <smarter@ubuntu.com> 4 // 5 6 #ifndef MARBLE_SATELLITESCONFIGMODEL_H 7 #define MARBLE_SATELLITESCONFIGMODEL_H 8 9 #include <QModelIndex> 10 11 #include "SatellitesConfigNodeItem.h" 12 13 namespace Marble { 14 15 class SatellitesConfigModel : public QAbstractItemModel 16 { 17 Q_OBJECT 18 public: 19 explicit SatellitesConfigModel( QObject *parent = nullptr ); 20 ~SatellitesConfigModel() override; 21 22 void loadSettings(const QHash<QString, QVariant> &settings); 23 24 void appendChild( SatellitesConfigAbstractItem *child ); 25 void clear(); 26 27 QStringList idList() const; 28 QStringList fullIdList() const; 29 QStringList urlList() const; 30 31 QVariant data( const QModelIndex &index, 32 int role = Qt::DisplayRole ) const override; 33 bool setData( const QModelIndex &index, 34 const QVariant &value, 35 int role = Qt::EditRole ) override; 36 int columnCount( const QModelIndex &parent = QModelIndex() ) const override; 37 int rowCount( const QModelIndex &parent = QModelIndex() ) const override; 38 QModelIndex parent( const QModelIndex &child ) const override; 39 QModelIndex index( int row, 40 int column, 41 const QModelIndex &parent = QModelIndex() ) const override; 42 QVariant headerData( int section, Qt::Orientation orientation, 43 int role = Qt::DisplayRole ) const override; 44 Qt::ItemFlags flags( const QModelIndex &index ) const override; 45 SatellitesConfigNodeItem* rootItem() const; 46 47 protected: 48 SatellitesConfigNodeItem *m_rootItem; 49 }; 50 51 } // namespace Marble 52 53 #endif // MARBLE_SATELLITESCONFIGMODEL_H 54 55