Kirigami-addons

soundspickermodel.h
1// SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com>
2// SPDX-License-Identifier: LGPL-2.0-or-later
3#ifndef SoundsPickerModel_H
4#define SoundsPickerModel_H
5
6#include <QAbstractListModel>
7#include <memory>
8class SoundsPickerModel : public QAbstractListModel
9{
11 Q_PROPERTY(bool notification READ notification WRITE setNotification NOTIFY notificationChanged)
12 Q_PROPERTY(QStringList defaultAudio READ defaultAudio WRITE setDefaultAudio NOTIFY defaultAudioChanged)
13 Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
14public:
15 enum Roles {
16 NameRole = Qt::UserRole,
17 UrlRole
18 };
19
20 explicit SoundsPickerModel(QObject *parent = nullptr);
21 ~SoundsPickerModel();
22
23 bool notification() const;
24 void setNotification(bool notification);
25 Q_INVOKABLE QString initialSourceUrl(int index);
26 QHash<int, QByteArray> roleNames() const override;
27 QVariant data(const QModelIndex &index, int role) const override;
28 int rowCount(const QModelIndex& parent) const override;
29
30 const QStringList &defaultAudio() const;
31 void setDefaultAudio(const QStringList &audio);
32 const QString &theme() const;
33 void setTheme(const QString &theme);
34
36 void notificationChanged();
37 void defaultAudioChanged();
38 void themeChanged();
39
40private:
41 void loadFiles();
42 void rearrangeRingtoneOrder();
43 class Private;
44 std::unique_ptr<Private> d;
45};
46
47#endif // SoundsPickerModel_H
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:11 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.