-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
soundspickermodel.h
52 lines (42 loc) · 1.52 KB
/
soundspickermodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
#ifndef SoundsPickerModel_H
#define SoundsPickerModel_H
#include <QAbstractListModel>
#include <qqmlregistration.h>
#include <memory>
class SoundsPickerModel : public QAbstractListModel
{
Q_OBJECT
QML_NAMED_ELEMENT(SoundsModel)
Q_PROPERTY(bool notification READ notification WRITE setNotification NOTIFY notificationChanged)
Q_PROPERTY(QStringList defaultAudio READ defaultAudio WRITE setDefaultAudio NOTIFY defaultAudioChanged)
Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
public:
enum Roles {
NameRole = Qt::UserRole,
UrlRole
};
explicit SoundsPickerModel(QObject *parent = nullptr);
~SoundsPickerModel();
bool notification() const;
void setNotification(bool notification);
Q_INVOKABLE QString initialSourceUrl(int index);
QHash<int, QByteArray> roleNames() const override;
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex& parent) const override;
const QStringList &defaultAudio() const;
void setDefaultAudio(const QStringList &audio);
const QString &theme() const;
void setTheme(const QString &theme);
Q_SIGNALS:
void notificationChanged();
void defaultAudioChanged();
void themeChanged();
private:
void loadFiles();
void rearrangeRingtoneOrder();
class Private;
std::unique_ptr<Private> d;
};
#endif // SoundsPickerModel_H