File indexing completed on 2024-05-12 16:25:45
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "custombasemodel.h" 0010 #include "customsound/customsoundsinfo.h" 0011 #include "libruqolacore_export.h" 0012 0013 class LIBRUQOLACORE_EXPORT AdminCustomSoundModel : public CustomBaseModel 0014 { 0015 Q_OBJECT 0016 public: 0017 enum CustomSoundsRoles { 0018 Name, 0019 Identifier, 0020 LastColumn = Identifier, 0021 }; 0022 Q_ENUM(CustomSoundsRoles) 0023 0024 explicit AdminCustomSoundModel(QObject *parent = nullptr); 0025 ~AdminCustomSoundModel() override; 0026 0027 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0028 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; 0029 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0030 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override; 0031 0032 [[nodiscard]] int total() const override; 0033 void parseElements(const QJsonObject &obj) override; 0034 void addMoreElements(const QJsonObject &obj) override; 0035 [[nodiscard]] QList<int> hideColumns() const override; 0036 0037 const CustomSoundsInfo &customSounds() const; 0038 void setCustomSounds(const CustomSoundsInfo &newCustomSounds); 0039 0040 void removeElement(const QString &identifier) override; 0041 0042 private: 0043 LIBRUQOLACORE_NO_EXPORT void checkFullList() override; 0044 LIBRUQOLACORE_NO_EXPORT void clear(); 0045 CustomSoundsInfo mCustomSounds; 0046 };