Marble

SpeakersModel.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_SPEAKERSMODEL_H
7#define MARBLE_SPEAKERSMODEL_H
8
9#include "marble_export.h"
10
11#include <QAbstractListModel>
12
13namespace Marble
14{
15
16class SpeakersModelPrivate;
17
18class MARBLE_EXPORT SpeakersModel : public QAbstractListModel
19{
20 Q_OBJECT
21
22 Q_PROPERTY(int count READ count NOTIFY countChanged)
23
24public:
25 enum SpeakersModelRoles {
26 Name = Qt::UserRole + 1,
27 Path,
28 IsLocal,
29 IsRemote
30 };
31
32 /** Constructor */
33 explicit SpeakersModel(QObject *parent = nullptr);
34
35 /** Destructor */
36 ~SpeakersModel() override;
37
38 /** Overload of QAbstractListModel */
39 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
40
41 /** Overload of QAbstractListModel */
42 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
43
44 /** Overload of QAbstractListModel */
45 QHash<int, QByteArray> roleNames() const override;
46
47 /** @todo FIXME https://bugreports.qt-project.org/browse/QTCOMPONENTS-1206 */
48 int count() const;
49
50public Q_SLOTS:
51 int indexOf(const QString &name);
52
53 QString path(int index);
54
55 void install(int index);
56
57 bool isLocal(int index) const;
58
59 bool isRemote(int index) const;
60
61Q_SIGNALS:
62 void countChanged();
63
64 void installationProgressed(int newstuffindex, qreal progress);
65
66 void installationFinished(int index);
67
68private:
69 SpeakersModelPrivate *const d;
70 friend class SpeakersModelPrivate;
71
72 Q_PRIVATE_SLOT(d, void fillModel())
73
74 Q_PRIVATE_SLOT(d, void handleInstallationProgress(int row, qreal progress))
75
76 Q_PRIVATE_SLOT(d, void handleInstallation(int row))
77};
78
79}
80
81#endif // MARBLE_SPEAKERSMODEL_H
QString path(const QString &relativePath)
Binds a QML item to a specific geodetic location in screen coordinates.
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.