File indexing completed on 2024-05-12 11:43:10
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org> 0004 // 0005 0006 #ifndef MARBLE_SPEAKERSMODEL_H 0007 #define MARBLE_SPEAKERSMODEL_H 0008 0009 #include "marble_export.h" 0010 0011 #include <QAbstractListModel> 0012 0013 namespace Marble 0014 { 0015 0016 class SpeakersModelPrivate; 0017 0018 class MARBLE_EXPORT SpeakersModel : public QAbstractListModel 0019 { 0020 Q_OBJECT 0021 0022 Q_PROPERTY(int count READ count NOTIFY countChanged) 0023 0024 public: 0025 enum SpeakersModelRoles { 0026 Name = Qt::UserRole + 1, 0027 Path, 0028 IsLocal, 0029 IsRemote 0030 }; 0031 0032 /** Constructor */ 0033 explicit SpeakersModel( QObject *parent = nullptr ); 0034 0035 /** Destructor */ 0036 ~SpeakersModel() override; 0037 0038 /** Overload of QAbstractListModel */ 0039 int rowCount ( const QModelIndex &parent = QModelIndex() ) const override; 0040 0041 /** Overload of QAbstractListModel */ 0042 QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const override; 0043 0044 /** Overload of QAbstractListModel */ 0045 QHash<int, QByteArray> roleNames() const override; 0046 0047 /** @todo FIXME https://bugreports.qt-project.org/browse/QTCOMPONENTS-1206 */ 0048 int count() const; 0049 0050 public Q_SLOTS: 0051 int indexOf( const QString &name ); 0052 0053 QString path( int index ); 0054 0055 void install( int index ); 0056 0057 bool isLocal( int index ) const; 0058 0059 bool isRemote( int index ) const; 0060 0061 Q_SIGNALS: 0062 void countChanged(); 0063 0064 void installationProgressed( int newstuffindex, qreal progress ); 0065 0066 void installationFinished( int index ); 0067 0068 private: 0069 SpeakersModelPrivate* const d; 0070 friend class SpeakersModelPrivate; 0071 0072 Q_PRIVATE_SLOT( d, void fillModel() ) 0073 0074 Q_PRIVATE_SLOT( d, void handleInstallationProgress( int row, qreal progress ) ) 0075 0076 Q_PRIVATE_SLOT( d, void handleInstallation( int row ) ) 0077 }; 0078 0079 } 0080 0081 #endif // MARBLE_SPEAKERSMODEL_H