File indexing completed on 2024-12-08 09:34:12

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_MONAVMAPSMODEL_H
0007 #define MARBLE_MONAVMAPSMODEL_H
0008 
0009 #include "MonavMap.h"
0010 
0011 #include <QAbstractTableModel>
0012 
0013 namespace Marble
0014 {
0015 
0016 class MonavMapsModel : public QAbstractTableModel
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit MonavMapsModel( const QVector<MonavMap> &data, QObject * parent = nullptr );
0022 
0023     QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
0024 
0025     QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const override;
0026 
0027     int rowCount ( const QModelIndex & parent = QModelIndex() ) const override;
0028 
0029     int columnCount ( const QModelIndex & parent = QModelIndex() ) const override;
0030 
0031     static bool sortByName( const MonavMap &first, const MonavMap &second );
0032 
0033     void deleteMapFiles( int index );
0034 
0035     QString payload( int index ) const;
0036 
0037     void setInstallableVersions( const QMap<QString, QString> &remoteMaps );
0038 
0039 private:
0040     QVector<MonavMap> m_data;
0041 
0042     QMap<QString, QString> m_remoteMaps;
0043 };
0044 
0045 }
0046 
0047 #endif // MARBLE_MONAVMAPSMODEL_H