File indexing completed on 2024-04-28 03:50:23

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Guillaume Martres <smarter@ubuntu.com>
0004 //
0005 
0006 #ifndef MARBLE_SATELLITESCONFIGMODEL_H
0007 #define MARBLE_SATELLITESCONFIGMODEL_H
0008 
0009 #include <QModelIndex>
0010 
0011 #include "SatellitesConfigNodeItem.h"
0012 
0013 namespace Marble {
0014 
0015 class SatellitesConfigModel : public QAbstractItemModel
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit SatellitesConfigModel( QObject *parent = nullptr );
0020     ~SatellitesConfigModel() override;
0021 
0022     void loadSettings(const QHash<QString, QVariant> &settings);
0023 
0024     void appendChild( SatellitesConfigAbstractItem *child );
0025     void clear();
0026 
0027     QStringList idList() const;
0028     QStringList fullIdList() const;
0029     QStringList urlList() const;
0030 
0031     QVariant data( const QModelIndex &index,
0032                    int role = Qt::DisplayRole ) const override;
0033     bool setData( const QModelIndex &index,
0034                   const QVariant &value,
0035                   int role = Qt::EditRole ) override;
0036     int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
0037     int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
0038     QModelIndex parent( const QModelIndex &child ) const override;
0039     QModelIndex index( int row,
0040                        int column,
0041                        const QModelIndex &parent = QModelIndex() ) const override;
0042     QVariant headerData( int section, Qt::Orientation orientation,
0043                          int role = Qt::DisplayRole ) const override;
0044     Qt::ItemFlags flags( const QModelIndex &index ) const override;
0045     SatellitesConfigNodeItem* rootItem() const;
0046 
0047 protected:
0048     SatellitesConfigNodeItem *m_rootItem;
0049 };
0050 
0051 } // namespace Marble
0052 
0053 #endif // MARBLE_SATELLITESCONFIGMODEL_H
0054