diff --git a/core/codegen/enum_header.hbs b/core/codegen/enum_header.hbs index e468093..39b3fdb 100644 --- a/core/codegen/enum_header.hbs +++ b/core/codegen/enum_header.hbs @@ -14,11 +14,18 @@ private: explicit {{className}}Class(); }; -typedef {{className}} Class::Value {{className}}; +typedef {{className}}Class::Value {{className}}; + +} // NS DTO + +namespace Support { + +using {{className}} = Jellyfin::DTO::{{className}}; +using {{className}}Class = Jellyfin::DTO::{{className}}Class; template <> -{{className}} fromJsonValue<{{className}}>(QJsonValue source) { +{{className}} fromJsonValue<{{className}}>(const QJsonValue &source) { if (!source.isString()) return {{className}}Class::EnumNotSet; QString str = source.toString(); diff --git a/core/codegen/object_header.hbs b/core/codegen/object_header.hbs index b5b3db0..467853a 100644 --- a/core/codegen/object_header.hbs +++ b/core/codegen/object_header.hbs @@ -5,13 +5,12 @@ class {{className}}; {{/if}} {{/each}} -class {{className}} : public QObject { - Q_OBJECT +class {{className}} { public: - explicit {{className}}(QObject *parent = nullptr); - static {{className}} *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source, bool emitSignals = true); - QJsonObject toJSON(); + explicit {{className}}(); + static {{className}} fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); // Properties @@ -23,26 +22,22 @@ public: */ {{/if}} - Q_PROPERTY({{p.typeNameWithQualifiers}} {{p.name}} READ {{p.name}} WRITE set{{p.writeName}} NOTIFY {{p.name}}Changed) - -{{/each}} - - // Getters - - {{#each properties as |p|}} {{p.typeNameWithQualifiers}} {{p.name}}() const; + +{{#if p.description.length > 0}} + /** + * @brief {{p.description}} + + */ +{{/if}} + void set{{p.writeName}}({{p.typeNameWithQualifiers}} new{{p.writeName}}); - - {{/each}} - - // Signals -signals: - - {{#each properties as |p|}} - void {{p.name}}Changed({{p.typeNameWithQualifiers}} new{{p.writeName}}); - - {{/each}} +{{#if p.isNullable}} + bool is{{p.writeName}}Null() const; + void set{{p.writeName}}Null(); +{{/if}} +{{/each}} protected: @@ -55,3 +50,16 @@ protected: {{/each}} }; + +} // NS DTO + +namespace Support { + +using {{className}} = Jellyfin::DTO::{{className}}; + +template <> + +{{className}} fromJsonValue<{{className}}>(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return {{className}}::fromJson(source.toObject()); +} diff --git a/core/codegen/object_implementation.hbs b/core/codegen/object_implementation.hbs index 770b707..ded1c98 100644 --- a/core/codegen/object_implementation.hbs +++ b/core/codegen/object_implementation.hbs @@ -1,30 +1,23 @@ -{{className}}::{{className}}(QObject *parent) : QObject(parent) {} +{{className}}::{{className}}(QObject *parent) {} -{{className}} *{{className}}::fromJSON(QJsonObject source, QObject *parent) { - {{className}} *instance = new {{className}}(parent); - instance->updateFromJSON(source, false); +{{className}} {{className}}::fromJson(QJsonObject source) { + {{className}} instance; + instance->setFromJson(source, false); return instance; } -void {{className}}::updateFromJSON(QJsonObject source, bool emitSignals) { +void {{className}}::setFromJson(QJsonObject source) { {{#each properties as |property|}} {{property.memberName}} = fromJsonValue<{{property.typeNameWithQualifiers}}>(source["{{property.originalName}}"]); {{/each}} - - if (emitSignals) { - {{#each properties as |property|}} - emit {{property.name}}Changed({{property.memberName}}); - - {{/each}} - } } -QJsonObject {{className}}::toJSON() { +QJsonObject {{className}}::toJson() { QJsonObject result; {{#each properties as |property|}} @@ -33,7 +26,7 @@ QJsonObject {{className}}::toJSON() { {{/each}} return result; -}" +} {{#each properties as |property|}} @@ -42,8 +35,14 @@ QJsonObject {{className}}::toJSON() { void {{className}}::set{{property.writeName}}({{property.typeNameWithQualifiers}} new{{property.writeName}}) { {{property.memberName}} = new{{property.writeName}}; - emit {{property.name}}Changed(new{{property.writeName}}); } +{{#if property.isNullable}} +bool {{className}}::is{{property.writeName}}Null() const { + return {{property.nullableCheck}}; +} +void {{className}}::setNull() { + {{property.nullableSetter}}; +} {{/each}} diff --git a/core/include/JellyfinQt/DTO/accessschedule.h b/core/include/JellyfinQt/DTO/accessschedule.h index de0bfaf..124140b 100644 --- a/core/include/JellyfinQt/DTO/accessschedule.h +++ b/core/include/JellyfinQt/DTO/accessschedule.h @@ -31,69 +31,82 @@ #define JELLYFIN_DTO_ACCESSSCHEDULE_H #include -#include -#include +#include +#include +#include #include "JellyfinQt/DTO/dynamicdayofweek.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class AccessSchedule : public QObject { - Q_OBJECT -public: - explicit AccessSchedule(QObject *parent = nullptr); - static AccessSchedule *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class AccessSchedule { +public: + explicit AccessSchedule(); + static AccessSchedule fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the id of this instance. */ - Q_PROPERTY(qint32 jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + qint32 jellyfinId() const; + /** + * @brief Gets or sets the id of this instance. + */ + void setJellyfinId(qint32 newJellyfinId); /** * @brief Gets or sets the id of the associated user. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) - Q_PROPERTY(DynamicDayOfWeek dayOfWeek READ dayOfWeek WRITE setDayOfWeek NOTIFY dayOfWeekChanged) + QUuid userId() const; + /** + * @brief Gets or sets the id of the associated user. + */ + void setUserId(QUuid newUserId); + + DynamicDayOfWeek dayOfWeek() const; + + void setDayOfWeek(DynamicDayOfWeek newDayOfWeek); /** * @brief Gets or sets the start hour. */ - Q_PROPERTY(double startHour READ startHour WRITE setStartHour NOTIFY startHourChanged) + double startHour() const; + /** + * @brief Gets or sets the start hour. + */ + void setStartHour(double newStartHour); /** * @brief Gets or sets the end hour. */ - Q_PROPERTY(double endHour READ endHour WRITE setEndHour NOTIFY endHourChanged) - - qint32 jellyfinId() const; - void setJellyfinId(qint32 newJellyfinId); - - QString userId() const; - void setUserId(QString newUserId); - - DynamicDayOfWeek dayOfWeek() const; - void setDayOfWeek(DynamicDayOfWeek newDayOfWeek); - - double startHour() const; - void setStartHour(double newStartHour); - double endHour() const; + /** + * @brief Gets or sets the end hour. + */ void setEndHour(double newEndHour); - -signals: - void jellyfinIdChanged(qint32 newJellyfinId); - void userIdChanged(QString newUserId); - void dayOfWeekChanged(DynamicDayOfWeek newDayOfWeek); - void startHourChanged(double newStartHour); - void endHourChanged(double newEndHour); + protected: qint32 m_jellyfinId; - QString m_userId; + QUuid m_userId; DynamicDayOfWeek m_dayOfWeek; double m_startHour; double m_endHour; }; +} // NS DTO + +namespace Support { + +using AccessSchedule = Jellyfin::DTO::AccessSchedule; + +template <> +AccessSchedule fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AccessSchedule::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/activitylogentry.h b/core/include/JellyfinQt/DTO/activitylogentry.h index 2116b83..262dc58 100644 --- a/core/include/JellyfinQt/DTO/activitylogentry.h +++ b/core/include/JellyfinQt/DTO/activitylogentry.h @@ -32,101 +32,103 @@ #include #include -#include +#include #include +#include +#include #include "JellyfinQt/DTO/loglevel.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ActivityLogEntry : public QObject { - Q_OBJECT -public: - explicit ActivityLogEntry(QObject *parent = nullptr); - static ActivityLogEntry *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ActivityLogEntry { +public: + explicit ActivityLogEntry(); + static ActivityLogEntry fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the identifier. */ - Q_PROPERTY(qint64 jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + qint64 jellyfinId() const; + /** + * @brief Gets or sets the identifier. + */ + void setJellyfinId(qint64 newJellyfinId); /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the overview. */ - Q_PROPERTY(QString overview READ overview WRITE setOverview NOTIFY overviewChanged) + QString overview() const; + /** + * @brief Gets or sets the overview. + */ + void setOverview(QString newOverview); /** * @brief Gets or sets the short overview. */ - Q_PROPERTY(QString shortOverview READ shortOverview WRITE setShortOverview NOTIFY shortOverviewChanged) + QString shortOverview() const; + /** + * @brief Gets or sets the short overview. + */ + void setShortOverview(QString newShortOverview); /** * @brief Gets or sets the type. */ - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + QString type() const; + /** + * @brief Gets or sets the type. + */ + void setType(QString newType); /** * @brief Gets or sets the item identifier. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QString itemId() const; + /** + * @brief Gets or sets the item identifier. + */ + void setItemId(QString newItemId); /** * @brief Gets or sets the date. */ - Q_PROPERTY(QDateTime date READ date WRITE setDate NOTIFY dateChanged) + QDateTime date() const; + /** + * @brief Gets or sets the date. + */ + void setDate(QDateTime newDate); /** * @brief Gets or sets the user identifier. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets the user identifier. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets the user primary image tag. */ - Q_PROPERTY(QString userPrimaryImageTag READ userPrimaryImageTag WRITE setUserPrimaryImageTag NOTIFY userPrimaryImageTagChanged) - Q_PROPERTY(LogLevel severity READ severity WRITE setSeverity NOTIFY severityChanged) - - qint64 jellyfinId() const; - void setJellyfinId(qint64 newJellyfinId); - - QString name() const; - void setName(QString newName); - - QString overview() const; - void setOverview(QString newOverview); - - QString shortOverview() const; - void setShortOverview(QString newShortOverview); - - QString type() const; - void setType(QString newType); - - QString itemId() const; - void setItemId(QString newItemId); - - QDateTime date() const; - void setDate(QDateTime newDate); - - QString userId() const; - void setUserId(QString newUserId); - QString userPrimaryImageTag() const; + /** + * @brief Gets or sets the user primary image tag. + */ void setUserPrimaryImageTag(QString newUserPrimaryImageTag); - + LogLevel severity() const; + void setSeverity(LogLevel newSeverity); - -signals: - void jellyfinIdChanged(qint64 newJellyfinId); - void nameChanged(QString newName); - void overviewChanged(QString newOverview); - void shortOverviewChanged(QString newShortOverview); - void typeChanged(QString newType); - void itemIdChanged(QString newItemId); - void dateChanged(QDateTime newDate); - void userIdChanged(QString newUserId); - void userPrimaryImageTagChanged(QString newUserPrimaryImageTag); - void severityChanged(LogLevel newSeverity); + protected: qint64 m_jellyfinId; QString m_name; @@ -135,11 +137,23 @@ protected: QString m_type; QString m_itemId; QDateTime m_date; - QString m_userId; + QUuid m_userId; QString m_userPrimaryImageTag; LogLevel m_severity; }; +} // NS DTO + +namespace Support { + +using ActivityLogEntry = Jellyfin::DTO::ActivityLogEntry; + +template <> +ActivityLogEntry fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ActivityLogEntry::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/activitylogentryqueryresult.h b/core/include/JellyfinQt/DTO/activitylogentryqueryresult.h index cffc94a..ab99fca 100644 --- a/core/include/JellyfinQt/DTO/activitylogentryqueryresult.h +++ b/core/include/JellyfinQt/DTO/activitylogentryqueryresult.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_ACTIVITYLOGENTRYQUERYRESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/activitylogentry.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ActivityLogEntry; -class ActivityLogEntryQueryResult : public QObject { - Q_OBJECT +class ActivityLogEntryQueryResult { public: - explicit ActivityLogEntryQueryResult(QObject *parent = nullptr); - static ActivityLogEntryQueryResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit ActivityLogEntryQueryResult(); + static ActivityLogEntryQueryResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items. */ - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) + QList> items() const; + /** + * @brief Gets or sets the items. + */ + void setItems(QList> newItems); /** * @brief The total number of records available. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief The total number of records available. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief The index of the first record in Items. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) - - QList items() const; - void setItems(QList newItems); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - qint32 startIndex() const; + /** + * @brief The index of the first record in Items. + */ void setStartIndex(qint32 newStartIndex); - -signals: - void itemsChanged(QList newItems); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void startIndexChanged(qint32 newStartIndex); + protected: - QList m_items; + QList> m_items; qint32 m_totalRecordCount; qint32 m_startIndex; }; +} // NS DTO + +namespace Support { + +using ActivityLogEntryQueryResult = Jellyfin::DTO::ActivityLogEntryQueryResult; + +template <> +ActivityLogEntryQueryResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ActivityLogEntryQueryResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/addvirtualfolderdto.h b/core/include/JellyfinQt/DTO/addvirtualfolderdto.h index ce001ef..39d1ff2 100644 --- a/core/include/JellyfinQt/DTO/addvirtualfolderdto.h +++ b/core/include/JellyfinQt/DTO/addvirtualfolderdto.h @@ -31,32 +31,46 @@ #define JELLYFIN_DTO_ADDVIRTUALFOLDERDTO_H #include -#include +#include +#include +#include + +#include "JellyfinQt/DTO/libraryoptions.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LibraryOptions; -class AddVirtualFolderDto : public QObject { - Q_OBJECT +class AddVirtualFolderDto { public: - explicit AddVirtualFolderDto(QObject *parent = nullptr); - static AddVirtualFolderDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(LibraryOptions * libraryOptions READ libraryOptions WRITE setLibraryOptions NOTIFY libraryOptionsChanged) - - LibraryOptions * libraryOptions() const; - void setLibraryOptions(LibraryOptions * newLibraryOptions); + explicit AddVirtualFolderDto(); + static AddVirtualFolderDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); -signals: - void libraryOptionsChanged(LibraryOptions * newLibraryOptions); + // Properties + + QSharedPointer libraryOptions() const; + + void setLibraryOptions(QSharedPointer newLibraryOptions); + protected: - LibraryOptions * m_libraryOptions = nullptr; + QSharedPointer m_libraryOptions = nullptr; }; +} // NS DTO + +namespace Support { + +using AddVirtualFolderDto = Jellyfin::DTO::AddVirtualFolderDto; + +template <> +AddVirtualFolderDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AddVirtualFolderDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/albuminfo.h b/core/include/JellyfinQt/DTO/albuminfo.h index 9102e4e..d090847 100644 --- a/core/include/JellyfinQt/DTO/albuminfo.h +++ b/core/include/JellyfinQt/DTO/albuminfo.h @@ -32,115 +32,113 @@ #include #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/songinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SongInfo; -class AlbumInfo : public QObject { - Q_OBJECT +class AlbumInfo { public: - explicit AlbumInfo(QObject *parent = nullptr); - static AlbumInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit AlbumInfo(); + static AlbumInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) + qint32 year() const; + /** + * @brief Gets or sets the year. + */ + void setYear(qint32 newYear); + + qint32 indexNumber() const; + + void setIndexNumber(qint32 newIndexNumber); + + qint32 parentIndexNumber() const; + + void setParentIndexNumber(qint32 newParentIndexNumber); + + QDateTime premiereDate() const; + + void setPremiereDate(QDateTime newPremiereDate); + + bool isAutomated() const; + + void setIsAutomated(bool newIsAutomated); /** * @brief Gets or sets the album artist. */ - Q_PROPERTY(QStringList albumArtists READ albumArtists WRITE setAlbumArtists NOTIFY albumArtistsChanged) + QStringList albumArtists() const; + /** + * @brief Gets or sets the album artist. + */ + void setAlbumArtists(QStringList newAlbumArtists); /** * @brief Gets or sets the artist provider ids. */ - Q_PROPERTY(QJsonObject artistProviderIds READ artistProviderIds WRITE setArtistProviderIds NOTIFY artistProviderIdsChanged) - Q_PROPERTY(QList songInfos READ songInfos WRITE setSongInfos NOTIFY songInfosChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - - qint32 year() const; - void setYear(qint32 newYear); - - qint32 indexNumber() const; - void setIndexNumber(qint32 newIndexNumber); - - qint32 parentIndexNumber() const; - void setParentIndexNumber(qint32 newParentIndexNumber); - - QDateTime premiereDate() const; - void setPremiereDate(QDateTime newPremiereDate); - - bool isAutomated() const; - void setIsAutomated(bool newIsAutomated); - - QStringList albumArtists() const; - void setAlbumArtists(QStringList newAlbumArtists); - QJsonObject artistProviderIds() const; + /** + * @brief Gets or sets the artist provider ids. + */ void setArtistProviderIds(QJsonObject newArtistProviderIds); - - QList songInfos() const; - void setSongInfos(QList newSongInfos); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); - void albumArtistsChanged(QStringList newAlbumArtists); - void artistProviderIdsChanged(QJsonObject newArtistProviderIds); - void songInfosChanged(QList newSongInfos); + + QList> songInfos() const; + + void setSongInfos(QList> newSongInfos); + protected: QString m_name; QString m_path; @@ -154,9 +152,21 @@ protected: bool m_isAutomated; QStringList m_albumArtists; QJsonObject m_artistProviderIds; - QList m_songInfos; + QList> m_songInfos; }; +} // NS DTO + +namespace Support { + +using AlbumInfo = Jellyfin::DTO::AlbumInfo; + +template <> +AlbumInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AlbumInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/albuminforemotesearchquery.h b/core/include/JellyfinQt/DTO/albuminforemotesearchquery.h index 1f13c22..f337344 100644 --- a/core/include/JellyfinQt/DTO/albuminforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/albuminforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_ALBUMINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/albuminfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class AlbumInfo; -class AlbumInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class AlbumInfoRemoteSearchQuery { public: - explicit AlbumInfoRemoteSearchQuery(QObject *parent = nullptr); - static AlbumInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit AlbumInfoRemoteSearchQuery(); + static AlbumInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(AlbumInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - AlbumInfo * searchInfo() const; - void setSearchInfo(AlbumInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(AlbumInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - AlbumInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using AlbumInfoRemoteSearchQuery = Jellyfin::DTO::AlbumInfoRemoteSearchQuery; + +template <> +AlbumInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AlbumInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/allthememediaresult.h b/core/include/JellyfinQt/DTO/allthememediaresult.h index 25f3dc7..7591dba 100644 --- a/core/include/JellyfinQt/DTO/allthememediaresult.h +++ b/core/include/JellyfinQt/DTO/allthememediaresult.h @@ -31,46 +31,56 @@ #define JELLYFIN_DTO_ALLTHEMEMEDIARESULT_H #include -#include +#include +#include +#include + +#include "JellyfinQt/DTO/thememediaresult.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ThemeMediaResult; -class ThemeMediaResult; -class ThemeMediaResult; -class AllThemeMediaResult : public QObject { - Q_OBJECT +class AllThemeMediaResult { public: - explicit AllThemeMediaResult(QObject *parent = nullptr); - static AllThemeMediaResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit AllThemeMediaResult(); + static AllThemeMediaResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(ThemeMediaResult * themeVideosResult READ themeVideosResult WRITE setThemeVideosResult NOTIFY themeVideosResultChanged) - Q_PROPERTY(ThemeMediaResult * themeSongsResult READ themeSongsResult WRITE setThemeSongsResult NOTIFY themeSongsResultChanged) - Q_PROPERTY(ThemeMediaResult * soundtrackSongsResult READ soundtrackSongsResult WRITE setSoundtrackSongsResult NOTIFY soundtrackSongsResultChanged) + QSharedPointer themeVideosResult() const; + + void setThemeVideosResult(QSharedPointer newThemeVideosResult); + + QSharedPointer themeSongsResult() const; + + void setThemeSongsResult(QSharedPointer newThemeSongsResult); + + QSharedPointer soundtrackSongsResult() const; + + void setSoundtrackSongsResult(QSharedPointer newSoundtrackSongsResult); - ThemeMediaResult * themeVideosResult() const; - void setThemeVideosResult(ThemeMediaResult * newThemeVideosResult); - - ThemeMediaResult * themeSongsResult() const; - void setThemeSongsResult(ThemeMediaResult * newThemeSongsResult); - - ThemeMediaResult * soundtrackSongsResult() const; - void setSoundtrackSongsResult(ThemeMediaResult * newSoundtrackSongsResult); - -signals: - void themeVideosResultChanged(ThemeMediaResult * newThemeVideosResult); - void themeSongsResultChanged(ThemeMediaResult * newThemeSongsResult); - void soundtrackSongsResultChanged(ThemeMediaResult * newSoundtrackSongsResult); protected: - ThemeMediaResult * m_themeVideosResult = nullptr; - ThemeMediaResult * m_themeSongsResult = nullptr; - ThemeMediaResult * m_soundtrackSongsResult = nullptr; + QSharedPointer m_themeVideosResult = nullptr; + QSharedPointer m_themeSongsResult = nullptr; + QSharedPointer m_soundtrackSongsResult = nullptr; }; +} // NS DTO + +namespace Support { + +using AllThemeMediaResult = Jellyfin::DTO::AllThemeMediaResult; + +template <> +AllThemeMediaResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AllThemeMediaResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/architecture.h b/core/include/JellyfinQt/DTO/architecture.h index 6810a47..69c74ee 100644 --- a/core/include/JellyfinQt/DTO/architecture.h +++ b/core/include/JellyfinQt/DTO/architecture.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_ARCHITECTURE_H #define JELLYFIN_DTO_ARCHITECTURE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ArchitectureClass { Q_GADGET public: enum Value { + EnumNotSet, X86, X64, Arm, @@ -49,8 +54,40 @@ public: private: explicit ArchitectureClass(); }; + typedef ArchitectureClass::Value Architecture; +} // NS DTO + +namespace Support { + +using Architecture = Jellyfin::DTO::Architecture; +using ArchitectureClass = Jellyfin::DTO::ArchitectureClass; + +template <> +Architecture fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ArchitectureClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("X86")) { + return ArchitectureClass::X86; + } + if (str == QStringLiteral("X64")) { + return ArchitectureClass::X64; + } + if (str == QStringLiteral("Arm")) { + return ArchitectureClass::Arm; + } + if (str == QStringLiteral("Arm64")) { + return ArchitectureClass::Arm64; + } + if (str == QStringLiteral("Wasm")) { + return ArchitectureClass::Wasm; + } + + return ArchitectureClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/artistinfo.h b/core/include/JellyfinQt/DTO/artistinfo.h index 645b964..9d9200c 100644 --- a/core/include/JellyfinQt/DTO/artistinfo.h +++ b/core/include/JellyfinQt/DTO/artistinfo.h @@ -32,99 +32,97 @@ #include #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/songinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SongInfo; -class ArtistInfo : public QObject { - Q_OBJECT +class ArtistInfo { public: - explicit ArtistInfo(QObject *parent = nullptr); - static ArtistInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit ArtistInfo(); + static ArtistInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - Q_PROPERTY(QList songInfos READ songInfos WRITE setSongInfos NOTIFY songInfosChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - - QList songInfos() const; - void setSongInfos(QList newSongInfos); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); - void songInfosChanged(QList newSongInfos); + + QList> songInfos() const; + + void setSongInfos(QList> newSongInfos); + protected: QString m_name; QString m_path; @@ -136,9 +134,21 @@ protected: qint32 m_parentIndexNumber; QDateTime m_premiereDate; bool m_isAutomated; - QList m_songInfos; + QList> m_songInfos; }; +} // NS DTO + +namespace Support { + +using ArtistInfo = Jellyfin::DTO::ArtistInfo; + +template <> +ArtistInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ArtistInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/artistinforemotesearchquery.h b/core/include/JellyfinQt/DTO/artistinforemotesearchquery.h index 505f17d..aa56cf0 100644 --- a/core/include/JellyfinQt/DTO/artistinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/artistinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_ARTISTINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/artistinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ArtistInfo; -class ArtistInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class ArtistInfoRemoteSearchQuery { public: - explicit ArtistInfoRemoteSearchQuery(QObject *parent = nullptr); - static ArtistInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit ArtistInfoRemoteSearchQuery(); + static ArtistInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(ArtistInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - ArtistInfo * searchInfo() const; - void setSearchInfo(ArtistInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(ArtistInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - ArtistInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using ArtistInfoRemoteSearchQuery = Jellyfin::DTO::ArtistInfoRemoteSearchQuery; + +template <> +ArtistInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ArtistInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/authenticateuserbyname.h b/core/include/JellyfinQt/DTO/authenticateuserbyname.h index 0c9bd54..f2bd5da 100644 --- a/core/include/JellyfinQt/DTO/authenticateuserbyname.h +++ b/core/include/JellyfinQt/DTO/authenticateuserbyname.h @@ -31,52 +31,67 @@ #define JELLYFIN_DTO_AUTHENTICATEUSERBYNAME_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class AuthenticateUserByName : public QObject { - Q_OBJECT -public: - explicit AuthenticateUserByName(QObject *parent = nullptr); - static AuthenticateUserByName *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class AuthenticateUserByName { +public: + explicit AuthenticateUserByName(); + static AuthenticateUserByName fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the username. */ - Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged) + QString username() const; + /** + * @brief Gets or sets the username. + */ + void setUsername(QString newUsername); /** * @brief Gets or sets the plain text password. */ - Q_PROPERTY(QString pw READ pw WRITE setPw NOTIFY pwChanged) + QString pw() const; + /** + * @brief Gets or sets the plain text password. + */ + void setPw(QString newPw); /** * @brief Gets or sets the sha1-hashed password. */ - Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) - - QString username() const; - void setUsername(QString newUsername); - - QString pw() const; - void setPw(QString newPw); - QString password() const; + /** + * @brief Gets or sets the sha1-hashed password. + */ void setPassword(QString newPassword); - -signals: - void usernameChanged(QString newUsername); - void pwChanged(QString newPw); - void passwordChanged(QString newPassword); + protected: QString m_username; QString m_pw; QString m_password; }; +} // NS DTO + +namespace Support { + +using AuthenticateUserByName = Jellyfin::DTO::AuthenticateUserByName; + +template <> +AuthenticateUserByName fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AuthenticateUserByName::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/authenticationinfo.h b/core/include/JellyfinQt/DTO/authenticationinfo.h index 5aec874..7df5cd9 100644 --- a/core/include/JellyfinQt/DTO/authenticationinfo.h +++ b/core/include/JellyfinQt/DTO/authenticationinfo.h @@ -32,112 +32,114 @@ #include #include -#include +#include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class AuthenticationInfo : public QObject { - Q_OBJECT -public: - explicit AuthenticationInfo(QObject *parent = nullptr); - static AuthenticationInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class AuthenticationInfo { +public: + explicit AuthenticationInfo(); + static AuthenticationInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the identifier. */ - Q_PROPERTY(qint64 jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + qint64 jellyfinId() const; + /** + * @brief Gets or sets the identifier. + */ + void setJellyfinId(qint64 newJellyfinId); /** * @brief Gets or sets the access token. */ - Q_PROPERTY(QString accessToken READ accessToken WRITE setAccessToken NOTIFY accessTokenChanged) + QString accessToken() const; + /** + * @brief Gets or sets the access token. + */ + void setAccessToken(QString newAccessToken); /** * @brief Gets or sets the device identifier. */ - Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged) + QString deviceId() const; + /** + * @brief Gets or sets the device identifier. + */ + void setDeviceId(QString newDeviceId); /** * @brief Gets or sets the name of the application. */ - Q_PROPERTY(QString appName READ appName WRITE setAppName NOTIFY appNameChanged) + QString appName() const; + /** + * @brief Gets or sets the name of the application. + */ + void setAppName(QString newAppName); /** * @brief Gets or sets the application version. */ - Q_PROPERTY(QString appVersion READ appVersion WRITE setAppVersion NOTIFY appVersionChanged) + QString appVersion() const; + /** + * @brief Gets or sets the application version. + */ + void setAppVersion(QString newAppVersion); /** * @brief Gets or sets the name of the device. */ - Q_PROPERTY(QString deviceName READ deviceName WRITE setDeviceName NOTIFY deviceNameChanged) + QString deviceName() const; + /** + * @brief Gets or sets the name of the device. + */ + void setDeviceName(QString newDeviceName); /** * @brief Gets or sets the user identifier. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets the user identifier. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets a value indicating whether this instance is active. */ - Q_PROPERTY(bool isActive READ isActive WRITE setIsActive NOTIFY isActiveChanged) + bool isActive() const; + /** + * @brief Gets or sets a value indicating whether this instance is active. + */ + void setIsActive(bool newIsActive); /** * @brief Gets or sets the date created. */ - Q_PROPERTY(QDateTime dateCreated READ dateCreated WRITE setDateCreated NOTIFY dateCreatedChanged) + QDateTime dateCreated() const; + /** + * @brief Gets or sets the date created. + */ + void setDateCreated(QDateTime newDateCreated); /** * @brief Gets or sets the date revoked. */ - Q_PROPERTY(QDateTime dateRevoked READ dateRevoked WRITE setDateRevoked NOTIFY dateRevokedChanged) - Q_PROPERTY(QDateTime dateLastActivity READ dateLastActivity WRITE setDateLastActivity NOTIFY dateLastActivityChanged) - Q_PROPERTY(QString userName READ userName WRITE setUserName NOTIFY userNameChanged) - - qint64 jellyfinId() const; - void setJellyfinId(qint64 newJellyfinId); - - QString accessToken() const; - void setAccessToken(QString newAccessToken); - - QString deviceId() const; - void setDeviceId(QString newDeviceId); - - QString appName() const; - void setAppName(QString newAppName); - - QString appVersion() const; - void setAppVersion(QString newAppVersion); - - QString deviceName() const; - void setDeviceName(QString newDeviceName); - - QString userId() const; - void setUserId(QString newUserId); - - bool isActive() const; - void setIsActive(bool newIsActive); - - QDateTime dateCreated() const; - void setDateCreated(QDateTime newDateCreated); - QDateTime dateRevoked() const; + /** + * @brief Gets or sets the date revoked. + */ void setDateRevoked(QDateTime newDateRevoked); - + QDateTime dateLastActivity() const; + void setDateLastActivity(QDateTime newDateLastActivity); - + QString userName() const; + void setUserName(QString newUserName); - -signals: - void jellyfinIdChanged(qint64 newJellyfinId); - void accessTokenChanged(QString newAccessToken); - void deviceIdChanged(QString newDeviceId); - void appNameChanged(QString newAppName); - void appVersionChanged(QString newAppVersion); - void deviceNameChanged(QString newDeviceName); - void userIdChanged(QString newUserId); - void isActiveChanged(bool newIsActive); - void dateCreatedChanged(QDateTime newDateCreated); - void dateRevokedChanged(QDateTime newDateRevoked); - void dateLastActivityChanged(QDateTime newDateLastActivity); - void userNameChanged(QString newUserName); + protected: qint64 m_jellyfinId; QString m_accessToken; @@ -145,7 +147,7 @@ protected: QString m_appName; QString m_appVersion; QString m_deviceName; - QString m_userId; + QUuid m_userId; bool m_isActive; QDateTime m_dateCreated; QDateTime m_dateRevoked; @@ -153,6 +155,18 @@ protected: QString m_userName; }; +} // NS DTO + +namespace Support { + +using AuthenticationInfo = Jellyfin::DTO::AuthenticationInfo; + +template <> +AuthenticationInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AuthenticationInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/authenticationinfoqueryresult.h b/core/include/JellyfinQt/DTO/authenticationinfoqueryresult.h index 381d592..0304649 100644 --- a/core/include/JellyfinQt/DTO/authenticationinfoqueryresult.h +++ b/core/include/JellyfinQt/DTO/authenticationinfoqueryresult.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_AUTHENTICATIONINFOQUERYRESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/authenticationinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class AuthenticationInfo; -class AuthenticationInfoQueryResult : public QObject { - Q_OBJECT +class AuthenticationInfoQueryResult { public: - explicit AuthenticationInfoQueryResult(QObject *parent = nullptr); - static AuthenticationInfoQueryResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit AuthenticationInfoQueryResult(); + static AuthenticationInfoQueryResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items. */ - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) + QList> items() const; + /** + * @brief Gets or sets the items. + */ + void setItems(QList> newItems); /** * @brief The total number of records available. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief The total number of records available. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief The index of the first record in Items. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) - - QList items() const; - void setItems(QList newItems); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - qint32 startIndex() const; + /** + * @brief The index of the first record in Items. + */ void setStartIndex(qint32 newStartIndex); - -signals: - void itemsChanged(QList newItems); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void startIndexChanged(qint32 newStartIndex); + protected: - QList m_items; + QList> m_items; qint32 m_totalRecordCount; qint32 m_startIndex; }; +} // NS DTO + +namespace Support { + +using AuthenticationInfoQueryResult = Jellyfin::DTO::AuthenticationInfoQueryResult; + +template <> +AuthenticationInfoQueryResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AuthenticationInfoQueryResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/authenticationresult.h b/core/include/JellyfinQt/DTO/authenticationresult.h index 9804036..9466266 100644 --- a/core/include/JellyfinQt/DTO/authenticationresult.h +++ b/core/include/JellyfinQt/DTO/authenticationresult.h @@ -31,52 +31,63 @@ #define JELLYFIN_DTO_AUTHENTICATIONRESULT_H #include -#include +#include +#include #include +#include + +#include "JellyfinQt/DTO/sessioninfo.h" +#include "JellyfinQt/DTO/userdto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SessionInfo; -class UserDto; -class AuthenticationResult : public QObject { - Q_OBJECT +class AuthenticationResult { public: - explicit AuthenticationResult(QObject *parent = nullptr); - static AuthenticationResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(UserDto * user READ user WRITE setUser NOTIFY userChanged) - Q_PROPERTY(SessionInfo * sessionInfo READ sessionInfo WRITE setSessionInfo NOTIFY sessionInfoChanged) - Q_PROPERTY(QString accessToken READ accessToken WRITE setAccessToken NOTIFY accessTokenChanged) - Q_PROPERTY(QString serverId READ serverId WRITE setServerId NOTIFY serverIdChanged) - - UserDto * user() const; - void setUser(UserDto * newUser); - - SessionInfo * sessionInfo() const; - void setSessionInfo(SessionInfo * newSessionInfo); + explicit AuthenticationResult(); + static AuthenticationResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + // Properties + + QSharedPointer user() const; + + void setUser(QSharedPointer newUser); + + QSharedPointer sessionInfo() const; + + void setSessionInfo(QSharedPointer newSessionInfo); + QString accessToken() const; + void setAccessToken(QString newAccessToken); - + QString serverId() const; + void setServerId(QString newServerId); - -signals: - void userChanged(UserDto * newUser); - void sessionInfoChanged(SessionInfo * newSessionInfo); - void accessTokenChanged(QString newAccessToken); - void serverIdChanged(QString newServerId); + protected: - UserDto * m_user = nullptr; - SessionInfo * m_sessionInfo = nullptr; + QSharedPointer m_user = nullptr; + QSharedPointer m_sessionInfo = nullptr; QString m_accessToken; QString m_serverId; }; +} // NS DTO + +namespace Support { + +using AuthenticationResult = Jellyfin::DTO::AuthenticationResult; + +template <> +AuthenticationResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return AuthenticationResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/baseitem.h b/core/include/JellyfinQt/DTO/baseitem.h index 46c1c65..64c329d 100644 --- a/core/include/JellyfinQt/DTO/baseitem.h +++ b/core/include/JellyfinQt/DTO/baseitem.h @@ -32,98 +32,104 @@ #include #include +#include #include -#include +#include #include #include +#include +#include + +#include "JellyfinQt/DTO/mediaurl.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaUrl; -class BaseItem : public QObject { - Q_OBJECT +class BaseItem { public: - explicit BaseItem(QObject *parent = nullptr); - static BaseItem *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit BaseItem(); + static BaseItem fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(qint64 size READ size WRITE setSize NOTIFY sizeChanged) - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) - Q_PROPERTY(QDateTime dateLastSaved READ dateLastSaved WRITE setDateLastSaved NOTIFY dateLastSavedChanged) + qint64 size() const; + + void setSize(qint64 newSize); + + QString container() const; + + void setContainer(QString newContainer); + + QDateTime dateLastSaved() const; + + void setDateLastSaved(QDateTime newDateLastSaved); /** * @brief Gets or sets the remote trailers. */ - Q_PROPERTY(QList remoteTrailers READ remoteTrailers WRITE setRemoteTrailers NOTIFY remoteTrailersChanged) - Q_PROPERTY(bool isHD READ isHD WRITE setIsHD NOTIFY isHDChanged) - Q_PROPERTY(bool isShortcut READ isShortcut WRITE setIsShortcut NOTIFY isShortcutChanged) - Q_PROPERTY(QString shortcutPath READ shortcutPath WRITE setShortcutPath NOTIFY shortcutPathChanged) - Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged) - Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(QStringList extraIds READ extraIds WRITE setExtraIds NOTIFY extraIdsChanged) - Q_PROPERTY(bool supportsExternalTransfer READ supportsExternalTransfer WRITE setSupportsExternalTransfer NOTIFY supportsExternalTransferChanged) + QList> remoteTrailers() const; + /** + * @brief Gets or sets the remote trailers. + */ + void setRemoteTrailers(QList> newRemoteTrailers); - qint64 size() const; - void setSize(qint64 newSize); - - QString container() const; - void setContainer(QString newContainer); - - QDateTime dateLastSaved() const; - void setDateLastSaved(QDateTime newDateLastSaved); - - QList remoteTrailers() const; - void setRemoteTrailers(QList newRemoteTrailers); - bool isHD() const; + void setIsHD(bool newIsHD); - + bool isShortcut() const; + void setIsShortcut(bool newIsShortcut); - + QString shortcutPath() const; + void setShortcutPath(QString newShortcutPath); - + qint32 width() const; + void setWidth(qint32 newWidth); - + qint32 height() const; + void setHeight(qint32 newHeight); - - QStringList extraIds() const; - void setExtraIds(QStringList newExtraIds); - + + QList extraIds() const; + + void setExtraIds(QList newExtraIds); + bool supportsExternalTransfer() const; + void setSupportsExternalTransfer(bool newSupportsExternalTransfer); - -signals: - void sizeChanged(qint64 newSize); - void containerChanged(QString newContainer); - void dateLastSavedChanged(QDateTime newDateLastSaved); - void remoteTrailersChanged(QList newRemoteTrailers); - void isHDChanged(bool newIsHD); - void isShortcutChanged(bool newIsShortcut); - void shortcutPathChanged(QString newShortcutPath); - void widthChanged(qint32 newWidth); - void heightChanged(qint32 newHeight); - void extraIdsChanged(QStringList newExtraIds); - void supportsExternalTransferChanged(bool newSupportsExternalTransfer); + protected: qint64 m_size; QString m_container; QDateTime m_dateLastSaved; - QList m_remoteTrailers; + QList> m_remoteTrailers; bool m_isHD; bool m_isShortcut; QString m_shortcutPath; qint32 m_width; qint32 m_height; - QStringList m_extraIds; + QList m_extraIds; bool m_supportsExternalTransfer; }; +} // NS DTO + +namespace Support { + +using BaseItem = Jellyfin::DTO::BaseItem; + +template <> +BaseItem fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BaseItem::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/baseitemdto.h b/core/include/JellyfinQt/DTO/baseitemdto.h index e33fb93..805e17b 100644 --- a/core/include/JellyfinQt/DTO/baseitemdto.h +++ b/core/include/JellyfinQt/DTO/baseitemdto.h @@ -32,1129 +32,1086 @@ #include #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/baseitemperson.h" #include "JellyfinQt/DTO/channeltype.h" +#include "JellyfinQt/DTO/chapterinfo.h" #include "JellyfinQt/DTO/dayofweek.h" +#include "JellyfinQt/DTO/externalurl.h" #include "JellyfinQt/DTO/imageorientation.h" #include "JellyfinQt/DTO/isotype.h" #include "JellyfinQt/DTO/locationtype.h" +#include "JellyfinQt/DTO/mediasourceinfo.h" +#include "JellyfinQt/DTO/mediastream.h" +#include "JellyfinQt/DTO/mediaurl.h" #include "JellyfinQt/DTO/metadatafield.h" +#include "JellyfinQt/DTO/nameguidpair.h" #include "JellyfinQt/DTO/playaccess.h" #include "JellyfinQt/DTO/programaudio.h" +#include "JellyfinQt/DTO/useritemdatadto.h" #include "JellyfinQt/DTO/video3dformat.h" #include "JellyfinQt/DTO/videotype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemPerson; -class ChapterInfo; -class ExternalUrl; -class MediaSourceInfo; -class MediaStream; -class MediaUrl; -class NameGuidPair; -class NameGuidPair; -class NameGuidPair; -class NameGuidPair; -class UserItemDataDto; -class BaseItemDto : public QObject { - Q_OBJECT +class BaseItemDto { public: - explicit BaseItemDto(QObject *parent = nullptr); - static BaseItemDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit BaseItemDto(); + static BaseItemDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString originalTitle READ originalTitle WRITE setOriginalTitle NOTIFY originalTitleChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); + + QString originalTitle() const; + + void setOriginalTitle(QString newOriginalTitle); /** * @brief Gets or sets the server identifier. */ - Q_PROPERTY(QString serverId READ serverId WRITE setServerId NOTIFY serverIdChanged) + QString serverId() const; + /** + * @brief Gets or sets the server identifier. + */ + void setServerId(QString newServerId); /** * @brief Gets or sets the id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QUuid jellyfinId() const; + /** + * @brief Gets or sets the id. + */ + void setJellyfinId(QUuid newJellyfinId); /** * @brief Gets or sets the etag. */ - Q_PROPERTY(QString etag READ etag WRITE setEtag NOTIFY etagChanged) + QString etag() const; + /** + * @brief Gets or sets the etag. + */ + void setEtag(QString newEtag); /** * @brief Gets or sets the type of the source. */ - Q_PROPERTY(QString sourceType READ sourceType WRITE setSourceType NOTIFY sourceTypeChanged) + QString sourceType() const; + /** + * @brief Gets or sets the type of the source. + */ + void setSourceType(QString newSourceType); /** * @brief Gets or sets the playlist item identifier. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QString playlistItemId() const; + /** + * @brief Gets or sets the playlist item identifier. + */ + void setPlaylistItemId(QString newPlaylistItemId); /** * @brief Gets or sets the date created. */ - Q_PROPERTY(QDateTime dateCreated READ dateCreated WRITE setDateCreated NOTIFY dateCreatedChanged) - Q_PROPERTY(QDateTime dateLastMediaAdded READ dateLastMediaAdded WRITE setDateLastMediaAdded NOTIFY dateLastMediaAddedChanged) - Q_PROPERTY(QString extraType READ extraType WRITE setExtraType NOTIFY extraTypeChanged) - Q_PROPERTY(qint32 airsBeforeSeasonNumber READ airsBeforeSeasonNumber WRITE setAirsBeforeSeasonNumber NOTIFY airsBeforeSeasonNumberChanged) - Q_PROPERTY(qint32 airsAfterSeasonNumber READ airsAfterSeasonNumber WRITE setAirsAfterSeasonNumber NOTIFY airsAfterSeasonNumberChanged) - Q_PROPERTY(qint32 airsBeforeEpisodeNumber READ airsBeforeEpisodeNumber WRITE setAirsBeforeEpisodeNumber NOTIFY airsBeforeEpisodeNumberChanged) - Q_PROPERTY(bool canDelete READ canDelete WRITE setCanDelete NOTIFY canDeleteChanged) - Q_PROPERTY(bool canDownload READ canDownload WRITE setCanDownload NOTIFY canDownloadChanged) - Q_PROPERTY(bool hasSubtitles READ hasSubtitles WRITE setHasSubtitles NOTIFY hasSubtitlesChanged) - Q_PROPERTY(QString preferredMetadataLanguage READ preferredMetadataLanguage WRITE setPreferredMetadataLanguage NOTIFY preferredMetadataLanguageChanged) - Q_PROPERTY(QString preferredMetadataCountryCode READ preferredMetadataCountryCode WRITE setPreferredMetadataCountryCode NOTIFY preferredMetadataCountryCodeChanged) + QDateTime dateCreated() const; + /** + * @brief Gets or sets the date created. + */ + void setDateCreated(QDateTime newDateCreated); + + QDateTime dateLastMediaAdded() const; + + void setDateLastMediaAdded(QDateTime newDateLastMediaAdded); + + QString extraType() const; + + void setExtraType(QString newExtraType); + + qint32 airsBeforeSeasonNumber() const; + + void setAirsBeforeSeasonNumber(qint32 newAirsBeforeSeasonNumber); + + qint32 airsAfterSeasonNumber() const; + + void setAirsAfterSeasonNumber(qint32 newAirsAfterSeasonNumber); + + qint32 airsBeforeEpisodeNumber() const; + + void setAirsBeforeEpisodeNumber(qint32 newAirsBeforeEpisodeNumber); + + bool canDelete() const; + + void setCanDelete(bool newCanDelete); + + bool canDownload() const; + + void setCanDownload(bool newCanDownload); + + bool hasSubtitles() const; + + void setHasSubtitles(bool newHasSubtitles); + + QString preferredMetadataLanguage() const; + + void setPreferredMetadataLanguage(QString newPreferredMetadataLanguage); + + QString preferredMetadataCountryCode() const; + + void setPreferredMetadataCountryCode(QString newPreferredMetadataCountryCode); /** * @brief Gets or sets a value indicating whether [supports synchronize]. */ - Q_PROPERTY(bool supportsSync READ supportsSync WRITE setSupportsSync NOTIFY supportsSyncChanged) - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) + bool supportsSync() const; + /** + * @brief Gets or sets a value indicating whether [supports synchronize]. + */ + void setSupportsSync(bool newSupportsSync); + + QString container() const; + + void setContainer(QString newContainer); /** * @brief Gets or sets the name of the sort. */ - Q_PROPERTY(QString sortName READ sortName WRITE setSortName NOTIFY sortNameChanged) - Q_PROPERTY(QString forcedSortName READ forcedSortName WRITE setForcedSortName NOTIFY forcedSortNameChanged) - Q_PROPERTY(Video3DFormat video3DFormat READ video3DFormat WRITE setVideo3DFormat NOTIFY video3DFormatChanged) + QString sortName() const; + /** + * @brief Gets or sets the name of the sort. + */ + void setSortName(QString newSortName); + + QString forcedSortName() const; + + void setForcedSortName(QString newForcedSortName); + + Video3DFormat video3DFormat() const; + + void setVideo3DFormat(Video3DFormat newVideo3DFormat); /** * @brief Gets or sets the premiere date. */ - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) + QDateTime premiereDate() const; + /** + * @brief Gets or sets the premiere date. + */ + void setPremiereDate(QDateTime newPremiereDate); /** * @brief Gets or sets the external urls. */ - Q_PROPERTY(QList externalUrls READ externalUrls WRITE setExternalUrls NOTIFY externalUrlsChanged) + QList> externalUrls() const; + /** + * @brief Gets or sets the external urls. + */ + void setExternalUrls(QList> newExternalUrls); /** * @brief Gets or sets the media versions. */ - Q_PROPERTY(QList mediaSources READ mediaSources WRITE setMediaSources NOTIFY mediaSourcesChanged) + QList> mediaSources() const; + /** + * @brief Gets or sets the media versions. + */ + void setMediaSources(QList> newMediaSources); /** * @brief Gets or sets the critic rating. */ - Q_PROPERTY(float criticRating READ criticRating WRITE setCriticRating NOTIFY criticRatingChanged) - Q_PROPERTY(QStringList productionLocations READ productionLocations WRITE setProductionLocations NOTIFY productionLocationsChanged) + float criticRating() const; + /** + * @brief Gets or sets the critic rating. + */ + void setCriticRating(float newCriticRating); + + QStringList productionLocations() const; + + void setProductionLocations(QStringList newProductionLocations); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(bool enableMediaSourceDisplay READ enableMediaSourceDisplay WRITE setEnableMediaSourceDisplay NOTIFY enableMediaSourceDisplayChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); + + bool enableMediaSourceDisplay() const; + + void setEnableMediaSourceDisplay(bool newEnableMediaSourceDisplay); /** * @brief Gets or sets the official rating. */ - Q_PROPERTY(QString officialRating READ officialRating WRITE setOfficialRating NOTIFY officialRatingChanged) + QString officialRating() const; + /** + * @brief Gets or sets the official rating. + */ + void setOfficialRating(QString newOfficialRating); /** * @brief Gets or sets the custom rating. */ - Q_PROPERTY(QString customRating READ customRating WRITE setCustomRating NOTIFY customRatingChanged) + QString customRating() const; + /** + * @brief Gets or sets the custom rating. + */ + void setCustomRating(QString newCustomRating); /** * @brief Gets or sets the channel identifier. */ - Q_PROPERTY(QString channelId READ channelId WRITE setChannelId NOTIFY channelIdChanged) - Q_PROPERTY(QString channelName READ channelName WRITE setChannelName NOTIFY channelNameChanged) + QUuid channelId() const; + /** + * @brief Gets or sets the channel identifier. + */ + void setChannelId(QUuid newChannelId); + + QString channelName() const; + + void setChannelName(QString newChannelName); /** * @brief Gets or sets the overview. */ - Q_PROPERTY(QString overview READ overview WRITE setOverview NOTIFY overviewChanged) + QString overview() const; + /** + * @brief Gets or sets the overview. + */ + void setOverview(QString newOverview); /** * @brief Gets or sets the taglines. */ - Q_PROPERTY(QStringList taglines READ taglines WRITE setTaglines NOTIFY taglinesChanged) + QStringList taglines() const; + /** + * @brief Gets or sets the taglines. + */ + void setTaglines(QStringList newTaglines); /** * @brief Gets or sets the genres. */ - Q_PROPERTY(QStringList genres READ genres WRITE setGenres NOTIFY genresChanged) + QStringList genres() const; + /** + * @brief Gets or sets the genres. + */ + void setGenres(QStringList newGenres); /** * @brief Gets or sets the community rating. */ - Q_PROPERTY(float communityRating READ communityRating WRITE setCommunityRating NOTIFY communityRatingChanged) + float communityRating() const; + /** + * @brief Gets or sets the community rating. + */ + void setCommunityRating(float newCommunityRating); /** * @brief Gets or sets the cumulative run time ticks. */ - Q_PROPERTY(qint64 cumulativeRunTimeTicks READ cumulativeRunTimeTicks WRITE setCumulativeRunTimeTicks NOTIFY cumulativeRunTimeTicksChanged) + qint64 cumulativeRunTimeTicks() const; + /** + * @brief Gets or sets the cumulative run time ticks. + */ + void setCumulativeRunTimeTicks(qint64 newCumulativeRunTimeTicks); /** * @brief Gets or sets the run time ticks. */ - Q_PROPERTY(qint64 runTimeTicks READ runTimeTicks WRITE setRunTimeTicks NOTIFY runTimeTicksChanged) - Q_PROPERTY(PlayAccess playAccess READ playAccess WRITE setPlayAccess NOTIFY playAccessChanged) + qint64 runTimeTicks() const; + /** + * @brief Gets or sets the run time ticks. + */ + void setRunTimeTicks(qint64 newRunTimeTicks); + + PlayAccess playAccess() const; + + void setPlayAccess(PlayAccess newPlayAccess); /** * @brief Gets or sets the aspect ratio. */ - Q_PROPERTY(QString aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged) + QString aspectRatio() const; + /** + * @brief Gets or sets the aspect ratio. + */ + void setAspectRatio(QString newAspectRatio); /** * @brief Gets or sets the production year. */ - Q_PROPERTY(qint32 productionYear READ productionYear WRITE setProductionYear NOTIFY productionYearChanged) + qint32 productionYear() const; + /** + * @brief Gets or sets the production year. + */ + void setProductionYear(qint32 newProductionYear); /** * @brief Gets or sets a value indicating whether this instance is place holder. */ - Q_PROPERTY(bool isPlaceHolder READ isPlaceHolder WRITE setIsPlaceHolder NOTIFY isPlaceHolderChanged) + bool isPlaceHolder() const; + /** + * @brief Gets or sets a value indicating whether this instance is place holder. + */ + void setIsPlaceHolder(bool newIsPlaceHolder); /** * @brief Gets or sets the number. */ - Q_PROPERTY(QString number READ number WRITE setNumber NOTIFY numberChanged) - Q_PROPERTY(QString channelNumber READ channelNumber WRITE setChannelNumber NOTIFY channelNumberChanged) + QString number() const; + /** + * @brief Gets or sets the number. + */ + void setNumber(QString newNumber); + + QString channelNumber() const; + + void setChannelNumber(QString newChannelNumber); /** * @brief Gets or sets the index number. */ - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) + qint32 indexNumber() const; + /** + * @brief Gets or sets the index number. + */ + void setIndexNumber(qint32 newIndexNumber); /** * @brief Gets or sets the index number end. */ - Q_PROPERTY(qint32 indexNumberEnd READ indexNumberEnd WRITE setIndexNumberEnd NOTIFY indexNumberEndChanged) + qint32 indexNumberEnd() const; + /** + * @brief Gets or sets the index number end. + */ + void setIndexNumberEnd(qint32 newIndexNumberEnd); /** * @brief Gets or sets the parent index number. */ - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) + qint32 parentIndexNumber() const; + /** + * @brief Gets or sets the parent index number. + */ + void setParentIndexNumber(qint32 newParentIndexNumber); /** * @brief Gets or sets the trailer urls. */ - Q_PROPERTY(QList remoteTrailers READ remoteTrailers WRITE setRemoteTrailers NOTIFY remoteTrailersChanged) + QList> remoteTrailers() const; + /** + * @brief Gets or sets the trailer urls. + */ + void setRemoteTrailers(QList> newRemoteTrailers); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets a value indicating whether this instance is HD. */ - Q_PROPERTY(bool isHD READ isHD WRITE setIsHD NOTIFY isHDChanged) + bool isHD() const; + /** + * @brief Gets or sets a value indicating whether this instance is HD. + */ + void setIsHD(bool newIsHD); /** * @brief Gets or sets a value indicating whether this instance is folder. */ - Q_PROPERTY(bool isFolder READ isFolder WRITE setIsFolder NOTIFY isFolderChanged) + bool isFolder() const; + /** + * @brief Gets or sets a value indicating whether this instance is folder. + */ + void setIsFolder(bool newIsFolder); /** * @brief Gets or sets the parent id. */ - Q_PROPERTY(QString parentId READ parentId WRITE setParentId NOTIFY parentIdChanged) + QUuid parentId() const; + /** + * @brief Gets or sets the parent id. + */ + void setParentId(QUuid newParentId); /** * @brief Gets or sets the type. */ - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + QString type() const; + /** + * @brief Gets or sets the type. + */ + void setType(QString newType); /** * @brief Gets or sets the people. */ - Q_PROPERTY(QList people READ people WRITE setPeople NOTIFY peopleChanged) + QList> people() const; + /** + * @brief Gets or sets the people. + */ + void setPeople(QList> newPeople); /** * @brief Gets or sets the studios. */ - Q_PROPERTY(QList studios READ studios WRITE setStudios NOTIFY studiosChanged) - Q_PROPERTY(QList genreItems READ genreItems WRITE setGenreItems NOTIFY genreItemsChanged) + QList> studios() const; + /** + * @brief Gets or sets the studios. + */ + void setStudios(QList> newStudios); + + QList> genreItems() const; + + void setGenreItems(QList> newGenreItems); /** * @brief If the item does not have a logo, this will hold the Id of the Parent that has one. */ - Q_PROPERTY(QString parentLogoItemId READ parentLogoItemId WRITE setParentLogoItemId NOTIFY parentLogoItemIdChanged) + QString parentLogoItemId() const; + /** + * @brief If the item does not have a logo, this will hold the Id of the Parent that has one. + */ + void setParentLogoItemId(QString newParentLogoItemId); /** * @brief If the item does not have any backdrops, this will hold the Id of the Parent that has one. */ - Q_PROPERTY(QString parentBackdropItemId READ parentBackdropItemId WRITE setParentBackdropItemId NOTIFY parentBackdropItemIdChanged) + QString parentBackdropItemId() const; + /** + * @brief If the item does not have any backdrops, this will hold the Id of the Parent that has one. + */ + void setParentBackdropItemId(QString newParentBackdropItemId); /** * @brief Gets or sets the parent backdrop image tags. */ - Q_PROPERTY(QStringList parentBackdropImageTags READ parentBackdropImageTags WRITE setParentBackdropImageTags NOTIFY parentBackdropImageTagsChanged) + QStringList parentBackdropImageTags() const; + /** + * @brief Gets or sets the parent backdrop image tags. + */ + void setParentBackdropImageTags(QStringList newParentBackdropImageTags); /** * @brief Gets or sets the local trailer count. */ - Q_PROPERTY(qint32 localTrailerCount READ localTrailerCount WRITE setLocalTrailerCount NOTIFY localTrailerCountChanged) - Q_PROPERTY(UserItemDataDto * userData READ userData WRITE setUserData NOTIFY userDataChanged) + qint32 localTrailerCount() const; + /** + * @brief Gets or sets the local trailer count. + */ + void setLocalTrailerCount(qint32 newLocalTrailerCount); + + QSharedPointer userData() const; + + void setUserData(QSharedPointer newUserData); /** * @brief Gets or sets the recursive item count. */ - Q_PROPERTY(qint32 recursiveItemCount READ recursiveItemCount WRITE setRecursiveItemCount NOTIFY recursiveItemCountChanged) + qint32 recursiveItemCount() const; + /** + * @brief Gets or sets the recursive item count. + */ + void setRecursiveItemCount(qint32 newRecursiveItemCount); /** * @brief Gets or sets the child count. */ - Q_PROPERTY(qint32 childCount READ childCount WRITE setChildCount NOTIFY childCountChanged) + qint32 childCount() const; + /** + * @brief Gets or sets the child count. + */ + void setChildCount(qint32 newChildCount); /** * @brief Gets or sets the name of the series. */ - Q_PROPERTY(QString seriesName READ seriesName WRITE setSeriesName NOTIFY seriesNameChanged) + QString seriesName() const; + /** + * @brief Gets or sets the name of the series. + */ + void setSeriesName(QString newSeriesName); /** * @brief Gets or sets the series id. */ - Q_PROPERTY(QString seriesId READ seriesId WRITE setSeriesId NOTIFY seriesIdChanged) + QUuid seriesId() const; + /** + * @brief Gets or sets the series id. + */ + void setSeriesId(QUuid newSeriesId); /** * @brief Gets or sets the season identifier. */ - Q_PROPERTY(QString seasonId READ seasonId WRITE setSeasonId NOTIFY seasonIdChanged) + QUuid seasonId() const; + /** + * @brief Gets or sets the season identifier. + */ + void setSeasonId(QUuid newSeasonId); /** * @brief Gets or sets the special feature count. */ - Q_PROPERTY(qint32 specialFeatureCount READ specialFeatureCount WRITE setSpecialFeatureCount NOTIFY specialFeatureCountChanged) + qint32 specialFeatureCount() const; + /** + * @brief Gets or sets the special feature count. + */ + void setSpecialFeatureCount(qint32 newSpecialFeatureCount); /** * @brief Gets or sets the display preferences id. */ - Q_PROPERTY(QString displayPreferencesId READ displayPreferencesId WRITE setDisplayPreferencesId NOTIFY displayPreferencesIdChanged) + QString displayPreferencesId() const; + /** + * @brief Gets or sets the display preferences id. + */ + void setDisplayPreferencesId(QString newDisplayPreferencesId); /** * @brief Gets or sets the status. */ - Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged) + QString status() const; + /** + * @brief Gets or sets the status. + */ + void setStatus(QString newStatus); /** * @brief Gets or sets the air time. */ - Q_PROPERTY(QString airTime READ airTime WRITE setAirTime NOTIFY airTimeChanged) + QString airTime() const; + /** + * @brief Gets or sets the air time. + */ + void setAirTime(QString newAirTime); /** * @brief Gets or sets the air days. */ - Q_PROPERTY(QList airDays READ airDays WRITE setAirDays NOTIFY airDaysChanged) + QList airDays() const; + /** + * @brief Gets or sets the air days. + */ + void setAirDays(QList newAirDays); /** * @brief Gets or sets the tags. */ - Q_PROPERTY(QStringList tags READ tags WRITE setTags NOTIFY tagsChanged) + QStringList tags() const; + /** + * @brief Gets or sets the tags. + */ + void setTags(QStringList newTags); /** * @brief Gets or sets the primary image aspect ratio, after image enhancements. */ - Q_PROPERTY(double primaryImageAspectRatio READ primaryImageAspectRatio WRITE setPrimaryImageAspectRatio NOTIFY primaryImageAspectRatioChanged) + double primaryImageAspectRatio() const; + /** + * @brief Gets or sets the primary image aspect ratio, after image enhancements. + */ + void setPrimaryImageAspectRatio(double newPrimaryImageAspectRatio); /** * @brief Gets or sets the artists. */ - Q_PROPERTY(QStringList artists READ artists WRITE setArtists NOTIFY artistsChanged) + QStringList artists() const; + /** + * @brief Gets or sets the artists. + */ + void setArtists(QStringList newArtists); /** * @brief Gets or sets the artist items. */ - Q_PROPERTY(QList artistItems READ artistItems WRITE setArtistItems NOTIFY artistItemsChanged) + QList> artistItems() const; + /** + * @brief Gets or sets the artist items. + */ + void setArtistItems(QList> newArtistItems); /** * @brief Gets or sets the album. */ - Q_PROPERTY(QString album READ album WRITE setAlbum NOTIFY albumChanged) + QString album() const; + /** + * @brief Gets or sets the album. + */ + void setAlbum(QString newAlbum); /** * @brief Gets or sets the type of the collection. */ - Q_PROPERTY(QString collectionType READ collectionType WRITE setCollectionType NOTIFY collectionTypeChanged) + QString collectionType() const; + /** + * @brief Gets or sets the type of the collection. + */ + void setCollectionType(QString newCollectionType); /** * @brief Gets or sets the display order. */ - Q_PROPERTY(QString displayOrder READ displayOrder WRITE setDisplayOrder NOTIFY displayOrderChanged) + QString displayOrder() const; + /** + * @brief Gets or sets the display order. + */ + void setDisplayOrder(QString newDisplayOrder); /** * @brief Gets or sets the album id. */ - Q_PROPERTY(QString albumId READ albumId WRITE setAlbumId NOTIFY albumIdChanged) + QUuid albumId() const; + /** + * @brief Gets or sets the album id. + */ + void setAlbumId(QUuid newAlbumId); /** * @brief Gets or sets the album image tag. */ - Q_PROPERTY(QString albumPrimaryImageTag READ albumPrimaryImageTag WRITE setAlbumPrimaryImageTag NOTIFY albumPrimaryImageTagChanged) + QString albumPrimaryImageTag() const; + /** + * @brief Gets or sets the album image tag. + */ + void setAlbumPrimaryImageTag(QString newAlbumPrimaryImageTag); /** * @brief Gets or sets the series primary image tag. */ - Q_PROPERTY(QString seriesPrimaryImageTag READ seriesPrimaryImageTag WRITE setSeriesPrimaryImageTag NOTIFY seriesPrimaryImageTagChanged) + QString seriesPrimaryImageTag() const; + /** + * @brief Gets or sets the series primary image tag. + */ + void setSeriesPrimaryImageTag(QString newSeriesPrimaryImageTag); /** * @brief Gets or sets the album artist. */ - Q_PROPERTY(QString albumArtist READ albumArtist WRITE setAlbumArtist NOTIFY albumArtistChanged) + QString albumArtist() const; + /** + * @brief Gets or sets the album artist. + */ + void setAlbumArtist(QString newAlbumArtist); /** * @brief Gets or sets the album artists. */ - Q_PROPERTY(QList albumArtists READ albumArtists WRITE setAlbumArtists NOTIFY albumArtistsChanged) + QList> albumArtists() const; + /** + * @brief Gets or sets the album artists. + */ + void setAlbumArtists(QList> newAlbumArtists); /** * @brief Gets or sets the name of the season. */ - Q_PROPERTY(QString seasonName READ seasonName WRITE setSeasonName NOTIFY seasonNameChanged) + QString seasonName() const; + /** + * @brief Gets or sets the name of the season. + */ + void setSeasonName(QString newSeasonName); /** * @brief Gets or sets the media streams. */ - Q_PROPERTY(QList mediaStreams READ mediaStreams WRITE setMediaStreams NOTIFY mediaStreamsChanged) - Q_PROPERTY(VideoType videoType READ videoType WRITE setVideoType NOTIFY videoTypeChanged) + QList> mediaStreams() const; + /** + * @brief Gets or sets the media streams. + */ + void setMediaStreams(QList> newMediaStreams); + + VideoType videoType() const; + + void setVideoType(VideoType newVideoType); /** * @brief Gets or sets the part count. */ - Q_PROPERTY(qint32 partCount READ partCount WRITE setPartCount NOTIFY partCountChanged) - Q_PROPERTY(qint32 mediaSourceCount READ mediaSourceCount WRITE setMediaSourceCount NOTIFY mediaSourceCountChanged) + qint32 partCount() const; + /** + * @brief Gets or sets the part count. + */ + void setPartCount(qint32 newPartCount); + + qint32 mediaSourceCount() const; + + void setMediaSourceCount(qint32 newMediaSourceCount); /** * @brief Gets or sets the image tags. */ - Q_PROPERTY(QJsonObject imageTags READ imageTags WRITE setImageTags NOTIFY imageTagsChanged) + QJsonObject imageTags() const; + /** + * @brief Gets or sets the image tags. + */ + void setImageTags(QJsonObject newImageTags); /** * @brief Gets or sets the backdrop image tags. */ - Q_PROPERTY(QStringList backdropImageTags READ backdropImageTags WRITE setBackdropImageTags NOTIFY backdropImageTagsChanged) + QStringList backdropImageTags() const; + /** + * @brief Gets or sets the backdrop image tags. + */ + void setBackdropImageTags(QStringList newBackdropImageTags); /** * @brief Gets or sets the screenshot image tags. */ - Q_PROPERTY(QStringList screenshotImageTags READ screenshotImageTags WRITE setScreenshotImageTags NOTIFY screenshotImageTagsChanged) + QStringList screenshotImageTags() const; + /** + * @brief Gets or sets the screenshot image tags. + */ + void setScreenshotImageTags(QStringList newScreenshotImageTags); /** * @brief Gets or sets the parent logo image tag. */ - Q_PROPERTY(QString parentLogoImageTag READ parentLogoImageTag WRITE setParentLogoImageTag NOTIFY parentLogoImageTagChanged) + QString parentLogoImageTag() const; + /** + * @brief Gets or sets the parent logo image tag. + */ + void setParentLogoImageTag(QString newParentLogoImageTag); /** * @brief If the item does not have a art, this will hold the Id of the Parent that has one. */ - Q_PROPERTY(QString parentArtItemId READ parentArtItemId WRITE setParentArtItemId NOTIFY parentArtItemIdChanged) + QString parentArtItemId() const; + /** + * @brief If the item does not have a art, this will hold the Id of the Parent that has one. + */ + void setParentArtItemId(QString newParentArtItemId); /** * @brief Gets or sets the parent art image tag. */ - Q_PROPERTY(QString parentArtImageTag READ parentArtImageTag WRITE setParentArtImageTag NOTIFY parentArtImageTagChanged) + QString parentArtImageTag() const; + /** + * @brief Gets or sets the parent art image tag. + */ + void setParentArtImageTag(QString newParentArtImageTag); /** * @brief Gets or sets the series thumb image tag. */ - Q_PROPERTY(QString seriesThumbImageTag READ seriesThumbImageTag WRITE setSeriesThumbImageTag NOTIFY seriesThumbImageTagChanged) + QString seriesThumbImageTag() const; + /** + * @brief Gets or sets the series thumb image tag. + */ + void setSeriesThumbImageTag(QString newSeriesThumbImageTag); /** * @brief Gets or sets the blurhashes for the image tags. Maps image type to dictionary mapping image tag to blurhash value. */ - Q_PROPERTY(QJsonObject imageBlurHashes READ imageBlurHashes WRITE setImageBlurHashes NOTIFY imageBlurHashesChanged) + QJsonObject imageBlurHashes() const; + /** + * @brief Gets or sets the blurhashes for the image tags. +Maps image type to dictionary mapping image tag to blurhash value. + */ + void setImageBlurHashes(QJsonObject newImageBlurHashes); /** * @brief Gets or sets the series studio. */ - Q_PROPERTY(QString seriesStudio READ seriesStudio WRITE setSeriesStudio NOTIFY seriesStudioChanged) + QString seriesStudio() const; + /** + * @brief Gets or sets the series studio. + */ + void setSeriesStudio(QString newSeriesStudio); /** * @brief Gets or sets the parent thumb item id. */ - Q_PROPERTY(QString parentThumbItemId READ parentThumbItemId WRITE setParentThumbItemId NOTIFY parentThumbItemIdChanged) + QString parentThumbItemId() const; + /** + * @brief Gets or sets the parent thumb item id. + */ + void setParentThumbItemId(QString newParentThumbItemId); /** * @brief Gets or sets the parent thumb image tag. */ - Q_PROPERTY(QString parentThumbImageTag READ parentThumbImageTag WRITE setParentThumbImageTag NOTIFY parentThumbImageTagChanged) + QString parentThumbImageTag() const; + /** + * @brief Gets or sets the parent thumb image tag. + */ + void setParentThumbImageTag(QString newParentThumbImageTag); /** * @brief Gets or sets the parent primary image item identifier. */ - Q_PROPERTY(QString parentPrimaryImageItemId READ parentPrimaryImageItemId WRITE setParentPrimaryImageItemId NOTIFY parentPrimaryImageItemIdChanged) + QString parentPrimaryImageItemId() const; + /** + * @brief Gets or sets the parent primary image item identifier. + */ + void setParentPrimaryImageItemId(QString newParentPrimaryImageItemId); /** * @brief Gets or sets the parent primary image tag. */ - Q_PROPERTY(QString parentPrimaryImageTag READ parentPrimaryImageTag WRITE setParentPrimaryImageTag NOTIFY parentPrimaryImageTagChanged) + QString parentPrimaryImageTag() const; + /** + * @brief Gets or sets the parent primary image tag. + */ + void setParentPrimaryImageTag(QString newParentPrimaryImageTag); /** * @brief Gets or sets the chapters. */ - Q_PROPERTY(QList chapters READ chapters WRITE setChapters NOTIFY chaptersChanged) - Q_PROPERTY(LocationType locationType READ locationType WRITE setLocationType NOTIFY locationTypeChanged) - Q_PROPERTY(IsoType isoType READ isoType WRITE setIsoType NOTIFY isoTypeChanged) + QList> chapters() const; + /** + * @brief Gets or sets the chapters. + */ + void setChapters(QList> newChapters); + + LocationType locationType() const; + + void setLocationType(LocationType newLocationType); + + IsoType isoType() const; + + void setIsoType(IsoType newIsoType); /** * @brief Gets or sets the type of the media. */ - Q_PROPERTY(QString mediaType READ mediaType WRITE setMediaType NOTIFY mediaTypeChanged) + QString mediaType() const; + /** + * @brief Gets or sets the type of the media. + */ + void setMediaType(QString newMediaType); /** * @brief Gets or sets the end date. */ - Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged) + QDateTime endDate() const; + /** + * @brief Gets or sets the end date. + */ + void setEndDate(QDateTime newEndDate); /** * @brief Gets or sets the locked fields. */ - Q_PROPERTY(QList lockedFields READ lockedFields WRITE setLockedFields NOTIFY lockedFieldsChanged) + QList lockedFields() const; + /** + * @brief Gets or sets the locked fields. + */ + void setLockedFields(QList newLockedFields); /** * @brief Gets or sets the trailer count. */ - Q_PROPERTY(qint32 trailerCount READ trailerCount WRITE setTrailerCount NOTIFY trailerCountChanged) + qint32 trailerCount() const; + /** + * @brief Gets or sets the trailer count. + */ + void setTrailerCount(qint32 newTrailerCount); /** * @brief Gets or sets the movie count. */ - Q_PROPERTY(qint32 movieCount READ movieCount WRITE setMovieCount NOTIFY movieCountChanged) + qint32 movieCount() const; + /** + * @brief Gets or sets the movie count. + */ + void setMovieCount(qint32 newMovieCount); /** * @brief Gets or sets the series count. */ - Q_PROPERTY(qint32 seriesCount READ seriesCount WRITE setSeriesCount NOTIFY seriesCountChanged) - Q_PROPERTY(qint32 programCount READ programCount WRITE setProgramCount NOTIFY programCountChanged) + qint32 seriesCount() const; + /** + * @brief Gets or sets the series count. + */ + void setSeriesCount(qint32 newSeriesCount); + + qint32 programCount() const; + + void setProgramCount(qint32 newProgramCount); /** * @brief Gets or sets the episode count. */ - Q_PROPERTY(qint32 episodeCount READ episodeCount WRITE setEpisodeCount NOTIFY episodeCountChanged) + qint32 episodeCount() const; + /** + * @brief Gets or sets the episode count. + */ + void setEpisodeCount(qint32 newEpisodeCount); /** * @brief Gets or sets the song count. */ - Q_PROPERTY(qint32 songCount READ songCount WRITE setSongCount NOTIFY songCountChanged) + qint32 songCount() const; + /** + * @brief Gets or sets the song count. + */ + void setSongCount(qint32 newSongCount); /** * @brief Gets or sets the album count. */ - Q_PROPERTY(qint32 albumCount READ albumCount WRITE setAlbumCount NOTIFY albumCountChanged) - Q_PROPERTY(qint32 artistCount READ artistCount WRITE setArtistCount NOTIFY artistCountChanged) + qint32 albumCount() const; + /** + * @brief Gets or sets the album count. + */ + void setAlbumCount(qint32 newAlbumCount); + + qint32 artistCount() const; + + void setArtistCount(qint32 newArtistCount); /** * @brief Gets or sets the music video count. */ - Q_PROPERTY(qint32 musicVideoCount READ musicVideoCount WRITE setMusicVideoCount NOTIFY musicVideoCountChanged) + qint32 musicVideoCount() const; + /** + * @brief Gets or sets the music video count. + */ + void setMusicVideoCount(qint32 newMusicVideoCount); /** * @brief Gets or sets a value indicating whether [enable internet providers]. */ - Q_PROPERTY(bool lockData READ lockData WRITE setLockData NOTIFY lockDataChanged) - Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged) - Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(QString cameraMake READ cameraMake WRITE setCameraMake NOTIFY cameraMakeChanged) - Q_PROPERTY(QString cameraModel READ cameraModel WRITE setCameraModel NOTIFY cameraModelChanged) - Q_PROPERTY(QString software READ software WRITE setSoftware NOTIFY softwareChanged) - Q_PROPERTY(double exposureTime READ exposureTime WRITE setExposureTime NOTIFY exposureTimeChanged) - Q_PROPERTY(double focalLength READ focalLength WRITE setFocalLength NOTIFY focalLengthChanged) - Q_PROPERTY(ImageOrientation imageOrientation READ imageOrientation WRITE setImageOrientation NOTIFY imageOrientationChanged) - Q_PROPERTY(double aperture READ aperture WRITE setAperture NOTIFY apertureChanged) - Q_PROPERTY(double shutterSpeed READ shutterSpeed WRITE setShutterSpeed NOTIFY shutterSpeedChanged) - Q_PROPERTY(double latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged) - Q_PROPERTY(double longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged) - Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged) - Q_PROPERTY(qint32 isoSpeedRating READ isoSpeedRating WRITE setIsoSpeedRating NOTIFY isoSpeedRatingChanged) + bool lockData() const; + /** + * @brief Gets or sets a value indicating whether [enable internet providers]. + */ + void setLockData(bool newLockData); + + qint32 width() const; + + void setWidth(qint32 newWidth); + + qint32 height() const; + + void setHeight(qint32 newHeight); + + QString cameraMake() const; + + void setCameraMake(QString newCameraMake); + + QString cameraModel() const; + + void setCameraModel(QString newCameraModel); + + QString software() const; + + void setSoftware(QString newSoftware); + + double exposureTime() const; + + void setExposureTime(double newExposureTime); + + double focalLength() const; + + void setFocalLength(double newFocalLength); + + ImageOrientation imageOrientation() const; + + void setImageOrientation(ImageOrientation newImageOrientation); + + double aperture() const; + + void setAperture(double newAperture); + + double shutterSpeed() const; + + void setShutterSpeed(double newShutterSpeed); + + double latitude() const; + + void setLatitude(double newLatitude); + + double longitude() const; + + void setLongitude(double newLongitude); + + double altitude() const; + + void setAltitude(double newAltitude); + + qint32 isoSpeedRating() const; + + void setIsoSpeedRating(qint32 newIsoSpeedRating); /** * @brief Gets or sets the series timer identifier. */ - Q_PROPERTY(QString seriesTimerId READ seriesTimerId WRITE setSeriesTimerId NOTIFY seriesTimerIdChanged) + QString seriesTimerId() const; + /** + * @brief Gets or sets the series timer identifier. + */ + void setSeriesTimerId(QString newSeriesTimerId); /** * @brief Gets or sets the program identifier. */ - Q_PROPERTY(QString programId READ programId WRITE setProgramId NOTIFY programIdChanged) + QString programId() const; + /** + * @brief Gets or sets the program identifier. + */ + void setProgramId(QString newProgramId); /** * @brief Gets or sets the channel primary image tag. */ - Q_PROPERTY(QString channelPrimaryImageTag READ channelPrimaryImageTag WRITE setChannelPrimaryImageTag NOTIFY channelPrimaryImageTagChanged) + QString channelPrimaryImageTag() const; + /** + * @brief Gets or sets the channel primary image tag. + */ + void setChannelPrimaryImageTag(QString newChannelPrimaryImageTag); /** * @brief The start date of the recording, in UTC. */ - Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged) + QDateTime startDate() const; + /** + * @brief The start date of the recording, in UTC. + */ + void setStartDate(QDateTime newStartDate); /** * @brief Gets or sets the completion percentage. */ - Q_PROPERTY(double completionPercentage READ completionPercentage WRITE setCompletionPercentage NOTIFY completionPercentageChanged) + double completionPercentage() const; + /** + * @brief Gets or sets the completion percentage. + */ + void setCompletionPercentage(double newCompletionPercentage); /** * @brief Gets or sets a value indicating whether this instance is repeat. */ - Q_PROPERTY(bool isRepeat READ isRepeat WRITE setIsRepeat NOTIFY isRepeatChanged) + bool isRepeat() const; + /** + * @brief Gets or sets a value indicating whether this instance is repeat. + */ + void setIsRepeat(bool newIsRepeat); /** * @brief Gets or sets the episode title. */ - Q_PROPERTY(QString episodeTitle READ episodeTitle WRITE setEpisodeTitle NOTIFY episodeTitleChanged) - Q_PROPERTY(ChannelType channelType READ channelType WRITE setChannelType NOTIFY channelTypeChanged) - Q_PROPERTY(ProgramAudio audio READ audio WRITE setAudio NOTIFY audioChanged) + QString episodeTitle() const; + /** + * @brief Gets or sets the episode title. + */ + void setEpisodeTitle(QString newEpisodeTitle); + + ChannelType channelType() const; + + void setChannelType(ChannelType newChannelType); + + ProgramAudio audio() const; + + void setAudio(ProgramAudio newAudio); /** * @brief Gets or sets a value indicating whether this instance is movie. */ - Q_PROPERTY(bool isMovie READ isMovie WRITE setIsMovie NOTIFY isMovieChanged) + bool isMovie() const; + /** + * @brief Gets or sets a value indicating whether this instance is movie. + */ + void setIsMovie(bool newIsMovie); /** * @brief Gets or sets a value indicating whether this instance is sports. */ - Q_PROPERTY(bool isSports READ isSports WRITE setIsSports NOTIFY isSportsChanged) + bool isSports() const; + /** + * @brief Gets or sets a value indicating whether this instance is sports. + */ + void setIsSports(bool newIsSports); /** * @brief Gets or sets a value indicating whether this instance is series. */ - Q_PROPERTY(bool isSeries READ isSeries WRITE setIsSeries NOTIFY isSeriesChanged) + bool isSeries() const; + /** + * @brief Gets or sets a value indicating whether this instance is series. + */ + void setIsSeries(bool newIsSeries); /** * @brief Gets or sets a value indicating whether this instance is live. */ - Q_PROPERTY(bool isLive READ isLive WRITE setIsLive NOTIFY isLiveChanged) + bool isLive() const; + /** + * @brief Gets or sets a value indicating whether this instance is live. + */ + void setIsLive(bool newIsLive); /** * @brief Gets or sets a value indicating whether this instance is news. */ - Q_PROPERTY(bool isNews READ isNews WRITE setIsNews NOTIFY isNewsChanged) + bool isNews() const; + /** + * @brief Gets or sets a value indicating whether this instance is news. + */ + void setIsNews(bool newIsNews); /** * @brief Gets or sets a value indicating whether this instance is kids. */ - Q_PROPERTY(bool isKids READ isKids WRITE setIsKids NOTIFY isKidsChanged) + bool isKids() const; + /** + * @brief Gets or sets a value indicating whether this instance is kids. + */ + void setIsKids(bool newIsKids); /** * @brief Gets or sets a value indicating whether this instance is premiere. */ - Q_PROPERTY(bool isPremiere READ isPremiere WRITE setIsPremiere NOTIFY isPremiereChanged) + bool isPremiere() const; + /** + * @brief Gets or sets a value indicating whether this instance is premiere. + */ + void setIsPremiere(bool newIsPremiere); /** * @brief Gets or sets the timer identifier. */ - Q_PROPERTY(QString timerId READ timerId WRITE setTimerId NOTIFY timerIdChanged) - Q_PROPERTY(BaseItemDto * currentProgram READ currentProgram WRITE setCurrentProgram NOTIFY currentProgramChanged) - - QString name() const; - void setName(QString newName); - - QString originalTitle() const; - void setOriginalTitle(QString newOriginalTitle); - - QString serverId() const; - void setServerId(QString newServerId); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString etag() const; - void setEtag(QString newEtag); - - QString sourceType() const; - void setSourceType(QString newSourceType); - - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - - QDateTime dateCreated() const; - void setDateCreated(QDateTime newDateCreated); - - QDateTime dateLastMediaAdded() const; - void setDateLastMediaAdded(QDateTime newDateLastMediaAdded); - - QString extraType() const; - void setExtraType(QString newExtraType); - - qint32 airsBeforeSeasonNumber() const; - void setAirsBeforeSeasonNumber(qint32 newAirsBeforeSeasonNumber); - - qint32 airsAfterSeasonNumber() const; - void setAirsAfterSeasonNumber(qint32 newAirsAfterSeasonNumber); - - qint32 airsBeforeEpisodeNumber() const; - void setAirsBeforeEpisodeNumber(qint32 newAirsBeforeEpisodeNumber); - - bool canDelete() const; - void setCanDelete(bool newCanDelete); - - bool canDownload() const; - void setCanDownload(bool newCanDownload); - - bool hasSubtitles() const; - void setHasSubtitles(bool newHasSubtitles); - - QString preferredMetadataLanguage() const; - void setPreferredMetadataLanguage(QString newPreferredMetadataLanguage); - - QString preferredMetadataCountryCode() const; - void setPreferredMetadataCountryCode(QString newPreferredMetadataCountryCode); - - bool supportsSync() const; - void setSupportsSync(bool newSupportsSync); - - QString container() const; - void setContainer(QString newContainer); - - QString sortName() const; - void setSortName(QString newSortName); - - QString forcedSortName() const; - void setForcedSortName(QString newForcedSortName); - - Video3DFormat video3DFormat() const; - void setVideo3DFormat(Video3DFormat newVideo3DFormat); - - QDateTime premiereDate() const; - void setPremiereDate(QDateTime newPremiereDate); - - QList externalUrls() const; - void setExternalUrls(QList newExternalUrls); - - QList mediaSources() const; - void setMediaSources(QList newMediaSources); - - float criticRating() const; - void setCriticRating(float newCriticRating); - - QStringList productionLocations() const; - void setProductionLocations(QStringList newProductionLocations); - - QString path() const; - void setPath(QString newPath); - - bool enableMediaSourceDisplay() const; - void setEnableMediaSourceDisplay(bool newEnableMediaSourceDisplay); - - QString officialRating() const; - void setOfficialRating(QString newOfficialRating); - - QString customRating() const; - void setCustomRating(QString newCustomRating); - - QString channelId() const; - void setChannelId(QString newChannelId); - - QString channelName() const; - void setChannelName(QString newChannelName); - - QString overview() const; - void setOverview(QString newOverview); - - QStringList taglines() const; - void setTaglines(QStringList newTaglines); - - QStringList genres() const; - void setGenres(QStringList newGenres); - - float communityRating() const; - void setCommunityRating(float newCommunityRating); - - qint64 cumulativeRunTimeTicks() const; - void setCumulativeRunTimeTicks(qint64 newCumulativeRunTimeTicks); - - qint64 runTimeTicks() const; - void setRunTimeTicks(qint64 newRunTimeTicks); - - PlayAccess playAccess() const; - void setPlayAccess(PlayAccess newPlayAccess); - - QString aspectRatio() const; - void setAspectRatio(QString newAspectRatio); - - qint32 productionYear() const; - void setProductionYear(qint32 newProductionYear); - - bool isPlaceHolder() const; - void setIsPlaceHolder(bool newIsPlaceHolder); - - QString number() const; - void setNumber(QString newNumber); - - QString channelNumber() const; - void setChannelNumber(QString newChannelNumber); - - qint32 indexNumber() const; - void setIndexNumber(qint32 newIndexNumber); - - qint32 indexNumberEnd() const; - void setIndexNumberEnd(qint32 newIndexNumberEnd); - - qint32 parentIndexNumber() const; - void setParentIndexNumber(qint32 newParentIndexNumber); - - QList remoteTrailers() const; - void setRemoteTrailers(QList newRemoteTrailers); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - - bool isHD() const; - void setIsHD(bool newIsHD); - - bool isFolder() const; - void setIsFolder(bool newIsFolder); - - QString parentId() const; - void setParentId(QString newParentId); - - QString type() const; - void setType(QString newType); - - QList people() const; - void setPeople(QList newPeople); - - QList studios() const; - void setStudios(QList newStudios); - - QList genreItems() const; - void setGenreItems(QList newGenreItems); - - QString parentLogoItemId() const; - void setParentLogoItemId(QString newParentLogoItemId); - - QString parentBackdropItemId() const; - void setParentBackdropItemId(QString newParentBackdropItemId); - - QStringList parentBackdropImageTags() const; - void setParentBackdropImageTags(QStringList newParentBackdropImageTags); - - qint32 localTrailerCount() const; - void setLocalTrailerCount(qint32 newLocalTrailerCount); - - UserItemDataDto * userData() const; - void setUserData(UserItemDataDto * newUserData); - - qint32 recursiveItemCount() const; - void setRecursiveItemCount(qint32 newRecursiveItemCount); - - qint32 childCount() const; - void setChildCount(qint32 newChildCount); - - QString seriesName() const; - void setSeriesName(QString newSeriesName); - - QString seriesId() const; - void setSeriesId(QString newSeriesId); - - QString seasonId() const; - void setSeasonId(QString newSeasonId); - - qint32 specialFeatureCount() const; - void setSpecialFeatureCount(qint32 newSpecialFeatureCount); - - QString displayPreferencesId() const; - void setDisplayPreferencesId(QString newDisplayPreferencesId); - - QString status() const; - void setStatus(QString newStatus); - - QString airTime() const; - void setAirTime(QString newAirTime); - - QList airDays() const; - void setAirDays(QList newAirDays); - - QStringList tags() const; - void setTags(QStringList newTags); - - double primaryImageAspectRatio() const; - void setPrimaryImageAspectRatio(double newPrimaryImageAspectRatio); - - QStringList artists() const; - void setArtists(QStringList newArtists); - - QList artistItems() const; - void setArtistItems(QList newArtistItems); - - QString album() const; - void setAlbum(QString newAlbum); - - QString collectionType() const; - void setCollectionType(QString newCollectionType); - - QString displayOrder() const; - void setDisplayOrder(QString newDisplayOrder); - - QString albumId() const; - void setAlbumId(QString newAlbumId); - - QString albumPrimaryImageTag() const; - void setAlbumPrimaryImageTag(QString newAlbumPrimaryImageTag); - - QString seriesPrimaryImageTag() const; - void setSeriesPrimaryImageTag(QString newSeriesPrimaryImageTag); - - QString albumArtist() const; - void setAlbumArtist(QString newAlbumArtist); - - QList albumArtists() const; - void setAlbumArtists(QList newAlbumArtists); - - QString seasonName() const; - void setSeasonName(QString newSeasonName); - - QList mediaStreams() const; - void setMediaStreams(QList newMediaStreams); - - VideoType videoType() const; - void setVideoType(VideoType newVideoType); - - qint32 partCount() const; - void setPartCount(qint32 newPartCount); - - qint32 mediaSourceCount() const; - void setMediaSourceCount(qint32 newMediaSourceCount); - - QJsonObject imageTags() const; - void setImageTags(QJsonObject newImageTags); - - QStringList backdropImageTags() const; - void setBackdropImageTags(QStringList newBackdropImageTags); - - QStringList screenshotImageTags() const; - void setScreenshotImageTags(QStringList newScreenshotImageTags); - - QString parentLogoImageTag() const; - void setParentLogoImageTag(QString newParentLogoImageTag); - - QString parentArtItemId() const; - void setParentArtItemId(QString newParentArtItemId); - - QString parentArtImageTag() const; - void setParentArtImageTag(QString newParentArtImageTag); - - QString seriesThumbImageTag() const; - void setSeriesThumbImageTag(QString newSeriesThumbImageTag); - - QJsonObject imageBlurHashes() const; - void setImageBlurHashes(QJsonObject newImageBlurHashes); - - QString seriesStudio() const; - void setSeriesStudio(QString newSeriesStudio); - - QString parentThumbItemId() const; - void setParentThumbItemId(QString newParentThumbItemId); - - QString parentThumbImageTag() const; - void setParentThumbImageTag(QString newParentThumbImageTag); - - QString parentPrimaryImageItemId() const; - void setParentPrimaryImageItemId(QString newParentPrimaryImageItemId); - - QString parentPrimaryImageTag() const; - void setParentPrimaryImageTag(QString newParentPrimaryImageTag); - - QList chapters() const; - void setChapters(QList newChapters); - - LocationType locationType() const; - void setLocationType(LocationType newLocationType); - - IsoType isoType() const; - void setIsoType(IsoType newIsoType); - - QString mediaType() const; - void setMediaType(QString newMediaType); - - QDateTime endDate() const; - void setEndDate(QDateTime newEndDate); - - QList lockedFields() const; - void setLockedFields(QList newLockedFields); - - qint32 trailerCount() const; - void setTrailerCount(qint32 newTrailerCount); - - qint32 movieCount() const; - void setMovieCount(qint32 newMovieCount); - - qint32 seriesCount() const; - void setSeriesCount(qint32 newSeriesCount); - - qint32 programCount() const; - void setProgramCount(qint32 newProgramCount); - - qint32 episodeCount() const; - void setEpisodeCount(qint32 newEpisodeCount); - - qint32 songCount() const; - void setSongCount(qint32 newSongCount); - - qint32 albumCount() const; - void setAlbumCount(qint32 newAlbumCount); - - qint32 artistCount() const; - void setArtistCount(qint32 newArtistCount); - - qint32 musicVideoCount() const; - void setMusicVideoCount(qint32 newMusicVideoCount); - - bool lockData() const; - void setLockData(bool newLockData); - - qint32 width() const; - void setWidth(qint32 newWidth); - - qint32 height() const; - void setHeight(qint32 newHeight); - - QString cameraMake() const; - void setCameraMake(QString newCameraMake); - - QString cameraModel() const; - void setCameraModel(QString newCameraModel); - - QString software() const; - void setSoftware(QString newSoftware); - - double exposureTime() const; - void setExposureTime(double newExposureTime); - - double focalLength() const; - void setFocalLength(double newFocalLength); - - ImageOrientation imageOrientation() const; - void setImageOrientation(ImageOrientation newImageOrientation); - - double aperture() const; - void setAperture(double newAperture); - - double shutterSpeed() const; - void setShutterSpeed(double newShutterSpeed); - - double latitude() const; - void setLatitude(double newLatitude); - - double longitude() const; - void setLongitude(double newLongitude); - - double altitude() const; - void setAltitude(double newAltitude); - - qint32 isoSpeedRating() const; - void setIsoSpeedRating(qint32 newIsoSpeedRating); - - QString seriesTimerId() const; - void setSeriesTimerId(QString newSeriesTimerId); - - QString programId() const; - void setProgramId(QString newProgramId); - - QString channelPrimaryImageTag() const; - void setChannelPrimaryImageTag(QString newChannelPrimaryImageTag); - - QDateTime startDate() const; - void setStartDate(QDateTime newStartDate); - - double completionPercentage() const; - void setCompletionPercentage(double newCompletionPercentage); - - bool isRepeat() const; - void setIsRepeat(bool newIsRepeat); - - QString episodeTitle() const; - void setEpisodeTitle(QString newEpisodeTitle); - - ChannelType channelType() const; - void setChannelType(ChannelType newChannelType); - - ProgramAudio audio() const; - void setAudio(ProgramAudio newAudio); - - bool isMovie() const; - void setIsMovie(bool newIsMovie); - - bool isSports() const; - void setIsSports(bool newIsSports); - - bool isSeries() const; - void setIsSeries(bool newIsSeries); - - bool isLive() const; - void setIsLive(bool newIsLive); - - bool isNews() const; - void setIsNews(bool newIsNews); - - bool isKids() const; - void setIsKids(bool newIsKids); - - bool isPremiere() const; - void setIsPremiere(bool newIsPremiere); - QString timerId() const; + /** + * @brief Gets or sets the timer identifier. + */ void setTimerId(QString newTimerId); - - BaseItemDto * currentProgram() const; - void setCurrentProgram(BaseItemDto * newCurrentProgram); - -signals: - void nameChanged(QString newName); - void originalTitleChanged(QString newOriginalTitle); - void serverIdChanged(QString newServerId); - void jellyfinIdChanged(QString newJellyfinId); - void etagChanged(QString newEtag); - void sourceTypeChanged(QString newSourceType); - void playlistItemIdChanged(QString newPlaylistItemId); - void dateCreatedChanged(QDateTime newDateCreated); - void dateLastMediaAddedChanged(QDateTime newDateLastMediaAdded); - void extraTypeChanged(QString newExtraType); - void airsBeforeSeasonNumberChanged(qint32 newAirsBeforeSeasonNumber); - void airsAfterSeasonNumberChanged(qint32 newAirsAfterSeasonNumber); - void airsBeforeEpisodeNumberChanged(qint32 newAirsBeforeEpisodeNumber); - void canDeleteChanged(bool newCanDelete); - void canDownloadChanged(bool newCanDownload); - void hasSubtitlesChanged(bool newHasSubtitles); - void preferredMetadataLanguageChanged(QString newPreferredMetadataLanguage); - void preferredMetadataCountryCodeChanged(QString newPreferredMetadataCountryCode); - void supportsSyncChanged(bool newSupportsSync); - void containerChanged(QString newContainer); - void sortNameChanged(QString newSortName); - void forcedSortNameChanged(QString newForcedSortName); - void video3DFormatChanged(Video3DFormat newVideo3DFormat); - void premiereDateChanged(QDateTime newPremiereDate); - void externalUrlsChanged(QList newExternalUrls); - void mediaSourcesChanged(QList newMediaSources); - void criticRatingChanged(float newCriticRating); - void productionLocationsChanged(QStringList newProductionLocations); - void pathChanged(QString newPath); - void enableMediaSourceDisplayChanged(bool newEnableMediaSourceDisplay); - void officialRatingChanged(QString newOfficialRating); - void customRatingChanged(QString newCustomRating); - void channelIdChanged(QString newChannelId); - void channelNameChanged(QString newChannelName); - void overviewChanged(QString newOverview); - void taglinesChanged(QStringList newTaglines); - void genresChanged(QStringList newGenres); - void communityRatingChanged(float newCommunityRating); - void cumulativeRunTimeTicksChanged(qint64 newCumulativeRunTimeTicks); - void runTimeTicksChanged(qint64 newRunTimeTicks); - void playAccessChanged(PlayAccess newPlayAccess); - void aspectRatioChanged(QString newAspectRatio); - void productionYearChanged(qint32 newProductionYear); - void isPlaceHolderChanged(bool newIsPlaceHolder); - void numberChanged(QString newNumber); - void channelNumberChanged(QString newChannelNumber); - void indexNumberChanged(qint32 newIndexNumber); - void indexNumberEndChanged(qint32 newIndexNumberEnd); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void remoteTrailersChanged(QList newRemoteTrailers); - void providerIdsChanged(QJsonObject newProviderIds); - void isHDChanged(bool newIsHD); - void isFolderChanged(bool newIsFolder); - void parentIdChanged(QString newParentId); - void typeChanged(QString newType); - void peopleChanged(QList newPeople); - void studiosChanged(QList newStudios); - void genreItemsChanged(QList newGenreItems); - void parentLogoItemIdChanged(QString newParentLogoItemId); - void parentBackdropItemIdChanged(QString newParentBackdropItemId); - void parentBackdropImageTagsChanged(QStringList newParentBackdropImageTags); - void localTrailerCountChanged(qint32 newLocalTrailerCount); - void userDataChanged(UserItemDataDto * newUserData); - void recursiveItemCountChanged(qint32 newRecursiveItemCount); - void childCountChanged(qint32 newChildCount); - void seriesNameChanged(QString newSeriesName); - void seriesIdChanged(QString newSeriesId); - void seasonIdChanged(QString newSeasonId); - void specialFeatureCountChanged(qint32 newSpecialFeatureCount); - void displayPreferencesIdChanged(QString newDisplayPreferencesId); - void statusChanged(QString newStatus); - void airTimeChanged(QString newAirTime); - void airDaysChanged(QList newAirDays); - void tagsChanged(QStringList newTags); - void primaryImageAspectRatioChanged(double newPrimaryImageAspectRatio); - void artistsChanged(QStringList newArtists); - void artistItemsChanged(QList newArtistItems); - void albumChanged(QString newAlbum); - void collectionTypeChanged(QString newCollectionType); - void displayOrderChanged(QString newDisplayOrder); - void albumIdChanged(QString newAlbumId); - void albumPrimaryImageTagChanged(QString newAlbumPrimaryImageTag); - void seriesPrimaryImageTagChanged(QString newSeriesPrimaryImageTag); - void albumArtistChanged(QString newAlbumArtist); - void albumArtistsChanged(QList newAlbumArtists); - void seasonNameChanged(QString newSeasonName); - void mediaStreamsChanged(QList newMediaStreams); - void videoTypeChanged(VideoType newVideoType); - void partCountChanged(qint32 newPartCount); - void mediaSourceCountChanged(qint32 newMediaSourceCount); - void imageTagsChanged(QJsonObject newImageTags); - void backdropImageTagsChanged(QStringList newBackdropImageTags); - void screenshotImageTagsChanged(QStringList newScreenshotImageTags); - void parentLogoImageTagChanged(QString newParentLogoImageTag); - void parentArtItemIdChanged(QString newParentArtItemId); - void parentArtImageTagChanged(QString newParentArtImageTag); - void seriesThumbImageTagChanged(QString newSeriesThumbImageTag); - void imageBlurHashesChanged(QJsonObject newImageBlurHashes); - void seriesStudioChanged(QString newSeriesStudio); - void parentThumbItemIdChanged(QString newParentThumbItemId); - void parentThumbImageTagChanged(QString newParentThumbImageTag); - void parentPrimaryImageItemIdChanged(QString newParentPrimaryImageItemId); - void parentPrimaryImageTagChanged(QString newParentPrimaryImageTag); - void chaptersChanged(QList newChapters); - void locationTypeChanged(LocationType newLocationType); - void isoTypeChanged(IsoType newIsoType); - void mediaTypeChanged(QString newMediaType); - void endDateChanged(QDateTime newEndDate); - void lockedFieldsChanged(QList newLockedFields); - void trailerCountChanged(qint32 newTrailerCount); - void movieCountChanged(qint32 newMovieCount); - void seriesCountChanged(qint32 newSeriesCount); - void programCountChanged(qint32 newProgramCount); - void episodeCountChanged(qint32 newEpisodeCount); - void songCountChanged(qint32 newSongCount); - void albumCountChanged(qint32 newAlbumCount); - void artistCountChanged(qint32 newArtistCount); - void musicVideoCountChanged(qint32 newMusicVideoCount); - void lockDataChanged(bool newLockData); - void widthChanged(qint32 newWidth); - void heightChanged(qint32 newHeight); - void cameraMakeChanged(QString newCameraMake); - void cameraModelChanged(QString newCameraModel); - void softwareChanged(QString newSoftware); - void exposureTimeChanged(double newExposureTime); - void focalLengthChanged(double newFocalLength); - void imageOrientationChanged(ImageOrientation newImageOrientation); - void apertureChanged(double newAperture); - void shutterSpeedChanged(double newShutterSpeed); - void latitudeChanged(double newLatitude); - void longitudeChanged(double newLongitude); - void altitudeChanged(double newAltitude); - void isoSpeedRatingChanged(qint32 newIsoSpeedRating); - void seriesTimerIdChanged(QString newSeriesTimerId); - void programIdChanged(QString newProgramId); - void channelPrimaryImageTagChanged(QString newChannelPrimaryImageTag); - void startDateChanged(QDateTime newStartDate); - void completionPercentageChanged(double newCompletionPercentage); - void isRepeatChanged(bool newIsRepeat); - void episodeTitleChanged(QString newEpisodeTitle); - void channelTypeChanged(ChannelType newChannelType); - void audioChanged(ProgramAudio newAudio); - void isMovieChanged(bool newIsMovie); - void isSportsChanged(bool newIsSports); - void isSeriesChanged(bool newIsSeries); - void isLiveChanged(bool newIsLive); - void isNewsChanged(bool newIsNews); - void isKidsChanged(bool newIsKids); - void isPremiereChanged(bool newIsPremiere); - void timerIdChanged(QString newTimerId); - void currentProgramChanged(BaseItemDto * newCurrentProgram); + + QSharedPointer currentProgram() const; + + void setCurrentProgram(QSharedPointer newCurrentProgram); + protected: QString m_name; QString m_originalTitle; QString m_serverId; - QString m_jellyfinId; + QUuid m_jellyfinId; QString m_etag; QString m_sourceType; QString m_playlistItemId; @@ -1175,15 +1132,15 @@ protected: QString m_forcedSortName; Video3DFormat m_video3DFormat; QDateTime m_premiereDate; - QList m_externalUrls; - QList m_mediaSources; + QList> m_externalUrls; + QList> m_mediaSources; float m_criticRating; QStringList m_productionLocations; QString m_path; bool m_enableMediaSourceDisplay; QString m_officialRating; QString m_customRating; - QString m_channelId; + QUuid m_channelId; QString m_channelName; QString m_overview; QStringList m_taglines; @@ -1200,25 +1157,25 @@ protected: qint32 m_indexNumber; qint32 m_indexNumberEnd; qint32 m_parentIndexNumber; - QList m_remoteTrailers; + QList> m_remoteTrailers; QJsonObject m_providerIds; bool m_isHD; bool m_isFolder; - QString m_parentId; + QUuid m_parentId; QString m_type; - QList m_people; - QList m_studios; - QList m_genreItems; + QList> m_people; + QList> m_studios; + QList> m_genreItems; QString m_parentLogoItemId; QString m_parentBackdropItemId; QStringList m_parentBackdropImageTags; qint32 m_localTrailerCount; - UserItemDataDto * m_userData = nullptr; + QSharedPointer m_userData = nullptr; qint32 m_recursiveItemCount; qint32 m_childCount; QString m_seriesName; - QString m_seriesId; - QString m_seasonId; + QUuid m_seriesId; + QUuid m_seasonId; qint32 m_specialFeatureCount; QString m_displayPreferencesId; QString m_status; @@ -1227,17 +1184,17 @@ protected: QStringList m_tags; double m_primaryImageAspectRatio; QStringList m_artists; - QList m_artistItems; + QList> m_artistItems; QString m_album; QString m_collectionType; QString m_displayOrder; - QString m_albumId; + QUuid m_albumId; QString m_albumPrimaryImageTag; QString m_seriesPrimaryImageTag; QString m_albumArtist; - QList m_albumArtists; + QList> m_albumArtists; QString m_seasonName; - QList m_mediaStreams; + QList> m_mediaStreams; VideoType m_videoType; qint32 m_partCount; qint32 m_mediaSourceCount; @@ -1254,7 +1211,7 @@ protected: QString m_parentThumbImageTag; QString m_parentPrimaryImageItemId; QString m_parentPrimaryImageTag; - QList m_chapters; + QList> m_chapters; LocationType m_locationType; IsoType m_isoType; QString m_mediaType; @@ -1301,9 +1258,21 @@ protected: bool m_isKids; bool m_isPremiere; QString m_timerId; - BaseItemDto * m_currentProgram = nullptr; + QSharedPointer m_currentProgram = nullptr; }; +} // NS DTO + +namespace Support { + +using BaseItemDto = Jellyfin::DTO::BaseItemDto; + +template <> +BaseItemDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BaseItemDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/baseitemdtoqueryresult.h b/core/include/JellyfinQt/DTO/baseitemdtoqueryresult.h index cc61ca3..2a76c0c 100644 --- a/core/include/JellyfinQt/DTO/baseitemdtoqueryresult.h +++ b/core/include/JellyfinQt/DTO/baseitemdtoqueryresult.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_BASEITEMDTOQUERYRESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/baseitemdto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemDto; -class BaseItemDtoQueryResult : public QObject { - Q_OBJECT +class BaseItemDtoQueryResult { public: - explicit BaseItemDtoQueryResult(QObject *parent = nullptr); - static BaseItemDtoQueryResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit BaseItemDtoQueryResult(); + static BaseItemDtoQueryResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items. */ - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) + QList> items() const; + /** + * @brief Gets or sets the items. + */ + void setItems(QList> newItems); /** * @brief The total number of records available. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief The total number of records available. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief The index of the first record in Items. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) - - QList items() const; - void setItems(QList newItems); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - qint32 startIndex() const; + /** + * @brief The index of the first record in Items. + */ void setStartIndex(qint32 newStartIndex); - -signals: - void itemsChanged(QList newItems); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void startIndexChanged(qint32 newStartIndex); + protected: - QList m_items; + QList> m_items; qint32 m_totalRecordCount; qint32 m_startIndex; }; +} // NS DTO + +namespace Support { + +using BaseItemDtoQueryResult = Jellyfin::DTO::BaseItemDtoQueryResult; + +template <> +BaseItemDtoQueryResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BaseItemDtoQueryResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/baseitemperson.h b/core/include/JellyfinQt/DTO/baseitemperson.h index 8bd2397..e13745a 100644 --- a/core/include/JellyfinQt/DTO/baseitemperson.h +++ b/core/include/JellyfinQt/DTO/baseitemperson.h @@ -31,70 +31,73 @@ #define JELLYFIN_DTO_BASEITEMPERSON_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemPerson : public QObject { - Q_OBJECT -public: - explicit BaseItemPerson(QObject *parent = nullptr); - static BaseItemPerson *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class BaseItemPerson { +public: + explicit BaseItemPerson(); + static BaseItemPerson fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the identifier. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the identifier. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets the role. */ - Q_PROPERTY(QString role READ role WRITE setRole NOTIFY roleChanged) + QString role() const; + /** + * @brief Gets or sets the role. + */ + void setRole(QString newRole); /** * @brief Gets or sets the type. */ - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + QString type() const; + /** + * @brief Gets or sets the type. + */ + void setType(QString newType); /** * @brief Gets or sets the primary image tag. */ - Q_PROPERTY(QString primaryImageTag READ primaryImageTag WRITE setPrimaryImageTag NOTIFY primaryImageTagChanged) + QString primaryImageTag() const; + /** + * @brief Gets or sets the primary image tag. + */ + void setPrimaryImageTag(QString newPrimaryImageTag); /** * @brief Gets or sets the primary image blurhash. */ - Q_PROPERTY(QJsonObject imageBlurHashes READ imageBlurHashes WRITE setImageBlurHashes NOTIFY imageBlurHashesChanged) - - QString name() const; - void setName(QString newName); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString role() const; - void setRole(QString newRole); - - QString type() const; - void setType(QString newType); - - QString primaryImageTag() const; - void setPrimaryImageTag(QString newPrimaryImageTag); - QJsonObject imageBlurHashes() const; + /** + * @brief Gets or sets the primary image blurhash. + */ void setImageBlurHashes(QJsonObject newImageBlurHashes); - -signals: - void nameChanged(QString newName); - void jellyfinIdChanged(QString newJellyfinId); - void roleChanged(QString newRole); - void typeChanged(QString newType); - void primaryImageTagChanged(QString newPrimaryImageTag); - void imageBlurHashesChanged(QJsonObject newImageBlurHashes); + protected: QString m_name; QString m_jellyfinId; @@ -104,6 +107,18 @@ protected: QJsonObject m_imageBlurHashes; }; +} // NS DTO + +namespace Support { + +using BaseItemPerson = Jellyfin::DTO::BaseItemPerson; + +template <> +BaseItemPerson fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BaseItemPerson::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/bookinfo.h b/core/include/JellyfinQt/DTO/bookinfo.h index 920321d..349f2cd 100644 --- a/core/include/JellyfinQt/DTO/bookinfo.h +++ b/core/include/JellyfinQt/DTO/bookinfo.h @@ -32,95 +32,93 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BookInfo : public QObject { - Q_OBJECT -public: - explicit BookInfo(QObject *parent = nullptr); - static BookInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class BookInfo { +public: + explicit BookInfo(); + static BookInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - Q_PROPERTY(QString seriesName READ seriesName WRITE setSeriesName NOTIFY seriesNameChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - + QString seriesName() const; + void setSeriesName(QString newSeriesName); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); - void seriesNameChanged(QString newSeriesName); + protected: QString m_name; QString m_path; @@ -135,6 +133,18 @@ protected: QString m_seriesName; }; +} // NS DTO + +namespace Support { + +using BookInfo = Jellyfin::DTO::BookInfo; + +template <> +BookInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BookInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/bookinforemotesearchquery.h b/core/include/JellyfinQt/DTO/bookinforemotesearchquery.h index 0e26c66..8322e7f 100644 --- a/core/include/JellyfinQt/DTO/bookinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/bookinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_BOOKINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/bookinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BookInfo; -class BookInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class BookInfoRemoteSearchQuery { public: - explicit BookInfoRemoteSearchQuery(QObject *parent = nullptr); - static BookInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit BookInfoRemoteSearchQuery(); + static BookInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(BookInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - BookInfo * searchInfo() const; - void setSearchInfo(BookInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(BookInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - BookInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using BookInfoRemoteSearchQuery = Jellyfin::DTO::BookInfoRemoteSearchQuery; + +template <> +BookInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BookInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/boxsetinfo.h b/core/include/JellyfinQt/DTO/boxsetinfo.h index f08d424..3f1c02f 100644 --- a/core/include/JellyfinQt/DTO/boxsetinfo.h +++ b/core/include/JellyfinQt/DTO/boxsetinfo.h @@ -32,90 +32,89 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BoxSetInfo : public QObject { - Q_OBJECT -public: - explicit BoxSetInfo(QObject *parent = nullptr); - static BoxSetInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class BoxSetInfo { +public: + explicit BoxSetInfo(); + static BoxSetInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); + protected: QString m_name; QString m_path; @@ -129,6 +128,18 @@ protected: bool m_isAutomated; }; +} // NS DTO + +namespace Support { + +using BoxSetInfo = Jellyfin::DTO::BoxSetInfo; + +template <> +BoxSetInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BoxSetInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/boxsetinforemotesearchquery.h b/core/include/JellyfinQt/DTO/boxsetinforemotesearchquery.h index 0fa7db2..672de56 100644 --- a/core/include/JellyfinQt/DTO/boxsetinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/boxsetinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_BOXSETINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/boxsetinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BoxSetInfo; -class BoxSetInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class BoxSetInfoRemoteSearchQuery { public: - explicit BoxSetInfoRemoteSearchQuery(QObject *parent = nullptr); - static BoxSetInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit BoxSetInfoRemoteSearchQuery(); + static BoxSetInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(BoxSetInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - BoxSetInfo * searchInfo() const; - void setSearchInfo(BoxSetInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(BoxSetInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - BoxSetInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using BoxSetInfoRemoteSearchQuery = Jellyfin::DTO::BoxSetInfoRemoteSearchQuery; + +template <> +BoxSetInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BoxSetInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/brandingoptions.h b/core/include/JellyfinQt/DTO/brandingoptions.h index 8a46e52..6b6896b 100644 --- a/core/include/JellyfinQt/DTO/brandingoptions.h +++ b/core/include/JellyfinQt/DTO/brandingoptions.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_BRANDINGOPTIONS_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BrandingOptions : public QObject { - Q_OBJECT -public: - explicit BrandingOptions(QObject *parent = nullptr); - static BrandingOptions *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class BrandingOptions { +public: + explicit BrandingOptions(); + static BrandingOptions fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the login disclaimer. */ - Q_PROPERTY(QString loginDisclaimer READ loginDisclaimer WRITE setLoginDisclaimer NOTIFY loginDisclaimerChanged) + QString loginDisclaimer() const; + /** + * @brief Gets or sets the login disclaimer. + */ + void setLoginDisclaimer(QString newLoginDisclaimer); /** * @brief Gets or sets the custom CSS. */ - Q_PROPERTY(QString customCss READ customCss WRITE setCustomCss NOTIFY customCssChanged) - - QString loginDisclaimer() const; - void setLoginDisclaimer(QString newLoginDisclaimer); - QString customCss() const; + /** + * @brief Gets or sets the custom CSS. + */ void setCustomCss(QString newCustomCss); - -signals: - void loginDisclaimerChanged(QString newLoginDisclaimer); - void customCssChanged(QString newCustomCss); + protected: QString m_loginDisclaimer; QString m_customCss; }; +} // NS DTO + +namespace Support { + +using BrandingOptions = Jellyfin::DTO::BrandingOptions; + +template <> +BrandingOptions fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BrandingOptions::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/bufferrequestdto.h b/core/include/JellyfinQt/DTO/bufferrequestdto.h index c178ecd..798dd47 100644 --- a/core/include/JellyfinQt/DTO/bufferrequestdto.h +++ b/core/include/JellyfinQt/DTO/bufferrequestdto.h @@ -32,61 +32,76 @@ #include #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BufferRequestDto : public QObject { - Q_OBJECT -public: - explicit BufferRequestDto(QObject *parent = nullptr); - static BufferRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class BufferRequestDto { +public: + explicit BufferRequestDto(); + static BufferRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets when the request has been made by the client. */ - Q_PROPERTY(QDateTime when READ when WRITE setWhen NOTIFY whenChanged) + QDateTime when() const; + /** + * @brief Gets or sets when the request has been made by the client. + */ + void setWhen(QDateTime newWhen); /** * @brief Gets or sets the position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) + qint64 positionTicks() const; + /** + * @brief Gets or sets the position ticks. + */ + void setPositionTicks(qint64 newPositionTicks); /** * @brief Gets or sets a value indicating whether the client playback is unpaused. */ - Q_PROPERTY(bool isPlaying READ isPlaying WRITE setIsPlaying NOTIFY isPlayingChanged) + bool isPlaying() const; + /** + * @brief Gets or sets a value indicating whether the client playback is unpaused. + */ + void setIsPlaying(bool newIsPlaying); /** * @brief Gets or sets the playlist item identifier of the playing item. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QUuid playlistItemId() const; + /** + * @brief Gets or sets the playlist item identifier of the playing item. + */ + void setPlaylistItemId(QUuid newPlaylistItemId); - QDateTime when() const; - void setWhen(QDateTime newWhen); - - qint64 positionTicks() const; - void setPositionTicks(qint64 newPositionTicks); - - bool isPlaying() const; - void setIsPlaying(bool newIsPlaying); - - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void whenChanged(QDateTime newWhen); - void positionTicksChanged(qint64 newPositionTicks); - void isPlayingChanged(bool newIsPlaying); - void playlistItemIdChanged(QString newPlaylistItemId); protected: QDateTime m_when; qint64 m_positionTicks; bool m_isPlaying; - QString m_playlistItemId; + QUuid m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using BufferRequestDto = Jellyfin::DTO::BufferRequestDto; + +template <> +BufferRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return BufferRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/channelfeatures.h b/core/include/JellyfinQt/DTO/channelfeatures.h index b8f823e..81b95bf 100644 --- a/core/include/JellyfinQt/DTO/channelfeatures.h +++ b/core/include/JellyfinQt/DTO/channelfeatures.h @@ -31,124 +31,126 @@ #define JELLYFIN_DTO_CHANNELFEATURES_H #include +#include #include -#include #include #include +#include #include "JellyfinQt/DTO/channelitemsortfield.h" #include "JellyfinQt/DTO/channelmediacontenttype.h" #include "JellyfinQt/DTO/channelmediatype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ChannelFeatures : public QObject { - Q_OBJECT -public: - explicit ChannelFeatures(QObject *parent = nullptr); - static ChannelFeatures *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ChannelFeatures { +public: + explicit ChannelFeatures(); + static ChannelFeatures fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the identifier. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the identifier. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets a value indicating whether this instance can search. */ - Q_PROPERTY(bool canSearch READ canSearch WRITE setCanSearch NOTIFY canSearchChanged) + bool canSearch() const; + /** + * @brief Gets or sets a value indicating whether this instance can search. + */ + void setCanSearch(bool newCanSearch); /** * @brief Gets or sets the media types. */ - Q_PROPERTY(QList mediaTypes READ mediaTypes WRITE setMediaTypes NOTIFY mediaTypesChanged) + QList mediaTypes() const; + /** + * @brief Gets or sets the media types. + */ + void setMediaTypes(QList newMediaTypes); /** * @brief Gets or sets the content types. */ - Q_PROPERTY(QList contentTypes READ contentTypes WRITE setContentTypes NOTIFY contentTypesChanged) + QList contentTypes() const; + /** + * @brief Gets or sets the content types. + */ + void setContentTypes(QList newContentTypes); /** * @brief Represents the maximum number of records the channel allows retrieving at a time. */ - Q_PROPERTY(qint32 maxPageSize READ maxPageSize WRITE setMaxPageSize NOTIFY maxPageSizeChanged) + qint32 maxPageSize() const; + /** + * @brief Represents the maximum number of records the channel allows retrieving at a time. + */ + void setMaxPageSize(qint32 newMaxPageSize); /** * @brief Gets or sets the automatic refresh levels. */ - Q_PROPERTY(qint32 autoRefreshLevels READ autoRefreshLevels WRITE setAutoRefreshLevels NOTIFY autoRefreshLevelsChanged) + qint32 autoRefreshLevels() const; + /** + * @brief Gets or sets the automatic refresh levels. + */ + void setAutoRefreshLevels(qint32 newAutoRefreshLevels); /** * @brief Gets or sets the default sort orders. */ - Q_PROPERTY(QList defaultSortFields READ defaultSortFields WRITE setDefaultSortFields NOTIFY defaultSortFieldsChanged) + QList defaultSortFields() const; + /** + * @brief Gets or sets the default sort orders. + */ + void setDefaultSortFields(QList newDefaultSortFields); /** * @brief Indicates if a sort ascending/descending toggle is supported or not. */ - Q_PROPERTY(bool supportsSortOrderToggle READ supportsSortOrderToggle WRITE setSupportsSortOrderToggle NOTIFY supportsSortOrderToggleChanged) + bool supportsSortOrderToggle() const; + /** + * @brief Indicates if a sort ascending/descending toggle is supported or not. + */ + void setSupportsSortOrderToggle(bool newSupportsSortOrderToggle); /** * @brief Gets or sets a value indicating whether [supports latest media]. */ - Q_PROPERTY(bool supportsLatestMedia READ supportsLatestMedia WRITE setSupportsLatestMedia NOTIFY supportsLatestMediaChanged) + bool supportsLatestMedia() const; + /** + * @brief Gets or sets a value indicating whether [supports latest media]. + */ + void setSupportsLatestMedia(bool newSupportsLatestMedia); /** * @brief Gets or sets a value indicating whether this instance can filter. */ - Q_PROPERTY(bool canFilter READ canFilter WRITE setCanFilter NOTIFY canFilterChanged) + bool canFilter() const; + /** + * @brief Gets or sets a value indicating whether this instance can filter. + */ + void setCanFilter(bool newCanFilter); /** * @brief Gets or sets a value indicating whether [supports content downloading]. */ - Q_PROPERTY(bool supportsContentDownloading READ supportsContentDownloading WRITE setSupportsContentDownloading NOTIFY supportsContentDownloadingChanged) - - QString name() const; - void setName(QString newName); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - bool canSearch() const; - void setCanSearch(bool newCanSearch); - - QList mediaTypes() const; - void setMediaTypes(QList newMediaTypes); - - QList contentTypes() const; - void setContentTypes(QList newContentTypes); - - qint32 maxPageSize() const; - void setMaxPageSize(qint32 newMaxPageSize); - - qint32 autoRefreshLevels() const; - void setAutoRefreshLevels(qint32 newAutoRefreshLevels); - - QList defaultSortFields() const; - void setDefaultSortFields(QList newDefaultSortFields); - - bool supportsSortOrderToggle() const; - void setSupportsSortOrderToggle(bool newSupportsSortOrderToggle); - - bool supportsLatestMedia() const; - void setSupportsLatestMedia(bool newSupportsLatestMedia); - - bool canFilter() const; - void setCanFilter(bool newCanFilter); - bool supportsContentDownloading() const; + /** + * @brief Gets or sets a value indicating whether [supports content downloading]. + */ void setSupportsContentDownloading(bool newSupportsContentDownloading); - -signals: - void nameChanged(QString newName); - void jellyfinIdChanged(QString newJellyfinId); - void canSearchChanged(bool newCanSearch); - void mediaTypesChanged(QList newMediaTypes); - void contentTypesChanged(QList newContentTypes); - void maxPageSizeChanged(qint32 newMaxPageSize); - void autoRefreshLevelsChanged(qint32 newAutoRefreshLevels); - void defaultSortFieldsChanged(QList newDefaultSortFields); - void supportsSortOrderToggleChanged(bool newSupportsSortOrderToggle); - void supportsLatestMediaChanged(bool newSupportsLatestMedia); - void canFilterChanged(bool newCanFilter); - void supportsContentDownloadingChanged(bool newSupportsContentDownloading); + protected: QString m_name; QString m_jellyfinId; @@ -164,6 +166,18 @@ protected: bool m_supportsContentDownloading; }; +} // NS DTO + +namespace Support { + +using ChannelFeatures = Jellyfin::DTO::ChannelFeatures; + +template <> +ChannelFeatures fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ChannelFeatures::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/channelitemsortfield.h b/core/include/JellyfinQt/DTO/channelitemsortfield.h index aa5aec8..3139beb 100644 --- a/core/include/JellyfinQt/DTO/channelitemsortfield.h +++ b/core/include/JellyfinQt/DTO/channelitemsortfield.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_CHANNELITEMSORTFIELD_H #define JELLYFIN_DTO_CHANNELITEMSORTFIELD_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ChannelItemSortFieldClass { Q_GADGET public: enum Value { + EnumNotSet, Name, CommunityRating, PremiereDate, @@ -51,8 +56,46 @@ public: private: explicit ChannelItemSortFieldClass(); }; + typedef ChannelItemSortFieldClass::Value ChannelItemSortField; +} // NS DTO + +namespace Support { + +using ChannelItemSortField = Jellyfin::DTO::ChannelItemSortField; +using ChannelItemSortFieldClass = Jellyfin::DTO::ChannelItemSortFieldClass; + +template <> +ChannelItemSortField fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ChannelItemSortFieldClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Name")) { + return ChannelItemSortFieldClass::Name; + } + if (str == QStringLiteral("CommunityRating")) { + return ChannelItemSortFieldClass::CommunityRating; + } + if (str == QStringLiteral("PremiereDate")) { + return ChannelItemSortFieldClass::PremiereDate; + } + if (str == QStringLiteral("DateCreated")) { + return ChannelItemSortFieldClass::DateCreated; + } + if (str == QStringLiteral("Runtime")) { + return ChannelItemSortFieldClass::Runtime; + } + if (str == QStringLiteral("PlayCount")) { + return ChannelItemSortFieldClass::PlayCount; + } + if (str == QStringLiteral("CommunityPlayCount")) { + return ChannelItemSortFieldClass::CommunityPlayCount; + } + + return ChannelItemSortFieldClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/channelmappingoptionsdto.h b/core/include/JellyfinQt/DTO/channelmappingoptionsdto.h index 6215f18..7cbc942 100644 --- a/core/include/JellyfinQt/DTO/channelmappingoptionsdto.h +++ b/core/include/JellyfinQt/DTO/channelmappingoptionsdto.h @@ -31,67 +31,82 @@ #define JELLYFIN_DTO_CHANNELMAPPINGOPTIONSDTO_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/nameidpair.h" +#include "JellyfinQt/DTO/namevaluepair.h" +#include "JellyfinQt/DTO/tunerchannelmapping.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NameIdPair; -class NameValuePair; -class TunerChannelMapping; -class ChannelMappingOptionsDto : public QObject { - Q_OBJECT +class ChannelMappingOptionsDto { public: - explicit ChannelMappingOptionsDto(QObject *parent = nullptr); - static ChannelMappingOptionsDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit ChannelMappingOptionsDto(); + static ChannelMappingOptionsDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets list of tuner channels. */ - Q_PROPERTY(QList tunerChannels READ tunerChannels WRITE setTunerChannels NOTIFY tunerChannelsChanged) + QList> tunerChannels() const; + /** + * @brief Gets or sets list of tuner channels. + */ + void setTunerChannels(QList> newTunerChannels); /** * @brief Gets or sets list of provider channels. */ - Q_PROPERTY(QList providerChannels READ providerChannels WRITE setProviderChannels NOTIFY providerChannelsChanged) + QList> providerChannels() const; + /** + * @brief Gets or sets list of provider channels. + */ + void setProviderChannels(QList> newProviderChannels); /** * @brief Gets or sets list of mappings. */ - Q_PROPERTY(QList mappings READ mappings WRITE setMappings NOTIFY mappingsChanged) + QList> mappings() const; + /** + * @brief Gets or sets list of mappings. + */ + void setMappings(QList> newMappings); /** * @brief Gets or sets provider name. */ - Q_PROPERTY(QString providerName READ providerName WRITE setProviderName NOTIFY providerNameChanged) - - QList tunerChannels() const; - void setTunerChannels(QList newTunerChannels); - - QList providerChannels() const; - void setProviderChannels(QList newProviderChannels); - - QList mappings() const; - void setMappings(QList newMappings); - QString providerName() const; + /** + * @brief Gets or sets provider name. + */ void setProviderName(QString newProviderName); - -signals: - void tunerChannelsChanged(QList newTunerChannels); - void providerChannelsChanged(QList newProviderChannels); - void mappingsChanged(QList newMappings); - void providerNameChanged(QString newProviderName); + protected: - QList m_tunerChannels; - QList m_providerChannels; - QList m_mappings; + QList> m_tunerChannels; + QList> m_providerChannels; + QList> m_mappings; QString m_providerName; }; +} // NS DTO + +namespace Support { + +using ChannelMappingOptionsDto = Jellyfin::DTO::ChannelMappingOptionsDto; + +template <> +ChannelMappingOptionsDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ChannelMappingOptionsDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/channelmediacontenttype.h b/core/include/JellyfinQt/DTO/channelmediacontenttype.h index f310729..40ef270 100644 --- a/core/include/JellyfinQt/DTO/channelmediacontenttype.h +++ b/core/include/JellyfinQt/DTO/channelmediacontenttype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_CHANNELMEDIACONTENTTYPE_H #define JELLYFIN_DTO_CHANNELMEDIACONTENTTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ChannelMediaContentTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Clip, Podcast, Trailer, @@ -52,8 +57,49 @@ public: private: explicit ChannelMediaContentTypeClass(); }; + typedef ChannelMediaContentTypeClass::Value ChannelMediaContentType; +} // NS DTO + +namespace Support { + +using ChannelMediaContentType = Jellyfin::DTO::ChannelMediaContentType; +using ChannelMediaContentTypeClass = Jellyfin::DTO::ChannelMediaContentTypeClass; + +template <> +ChannelMediaContentType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ChannelMediaContentTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Clip")) { + return ChannelMediaContentTypeClass::Clip; + } + if (str == QStringLiteral("Podcast")) { + return ChannelMediaContentTypeClass::Podcast; + } + if (str == QStringLiteral("Trailer")) { + return ChannelMediaContentTypeClass::Trailer; + } + if (str == QStringLiteral("Movie")) { + return ChannelMediaContentTypeClass::Movie; + } + if (str == QStringLiteral("Episode")) { + return ChannelMediaContentTypeClass::Episode; + } + if (str == QStringLiteral("Song")) { + return ChannelMediaContentTypeClass::Song; + } + if (str == QStringLiteral("MovieExtra")) { + return ChannelMediaContentTypeClass::MovieExtra; + } + if (str == QStringLiteral("TvExtra")) { + return ChannelMediaContentTypeClass::TvExtra; + } + + return ChannelMediaContentTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/channelmediatype.h b/core/include/JellyfinQt/DTO/channelmediatype.h index 4913e18..268197b 100644 --- a/core/include/JellyfinQt/DTO/channelmediatype.h +++ b/core/include/JellyfinQt/DTO/channelmediatype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_CHANNELMEDIATYPE_H #define JELLYFIN_DTO_CHANNELMEDIATYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ChannelMediaTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Audio, Video, Photo, @@ -47,8 +52,34 @@ public: private: explicit ChannelMediaTypeClass(); }; + typedef ChannelMediaTypeClass::Value ChannelMediaType; +} // NS DTO + +namespace Support { + +using ChannelMediaType = Jellyfin::DTO::ChannelMediaType; +using ChannelMediaTypeClass = Jellyfin::DTO::ChannelMediaTypeClass; + +template <> +ChannelMediaType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ChannelMediaTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Audio")) { + return ChannelMediaTypeClass::Audio; + } + if (str == QStringLiteral("Video")) { + return ChannelMediaTypeClass::Video; + } + if (str == QStringLiteral("Photo")) { + return ChannelMediaTypeClass::Photo; + } + + return ChannelMediaTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/channeltype.h b/core/include/JellyfinQt/DTO/channeltype.h index ce11729..53e7255 100644 --- a/core/include/JellyfinQt/DTO/channeltype.h +++ b/core/include/JellyfinQt/DTO/channeltype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_CHANNELTYPE_H #define JELLYFIN_DTO_CHANNELTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ChannelTypeClass { Q_GADGET public: enum Value { + EnumNotSet, TV, Radio, }; @@ -46,8 +51,31 @@ public: private: explicit ChannelTypeClass(); }; + typedef ChannelTypeClass::Value ChannelType; +} // NS DTO + +namespace Support { + +using ChannelType = Jellyfin::DTO::ChannelType; +using ChannelTypeClass = Jellyfin::DTO::ChannelTypeClass; + +template <> +ChannelType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ChannelTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("TV")) { + return ChannelTypeClass::TV; + } + if (str == QStringLiteral("Radio")) { + return ChannelTypeClass::Radio; + } + + return ChannelTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/chapterinfo.h b/core/include/JellyfinQt/DTO/chapterinfo.h index 28ce872..5ae5602 100644 --- a/core/include/JellyfinQt/DTO/chapterinfo.h +++ b/core/include/JellyfinQt/DTO/chapterinfo.h @@ -32,56 +32,57 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ChapterInfo : public QObject { - Q_OBJECT -public: - explicit ChapterInfo(QObject *parent = nullptr); - static ChapterInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ChapterInfo { +public: + explicit ChapterInfo(); + static ChapterInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the start position ticks. */ - Q_PROPERTY(qint64 startPositionTicks READ startPositionTicks WRITE setStartPositionTicks NOTIFY startPositionTicksChanged) + qint64 startPositionTicks() const; + /** + * @brief Gets or sets the start position ticks. + */ + void setStartPositionTicks(qint64 newStartPositionTicks); /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the image path. */ - Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged) - Q_PROPERTY(QDateTime imageDateModified READ imageDateModified WRITE setImageDateModified NOTIFY imageDateModifiedChanged) - Q_PROPERTY(QString imageTag READ imageTag WRITE setImageTag NOTIFY imageTagChanged) - - qint64 startPositionTicks() const; - void setStartPositionTicks(qint64 newStartPositionTicks); - - QString name() const; - void setName(QString newName); - QString imagePath() const; + /** + * @brief Gets or sets the image path. + */ void setImagePath(QString newImagePath); - + QDateTime imageDateModified() const; + void setImageDateModified(QDateTime newImageDateModified); - + QString imageTag() const; + void setImageTag(QString newImageTag); - -signals: - void startPositionTicksChanged(qint64 newStartPositionTicks); - void nameChanged(QString newName); - void imagePathChanged(QString newImagePath); - void imageDateModifiedChanged(QDateTime newImageDateModified); - void imageTagChanged(QString newImageTag); + protected: qint64 m_startPositionTicks; QString m_name; @@ -90,6 +91,18 @@ protected: QString m_imageTag; }; +} // NS DTO + +namespace Support { + +using ChapterInfo = Jellyfin::DTO::ChapterInfo; + +template <> +ChapterInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ChapterInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/clientcapabilities.h b/core/include/JellyfinQt/DTO/clientcapabilities.h index 5d6a398..4d062ac 100644 --- a/core/include/JellyfinQt/DTO/clientcapabilities.h +++ b/core/include/JellyfinQt/DTO/clientcapabilities.h @@ -31,78 +31,70 @@ #define JELLYFIN_DTO_CLIENTCAPABILITIES_H #include +#include #include -#include +#include #include #include +#include +#include "JellyfinQt/DTO/deviceprofile.h" #include "JellyfinQt/DTO/generalcommandtype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DeviceProfile; -class ClientCapabilities : public QObject { - Q_OBJECT +class ClientCapabilities { public: - explicit ClientCapabilities(QObject *parent = nullptr); - static ClientCapabilities *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QStringList playableMediaTypes READ playableMediaTypes WRITE setPlayableMediaTypes NOTIFY playableMediaTypesChanged) - Q_PROPERTY(QList supportedCommands READ supportedCommands WRITE setSupportedCommands NOTIFY supportedCommandsChanged) - Q_PROPERTY(bool supportsMediaControl READ supportsMediaControl WRITE setSupportsMediaControl NOTIFY supportsMediaControlChanged) - Q_PROPERTY(bool supportsContentUploading READ supportsContentUploading WRITE setSupportsContentUploading NOTIFY supportsContentUploadingChanged) - Q_PROPERTY(QString messageCallbackUrl READ messageCallbackUrl WRITE setMessageCallbackUrl NOTIFY messageCallbackUrlChanged) - Q_PROPERTY(bool supportsPersistentIdentifier READ supportsPersistentIdentifier WRITE setSupportsPersistentIdentifier NOTIFY supportsPersistentIdentifierChanged) - Q_PROPERTY(bool supportsSync READ supportsSync WRITE setSupportsSync NOTIFY supportsSyncChanged) - Q_PROPERTY(DeviceProfile * deviceProfile READ deviceProfile WRITE setDeviceProfile NOTIFY deviceProfileChanged) - Q_PROPERTY(QString appStoreUrl READ appStoreUrl WRITE setAppStoreUrl NOTIFY appStoreUrlChanged) - Q_PROPERTY(QString iconUrl READ iconUrl WRITE setIconUrl NOTIFY iconUrlChanged) + explicit ClientCapabilities(); + static ClientCapabilities fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QStringList playableMediaTypes() const; + void setPlayableMediaTypes(QStringList newPlayableMediaTypes); - + QList supportedCommands() const; + void setSupportedCommands(QList newSupportedCommands); - + bool supportsMediaControl() const; + void setSupportsMediaControl(bool newSupportsMediaControl); - + bool supportsContentUploading() const; + void setSupportsContentUploading(bool newSupportsContentUploading); - + QString messageCallbackUrl() const; + void setMessageCallbackUrl(QString newMessageCallbackUrl); - + bool supportsPersistentIdentifier() const; + void setSupportsPersistentIdentifier(bool newSupportsPersistentIdentifier); - + bool supportsSync() const; + void setSupportsSync(bool newSupportsSync); - - DeviceProfile * deviceProfile() const; - void setDeviceProfile(DeviceProfile * newDeviceProfile); - + + QSharedPointer deviceProfile() const; + + void setDeviceProfile(QSharedPointer newDeviceProfile); + QString appStoreUrl() const; + void setAppStoreUrl(QString newAppStoreUrl); - + QString iconUrl() const; + void setIconUrl(QString newIconUrl); - -signals: - void playableMediaTypesChanged(QStringList newPlayableMediaTypes); - void supportedCommandsChanged(QList newSupportedCommands); - void supportsMediaControlChanged(bool newSupportsMediaControl); - void supportsContentUploadingChanged(bool newSupportsContentUploading); - void messageCallbackUrlChanged(QString newMessageCallbackUrl); - void supportsPersistentIdentifierChanged(bool newSupportsPersistentIdentifier); - void supportsSyncChanged(bool newSupportsSync); - void deviceProfileChanged(DeviceProfile * newDeviceProfile); - void appStoreUrlChanged(QString newAppStoreUrl); - void iconUrlChanged(QString newIconUrl); + protected: QStringList m_playableMediaTypes; QList m_supportedCommands; @@ -111,11 +103,23 @@ protected: QString m_messageCallbackUrl; bool m_supportsPersistentIdentifier; bool m_supportsSync; - DeviceProfile * m_deviceProfile = nullptr; + QSharedPointer m_deviceProfile = nullptr; QString m_appStoreUrl; QString m_iconUrl; }; +} // NS DTO + +namespace Support { + +using ClientCapabilities = Jellyfin::DTO::ClientCapabilities; + +template <> +ClientCapabilities fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ClientCapabilities::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/clientcapabilitiesdto.h b/core/include/JellyfinQt/DTO/clientcapabilitiesdto.h index e420fbd..e086b0c 100644 --- a/core/include/JellyfinQt/DTO/clientcapabilitiesdto.h +++ b/core/include/JellyfinQt/DTO/clientcapabilitiesdto.h @@ -31,105 +31,106 @@ #define JELLYFIN_DTO_CLIENTCAPABILITIESDTO_H #include +#include #include -#include +#include #include #include +#include +#include "JellyfinQt/DTO/deviceprofile.h" #include "JellyfinQt/DTO/generalcommandtype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DeviceProfile; -class ClientCapabilitiesDto : public QObject { - Q_OBJECT +class ClientCapabilitiesDto { public: - explicit ClientCapabilitiesDto(QObject *parent = nullptr); - static ClientCapabilitiesDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit ClientCapabilitiesDto(); + static ClientCapabilitiesDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the list of playable media types. */ - Q_PROPERTY(QStringList playableMediaTypes READ playableMediaTypes WRITE setPlayableMediaTypes NOTIFY playableMediaTypesChanged) + QStringList playableMediaTypes() const; + /** + * @brief Gets or sets the list of playable media types. + */ + void setPlayableMediaTypes(QStringList newPlayableMediaTypes); /** * @brief Gets or sets the list of supported commands. */ - Q_PROPERTY(QList supportedCommands READ supportedCommands WRITE setSupportedCommands NOTIFY supportedCommandsChanged) + QList supportedCommands() const; + /** + * @brief Gets or sets the list of supported commands. + */ + void setSupportedCommands(QList newSupportedCommands); /** * @brief Gets or sets a value indicating whether session supports media control. */ - Q_PROPERTY(bool supportsMediaControl READ supportsMediaControl WRITE setSupportsMediaControl NOTIFY supportsMediaControlChanged) + bool supportsMediaControl() const; + /** + * @brief Gets or sets a value indicating whether session supports media control. + */ + void setSupportsMediaControl(bool newSupportsMediaControl); /** * @brief Gets or sets a value indicating whether session supports content uploading. */ - Q_PROPERTY(bool supportsContentUploading READ supportsContentUploading WRITE setSupportsContentUploading NOTIFY supportsContentUploadingChanged) + bool supportsContentUploading() const; + /** + * @brief Gets or sets a value indicating whether session supports content uploading. + */ + void setSupportsContentUploading(bool newSupportsContentUploading); /** * @brief Gets or sets the message callback url. */ - Q_PROPERTY(QString messageCallbackUrl READ messageCallbackUrl WRITE setMessageCallbackUrl NOTIFY messageCallbackUrlChanged) + QString messageCallbackUrl() const; + /** + * @brief Gets or sets the message callback url. + */ + void setMessageCallbackUrl(QString newMessageCallbackUrl); /** * @brief Gets or sets a value indicating whether session supports a persistent identifier. */ - Q_PROPERTY(bool supportsPersistentIdentifier READ supportsPersistentIdentifier WRITE setSupportsPersistentIdentifier NOTIFY supportsPersistentIdentifierChanged) + bool supportsPersistentIdentifier() const; + /** + * @brief Gets or sets a value indicating whether session supports a persistent identifier. + */ + void setSupportsPersistentIdentifier(bool newSupportsPersistentIdentifier); /** * @brief Gets or sets a value indicating whether session supports sync. */ - Q_PROPERTY(bool supportsSync READ supportsSync WRITE setSupportsSync NOTIFY supportsSyncChanged) - Q_PROPERTY(DeviceProfile * deviceProfile READ deviceProfile WRITE setDeviceProfile NOTIFY deviceProfileChanged) + bool supportsSync() const; + /** + * @brief Gets or sets a value indicating whether session supports sync. + */ + void setSupportsSync(bool newSupportsSync); + + QSharedPointer deviceProfile() const; + + void setDeviceProfile(QSharedPointer newDeviceProfile); /** * @brief Gets or sets the app store url. */ - Q_PROPERTY(QString appStoreUrl READ appStoreUrl WRITE setAppStoreUrl NOTIFY appStoreUrlChanged) + QString appStoreUrl() const; + /** + * @brief Gets or sets the app store url. + */ + void setAppStoreUrl(QString newAppStoreUrl); /** * @brief Gets or sets the icon url. */ - Q_PROPERTY(QString iconUrl READ iconUrl WRITE setIconUrl NOTIFY iconUrlChanged) - - QStringList playableMediaTypes() const; - void setPlayableMediaTypes(QStringList newPlayableMediaTypes); - - QList supportedCommands() const; - void setSupportedCommands(QList newSupportedCommands); - - bool supportsMediaControl() const; - void setSupportsMediaControl(bool newSupportsMediaControl); - - bool supportsContentUploading() const; - void setSupportsContentUploading(bool newSupportsContentUploading); - - QString messageCallbackUrl() const; - void setMessageCallbackUrl(QString newMessageCallbackUrl); - - bool supportsPersistentIdentifier() const; - void setSupportsPersistentIdentifier(bool newSupportsPersistentIdentifier); - - bool supportsSync() const; - void setSupportsSync(bool newSupportsSync); - - DeviceProfile * deviceProfile() const; - void setDeviceProfile(DeviceProfile * newDeviceProfile); - - QString appStoreUrl() const; - void setAppStoreUrl(QString newAppStoreUrl); - QString iconUrl() const; + /** + * @brief Gets or sets the icon url. + */ void setIconUrl(QString newIconUrl); - -signals: - void playableMediaTypesChanged(QStringList newPlayableMediaTypes); - void supportedCommandsChanged(QList newSupportedCommands); - void supportsMediaControlChanged(bool newSupportsMediaControl); - void supportsContentUploadingChanged(bool newSupportsContentUploading); - void messageCallbackUrlChanged(QString newMessageCallbackUrl); - void supportsPersistentIdentifierChanged(bool newSupportsPersistentIdentifier); - void supportsSyncChanged(bool newSupportsSync); - void deviceProfileChanged(DeviceProfile * newDeviceProfile); - void appStoreUrlChanged(QString newAppStoreUrl); - void iconUrlChanged(QString newIconUrl); + protected: QStringList m_playableMediaTypes; QList m_supportedCommands; @@ -138,11 +139,23 @@ protected: QString m_messageCallbackUrl; bool m_supportsPersistentIdentifier; bool m_supportsSync; - DeviceProfile * m_deviceProfile = nullptr; + QSharedPointer m_deviceProfile = nullptr; QString m_appStoreUrl; QString m_iconUrl; }; +} // NS DTO + +namespace Support { + +using ClientCapabilitiesDto = Jellyfin::DTO::ClientCapabilitiesDto; + +template <> +ClientCapabilitiesDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ClientCapabilitiesDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/codecprofile.h b/core/include/JellyfinQt/DTO/codecprofile.h index 94c08cb..4d7b317 100644 --- a/core/include/JellyfinQt/DTO/codecprofile.h +++ b/core/include/JellyfinQt/DTO/codecprofile.h @@ -31,62 +31,70 @@ #define JELLYFIN_DTO_CODECPROFILE_H #include +#include #include -#include +#include #include #include +#include #include "JellyfinQt/DTO/codectype.h" +#include "JellyfinQt/DTO/profilecondition.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ProfileCondition; -class ProfileCondition; -class CodecProfile : public QObject { - Q_OBJECT +class CodecProfile { public: - explicit CodecProfile(QObject *parent = nullptr); - static CodecProfile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(CodecType type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QList conditions READ conditions WRITE setConditions NOTIFY conditionsChanged) - Q_PROPERTY(QList applyConditions READ applyConditions WRITE setApplyConditions NOTIFY applyConditionsChanged) - Q_PROPERTY(QString codec READ codec WRITE setCodec NOTIFY codecChanged) - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) + explicit CodecProfile(); + static CodecProfile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties CodecType type() const; + void setType(CodecType newType); - - QList conditions() const; - void setConditions(QList newConditions); - - QList applyConditions() const; - void setApplyConditions(QList newApplyConditions); - + + QList> conditions() const; + + void setConditions(QList> newConditions); + + QList> applyConditions() const; + + void setApplyConditions(QList> newApplyConditions); + QString codec() const; + void setCodec(QString newCodec); - + QString container() const; + void setContainer(QString newContainer); - -signals: - void typeChanged(CodecType newType); - void conditionsChanged(QList newConditions); - void applyConditionsChanged(QList newApplyConditions); - void codecChanged(QString newCodec); - void containerChanged(QString newContainer); + protected: CodecType m_type; - QList m_conditions; - QList m_applyConditions; + QList> m_conditions; + QList> m_applyConditions; QString m_codec; QString m_container; }; +} // NS DTO + +namespace Support { + +using CodecProfile = Jellyfin::DTO::CodecProfile; + +template <> +CodecProfile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return CodecProfile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/codectype.h b/core/include/JellyfinQt/DTO/codectype.h index 6f71e20..2ab8e59 100644 --- a/core/include/JellyfinQt/DTO/codectype.h +++ b/core/include/JellyfinQt/DTO/codectype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_CODECTYPE_H #define JELLYFIN_DTO_CODECTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class CodecTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Video, VideoAudio, Audio, @@ -47,8 +52,34 @@ public: private: explicit CodecTypeClass(); }; + typedef CodecTypeClass::Value CodecType; +} // NS DTO + +namespace Support { + +using CodecType = Jellyfin::DTO::CodecType; +using CodecTypeClass = Jellyfin::DTO::CodecTypeClass; + +template <> +CodecType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return CodecTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Video")) { + return CodecTypeClass::Video; + } + if (str == QStringLiteral("VideoAudio")) { + return CodecTypeClass::VideoAudio; + } + if (str == QStringLiteral("Audio")) { + return CodecTypeClass::Audio; + } + + return CodecTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/collectioncreationresult.h b/core/include/JellyfinQt/DTO/collectioncreationresult.h index b64fc31..933fe1f 100644 --- a/core/include/JellyfinQt/DTO/collectioncreationresult.h +++ b/core/include/JellyfinQt/DTO/collectioncreationresult.h @@ -31,31 +31,45 @@ #define JELLYFIN_DTO_COLLECTIONCREATIONRESULT_H #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class CollectionCreationResult : public QObject { - Q_OBJECT + +class CollectionCreationResult { public: - explicit CollectionCreationResult(QObject *parent = nullptr); - static CollectionCreationResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); + explicit CollectionCreationResult(); + static CollectionCreationResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); -signals: - void jellyfinIdChanged(QString newJellyfinId); + // Properties + + QUuid jellyfinId() const; + + void setJellyfinId(QUuid newJellyfinId); + protected: - QString m_jellyfinId; + QUuid m_jellyfinId; }; +} // NS DTO + +namespace Support { + +using CollectionCreationResult = Jellyfin::DTO::CollectionCreationResult; + +template <> +CollectionCreationResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return CollectionCreationResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/configurationpageinfo.h b/core/include/JellyfinQt/DTO/configurationpageinfo.h index f26f6c2..5363fcc 100644 --- a/core/include/JellyfinQt/DTO/configurationpageinfo.h +++ b/core/include/JellyfinQt/DTO/configurationpageinfo.h @@ -31,77 +31,79 @@ #define JELLYFIN_DTO_CONFIGURATIONPAGEINFO_H #include -#include +#include #include +#include +#include #include "JellyfinQt/DTO/configurationpagetype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ConfigurationPageInfo : public QObject { - Q_OBJECT -public: - explicit ConfigurationPageInfo(QObject *parent = nullptr); - static ConfigurationPageInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ConfigurationPageInfo { +public: + explicit ConfigurationPageInfo(); + static ConfigurationPageInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets a value indicating whether the configurations page is enabled in the main menu. */ - Q_PROPERTY(bool enableInMainMenu READ enableInMainMenu WRITE setEnableInMainMenu NOTIFY enableInMainMenuChanged) + bool enableInMainMenu() const; + /** + * @brief Gets or sets a value indicating whether the configurations page is enabled in the main menu. + */ + void setEnableInMainMenu(bool newEnableInMainMenu); /** * @brief Gets or sets the menu section. */ - Q_PROPERTY(QString menuSection READ menuSection WRITE setMenuSection NOTIFY menuSectionChanged) + QString menuSection() const; + /** + * @brief Gets or sets the menu section. + */ + void setMenuSection(QString newMenuSection); /** * @brief Gets or sets the menu icon. */ - Q_PROPERTY(QString menuIcon READ menuIcon WRITE setMenuIcon NOTIFY menuIconChanged) + QString menuIcon() const; + /** + * @brief Gets or sets the menu icon. + */ + void setMenuIcon(QString newMenuIcon); /** * @brief Gets or sets the display name. */ - Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged) - Q_PROPERTY(ConfigurationPageType configurationPageType READ configurationPageType WRITE setConfigurationPageType NOTIFY configurationPageTypeChanged) + QString displayName() const; + /** + * @brief Gets or sets the display name. + */ + void setDisplayName(QString newDisplayName); + + ConfigurationPageType configurationPageType() const; + + void setConfigurationPageType(ConfigurationPageType newConfigurationPageType); /** * @brief Gets or sets the plugin id. */ - Q_PROPERTY(QString pluginId READ pluginId WRITE setPluginId NOTIFY pluginIdChanged) + QUuid pluginId() const; + /** + * @brief Gets or sets the plugin id. + */ + void setPluginId(QUuid newPluginId); - QString name() const; - void setName(QString newName); - - bool enableInMainMenu() const; - void setEnableInMainMenu(bool newEnableInMainMenu); - - QString menuSection() const; - void setMenuSection(QString newMenuSection); - - QString menuIcon() const; - void setMenuIcon(QString newMenuIcon); - - QString displayName() const; - void setDisplayName(QString newDisplayName); - - ConfigurationPageType configurationPageType() const; - void setConfigurationPageType(ConfigurationPageType newConfigurationPageType); - - QString pluginId() const; - void setPluginId(QString newPluginId); - -signals: - void nameChanged(QString newName); - void enableInMainMenuChanged(bool newEnableInMainMenu); - void menuSectionChanged(QString newMenuSection); - void menuIconChanged(QString newMenuIcon); - void displayNameChanged(QString newDisplayName); - void configurationPageTypeChanged(ConfigurationPageType newConfigurationPageType); - void pluginIdChanged(QString newPluginId); protected: QString m_name; bool m_enableInMainMenu; @@ -109,9 +111,21 @@ protected: QString m_menuIcon; QString m_displayName; ConfigurationPageType m_configurationPageType; - QString m_pluginId; + QUuid m_pluginId; }; +} // NS DTO + +namespace Support { + +using ConfigurationPageInfo = Jellyfin::DTO::ConfigurationPageInfo; + +template <> +ConfigurationPageInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ConfigurationPageInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/configurationpagetype.h b/core/include/JellyfinQt/DTO/configurationpagetype.h index 4e1c489..3981dd7 100644 --- a/core/include/JellyfinQt/DTO/configurationpagetype.h +++ b/core/include/JellyfinQt/DTO/configurationpagetype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_CONFIGURATIONPAGETYPE_H #define JELLYFIN_DTO_CONFIGURATIONPAGETYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ConfigurationPageTypeClass { Q_GADGET public: enum Value { + EnumNotSet, PluginConfiguration, None, }; @@ -46,8 +51,31 @@ public: private: explicit ConfigurationPageTypeClass(); }; + typedef ConfigurationPageTypeClass::Value ConfigurationPageType; +} // NS DTO + +namespace Support { + +using ConfigurationPageType = Jellyfin::DTO::ConfigurationPageType; +using ConfigurationPageTypeClass = Jellyfin::DTO::ConfigurationPageTypeClass; + +template <> +ConfigurationPageType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ConfigurationPageTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("PluginConfiguration")) { + return ConfigurationPageTypeClass::PluginConfiguration; + } + if (str == QStringLiteral("None")) { + return ConfigurationPageTypeClass::None; + } + + return ConfigurationPageTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/containerprofile.h b/core/include/JellyfinQt/DTO/containerprofile.h index b97c696..f7c7010 100644 --- a/core/include/JellyfinQt/DTO/containerprofile.h +++ b/core/include/JellyfinQt/DTO/containerprofile.h @@ -31,49 +31,60 @@ #define JELLYFIN_DTO_CONTAINERPROFILE_H #include +#include #include -#include +#include #include #include +#include #include "JellyfinQt/DTO/dlnaprofiletype.h" +#include "JellyfinQt/DTO/profilecondition.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ProfileCondition; -class ContainerProfile : public QObject { - Q_OBJECT +class ContainerProfile { public: - explicit ContainerProfile(QObject *parent = nullptr); - static ContainerProfile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(DlnaProfileType type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QList conditions READ conditions WRITE setConditions NOTIFY conditionsChanged) - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) + explicit ContainerProfile(); + static ContainerProfile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties DlnaProfileType type() const; + void setType(DlnaProfileType newType); - - QList conditions() const; - void setConditions(QList newConditions); - + + QList> conditions() const; + + void setConditions(QList> newConditions); + QString container() const; + void setContainer(QString newContainer); - -signals: - void typeChanged(DlnaProfileType newType); - void conditionsChanged(QList newConditions); - void containerChanged(QString newContainer); + protected: DlnaProfileType m_type; - QList m_conditions; + QList> m_conditions; QString m_container; }; +} // NS DTO + +namespace Support { + +using ContainerProfile = Jellyfin::DTO::ContainerProfile; + +template <> +ContainerProfile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ContainerProfile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/controlresponse.h b/core/include/JellyfinQt/DTO/controlresponse.h index 39f6bb5..259731e 100644 --- a/core/include/JellyfinQt/DTO/controlresponse.h +++ b/core/include/JellyfinQt/DTO/controlresponse.h @@ -31,43 +31,55 @@ #define JELLYFIN_DTO_CONTROLRESPONSE_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ControlResponse : public QObject { - Q_OBJECT -public: - explicit ControlResponse(QObject *parent = nullptr); - static ControlResponse *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QJsonObject headers READ headers WRITE setHeaders NOTIFY headersChanged) - Q_PROPERTY(QString xml READ xml WRITE setXml NOTIFY xmlChanged) - Q_PROPERTY(bool isSuccessful READ isSuccessful WRITE setIsSuccessful NOTIFY isSuccessfulChanged) +class ControlResponse { +public: + explicit ControlResponse(); + static ControlResponse fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QJsonObject headers() const; + void setHeaders(QJsonObject newHeaders); - + QString xml() const; + void setXml(QString newXml); - + bool isSuccessful() const; + void setIsSuccessful(bool newIsSuccessful); - -signals: - void headersChanged(QJsonObject newHeaders); - void xmlChanged(QString newXml); - void isSuccessfulChanged(bool newIsSuccessful); + protected: QJsonObject m_headers; QString m_xml; bool m_isSuccessful; }; +} // NS DTO + +namespace Support { + +using ControlResponse = Jellyfin::DTO::ControlResponse; + +template <> +ControlResponse fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ControlResponse::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/countryinfo.h b/core/include/JellyfinQt/DTO/countryinfo.h index 54fd6bd..9400207 100644 --- a/core/include/JellyfinQt/DTO/countryinfo.h +++ b/core/include/JellyfinQt/DTO/countryinfo.h @@ -31,54 +31,57 @@ #define JELLYFIN_DTO_COUNTRYINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class CountryInfo : public QObject { - Q_OBJECT -public: - explicit CountryInfo(QObject *parent = nullptr); - static CountryInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class CountryInfo { +public: + explicit CountryInfo(); + static CountryInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the display name. */ - Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged) + QString displayName() const; + /** + * @brief Gets or sets the display name. + */ + void setDisplayName(QString newDisplayName); /** * @brief Gets or sets the name of the two letter ISO region. */ - Q_PROPERTY(QString twoLetterISORegionName READ twoLetterISORegionName WRITE setTwoLetterISORegionName NOTIFY twoLetterISORegionNameChanged) + QString twoLetterISORegionName() const; + /** + * @brief Gets or sets the name of the two letter ISO region. + */ + void setTwoLetterISORegionName(QString newTwoLetterISORegionName); /** * @brief Gets or sets the name of the three letter ISO region. */ - Q_PROPERTY(QString threeLetterISORegionName READ threeLetterISORegionName WRITE setThreeLetterISORegionName NOTIFY threeLetterISORegionNameChanged) - - QString name() const; - void setName(QString newName); - - QString displayName() const; - void setDisplayName(QString newDisplayName); - - QString twoLetterISORegionName() const; - void setTwoLetterISORegionName(QString newTwoLetterISORegionName); - QString threeLetterISORegionName() const; + /** + * @brief Gets or sets the name of the three letter ISO region. + */ void setThreeLetterISORegionName(QString newThreeLetterISORegionName); - -signals: - void nameChanged(QString newName); - void displayNameChanged(QString newDisplayName); - void twoLetterISORegionNameChanged(QString newTwoLetterISORegionName); - void threeLetterISORegionNameChanged(QString newThreeLetterISORegionName); + protected: QString m_name; QString m_displayName; @@ -86,6 +89,18 @@ protected: QString m_threeLetterISORegionName; }; +} // NS DTO + +namespace Support { + +using CountryInfo = Jellyfin::DTO::CountryInfo; + +template <> +CountryInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return CountryInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/createplaylistdto.h b/core/include/JellyfinQt/DTO/createplaylistdto.h index 783a5dd..2d530b3 100644 --- a/core/include/JellyfinQt/DTO/createplaylistdto.h +++ b/core/include/JellyfinQt/DTO/createplaylistdto.h @@ -31,63 +31,79 @@ #define JELLYFIN_DTO_CREATEPLAYLISTDTO_H #include +#include #include -#include #include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class CreatePlaylistDto : public QObject { - Q_OBJECT -public: - explicit CreatePlaylistDto(QObject *parent = nullptr); - static CreatePlaylistDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class CreatePlaylistDto { +public: + explicit CreatePlaylistDto(); + static CreatePlaylistDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name of the new playlist. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name of the new playlist. + */ + void setName(QString newName); /** * @brief Gets or sets item ids to add to the playlist. */ - Q_PROPERTY(QStringList ids READ ids WRITE setIds NOTIFY idsChanged) + QList ids() const; + /** + * @brief Gets or sets item ids to add to the playlist. + */ + void setIds(QList newIds); /** * @brief Gets or sets the user id. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets the user id. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets the media type. */ - Q_PROPERTY(QString mediaType READ mediaType WRITE setMediaType NOTIFY mediaTypeChanged) - - QString name() const; - void setName(QString newName); - - QStringList ids() const; - void setIds(QStringList newIds); - - QString userId() const; - void setUserId(QString newUserId); - QString mediaType() const; + /** + * @brief Gets or sets the media type. + */ void setMediaType(QString newMediaType); - -signals: - void nameChanged(QString newName); - void idsChanged(QStringList newIds); - void userIdChanged(QString newUserId); - void mediaTypeChanged(QString newMediaType); + protected: QString m_name; - QStringList m_ids; - QString m_userId; + QList m_ids; + QUuid m_userId; QString m_mediaType; }; +} // NS DTO + +namespace Support { + +using CreatePlaylistDto = Jellyfin::DTO::CreatePlaylistDto; + +template <> +CreatePlaylistDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return CreatePlaylistDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/createuserbyname.h b/core/include/JellyfinQt/DTO/createuserbyname.h index dfb5cf4..c85735b 100644 --- a/core/include/JellyfinQt/DTO/createuserbyname.h +++ b/core/include/JellyfinQt/DTO/createuserbyname.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_CREATEUSERBYNAME_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class CreateUserByName : public QObject { - Q_OBJECT -public: - explicit CreateUserByName(QObject *parent = nullptr); - static CreateUserByName *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class CreateUserByName { +public: + explicit CreateUserByName(); + static CreateUserByName fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the username. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the username. + */ + void setName(QString newName); /** * @brief Gets or sets the password. */ - Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) - - QString name() const; - void setName(QString newName); - QString password() const; + /** + * @brief Gets or sets the password. + */ void setPassword(QString newPassword); - -signals: - void nameChanged(QString newName); - void passwordChanged(QString newPassword); + protected: QString m_name; QString m_password; }; +} // NS DTO + +namespace Support { + +using CreateUserByName = Jellyfin::DTO::CreateUserByName; + +template <> +CreateUserByName fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return CreateUserByName::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/culturedto.h b/core/include/JellyfinQt/DTO/culturedto.h index 8d37650..01d2505 100644 --- a/core/include/JellyfinQt/DTO/culturedto.h +++ b/core/include/JellyfinQt/DTO/culturedto.h @@ -31,61 +31,63 @@ #define JELLYFIN_DTO_CULTUREDTO_H #include +#include #include -#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class CultureDto : public QObject { - Q_OBJECT -public: - explicit CultureDto(QObject *parent = nullptr); - static CultureDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class CultureDto { +public: + explicit CultureDto(); + static CultureDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the display name. */ - Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged) + QString displayName() const; + /** + * @brief Gets or sets the display name. + */ + void setDisplayName(QString newDisplayName); /** * @brief Gets or sets the name of the two letter ISO language. */ - Q_PROPERTY(QString twoLetterISOLanguageName READ twoLetterISOLanguageName WRITE setTwoLetterISOLanguageName NOTIFY twoLetterISOLanguageNameChanged) + QString twoLetterISOLanguageName() const; + /** + * @brief Gets or sets the name of the two letter ISO language. + */ + void setTwoLetterISOLanguageName(QString newTwoLetterISOLanguageName); /** * @brief Gets or sets the name of the three letter ISO language. */ - Q_PROPERTY(QString threeLetterISOLanguageName READ threeLetterISOLanguageName WRITE setThreeLetterISOLanguageName NOTIFY threeLetterISOLanguageNameChanged) - Q_PROPERTY(QStringList threeLetterISOLanguageNames READ threeLetterISOLanguageNames WRITE setThreeLetterISOLanguageNames NOTIFY threeLetterISOLanguageNamesChanged) - - QString name() const; - void setName(QString newName); - - QString displayName() const; - void setDisplayName(QString newDisplayName); - - QString twoLetterISOLanguageName() const; - void setTwoLetterISOLanguageName(QString newTwoLetterISOLanguageName); - QString threeLetterISOLanguageName() const; + /** + * @brief Gets or sets the name of the three letter ISO language. + */ void setThreeLetterISOLanguageName(QString newThreeLetterISOLanguageName); - + QStringList threeLetterISOLanguageNames() const; + void setThreeLetterISOLanguageNames(QStringList newThreeLetterISOLanguageNames); - -signals: - void nameChanged(QString newName); - void displayNameChanged(QString newDisplayName); - void twoLetterISOLanguageNameChanged(QString newTwoLetterISOLanguageName); - void threeLetterISOLanguageNameChanged(QString newThreeLetterISOLanguageName); - void threeLetterISOLanguageNamesChanged(QStringList newThreeLetterISOLanguageNames); + protected: QString m_name; QString m_displayName; @@ -94,6 +96,18 @@ protected: QStringList m_threeLetterISOLanguageNames; }; +} // NS DTO + +namespace Support { + +using CultureDto = Jellyfin::DTO::CultureDto; + +template <> +CultureDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return CultureDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/dayofweek.h b/core/include/JellyfinQt/DTO/dayofweek.h index 3dede3e..fba7e1a 100644 --- a/core/include/JellyfinQt/DTO/dayofweek.h +++ b/core/include/JellyfinQt/DTO/dayofweek.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_DAYOFWEEK_H #define JELLYFIN_DTO_DAYOFWEEK_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class DayOfWeekClass { Q_GADGET public: enum Value { + EnumNotSet, Sunday, Monday, Tuesday, @@ -51,8 +56,46 @@ public: private: explicit DayOfWeekClass(); }; + typedef DayOfWeekClass::Value DayOfWeek; +} // NS DTO + +namespace Support { + +using DayOfWeek = Jellyfin::DTO::DayOfWeek; +using DayOfWeekClass = Jellyfin::DTO::DayOfWeekClass; + +template <> +DayOfWeek fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return DayOfWeekClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Sunday")) { + return DayOfWeekClass::Sunday; + } + if (str == QStringLiteral("Monday")) { + return DayOfWeekClass::Monday; + } + if (str == QStringLiteral("Tuesday")) { + return DayOfWeekClass::Tuesday; + } + if (str == QStringLiteral("Wednesday")) { + return DayOfWeekClass::Wednesday; + } + if (str == QStringLiteral("Thursday")) { + return DayOfWeekClass::Thursday; + } + if (str == QStringLiteral("Friday")) { + return DayOfWeekClass::Friday; + } + if (str == QStringLiteral("Saturday")) { + return DayOfWeekClass::Saturday; + } + + return DayOfWeekClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/daypattern.h b/core/include/JellyfinQt/DTO/daypattern.h index b8ee2c8..fe5ebee 100644 --- a/core/include/JellyfinQt/DTO/daypattern.h +++ b/core/include/JellyfinQt/DTO/daypattern.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_DAYPATTERN_H #define JELLYFIN_DTO_DAYPATTERN_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class DayPatternClass { Q_GADGET public: enum Value { + EnumNotSet, Daily, Weekdays, Weekends, @@ -47,8 +52,34 @@ public: private: explicit DayPatternClass(); }; + typedef DayPatternClass::Value DayPattern; +} // NS DTO + +namespace Support { + +using DayPattern = Jellyfin::DTO::DayPattern; +using DayPatternClass = Jellyfin::DTO::DayPatternClass; + +template <> +DayPattern fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return DayPatternClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Daily")) { + return DayPatternClass::Daily; + } + if (str == QStringLiteral("Weekdays")) { + return DayPatternClass::Weekdays; + } + if (str == QStringLiteral("Weekends")) { + return DayPatternClass::Weekends; + } + + return DayPatternClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/defaultdirectorybrowserinfodto.h b/core/include/JellyfinQt/DTO/defaultdirectorybrowserinfodto.h index 7521995..23bb219 100644 --- a/core/include/JellyfinQt/DTO/defaultdirectorybrowserinfodto.h +++ b/core/include/JellyfinQt/DTO/defaultdirectorybrowserinfodto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_DEFAULTDIRECTORYBROWSERINFODTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DefaultDirectoryBrowserInfoDto : public QObject { - Q_OBJECT -public: - explicit DefaultDirectoryBrowserInfoDto(QObject *parent = nullptr); - static DefaultDirectoryBrowserInfoDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class DefaultDirectoryBrowserInfoDto { +public: + explicit DefaultDirectoryBrowserInfoDto(); + static DefaultDirectoryBrowserInfoDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - QString path() const; + /** + * @brief Gets or sets the path. + */ void setPath(QString newPath); - -signals: - void pathChanged(QString newPath); + protected: QString m_path; }; +} // NS DTO + +namespace Support { + +using DefaultDirectoryBrowserInfoDto = Jellyfin::DTO::DefaultDirectoryBrowserInfoDto; + +template <> +DefaultDirectoryBrowserInfoDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DefaultDirectoryBrowserInfoDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/deviceidentification.h b/core/include/JellyfinQt/DTO/deviceidentification.h index a012516..6db8525 100644 --- a/core/include/JellyfinQt/DTO/deviceidentification.h +++ b/core/include/JellyfinQt/DTO/deviceidentification.h @@ -31,98 +31,101 @@ #define JELLYFIN_DTO_DEVICEIDENTIFICATION_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/httpheaderinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class HttpHeaderInfo; -class DeviceIdentification : public QObject { - Q_OBJECT +class DeviceIdentification { public: - explicit DeviceIdentification(QObject *parent = nullptr); - static DeviceIdentification *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit DeviceIdentification(); + static DeviceIdentification fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name of the friendly. */ - Q_PROPERTY(QString friendlyName READ friendlyName WRITE setFriendlyName NOTIFY friendlyNameChanged) + QString friendlyName() const; + /** + * @brief Gets or sets the name of the friendly. + */ + void setFriendlyName(QString newFriendlyName); /** * @brief Gets or sets the model number. */ - Q_PROPERTY(QString modelNumber READ modelNumber WRITE setModelNumber NOTIFY modelNumberChanged) + QString modelNumber() const; + /** + * @brief Gets or sets the model number. + */ + void setModelNumber(QString newModelNumber); /** * @brief Gets or sets the serial number. */ - Q_PROPERTY(QString serialNumber READ serialNumber WRITE setSerialNumber NOTIFY serialNumberChanged) + QString serialNumber() const; + /** + * @brief Gets or sets the serial number. + */ + void setSerialNumber(QString newSerialNumber); /** * @brief Gets or sets the name of the model. */ - Q_PROPERTY(QString modelName READ modelName WRITE setModelName NOTIFY modelNameChanged) + QString modelName() const; + /** + * @brief Gets or sets the name of the model. + */ + void setModelName(QString newModelName); /** * @brief Gets or sets the model description. */ - Q_PROPERTY(QString modelDescription READ modelDescription WRITE setModelDescription NOTIFY modelDescriptionChanged) + QString modelDescription() const; + /** + * @brief Gets or sets the model description. + */ + void setModelDescription(QString newModelDescription); /** * @brief Gets or sets the model URL. */ - Q_PROPERTY(QString modelUrl READ modelUrl WRITE setModelUrl NOTIFY modelUrlChanged) + QString modelUrl() const; + /** + * @brief Gets or sets the model URL. + */ + void setModelUrl(QString newModelUrl); /** * @brief Gets or sets the manufacturer. */ - Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged) + QString manufacturer() const; + /** + * @brief Gets or sets the manufacturer. + */ + void setManufacturer(QString newManufacturer); /** * @brief Gets or sets the manufacturer URL. */ - Q_PROPERTY(QString manufacturerUrl READ manufacturerUrl WRITE setManufacturerUrl NOTIFY manufacturerUrlChanged) + QString manufacturerUrl() const; + /** + * @brief Gets or sets the manufacturer URL. + */ + void setManufacturerUrl(QString newManufacturerUrl); /** * @brief Gets or sets the headers. */ - Q_PROPERTY(QList headers READ headers WRITE setHeaders NOTIFY headersChanged) + QList> headers() const; + /** + * @brief Gets or sets the headers. + */ + void setHeaders(QList> newHeaders); - QString friendlyName() const; - void setFriendlyName(QString newFriendlyName); - - QString modelNumber() const; - void setModelNumber(QString newModelNumber); - - QString serialNumber() const; - void setSerialNumber(QString newSerialNumber); - - QString modelName() const; - void setModelName(QString newModelName); - - QString modelDescription() const; - void setModelDescription(QString newModelDescription); - - QString modelUrl() const; - void setModelUrl(QString newModelUrl); - - QString manufacturer() const; - void setManufacturer(QString newManufacturer); - - QString manufacturerUrl() const; - void setManufacturerUrl(QString newManufacturerUrl); - - QList headers() const; - void setHeaders(QList newHeaders); - -signals: - void friendlyNameChanged(QString newFriendlyName); - void modelNumberChanged(QString newModelNumber); - void serialNumberChanged(QString newSerialNumber); - void modelNameChanged(QString newModelName); - void modelDescriptionChanged(QString newModelDescription); - void modelUrlChanged(QString newModelUrl); - void manufacturerChanged(QString newManufacturer); - void manufacturerUrlChanged(QString newManufacturerUrl); - void headersChanged(QList newHeaders); protected: QString m_friendlyName; QString m_modelNumber; @@ -132,9 +135,21 @@ protected: QString m_modelUrl; QString m_manufacturer; QString m_manufacturerUrl; - QList m_headers; + QList> m_headers; }; +} // NS DTO + +namespace Support { + +using DeviceIdentification = Jellyfin::DTO::DeviceIdentification; + +template <> +DeviceIdentification fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DeviceIdentification::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/deviceinfo.h b/core/include/JellyfinQt/DTO/deviceinfo.h index dc540e3..636659b 100644 --- a/core/include/JellyfinQt/DTO/deviceinfo.h +++ b/core/include/JellyfinQt/DTO/deviceinfo.h @@ -32,99 +32,112 @@ #include #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/clientcapabilities.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ClientCapabilities; -class DeviceInfo : public QObject { - Q_OBJECT +class DeviceInfo { public: - explicit DeviceInfo(QObject *parent = nullptr); - static DeviceInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit DeviceInfo(); + static DeviceInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + + void setName(QString newName); /** * @brief Gets or sets the identifier. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the identifier. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets the last name of the user. */ - Q_PROPERTY(QString lastUserName READ lastUserName WRITE setLastUserName NOTIFY lastUserNameChanged) + QString lastUserName() const; + /** + * @brief Gets or sets the last name of the user. + */ + void setLastUserName(QString newLastUserName); /** * @brief Gets or sets the name of the application. */ - Q_PROPERTY(QString appName READ appName WRITE setAppName NOTIFY appNameChanged) + QString appName() const; + /** + * @brief Gets or sets the name of the application. + */ + void setAppName(QString newAppName); /** * @brief Gets or sets the application version. */ - Q_PROPERTY(QString appVersion READ appVersion WRITE setAppVersion NOTIFY appVersionChanged) + QString appVersion() const; + /** + * @brief Gets or sets the application version. + */ + void setAppVersion(QString newAppVersion); /** * @brief Gets or sets the last user identifier. */ - Q_PROPERTY(QString lastUserId READ lastUserId WRITE setLastUserId NOTIFY lastUserIdChanged) + QUuid lastUserId() const; + /** + * @brief Gets or sets the last user identifier. + */ + void setLastUserId(QUuid newLastUserId); /** * @brief Gets or sets the date last modified. */ - Q_PROPERTY(QDateTime dateLastActivity READ dateLastActivity WRITE setDateLastActivity NOTIFY dateLastActivityChanged) - Q_PROPERTY(ClientCapabilities * capabilities READ capabilities WRITE setCapabilities NOTIFY capabilitiesChanged) - Q_PROPERTY(QString iconUrl READ iconUrl WRITE setIconUrl NOTIFY iconUrlChanged) - - QString name() const; - void setName(QString newName); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString lastUserName() const; - void setLastUserName(QString newLastUserName); - - QString appName() const; - void setAppName(QString newAppName); - - QString appVersion() const; - void setAppVersion(QString newAppVersion); - - QString lastUserId() const; - void setLastUserId(QString newLastUserId); - QDateTime dateLastActivity() const; + /** + * @brief Gets or sets the date last modified. + */ void setDateLastActivity(QDateTime newDateLastActivity); - - ClientCapabilities * capabilities() const; - void setCapabilities(ClientCapabilities * newCapabilities); - + + QSharedPointer capabilities() const; + + void setCapabilities(QSharedPointer newCapabilities); + QString iconUrl() const; + void setIconUrl(QString newIconUrl); - -signals: - void nameChanged(QString newName); - void jellyfinIdChanged(QString newJellyfinId); - void lastUserNameChanged(QString newLastUserName); - void appNameChanged(QString newAppName); - void appVersionChanged(QString newAppVersion); - void lastUserIdChanged(QString newLastUserId); - void dateLastActivityChanged(QDateTime newDateLastActivity); - void capabilitiesChanged(ClientCapabilities * newCapabilities); - void iconUrlChanged(QString newIconUrl); + protected: QString m_name; QString m_jellyfinId; QString m_lastUserName; QString m_appName; QString m_appVersion; - QString m_lastUserId; + QUuid m_lastUserId; QDateTime m_dateLastActivity; - ClientCapabilities * m_capabilities = nullptr; + QSharedPointer m_capabilities = nullptr; QString m_iconUrl; }; +} // NS DTO + +namespace Support { + +using DeviceInfo = Jellyfin::DTO::DeviceInfo; + +template <> +DeviceInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DeviceInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/deviceinfoqueryresult.h b/core/include/JellyfinQt/DTO/deviceinfoqueryresult.h index 23b3441..0e9d3b4 100644 --- a/core/include/JellyfinQt/DTO/deviceinfoqueryresult.h +++ b/core/include/JellyfinQt/DTO/deviceinfoqueryresult.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_DEVICEINFOQUERYRESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/deviceinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DeviceInfo; -class DeviceInfoQueryResult : public QObject { - Q_OBJECT +class DeviceInfoQueryResult { public: - explicit DeviceInfoQueryResult(QObject *parent = nullptr); - static DeviceInfoQueryResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit DeviceInfoQueryResult(); + static DeviceInfoQueryResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items. */ - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) + QList> items() const; + /** + * @brief Gets or sets the items. + */ + void setItems(QList> newItems); /** * @brief The total number of records available. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief The total number of records available. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief The index of the first record in Items. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) - - QList items() const; - void setItems(QList newItems); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - qint32 startIndex() const; + /** + * @brief The index of the first record in Items. + */ void setStartIndex(qint32 newStartIndex); - -signals: - void itemsChanged(QList newItems); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void startIndexChanged(qint32 newStartIndex); + protected: - QList m_items; + QList> m_items; qint32 m_totalRecordCount; qint32 m_startIndex; }; +} // NS DTO + +namespace Support { + +using DeviceInfoQueryResult = Jellyfin::DTO::DeviceInfoQueryResult; + +template <> +DeviceInfoQueryResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DeviceInfoQueryResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/deviceoptions.h b/core/include/JellyfinQt/DTO/deviceoptions.h index 6a5ef02..94e6064 100644 --- a/core/include/JellyfinQt/DTO/deviceoptions.h +++ b/core/include/JellyfinQt/DTO/deviceoptions.h @@ -31,31 +31,45 @@ #define JELLYFIN_DTO_DEVICEOPTIONS_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DeviceOptions : public QObject { - Q_OBJECT -public: - explicit DeviceOptions(QObject *parent = nullptr); - static DeviceOptions *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString customName READ customName WRITE setCustomName NOTIFY customNameChanged) +class DeviceOptions { +public: + explicit DeviceOptions(); + static DeviceOptions fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString customName() const; + void setCustomName(QString newCustomName); - -signals: - void customNameChanged(QString newCustomName); + protected: QString m_customName; }; +} // NS DTO + +namespace Support { + +using DeviceOptions = Jellyfin::DTO::DeviceOptions; + +template <> +DeviceOptions fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DeviceOptions::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/deviceprofile.h b/core/include/JellyfinQt/DTO/deviceprofile.h index 5569b4f..4e4125c 100644 --- a/core/include/JellyfinQt/DTO/deviceprofile.h +++ b/core/include/JellyfinQt/DTO/deviceprofile.h @@ -31,346 +31,348 @@ #define JELLYFIN_DTO_DEVICEPROFILE_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/codecprofile.h" +#include "JellyfinQt/DTO/containerprofile.h" +#include "JellyfinQt/DTO/deviceidentification.h" +#include "JellyfinQt/DTO/directplayprofile.h" +#include "JellyfinQt/DTO/responseprofile.h" +#include "JellyfinQt/DTO/subtitleprofile.h" +#include "JellyfinQt/DTO/transcodingprofile.h" +#include "JellyfinQt/DTO/xmlattribute.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class CodecProfile; -class ContainerProfile; -class DeviceIdentification; -class DirectPlayProfile; -class ResponseProfile; -class SubtitleProfile; -class TranscodingProfile; -class XmlAttribute; -class DeviceProfile : public QObject { - Q_OBJECT +class DeviceProfile { public: - explicit DeviceProfile(QObject *parent = nullptr); - static DeviceProfile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit DeviceProfile(); + static DeviceProfile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the Name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the Name. + */ + void setName(QString newName); /** * @brief Gets or sets the Id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(DeviceIdentification * identification READ identification WRITE setIdentification NOTIFY identificationChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the Id. + */ + void setJellyfinId(QString newJellyfinId); + + QSharedPointer identification() const; + + void setIdentification(QSharedPointer newIdentification); /** * @brief Gets or sets the FriendlyName. */ - Q_PROPERTY(QString friendlyName READ friendlyName WRITE setFriendlyName NOTIFY friendlyNameChanged) + QString friendlyName() const; + /** + * @brief Gets or sets the FriendlyName. + */ + void setFriendlyName(QString newFriendlyName); /** * @brief Gets or sets the Manufacturer. */ - Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged) + QString manufacturer() const; + /** + * @brief Gets or sets the Manufacturer. + */ + void setManufacturer(QString newManufacturer); /** * @brief Gets or sets the ManufacturerUrl. */ - Q_PROPERTY(QString manufacturerUrl READ manufacturerUrl WRITE setManufacturerUrl NOTIFY manufacturerUrlChanged) + QString manufacturerUrl() const; + /** + * @brief Gets or sets the ManufacturerUrl. + */ + void setManufacturerUrl(QString newManufacturerUrl); /** * @brief Gets or sets the ModelName. */ - Q_PROPERTY(QString modelName READ modelName WRITE setModelName NOTIFY modelNameChanged) + QString modelName() const; + /** + * @brief Gets or sets the ModelName. + */ + void setModelName(QString newModelName); /** * @brief Gets or sets the ModelDescription. */ - Q_PROPERTY(QString modelDescription READ modelDescription WRITE setModelDescription NOTIFY modelDescriptionChanged) + QString modelDescription() const; + /** + * @brief Gets or sets the ModelDescription. + */ + void setModelDescription(QString newModelDescription); /** * @brief Gets or sets the ModelNumber. */ - Q_PROPERTY(QString modelNumber READ modelNumber WRITE setModelNumber NOTIFY modelNumberChanged) + QString modelNumber() const; + /** + * @brief Gets or sets the ModelNumber. + */ + void setModelNumber(QString newModelNumber); /** * @brief Gets or sets the ModelUrl. */ - Q_PROPERTY(QString modelUrl READ modelUrl WRITE setModelUrl NOTIFY modelUrlChanged) + QString modelUrl() const; + /** + * @brief Gets or sets the ModelUrl. + */ + void setModelUrl(QString newModelUrl); /** * @brief Gets or sets the SerialNumber. */ - Q_PROPERTY(QString serialNumber READ serialNumber WRITE setSerialNumber NOTIFY serialNumberChanged) + QString serialNumber() const; + /** + * @brief Gets or sets the SerialNumber. + */ + void setSerialNumber(QString newSerialNumber); /** * @brief Gets or sets a value indicating whether EnableAlbumArtInDidl. */ - Q_PROPERTY(bool enableAlbumArtInDidl READ enableAlbumArtInDidl WRITE setEnableAlbumArtInDidl NOTIFY enableAlbumArtInDidlChanged) + bool enableAlbumArtInDidl() const; + /** + * @brief Gets or sets a value indicating whether EnableAlbumArtInDidl. + */ + void setEnableAlbumArtInDidl(bool newEnableAlbumArtInDidl); /** * @brief Gets or sets a value indicating whether EnableSingleAlbumArtLimit. */ - Q_PROPERTY(bool enableSingleAlbumArtLimit READ enableSingleAlbumArtLimit WRITE setEnableSingleAlbumArtLimit NOTIFY enableSingleAlbumArtLimitChanged) + bool enableSingleAlbumArtLimit() const; + /** + * @brief Gets or sets a value indicating whether EnableSingleAlbumArtLimit. + */ + void setEnableSingleAlbumArtLimit(bool newEnableSingleAlbumArtLimit); /** * @brief Gets or sets a value indicating whether EnableSingleSubtitleLimit. */ - Q_PROPERTY(bool enableSingleSubtitleLimit READ enableSingleSubtitleLimit WRITE setEnableSingleSubtitleLimit NOTIFY enableSingleSubtitleLimitChanged) + bool enableSingleSubtitleLimit() const; + /** + * @brief Gets or sets a value indicating whether EnableSingleSubtitleLimit. + */ + void setEnableSingleSubtitleLimit(bool newEnableSingleSubtitleLimit); /** * @brief Gets or sets the SupportedMediaTypes. */ - Q_PROPERTY(QString supportedMediaTypes READ supportedMediaTypes WRITE setSupportedMediaTypes NOTIFY supportedMediaTypesChanged) + QString supportedMediaTypes() const; + /** + * @brief Gets or sets the SupportedMediaTypes. + */ + void setSupportedMediaTypes(QString newSupportedMediaTypes); /** * @brief Gets or sets the UserId. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QString userId() const; + /** + * @brief Gets or sets the UserId. + */ + void setUserId(QString newUserId); /** * @brief Gets or sets the AlbumArtPn. */ - Q_PROPERTY(QString albumArtPn READ albumArtPn WRITE setAlbumArtPn NOTIFY albumArtPnChanged) + QString albumArtPn() const; + /** + * @brief Gets or sets the AlbumArtPn. + */ + void setAlbumArtPn(QString newAlbumArtPn); /** * @brief Gets or sets the MaxAlbumArtWidth. */ - Q_PROPERTY(qint32 maxAlbumArtWidth READ maxAlbumArtWidth WRITE setMaxAlbumArtWidth NOTIFY maxAlbumArtWidthChanged) + qint32 maxAlbumArtWidth() const; + /** + * @brief Gets or sets the MaxAlbumArtWidth. + */ + void setMaxAlbumArtWidth(qint32 newMaxAlbumArtWidth); /** * @brief Gets or sets the MaxAlbumArtHeight. */ - Q_PROPERTY(qint32 maxAlbumArtHeight READ maxAlbumArtHeight WRITE setMaxAlbumArtHeight NOTIFY maxAlbumArtHeightChanged) + qint32 maxAlbumArtHeight() const; + /** + * @brief Gets or sets the MaxAlbumArtHeight. + */ + void setMaxAlbumArtHeight(qint32 newMaxAlbumArtHeight); /** * @brief Gets or sets the MaxIconWidth. */ - Q_PROPERTY(qint32 maxIconWidth READ maxIconWidth WRITE setMaxIconWidth NOTIFY maxIconWidthChanged) + qint32 maxIconWidth() const; + /** + * @brief Gets or sets the MaxIconWidth. + */ + void setMaxIconWidth(qint32 newMaxIconWidth); /** * @brief Gets or sets the MaxIconHeight. */ - Q_PROPERTY(qint32 maxIconHeight READ maxIconHeight WRITE setMaxIconHeight NOTIFY maxIconHeightChanged) + qint32 maxIconHeight() const; + /** + * @brief Gets or sets the MaxIconHeight. + */ + void setMaxIconHeight(qint32 newMaxIconHeight); /** * @brief Gets or sets the MaxStreamingBitrate. */ - Q_PROPERTY(qint32 maxStreamingBitrate READ maxStreamingBitrate WRITE setMaxStreamingBitrate NOTIFY maxStreamingBitrateChanged) + qint32 maxStreamingBitrate() const; + /** + * @brief Gets or sets the MaxStreamingBitrate. + */ + void setMaxStreamingBitrate(qint32 newMaxStreamingBitrate); /** * @brief Gets or sets the MaxStaticBitrate. */ - Q_PROPERTY(qint32 maxStaticBitrate READ maxStaticBitrate WRITE setMaxStaticBitrate NOTIFY maxStaticBitrateChanged) + qint32 maxStaticBitrate() const; + /** + * @brief Gets or sets the MaxStaticBitrate. + */ + void setMaxStaticBitrate(qint32 newMaxStaticBitrate); /** * @brief Gets or sets the MusicStreamingTranscodingBitrate. */ - Q_PROPERTY(qint32 musicStreamingTranscodingBitrate READ musicStreamingTranscodingBitrate WRITE setMusicStreamingTranscodingBitrate NOTIFY musicStreamingTranscodingBitrateChanged) + qint32 musicStreamingTranscodingBitrate() const; + /** + * @brief Gets or sets the MusicStreamingTranscodingBitrate. + */ + void setMusicStreamingTranscodingBitrate(qint32 newMusicStreamingTranscodingBitrate); /** * @brief Gets or sets the MaxStaticMusicBitrate. */ - Q_PROPERTY(qint32 maxStaticMusicBitrate READ maxStaticMusicBitrate WRITE setMaxStaticMusicBitrate NOTIFY maxStaticMusicBitrateChanged) + qint32 maxStaticMusicBitrate() const; + /** + * @brief Gets or sets the MaxStaticMusicBitrate. + */ + void setMaxStaticMusicBitrate(qint32 newMaxStaticMusicBitrate); /** * @brief Gets or sets the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace. */ - Q_PROPERTY(QString sonyAggregationFlags READ sonyAggregationFlags WRITE setSonyAggregationFlags NOTIFY sonyAggregationFlagsChanged) + QString sonyAggregationFlags() const; + /** + * @brief Gets or sets the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace. + */ + void setSonyAggregationFlags(QString newSonyAggregationFlags); /** * @brief Gets or sets the ProtocolInfo. */ - Q_PROPERTY(QString protocolInfo READ protocolInfo WRITE setProtocolInfo NOTIFY protocolInfoChanged) + QString protocolInfo() const; + /** + * @brief Gets or sets the ProtocolInfo. + */ + void setProtocolInfo(QString newProtocolInfo); /** * @brief Gets or sets the TimelineOffsetSeconds. */ - Q_PROPERTY(qint32 timelineOffsetSeconds READ timelineOffsetSeconds WRITE setTimelineOffsetSeconds NOTIFY timelineOffsetSecondsChanged) + qint32 timelineOffsetSeconds() const; + /** + * @brief Gets or sets the TimelineOffsetSeconds. + */ + void setTimelineOffsetSeconds(qint32 newTimelineOffsetSeconds); /** * @brief Gets or sets a value indicating whether RequiresPlainVideoItems. */ - Q_PROPERTY(bool requiresPlainVideoItems READ requiresPlainVideoItems WRITE setRequiresPlainVideoItems NOTIFY requiresPlainVideoItemsChanged) + bool requiresPlainVideoItems() const; + /** + * @brief Gets or sets a value indicating whether RequiresPlainVideoItems. + */ + void setRequiresPlainVideoItems(bool newRequiresPlainVideoItems); /** * @brief Gets or sets a value indicating whether RequiresPlainFolders. */ - Q_PROPERTY(bool requiresPlainFolders READ requiresPlainFolders WRITE setRequiresPlainFolders NOTIFY requiresPlainFoldersChanged) + bool requiresPlainFolders() const; + /** + * @brief Gets or sets a value indicating whether RequiresPlainFolders. + */ + void setRequiresPlainFolders(bool newRequiresPlainFolders); /** * @brief Gets or sets a value indicating whether EnableMSMediaReceiverRegistrar. */ - Q_PROPERTY(bool enableMSMediaReceiverRegistrar READ enableMSMediaReceiverRegistrar WRITE setEnableMSMediaReceiverRegistrar NOTIFY enableMSMediaReceiverRegistrarChanged) + bool enableMSMediaReceiverRegistrar() const; + /** + * @brief Gets or sets a value indicating whether EnableMSMediaReceiverRegistrar. + */ + void setEnableMSMediaReceiverRegistrar(bool newEnableMSMediaReceiverRegistrar); /** * @brief Gets or sets a value indicating whether IgnoreTranscodeByteRangeRequests. */ - Q_PROPERTY(bool ignoreTranscodeByteRangeRequests READ ignoreTranscodeByteRangeRequests WRITE setIgnoreTranscodeByteRangeRequests NOTIFY ignoreTranscodeByteRangeRequestsChanged) + bool ignoreTranscodeByteRangeRequests() const; + /** + * @brief Gets or sets a value indicating whether IgnoreTranscodeByteRangeRequests. + */ + void setIgnoreTranscodeByteRangeRequests(bool newIgnoreTranscodeByteRangeRequests); /** * @brief Gets or sets the XmlRootAttributes. */ - Q_PROPERTY(QList xmlRootAttributes READ xmlRootAttributes WRITE setXmlRootAttributes NOTIFY xmlRootAttributesChanged) + QList> xmlRootAttributes() const; + /** + * @brief Gets or sets the XmlRootAttributes. + */ + void setXmlRootAttributes(QList> newXmlRootAttributes); /** * @brief Gets or sets the direct play profiles. */ - Q_PROPERTY(QList directPlayProfiles READ directPlayProfiles WRITE setDirectPlayProfiles NOTIFY directPlayProfilesChanged) + QList> directPlayProfiles() const; + /** + * @brief Gets or sets the direct play profiles. + */ + void setDirectPlayProfiles(QList> newDirectPlayProfiles); /** * @brief Gets or sets the transcoding profiles. */ - Q_PROPERTY(QList transcodingProfiles READ transcodingProfiles WRITE setTranscodingProfiles NOTIFY transcodingProfilesChanged) + QList> transcodingProfiles() const; + /** + * @brief Gets or sets the transcoding profiles. + */ + void setTranscodingProfiles(QList> newTranscodingProfiles); /** * @brief Gets or sets the ContainerProfiles. */ - Q_PROPERTY(QList containerProfiles READ containerProfiles WRITE setContainerProfiles NOTIFY containerProfilesChanged) + QList> containerProfiles() const; + /** + * @brief Gets or sets the ContainerProfiles. + */ + void setContainerProfiles(QList> newContainerProfiles); /** * @brief Gets or sets the CodecProfiles. */ - Q_PROPERTY(QList codecProfiles READ codecProfiles WRITE setCodecProfiles NOTIFY codecProfilesChanged) + QList> codecProfiles() const; + /** + * @brief Gets or sets the CodecProfiles. + */ + void setCodecProfiles(QList> newCodecProfiles); /** * @brief Gets or sets the ResponseProfiles. */ - Q_PROPERTY(QList responseProfiles READ responseProfiles WRITE setResponseProfiles NOTIFY responseProfilesChanged) + QList> responseProfiles() const; + /** + * @brief Gets or sets the ResponseProfiles. + */ + void setResponseProfiles(QList> newResponseProfiles); /** * @brief Gets or sets the SubtitleProfiles. */ - Q_PROPERTY(QList subtitleProfiles READ subtitleProfiles WRITE setSubtitleProfiles NOTIFY subtitleProfilesChanged) + QList> subtitleProfiles() const; + /** + * @brief Gets or sets the SubtitleProfiles. + */ + void setSubtitleProfiles(QList> newSubtitleProfiles); - QString name() const; - void setName(QString newName); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - DeviceIdentification * identification() const; - void setIdentification(DeviceIdentification * newIdentification); - - QString friendlyName() const; - void setFriendlyName(QString newFriendlyName); - - QString manufacturer() const; - void setManufacturer(QString newManufacturer); - - QString manufacturerUrl() const; - void setManufacturerUrl(QString newManufacturerUrl); - - QString modelName() const; - void setModelName(QString newModelName); - - QString modelDescription() const; - void setModelDescription(QString newModelDescription); - - QString modelNumber() const; - void setModelNumber(QString newModelNumber); - - QString modelUrl() const; - void setModelUrl(QString newModelUrl); - - QString serialNumber() const; - void setSerialNumber(QString newSerialNumber); - - bool enableAlbumArtInDidl() const; - void setEnableAlbumArtInDidl(bool newEnableAlbumArtInDidl); - - bool enableSingleAlbumArtLimit() const; - void setEnableSingleAlbumArtLimit(bool newEnableSingleAlbumArtLimit); - - bool enableSingleSubtitleLimit() const; - void setEnableSingleSubtitleLimit(bool newEnableSingleSubtitleLimit); - - QString supportedMediaTypes() const; - void setSupportedMediaTypes(QString newSupportedMediaTypes); - - QString userId() const; - void setUserId(QString newUserId); - - QString albumArtPn() const; - void setAlbumArtPn(QString newAlbumArtPn); - - qint32 maxAlbumArtWidth() const; - void setMaxAlbumArtWidth(qint32 newMaxAlbumArtWidth); - - qint32 maxAlbumArtHeight() const; - void setMaxAlbumArtHeight(qint32 newMaxAlbumArtHeight); - - qint32 maxIconWidth() const; - void setMaxIconWidth(qint32 newMaxIconWidth); - - qint32 maxIconHeight() const; - void setMaxIconHeight(qint32 newMaxIconHeight); - - qint32 maxStreamingBitrate() const; - void setMaxStreamingBitrate(qint32 newMaxStreamingBitrate); - - qint32 maxStaticBitrate() const; - void setMaxStaticBitrate(qint32 newMaxStaticBitrate); - - qint32 musicStreamingTranscodingBitrate() const; - void setMusicStreamingTranscodingBitrate(qint32 newMusicStreamingTranscodingBitrate); - - qint32 maxStaticMusicBitrate() const; - void setMaxStaticMusicBitrate(qint32 newMaxStaticMusicBitrate); - - QString sonyAggregationFlags() const; - void setSonyAggregationFlags(QString newSonyAggregationFlags); - - QString protocolInfo() const; - void setProtocolInfo(QString newProtocolInfo); - - qint32 timelineOffsetSeconds() const; - void setTimelineOffsetSeconds(qint32 newTimelineOffsetSeconds); - - bool requiresPlainVideoItems() const; - void setRequiresPlainVideoItems(bool newRequiresPlainVideoItems); - - bool requiresPlainFolders() const; - void setRequiresPlainFolders(bool newRequiresPlainFolders); - - bool enableMSMediaReceiverRegistrar() const; - void setEnableMSMediaReceiverRegistrar(bool newEnableMSMediaReceiverRegistrar); - - bool ignoreTranscodeByteRangeRequests() const; - void setIgnoreTranscodeByteRangeRequests(bool newIgnoreTranscodeByteRangeRequests); - - QList xmlRootAttributes() const; - void setXmlRootAttributes(QList newXmlRootAttributes); - - QList directPlayProfiles() const; - void setDirectPlayProfiles(QList newDirectPlayProfiles); - - QList transcodingProfiles() const; - void setTranscodingProfiles(QList newTranscodingProfiles); - - QList containerProfiles() const; - void setContainerProfiles(QList newContainerProfiles); - - QList codecProfiles() const; - void setCodecProfiles(QList newCodecProfiles); - - QList responseProfiles() const; - void setResponseProfiles(QList newResponseProfiles); - - QList subtitleProfiles() const; - void setSubtitleProfiles(QList newSubtitleProfiles); - -signals: - void nameChanged(QString newName); - void jellyfinIdChanged(QString newJellyfinId); - void identificationChanged(DeviceIdentification * newIdentification); - void friendlyNameChanged(QString newFriendlyName); - void manufacturerChanged(QString newManufacturer); - void manufacturerUrlChanged(QString newManufacturerUrl); - void modelNameChanged(QString newModelName); - void modelDescriptionChanged(QString newModelDescription); - void modelNumberChanged(QString newModelNumber); - void modelUrlChanged(QString newModelUrl); - void serialNumberChanged(QString newSerialNumber); - void enableAlbumArtInDidlChanged(bool newEnableAlbumArtInDidl); - void enableSingleAlbumArtLimitChanged(bool newEnableSingleAlbumArtLimit); - void enableSingleSubtitleLimitChanged(bool newEnableSingleSubtitleLimit); - void supportedMediaTypesChanged(QString newSupportedMediaTypes); - void userIdChanged(QString newUserId); - void albumArtPnChanged(QString newAlbumArtPn); - void maxAlbumArtWidthChanged(qint32 newMaxAlbumArtWidth); - void maxAlbumArtHeightChanged(qint32 newMaxAlbumArtHeight); - void maxIconWidthChanged(qint32 newMaxIconWidth); - void maxIconHeightChanged(qint32 newMaxIconHeight); - void maxStreamingBitrateChanged(qint32 newMaxStreamingBitrate); - void maxStaticBitrateChanged(qint32 newMaxStaticBitrate); - void musicStreamingTranscodingBitrateChanged(qint32 newMusicStreamingTranscodingBitrate); - void maxStaticMusicBitrateChanged(qint32 newMaxStaticMusicBitrate); - void sonyAggregationFlagsChanged(QString newSonyAggregationFlags); - void protocolInfoChanged(QString newProtocolInfo); - void timelineOffsetSecondsChanged(qint32 newTimelineOffsetSeconds); - void requiresPlainVideoItemsChanged(bool newRequiresPlainVideoItems); - void requiresPlainFoldersChanged(bool newRequiresPlainFolders); - void enableMSMediaReceiverRegistrarChanged(bool newEnableMSMediaReceiverRegistrar); - void ignoreTranscodeByteRangeRequestsChanged(bool newIgnoreTranscodeByteRangeRequests); - void xmlRootAttributesChanged(QList newXmlRootAttributes); - void directPlayProfilesChanged(QList newDirectPlayProfiles); - void transcodingProfilesChanged(QList newTranscodingProfiles); - void containerProfilesChanged(QList newContainerProfiles); - void codecProfilesChanged(QList newCodecProfiles); - void responseProfilesChanged(QList newResponseProfiles); - void subtitleProfilesChanged(QList newSubtitleProfiles); protected: QString m_name; QString m_jellyfinId; - DeviceIdentification * m_identification = nullptr; + QSharedPointer m_identification = nullptr; QString m_friendlyName; QString m_manufacturer; QString m_manufacturerUrl; @@ -400,15 +402,27 @@ protected: bool m_requiresPlainFolders; bool m_enableMSMediaReceiverRegistrar; bool m_ignoreTranscodeByteRangeRequests; - QList m_xmlRootAttributes; - QList m_directPlayProfiles; - QList m_transcodingProfiles; - QList m_containerProfiles; - QList m_codecProfiles; - QList m_responseProfiles; - QList m_subtitleProfiles; + QList> m_xmlRootAttributes; + QList> m_directPlayProfiles; + QList> m_transcodingProfiles; + QList> m_containerProfiles; + QList> m_codecProfiles; + QList> m_responseProfiles; + QList> m_subtitleProfiles; }; +} // NS DTO + +namespace Support { + +using DeviceProfile = Jellyfin::DTO::DeviceProfile; + +template <> +DeviceProfile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DeviceProfile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/deviceprofileinfo.h b/core/include/JellyfinQt/DTO/deviceprofileinfo.h index 52198aa..653bd2b 100644 --- a/core/include/JellyfinQt/DTO/deviceprofileinfo.h +++ b/core/include/JellyfinQt/DTO/deviceprofileinfo.h @@ -31,51 +31,64 @@ #define JELLYFIN_DTO_DEVICEPROFILEINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/deviceprofiletype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DeviceProfileInfo : public QObject { - Q_OBJECT -public: - explicit DeviceProfileInfo(QObject *parent = nullptr); - static DeviceProfileInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class DeviceProfileInfo { +public: + explicit DeviceProfileInfo(); + static DeviceProfileInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the identifier. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the identifier. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(DeviceProfileType type READ type WRITE setType NOTIFY typeChanged) - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - QString name() const; + /** + * @brief Gets or sets the name. + */ void setName(QString newName); - + DeviceProfileType type() const; + void setType(DeviceProfileType newType); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void nameChanged(QString newName); - void typeChanged(DeviceProfileType newType); + protected: QString m_jellyfinId; QString m_name; DeviceProfileType m_type; }; +} // NS DTO + +namespace Support { + +using DeviceProfileInfo = Jellyfin::DTO::DeviceProfileInfo; + +template <> +DeviceProfileInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DeviceProfileInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/deviceprofiletype.h b/core/include/JellyfinQt/DTO/deviceprofiletype.h index 255004a..98fc24f 100644 --- a/core/include/JellyfinQt/DTO/deviceprofiletype.h +++ b/core/include/JellyfinQt/DTO/deviceprofiletype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_DEVICEPROFILETYPE_H #define JELLYFIN_DTO_DEVICEPROFILETYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class DeviceProfileTypeClass { Q_GADGET public: enum Value { + EnumNotSet, System, User, }; @@ -46,8 +51,31 @@ public: private: explicit DeviceProfileTypeClass(); }; + typedef DeviceProfileTypeClass::Value DeviceProfileType; +} // NS DTO + +namespace Support { + +using DeviceProfileType = Jellyfin::DTO::DeviceProfileType; +using DeviceProfileTypeClass = Jellyfin::DTO::DeviceProfileTypeClass; + +template <> +DeviceProfileType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return DeviceProfileTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("System")) { + return DeviceProfileTypeClass::System; + } + if (str == QStringLiteral("User")) { + return DeviceProfileTypeClass::User; + } + + return DeviceProfileTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/directplayprofile.h b/core/include/JellyfinQt/DTO/directplayprofile.h index f254c16..ef94eb7 100644 --- a/core/include/JellyfinQt/DTO/directplayprofile.h +++ b/core/include/JellyfinQt/DTO/directplayprofile.h @@ -31,44 +31,42 @@ #define JELLYFIN_DTO_DIRECTPLAYPROFILE_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/dlnaprofiletype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DirectPlayProfile : public QObject { - Q_OBJECT -public: - explicit DirectPlayProfile(QObject *parent = nullptr); - static DirectPlayProfile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) - Q_PROPERTY(QString audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged) - Q_PROPERTY(QString videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged) - Q_PROPERTY(DlnaProfileType type READ type WRITE setType NOTIFY typeChanged) +class DirectPlayProfile { +public: + explicit DirectPlayProfile(); + static DirectPlayProfile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString container() const; + void setContainer(QString newContainer); - + QString audioCodec() const; + void setAudioCodec(QString newAudioCodec); - + QString videoCodec() const; + void setVideoCodec(QString newVideoCodec); - + DlnaProfileType type() const; + void setType(DlnaProfileType newType); - -signals: - void containerChanged(QString newContainer); - void audioCodecChanged(QString newAudioCodec); - void videoCodecChanged(QString newVideoCodec); - void typeChanged(DlnaProfileType newType); + protected: QString m_container; QString m_audioCodec; @@ -76,6 +74,18 @@ protected: DlnaProfileType m_type; }; +} // NS DTO + +namespace Support { + +using DirectPlayProfile = Jellyfin::DTO::DirectPlayProfile; + +template <> +DirectPlayProfile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DirectPlayProfile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/displaypreferencesdto.h b/core/include/JellyfinQt/DTO/displaypreferencesdto.h index 83b84f8..1cc4fd8 100644 --- a/core/include/JellyfinQt/DTO/displaypreferencesdto.h +++ b/core/include/JellyfinQt/DTO/displaypreferencesdto.h @@ -31,131 +31,131 @@ #define JELLYFIN_DTO_DISPLAYPREFERENCESDTO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/scrolldirection.h" #include "JellyfinQt/DTO/sortorder.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DisplayPreferencesDto : public QObject { - Q_OBJECT -public: - explicit DisplayPreferencesDto(QObject *parent = nullptr); - static DisplayPreferencesDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class DisplayPreferencesDto { +public: + explicit DisplayPreferencesDto(); + static DisplayPreferencesDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the user id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the user id. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets the type of the view. */ - Q_PROPERTY(QString viewType READ viewType WRITE setViewType NOTIFY viewTypeChanged) + QString viewType() const; + /** + * @brief Gets or sets the type of the view. + */ + void setViewType(QString newViewType); /** * @brief Gets or sets the sort by. */ - Q_PROPERTY(QString sortBy READ sortBy WRITE setSortBy NOTIFY sortByChanged) + QString sortBy() const; + /** + * @brief Gets or sets the sort by. + */ + void setSortBy(QString newSortBy); /** * @brief Gets or sets the index by. */ - Q_PROPERTY(QString indexBy READ indexBy WRITE setIndexBy NOTIFY indexByChanged) + QString indexBy() const; + /** + * @brief Gets or sets the index by. + */ + void setIndexBy(QString newIndexBy); /** * @brief Gets or sets a value indicating whether [remember indexing]. */ - Q_PROPERTY(bool rememberIndexing READ rememberIndexing WRITE setRememberIndexing NOTIFY rememberIndexingChanged) + bool rememberIndexing() const; + /** + * @brief Gets or sets a value indicating whether [remember indexing]. + */ + void setRememberIndexing(bool newRememberIndexing); /** * @brief Gets or sets the height of the primary image. */ - Q_PROPERTY(qint32 primaryImageHeight READ primaryImageHeight WRITE setPrimaryImageHeight NOTIFY primaryImageHeightChanged) + qint32 primaryImageHeight() const; + /** + * @brief Gets or sets the height of the primary image. + */ + void setPrimaryImageHeight(qint32 newPrimaryImageHeight); /** * @brief Gets or sets the width of the primary image. */ - Q_PROPERTY(qint32 primaryImageWidth READ primaryImageWidth WRITE setPrimaryImageWidth NOTIFY primaryImageWidthChanged) + qint32 primaryImageWidth() const; + /** + * @brief Gets or sets the width of the primary image. + */ + void setPrimaryImageWidth(qint32 newPrimaryImageWidth); /** * @brief Gets or sets the custom prefs. */ - Q_PROPERTY(QJsonObject customPrefs READ customPrefs WRITE setCustomPrefs NOTIFY customPrefsChanged) - Q_PROPERTY(ScrollDirection scrollDirection READ scrollDirection WRITE setScrollDirection NOTIFY scrollDirectionChanged) + QJsonObject customPrefs() const; + /** + * @brief Gets or sets the custom prefs. + */ + void setCustomPrefs(QJsonObject newCustomPrefs); + + ScrollDirection scrollDirection() const; + + void setScrollDirection(ScrollDirection newScrollDirection); /** * @brief Gets or sets a value indicating whether to show backdrops on this item. */ - Q_PROPERTY(bool showBackdrop READ showBackdrop WRITE setShowBackdrop NOTIFY showBackdropChanged) + bool showBackdrop() const; + /** + * @brief Gets or sets a value indicating whether to show backdrops on this item. + */ + void setShowBackdrop(bool newShowBackdrop); /** * @brief Gets or sets a value indicating whether [remember sorting]. */ - Q_PROPERTY(bool rememberSorting READ rememberSorting WRITE setRememberSorting NOTIFY rememberSortingChanged) - Q_PROPERTY(SortOrder sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged) + bool rememberSorting() const; + /** + * @brief Gets or sets a value indicating whether [remember sorting]. + */ + void setRememberSorting(bool newRememberSorting); + + SortOrder sortOrder() const; + + void setSortOrder(SortOrder newSortOrder); /** * @brief Gets or sets a value indicating whether [show sidebar]. */ - Q_PROPERTY(bool showSidebar READ showSidebar WRITE setShowSidebar NOTIFY showSidebarChanged) + bool showSidebar() const; + /** + * @brief Gets or sets a value indicating whether [show sidebar]. + */ + void setShowSidebar(bool newShowSidebar); /** * @brief Gets or sets the client. */ - Q_PROPERTY(QString client READ client WRITE setClient NOTIFY clientChanged) - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString viewType() const; - void setViewType(QString newViewType); - - QString sortBy() const; - void setSortBy(QString newSortBy); - - QString indexBy() const; - void setIndexBy(QString newIndexBy); - - bool rememberIndexing() const; - void setRememberIndexing(bool newRememberIndexing); - - qint32 primaryImageHeight() const; - void setPrimaryImageHeight(qint32 newPrimaryImageHeight); - - qint32 primaryImageWidth() const; - void setPrimaryImageWidth(qint32 newPrimaryImageWidth); - - QJsonObject customPrefs() const; - void setCustomPrefs(QJsonObject newCustomPrefs); - - ScrollDirection scrollDirection() const; - void setScrollDirection(ScrollDirection newScrollDirection); - - bool showBackdrop() const; - void setShowBackdrop(bool newShowBackdrop); - - bool rememberSorting() const; - void setRememberSorting(bool newRememberSorting); - - SortOrder sortOrder() const; - void setSortOrder(SortOrder newSortOrder); - - bool showSidebar() const; - void setShowSidebar(bool newShowSidebar); - QString client() const; + /** + * @brief Gets or sets the client. + */ void setClient(QString newClient); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void viewTypeChanged(QString newViewType); - void sortByChanged(QString newSortBy); - void indexByChanged(QString newIndexBy); - void rememberIndexingChanged(bool newRememberIndexing); - void primaryImageHeightChanged(qint32 newPrimaryImageHeight); - void primaryImageWidthChanged(qint32 newPrimaryImageWidth); - void customPrefsChanged(QJsonObject newCustomPrefs); - void scrollDirectionChanged(ScrollDirection newScrollDirection); - void showBackdropChanged(bool newShowBackdrop); - void rememberSortingChanged(bool newRememberSorting); - void sortOrderChanged(SortOrder newSortOrder); - void showSidebarChanged(bool newShowSidebar); - void clientChanged(QString newClient); + protected: QString m_jellyfinId; QString m_viewType; @@ -173,6 +173,18 @@ protected: QString m_client; }; +} // NS DTO + +namespace Support { + +using DisplayPreferencesDto = Jellyfin::DTO::DisplayPreferencesDto; + +template <> +DisplayPreferencesDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return DisplayPreferencesDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/dlnaprofiletype.h b/core/include/JellyfinQt/DTO/dlnaprofiletype.h index 899d23f..7b58d3b 100644 --- a/core/include/JellyfinQt/DTO/dlnaprofiletype.h +++ b/core/include/JellyfinQt/DTO/dlnaprofiletype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_DLNAPROFILETYPE_H #define JELLYFIN_DTO_DLNAPROFILETYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class DlnaProfileTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Audio, Video, Photo, @@ -47,8 +52,34 @@ public: private: explicit DlnaProfileTypeClass(); }; + typedef DlnaProfileTypeClass::Value DlnaProfileType; +} // NS DTO + +namespace Support { + +using DlnaProfileType = Jellyfin::DTO::DlnaProfileType; +using DlnaProfileTypeClass = Jellyfin::DTO::DlnaProfileTypeClass; + +template <> +DlnaProfileType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return DlnaProfileTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Audio")) { + return DlnaProfileTypeClass::Audio; + } + if (str == QStringLiteral("Video")) { + return DlnaProfileTypeClass::Video; + } + if (str == QStringLiteral("Photo")) { + return DlnaProfileTypeClass::Photo; + } + + return DlnaProfileTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/dynamicdayofweek.h b/core/include/JellyfinQt/DTO/dynamicdayofweek.h index 7a0dc28..da719f8 100644 --- a/core/include/JellyfinQt/DTO/dynamicdayofweek.h +++ b/core/include/JellyfinQt/DTO/dynamicdayofweek.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_DYNAMICDAYOFWEEK_H #define JELLYFIN_DTO_DYNAMICDAYOFWEEK_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class DynamicDayOfWeekClass { Q_GADGET public: enum Value { + EnumNotSet, Sunday, Monday, Tuesday, @@ -54,8 +59,55 @@ public: private: explicit DynamicDayOfWeekClass(); }; + typedef DynamicDayOfWeekClass::Value DynamicDayOfWeek; +} // NS DTO + +namespace Support { + +using DynamicDayOfWeek = Jellyfin::DTO::DynamicDayOfWeek; +using DynamicDayOfWeekClass = Jellyfin::DTO::DynamicDayOfWeekClass; + +template <> +DynamicDayOfWeek fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return DynamicDayOfWeekClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Sunday")) { + return DynamicDayOfWeekClass::Sunday; + } + if (str == QStringLiteral("Monday")) { + return DynamicDayOfWeekClass::Monday; + } + if (str == QStringLiteral("Tuesday")) { + return DynamicDayOfWeekClass::Tuesday; + } + if (str == QStringLiteral("Wednesday")) { + return DynamicDayOfWeekClass::Wednesday; + } + if (str == QStringLiteral("Thursday")) { + return DynamicDayOfWeekClass::Thursday; + } + if (str == QStringLiteral("Friday")) { + return DynamicDayOfWeekClass::Friday; + } + if (str == QStringLiteral("Saturday")) { + return DynamicDayOfWeekClass::Saturday; + } + if (str == QStringLiteral("Everyday")) { + return DynamicDayOfWeekClass::Everyday; + } + if (str == QStringLiteral("Weekday")) { + return DynamicDayOfWeekClass::Weekday; + } + if (str == QStringLiteral("Weekend")) { + return DynamicDayOfWeekClass::Weekend; + } + + return DynamicDayOfWeekClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/encodingcontext.h b/core/include/JellyfinQt/DTO/encodingcontext.h index 1bf486d..00cf74e 100644 --- a/core/include/JellyfinQt/DTO/encodingcontext.h +++ b/core/include/JellyfinQt/DTO/encodingcontext.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_ENCODINGCONTEXT_H #define JELLYFIN_DTO_ENCODINGCONTEXT_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class EncodingContextClass { Q_GADGET public: enum Value { + EnumNotSet, Streaming, Static, }; @@ -46,8 +51,31 @@ public: private: explicit EncodingContextClass(); }; + typedef EncodingContextClass::Value EncodingContext; +} // NS DTO + +namespace Support { + +using EncodingContext = Jellyfin::DTO::EncodingContext; +using EncodingContextClass = Jellyfin::DTO::EncodingContextClass; + +template <> +EncodingContext fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return EncodingContextClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Streaming")) { + return EncodingContextClass::Streaming; + } + if (str == QStringLiteral("Static")) { + return EncodingContextClass::Static; + } + + return EncodingContextClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/endpointinfo.h b/core/include/JellyfinQt/DTO/endpointinfo.h index cabb2bb..8849468 100644 --- a/core/include/JellyfinQt/DTO/endpointinfo.h +++ b/core/include/JellyfinQt/DTO/endpointinfo.h @@ -31,36 +31,49 @@ #define JELLYFIN_DTO_ENDPOINTINFO_H #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class EndPointInfo : public QObject { - Q_OBJECT -public: - explicit EndPointInfo(QObject *parent = nullptr); - static EndPointInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(bool isLocal READ isLocal WRITE setIsLocal NOTIFY isLocalChanged) - Q_PROPERTY(bool isInNetwork READ isInNetwork WRITE setIsInNetwork NOTIFY isInNetworkChanged) +class EndPointInfo { +public: + explicit EndPointInfo(); + static EndPointInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties bool isLocal() const; + void setIsLocal(bool newIsLocal); - + bool isInNetwork() const; + void setIsInNetwork(bool newIsInNetwork); - -signals: - void isLocalChanged(bool newIsLocal); - void isInNetworkChanged(bool newIsInNetwork); + protected: bool m_isLocal; bool m_isInNetwork; }; +} // NS DTO + +namespace Support { + +using EndPointInfo = Jellyfin::DTO::EndPointInfo; + +template <> +EndPointInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return EndPointInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/externalidinfo.h b/core/include/JellyfinQt/DTO/externalidinfo.h index 5990258..faaa653 100644 --- a/core/include/JellyfinQt/DTO/externalidinfo.h +++ b/core/include/JellyfinQt/DTO/externalidinfo.h @@ -31,53 +31,54 @@ #define JELLYFIN_DTO_EXTERNALIDINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/externalidmediatype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ExternalIdInfo : public QObject { - Q_OBJECT -public: - explicit ExternalIdInfo(QObject *parent = nullptr); - static ExternalIdInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ExternalIdInfo { +public: + explicit ExternalIdInfo(); + static ExternalIdInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the display name of the external id provider (IE: IMDB, MusicBrainz, etc). */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the display name of the external id provider (IE: IMDB, MusicBrainz, etc). + */ + void setName(QString newName); /** * @brief Gets or sets the unique key for this id. This key should be unique across all providers. */ - Q_PROPERTY(QString key READ key WRITE setKey NOTIFY keyChanged) - Q_PROPERTY(ExternalIdMediaType type READ type WRITE setType NOTIFY typeChanged) + QString key() const; + /** + * @brief Gets or sets the unique key for this id. This key should be unique across all providers. + */ + void setKey(QString newKey); + + ExternalIdMediaType type() const; + + void setType(ExternalIdMediaType newType); /** * @brief Gets or sets the URL format string. */ - Q_PROPERTY(QString urlFormatString READ urlFormatString WRITE setUrlFormatString NOTIFY urlFormatStringChanged) - - QString name() const; - void setName(QString newName); - - QString key() const; - void setKey(QString newKey); - - ExternalIdMediaType type() const; - void setType(ExternalIdMediaType newType); - QString urlFormatString() const; + /** + * @brief Gets or sets the URL format string. + */ void setUrlFormatString(QString newUrlFormatString); - -signals: - void nameChanged(QString newName); - void keyChanged(QString newKey); - void typeChanged(ExternalIdMediaType newType); - void urlFormatStringChanged(QString newUrlFormatString); + protected: QString m_name; QString m_key; @@ -85,6 +86,18 @@ protected: QString m_urlFormatString; }; +} // NS DTO + +namespace Support { + +using ExternalIdInfo = Jellyfin::DTO::ExternalIdInfo; + +template <> +ExternalIdInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ExternalIdInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/externalidmediatype.h b/core/include/JellyfinQt/DTO/externalidmediatype.h index 4344912..a3b873c 100644 --- a/core/include/JellyfinQt/DTO/externalidmediatype.h +++ b/core/include/JellyfinQt/DTO/externalidmediatype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_EXTERNALIDMEDIATYPE_H #define JELLYFIN_DTO_EXTERNALIDMEDIATYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ExternalIdMediaTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Album, AlbumArtist, Artist, @@ -56,8 +61,61 @@ public: private: explicit ExternalIdMediaTypeClass(); }; + typedef ExternalIdMediaTypeClass::Value ExternalIdMediaType; +} // NS DTO + +namespace Support { + +using ExternalIdMediaType = Jellyfin::DTO::ExternalIdMediaType; +using ExternalIdMediaTypeClass = Jellyfin::DTO::ExternalIdMediaTypeClass; + +template <> +ExternalIdMediaType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ExternalIdMediaTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Album")) { + return ExternalIdMediaTypeClass::Album; + } + if (str == QStringLiteral("AlbumArtist")) { + return ExternalIdMediaTypeClass::AlbumArtist; + } + if (str == QStringLiteral("Artist")) { + return ExternalIdMediaTypeClass::Artist; + } + if (str == QStringLiteral("BoxSet")) { + return ExternalIdMediaTypeClass::BoxSet; + } + if (str == QStringLiteral("Episode")) { + return ExternalIdMediaTypeClass::Episode; + } + if (str == QStringLiteral("Movie")) { + return ExternalIdMediaTypeClass::Movie; + } + if (str == QStringLiteral("OtherArtist")) { + return ExternalIdMediaTypeClass::OtherArtist; + } + if (str == QStringLiteral("Person")) { + return ExternalIdMediaTypeClass::Person; + } + if (str == QStringLiteral("ReleaseGroup")) { + return ExternalIdMediaTypeClass::ReleaseGroup; + } + if (str == QStringLiteral("Season")) { + return ExternalIdMediaTypeClass::Season; + } + if (str == QStringLiteral("Series")) { + return ExternalIdMediaTypeClass::Series; + } + if (str == QStringLiteral("Track")) { + return ExternalIdMediaTypeClass::Track; + } + + return ExternalIdMediaTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/externalurl.h b/core/include/JellyfinQt/DTO/externalurl.h index 804e898..8066d50 100644 --- a/core/include/JellyfinQt/DTO/externalurl.h +++ b/core/include/JellyfinQt/DTO/externalurl.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_EXTERNALURL_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ExternalUrl : public QObject { - Q_OBJECT -public: - explicit ExternalUrl(QObject *parent = nullptr); - static ExternalUrl *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ExternalUrl { +public: + explicit ExternalUrl(); + static ExternalUrl fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the type of the item. */ - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) - - QString name() const; - void setName(QString newName); - QString url() const; + /** + * @brief Gets or sets the type of the item. + */ void setUrl(QString newUrl); - -signals: - void nameChanged(QString newName); - void urlChanged(QString newUrl); + protected: QString m_name; QString m_url; }; +} // NS DTO + +namespace Support { + +using ExternalUrl = Jellyfin::DTO::ExternalUrl; + +template <> +ExternalUrl fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ExternalUrl::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/ffmpeglocation.h b/core/include/JellyfinQt/DTO/ffmpeglocation.h index f57f3b7..7e1a916 100644 --- a/core/include/JellyfinQt/DTO/ffmpeglocation.h +++ b/core/include/JellyfinQt/DTO/ffmpeglocation.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_FFMPEGLOCATION_H #define JELLYFIN_DTO_FFMPEGLOCATION_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class FFmpegLocationClass { Q_GADGET public: enum Value { + EnumNotSet, NotFound, SetByArgument, Custom, @@ -48,8 +53,37 @@ public: private: explicit FFmpegLocationClass(); }; + typedef FFmpegLocationClass::Value FFmpegLocation; +} // NS DTO + +namespace Support { + +using FFmpegLocation = Jellyfin::DTO::FFmpegLocation; +using FFmpegLocationClass = Jellyfin::DTO::FFmpegLocationClass; + +template <> +FFmpegLocation fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return FFmpegLocationClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("NotFound")) { + return FFmpegLocationClass::NotFound; + } + if (str == QStringLiteral("SetByArgument")) { + return FFmpegLocationClass::SetByArgument; + } + if (str == QStringLiteral("Custom")) { + return FFmpegLocationClass::Custom; + } + if (str == QStringLiteral("System")) { + return FFmpegLocationClass::System; + } + + return FFmpegLocationClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/filesystementryinfo.h b/core/include/JellyfinQt/DTO/filesystementryinfo.h index ef25e1c..34e58d1 100644 --- a/core/include/JellyfinQt/DTO/filesystementryinfo.h +++ b/core/include/JellyfinQt/DTO/filesystementryinfo.h @@ -31,51 +31,64 @@ #define JELLYFIN_DTO_FILESYSTEMENTRYINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/filesystementrytype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class FileSystemEntryInfo : public QObject { - Q_OBJECT -public: - explicit FileSystemEntryInfo(QObject *parent = nullptr); - static FileSystemEntryInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class FileSystemEntryInfo { +public: + explicit FileSystemEntryInfo(); + static FileSystemEntryInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets the name. + */ + void setName(QString newName); /** * @brief Gets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(FileSystemEntryType type READ type WRITE setType NOTIFY typeChanged) - - QString name() const; - void setName(QString newName); - QString path() const; + /** + * @brief Gets the path. + */ void setPath(QString newPath); - + FileSystemEntryType type() const; + void setType(FileSystemEntryType newType); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void typeChanged(FileSystemEntryType newType); + protected: QString m_name; QString m_path; FileSystemEntryType m_type; }; +} // NS DTO + +namespace Support { + +using FileSystemEntryInfo = Jellyfin::DTO::FileSystemEntryInfo; + +template <> +FileSystemEntryInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return FileSystemEntryInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/filesystementrytype.h b/core/include/JellyfinQt/DTO/filesystementrytype.h index bb68521..b1b6250 100644 --- a/core/include/JellyfinQt/DTO/filesystementrytype.h +++ b/core/include/JellyfinQt/DTO/filesystementrytype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_FILESYSTEMENTRYTYPE_H #define JELLYFIN_DTO_FILESYSTEMENTRYTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class FileSystemEntryTypeClass { Q_GADGET public: enum Value { + EnumNotSet, File, Directory, NetworkComputer, @@ -48,8 +53,37 @@ public: private: explicit FileSystemEntryTypeClass(); }; + typedef FileSystemEntryTypeClass::Value FileSystemEntryType; +} // NS DTO + +namespace Support { + +using FileSystemEntryType = Jellyfin::DTO::FileSystemEntryType; +using FileSystemEntryTypeClass = Jellyfin::DTO::FileSystemEntryTypeClass; + +template <> +FileSystemEntryType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return FileSystemEntryTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("File")) { + return FileSystemEntryTypeClass::File; + } + if (str == QStringLiteral("Directory")) { + return FileSystemEntryTypeClass::Directory; + } + if (str == QStringLiteral("NetworkComputer")) { + return FileSystemEntryTypeClass::NetworkComputer; + } + if (str == QStringLiteral("NetworkShare")) { + return FileSystemEntryTypeClass::NetworkShare; + } + + return FileSystemEntryTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/fontfile.h b/core/include/JellyfinQt/DTO/fontfile.h index 5f4ef8c..fac8d2b 100644 --- a/core/include/JellyfinQt/DTO/fontfile.h +++ b/core/include/JellyfinQt/DTO/fontfile.h @@ -32,54 +32,57 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class FontFile : public QObject { - Q_OBJECT -public: - explicit FontFile(QObject *parent = nullptr); - static FontFile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class FontFile { +public: + explicit FontFile(); + static FontFile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the size. */ - Q_PROPERTY(qint64 size READ size WRITE setSize NOTIFY sizeChanged) + qint64 size() const; + /** + * @brief Gets or sets the size. + */ + void setSize(qint64 newSize); /** * @brief Gets or sets the date created. */ - Q_PROPERTY(QDateTime dateCreated READ dateCreated WRITE setDateCreated NOTIFY dateCreatedChanged) + QDateTime dateCreated() const; + /** + * @brief Gets or sets the date created. + */ + void setDateCreated(QDateTime newDateCreated); /** * @brief Gets or sets the date modified. */ - Q_PROPERTY(QDateTime dateModified READ dateModified WRITE setDateModified NOTIFY dateModifiedChanged) - - QString name() const; - void setName(QString newName); - - qint64 size() const; - void setSize(qint64 newSize); - - QDateTime dateCreated() const; - void setDateCreated(QDateTime newDateCreated); - QDateTime dateModified() const; + /** + * @brief Gets or sets the date modified. + */ void setDateModified(QDateTime newDateModified); - -signals: - void nameChanged(QString newName); - void sizeChanged(qint64 newSize); - void dateCreatedChanged(QDateTime newDateCreated); - void dateModifiedChanged(QDateTime newDateModified); + protected: QString m_name; qint64 m_size; @@ -87,6 +90,18 @@ protected: QDateTime m_dateModified; }; +} // NS DTO + +namespace Support { + +using FontFile = Jellyfin::DTO::FontFile; + +template <> +FontFile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return FontFile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/forgotpasswordaction.h b/core/include/JellyfinQt/DTO/forgotpasswordaction.h index 85c1c21..7053906 100644 --- a/core/include/JellyfinQt/DTO/forgotpasswordaction.h +++ b/core/include/JellyfinQt/DTO/forgotpasswordaction.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_FORGOTPASSWORDACTION_H #define JELLYFIN_DTO_FORGOTPASSWORDACTION_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ForgotPasswordActionClass { Q_GADGET public: enum Value { + EnumNotSet, ContactAdmin, PinCode, InNetworkRequired, @@ -47,8 +52,34 @@ public: private: explicit ForgotPasswordActionClass(); }; + typedef ForgotPasswordActionClass::Value ForgotPasswordAction; +} // NS DTO + +namespace Support { + +using ForgotPasswordAction = Jellyfin::DTO::ForgotPasswordAction; +using ForgotPasswordActionClass = Jellyfin::DTO::ForgotPasswordActionClass; + +template <> +ForgotPasswordAction fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ForgotPasswordActionClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("ContactAdmin")) { + return ForgotPasswordActionClass::ContactAdmin; + } + if (str == QStringLiteral("PinCode")) { + return ForgotPasswordActionClass::PinCode; + } + if (str == QStringLiteral("InNetworkRequired")) { + return ForgotPasswordActionClass::InNetworkRequired; + } + + return ForgotPasswordActionClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/forgotpassworddto.h b/core/include/JellyfinQt/DTO/forgotpassworddto.h index 1cd5dc4..8c2b2ba 100644 --- a/core/include/JellyfinQt/DTO/forgotpassworddto.h +++ b/core/include/JellyfinQt/DTO/forgotpassworddto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_FORGOTPASSWORDDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ForgotPasswordDto : public QObject { - Q_OBJECT -public: - explicit ForgotPasswordDto(QObject *parent = nullptr); - static ForgotPasswordDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ForgotPasswordDto { +public: + explicit ForgotPasswordDto(); + static ForgotPasswordDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the entered username to have its password reset. */ - Q_PROPERTY(QString enteredUsername READ enteredUsername WRITE setEnteredUsername NOTIFY enteredUsernameChanged) - QString enteredUsername() const; + /** + * @brief Gets or sets the entered username to have its password reset. + */ void setEnteredUsername(QString newEnteredUsername); - -signals: - void enteredUsernameChanged(QString newEnteredUsername); + protected: QString m_enteredUsername; }; +} // NS DTO + +namespace Support { + +using ForgotPasswordDto = Jellyfin::DTO::ForgotPasswordDto; + +template <> +ForgotPasswordDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ForgotPasswordDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/forgotpasswordresult.h b/core/include/JellyfinQt/DTO/forgotpasswordresult.h index a4cd079..7992432 100644 --- a/core/include/JellyfinQt/DTO/forgotpasswordresult.h +++ b/core/include/JellyfinQt/DTO/forgotpasswordresult.h @@ -32,51 +32,64 @@ #include #include -#include +#include #include +#include #include "JellyfinQt/DTO/forgotpasswordaction.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ForgotPasswordResult : public QObject { - Q_OBJECT -public: - explicit ForgotPasswordResult(QObject *parent = nullptr); - static ForgotPasswordResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(ForgotPasswordAction action READ action WRITE setAction NOTIFY actionChanged) +class ForgotPasswordResult { +public: + explicit ForgotPasswordResult(); + static ForgotPasswordResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties + + ForgotPasswordAction action() const; + + void setAction(ForgotPasswordAction newAction); /** * @brief Gets or sets the pin file. */ - Q_PROPERTY(QString pinFile READ pinFile WRITE setPinFile NOTIFY pinFileChanged) + QString pinFile() const; + /** + * @brief Gets or sets the pin file. + */ + void setPinFile(QString newPinFile); /** * @brief Gets or sets the pin expiration date. */ - Q_PROPERTY(QDateTime pinExpirationDate READ pinExpirationDate WRITE setPinExpirationDate NOTIFY pinExpirationDateChanged) - - ForgotPasswordAction action() const; - void setAction(ForgotPasswordAction newAction); - - QString pinFile() const; - void setPinFile(QString newPinFile); - QDateTime pinExpirationDate() const; + /** + * @brief Gets or sets the pin expiration date. + */ void setPinExpirationDate(QDateTime newPinExpirationDate); - -signals: - void actionChanged(ForgotPasswordAction newAction); - void pinFileChanged(QString newPinFile); - void pinExpirationDateChanged(QDateTime newPinExpirationDate); + protected: ForgotPasswordAction m_action; QString m_pinFile; QDateTime m_pinExpirationDate; }; +} // NS DTO + +namespace Support { + +using ForgotPasswordResult = Jellyfin::DTO::ForgotPasswordResult; + +template <> +ForgotPasswordResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ForgotPasswordResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/generalcommand.h b/core/include/JellyfinQt/DTO/generalcommand.h index 06aabaa..b771255 100644 --- a/core/include/JellyfinQt/DTO/generalcommand.h +++ b/core/include/JellyfinQt/DTO/generalcommand.h @@ -31,45 +31,56 @@ #define JELLYFIN_DTO_GENERALCOMMAND_H #include -#include -#include +#include +#include +#include #include "JellyfinQt/DTO/generalcommandtype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class GeneralCommand : public QObject { - Q_OBJECT -public: - explicit GeneralCommand(QObject *parent = nullptr); - static GeneralCommand *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(GeneralCommandType name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString controllingUserId READ controllingUserId WRITE setControllingUserId NOTIFY controllingUserIdChanged) - Q_PROPERTY(QJsonObject arguments READ arguments WRITE setArguments NOTIFY argumentsChanged) +class GeneralCommand { +public: + explicit GeneralCommand(); + static GeneralCommand fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties GeneralCommandType name() const; + void setName(GeneralCommandType newName); - - QString controllingUserId() const; - void setControllingUserId(QString newControllingUserId); - + + QUuid controllingUserId() const; + + void setControllingUserId(QUuid newControllingUserId); + QJsonObject arguments() const; + void setArguments(QJsonObject newArguments); - -signals: - void nameChanged(GeneralCommandType newName); - void controllingUserIdChanged(QString newControllingUserId); - void argumentsChanged(QJsonObject newArguments); + protected: GeneralCommandType m_name; - QString m_controllingUserId; + QUuid m_controllingUserId; QJsonObject m_arguments; }; +} // NS DTO + +namespace Support { + +using GeneralCommand = Jellyfin::DTO::GeneralCommand; + +template <> +GeneralCommand fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return GeneralCommand::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/generalcommandtype.h b/core/include/JellyfinQt/DTO/generalcommandtype.h index f27bb3a..ac9d409 100644 --- a/core/include/JellyfinQt/DTO/generalcommandtype.h +++ b/core/include/JellyfinQt/DTO/generalcommandtype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_GENERALCOMMANDTYPE_H #define JELLYFIN_DTO_GENERALCOMMANDTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class GeneralCommandTypeClass { Q_GADGET public: enum Value { + EnumNotSet, MoveUp, MoveDown, MoveLeft, @@ -85,8 +90,148 @@ public: private: explicit GeneralCommandTypeClass(); }; + typedef GeneralCommandTypeClass::Value GeneralCommandType; +} // NS DTO + +namespace Support { + +using GeneralCommandType = Jellyfin::DTO::GeneralCommandType; +using GeneralCommandTypeClass = Jellyfin::DTO::GeneralCommandTypeClass; + +template <> +GeneralCommandType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return GeneralCommandTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("MoveUp")) { + return GeneralCommandTypeClass::MoveUp; + } + if (str == QStringLiteral("MoveDown")) { + return GeneralCommandTypeClass::MoveDown; + } + if (str == QStringLiteral("MoveLeft")) { + return GeneralCommandTypeClass::MoveLeft; + } + if (str == QStringLiteral("MoveRight")) { + return GeneralCommandTypeClass::MoveRight; + } + if (str == QStringLiteral("PageUp")) { + return GeneralCommandTypeClass::PageUp; + } + if (str == QStringLiteral("PageDown")) { + return GeneralCommandTypeClass::PageDown; + } + if (str == QStringLiteral("PreviousLetter")) { + return GeneralCommandTypeClass::PreviousLetter; + } + if (str == QStringLiteral("NextLetter")) { + return GeneralCommandTypeClass::NextLetter; + } + if (str == QStringLiteral("ToggleOsd")) { + return GeneralCommandTypeClass::ToggleOsd; + } + if (str == QStringLiteral("ToggleContextMenu")) { + return GeneralCommandTypeClass::ToggleContextMenu; + } + if (str == QStringLiteral("Select")) { + return GeneralCommandTypeClass::Select; + } + if (str == QStringLiteral("Back")) { + return GeneralCommandTypeClass::Back; + } + if (str == QStringLiteral("TakeScreenshot")) { + return GeneralCommandTypeClass::TakeScreenshot; + } + if (str == QStringLiteral("SendKey")) { + return GeneralCommandTypeClass::SendKey; + } + if (str == QStringLiteral("SendString")) { + return GeneralCommandTypeClass::SendString; + } + if (str == QStringLiteral("GoHome")) { + return GeneralCommandTypeClass::GoHome; + } + if (str == QStringLiteral("GoToSettings")) { + return GeneralCommandTypeClass::GoToSettings; + } + if (str == QStringLiteral("VolumeUp")) { + return GeneralCommandTypeClass::VolumeUp; + } + if (str == QStringLiteral("VolumeDown")) { + return GeneralCommandTypeClass::VolumeDown; + } + if (str == QStringLiteral("Mute")) { + return GeneralCommandTypeClass::Mute; + } + if (str == QStringLiteral("Unmute")) { + return GeneralCommandTypeClass::Unmute; + } + if (str == QStringLiteral("ToggleMute")) { + return GeneralCommandTypeClass::ToggleMute; + } + if (str == QStringLiteral("SetVolume")) { + return GeneralCommandTypeClass::SetVolume; + } + if (str == QStringLiteral("SetAudioStreamIndex")) { + return GeneralCommandTypeClass::SetAudioStreamIndex; + } + if (str == QStringLiteral("SetSubtitleStreamIndex")) { + return GeneralCommandTypeClass::SetSubtitleStreamIndex; + } + if (str == QStringLiteral("ToggleFullscreen")) { + return GeneralCommandTypeClass::ToggleFullscreen; + } + if (str == QStringLiteral("DisplayContent")) { + return GeneralCommandTypeClass::DisplayContent; + } + if (str == QStringLiteral("GoToSearch")) { + return GeneralCommandTypeClass::GoToSearch; + } + if (str == QStringLiteral("DisplayMessage")) { + return GeneralCommandTypeClass::DisplayMessage; + } + if (str == QStringLiteral("SetRepeatMode")) { + return GeneralCommandTypeClass::SetRepeatMode; + } + if (str == QStringLiteral("ChannelUp")) { + return GeneralCommandTypeClass::ChannelUp; + } + if (str == QStringLiteral("ChannelDown")) { + return GeneralCommandTypeClass::ChannelDown; + } + if (str == QStringLiteral("Guide")) { + return GeneralCommandTypeClass::Guide; + } + if (str == QStringLiteral("ToggleStats")) { + return GeneralCommandTypeClass::ToggleStats; + } + if (str == QStringLiteral("PlayMediaSource")) { + return GeneralCommandTypeClass::PlayMediaSource; + } + if (str == QStringLiteral("PlayTrailers")) { + return GeneralCommandTypeClass::PlayTrailers; + } + if (str == QStringLiteral("SetShuffleQueue")) { + return GeneralCommandTypeClass::SetShuffleQueue; + } + if (str == QStringLiteral("PlayState")) { + return GeneralCommandTypeClass::PlayState; + } + if (str == QStringLiteral("PlayNext")) { + return GeneralCommandTypeClass::PlayNext; + } + if (str == QStringLiteral("ToggleOsdMenu")) { + return GeneralCommandTypeClass::ToggleOsdMenu; + } + if (str == QStringLiteral("Play")) { + return GeneralCommandTypeClass::Play; + } + + return GeneralCommandTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/getprogramsdto.h b/core/include/JellyfinQt/DTO/getprogramsdto.h index defd4ff..ab2bd48 100644 --- a/core/include/JellyfinQt/DTO/getprogramsdto.h +++ b/core/include/JellyfinQt/DTO/getprogramsdto.h @@ -32,267 +32,291 @@ #include #include +#include #include -#include #include #include +#include +#include #include "JellyfinQt/DTO/imagetype.h" #include "JellyfinQt/DTO/itemfields.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class GetProgramsDto : public QObject { - Q_OBJECT -public: - explicit GetProgramsDto(QObject *parent = nullptr); - static GetProgramsDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class GetProgramsDto { +public: + explicit GetProgramsDto(); + static GetProgramsDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the channels to return guide information for. */ - Q_PROPERTY(QStringList channelIds READ channelIds WRITE setChannelIds NOTIFY channelIdsChanged) + QList channelIds() const; + /** + * @brief Gets or sets the channels to return guide information for. + */ + void setChannelIds(QList newChannelIds); /** * @brief Gets or sets optional. Filter by user id. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets optional. Filter by user id. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets the minimum premiere start date. Optional. */ - Q_PROPERTY(QDateTime minStartDate READ minStartDate WRITE setMinStartDate NOTIFY minStartDateChanged) + QDateTime minStartDate() const; + /** + * @brief Gets or sets the minimum premiere start date. +Optional. + */ + void setMinStartDate(QDateTime newMinStartDate); /** * @brief Gets or sets filter by programs that have completed airing, or not. Optional. */ - Q_PROPERTY(bool hasAired READ hasAired WRITE setHasAired NOTIFY hasAiredChanged) + bool hasAired() const; + /** + * @brief Gets or sets filter by programs that have completed airing, or not. +Optional. + */ + void setHasAired(bool newHasAired); /** * @brief Gets or sets filter by programs that are currently airing, or not. Optional. */ - Q_PROPERTY(bool isAiring READ isAiring WRITE setIsAiring NOTIFY isAiringChanged) + bool isAiring() const; + /** + * @brief Gets or sets filter by programs that are currently airing, or not. +Optional. + */ + void setIsAiring(bool newIsAiring); /** * @brief Gets or sets the maximum premiere start date. Optional. */ - Q_PROPERTY(QDateTime maxStartDate READ maxStartDate WRITE setMaxStartDate NOTIFY maxStartDateChanged) + QDateTime maxStartDate() const; + /** + * @brief Gets or sets the maximum premiere start date. +Optional. + */ + void setMaxStartDate(QDateTime newMaxStartDate); /** * @brief Gets or sets the minimum premiere end date. Optional. */ - Q_PROPERTY(QDateTime minEndDate READ minEndDate WRITE setMinEndDate NOTIFY minEndDateChanged) + QDateTime minEndDate() const; + /** + * @brief Gets or sets the minimum premiere end date. +Optional. + */ + void setMinEndDate(QDateTime newMinEndDate); /** * @brief Gets or sets the maximum premiere end date. Optional. */ - Q_PROPERTY(QDateTime maxEndDate READ maxEndDate WRITE setMaxEndDate NOTIFY maxEndDateChanged) + QDateTime maxEndDate() const; + /** + * @brief Gets or sets the maximum premiere end date. +Optional. + */ + void setMaxEndDate(QDateTime newMaxEndDate); /** * @brief Gets or sets filter for movies. Optional. */ - Q_PROPERTY(bool isMovie READ isMovie WRITE setIsMovie NOTIFY isMovieChanged) + bool isMovie() const; + /** + * @brief Gets or sets filter for movies. +Optional. + */ + void setIsMovie(bool newIsMovie); /** * @brief Gets or sets filter for series. Optional. */ - Q_PROPERTY(bool isSeries READ isSeries WRITE setIsSeries NOTIFY isSeriesChanged) + bool isSeries() const; + /** + * @brief Gets or sets filter for series. +Optional. + */ + void setIsSeries(bool newIsSeries); /** * @brief Gets or sets filter for news. Optional. */ - Q_PROPERTY(bool isNews READ isNews WRITE setIsNews NOTIFY isNewsChanged) + bool isNews() const; + /** + * @brief Gets or sets filter for news. +Optional. + */ + void setIsNews(bool newIsNews); /** * @brief Gets or sets filter for kids. Optional. */ - Q_PROPERTY(bool isKids READ isKids WRITE setIsKids NOTIFY isKidsChanged) + bool isKids() const; + /** + * @brief Gets or sets filter for kids. +Optional. + */ + void setIsKids(bool newIsKids); /** * @brief Gets or sets filter for sports. Optional. */ - Q_PROPERTY(bool isSports READ isSports WRITE setIsSports NOTIFY isSportsChanged) + bool isSports() const; + /** + * @brief Gets or sets filter for sports. +Optional. + */ + void setIsSports(bool newIsSports); /** * @brief Gets or sets the record index to start at. All items with a lower index will be dropped from the results. Optional. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) + qint32 startIndex() const; + /** + * @brief Gets or sets the record index to start at. All items with a lower index will be dropped from the results. +Optional. + */ + void setStartIndex(qint32 newStartIndex); /** * @brief Gets or sets the maximum number of records to return. Optional. */ - Q_PROPERTY(qint32 limit READ limit WRITE setLimit NOTIFY limitChanged) + qint32 limit() const; + /** + * @brief Gets or sets the maximum number of records to return. +Optional. + */ + void setLimit(qint32 newLimit); /** * @brief Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate. Optional. */ - Q_PROPERTY(QString sortBy READ sortBy WRITE setSortBy NOTIFY sortByChanged) + QString sortBy() const; + /** + * @brief Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate. +Optional. + */ + void setSortBy(QString newSortBy); /** * @brief Gets or sets sort Order - Ascending,Descending. */ - Q_PROPERTY(QString sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged) + QString sortOrder() const; + /** + * @brief Gets or sets sort Order - Ascending,Descending. + */ + void setSortOrder(QString newSortOrder); /** * @brief Gets or sets the genres to return guide information for. */ - Q_PROPERTY(QStringList genres READ genres WRITE setGenres NOTIFY genresChanged) + QStringList genres() const; + /** + * @brief Gets or sets the genres to return guide information for. + */ + void setGenres(QStringList newGenres); /** * @brief Gets or sets the genre ids to return guide information for. */ - Q_PROPERTY(QStringList genreIds READ genreIds WRITE setGenreIds NOTIFY genreIdsChanged) + QList genreIds() const; + /** + * @brief Gets or sets the genre ids to return guide information for. + */ + void setGenreIds(QList newGenreIds); /** * @brief Gets or sets include image information in output. Optional. */ - Q_PROPERTY(bool enableImages READ enableImages WRITE setEnableImages NOTIFY enableImagesChanged) + bool enableImages() const; + /** + * @brief Gets or sets include image information in output. +Optional. + */ + void setEnableImages(bool newEnableImages); /** * @brief Gets or sets a value indicating whether retrieve total record count. */ - Q_PROPERTY(bool enableTotalRecordCount READ enableTotalRecordCount WRITE setEnableTotalRecordCount NOTIFY enableTotalRecordCountChanged) + bool enableTotalRecordCount() const; + /** + * @brief Gets or sets a value indicating whether retrieve total record count. + */ + void setEnableTotalRecordCount(bool newEnableTotalRecordCount); /** * @brief Gets or sets the max number of images to return, per image type. Optional. */ - Q_PROPERTY(qint32 imageTypeLimit READ imageTypeLimit WRITE setImageTypeLimit NOTIFY imageTypeLimitChanged) + qint32 imageTypeLimit() const; + /** + * @brief Gets or sets the max number of images to return, per image type. +Optional. + */ + void setImageTypeLimit(qint32 newImageTypeLimit); /** * @brief Gets or sets the image types to include in the output. Optional. */ - Q_PROPERTY(QList enableImageTypes READ enableImageTypes WRITE setEnableImageTypes NOTIFY enableImageTypesChanged) + QList enableImageTypes() const; + /** + * @brief Gets or sets the image types to include in the output. +Optional. + */ + void setEnableImageTypes(QList newEnableImageTypes); /** * @brief Gets or sets include user data. Optional. */ - Q_PROPERTY(bool enableUserData READ enableUserData WRITE setEnableUserData NOTIFY enableUserDataChanged) + bool enableUserData() const; + /** + * @brief Gets or sets include user data. +Optional. + */ + void setEnableUserData(bool newEnableUserData); /** * @brief Gets or sets filter by series timer id. Optional. */ - Q_PROPERTY(QString seriesTimerId READ seriesTimerId WRITE setSeriesTimerId NOTIFY seriesTimerIdChanged) + QString seriesTimerId() const; + /** + * @brief Gets or sets filter by series timer id. +Optional. + */ + void setSeriesTimerId(QString newSeriesTimerId); /** * @brief Gets or sets filter by library series id. Optional. */ - Q_PROPERTY(QString librarySeriesId READ librarySeriesId WRITE setLibrarySeriesId NOTIFY librarySeriesIdChanged) + QUuid librarySeriesId() const; + /** + * @brief Gets or sets filter by library series id. +Optional. + */ + void setLibrarySeriesId(QUuid newLibrarySeriesId); /** * @brief Gets or sets specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines. Optional. */ - Q_PROPERTY(QList fields READ fields WRITE setFields NOTIFY fieldsChanged) - - QStringList channelIds() const; - void setChannelIds(QStringList newChannelIds); - - QString userId() const; - void setUserId(QString newUserId); - - QDateTime minStartDate() const; - void setMinStartDate(QDateTime newMinStartDate); - - bool hasAired() const; - void setHasAired(bool newHasAired); - - bool isAiring() const; - void setIsAiring(bool newIsAiring); - - QDateTime maxStartDate() const; - void setMaxStartDate(QDateTime newMaxStartDate); - - QDateTime minEndDate() const; - void setMinEndDate(QDateTime newMinEndDate); - - QDateTime maxEndDate() const; - void setMaxEndDate(QDateTime newMaxEndDate); - - bool isMovie() const; - void setIsMovie(bool newIsMovie); - - bool isSeries() const; - void setIsSeries(bool newIsSeries); - - bool isNews() const; - void setIsNews(bool newIsNews); - - bool isKids() const; - void setIsKids(bool newIsKids); - - bool isSports() const; - void setIsSports(bool newIsSports); - - qint32 startIndex() const; - void setStartIndex(qint32 newStartIndex); - - qint32 limit() const; - void setLimit(qint32 newLimit); - - QString sortBy() const; - void setSortBy(QString newSortBy); - - QString sortOrder() const; - void setSortOrder(QString newSortOrder); - - QStringList genres() const; - void setGenres(QStringList newGenres); - - QStringList genreIds() const; - void setGenreIds(QStringList newGenreIds); - - bool enableImages() const; - void setEnableImages(bool newEnableImages); - - bool enableTotalRecordCount() const; - void setEnableTotalRecordCount(bool newEnableTotalRecordCount); - - qint32 imageTypeLimit() const; - void setImageTypeLimit(qint32 newImageTypeLimit); - - QList enableImageTypes() const; - void setEnableImageTypes(QList newEnableImageTypes); - - bool enableUserData() const; - void setEnableUserData(bool newEnableUserData); - - QString seriesTimerId() const; - void setSeriesTimerId(QString newSeriesTimerId); - - QString librarySeriesId() const; - void setLibrarySeriesId(QString newLibrarySeriesId); - QList fields() const; + /** + * @brief Gets or sets specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines. +Optional. + */ void setFields(QList newFields); - -signals: - void channelIdsChanged(QStringList newChannelIds); - void userIdChanged(QString newUserId); - void minStartDateChanged(QDateTime newMinStartDate); - void hasAiredChanged(bool newHasAired); - void isAiringChanged(bool newIsAiring); - void maxStartDateChanged(QDateTime newMaxStartDate); - void minEndDateChanged(QDateTime newMinEndDate); - void maxEndDateChanged(QDateTime newMaxEndDate); - void isMovieChanged(bool newIsMovie); - void isSeriesChanged(bool newIsSeries); - void isNewsChanged(bool newIsNews); - void isKidsChanged(bool newIsKids); - void isSportsChanged(bool newIsSports); - void startIndexChanged(qint32 newStartIndex); - void limitChanged(qint32 newLimit); - void sortByChanged(QString newSortBy); - void sortOrderChanged(QString newSortOrder); - void genresChanged(QStringList newGenres); - void genreIdsChanged(QStringList newGenreIds); - void enableImagesChanged(bool newEnableImages); - void enableTotalRecordCountChanged(bool newEnableTotalRecordCount); - void imageTypeLimitChanged(qint32 newImageTypeLimit); - void enableImageTypesChanged(QList newEnableImageTypes); - void enableUserDataChanged(bool newEnableUserData); - void seriesTimerIdChanged(QString newSeriesTimerId); - void librarySeriesIdChanged(QString newLibrarySeriesId); - void fieldsChanged(QList newFields); + protected: - QStringList m_channelIds; - QString m_userId; + QList m_channelIds; + QUuid m_userId; QDateTime m_minStartDate; bool m_hasAired; bool m_isAiring; @@ -309,17 +333,29 @@ protected: QString m_sortBy; QString m_sortOrder; QStringList m_genres; - QStringList m_genreIds; + QList m_genreIds; bool m_enableImages; bool m_enableTotalRecordCount; qint32 m_imageTypeLimit; QList m_enableImageTypes; bool m_enableUserData; QString m_seriesTimerId; - QString m_librarySeriesId; + QUuid m_librarySeriesId; QList m_fields; }; +} // NS DTO + +namespace Support { + +using GetProgramsDto = Jellyfin::DTO::GetProgramsDto; + +template <> +GetProgramsDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return GetProgramsDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/groupinfodto.h b/core/include/JellyfinQt/DTO/groupinfodto.h index 0c35099..2a2b986 100644 --- a/core/include/JellyfinQt/DTO/groupinfodto.h +++ b/core/include/JellyfinQt/DTO/groupinfodto.h @@ -32,71 +32,85 @@ #include #include +#include #include -#include #include #include +#include +#include #include "JellyfinQt/DTO/groupstatetype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class GroupInfoDto : public QObject { - Q_OBJECT -public: - explicit GroupInfoDto(QObject *parent = nullptr); - static GroupInfoDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class GroupInfoDto { +public: + explicit GroupInfoDto(); + static GroupInfoDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the group identifier. */ - Q_PROPERTY(QString groupId READ groupId WRITE setGroupId NOTIFY groupIdChanged) + QUuid groupId() const; + /** + * @brief Gets the group identifier. + */ + void setGroupId(QUuid newGroupId); /** * @brief Gets the group name. */ - Q_PROPERTY(QString groupName READ groupName WRITE setGroupName NOTIFY groupNameChanged) - Q_PROPERTY(GroupStateType state READ state WRITE setState NOTIFY stateChanged) + QString groupName() const; + /** + * @brief Gets the group name. + */ + void setGroupName(QString newGroupName); + + GroupStateType state() const; + + void setState(GroupStateType newState); /** * @brief Gets the participants. */ - Q_PROPERTY(QStringList participants READ participants WRITE setParticipants NOTIFY participantsChanged) + QStringList participants() const; + /** + * @brief Gets the participants. + */ + void setParticipants(QStringList newParticipants); /** * @brief Gets the date when this DTO has been created. */ - Q_PROPERTY(QDateTime lastUpdatedAt READ lastUpdatedAt WRITE setLastUpdatedAt NOTIFY lastUpdatedAtChanged) - - QString groupId() const; - void setGroupId(QString newGroupId); - - QString groupName() const; - void setGroupName(QString newGroupName); - - GroupStateType state() const; - void setState(GroupStateType newState); - - QStringList participants() const; - void setParticipants(QStringList newParticipants); - QDateTime lastUpdatedAt() const; + /** + * @brief Gets the date when this DTO has been created. + */ void setLastUpdatedAt(QDateTime newLastUpdatedAt); - -signals: - void groupIdChanged(QString newGroupId); - void groupNameChanged(QString newGroupName); - void stateChanged(GroupStateType newState); - void participantsChanged(QStringList newParticipants); - void lastUpdatedAtChanged(QDateTime newLastUpdatedAt); + protected: - QString m_groupId; + QUuid m_groupId; QString m_groupName; GroupStateType m_state; QStringList m_participants; QDateTime m_lastUpdatedAt; }; +} // NS DTO + +namespace Support { + +using GroupInfoDto = Jellyfin::DTO::GroupInfoDto; + +template <> +GroupInfoDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return GroupInfoDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/groupqueuemode.h b/core/include/JellyfinQt/DTO/groupqueuemode.h index b4c3ff7..d65a97e 100644 --- a/core/include/JellyfinQt/DTO/groupqueuemode.h +++ b/core/include/JellyfinQt/DTO/groupqueuemode.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_GROUPQUEUEMODE_H #define JELLYFIN_DTO_GROUPQUEUEMODE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class GroupQueueModeClass { Q_GADGET public: enum Value { + EnumNotSet, Queue, QueueNext, }; @@ -46,8 +51,31 @@ public: private: explicit GroupQueueModeClass(); }; + typedef GroupQueueModeClass::Value GroupQueueMode; +} // NS DTO + +namespace Support { + +using GroupQueueMode = Jellyfin::DTO::GroupQueueMode; +using GroupQueueModeClass = Jellyfin::DTO::GroupQueueModeClass; + +template <> +GroupQueueMode fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return GroupQueueModeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Queue")) { + return GroupQueueModeClass::Queue; + } + if (str == QStringLiteral("QueueNext")) { + return GroupQueueModeClass::QueueNext; + } + + return GroupQueueModeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/grouprepeatmode.h b/core/include/JellyfinQt/DTO/grouprepeatmode.h index 6ca08c5..3ae0565 100644 --- a/core/include/JellyfinQt/DTO/grouprepeatmode.h +++ b/core/include/JellyfinQt/DTO/grouprepeatmode.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_GROUPREPEATMODE_H #define JELLYFIN_DTO_GROUPREPEATMODE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class GroupRepeatModeClass { Q_GADGET public: enum Value { + EnumNotSet, RepeatOne, RepeatAll, RepeatNone, @@ -47,8 +52,34 @@ public: private: explicit GroupRepeatModeClass(); }; + typedef GroupRepeatModeClass::Value GroupRepeatMode; +} // NS DTO + +namespace Support { + +using GroupRepeatMode = Jellyfin::DTO::GroupRepeatMode; +using GroupRepeatModeClass = Jellyfin::DTO::GroupRepeatModeClass; + +template <> +GroupRepeatMode fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return GroupRepeatModeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("RepeatOne")) { + return GroupRepeatModeClass::RepeatOne; + } + if (str == QStringLiteral("RepeatAll")) { + return GroupRepeatModeClass::RepeatAll; + } + if (str == QStringLiteral("RepeatNone")) { + return GroupRepeatModeClass::RepeatNone; + } + + return GroupRepeatModeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/groupshufflemode.h b/core/include/JellyfinQt/DTO/groupshufflemode.h index e5f72d4..5514804 100644 --- a/core/include/JellyfinQt/DTO/groupshufflemode.h +++ b/core/include/JellyfinQt/DTO/groupshufflemode.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_GROUPSHUFFLEMODE_H #define JELLYFIN_DTO_GROUPSHUFFLEMODE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class GroupShuffleModeClass { Q_GADGET public: enum Value { + EnumNotSet, Sorted, Shuffle, }; @@ -46,8 +51,31 @@ public: private: explicit GroupShuffleModeClass(); }; + typedef GroupShuffleModeClass::Value GroupShuffleMode; +} // NS DTO + +namespace Support { + +using GroupShuffleMode = Jellyfin::DTO::GroupShuffleMode; +using GroupShuffleModeClass = Jellyfin::DTO::GroupShuffleModeClass; + +template <> +GroupShuffleMode fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return GroupShuffleModeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Sorted")) { + return GroupShuffleModeClass::Sorted; + } + if (str == QStringLiteral("Shuffle")) { + return GroupShuffleModeClass::Shuffle; + } + + return GroupShuffleModeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/groupstatetype.h b/core/include/JellyfinQt/DTO/groupstatetype.h index 4fbea5c..ca0f7e5 100644 --- a/core/include/JellyfinQt/DTO/groupstatetype.h +++ b/core/include/JellyfinQt/DTO/groupstatetype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_GROUPSTATETYPE_H #define JELLYFIN_DTO_GROUPSTATETYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class GroupStateTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Idle, Waiting, Paused, @@ -48,8 +53,37 @@ public: private: explicit GroupStateTypeClass(); }; + typedef GroupStateTypeClass::Value GroupStateType; +} // NS DTO + +namespace Support { + +using GroupStateType = Jellyfin::DTO::GroupStateType; +using GroupStateTypeClass = Jellyfin::DTO::GroupStateTypeClass; + +template <> +GroupStateType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return GroupStateTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Idle")) { + return GroupStateTypeClass::Idle; + } + if (str == QStringLiteral("Waiting")) { + return GroupStateTypeClass::Waiting; + } + if (str == QStringLiteral("Paused")) { + return GroupStateTypeClass::Paused; + } + if (str == QStringLiteral("Playing")) { + return GroupStateTypeClass::Playing; + } + + return GroupStateTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/groupupdatetype.h b/core/include/JellyfinQt/DTO/groupupdatetype.h index b4bb281..0479fdb 100644 --- a/core/include/JellyfinQt/DTO/groupupdatetype.h +++ b/core/include/JellyfinQt/DTO/groupupdatetype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_GROUPUPDATETYPE_H #define JELLYFIN_DTO_GROUPUPDATETYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class GroupUpdateTypeClass { Q_GADGET public: enum Value { + EnumNotSet, UserJoined, UserLeft, GroupJoined, @@ -55,8 +60,58 @@ public: private: explicit GroupUpdateTypeClass(); }; + typedef GroupUpdateTypeClass::Value GroupUpdateType; +} // NS DTO + +namespace Support { + +using GroupUpdateType = Jellyfin::DTO::GroupUpdateType; +using GroupUpdateTypeClass = Jellyfin::DTO::GroupUpdateTypeClass; + +template <> +GroupUpdateType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return GroupUpdateTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("UserJoined")) { + return GroupUpdateTypeClass::UserJoined; + } + if (str == QStringLiteral("UserLeft")) { + return GroupUpdateTypeClass::UserLeft; + } + if (str == QStringLiteral("GroupJoined")) { + return GroupUpdateTypeClass::GroupJoined; + } + if (str == QStringLiteral("GroupLeft")) { + return GroupUpdateTypeClass::GroupLeft; + } + if (str == QStringLiteral("StateUpdate")) { + return GroupUpdateTypeClass::StateUpdate; + } + if (str == QStringLiteral("PlayQueue")) { + return GroupUpdateTypeClass::PlayQueue; + } + if (str == QStringLiteral("NotInGroup")) { + return GroupUpdateTypeClass::NotInGroup; + } + if (str == QStringLiteral("GroupDoesNotExist")) { + return GroupUpdateTypeClass::GroupDoesNotExist; + } + if (str == QStringLiteral("CreateGroupDenied")) { + return GroupUpdateTypeClass::CreateGroupDenied; + } + if (str == QStringLiteral("JoinGroupDenied")) { + return GroupUpdateTypeClass::JoinGroupDenied; + } + if (str == QStringLiteral("LibraryAccessDenied")) { + return GroupUpdateTypeClass::LibraryAccessDenied; + } + + return GroupUpdateTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/guideinfo.h b/core/include/JellyfinQt/DTO/guideinfo.h index 06f341f..783f151 100644 --- a/core/include/JellyfinQt/DTO/guideinfo.h +++ b/core/include/JellyfinQt/DTO/guideinfo.h @@ -32,42 +32,57 @@ #include #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class GuideInfo : public QObject { - Q_OBJECT -public: - explicit GuideInfo(QObject *parent = nullptr); - static GuideInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class GuideInfo { +public: + explicit GuideInfo(); + static GuideInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the start date. */ - Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged) + QDateTime startDate() const; + /** + * @brief Gets or sets the start date. + */ + void setStartDate(QDateTime newStartDate); /** * @brief Gets or sets the end date. */ - Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged) - - QDateTime startDate() const; - void setStartDate(QDateTime newStartDate); - QDateTime endDate() const; + /** + * @brief Gets or sets the end date. + */ void setEndDate(QDateTime newEndDate); - -signals: - void startDateChanged(QDateTime newStartDate); - void endDateChanged(QDateTime newEndDate); + protected: QDateTime m_startDate; QDateTime m_endDate; }; +} // NS DTO + +namespace Support { + +using GuideInfo = Jellyfin::DTO::GuideInfo; + +template <> +GuideInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return GuideInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/headermatchtype.h b/core/include/JellyfinQt/DTO/headermatchtype.h index 1d11e29..d5ca9b3 100644 --- a/core/include/JellyfinQt/DTO/headermatchtype.h +++ b/core/include/JellyfinQt/DTO/headermatchtype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_HEADERMATCHTYPE_H #define JELLYFIN_DTO_HEADERMATCHTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class HeaderMatchTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Equals, Regex, Substring, @@ -47,8 +52,34 @@ public: private: explicit HeaderMatchTypeClass(); }; + typedef HeaderMatchTypeClass::Value HeaderMatchType; +} // NS DTO + +namespace Support { + +using HeaderMatchType = Jellyfin::DTO::HeaderMatchType; +using HeaderMatchTypeClass = Jellyfin::DTO::HeaderMatchTypeClass; + +template <> +HeaderMatchType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return HeaderMatchTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Equals")) { + return HeaderMatchTypeClass::Equals; + } + if (str == QStringLiteral("Regex")) { + return HeaderMatchTypeClass::Regex; + } + if (str == QStringLiteral("Substring")) { + return HeaderMatchTypeClass::Substring; + } + + return HeaderMatchTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/httpheaderinfo.h b/core/include/JellyfinQt/DTO/httpheaderinfo.h index bc9f3cb..3371da4 100644 --- a/core/include/JellyfinQt/DTO/httpheaderinfo.h +++ b/core/include/JellyfinQt/DTO/httpheaderinfo.h @@ -31,45 +31,56 @@ #define JELLYFIN_DTO_HTTPHEADERINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/headermatchtype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class HttpHeaderInfo : public QObject { - Q_OBJECT -public: - explicit HttpHeaderInfo(QObject *parent = nullptr); - static HttpHeaderInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged) - Q_PROPERTY(HeaderMatchType match READ match WRITE setMatch NOTIFY matchChanged) +class HttpHeaderInfo { +public: + explicit HttpHeaderInfo(); + static HttpHeaderInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString name() const; + void setName(QString newName); - + QString value() const; + void setValue(QString newValue); - + HeaderMatchType match() const; + void setMatch(HeaderMatchType newMatch); - -signals: - void nameChanged(QString newName); - void valueChanged(QString newValue); - void matchChanged(HeaderMatchType newMatch); + protected: QString m_name; QString m_value; HeaderMatchType m_match; }; +} // NS DTO + +namespace Support { + +using HttpHeaderInfo = Jellyfin::DTO::HttpHeaderInfo; + +template <> +HttpHeaderInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return HttpHeaderInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/ignorewaitrequestdto.h b/core/include/JellyfinQt/DTO/ignorewaitrequestdto.h index 3cf1937..d5b8d35 100644 --- a/core/include/JellyfinQt/DTO/ignorewaitrequestdto.h +++ b/core/include/JellyfinQt/DTO/ignorewaitrequestdto.h @@ -31,33 +31,48 @@ #define JELLYFIN_DTO_IGNOREWAITREQUESTDTO_H #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class IgnoreWaitRequestDto : public QObject { - Q_OBJECT -public: - explicit IgnoreWaitRequestDto(QObject *parent = nullptr); - static IgnoreWaitRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class IgnoreWaitRequestDto { +public: + explicit IgnoreWaitRequestDto(); + static IgnoreWaitRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets a value indicating whether the client should be ignored. */ - Q_PROPERTY(bool ignoreWait READ ignoreWait WRITE setIgnoreWait NOTIFY ignoreWaitChanged) - bool ignoreWait() const; + /** + * @brief Gets or sets a value indicating whether the client should be ignored. + */ void setIgnoreWait(bool newIgnoreWait); - -signals: - void ignoreWaitChanged(bool newIgnoreWait); + protected: bool m_ignoreWait; }; +} // NS DTO + +namespace Support { + +using IgnoreWaitRequestDto = Jellyfin::DTO::IgnoreWaitRequestDto; + +template <> +IgnoreWaitRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return IgnoreWaitRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imagebynameinfo.h b/core/include/JellyfinQt/DTO/imagebynameinfo.h index 2d3c859..2f25da5 100644 --- a/core/include/JellyfinQt/DTO/imagebynameinfo.h +++ b/core/include/JellyfinQt/DTO/imagebynameinfo.h @@ -31,62 +31,65 @@ #define JELLYFIN_DTO_IMAGEBYNAMEINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ImageByNameInfo : public QObject { - Q_OBJECT -public: - explicit ImageByNameInfo(QObject *parent = nullptr); - static ImageByNameInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ImageByNameInfo { +public: + explicit ImageByNameInfo(); + static ImageByNameInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the theme. */ - Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged) + QString theme() const; + /** + * @brief Gets or sets the theme. + */ + void setTheme(QString newTheme); /** * @brief Gets or sets the context. */ - Q_PROPERTY(QString context READ context WRITE setContext NOTIFY contextChanged) + QString context() const; + /** + * @brief Gets or sets the context. + */ + void setContext(QString newContext); /** * @brief Gets or sets the length of the file. */ - Q_PROPERTY(qint64 fileLength READ fileLength WRITE setFileLength NOTIFY fileLengthChanged) + qint64 fileLength() const; + /** + * @brief Gets or sets the length of the file. + */ + void setFileLength(qint64 newFileLength); /** * @brief Gets or sets the format. */ - Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged) - - QString name() const; - void setName(QString newName); - - QString theme() const; - void setTheme(QString newTheme); - - QString context() const; - void setContext(QString newContext); - - qint64 fileLength() const; - void setFileLength(qint64 newFileLength); - QString format() const; + /** + * @brief Gets or sets the format. + */ void setFormat(QString newFormat); - -signals: - void nameChanged(QString newName); - void themeChanged(QString newTheme); - void contextChanged(QString newContext); - void fileLengthChanged(qint64 newFileLength); - void formatChanged(QString newFormat); + protected: QString m_name; QString m_theme; @@ -95,6 +98,18 @@ protected: QString m_format; }; +} // NS DTO + +namespace Support { + +using ImageByNameInfo = Jellyfin::DTO::ImageByNameInfo; + +template <> +ImageByNameInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ImageByNameInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imageformat.h b/core/include/JellyfinQt/DTO/imageformat.h index e637715..6eb9081 100644 --- a/core/include/JellyfinQt/DTO/imageformat.h +++ b/core/include/JellyfinQt/DTO/imageformat.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_IMAGEFORMAT_H #define JELLYFIN_DTO_IMAGEFORMAT_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ImageFormatClass { Q_GADGET public: enum Value { + EnumNotSet, Bmp, Gif, Jpg, @@ -49,8 +54,40 @@ public: private: explicit ImageFormatClass(); }; + typedef ImageFormatClass::Value ImageFormat; +} // NS DTO + +namespace Support { + +using ImageFormat = Jellyfin::DTO::ImageFormat; +using ImageFormatClass = Jellyfin::DTO::ImageFormatClass; + +template <> +ImageFormat fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ImageFormatClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Bmp")) { + return ImageFormatClass::Bmp; + } + if (str == QStringLiteral("Gif")) { + return ImageFormatClass::Gif; + } + if (str == QStringLiteral("Jpg")) { + return ImageFormatClass::Jpg; + } + if (str == QStringLiteral("Png")) { + return ImageFormatClass::Png; + } + if (str == QStringLiteral("Webp")) { + return ImageFormatClass::Webp; + } + + return ImageFormatClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imageinfo.h b/core/include/JellyfinQt/DTO/imageinfo.h index 34da077..cb72972 100644 --- a/core/include/JellyfinQt/DTO/imageinfo.h +++ b/core/include/JellyfinQt/DTO/imageinfo.h @@ -31,85 +31,86 @@ #define JELLYFIN_DTO_IMAGEINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/imagetype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ImageInfo : public QObject { - Q_OBJECT -public: - explicit ImageInfo(QObject *parent = nullptr); - static ImageInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(ImageType imageType READ imageType WRITE setImageType NOTIFY imageTypeChanged) +class ImageInfo { +public: + explicit ImageInfo(); + static ImageInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties + + ImageType imageType() const; + + void setImageType(ImageType newImageType); /** * @brief Gets or sets the index of the image. */ - Q_PROPERTY(qint32 imageIndex READ imageIndex WRITE setImageIndex NOTIFY imageIndexChanged) + qint32 imageIndex() const; + /** + * @brief Gets or sets the index of the image. + */ + void setImageIndex(qint32 newImageIndex); /** * @brief Gets or sets the image tag. */ - Q_PROPERTY(QString imageTag READ imageTag WRITE setImageTag NOTIFY imageTagChanged) + QString imageTag() const; + /** + * @brief Gets or sets the image tag. + */ + void setImageTag(QString newImageTag); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the blurhash. */ - Q_PROPERTY(QString blurHash READ blurHash WRITE setBlurHash NOTIFY blurHashChanged) + QString blurHash() const; + /** + * @brief Gets or sets the blurhash. + */ + void setBlurHash(QString newBlurHash); /** * @brief Gets or sets the height. */ - Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged) + qint32 height() const; + /** + * @brief Gets or sets the height. + */ + void setHeight(qint32 newHeight); /** * @brief Gets or sets the width. */ - Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged) + qint32 width() const; + /** + * @brief Gets or sets the width. + */ + void setWidth(qint32 newWidth); /** * @brief Gets or sets the size. */ - Q_PROPERTY(qint64 size READ size WRITE setSize NOTIFY sizeChanged) - - ImageType imageType() const; - void setImageType(ImageType newImageType); - - qint32 imageIndex() const; - void setImageIndex(qint32 newImageIndex); - - QString imageTag() const; - void setImageTag(QString newImageTag); - - QString path() const; - void setPath(QString newPath); - - QString blurHash() const; - void setBlurHash(QString newBlurHash); - - qint32 height() const; - void setHeight(qint32 newHeight); - - qint32 width() const; - void setWidth(qint32 newWidth); - qint64 size() const; + /** + * @brief Gets or sets the size. + */ void setSize(qint64 newSize); - -signals: - void imageTypeChanged(ImageType newImageType); - void imageIndexChanged(qint32 newImageIndex); - void imageTagChanged(QString newImageTag); - void pathChanged(QString newPath); - void blurHashChanged(QString newBlurHash); - void heightChanged(qint32 newHeight); - void widthChanged(qint32 newWidth); - void sizeChanged(qint64 newSize); + protected: ImageType m_imageType; qint32 m_imageIndex; @@ -121,6 +122,18 @@ protected: qint64 m_size; }; +} // NS DTO + +namespace Support { + +using ImageInfo = Jellyfin::DTO::ImageInfo; + +template <> +ImageInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ImageInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imageoption.h b/core/include/JellyfinQt/DTO/imageoption.h index 26effec..8b0d7fc 100644 --- a/core/include/JellyfinQt/DTO/imageoption.h +++ b/core/include/JellyfinQt/DTO/imageoption.h @@ -31,50 +31,63 @@ #define JELLYFIN_DTO_IMAGEOPTION_H #include -#include +#include +#include #include "JellyfinQt/DTO/imagetype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ImageOption : public QObject { - Q_OBJECT -public: - explicit ImageOption(QObject *parent = nullptr); - static ImageOption *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(ImageType type READ type WRITE setType NOTIFY typeChanged) +class ImageOption { +public: + explicit ImageOption(); + static ImageOption fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties + + ImageType type() const; + + void setType(ImageType newType); /** * @brief Gets or sets the limit. */ - Q_PROPERTY(qint32 limit READ limit WRITE setLimit NOTIFY limitChanged) + qint32 limit() const; + /** + * @brief Gets or sets the limit. + */ + void setLimit(qint32 newLimit); /** * @brief Gets or sets the minimum width. */ - Q_PROPERTY(qint32 minWidth READ minWidth WRITE setMinWidth NOTIFY minWidthChanged) - - ImageType type() const; - void setType(ImageType newType); - - qint32 limit() const; - void setLimit(qint32 newLimit); - qint32 minWidth() const; + /** + * @brief Gets or sets the minimum width. + */ void setMinWidth(qint32 newMinWidth); - -signals: - void typeChanged(ImageType newType); - void limitChanged(qint32 newLimit); - void minWidthChanged(qint32 newMinWidth); + protected: ImageType m_type; qint32 m_limit; qint32 m_minWidth; }; +} // NS DTO + +namespace Support { + +using ImageOption = Jellyfin::DTO::ImageOption; + +template <> +ImageOption fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ImageOption::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imageorientation.h b/core/include/JellyfinQt/DTO/imageorientation.h index 2532777..3a959e7 100644 --- a/core/include/JellyfinQt/DTO/imageorientation.h +++ b/core/include/JellyfinQt/DTO/imageorientation.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_IMAGEORIENTATION_H #define JELLYFIN_DTO_IMAGEORIENTATION_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ImageOrientationClass { Q_GADGET public: enum Value { + EnumNotSet, TopLeft, TopRight, BottomRight, @@ -52,8 +57,49 @@ public: private: explicit ImageOrientationClass(); }; + typedef ImageOrientationClass::Value ImageOrientation; +} // NS DTO + +namespace Support { + +using ImageOrientation = Jellyfin::DTO::ImageOrientation; +using ImageOrientationClass = Jellyfin::DTO::ImageOrientationClass; + +template <> +ImageOrientation fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ImageOrientationClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("TopLeft")) { + return ImageOrientationClass::TopLeft; + } + if (str == QStringLiteral("TopRight")) { + return ImageOrientationClass::TopRight; + } + if (str == QStringLiteral("BottomRight")) { + return ImageOrientationClass::BottomRight; + } + if (str == QStringLiteral("BottomLeft")) { + return ImageOrientationClass::BottomLeft; + } + if (str == QStringLiteral("LeftTop")) { + return ImageOrientationClass::LeftTop; + } + if (str == QStringLiteral("RightTop")) { + return ImageOrientationClass::RightTop; + } + if (str == QStringLiteral("RightBottom")) { + return ImageOrientationClass::RightBottom; + } + if (str == QStringLiteral("LeftBottom")) { + return ImageOrientationClass::LeftBottom; + } + + return ImageOrientationClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imageproviderinfo.h b/core/include/JellyfinQt/DTO/imageproviderinfo.h index 3a97ad6..ad6eafc 100644 --- a/core/include/JellyfinQt/DTO/imageproviderinfo.h +++ b/core/include/JellyfinQt/DTO/imageproviderinfo.h @@ -31,47 +31,61 @@ #define JELLYFIN_DTO_IMAGEPROVIDERINFO_H #include +#include #include -#include #include #include +#include #include "JellyfinQt/DTO/imagetype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ImageProviderInfo : public QObject { - Q_OBJECT -public: - explicit ImageProviderInfo(QObject *parent = nullptr); - static ImageProviderInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ImageProviderInfo { +public: + explicit ImageProviderInfo(); + static ImageProviderInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets the name. + */ + void setName(QString newName); /** * @brief Gets the supported image types. */ - Q_PROPERTY(QList supportedImages READ supportedImages WRITE setSupportedImages NOTIFY supportedImagesChanged) - - QString name() const; - void setName(QString newName); - QList supportedImages() const; + /** + * @brief Gets the supported image types. + */ void setSupportedImages(QList newSupportedImages); - -signals: - void nameChanged(QString newName); - void supportedImagesChanged(QList newSupportedImages); + protected: QString m_name; QList m_supportedImages; }; +} // NS DTO + +namespace Support { + +using ImageProviderInfo = Jellyfin::DTO::ImageProviderInfo; + +template <> +ImageProviderInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ImageProviderInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imagesavingconvention.h b/core/include/JellyfinQt/DTO/imagesavingconvention.h index 40121f2..6d8411e 100644 --- a/core/include/JellyfinQt/DTO/imagesavingconvention.h +++ b/core/include/JellyfinQt/DTO/imagesavingconvention.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_IMAGESAVINGCONVENTION_H #define JELLYFIN_DTO_IMAGESAVINGCONVENTION_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ImageSavingConventionClass { Q_GADGET public: enum Value { + EnumNotSet, Legacy, Compatible, }; @@ -46,8 +51,31 @@ public: private: explicit ImageSavingConventionClass(); }; + typedef ImageSavingConventionClass::Value ImageSavingConvention; +} // NS DTO + +namespace Support { + +using ImageSavingConvention = Jellyfin::DTO::ImageSavingConvention; +using ImageSavingConventionClass = Jellyfin::DTO::ImageSavingConventionClass; + +template <> +ImageSavingConvention fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ImageSavingConventionClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Legacy")) { + return ImageSavingConventionClass::Legacy; + } + if (str == QStringLiteral("Compatible")) { + return ImageSavingConventionClass::Compatible; + } + + return ImageSavingConventionClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/imagetype.h b/core/include/JellyfinQt/DTO/imagetype.h index 992d995..0802c40 100644 --- a/core/include/JellyfinQt/DTO/imagetype.h +++ b/core/include/JellyfinQt/DTO/imagetype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_IMAGETYPE_H #define JELLYFIN_DTO_IMAGETYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ImageTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Primary, Art, Backdrop, @@ -57,8 +62,64 @@ public: private: explicit ImageTypeClass(); }; + typedef ImageTypeClass::Value ImageType; +} // NS DTO + +namespace Support { + +using ImageType = Jellyfin::DTO::ImageType; +using ImageTypeClass = Jellyfin::DTO::ImageTypeClass; + +template <> +ImageType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ImageTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Primary")) { + return ImageTypeClass::Primary; + } + if (str == QStringLiteral("Art")) { + return ImageTypeClass::Art; + } + if (str == QStringLiteral("Backdrop")) { + return ImageTypeClass::Backdrop; + } + if (str == QStringLiteral("Banner")) { + return ImageTypeClass::Banner; + } + if (str == QStringLiteral("Logo")) { + return ImageTypeClass::Logo; + } + if (str == QStringLiteral("Thumb")) { + return ImageTypeClass::Thumb; + } + if (str == QStringLiteral("Disc")) { + return ImageTypeClass::Disc; + } + if (str == QStringLiteral("Box")) { + return ImageTypeClass::Box; + } + if (str == QStringLiteral("Screenshot")) { + return ImageTypeClass::Screenshot; + } + if (str == QStringLiteral("Menu")) { + return ImageTypeClass::Menu; + } + if (str == QStringLiteral("Chapter")) { + return ImageTypeClass::Chapter; + } + if (str == QStringLiteral("BoxRear")) { + return ImageTypeClass::BoxRear; + } + if (str == QStringLiteral("Profile")) { + return ImageTypeClass::Profile; + } + + return ImageTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/installationinfo.h b/core/include/JellyfinQt/DTO/installationinfo.h index 1e1e353..f287ae5 100644 --- a/core/include/JellyfinQt/DTO/installationinfo.h +++ b/core/include/JellyfinQt/DTO/installationinfo.h @@ -31,78 +31,93 @@ #define JELLYFIN_DTO_INSTALLATIONINFO_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/version.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class Version; -class InstallationInfo : public QObject { - Q_OBJECT +class InstallationInfo { public: - explicit InstallationInfo(QObject *parent = nullptr); - static InstallationInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit InstallationInfo(); + static InstallationInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the Id. */ - Q_PROPERTY(QString guid READ guid WRITE setGuid NOTIFY guidChanged) + QUuid guid() const; + /** + * @brief Gets or sets the Id. + */ + void setGuid(QUuid newGuid); /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(Version * version READ version WRITE setVersion NOTIFY versionChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); + + QSharedPointer version() const; + + void setVersion(QSharedPointer newVersion); /** * @brief Gets or sets the changelog for this version. */ - Q_PROPERTY(QString changelog READ changelog WRITE setChangelog NOTIFY changelogChanged) + QString changelog() const; + /** + * @brief Gets or sets the changelog for this version. + */ + void setChangelog(QString newChangelog); /** * @brief Gets or sets the source URL. */ - Q_PROPERTY(QString sourceUrl READ sourceUrl WRITE setSourceUrl NOTIFY sourceUrlChanged) + QString sourceUrl() const; + /** + * @brief Gets or sets the source URL. + */ + void setSourceUrl(QString newSourceUrl); /** * @brief Gets or sets a checksum for the binary. */ - Q_PROPERTY(QString checksum READ checksum WRITE setChecksum NOTIFY checksumChanged) - - QString guid() const; - void setGuid(QString newGuid); - - QString name() const; - void setName(QString newName); - - Version * version() const; - void setVersion(Version * newVersion); - - QString changelog() const; - void setChangelog(QString newChangelog); - - QString sourceUrl() const; - void setSourceUrl(QString newSourceUrl); - QString checksum() const; + /** + * @brief Gets or sets a checksum for the binary. + */ void setChecksum(QString newChecksum); - -signals: - void guidChanged(QString newGuid); - void nameChanged(QString newName); - void versionChanged(Version * newVersion); - void changelogChanged(QString newChangelog); - void sourceUrlChanged(QString newSourceUrl); - void checksumChanged(QString newChecksum); + protected: - QString m_guid; + QUuid m_guid; QString m_name; - Version * m_version = nullptr; + QSharedPointer m_version = nullptr; QString m_changelog; QString m_sourceUrl; QString m_checksum; }; +} // NS DTO + +namespace Support { + +using InstallationInfo = Jellyfin::DTO::InstallationInfo; + +template <> +InstallationInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return InstallationInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/iplugin.h b/core/include/JellyfinQt/DTO/iplugin.h index 4d96075..9dde757 100644 --- a/core/include/JellyfinQt/DTO/iplugin.h +++ b/core/include/JellyfinQt/DTO/iplugin.h @@ -31,87 +31,102 @@ #define JELLYFIN_DTO_IPLUGIN_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/version.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class Version; -class IPlugin : public QObject { - Q_OBJECT +class IPlugin { public: - explicit IPlugin(QObject *parent = nullptr); - static IPlugin *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit IPlugin(); + static IPlugin fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the name of the plugin. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets the name of the plugin. + */ + void setName(QString newName); /** * @brief Gets the Description. */ - Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged) + QString description() const; + /** + * @brief Gets the Description. + */ + void setDescription(QString newDescription); /** * @brief Gets the unique id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(Version * version READ version WRITE setVersion NOTIFY versionChanged) + QUuid jellyfinId() const; + /** + * @brief Gets the unique id. + */ + void setJellyfinId(QUuid newJellyfinId); + + QSharedPointer version() const; + + void setVersion(QSharedPointer newVersion); /** * @brief Gets the path to the assembly file. */ - Q_PROPERTY(QString assemblyFilePath READ assemblyFilePath WRITE setAssemblyFilePath NOTIFY assemblyFilePathChanged) + QString assemblyFilePath() const; + /** + * @brief Gets the path to the assembly file. + */ + void setAssemblyFilePath(QString newAssemblyFilePath); /** * @brief Gets a value indicating whether the plugin can be uninstalled. */ - Q_PROPERTY(bool canUninstall READ canUninstall WRITE setCanUninstall NOTIFY canUninstallChanged) + bool canUninstall() const; + /** + * @brief Gets a value indicating whether the plugin can be uninstalled. + */ + void setCanUninstall(bool newCanUninstall); /** * @brief Gets the full path to the data folder, where the plugin can store any miscellaneous files needed. */ - Q_PROPERTY(QString dataFolderPath READ dataFolderPath WRITE setDataFolderPath NOTIFY dataFolderPathChanged) - - QString name() const; - void setName(QString newName); - - QString description() const; - void setDescription(QString newDescription); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - Version * version() const; - void setVersion(Version * newVersion); - - QString assemblyFilePath() const; - void setAssemblyFilePath(QString newAssemblyFilePath); - - bool canUninstall() const; - void setCanUninstall(bool newCanUninstall); - QString dataFolderPath() const; + /** + * @brief Gets the full path to the data folder, where the plugin can store any miscellaneous files needed. + */ void setDataFolderPath(QString newDataFolderPath); - -signals: - void nameChanged(QString newName); - void descriptionChanged(QString newDescription); - void jellyfinIdChanged(QString newJellyfinId); - void versionChanged(Version * newVersion); - void assemblyFilePathChanged(QString newAssemblyFilePath); - void canUninstallChanged(bool newCanUninstall); - void dataFolderPathChanged(QString newDataFolderPath); + protected: QString m_name; QString m_description; - QString m_jellyfinId; - Version * m_version = nullptr; + QUuid m_jellyfinId; + QSharedPointer m_version = nullptr; QString m_assemblyFilePath; bool m_canUninstall; QString m_dataFolderPath; }; +} // NS DTO + +namespace Support { + +using IPlugin = Jellyfin::DTO::IPlugin; + +template <> +IPlugin fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return IPlugin::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/isotype.h b/core/include/JellyfinQt/DTO/isotype.h index ea5f8e8..aec1a28 100644 --- a/core/include/JellyfinQt/DTO/isotype.h +++ b/core/include/JellyfinQt/DTO/isotype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_ISOTYPE_H #define JELLYFIN_DTO_ISOTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class IsoTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Dvd, BluRay, }; @@ -46,8 +51,31 @@ public: private: explicit IsoTypeClass(); }; + typedef IsoTypeClass::Value IsoType; +} // NS DTO + +namespace Support { + +using IsoType = Jellyfin::DTO::IsoType; +using IsoTypeClass = Jellyfin::DTO::IsoTypeClass; + +template <> +IsoType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return IsoTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Dvd")) { + return IsoTypeClass::Dvd; + } + if (str == QStringLiteral("BluRay")) { + return IsoTypeClass::BluRay; + } + + return IsoTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/item.h b/core/include/JellyfinQt/DTO/item.h index b9ddd93..bc7a76c 100644 --- a/core/include/JellyfinQt/DTO/item.h +++ b/core/include/JellyfinQt/DTO/item.h @@ -30,7 +30,7 @@ #ifndef JELLYFIN_DTO_ITEM_H #define JELLYFIN_DTO_ITEM_H -#include "JellyfinQt/DTO/baseitemdto.h" +#include "JellyfinQt/BaseItemDto" namespace Jellyfin { namespace DTO { diff --git a/core/include/JellyfinQt/DTO/itemcounts.h b/core/include/JellyfinQt/DTO/itemcounts.h index 2a23846..e990b66 100644 --- a/core/include/JellyfinQt/DTO/itemcounts.h +++ b/core/include/JellyfinQt/DTO/itemcounts.h @@ -31,117 +31,120 @@ #define JELLYFIN_DTO_ITEMCOUNTS_H #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ItemCounts : public QObject { - Q_OBJECT -public: - explicit ItemCounts(QObject *parent = nullptr); - static ItemCounts *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ItemCounts { +public: + explicit ItemCounts(); + static ItemCounts fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the movie count. */ - Q_PROPERTY(qint32 movieCount READ movieCount WRITE setMovieCount NOTIFY movieCountChanged) + qint32 movieCount() const; + /** + * @brief Gets or sets the movie count. + */ + void setMovieCount(qint32 newMovieCount); /** * @brief Gets or sets the series count. */ - Q_PROPERTY(qint32 seriesCount READ seriesCount WRITE setSeriesCount NOTIFY seriesCountChanged) + qint32 seriesCount() const; + /** + * @brief Gets or sets the series count. + */ + void setSeriesCount(qint32 newSeriesCount); /** * @brief Gets or sets the episode count. */ - Q_PROPERTY(qint32 episodeCount READ episodeCount WRITE setEpisodeCount NOTIFY episodeCountChanged) + qint32 episodeCount() const; + /** + * @brief Gets or sets the episode count. + */ + void setEpisodeCount(qint32 newEpisodeCount); /** * @brief Gets or sets the artist count. */ - Q_PROPERTY(qint32 artistCount READ artistCount WRITE setArtistCount NOTIFY artistCountChanged) + qint32 artistCount() const; + /** + * @brief Gets or sets the artist count. + */ + void setArtistCount(qint32 newArtistCount); /** * @brief Gets or sets the program count. */ - Q_PROPERTY(qint32 programCount READ programCount WRITE setProgramCount NOTIFY programCountChanged) + qint32 programCount() const; + /** + * @brief Gets or sets the program count. + */ + void setProgramCount(qint32 newProgramCount); /** * @brief Gets or sets the trailer count. */ - Q_PROPERTY(qint32 trailerCount READ trailerCount WRITE setTrailerCount NOTIFY trailerCountChanged) + qint32 trailerCount() const; + /** + * @brief Gets or sets the trailer count. + */ + void setTrailerCount(qint32 newTrailerCount); /** * @brief Gets or sets the song count. */ - Q_PROPERTY(qint32 songCount READ songCount WRITE setSongCount NOTIFY songCountChanged) + qint32 songCount() const; + /** + * @brief Gets or sets the song count. + */ + void setSongCount(qint32 newSongCount); /** * @brief Gets or sets the album count. */ - Q_PROPERTY(qint32 albumCount READ albumCount WRITE setAlbumCount NOTIFY albumCountChanged) + qint32 albumCount() const; + /** + * @brief Gets or sets the album count. + */ + void setAlbumCount(qint32 newAlbumCount); /** * @brief Gets or sets the music video count. */ - Q_PROPERTY(qint32 musicVideoCount READ musicVideoCount WRITE setMusicVideoCount NOTIFY musicVideoCountChanged) + qint32 musicVideoCount() const; + /** + * @brief Gets or sets the music video count. + */ + void setMusicVideoCount(qint32 newMusicVideoCount); /** * @brief Gets or sets the box set count. */ - Q_PROPERTY(qint32 boxSetCount READ boxSetCount WRITE setBoxSetCount NOTIFY boxSetCountChanged) + qint32 boxSetCount() const; + /** + * @brief Gets or sets the box set count. + */ + void setBoxSetCount(qint32 newBoxSetCount); /** * @brief Gets or sets the book count. */ - Q_PROPERTY(qint32 bookCount READ bookCount WRITE setBookCount NOTIFY bookCountChanged) + qint32 bookCount() const; + /** + * @brief Gets or sets the book count. + */ + void setBookCount(qint32 newBookCount); /** * @brief Gets or sets the item count. */ - Q_PROPERTY(qint32 itemCount READ itemCount WRITE setItemCount NOTIFY itemCountChanged) - - qint32 movieCount() const; - void setMovieCount(qint32 newMovieCount); - - qint32 seriesCount() const; - void setSeriesCount(qint32 newSeriesCount); - - qint32 episodeCount() const; - void setEpisodeCount(qint32 newEpisodeCount); - - qint32 artistCount() const; - void setArtistCount(qint32 newArtistCount); - - qint32 programCount() const; - void setProgramCount(qint32 newProgramCount); - - qint32 trailerCount() const; - void setTrailerCount(qint32 newTrailerCount); - - qint32 songCount() const; - void setSongCount(qint32 newSongCount); - - qint32 albumCount() const; - void setAlbumCount(qint32 newAlbumCount); - - qint32 musicVideoCount() const; - void setMusicVideoCount(qint32 newMusicVideoCount); - - qint32 boxSetCount() const; - void setBoxSetCount(qint32 newBoxSetCount); - - qint32 bookCount() const; - void setBookCount(qint32 newBookCount); - qint32 itemCount() const; + /** + * @brief Gets or sets the item count. + */ void setItemCount(qint32 newItemCount); - -signals: - void movieCountChanged(qint32 newMovieCount); - void seriesCountChanged(qint32 newSeriesCount); - void episodeCountChanged(qint32 newEpisodeCount); - void artistCountChanged(qint32 newArtistCount); - void programCountChanged(qint32 newProgramCount); - void trailerCountChanged(qint32 newTrailerCount); - void songCountChanged(qint32 newSongCount); - void albumCountChanged(qint32 newAlbumCount); - void musicVideoCountChanged(qint32 newMusicVideoCount); - void boxSetCountChanged(qint32 newBoxSetCount); - void bookCountChanged(qint32 newBookCount); - void itemCountChanged(qint32 newItemCount); + protected: qint32 m_movieCount; qint32 m_seriesCount; @@ -157,6 +160,18 @@ protected: qint32 m_itemCount; }; +} // NS DTO + +namespace Support { + +using ItemCounts = Jellyfin::DTO::ItemCounts; + +template <> +ItemCounts fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ItemCounts::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/itemfields.h b/core/include/JellyfinQt/DTO/itemfields.h index 2186093..31d0761 100644 --- a/core/include/JellyfinQt/DTO/itemfields.h +++ b/core/include/JellyfinQt/DTO/itemfields.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_ITEMFIELDS_H #define JELLYFIN_DTO_ITEMFIELDS_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ItemFieldsClass { Q_GADGET public: enum Value { + EnumNotSet, AirTime, CanDelete, CanDownload, @@ -105,8 +110,208 @@ public: private: explicit ItemFieldsClass(); }; + typedef ItemFieldsClass::Value ItemFields; +} // NS DTO + +namespace Support { + +using ItemFields = Jellyfin::DTO::ItemFields; +using ItemFieldsClass = Jellyfin::DTO::ItemFieldsClass; + +template <> +ItemFields fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ItemFieldsClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("AirTime")) { + return ItemFieldsClass::AirTime; + } + if (str == QStringLiteral("CanDelete")) { + return ItemFieldsClass::CanDelete; + } + if (str == QStringLiteral("CanDownload")) { + return ItemFieldsClass::CanDownload; + } + if (str == QStringLiteral("ChannelInfo")) { + return ItemFieldsClass::ChannelInfo; + } + if (str == QStringLiteral("Chapters")) { + return ItemFieldsClass::Chapters; + } + if (str == QStringLiteral("ChildCount")) { + return ItemFieldsClass::ChildCount; + } + if (str == QStringLiteral("CumulativeRunTimeTicks")) { + return ItemFieldsClass::CumulativeRunTimeTicks; + } + if (str == QStringLiteral("CustomRating")) { + return ItemFieldsClass::CustomRating; + } + if (str == QStringLiteral("DateCreated")) { + return ItemFieldsClass::DateCreated; + } + if (str == QStringLiteral("DateLastMediaAdded")) { + return ItemFieldsClass::DateLastMediaAdded; + } + if (str == QStringLiteral("DisplayPreferencesId")) { + return ItemFieldsClass::DisplayPreferencesId; + } + if (str == QStringLiteral("Etag")) { + return ItemFieldsClass::Etag; + } + if (str == QStringLiteral("ExternalUrls")) { + return ItemFieldsClass::ExternalUrls; + } + if (str == QStringLiteral("Genres")) { + return ItemFieldsClass::Genres; + } + if (str == QStringLiteral("HomePageUrl")) { + return ItemFieldsClass::HomePageUrl; + } + if (str == QStringLiteral("ItemCounts")) { + return ItemFieldsClass::ItemCounts; + } + if (str == QStringLiteral("MediaSourceCount")) { + return ItemFieldsClass::MediaSourceCount; + } + if (str == QStringLiteral("MediaSources")) { + return ItemFieldsClass::MediaSources; + } + if (str == QStringLiteral("OriginalTitle")) { + return ItemFieldsClass::OriginalTitle; + } + if (str == QStringLiteral("Overview")) { + return ItemFieldsClass::Overview; + } + if (str == QStringLiteral("ParentId")) { + return ItemFieldsClass::ParentId; + } + if (str == QStringLiteral("Path")) { + return ItemFieldsClass::Path; + } + if (str == QStringLiteral("People")) { + return ItemFieldsClass::People; + } + if (str == QStringLiteral("PlayAccess")) { + return ItemFieldsClass::PlayAccess; + } + if (str == QStringLiteral("ProductionLocations")) { + return ItemFieldsClass::ProductionLocations; + } + if (str == QStringLiteral("ProviderIds")) { + return ItemFieldsClass::ProviderIds; + } + if (str == QStringLiteral("PrimaryImageAspectRatio")) { + return ItemFieldsClass::PrimaryImageAspectRatio; + } + if (str == QStringLiteral("RecursiveItemCount")) { + return ItemFieldsClass::RecursiveItemCount; + } + if (str == QStringLiteral("Settings")) { + return ItemFieldsClass::Settings; + } + if (str == QStringLiteral("ScreenshotImageTags")) { + return ItemFieldsClass::ScreenshotImageTags; + } + if (str == QStringLiteral("SeriesPrimaryImage")) { + return ItemFieldsClass::SeriesPrimaryImage; + } + if (str == QStringLiteral("SeriesStudio")) { + return ItemFieldsClass::SeriesStudio; + } + if (str == QStringLiteral("SortName")) { + return ItemFieldsClass::SortName; + } + if (str == QStringLiteral("SpecialEpisodeNumbers")) { + return ItemFieldsClass::SpecialEpisodeNumbers; + } + if (str == QStringLiteral("Studios")) { + return ItemFieldsClass::Studios; + } + if (str == QStringLiteral("BasicSyncInfo")) { + return ItemFieldsClass::BasicSyncInfo; + } + if (str == QStringLiteral("SyncInfo")) { + return ItemFieldsClass::SyncInfo; + } + if (str == QStringLiteral("Taglines")) { + return ItemFieldsClass::Taglines; + } + if (str == QStringLiteral("Tags")) { + return ItemFieldsClass::Tags; + } + if (str == QStringLiteral("RemoteTrailers")) { + return ItemFieldsClass::RemoteTrailers; + } + if (str == QStringLiteral("MediaStreams")) { + return ItemFieldsClass::MediaStreams; + } + if (str == QStringLiteral("SeasonUserData")) { + return ItemFieldsClass::SeasonUserData; + } + if (str == QStringLiteral("ServiceName")) { + return ItemFieldsClass::ServiceName; + } + if (str == QStringLiteral("ThemeSongIds")) { + return ItemFieldsClass::ThemeSongIds; + } + if (str == QStringLiteral("ThemeVideoIds")) { + return ItemFieldsClass::ThemeVideoIds; + } + if (str == QStringLiteral("ExternalEtag")) { + return ItemFieldsClass::ExternalEtag; + } + if (str == QStringLiteral("PresentationUniqueKey")) { + return ItemFieldsClass::PresentationUniqueKey; + } + if (str == QStringLiteral("InheritedParentalRatingValue")) { + return ItemFieldsClass::InheritedParentalRatingValue; + } + if (str == QStringLiteral("ExternalSeriesId")) { + return ItemFieldsClass::ExternalSeriesId; + } + if (str == QStringLiteral("SeriesPresentationUniqueKey")) { + return ItemFieldsClass::SeriesPresentationUniqueKey; + } + if (str == QStringLiteral("DateLastRefreshed")) { + return ItemFieldsClass::DateLastRefreshed; + } + if (str == QStringLiteral("DateLastSaved")) { + return ItemFieldsClass::DateLastSaved; + } + if (str == QStringLiteral("RefreshState")) { + return ItemFieldsClass::RefreshState; + } + if (str == QStringLiteral("ChannelImage")) { + return ItemFieldsClass::ChannelImage; + } + if (str == QStringLiteral("EnableMediaSourceDisplay")) { + return ItemFieldsClass::EnableMediaSourceDisplay; + } + if (str == QStringLiteral("Width")) { + return ItemFieldsClass::Width; + } + if (str == QStringLiteral("Height")) { + return ItemFieldsClass::Height; + } + if (str == QStringLiteral("ExtraIds")) { + return ItemFieldsClass::ExtraIds; + } + if (str == QStringLiteral("LocalTrailerCount")) { + return ItemFieldsClass::LocalTrailerCount; + } + if (str == QStringLiteral("IsHD")) { + return ItemFieldsClass::IsHD; + } + if (str == QStringLiteral("SpecialFeatureCount")) { + return ItemFieldsClass::SpecialFeatureCount; + } + + return ItemFieldsClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/itemfilter.h b/core/include/JellyfinQt/DTO/itemfilter.h index af89fab..a27d36c 100644 --- a/core/include/JellyfinQt/DTO/itemfilter.h +++ b/core/include/JellyfinQt/DTO/itemfilter.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_ITEMFILTER_H #define JELLYFIN_DTO_ITEMFILTER_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ItemFilterClass { Q_GADGET public: enum Value { + EnumNotSet, IsFolder, IsNotFolder, IsUnplayed, @@ -53,8 +58,52 @@ public: private: explicit ItemFilterClass(); }; + typedef ItemFilterClass::Value ItemFilter; +} // NS DTO + +namespace Support { + +using ItemFilter = Jellyfin::DTO::ItemFilter; +using ItemFilterClass = Jellyfin::DTO::ItemFilterClass; + +template <> +ItemFilter fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ItemFilterClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("IsFolder")) { + return ItemFilterClass::IsFolder; + } + if (str == QStringLiteral("IsNotFolder")) { + return ItemFilterClass::IsNotFolder; + } + if (str == QStringLiteral("IsUnplayed")) { + return ItemFilterClass::IsUnplayed; + } + if (str == QStringLiteral("IsPlayed")) { + return ItemFilterClass::IsPlayed; + } + if (str == QStringLiteral("IsFavorite")) { + return ItemFilterClass::IsFavorite; + } + if (str == QStringLiteral("IsResumable")) { + return ItemFilterClass::IsResumable; + } + if (str == QStringLiteral("Likes")) { + return ItemFilterClass::Likes; + } + if (str == QStringLiteral("Dislikes")) { + return ItemFilterClass::Dislikes; + } + if (str == QStringLiteral("IsFavoriteOrLikes")) { + return ItemFilterClass::IsFavoriteOrLikes; + } + + return ItemFilterClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/joingrouprequestdto.h b/core/include/JellyfinQt/DTO/joingrouprequestdto.h index 26dd7cc..2cd237d 100644 --- a/core/include/JellyfinQt/DTO/joingrouprequestdto.h +++ b/core/include/JellyfinQt/DTO/joingrouprequestdto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_JOINGROUPREQUESTDTO_H #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class JoinGroupRequestDto : public QObject { - Q_OBJECT -public: - explicit JoinGroupRequestDto(QObject *parent = nullptr); - static JoinGroupRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class JoinGroupRequestDto { +public: + explicit JoinGroupRequestDto(); + static JoinGroupRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the group identifier. */ - Q_PROPERTY(QString groupId READ groupId WRITE setGroupId NOTIFY groupIdChanged) + QUuid groupId() const; + /** + * @brief Gets or sets the group identifier. + */ + void setGroupId(QUuid newGroupId); - QString groupId() const; - void setGroupId(QString newGroupId); - -signals: - void groupIdChanged(QString newGroupId); protected: - QString m_groupId; + QUuid m_groupId; }; +} // NS DTO + +namespace Support { + +using JoinGroupRequestDto = Jellyfin::DTO::JoinGroupRequestDto; + +template <> +JoinGroupRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return JoinGroupRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/keepuntil.h b/core/include/JellyfinQt/DTO/keepuntil.h index 0ae8d9c..fb8ae0f 100644 --- a/core/include/JellyfinQt/DTO/keepuntil.h +++ b/core/include/JellyfinQt/DTO/keepuntil.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_KEEPUNTIL_H #define JELLYFIN_DTO_KEEPUNTIL_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class KeepUntilClass { Q_GADGET public: enum Value { + EnumNotSet, UntilDeleted, UntilSpaceNeeded, UntilWatched, @@ -48,8 +53,37 @@ public: private: explicit KeepUntilClass(); }; + typedef KeepUntilClass::Value KeepUntil; +} // NS DTO + +namespace Support { + +using KeepUntil = Jellyfin::DTO::KeepUntil; +using KeepUntilClass = Jellyfin::DTO::KeepUntilClass; + +template <> +KeepUntil fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return KeepUntilClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("UntilDeleted")) { + return KeepUntilClass::UntilDeleted; + } + if (str == QStringLiteral("UntilSpaceNeeded")) { + return KeepUntilClass::UntilSpaceNeeded; + } + if (str == QStringLiteral("UntilWatched")) { + return KeepUntilClass::UntilWatched; + } + if (str == QStringLiteral("UntilDate")) { + return KeepUntilClass::UntilDate; + } + + return KeepUntilClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/libraryoptioninfodto.h b/core/include/JellyfinQt/DTO/libraryoptioninfodto.h index de3a17f..8fcddf6 100644 --- a/core/include/JellyfinQt/DTO/libraryoptioninfodto.h +++ b/core/include/JellyfinQt/DTO/libraryoptioninfodto.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_LIBRARYOPTIONINFODTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LibraryOptionInfoDto : public QObject { - Q_OBJECT -public: - explicit LibraryOptionInfoDto(QObject *parent = nullptr); - static LibraryOptionInfoDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class LibraryOptionInfoDto { +public: + explicit LibraryOptionInfoDto(); + static LibraryOptionInfoDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets name. + */ + void setName(QString newName); /** * @brief Gets or sets a value indicating whether default enabled. */ - Q_PROPERTY(bool defaultEnabled READ defaultEnabled WRITE setDefaultEnabled NOTIFY defaultEnabledChanged) - - QString name() const; - void setName(QString newName); - bool defaultEnabled() const; + /** + * @brief Gets or sets a value indicating whether default enabled. + */ void setDefaultEnabled(bool newDefaultEnabled); - -signals: - void nameChanged(QString newName); - void defaultEnabledChanged(bool newDefaultEnabled); + protected: QString m_name; bool m_defaultEnabled; }; +} // NS DTO + +namespace Support { + +using LibraryOptionInfoDto = Jellyfin::DTO::LibraryOptionInfoDto; + +template <> +LibraryOptionInfoDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LibraryOptionInfoDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/libraryoptions.h b/core/include/JellyfinQt/DTO/libraryoptions.h index dd6386c..10bc13f 100644 --- a/core/include/JellyfinQt/DTO/libraryoptions.h +++ b/core/include/JellyfinQt/DTO/libraryoptions.h @@ -31,164 +31,144 @@ #define JELLYFIN_DTO_LIBRARYOPTIONS_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/mediapathinfo.h" +#include "JellyfinQt/DTO/typeoptions.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaPathInfo; -class TypeOptions; -class LibraryOptions : public QObject { - Q_OBJECT +class LibraryOptions { public: - explicit LibraryOptions(QObject *parent = nullptr); - static LibraryOptions *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit LibraryOptions(); + static LibraryOptions fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(bool enablePhotos READ enablePhotos WRITE setEnablePhotos NOTIFY enablePhotosChanged) - Q_PROPERTY(bool enableRealtimeMonitor READ enableRealtimeMonitor WRITE setEnableRealtimeMonitor NOTIFY enableRealtimeMonitorChanged) - Q_PROPERTY(bool enableChapterImageExtraction READ enableChapterImageExtraction WRITE setEnableChapterImageExtraction NOTIFY enableChapterImageExtractionChanged) - Q_PROPERTY(bool extractChapterImagesDuringLibraryScan READ extractChapterImagesDuringLibraryScan WRITE setExtractChapterImagesDuringLibraryScan NOTIFY extractChapterImagesDuringLibraryScanChanged) - Q_PROPERTY(QList pathInfos READ pathInfos WRITE setPathInfos NOTIFY pathInfosChanged) - Q_PROPERTY(bool saveLocalMetadata READ saveLocalMetadata WRITE setSaveLocalMetadata NOTIFY saveLocalMetadataChanged) - Q_PROPERTY(bool enableInternetProviders READ enableInternetProviders WRITE setEnableInternetProviders NOTIFY enableInternetProvidersChanged) - Q_PROPERTY(bool enableAutomaticSeriesGrouping READ enableAutomaticSeriesGrouping WRITE setEnableAutomaticSeriesGrouping NOTIFY enableAutomaticSeriesGroupingChanged) - Q_PROPERTY(bool enableEmbeddedTitles READ enableEmbeddedTitles WRITE setEnableEmbeddedTitles NOTIFY enableEmbeddedTitlesChanged) - Q_PROPERTY(bool enableEmbeddedEpisodeInfos READ enableEmbeddedEpisodeInfos WRITE setEnableEmbeddedEpisodeInfos NOTIFY enableEmbeddedEpisodeInfosChanged) - Q_PROPERTY(qint32 automaticRefreshIntervalDays READ automaticRefreshIntervalDays WRITE setAutomaticRefreshIntervalDays NOTIFY automaticRefreshIntervalDaysChanged) + bool enablePhotos() const; + + void setEnablePhotos(bool newEnablePhotos); + + bool enableRealtimeMonitor() const; + + void setEnableRealtimeMonitor(bool newEnableRealtimeMonitor); + + bool enableChapterImageExtraction() const; + + void setEnableChapterImageExtraction(bool newEnableChapterImageExtraction); + + bool extractChapterImagesDuringLibraryScan() const; + + void setExtractChapterImagesDuringLibraryScan(bool newExtractChapterImagesDuringLibraryScan); + + QList> pathInfos() const; + + void setPathInfos(QList> newPathInfos); + + bool saveLocalMetadata() const; + + void setSaveLocalMetadata(bool newSaveLocalMetadata); + + bool enableInternetProviders() const; + + void setEnableInternetProviders(bool newEnableInternetProviders); + + bool enableAutomaticSeriesGrouping() const; + + void setEnableAutomaticSeriesGrouping(bool newEnableAutomaticSeriesGrouping); + + bool enableEmbeddedTitles() const; + + void setEnableEmbeddedTitles(bool newEnableEmbeddedTitles); + + bool enableEmbeddedEpisodeInfos() const; + + void setEnableEmbeddedEpisodeInfos(bool newEnableEmbeddedEpisodeInfos); + + qint32 automaticRefreshIntervalDays() const; + + void setAutomaticRefreshIntervalDays(qint32 newAutomaticRefreshIntervalDays); /** * @brief Gets or sets the preferred metadata language. */ - Q_PROPERTY(QString preferredMetadataLanguage READ preferredMetadataLanguage WRITE setPreferredMetadataLanguage NOTIFY preferredMetadataLanguageChanged) + QString preferredMetadataLanguage() const; + /** + * @brief Gets or sets the preferred metadata language. + */ + void setPreferredMetadataLanguage(QString newPreferredMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) - Q_PROPERTY(QString seasonZeroDisplayName READ seasonZeroDisplayName WRITE setSeasonZeroDisplayName NOTIFY seasonZeroDisplayNameChanged) - Q_PROPERTY(QStringList metadataSavers READ metadataSavers WRITE setMetadataSavers NOTIFY metadataSaversChanged) - Q_PROPERTY(QStringList disabledLocalMetadataReaders READ disabledLocalMetadataReaders WRITE setDisabledLocalMetadataReaders NOTIFY disabledLocalMetadataReadersChanged) - Q_PROPERTY(QStringList localMetadataReaderOrder READ localMetadataReaderOrder WRITE setLocalMetadataReaderOrder NOTIFY localMetadataReaderOrderChanged) - Q_PROPERTY(QStringList disabledSubtitleFetchers READ disabledSubtitleFetchers WRITE setDisabledSubtitleFetchers NOTIFY disabledSubtitleFetchersChanged) - Q_PROPERTY(QStringList subtitleFetcherOrder READ subtitleFetcherOrder WRITE setSubtitleFetcherOrder NOTIFY subtitleFetcherOrderChanged) - Q_PROPERTY(bool skipSubtitlesIfEmbeddedSubtitlesPresent READ skipSubtitlesIfEmbeddedSubtitlesPresent WRITE setSkipSubtitlesIfEmbeddedSubtitlesPresent NOTIFY skipSubtitlesIfEmbeddedSubtitlesPresentChanged) - Q_PROPERTY(bool skipSubtitlesIfAudioTrackMatches READ skipSubtitlesIfAudioTrackMatches WRITE setSkipSubtitlesIfAudioTrackMatches NOTIFY skipSubtitlesIfAudioTrackMatchesChanged) - Q_PROPERTY(QStringList subtitleDownloadLanguages READ subtitleDownloadLanguages WRITE setSubtitleDownloadLanguages NOTIFY subtitleDownloadLanguagesChanged) - Q_PROPERTY(bool requirePerfectSubtitleMatch READ requirePerfectSubtitleMatch WRITE setRequirePerfectSubtitleMatch NOTIFY requirePerfectSubtitleMatchChanged) - Q_PROPERTY(bool saveSubtitlesWithMedia READ saveSubtitlesWithMedia WRITE setSaveSubtitlesWithMedia NOTIFY saveSubtitlesWithMediaChanged) - Q_PROPERTY(QList typeOptions READ typeOptions WRITE setTypeOptions NOTIFY typeOptionsChanged) - - bool enablePhotos() const; - void setEnablePhotos(bool newEnablePhotos); - - bool enableRealtimeMonitor() const; - void setEnableRealtimeMonitor(bool newEnableRealtimeMonitor); - - bool enableChapterImageExtraction() const; - void setEnableChapterImageExtraction(bool newEnableChapterImageExtraction); - - bool extractChapterImagesDuringLibraryScan() const; - void setExtractChapterImagesDuringLibraryScan(bool newExtractChapterImagesDuringLibraryScan); - - QList pathInfos() const; - void setPathInfos(QList newPathInfos); - - bool saveLocalMetadata() const; - void setSaveLocalMetadata(bool newSaveLocalMetadata); - - bool enableInternetProviders() const; - void setEnableInternetProviders(bool newEnableInternetProviders); - - bool enableAutomaticSeriesGrouping() const; - void setEnableAutomaticSeriesGrouping(bool newEnableAutomaticSeriesGrouping); - - bool enableEmbeddedTitles() const; - void setEnableEmbeddedTitles(bool newEnableEmbeddedTitles); - - bool enableEmbeddedEpisodeInfos() const; - void setEnableEmbeddedEpisodeInfos(bool newEnableEmbeddedEpisodeInfos); - - qint32 automaticRefreshIntervalDays() const; - void setAutomaticRefreshIntervalDays(qint32 newAutomaticRefreshIntervalDays); - - QString preferredMetadataLanguage() const; - void setPreferredMetadataLanguage(QString newPreferredMetadataLanguage); - QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ void setMetadataCountryCode(QString newMetadataCountryCode); - + QString seasonZeroDisplayName() const; + void setSeasonZeroDisplayName(QString newSeasonZeroDisplayName); - + QStringList metadataSavers() const; + void setMetadataSavers(QStringList newMetadataSavers); - + QStringList disabledLocalMetadataReaders() const; + void setDisabledLocalMetadataReaders(QStringList newDisabledLocalMetadataReaders); - + QStringList localMetadataReaderOrder() const; + void setLocalMetadataReaderOrder(QStringList newLocalMetadataReaderOrder); - + QStringList disabledSubtitleFetchers() const; + void setDisabledSubtitleFetchers(QStringList newDisabledSubtitleFetchers); - + QStringList subtitleFetcherOrder() const; + void setSubtitleFetcherOrder(QStringList newSubtitleFetcherOrder); - + bool skipSubtitlesIfEmbeddedSubtitlesPresent() const; + void setSkipSubtitlesIfEmbeddedSubtitlesPresent(bool newSkipSubtitlesIfEmbeddedSubtitlesPresent); - + bool skipSubtitlesIfAudioTrackMatches() const; + void setSkipSubtitlesIfAudioTrackMatches(bool newSkipSubtitlesIfAudioTrackMatches); - + QStringList subtitleDownloadLanguages() const; + void setSubtitleDownloadLanguages(QStringList newSubtitleDownloadLanguages); - + bool requirePerfectSubtitleMatch() const; + void setRequirePerfectSubtitleMatch(bool newRequirePerfectSubtitleMatch); - + bool saveSubtitlesWithMedia() const; + void setSaveSubtitlesWithMedia(bool newSaveSubtitlesWithMedia); - - QList typeOptions() const; - void setTypeOptions(QList newTypeOptions); - -signals: - void enablePhotosChanged(bool newEnablePhotos); - void enableRealtimeMonitorChanged(bool newEnableRealtimeMonitor); - void enableChapterImageExtractionChanged(bool newEnableChapterImageExtraction); - void extractChapterImagesDuringLibraryScanChanged(bool newExtractChapterImagesDuringLibraryScan); - void pathInfosChanged(QList newPathInfos); - void saveLocalMetadataChanged(bool newSaveLocalMetadata); - void enableInternetProvidersChanged(bool newEnableInternetProviders); - void enableAutomaticSeriesGroupingChanged(bool newEnableAutomaticSeriesGrouping); - void enableEmbeddedTitlesChanged(bool newEnableEmbeddedTitles); - void enableEmbeddedEpisodeInfosChanged(bool newEnableEmbeddedEpisodeInfos); - void automaticRefreshIntervalDaysChanged(qint32 newAutomaticRefreshIntervalDays); - void preferredMetadataLanguageChanged(QString newPreferredMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void seasonZeroDisplayNameChanged(QString newSeasonZeroDisplayName); - void metadataSaversChanged(QStringList newMetadataSavers); - void disabledLocalMetadataReadersChanged(QStringList newDisabledLocalMetadataReaders); - void localMetadataReaderOrderChanged(QStringList newLocalMetadataReaderOrder); - void disabledSubtitleFetchersChanged(QStringList newDisabledSubtitleFetchers); - void subtitleFetcherOrderChanged(QStringList newSubtitleFetcherOrder); - void skipSubtitlesIfEmbeddedSubtitlesPresentChanged(bool newSkipSubtitlesIfEmbeddedSubtitlesPresent); - void skipSubtitlesIfAudioTrackMatchesChanged(bool newSkipSubtitlesIfAudioTrackMatches); - void subtitleDownloadLanguagesChanged(QStringList newSubtitleDownloadLanguages); - void requirePerfectSubtitleMatchChanged(bool newRequirePerfectSubtitleMatch); - void saveSubtitlesWithMediaChanged(bool newSaveSubtitlesWithMedia); - void typeOptionsChanged(QList newTypeOptions); + + QList> typeOptions() const; + + void setTypeOptions(QList> newTypeOptions); + protected: bool m_enablePhotos; bool m_enableRealtimeMonitor; bool m_enableChapterImageExtraction; bool m_extractChapterImagesDuringLibraryScan; - QList m_pathInfos; + QList> m_pathInfos; bool m_saveLocalMetadata; bool m_enableInternetProviders; bool m_enableAutomaticSeriesGrouping; @@ -208,9 +188,21 @@ protected: QStringList m_subtitleDownloadLanguages; bool m_requirePerfectSubtitleMatch; bool m_saveSubtitlesWithMedia; - QList m_typeOptions; + QList> m_typeOptions; }; +} // NS DTO + +namespace Support { + +using LibraryOptions = Jellyfin::DTO::LibraryOptions; + +template <> +LibraryOptions fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LibraryOptions::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/libraryoptionsresultdto.h b/core/include/JellyfinQt/DTO/libraryoptionsresultdto.h index 3aed72d..8240c44 100644 --- a/core/include/JellyfinQt/DTO/libraryoptionsresultdto.h +++ b/core/include/JellyfinQt/DTO/libraryoptionsresultdto.h @@ -31,67 +31,80 @@ #define JELLYFIN_DTO_LIBRARYOPTIONSRESULTDTO_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/libraryoptioninfodto.h" +#include "JellyfinQt/DTO/librarytypeoptionsdto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LibraryOptionInfoDto; -class LibraryOptionInfoDto; -class LibraryOptionInfoDto; -class LibraryTypeOptionsDto; -class LibraryOptionsResultDto : public QObject { - Q_OBJECT +class LibraryOptionsResultDto { public: - explicit LibraryOptionsResultDto(QObject *parent = nullptr); - static LibraryOptionsResultDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit LibraryOptionsResultDto(); + static LibraryOptionsResultDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the metadata savers. */ - Q_PROPERTY(QList metadataSavers READ metadataSavers WRITE setMetadataSavers NOTIFY metadataSaversChanged) + QList> metadataSavers() const; + /** + * @brief Gets or sets the metadata savers. + */ + void setMetadataSavers(QList> newMetadataSavers); /** * @brief Gets or sets the metadata readers. */ - Q_PROPERTY(QList metadataReaders READ metadataReaders WRITE setMetadataReaders NOTIFY metadataReadersChanged) + QList> metadataReaders() const; + /** + * @brief Gets or sets the metadata readers. + */ + void setMetadataReaders(QList> newMetadataReaders); /** * @brief Gets or sets the subtitle fetchers. */ - Q_PROPERTY(QList subtitleFetchers READ subtitleFetchers WRITE setSubtitleFetchers NOTIFY subtitleFetchersChanged) + QList> subtitleFetchers() const; + /** + * @brief Gets or sets the subtitle fetchers. + */ + void setSubtitleFetchers(QList> newSubtitleFetchers); /** * @brief Gets or sets the type options. */ - Q_PROPERTY(QList typeOptions READ typeOptions WRITE setTypeOptions NOTIFY typeOptionsChanged) + QList> typeOptions() const; + /** + * @brief Gets or sets the type options. + */ + void setTypeOptions(QList> newTypeOptions); - QList metadataSavers() const; - void setMetadataSavers(QList newMetadataSavers); - - QList metadataReaders() const; - void setMetadataReaders(QList newMetadataReaders); - - QList subtitleFetchers() const; - void setSubtitleFetchers(QList newSubtitleFetchers); - - QList typeOptions() const; - void setTypeOptions(QList newTypeOptions); - -signals: - void metadataSaversChanged(QList newMetadataSavers); - void metadataReadersChanged(QList newMetadataReaders); - void subtitleFetchersChanged(QList newSubtitleFetchers); - void typeOptionsChanged(QList newTypeOptions); protected: - QList m_metadataSavers; - QList m_metadataReaders; - QList m_subtitleFetchers; - QList m_typeOptions; + QList> m_metadataSavers; + QList> m_metadataReaders; + QList> m_subtitleFetchers; + QList> m_typeOptions; }; +} // NS DTO + +namespace Support { + +using LibraryOptionsResultDto = Jellyfin::DTO::LibraryOptionsResultDto; + +template <> +LibraryOptionsResultDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LibraryOptionsResultDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/librarytypeoptionsdto.h b/core/include/JellyfinQt/DTO/librarytypeoptionsdto.h index c859769..0d3a97d 100644 --- a/core/include/JellyfinQt/DTO/librarytypeoptionsdto.h +++ b/core/include/JellyfinQt/DTO/librarytypeoptionsdto.h @@ -31,78 +31,91 @@ #define JELLYFIN_DTO_LIBRARYTYPEOPTIONSDTO_H #include +#include #include -#include +#include #include #include +#include +#include "JellyfinQt/DTO/imageoption.h" #include "JellyfinQt/DTO/imagetype.h" +#include "JellyfinQt/DTO/libraryoptioninfodto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ImageOption; -class LibraryOptionInfoDto; -class LibraryOptionInfoDto; -class LibraryTypeOptionsDto : public QObject { - Q_OBJECT +class LibraryTypeOptionsDto { public: - explicit LibraryTypeOptionsDto(QObject *parent = nullptr); - static LibraryTypeOptionsDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit LibraryTypeOptionsDto(); + static LibraryTypeOptionsDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the type. */ - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + QString type() const; + /** + * @brief Gets or sets the type. + */ + void setType(QString newType); /** * @brief Gets or sets the metadata fetchers. */ - Q_PROPERTY(QList metadataFetchers READ metadataFetchers WRITE setMetadataFetchers NOTIFY metadataFetchersChanged) + QList> metadataFetchers() const; + /** + * @brief Gets or sets the metadata fetchers. + */ + void setMetadataFetchers(QList> newMetadataFetchers); /** * @brief Gets or sets the image fetchers. */ - Q_PROPERTY(QList imageFetchers READ imageFetchers WRITE setImageFetchers NOTIFY imageFetchersChanged) + QList> imageFetchers() const; + /** + * @brief Gets or sets the image fetchers. + */ + void setImageFetchers(QList> newImageFetchers); /** * @brief Gets or sets the supported image types. */ - Q_PROPERTY(QList supportedImageTypes READ supportedImageTypes WRITE setSupportedImageTypes NOTIFY supportedImageTypesChanged) + QList supportedImageTypes() const; + /** + * @brief Gets or sets the supported image types. + */ + void setSupportedImageTypes(QList newSupportedImageTypes); /** * @brief Gets or sets the default image options. */ - Q_PROPERTY(QList defaultImageOptions READ defaultImageOptions WRITE setDefaultImageOptions NOTIFY defaultImageOptionsChanged) + QList> defaultImageOptions() const; + /** + * @brief Gets or sets the default image options. + */ + void setDefaultImageOptions(QList> newDefaultImageOptions); - QString type() const; - void setType(QString newType); - - QList metadataFetchers() const; - void setMetadataFetchers(QList newMetadataFetchers); - - QList imageFetchers() const; - void setImageFetchers(QList newImageFetchers); - - QList supportedImageTypes() const; - void setSupportedImageTypes(QList newSupportedImageTypes); - - QList defaultImageOptions() const; - void setDefaultImageOptions(QList newDefaultImageOptions); - -signals: - void typeChanged(QString newType); - void metadataFetchersChanged(QList newMetadataFetchers); - void imageFetchersChanged(QList newImageFetchers); - void supportedImageTypesChanged(QList newSupportedImageTypes); - void defaultImageOptionsChanged(QList newDefaultImageOptions); protected: QString m_type; - QList m_metadataFetchers; - QList m_imageFetchers; + QList> m_metadataFetchers; + QList> m_imageFetchers; QList m_supportedImageTypes; - QList m_defaultImageOptions; + QList> m_defaultImageOptions; }; +} // NS DTO + +namespace Support { + +using LibraryTypeOptionsDto = Jellyfin::DTO::LibraryTypeOptionsDto; + +template <> +LibraryTypeOptionsDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LibraryTypeOptionsDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/libraryupdateinfo.h b/core/include/JellyfinQt/DTO/libraryupdateinfo.h index bb3a406..374605f 100644 --- a/core/include/JellyfinQt/DTO/libraryupdateinfo.h +++ b/core/include/JellyfinQt/DTO/libraryupdateinfo.h @@ -31,74 +31,75 @@ #define JELLYFIN_DTO_LIBRARYUPDATEINFO_H #include +#include #include -#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LibraryUpdateInfo : public QObject { - Q_OBJECT -public: - explicit LibraryUpdateInfo(QObject *parent = nullptr); - static LibraryUpdateInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class LibraryUpdateInfo { +public: + explicit LibraryUpdateInfo(); + static LibraryUpdateInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the folders added to. */ - Q_PROPERTY(QStringList foldersAddedTo READ foldersAddedTo WRITE setFoldersAddedTo NOTIFY foldersAddedToChanged) + QStringList foldersAddedTo() const; + /** + * @brief Gets or sets the folders added to. + */ + void setFoldersAddedTo(QStringList newFoldersAddedTo); /** * @brief Gets or sets the folders removed from. */ - Q_PROPERTY(QStringList foldersRemovedFrom READ foldersRemovedFrom WRITE setFoldersRemovedFrom NOTIFY foldersRemovedFromChanged) + QStringList foldersRemovedFrom() const; + /** + * @brief Gets or sets the folders removed from. + */ + void setFoldersRemovedFrom(QStringList newFoldersRemovedFrom); /** * @brief Gets or sets the items added. */ - Q_PROPERTY(QStringList itemsAdded READ itemsAdded WRITE setItemsAdded NOTIFY itemsAddedChanged) + QStringList itemsAdded() const; + /** + * @brief Gets or sets the items added. + */ + void setItemsAdded(QStringList newItemsAdded); /** * @brief Gets or sets the items removed. */ - Q_PROPERTY(QStringList itemsRemoved READ itemsRemoved WRITE setItemsRemoved NOTIFY itemsRemovedChanged) + QStringList itemsRemoved() const; + /** + * @brief Gets or sets the items removed. + */ + void setItemsRemoved(QStringList newItemsRemoved); /** * @brief Gets or sets the items updated. */ - Q_PROPERTY(QStringList itemsUpdated READ itemsUpdated WRITE setItemsUpdated NOTIFY itemsUpdatedChanged) - Q_PROPERTY(QStringList collectionFolders READ collectionFolders WRITE setCollectionFolders NOTIFY collectionFoldersChanged) - Q_PROPERTY(bool isEmpty READ isEmpty WRITE setIsEmpty NOTIFY isEmptyChanged) - - QStringList foldersAddedTo() const; - void setFoldersAddedTo(QStringList newFoldersAddedTo); - - QStringList foldersRemovedFrom() const; - void setFoldersRemovedFrom(QStringList newFoldersRemovedFrom); - - QStringList itemsAdded() const; - void setItemsAdded(QStringList newItemsAdded); - - QStringList itemsRemoved() const; - void setItemsRemoved(QStringList newItemsRemoved); - QStringList itemsUpdated() const; + /** + * @brief Gets or sets the items updated. + */ void setItemsUpdated(QStringList newItemsUpdated); - + QStringList collectionFolders() const; + void setCollectionFolders(QStringList newCollectionFolders); - + bool isEmpty() const; + void setIsEmpty(bool newIsEmpty); - -signals: - void foldersAddedToChanged(QStringList newFoldersAddedTo); - void foldersRemovedFromChanged(QStringList newFoldersRemovedFrom); - void itemsAddedChanged(QStringList newItemsAdded); - void itemsRemovedChanged(QStringList newItemsRemoved); - void itemsUpdatedChanged(QStringList newItemsUpdated); - void collectionFoldersChanged(QStringList newCollectionFolders); - void isEmptyChanged(bool newIsEmpty); + protected: QStringList m_foldersAddedTo; QStringList m_foldersRemovedFrom; @@ -109,6 +110,18 @@ protected: bool m_isEmpty; }; +} // NS DTO + +namespace Support { + +using LibraryUpdateInfo = Jellyfin::DTO::LibraryUpdateInfo; + +template <> +LibraryUpdateInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LibraryUpdateInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/listingsproviderinfo.h b/core/include/JellyfinQt/DTO/listingsproviderinfo.h index b12a8a1..a322c85 100644 --- a/core/include/JellyfinQt/DTO/listingsproviderinfo.h +++ b/core/include/JellyfinQt/DTO/listingsproviderinfo.h @@ -31,116 +31,101 @@ #define JELLYFIN_DTO_LISTINGSPROVIDERINFO_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/namevaluepair.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NameValuePair; -class ListingsProviderInfo : public QObject { - Q_OBJECT +class ListingsProviderInfo { public: - explicit ListingsProviderInfo(QObject *parent = nullptr); - static ListingsProviderInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged) - Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) - Q_PROPERTY(QString listingsId READ listingsId WRITE setListingsId NOTIFY listingsIdChanged) - Q_PROPERTY(QString zipCode READ zipCode WRITE setZipCode NOTIFY zipCodeChanged) - Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged) - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(QStringList enabledTuners READ enabledTuners WRITE setEnabledTuners NOTIFY enabledTunersChanged) - Q_PROPERTY(bool enableAllTuners READ enableAllTuners WRITE setEnableAllTuners NOTIFY enableAllTunersChanged) - Q_PROPERTY(QStringList newsCategories READ newsCategories WRITE setNewsCategories NOTIFY newsCategoriesChanged) - Q_PROPERTY(QStringList sportsCategories READ sportsCategories WRITE setSportsCategories NOTIFY sportsCategoriesChanged) - Q_PROPERTY(QStringList kidsCategories READ kidsCategories WRITE setKidsCategories NOTIFY kidsCategoriesChanged) - Q_PROPERTY(QStringList movieCategories READ movieCategories WRITE setMovieCategories NOTIFY movieCategoriesChanged) - Q_PROPERTY(QList channelMappings READ channelMappings WRITE setChannelMappings NOTIFY channelMappingsChanged) - Q_PROPERTY(QString moviePrefix READ moviePrefix WRITE setMoviePrefix NOTIFY moviePrefixChanged) - Q_PROPERTY(QString preferredLanguage READ preferredLanguage WRITE setPreferredLanguage NOTIFY preferredLanguageChanged) - Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged) + explicit ListingsProviderInfo(); + static ListingsProviderInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString jellyfinId() const; + void setJellyfinId(QString newJellyfinId); - + QString type() const; + void setType(QString newType); - + QString username() const; + void setUsername(QString newUsername); - + QString password() const; + void setPassword(QString newPassword); - + QString listingsId() const; + void setListingsId(QString newListingsId); - + QString zipCode() const; + void setZipCode(QString newZipCode); - + QString country() const; + void setCountry(QString newCountry); - + QString path() const; + void setPath(QString newPath); - + QStringList enabledTuners() const; + void setEnabledTuners(QStringList newEnabledTuners); - + bool enableAllTuners() const; + void setEnableAllTuners(bool newEnableAllTuners); - + QStringList newsCategories() const; + void setNewsCategories(QStringList newNewsCategories); - + QStringList sportsCategories() const; + void setSportsCategories(QStringList newSportsCategories); - + QStringList kidsCategories() const; + void setKidsCategories(QStringList newKidsCategories); - + QStringList movieCategories() const; + void setMovieCategories(QStringList newMovieCategories); - - QList channelMappings() const; - void setChannelMappings(QList newChannelMappings); - + + QList> channelMappings() const; + + void setChannelMappings(QList> newChannelMappings); + QString moviePrefix() const; + void setMoviePrefix(QString newMoviePrefix); - + QString preferredLanguage() const; + void setPreferredLanguage(QString newPreferredLanguage); - + QString userAgent() const; + void setUserAgent(QString newUserAgent); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void typeChanged(QString newType); - void usernameChanged(QString newUsername); - void passwordChanged(QString newPassword); - void listingsIdChanged(QString newListingsId); - void zipCodeChanged(QString newZipCode); - void countryChanged(QString newCountry); - void pathChanged(QString newPath); - void enabledTunersChanged(QStringList newEnabledTuners); - void enableAllTunersChanged(bool newEnableAllTuners); - void newsCategoriesChanged(QStringList newNewsCategories); - void sportsCategoriesChanged(QStringList newSportsCategories); - void kidsCategoriesChanged(QStringList newKidsCategories); - void movieCategoriesChanged(QStringList newMovieCategories); - void channelMappingsChanged(QList newChannelMappings); - void moviePrefixChanged(QString newMoviePrefix); - void preferredLanguageChanged(QString newPreferredLanguage); - void userAgentChanged(QString newUserAgent); + protected: QString m_jellyfinId; QString m_type; @@ -156,12 +141,24 @@ protected: QStringList m_sportsCategories; QStringList m_kidsCategories; QStringList m_movieCategories; - QList m_channelMappings; + QList> m_channelMappings; QString m_moviePrefix; QString m_preferredLanguage; QString m_userAgent; }; +} // NS DTO + +namespace Support { + +using ListingsProviderInfo = Jellyfin::DTO::ListingsProviderInfo; + +template <> +ListingsProviderInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ListingsProviderInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/livestreamresponse.h b/core/include/JellyfinQt/DTO/livestreamresponse.h index 8dae092..ea721e2 100644 --- a/core/include/JellyfinQt/DTO/livestreamresponse.h +++ b/core/include/JellyfinQt/DTO/livestreamresponse.h @@ -31,32 +31,46 @@ #define JELLYFIN_DTO_LIVESTREAMRESPONSE_H #include -#include +#include +#include +#include + +#include "JellyfinQt/DTO/mediasourceinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaSourceInfo; -class LiveStreamResponse : public QObject { - Q_OBJECT +class LiveStreamResponse { public: - explicit LiveStreamResponse(QObject *parent = nullptr); - static LiveStreamResponse *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(MediaSourceInfo * mediaSource READ mediaSource WRITE setMediaSource NOTIFY mediaSourceChanged) - - MediaSourceInfo * mediaSource() const; - void setMediaSource(MediaSourceInfo * newMediaSource); + explicit LiveStreamResponse(); + static LiveStreamResponse fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); -signals: - void mediaSourceChanged(MediaSourceInfo * newMediaSource); + // Properties + + QSharedPointer mediaSource() const; + + void setMediaSource(QSharedPointer newMediaSource); + protected: - MediaSourceInfo * m_mediaSource = nullptr; + QSharedPointer m_mediaSource = nullptr; }; +} // NS DTO + +namespace Support { + +using LiveStreamResponse = Jellyfin::DTO::LiveStreamResponse; + +template <> +LiveStreamResponse fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LiveStreamResponse::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/livetvinfo.h b/core/include/JellyfinQt/DTO/livetvinfo.h index 684d8e5..d62801c 100644 --- a/core/include/JellyfinQt/DTO/livetvinfo.h +++ b/core/include/JellyfinQt/DTO/livetvinfo.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_LIVETVINFO_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/livetvserviceinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LiveTvServiceInfo; -class LiveTvInfo : public QObject { - Q_OBJECT +class LiveTvInfo { public: - explicit LiveTvInfo(QObject *parent = nullptr); - static LiveTvInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit LiveTvInfo(); + static LiveTvInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the services. */ - Q_PROPERTY(QList services READ services WRITE setServices NOTIFY servicesChanged) + QList> services() const; + /** + * @brief Gets or sets the services. + */ + void setServices(QList> newServices); /** * @brief Gets or sets a value indicating whether this instance is enabled. */ - Q_PROPERTY(bool isEnabled READ isEnabled WRITE setIsEnabled NOTIFY isEnabledChanged) + bool isEnabled() const; + /** + * @brief Gets or sets a value indicating whether this instance is enabled. + */ + void setIsEnabled(bool newIsEnabled); /** * @brief Gets or sets the enabled users. */ - Q_PROPERTY(QStringList enabledUsers READ enabledUsers WRITE setEnabledUsers NOTIFY enabledUsersChanged) - - QList services() const; - void setServices(QList newServices); - - bool isEnabled() const; - void setIsEnabled(bool newIsEnabled); - QStringList enabledUsers() const; + /** + * @brief Gets or sets the enabled users. + */ void setEnabledUsers(QStringList newEnabledUsers); - -signals: - void servicesChanged(QList newServices); - void isEnabledChanged(bool newIsEnabled); - void enabledUsersChanged(QStringList newEnabledUsers); + protected: - QList m_services; + QList> m_services; bool m_isEnabled; QStringList m_enabledUsers; }; +} // NS DTO + +namespace Support { + +using LiveTvInfo = Jellyfin::DTO::LiveTvInfo; + +template <> +LiveTvInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LiveTvInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/livetvserviceinfo.h b/core/include/JellyfinQt/DTO/livetvserviceinfo.h index 11198eb..d9b7815 100644 --- a/core/include/JellyfinQt/DTO/livetvserviceinfo.h +++ b/core/include/JellyfinQt/DTO/livetvserviceinfo.h @@ -31,84 +31,84 @@ #define JELLYFIN_DTO_LIVETVSERVICEINFO_H #include +#include #include -#include #include #include +#include #include "JellyfinQt/DTO/livetvservicestatus.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LiveTvServiceInfo : public QObject { - Q_OBJECT -public: - explicit LiveTvServiceInfo(QObject *parent = nullptr); - static LiveTvServiceInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class LiveTvServiceInfo { +public: + explicit LiveTvServiceInfo(); + static LiveTvServiceInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the home page URL. */ - Q_PROPERTY(QString homePageUrl READ homePageUrl WRITE setHomePageUrl NOTIFY homePageUrlChanged) - Q_PROPERTY(LiveTvServiceStatus status READ status WRITE setStatus NOTIFY statusChanged) + QString homePageUrl() const; + /** + * @brief Gets or sets the home page URL. + */ + void setHomePageUrl(QString newHomePageUrl); + + LiveTvServiceStatus status() const; + + void setStatus(LiveTvServiceStatus newStatus); /** * @brief Gets or sets the status message. */ - Q_PROPERTY(QString statusMessage READ statusMessage WRITE setStatusMessage NOTIFY statusMessageChanged) + QString statusMessage() const; + /** + * @brief Gets or sets the status message. + */ + void setStatusMessage(QString newStatusMessage); /** * @brief Gets or sets the version. */ - Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY versionChanged) + QString version() const; + /** + * @brief Gets or sets the version. + */ + void setVersion(QString newVersion); /** * @brief Gets or sets a value indicating whether this instance has update available. */ - Q_PROPERTY(bool hasUpdateAvailable READ hasUpdateAvailable WRITE setHasUpdateAvailable NOTIFY hasUpdateAvailableChanged) + bool hasUpdateAvailable() const; + /** + * @brief Gets or sets a value indicating whether this instance has update available. + */ + void setHasUpdateAvailable(bool newHasUpdateAvailable); /** * @brief Gets or sets a value indicating whether this instance is visible. */ - Q_PROPERTY(bool isVisible READ isVisible WRITE setIsVisible NOTIFY isVisibleChanged) - Q_PROPERTY(QStringList tuners READ tuners WRITE setTuners NOTIFY tunersChanged) - - QString name() const; - void setName(QString newName); - - QString homePageUrl() const; - void setHomePageUrl(QString newHomePageUrl); - - LiveTvServiceStatus status() const; - void setStatus(LiveTvServiceStatus newStatus); - - QString statusMessage() const; - void setStatusMessage(QString newStatusMessage); - - QString version() const; - void setVersion(QString newVersion); - - bool hasUpdateAvailable() const; - void setHasUpdateAvailable(bool newHasUpdateAvailable); - bool isVisible() const; + /** + * @brief Gets or sets a value indicating whether this instance is visible. + */ void setIsVisible(bool newIsVisible); - + QStringList tuners() const; + void setTuners(QStringList newTuners); - -signals: - void nameChanged(QString newName); - void homePageUrlChanged(QString newHomePageUrl); - void statusChanged(LiveTvServiceStatus newStatus); - void statusMessageChanged(QString newStatusMessage); - void versionChanged(QString newVersion); - void hasUpdateAvailableChanged(bool newHasUpdateAvailable); - void isVisibleChanged(bool newIsVisible); - void tunersChanged(QStringList newTuners); + protected: QString m_name; QString m_homePageUrl; @@ -120,6 +120,18 @@ protected: QStringList m_tuners; }; +} // NS DTO + +namespace Support { + +using LiveTvServiceInfo = Jellyfin::DTO::LiveTvServiceInfo; + +template <> +LiveTvServiceInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LiveTvServiceInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/livetvservicestatus.h b/core/include/JellyfinQt/DTO/livetvservicestatus.h index 6b70092..37e840a 100644 --- a/core/include/JellyfinQt/DTO/livetvservicestatus.h +++ b/core/include/JellyfinQt/DTO/livetvservicestatus.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_LIVETVSERVICESTATUS_H #define JELLYFIN_DTO_LIVETVSERVICESTATUS_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class LiveTvServiceStatusClass { Q_GADGET public: enum Value { + EnumNotSet, Ok, Unavailable, }; @@ -46,8 +51,31 @@ public: private: explicit LiveTvServiceStatusClass(); }; + typedef LiveTvServiceStatusClass::Value LiveTvServiceStatus; +} // NS DTO + +namespace Support { + +using LiveTvServiceStatus = Jellyfin::DTO::LiveTvServiceStatus; +using LiveTvServiceStatusClass = Jellyfin::DTO::LiveTvServiceStatusClass; + +template <> +LiveTvServiceStatus fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return LiveTvServiceStatusClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Ok")) { + return LiveTvServiceStatusClass::Ok; + } + if (str == QStringLiteral("Unavailable")) { + return LiveTvServiceStatusClass::Unavailable; + } + + return LiveTvServiceStatusClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/localizationoption.h b/core/include/JellyfinQt/DTO/localizationoption.h index 6b46b95..a96c296 100644 --- a/core/include/JellyfinQt/DTO/localizationoption.h +++ b/core/include/JellyfinQt/DTO/localizationoption.h @@ -31,37 +31,50 @@ #define JELLYFIN_DTO_LOCALIZATIONOPTION_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LocalizationOption : public QObject { - Q_OBJECT -public: - explicit LocalizationOption(QObject *parent = nullptr); - static LocalizationOption *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged) +class LocalizationOption { +public: + explicit LocalizationOption(); + static LocalizationOption fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString name() const; + void setName(QString newName); - + QString value() const; + void setValue(QString newValue); - -signals: - void nameChanged(QString newName); - void valueChanged(QString newValue); + protected: QString m_name; QString m_value; }; +} // NS DTO + +namespace Support { + +using LocalizationOption = Jellyfin::DTO::LocalizationOption; + +template <> +LocalizationOption fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LocalizationOption::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/locationtype.h b/core/include/JellyfinQt/DTO/locationtype.h index 59498f7..1debaff 100644 --- a/core/include/JellyfinQt/DTO/locationtype.h +++ b/core/include/JellyfinQt/DTO/locationtype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_LOCATIONTYPE_H #define JELLYFIN_DTO_LOCATIONTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class LocationTypeClass { Q_GADGET public: enum Value { + EnumNotSet, FileSystem, Remote, Virtual, @@ -48,8 +53,37 @@ public: private: explicit LocationTypeClass(); }; + typedef LocationTypeClass::Value LocationType; +} // NS DTO + +namespace Support { + +using LocationType = Jellyfin::DTO::LocationType; +using LocationTypeClass = Jellyfin::DTO::LocationTypeClass; + +template <> +LocationType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return LocationTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("FileSystem")) { + return LocationTypeClass::FileSystem; + } + if (str == QStringLiteral("Remote")) { + return LocationTypeClass::Remote; + } + if (str == QStringLiteral("Virtual")) { + return LocationTypeClass::Virtual; + } + if (str == QStringLiteral("Offline")) { + return LocationTypeClass::Offline; + } + + return LocationTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/logfile.h b/core/include/JellyfinQt/DTO/logfile.h index 39616c7..a941f2a 100644 --- a/core/include/JellyfinQt/DTO/logfile.h +++ b/core/include/JellyfinQt/DTO/logfile.h @@ -32,54 +32,57 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LogFile : public QObject { - Q_OBJECT -public: - explicit LogFile(QObject *parent = nullptr); - static LogFile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class LogFile { +public: + explicit LogFile(); + static LogFile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the date created. */ - Q_PROPERTY(QDateTime dateCreated READ dateCreated WRITE setDateCreated NOTIFY dateCreatedChanged) + QDateTime dateCreated() const; + /** + * @brief Gets or sets the date created. + */ + void setDateCreated(QDateTime newDateCreated); /** * @brief Gets or sets the date modified. */ - Q_PROPERTY(QDateTime dateModified READ dateModified WRITE setDateModified NOTIFY dateModifiedChanged) + QDateTime dateModified() const; + /** + * @brief Gets or sets the date modified. + */ + void setDateModified(QDateTime newDateModified); /** * @brief Gets or sets the size. */ - Q_PROPERTY(qint64 size READ size WRITE setSize NOTIFY sizeChanged) + qint64 size() const; + /** + * @brief Gets or sets the size. + */ + void setSize(qint64 newSize); /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - - QDateTime dateCreated() const; - void setDateCreated(QDateTime newDateCreated); - - QDateTime dateModified() const; - void setDateModified(QDateTime newDateModified); - - qint64 size() const; - void setSize(qint64 newSize); - QString name() const; + /** + * @brief Gets or sets the name. + */ void setName(QString newName); - -signals: - void dateCreatedChanged(QDateTime newDateCreated); - void dateModifiedChanged(QDateTime newDateModified); - void sizeChanged(qint64 newSize); - void nameChanged(QString newName); + protected: QDateTime m_dateCreated; QDateTime m_dateModified; @@ -87,6 +90,18 @@ protected: QString m_name; }; +} // NS DTO + +namespace Support { + +using LogFile = Jellyfin::DTO::LogFile; + +template <> +LogFile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return LogFile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/loglevel.h b/core/include/JellyfinQt/DTO/loglevel.h index 1e86022..f2b3655 100644 --- a/core/include/JellyfinQt/DTO/loglevel.h +++ b/core/include/JellyfinQt/DTO/loglevel.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_LOGLEVEL_H #define JELLYFIN_DTO_LOGLEVEL_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class LogLevelClass { Q_GADGET public: enum Value { + EnumNotSet, Trace, Debug, Information, @@ -51,8 +56,46 @@ public: private: explicit LogLevelClass(); }; + typedef LogLevelClass::Value LogLevel; +} // NS DTO + +namespace Support { + +using LogLevel = Jellyfin::DTO::LogLevel; +using LogLevelClass = Jellyfin::DTO::LogLevelClass; + +template <> +LogLevel fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return LogLevelClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Trace")) { + return LogLevelClass::Trace; + } + if (str == QStringLiteral("Debug")) { + return LogLevelClass::Debug; + } + if (str == QStringLiteral("Information")) { + return LogLevelClass::Information; + } + if (str == QStringLiteral("Warning")) { + return LogLevelClass::Warning; + } + if (str == QStringLiteral("Error")) { + return LogLevelClass::Error; + } + if (str == QStringLiteral("Critical")) { + return LogLevelClass::Critical; + } + if (str == QStringLiteral("None")) { + return LogLevelClass::None; + } + + return LogLevelClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediaattachment.h b/core/include/JellyfinQt/DTO/mediaattachment.h index 687ad76..25f7035 100644 --- a/core/include/JellyfinQt/DTO/mediaattachment.h +++ b/core/include/JellyfinQt/DTO/mediaattachment.h @@ -31,78 +31,81 @@ #define JELLYFIN_DTO_MEDIAATTACHMENT_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaAttachment : public QObject { - Q_OBJECT -public: - explicit MediaAttachment(QObject *parent = nullptr); - static MediaAttachment *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class MediaAttachment { +public: + explicit MediaAttachment(); + static MediaAttachment fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the codec. */ - Q_PROPERTY(QString codec READ codec WRITE setCodec NOTIFY codecChanged) + QString codec() const; + /** + * @brief Gets or sets the codec. + */ + void setCodec(QString newCodec); /** * @brief Gets or sets the codec tag. */ - Q_PROPERTY(QString codecTag READ codecTag WRITE setCodecTag NOTIFY codecTagChanged) + QString codecTag() const; + /** + * @brief Gets or sets the codec tag. + */ + void setCodecTag(QString newCodecTag); /** * @brief Gets or sets the comment. */ - Q_PROPERTY(QString comment READ comment WRITE setComment NOTIFY commentChanged) + QString comment() const; + /** + * @brief Gets or sets the comment. + */ + void setComment(QString newComment); /** * @brief Gets or sets the index. */ - Q_PROPERTY(qint32 index READ index WRITE setIndex NOTIFY indexChanged) + qint32 index() const; + /** + * @brief Gets or sets the index. + */ + void setIndex(qint32 newIndex); /** * @brief Gets or sets the filename. */ - Q_PROPERTY(QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged) + QString fileName() const; + /** + * @brief Gets or sets the filename. + */ + void setFileName(QString newFileName); /** * @brief Gets or sets the MIME type. */ - Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType NOTIFY mimeTypeChanged) + QString mimeType() const; + /** + * @brief Gets or sets the MIME type. + */ + void setMimeType(QString newMimeType); /** * @brief Gets or sets the delivery URL. */ - Q_PROPERTY(QString deliveryUrl READ deliveryUrl WRITE setDeliveryUrl NOTIFY deliveryUrlChanged) - - QString codec() const; - void setCodec(QString newCodec); - - QString codecTag() const; - void setCodecTag(QString newCodecTag); - - QString comment() const; - void setComment(QString newComment); - - qint32 index() const; - void setIndex(qint32 newIndex); - - QString fileName() const; - void setFileName(QString newFileName); - - QString mimeType() const; - void setMimeType(QString newMimeType); - QString deliveryUrl() const; + /** + * @brief Gets or sets the delivery URL. + */ void setDeliveryUrl(QString newDeliveryUrl); - -signals: - void codecChanged(QString newCodec); - void codecTagChanged(QString newCodecTag); - void commentChanged(QString newComment); - void indexChanged(qint32 newIndex); - void fileNameChanged(QString newFileName); - void mimeTypeChanged(QString newMimeType); - void deliveryUrlChanged(QString newDeliveryUrl); + protected: QString m_codec; QString m_codecTag; @@ -113,6 +116,18 @@ protected: QString m_deliveryUrl; }; +} // NS DTO + +namespace Support { + +using MediaAttachment = Jellyfin::DTO::MediaAttachment; + +template <> +MediaAttachment fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaAttachment::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediaencoderpathdto.h b/core/include/JellyfinQt/DTO/mediaencoderpathdto.h index 5e1575b..4452e85 100644 --- a/core/include/JellyfinQt/DTO/mediaencoderpathdto.h +++ b/core/include/JellyfinQt/DTO/mediaencoderpathdto.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_MEDIAENCODERPATHDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaEncoderPathDto : public QObject { - Q_OBJECT -public: - explicit MediaEncoderPathDto(QObject *parent = nullptr); - static MediaEncoderPathDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class MediaEncoderPathDto { +public: + explicit MediaEncoderPathDto(); + static MediaEncoderPathDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets media encoder path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets media encoder path. + */ + void setPath(QString newPath); /** * @brief Gets or sets media encoder path type. */ - Q_PROPERTY(QString pathType READ pathType WRITE setPathType NOTIFY pathTypeChanged) - - QString path() const; - void setPath(QString newPath); - QString pathType() const; + /** + * @brief Gets or sets media encoder path type. + */ void setPathType(QString newPathType); - -signals: - void pathChanged(QString newPath); - void pathTypeChanged(QString newPathType); + protected: QString m_path; QString m_pathType; }; +} // NS DTO + +namespace Support { + +using MediaEncoderPathDto = Jellyfin::DTO::MediaEncoderPathDto; + +template <> +MediaEncoderPathDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaEncoderPathDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediapathdto.h b/core/include/JellyfinQt/DTO/mediapathdto.h index cbdfc14..45fd348 100644 --- a/core/include/JellyfinQt/DTO/mediapathdto.h +++ b/core/include/JellyfinQt/DTO/mediapathdto.h @@ -31,51 +31,65 @@ #define JELLYFIN_DTO_MEDIAPATHDTO_H #include -#include +#include +#include #include +#include + +#include "JellyfinQt/DTO/mediapathinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaPathInfo; -class MediaPathDto : public QObject { - Q_OBJECT +class MediaPathDto { public: - explicit MediaPathDto(QObject *parent = nullptr); - static MediaPathDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit MediaPathDto(); + static MediaPathDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name of the library. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name of the library. + */ + void setName(QString newName); /** * @brief Gets or sets the path to add. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(MediaPathInfo * pathInfo READ pathInfo WRITE setPathInfo NOTIFY pathInfoChanged) - - QString name() const; - void setName(QString newName); - QString path() const; + /** + * @brief Gets or sets the path to add. + */ void setPath(QString newPath); - - MediaPathInfo * pathInfo() const; - void setPathInfo(MediaPathInfo * newPathInfo); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void pathInfoChanged(MediaPathInfo * newPathInfo); + + QSharedPointer pathInfo() const; + + void setPathInfo(QSharedPointer newPathInfo); + protected: QString m_name; QString m_path; - MediaPathInfo * m_pathInfo = nullptr; + QSharedPointer m_pathInfo = nullptr; }; +} // NS DTO + +namespace Support { + +using MediaPathDto = Jellyfin::DTO::MediaPathDto; + +template <> +MediaPathDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaPathDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediapathinfo.h b/core/include/JellyfinQt/DTO/mediapathinfo.h index d7ba25e..8b3c968 100644 --- a/core/include/JellyfinQt/DTO/mediapathinfo.h +++ b/core/include/JellyfinQt/DTO/mediapathinfo.h @@ -31,37 +31,50 @@ #define JELLYFIN_DTO_MEDIAPATHINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaPathInfo : public QObject { - Q_OBJECT -public: - explicit MediaPathInfo(QObject *parent = nullptr); - static MediaPathInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(QString networkPath READ networkPath WRITE setNetworkPath NOTIFY networkPathChanged) +class MediaPathInfo { +public: + explicit MediaPathInfo(); + static MediaPathInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString path() const; + void setPath(QString newPath); - + QString networkPath() const; + void setNetworkPath(QString newNetworkPath); - -signals: - void pathChanged(QString newPath); - void networkPathChanged(QString newNetworkPath); + protected: QString m_path; QString m_networkPath; }; +} // NS DTO + +namespace Support { + +using MediaPathInfo = Jellyfin::DTO::MediaPathInfo; + +template <> +MediaPathInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaPathInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediaprotocol.h b/core/include/JellyfinQt/DTO/mediaprotocol.h index fc77c6c..30aacac 100644 --- a/core/include/JellyfinQt/DTO/mediaprotocol.h +++ b/core/include/JellyfinQt/DTO/mediaprotocol.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_MEDIAPROTOCOL_H #define JELLYFIN_DTO_MEDIAPROTOCOL_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class MediaProtocolClass { Q_GADGET public: enum Value { + EnumNotSet, File, Http, Rtmp, @@ -51,8 +56,46 @@ public: private: explicit MediaProtocolClass(); }; + typedef MediaProtocolClass::Value MediaProtocol; +} // NS DTO + +namespace Support { + +using MediaProtocol = Jellyfin::DTO::MediaProtocol; +using MediaProtocolClass = Jellyfin::DTO::MediaProtocolClass; + +template <> +MediaProtocol fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return MediaProtocolClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("File")) { + return MediaProtocolClass::File; + } + if (str == QStringLiteral("Http")) { + return MediaProtocolClass::Http; + } + if (str == QStringLiteral("Rtmp")) { + return MediaProtocolClass::Rtmp; + } + if (str == QStringLiteral("Rtsp")) { + return MediaProtocolClass::Rtsp; + } + if (str == QStringLiteral("Udp")) { + return MediaProtocolClass::Udp; + } + if (str == QStringLiteral("Rtp")) { + return MediaProtocolClass::Rtp; + } + if (str == QStringLiteral("Ftp")) { + return MediaProtocolClass::Ftp; + } + + return MediaProtocolClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediasourceinfo.h b/core/include/JellyfinQt/DTO/mediasourceinfo.h index 346cbee..24bc3a6 100644 --- a/core/include/JellyfinQt/DTO/mediasourceinfo.h +++ b/core/include/JellyfinQt/DTO/mediasourceinfo.h @@ -31,247 +31,208 @@ #define JELLYFIN_DTO_MEDIASOURCEINFO_H #include +#include #include -#include +#include #include #include +#include #include "JellyfinQt/DTO/isotype.h" +#include "JellyfinQt/DTO/mediaattachment.h" #include "JellyfinQt/DTO/mediaprotocol.h" #include "JellyfinQt/DTO/mediasourcetype.h" +#include "JellyfinQt/DTO/mediastream.h" #include "JellyfinQt/DTO/transportstreamtimestamp.h" #include "JellyfinQt/DTO/video3dformat.h" #include "JellyfinQt/DTO/videotype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaAttachment; -class MediaStream; -class MediaSourceInfo : public QObject { - Q_OBJECT +class MediaSourceInfo { public: - explicit MediaSourceInfo(QObject *parent = nullptr); - static MediaSourceInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit MediaSourceInfo(); + static MediaSourceInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(MediaProtocol protocol READ protocol WRITE setProtocol NOTIFY protocolChanged) - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(QString encoderPath READ encoderPath WRITE setEncoderPath NOTIFY encoderPathChanged) - Q_PROPERTY(MediaProtocol encoderProtocol READ encoderProtocol WRITE setEncoderProtocol NOTIFY encoderProtocolChanged) - Q_PROPERTY(MediaSourceType type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) - Q_PROPERTY(qint64 size READ size WRITE setSize NOTIFY sizeChanged) - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + MediaProtocol protocol() const; + + void setProtocol(MediaProtocol newProtocol); + + QString jellyfinId() const; + + void setJellyfinId(QString newJellyfinId); + + QString path() const; + + void setPath(QString newPath); + + QString encoderPath() const; + + void setEncoderPath(QString newEncoderPath); + + MediaProtocol encoderProtocol() const; + + void setEncoderProtocol(MediaProtocol newEncoderProtocol); + + MediaSourceType type() const; + + void setType(MediaSourceType newType); + + QString container() const; + + void setContainer(QString newContainer); + + qint64 size() const; + + void setSize(qint64 newSize); + + QString name() const; + + void setName(QString newName); /** * @brief Differentiate internet url vs local network. */ - Q_PROPERTY(bool isRemote READ isRemote WRITE setIsRemote NOTIFY isRemoteChanged) - Q_PROPERTY(QString eTag READ eTag WRITE setETag NOTIFY eTagChanged) - Q_PROPERTY(qint64 runTimeTicks READ runTimeTicks WRITE setRunTimeTicks NOTIFY runTimeTicksChanged) - Q_PROPERTY(bool readAtNativeFramerate READ readAtNativeFramerate WRITE setReadAtNativeFramerate NOTIFY readAtNativeFramerateChanged) - Q_PROPERTY(bool ignoreDts READ ignoreDts WRITE setIgnoreDts NOTIFY ignoreDtsChanged) - Q_PROPERTY(bool ignoreIndex READ ignoreIndex WRITE setIgnoreIndex NOTIFY ignoreIndexChanged) - Q_PROPERTY(bool genPtsInput READ genPtsInput WRITE setGenPtsInput NOTIFY genPtsInputChanged) - Q_PROPERTY(bool supportsTranscoding READ supportsTranscoding WRITE setSupportsTranscoding NOTIFY supportsTranscodingChanged) - Q_PROPERTY(bool supportsDirectStream READ supportsDirectStream WRITE setSupportsDirectStream NOTIFY supportsDirectStreamChanged) - Q_PROPERTY(bool supportsDirectPlay READ supportsDirectPlay WRITE setSupportsDirectPlay NOTIFY supportsDirectPlayChanged) - Q_PROPERTY(bool isInfiniteStream READ isInfiniteStream WRITE setIsInfiniteStream NOTIFY isInfiniteStreamChanged) - Q_PROPERTY(bool requiresOpening READ requiresOpening WRITE setRequiresOpening NOTIFY requiresOpeningChanged) - Q_PROPERTY(QString openToken READ openToken WRITE setOpenToken NOTIFY openTokenChanged) - Q_PROPERTY(bool requiresClosing READ requiresClosing WRITE setRequiresClosing NOTIFY requiresClosingChanged) - Q_PROPERTY(QString liveStreamId READ liveStreamId WRITE setLiveStreamId NOTIFY liveStreamIdChanged) - Q_PROPERTY(qint32 bufferMs READ bufferMs WRITE setBufferMs NOTIFY bufferMsChanged) - Q_PROPERTY(bool requiresLooping READ requiresLooping WRITE setRequiresLooping NOTIFY requiresLoopingChanged) - Q_PROPERTY(bool supportsProbing READ supportsProbing WRITE setSupportsProbing NOTIFY supportsProbingChanged) - Q_PROPERTY(VideoType videoType READ videoType WRITE setVideoType NOTIFY videoTypeChanged) - Q_PROPERTY(IsoType isoType READ isoType WRITE setIsoType NOTIFY isoTypeChanged) - Q_PROPERTY(Video3DFormat video3DFormat READ video3DFormat WRITE setVideo3DFormat NOTIFY video3DFormatChanged) - Q_PROPERTY(QList mediaStreams READ mediaStreams WRITE setMediaStreams NOTIFY mediaStreamsChanged) - Q_PROPERTY(QList mediaAttachments READ mediaAttachments WRITE setMediaAttachments NOTIFY mediaAttachmentsChanged) - Q_PROPERTY(QStringList formats READ formats WRITE setFormats NOTIFY formatsChanged) - Q_PROPERTY(qint32 bitrate READ bitrate WRITE setBitrate NOTIFY bitrateChanged) - Q_PROPERTY(TransportStreamTimestamp timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged) - Q_PROPERTY(QJsonObject requiredHttpHeaders READ requiredHttpHeaders WRITE setRequiredHttpHeaders NOTIFY requiredHttpHeadersChanged) - Q_PROPERTY(QString transcodingUrl READ transcodingUrl WRITE setTranscodingUrl NOTIFY transcodingUrlChanged) - Q_PROPERTY(QString transcodingSubProtocol READ transcodingSubProtocol WRITE setTranscodingSubProtocol NOTIFY transcodingSubProtocolChanged) - Q_PROPERTY(QString transcodingContainer READ transcodingContainer WRITE setTranscodingContainer NOTIFY transcodingContainerChanged) - Q_PROPERTY(qint32 analyzeDurationMs READ analyzeDurationMs WRITE setAnalyzeDurationMs NOTIFY analyzeDurationMsChanged) - Q_PROPERTY(qint32 defaultAudioStreamIndex READ defaultAudioStreamIndex WRITE setDefaultAudioStreamIndex NOTIFY defaultAudioStreamIndexChanged) - Q_PROPERTY(qint32 defaultSubtitleStreamIndex READ defaultSubtitleStreamIndex WRITE setDefaultSubtitleStreamIndex NOTIFY defaultSubtitleStreamIndexChanged) - - MediaProtocol protocol() const; - void setProtocol(MediaProtocol newProtocol); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString path() const; - void setPath(QString newPath); - - QString encoderPath() const; - void setEncoderPath(QString newEncoderPath); - - MediaProtocol encoderProtocol() const; - void setEncoderProtocol(MediaProtocol newEncoderProtocol); - - MediaSourceType type() const; - void setType(MediaSourceType newType); - - QString container() const; - void setContainer(QString newContainer); - - qint64 size() const; - void setSize(qint64 newSize); - - QString name() const; - void setName(QString newName); - bool isRemote() const; + /** + * @brief Differentiate internet url vs local network. + */ void setIsRemote(bool newIsRemote); - + QString eTag() const; + void setETag(QString newETag); - + qint64 runTimeTicks() const; + void setRunTimeTicks(qint64 newRunTimeTicks); - + bool readAtNativeFramerate() const; + void setReadAtNativeFramerate(bool newReadAtNativeFramerate); - + bool ignoreDts() const; + void setIgnoreDts(bool newIgnoreDts); - + bool ignoreIndex() const; + void setIgnoreIndex(bool newIgnoreIndex); - + bool genPtsInput() const; + void setGenPtsInput(bool newGenPtsInput); - + bool supportsTranscoding() const; + void setSupportsTranscoding(bool newSupportsTranscoding); - + bool supportsDirectStream() const; + void setSupportsDirectStream(bool newSupportsDirectStream); - + bool supportsDirectPlay() const; + void setSupportsDirectPlay(bool newSupportsDirectPlay); - + bool isInfiniteStream() const; + void setIsInfiniteStream(bool newIsInfiniteStream); - + bool requiresOpening() const; + void setRequiresOpening(bool newRequiresOpening); - + QString openToken() const; + void setOpenToken(QString newOpenToken); - + bool requiresClosing() const; + void setRequiresClosing(bool newRequiresClosing); - + QString liveStreamId() const; + void setLiveStreamId(QString newLiveStreamId); - + qint32 bufferMs() const; + void setBufferMs(qint32 newBufferMs); - + bool requiresLooping() const; + void setRequiresLooping(bool newRequiresLooping); - + bool supportsProbing() const; + void setSupportsProbing(bool newSupportsProbing); - + VideoType videoType() const; + void setVideoType(VideoType newVideoType); - + IsoType isoType() const; + void setIsoType(IsoType newIsoType); - + Video3DFormat video3DFormat() const; + void setVideo3DFormat(Video3DFormat newVideo3DFormat); - - QList mediaStreams() const; - void setMediaStreams(QList newMediaStreams); - - QList mediaAttachments() const; - void setMediaAttachments(QList newMediaAttachments); - + + QList> mediaStreams() const; + + void setMediaStreams(QList> newMediaStreams); + + QList> mediaAttachments() const; + + void setMediaAttachments(QList> newMediaAttachments); + QStringList formats() const; + void setFormats(QStringList newFormats); - + qint32 bitrate() const; + void setBitrate(qint32 newBitrate); - + TransportStreamTimestamp timestamp() const; + void setTimestamp(TransportStreamTimestamp newTimestamp); - + QJsonObject requiredHttpHeaders() const; + void setRequiredHttpHeaders(QJsonObject newRequiredHttpHeaders); - + QString transcodingUrl() const; + void setTranscodingUrl(QString newTranscodingUrl); - + QString transcodingSubProtocol() const; + void setTranscodingSubProtocol(QString newTranscodingSubProtocol); - + QString transcodingContainer() const; + void setTranscodingContainer(QString newTranscodingContainer); - + qint32 analyzeDurationMs() const; + void setAnalyzeDurationMs(qint32 newAnalyzeDurationMs); - + qint32 defaultAudioStreamIndex() const; + void setDefaultAudioStreamIndex(qint32 newDefaultAudioStreamIndex); - + qint32 defaultSubtitleStreamIndex() const; + void setDefaultSubtitleStreamIndex(qint32 newDefaultSubtitleStreamIndex); - -signals: - void protocolChanged(MediaProtocol newProtocol); - void jellyfinIdChanged(QString newJellyfinId); - void pathChanged(QString newPath); - void encoderPathChanged(QString newEncoderPath); - void encoderProtocolChanged(MediaProtocol newEncoderProtocol); - void typeChanged(MediaSourceType newType); - void containerChanged(QString newContainer); - void sizeChanged(qint64 newSize); - void nameChanged(QString newName); - void isRemoteChanged(bool newIsRemote); - void eTagChanged(QString newETag); - void runTimeTicksChanged(qint64 newRunTimeTicks); - void readAtNativeFramerateChanged(bool newReadAtNativeFramerate); - void ignoreDtsChanged(bool newIgnoreDts); - void ignoreIndexChanged(bool newIgnoreIndex); - void genPtsInputChanged(bool newGenPtsInput); - void supportsTranscodingChanged(bool newSupportsTranscoding); - void supportsDirectStreamChanged(bool newSupportsDirectStream); - void supportsDirectPlayChanged(bool newSupportsDirectPlay); - void isInfiniteStreamChanged(bool newIsInfiniteStream); - void requiresOpeningChanged(bool newRequiresOpening); - void openTokenChanged(QString newOpenToken); - void requiresClosingChanged(bool newRequiresClosing); - void liveStreamIdChanged(QString newLiveStreamId); - void bufferMsChanged(qint32 newBufferMs); - void requiresLoopingChanged(bool newRequiresLooping); - void supportsProbingChanged(bool newSupportsProbing); - void videoTypeChanged(VideoType newVideoType); - void isoTypeChanged(IsoType newIsoType); - void video3DFormatChanged(Video3DFormat newVideo3DFormat); - void mediaStreamsChanged(QList newMediaStreams); - void mediaAttachmentsChanged(QList newMediaAttachments); - void formatsChanged(QStringList newFormats); - void bitrateChanged(qint32 newBitrate); - void timestampChanged(TransportStreamTimestamp newTimestamp); - void requiredHttpHeadersChanged(QJsonObject newRequiredHttpHeaders); - void transcodingUrlChanged(QString newTranscodingUrl); - void transcodingSubProtocolChanged(QString newTranscodingSubProtocol); - void transcodingContainerChanged(QString newTranscodingContainer); - void analyzeDurationMsChanged(qint32 newAnalyzeDurationMs); - void defaultAudioStreamIndexChanged(qint32 newDefaultAudioStreamIndex); - void defaultSubtitleStreamIndexChanged(qint32 newDefaultSubtitleStreamIndex); + protected: MediaProtocol m_protocol; QString m_jellyfinId; @@ -303,8 +264,8 @@ protected: VideoType m_videoType; IsoType m_isoType; Video3DFormat m_video3DFormat; - QList m_mediaStreams; - QList m_mediaAttachments; + QList> m_mediaStreams; + QList> m_mediaAttachments; QStringList m_formats; qint32 m_bitrate; TransportStreamTimestamp m_timestamp; @@ -317,6 +278,18 @@ protected: qint32 m_defaultSubtitleStreamIndex; }; +} // NS DTO + +namespace Support { + +using MediaSourceInfo = Jellyfin::DTO::MediaSourceInfo; + +template <> +MediaSourceInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaSourceInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediasourcetype.h b/core/include/JellyfinQt/DTO/mediasourcetype.h index 0ef7fa1..f7567c8 100644 --- a/core/include/JellyfinQt/DTO/mediasourcetype.h +++ b/core/include/JellyfinQt/DTO/mediasourcetype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_MEDIASOURCETYPE_H #define JELLYFIN_DTO_MEDIASOURCETYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class MediaSourceTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Default, Grouping, Placeholder, @@ -47,8 +52,34 @@ public: private: explicit MediaSourceTypeClass(); }; + typedef MediaSourceTypeClass::Value MediaSourceType; +} // NS DTO + +namespace Support { + +using MediaSourceType = Jellyfin::DTO::MediaSourceType; +using MediaSourceTypeClass = Jellyfin::DTO::MediaSourceTypeClass; + +template <> +MediaSourceType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return MediaSourceTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Default")) { + return MediaSourceTypeClass::Default; + } + if (str == QStringLiteral("Grouping")) { + return MediaSourceTypeClass::Grouping; + } + if (str == QStringLiteral("Placeholder")) { + return MediaSourceTypeClass::Placeholder; + } + + return MediaSourceTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediastream.h b/core/include/JellyfinQt/DTO/mediastream.h index 44e9922..ad2c366 100644 --- a/core/include/JellyfinQt/DTO/mediastream.h +++ b/core/include/JellyfinQt/DTO/mediastream.h @@ -31,374 +31,367 @@ #define JELLYFIN_DTO_MEDIASTREAM_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/mediastreamtype.h" #include "JellyfinQt/DTO/subtitledeliverymethod.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaStream : public QObject { - Q_OBJECT -public: - explicit MediaStream(QObject *parent = nullptr); - static MediaStream *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class MediaStream { +public: + explicit MediaStream(); + static MediaStream fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the codec. */ - Q_PROPERTY(QString codec READ codec WRITE setCodec NOTIFY codecChanged) + QString codec() const; + /** + * @brief Gets or sets the codec. + */ + void setCodec(QString newCodec); /** * @brief Gets or sets the codec tag. */ - Q_PROPERTY(QString codecTag READ codecTag WRITE setCodecTag NOTIFY codecTagChanged) + QString codecTag() const; + /** + * @brief Gets or sets the codec tag. + */ + void setCodecTag(QString newCodecTag); /** * @brief Gets or sets the language. */ - Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged) + QString language() const; + /** + * @brief Gets or sets the language. + */ + void setLanguage(QString newLanguage); /** * @brief Gets or sets the color range. */ - Q_PROPERTY(QString colorRange READ colorRange WRITE setColorRange NOTIFY colorRangeChanged) + QString colorRange() const; + /** + * @brief Gets or sets the color range. + */ + void setColorRange(QString newColorRange); /** * @brief Gets or sets the color space. */ - Q_PROPERTY(QString colorSpace READ colorSpace WRITE setColorSpace NOTIFY colorSpaceChanged) + QString colorSpace() const; + /** + * @brief Gets or sets the color space. + */ + void setColorSpace(QString newColorSpace); /** * @brief Gets or sets the color transfer. */ - Q_PROPERTY(QString colorTransfer READ colorTransfer WRITE setColorTransfer NOTIFY colorTransferChanged) + QString colorTransfer() const; + /** + * @brief Gets or sets the color transfer. + */ + void setColorTransfer(QString newColorTransfer); /** * @brief Gets or sets the color primaries. */ - Q_PROPERTY(QString colorPrimaries READ colorPrimaries WRITE setColorPrimaries NOTIFY colorPrimariesChanged) + QString colorPrimaries() const; + /** + * @brief Gets or sets the color primaries. + */ + void setColorPrimaries(QString newColorPrimaries); /** * @brief Gets or sets the comment. */ - Q_PROPERTY(QString comment READ comment WRITE setComment NOTIFY commentChanged) + QString comment() const; + /** + * @brief Gets or sets the comment. + */ + void setComment(QString newComment); /** * @brief Gets or sets the time base. */ - Q_PROPERTY(QString timeBase READ timeBase WRITE setTimeBase NOTIFY timeBaseChanged) + QString timeBase() const; + /** + * @brief Gets or sets the time base. + */ + void setTimeBase(QString newTimeBase); /** * @brief Gets or sets the codec time base. */ - Q_PROPERTY(QString codecTimeBase READ codecTimeBase WRITE setCodecTimeBase NOTIFY codecTimeBaseChanged) + QString codecTimeBase() const; + /** + * @brief Gets or sets the codec time base. + */ + void setCodecTimeBase(QString newCodecTimeBase); /** * @brief Gets or sets the title. */ - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) + QString title() const; + /** + * @brief Gets or sets the title. + */ + void setTitle(QString newTitle); /** * @brief Gets or sets the video range. */ - Q_PROPERTY(QString videoRange READ videoRange WRITE setVideoRange NOTIFY videoRangeChanged) - Q_PROPERTY(QString localizedUndefined READ localizedUndefined WRITE setLocalizedUndefined NOTIFY localizedUndefinedChanged) - Q_PROPERTY(QString localizedDefault READ localizedDefault WRITE setLocalizedDefault NOTIFY localizedDefaultChanged) - Q_PROPERTY(QString localizedForced READ localizedForced WRITE setLocalizedForced NOTIFY localizedForcedChanged) - Q_PROPERTY(QString displayTitle READ displayTitle WRITE setDisplayTitle NOTIFY displayTitleChanged) - Q_PROPERTY(QString nalLengthSize READ nalLengthSize WRITE setNalLengthSize NOTIFY nalLengthSizeChanged) + QString videoRange() const; + /** + * @brief Gets or sets the video range. + */ + void setVideoRange(QString newVideoRange); + + QString localizedUndefined() const; + + void setLocalizedUndefined(QString newLocalizedUndefined); + + QString localizedDefault() const; + + void setLocalizedDefault(QString newLocalizedDefault); + + QString localizedForced() const; + + void setLocalizedForced(QString newLocalizedForced); + + QString displayTitle() const; + + void setDisplayTitle(QString newDisplayTitle); + + QString nalLengthSize() const; + + void setNalLengthSize(QString newNalLengthSize); /** * @brief Gets or sets a value indicating whether this instance is interlaced. */ - Q_PROPERTY(bool isInterlaced READ isInterlaced WRITE setIsInterlaced NOTIFY isInterlacedChanged) - Q_PROPERTY(bool isAVC READ isAVC WRITE setIsAVC NOTIFY isAVCChanged) + bool isInterlaced() const; + /** + * @brief Gets or sets a value indicating whether this instance is interlaced. + */ + void setIsInterlaced(bool newIsInterlaced); + + bool isAVC() const; + + void setIsAVC(bool newIsAVC); /** * @brief Gets or sets the channel layout. */ - Q_PROPERTY(QString channelLayout READ channelLayout WRITE setChannelLayout NOTIFY channelLayoutChanged) + QString channelLayout() const; + /** + * @brief Gets or sets the channel layout. + */ + void setChannelLayout(QString newChannelLayout); /** * @brief Gets or sets the bit rate. */ - Q_PROPERTY(qint32 bitRate READ bitRate WRITE setBitRate NOTIFY bitRateChanged) + qint32 bitRate() const; + /** + * @brief Gets or sets the bit rate. + */ + void setBitRate(qint32 newBitRate); /** * @brief Gets or sets the bit depth. */ - Q_PROPERTY(qint32 bitDepth READ bitDepth WRITE setBitDepth NOTIFY bitDepthChanged) + qint32 bitDepth() const; + /** + * @brief Gets or sets the bit depth. + */ + void setBitDepth(qint32 newBitDepth); /** * @brief Gets or sets the reference frames. */ - Q_PROPERTY(qint32 refFrames READ refFrames WRITE setRefFrames NOTIFY refFramesChanged) + qint32 refFrames() const; + /** + * @brief Gets or sets the reference frames. + */ + void setRefFrames(qint32 newRefFrames); /** * @brief Gets or sets the length of the packet. */ - Q_PROPERTY(qint32 packetLength READ packetLength WRITE setPacketLength NOTIFY packetLengthChanged) + qint32 packetLength() const; + /** + * @brief Gets or sets the length of the packet. + */ + void setPacketLength(qint32 newPacketLength); /** * @brief Gets or sets the channels. */ - Q_PROPERTY(qint32 channels READ channels WRITE setChannels NOTIFY channelsChanged) + qint32 channels() const; + /** + * @brief Gets or sets the channels. + */ + void setChannels(qint32 newChannels); /** * @brief Gets or sets the sample rate. */ - Q_PROPERTY(qint32 sampleRate READ sampleRate WRITE setSampleRate NOTIFY sampleRateChanged) + qint32 sampleRate() const; + /** + * @brief Gets or sets the sample rate. + */ + void setSampleRate(qint32 newSampleRate); /** * @brief Gets or sets a value indicating whether this instance is default. */ - Q_PROPERTY(bool isDefault READ isDefault WRITE setIsDefault NOTIFY isDefaultChanged) + bool isDefault() const; + /** + * @brief Gets or sets a value indicating whether this instance is default. + */ + void setIsDefault(bool newIsDefault); /** * @brief Gets or sets a value indicating whether this instance is forced. */ - Q_PROPERTY(bool isForced READ isForced WRITE setIsForced NOTIFY isForcedChanged) + bool isForced() const; + /** + * @brief Gets or sets a value indicating whether this instance is forced. + */ + void setIsForced(bool newIsForced); /** * @brief Gets or sets the height. */ - Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged) + qint32 height() const; + /** + * @brief Gets or sets the height. + */ + void setHeight(qint32 newHeight); /** * @brief Gets or sets the width. */ - Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged) + qint32 width() const; + /** + * @brief Gets or sets the width. + */ + void setWidth(qint32 newWidth); /** * @brief Gets or sets the average frame rate. */ - Q_PROPERTY(float averageFrameRate READ averageFrameRate WRITE setAverageFrameRate NOTIFY averageFrameRateChanged) + float averageFrameRate() const; + /** + * @brief Gets or sets the average frame rate. + */ + void setAverageFrameRate(float newAverageFrameRate); /** * @brief Gets or sets the real frame rate. */ - Q_PROPERTY(float realFrameRate READ realFrameRate WRITE setRealFrameRate NOTIFY realFrameRateChanged) + float realFrameRate() const; + /** + * @brief Gets or sets the real frame rate. + */ + void setRealFrameRate(float newRealFrameRate); /** * @brief Gets or sets the profile. */ - Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged) - Q_PROPERTY(MediaStreamType type READ type WRITE setType NOTIFY typeChanged) + QString profile() const; + /** + * @brief Gets or sets the profile. + */ + void setProfile(QString newProfile); + + MediaStreamType type() const; + + void setType(MediaStreamType newType); /** * @brief Gets or sets the aspect ratio. */ - Q_PROPERTY(QString aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged) + QString aspectRatio() const; + /** + * @brief Gets or sets the aspect ratio. + */ + void setAspectRatio(QString newAspectRatio); /** * @brief Gets or sets the index. */ - Q_PROPERTY(qint32 index READ index WRITE setIndex NOTIFY indexChanged) + qint32 index() const; + /** + * @brief Gets or sets the index. + */ + void setIndex(qint32 newIndex); /** * @brief Gets or sets the score. */ - Q_PROPERTY(qint32 score READ score WRITE setScore NOTIFY scoreChanged) + qint32 score() const; + /** + * @brief Gets or sets the score. + */ + void setScore(qint32 newScore); /** * @brief Gets or sets a value indicating whether this instance is external. */ - Q_PROPERTY(bool isExternal READ isExternal WRITE setIsExternal NOTIFY isExternalChanged) - Q_PROPERTY(SubtitleDeliveryMethod deliveryMethod READ deliveryMethod WRITE setDeliveryMethod NOTIFY deliveryMethodChanged) + bool isExternal() const; + /** + * @brief Gets or sets a value indicating whether this instance is external. + */ + void setIsExternal(bool newIsExternal); + + SubtitleDeliveryMethod deliveryMethod() const; + + void setDeliveryMethod(SubtitleDeliveryMethod newDeliveryMethod); /** * @brief Gets or sets the delivery URL. */ - Q_PROPERTY(QString deliveryUrl READ deliveryUrl WRITE setDeliveryUrl NOTIFY deliveryUrlChanged) + QString deliveryUrl() const; + /** + * @brief Gets or sets the delivery URL. + */ + void setDeliveryUrl(QString newDeliveryUrl); /** * @brief Gets or sets a value indicating whether this instance is external URL. */ - Q_PROPERTY(bool isExternalUrl READ isExternalUrl WRITE setIsExternalUrl NOTIFY isExternalUrlChanged) - Q_PROPERTY(bool isTextSubtitleStream READ isTextSubtitleStream WRITE setIsTextSubtitleStream NOTIFY isTextSubtitleStreamChanged) + bool isExternalUrl() const; + /** + * @brief Gets or sets a value indicating whether this instance is external URL. + */ + void setIsExternalUrl(bool newIsExternalUrl); + + bool isTextSubtitleStream() const; + + void setIsTextSubtitleStream(bool newIsTextSubtitleStream); /** * @brief Gets or sets a value indicating whether [supports external stream]. */ - Q_PROPERTY(bool supportsExternalStream READ supportsExternalStream WRITE setSupportsExternalStream NOTIFY supportsExternalStreamChanged) + bool supportsExternalStream() const; + /** + * @brief Gets or sets a value indicating whether [supports external stream]. + */ + void setSupportsExternalStream(bool newSupportsExternalStream); /** * @brief Gets or sets the filename. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the filename. + */ + void setPath(QString newPath); /** * @brief Gets or sets the pixel format. */ - Q_PROPERTY(QString pixelFormat READ pixelFormat WRITE setPixelFormat NOTIFY pixelFormatChanged) + QString pixelFormat() const; + /** + * @brief Gets or sets the pixel format. + */ + void setPixelFormat(QString newPixelFormat); /** * @brief Gets or sets the level. */ - Q_PROPERTY(double level READ level WRITE setLevel NOTIFY levelChanged) + double level() const; + /** + * @brief Gets or sets the level. + */ + void setLevel(double newLevel); /** * @brief Gets a value indicating whether this instance is anamorphic. */ - Q_PROPERTY(bool isAnamorphic READ isAnamorphic WRITE setIsAnamorphic NOTIFY isAnamorphicChanged) - - QString codec() const; - void setCodec(QString newCodec); - - QString codecTag() const; - void setCodecTag(QString newCodecTag); - - QString language() const; - void setLanguage(QString newLanguage); - - QString colorRange() const; - void setColorRange(QString newColorRange); - - QString colorSpace() const; - void setColorSpace(QString newColorSpace); - - QString colorTransfer() const; - void setColorTransfer(QString newColorTransfer); - - QString colorPrimaries() const; - void setColorPrimaries(QString newColorPrimaries); - - QString comment() const; - void setComment(QString newComment); - - QString timeBase() const; - void setTimeBase(QString newTimeBase); - - QString codecTimeBase() const; - void setCodecTimeBase(QString newCodecTimeBase); - - QString title() const; - void setTitle(QString newTitle); - - QString videoRange() const; - void setVideoRange(QString newVideoRange); - - QString localizedUndefined() const; - void setLocalizedUndefined(QString newLocalizedUndefined); - - QString localizedDefault() const; - void setLocalizedDefault(QString newLocalizedDefault); - - QString localizedForced() const; - void setLocalizedForced(QString newLocalizedForced); - - QString displayTitle() const; - void setDisplayTitle(QString newDisplayTitle); - - QString nalLengthSize() const; - void setNalLengthSize(QString newNalLengthSize); - - bool isInterlaced() const; - void setIsInterlaced(bool newIsInterlaced); - - bool isAVC() const; - void setIsAVC(bool newIsAVC); - - QString channelLayout() const; - void setChannelLayout(QString newChannelLayout); - - qint32 bitRate() const; - void setBitRate(qint32 newBitRate); - - qint32 bitDepth() const; - void setBitDepth(qint32 newBitDepth); - - qint32 refFrames() const; - void setRefFrames(qint32 newRefFrames); - - qint32 packetLength() const; - void setPacketLength(qint32 newPacketLength); - - qint32 channels() const; - void setChannels(qint32 newChannels); - - qint32 sampleRate() const; - void setSampleRate(qint32 newSampleRate); - - bool isDefault() const; - void setIsDefault(bool newIsDefault); - - bool isForced() const; - void setIsForced(bool newIsForced); - - qint32 height() const; - void setHeight(qint32 newHeight); - - qint32 width() const; - void setWidth(qint32 newWidth); - - float averageFrameRate() const; - void setAverageFrameRate(float newAverageFrameRate); - - float realFrameRate() const; - void setRealFrameRate(float newRealFrameRate); - - QString profile() const; - void setProfile(QString newProfile); - - MediaStreamType type() const; - void setType(MediaStreamType newType); - - QString aspectRatio() const; - void setAspectRatio(QString newAspectRatio); - - qint32 index() const; - void setIndex(qint32 newIndex); - - qint32 score() const; - void setScore(qint32 newScore); - - bool isExternal() const; - void setIsExternal(bool newIsExternal); - - SubtitleDeliveryMethod deliveryMethod() const; - void setDeliveryMethod(SubtitleDeliveryMethod newDeliveryMethod); - - QString deliveryUrl() const; - void setDeliveryUrl(QString newDeliveryUrl); - - bool isExternalUrl() const; - void setIsExternalUrl(bool newIsExternalUrl); - - bool isTextSubtitleStream() const; - void setIsTextSubtitleStream(bool newIsTextSubtitleStream); - - bool supportsExternalStream() const; - void setSupportsExternalStream(bool newSupportsExternalStream); - - QString path() const; - void setPath(QString newPath); - - QString pixelFormat() const; - void setPixelFormat(QString newPixelFormat); - - double level() const; - void setLevel(double newLevel); - bool isAnamorphic() const; + /** + * @brief Gets a value indicating whether this instance is anamorphic. + */ void setIsAnamorphic(bool newIsAnamorphic); - -signals: - void codecChanged(QString newCodec); - void codecTagChanged(QString newCodecTag); - void languageChanged(QString newLanguage); - void colorRangeChanged(QString newColorRange); - void colorSpaceChanged(QString newColorSpace); - void colorTransferChanged(QString newColorTransfer); - void colorPrimariesChanged(QString newColorPrimaries); - void commentChanged(QString newComment); - void timeBaseChanged(QString newTimeBase); - void codecTimeBaseChanged(QString newCodecTimeBase); - void titleChanged(QString newTitle); - void videoRangeChanged(QString newVideoRange); - void localizedUndefinedChanged(QString newLocalizedUndefined); - void localizedDefaultChanged(QString newLocalizedDefault); - void localizedForcedChanged(QString newLocalizedForced); - void displayTitleChanged(QString newDisplayTitle); - void nalLengthSizeChanged(QString newNalLengthSize); - void isInterlacedChanged(bool newIsInterlaced); - void isAVCChanged(bool newIsAVC); - void channelLayoutChanged(QString newChannelLayout); - void bitRateChanged(qint32 newBitRate); - void bitDepthChanged(qint32 newBitDepth); - void refFramesChanged(qint32 newRefFrames); - void packetLengthChanged(qint32 newPacketLength); - void channelsChanged(qint32 newChannels); - void sampleRateChanged(qint32 newSampleRate); - void isDefaultChanged(bool newIsDefault); - void isForcedChanged(bool newIsForced); - void heightChanged(qint32 newHeight); - void widthChanged(qint32 newWidth); - void averageFrameRateChanged(float newAverageFrameRate); - void realFrameRateChanged(float newRealFrameRate); - void profileChanged(QString newProfile); - void typeChanged(MediaStreamType newType); - void aspectRatioChanged(QString newAspectRatio); - void indexChanged(qint32 newIndex); - void scoreChanged(qint32 newScore); - void isExternalChanged(bool newIsExternal); - void deliveryMethodChanged(SubtitleDeliveryMethod newDeliveryMethod); - void deliveryUrlChanged(QString newDeliveryUrl); - void isExternalUrlChanged(bool newIsExternalUrl); - void isTextSubtitleStreamChanged(bool newIsTextSubtitleStream); - void supportsExternalStreamChanged(bool newSupportsExternalStream); - void pathChanged(QString newPath); - void pixelFormatChanged(QString newPixelFormat); - void levelChanged(double newLevel); - void isAnamorphicChanged(bool newIsAnamorphic); + protected: QString m_codec; QString m_codecTag; @@ -449,6 +442,18 @@ protected: bool m_isAnamorphic; }; +} // NS DTO + +namespace Support { + +using MediaStream = Jellyfin::DTO::MediaStream; + +template <> +MediaStream fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaStream::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediastreamtype.h b/core/include/JellyfinQt/DTO/mediastreamtype.h index 98f9c3e..1f8f7cf 100644 --- a/core/include/JellyfinQt/DTO/mediastreamtype.h +++ b/core/include/JellyfinQt/DTO/mediastreamtype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_MEDIASTREAMTYPE_H #define JELLYFIN_DTO_MEDIASTREAMTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class MediaStreamTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Audio, Video, Subtitle, @@ -48,8 +53,37 @@ public: private: explicit MediaStreamTypeClass(); }; + typedef MediaStreamTypeClass::Value MediaStreamType; +} // NS DTO + +namespace Support { + +using MediaStreamType = Jellyfin::DTO::MediaStreamType; +using MediaStreamTypeClass = Jellyfin::DTO::MediaStreamTypeClass; + +template <> +MediaStreamType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return MediaStreamTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Audio")) { + return MediaStreamTypeClass::Audio; + } + if (str == QStringLiteral("Video")) { + return MediaStreamTypeClass::Video; + } + if (str == QStringLiteral("Subtitle")) { + return MediaStreamTypeClass::Subtitle; + } + if (str == QStringLiteral("EmbeddedImage")) { + return MediaStreamTypeClass::EmbeddedImage; + } + + return MediaStreamTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediaupdateinfodto.h b/core/include/JellyfinQt/DTO/mediaupdateinfodto.h index 16024da..5bec512 100644 --- a/core/include/JellyfinQt/DTO/mediaupdateinfodto.h +++ b/core/include/JellyfinQt/DTO/mediaupdateinfodto.h @@ -31,44 +31,60 @@ #define JELLYFIN_DTO_MEDIAUPDATEINFODTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaUpdateInfoDto : public QObject { - Q_OBJECT -public: - explicit MediaUpdateInfoDto(QObject *parent = nullptr); - static MediaUpdateInfoDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class MediaUpdateInfoDto { +public: + explicit MediaUpdateInfoDto(); + static MediaUpdateInfoDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets media path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets media path. + */ + void setPath(QString newPath); /** * @brief Gets or sets media update type. Created, Modified, Deleted. */ - Q_PROPERTY(QString updateType READ updateType WRITE setUpdateType NOTIFY updateTypeChanged) - - QString path() const; - void setPath(QString newPath); - QString updateType() const; + /** + * @brief Gets or sets media update type. +Created, Modified, Deleted. + */ void setUpdateType(QString newUpdateType); - -signals: - void pathChanged(QString newPath); - void updateTypeChanged(QString newUpdateType); + protected: QString m_path; QString m_updateType; }; +} // NS DTO + +namespace Support { + +using MediaUpdateInfoDto = Jellyfin::DTO::MediaUpdateInfoDto; + +template <> +MediaUpdateInfoDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaUpdateInfoDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/mediaurl.h b/core/include/JellyfinQt/DTO/mediaurl.h index 60c7204..959f995 100644 --- a/core/include/JellyfinQt/DTO/mediaurl.h +++ b/core/include/JellyfinQt/DTO/mediaurl.h @@ -31,37 +31,50 @@ #define JELLYFIN_DTO_MEDIAURL_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaUrl : public QObject { - Q_OBJECT -public: - explicit MediaUrl(QObject *parent = nullptr); - static MediaUrl *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) +class MediaUrl { +public: + explicit MediaUrl(); + static MediaUrl fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString url() const; + void setUrl(QString newUrl); - + QString name() const; + void setName(QString newName); - -signals: - void urlChanged(QString newUrl); - void nameChanged(QString newName); + protected: QString m_url; QString m_name; }; +} // NS DTO + +namespace Support { + +using MediaUrl = Jellyfin::DTO::MediaUrl; + +template <> +MediaUrl fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MediaUrl::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/metadataeditorinfo.h b/core/include/JellyfinQt/DTO/metadataeditorinfo.h index 66178c2..8b44810 100644 --- a/core/include/JellyfinQt/DTO/metadataeditorinfo.h +++ b/core/include/JellyfinQt/DTO/metadataeditorinfo.h @@ -31,69 +31,78 @@ #define JELLYFIN_DTO_METADATAEDITORINFO_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/countryinfo.h" +#include "JellyfinQt/DTO/culturedto.h" +#include "JellyfinQt/DTO/externalidinfo.h" +#include "JellyfinQt/DTO/namevaluepair.h" +#include "JellyfinQt/DTO/parentalrating.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class CountryInfo; -class CultureDto; -class ExternalIdInfo; -class NameValuePair; -class ParentalRating; -class MetadataEditorInfo : public QObject { - Q_OBJECT +class MetadataEditorInfo { public: - explicit MetadataEditorInfo(QObject *parent = nullptr); - static MetadataEditorInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit MetadataEditorInfo(); + static MetadataEditorInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(QList parentalRatingOptions READ parentalRatingOptions WRITE setParentalRatingOptions NOTIFY parentalRatingOptionsChanged) - Q_PROPERTY(QList countries READ countries WRITE setCountries NOTIFY countriesChanged) - Q_PROPERTY(QList cultures READ cultures WRITE setCultures NOTIFY culturesChanged) - Q_PROPERTY(QList externalIdInfos READ externalIdInfos WRITE setExternalIdInfos NOTIFY externalIdInfosChanged) - Q_PROPERTY(QString contentType READ contentType WRITE setContentType NOTIFY contentTypeChanged) - Q_PROPERTY(QList contentTypeOptions READ contentTypeOptions WRITE setContentTypeOptions NOTIFY contentTypeOptionsChanged) + QList> parentalRatingOptions() const; + + void setParentalRatingOptions(QList> newParentalRatingOptions); + + QList> countries() const; + + void setCountries(QList> newCountries); + + QList> cultures() const; + + void setCultures(QList> newCultures); + + QList> externalIdInfos() const; + + void setExternalIdInfos(QList> newExternalIdInfos); - QList parentalRatingOptions() const; - void setParentalRatingOptions(QList newParentalRatingOptions); - - QList countries() const; - void setCountries(QList newCountries); - - QList cultures() const; - void setCultures(QList newCultures); - - QList externalIdInfos() const; - void setExternalIdInfos(QList newExternalIdInfos); - QString contentType() const; + void setContentType(QString newContentType); - - QList contentTypeOptions() const; - void setContentTypeOptions(QList newContentTypeOptions); - -signals: - void parentalRatingOptionsChanged(QList newParentalRatingOptions); - void countriesChanged(QList newCountries); - void culturesChanged(QList newCultures); - void externalIdInfosChanged(QList newExternalIdInfos); - void contentTypeChanged(QString newContentType); - void contentTypeOptionsChanged(QList newContentTypeOptions); + + QList> contentTypeOptions() const; + + void setContentTypeOptions(QList> newContentTypeOptions); + protected: - QList m_parentalRatingOptions; - QList m_countries; - QList m_cultures; - QList m_externalIdInfos; + QList> m_parentalRatingOptions; + QList> m_countries; + QList> m_cultures; + QList> m_externalIdInfos; QString m_contentType; - QList m_contentTypeOptions; + QList> m_contentTypeOptions; }; +} // NS DTO + +namespace Support { + +using MetadataEditorInfo = Jellyfin::DTO::MetadataEditorInfo; + +template <> +MetadataEditorInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MetadataEditorInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/metadatafield.h b/core/include/JellyfinQt/DTO/metadatafield.h index 7ebcfd7..337c315 100644 --- a/core/include/JellyfinQt/DTO/metadatafield.h +++ b/core/include/JellyfinQt/DTO/metadatafield.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_METADATAFIELD_H #define JELLYFIN_DTO_METADATAFIELD_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class MetadataFieldClass { Q_GADGET public: enum Value { + EnumNotSet, Cast, Genres, ProductionLocations, @@ -53,8 +58,52 @@ public: private: explicit MetadataFieldClass(); }; + typedef MetadataFieldClass::Value MetadataField; +} // NS DTO + +namespace Support { + +using MetadataField = Jellyfin::DTO::MetadataField; +using MetadataFieldClass = Jellyfin::DTO::MetadataFieldClass; + +template <> +MetadataField fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return MetadataFieldClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Cast")) { + return MetadataFieldClass::Cast; + } + if (str == QStringLiteral("Genres")) { + return MetadataFieldClass::Genres; + } + if (str == QStringLiteral("ProductionLocations")) { + return MetadataFieldClass::ProductionLocations; + } + if (str == QStringLiteral("Studios")) { + return MetadataFieldClass::Studios; + } + if (str == QStringLiteral("Tags")) { + return MetadataFieldClass::Tags; + } + if (str == QStringLiteral("Name")) { + return MetadataFieldClass::Name; + } + if (str == QStringLiteral("Overview")) { + return MetadataFieldClass::Overview; + } + if (str == QStringLiteral("Runtime")) { + return MetadataFieldClass::Runtime; + } + if (str == QStringLiteral("OfficialRating")) { + return MetadataFieldClass::OfficialRating; + } + + return MetadataFieldClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/metadataoptions.h b/core/include/JellyfinQt/DTO/metadataoptions.h index 72e7959..54ccd42 100644 --- a/core/include/JellyfinQt/DTO/metadataoptions.h +++ b/core/include/JellyfinQt/DTO/metadataoptions.h @@ -31,59 +31,55 @@ #define JELLYFIN_DTO_METADATAOPTIONS_H #include +#include #include -#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MetadataOptions : public QObject { - Q_OBJECT -public: - explicit MetadataOptions(QObject *parent = nullptr); - static MetadataOptions *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString itemType READ itemType WRITE setItemType NOTIFY itemTypeChanged) - Q_PROPERTY(QStringList disabledMetadataSavers READ disabledMetadataSavers WRITE setDisabledMetadataSavers NOTIFY disabledMetadataSaversChanged) - Q_PROPERTY(QStringList localMetadataReaderOrder READ localMetadataReaderOrder WRITE setLocalMetadataReaderOrder NOTIFY localMetadataReaderOrderChanged) - Q_PROPERTY(QStringList disabledMetadataFetchers READ disabledMetadataFetchers WRITE setDisabledMetadataFetchers NOTIFY disabledMetadataFetchersChanged) - Q_PROPERTY(QStringList metadataFetcherOrder READ metadataFetcherOrder WRITE setMetadataFetcherOrder NOTIFY metadataFetcherOrderChanged) - Q_PROPERTY(QStringList disabledImageFetchers READ disabledImageFetchers WRITE setDisabledImageFetchers NOTIFY disabledImageFetchersChanged) - Q_PROPERTY(QStringList imageFetcherOrder READ imageFetcherOrder WRITE setImageFetcherOrder NOTIFY imageFetcherOrderChanged) +class MetadataOptions { +public: + explicit MetadataOptions(); + static MetadataOptions fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString itemType() const; + void setItemType(QString newItemType); - + QStringList disabledMetadataSavers() const; + void setDisabledMetadataSavers(QStringList newDisabledMetadataSavers); - + QStringList localMetadataReaderOrder() const; + void setLocalMetadataReaderOrder(QStringList newLocalMetadataReaderOrder); - + QStringList disabledMetadataFetchers() const; + void setDisabledMetadataFetchers(QStringList newDisabledMetadataFetchers); - + QStringList metadataFetcherOrder() const; + void setMetadataFetcherOrder(QStringList newMetadataFetcherOrder); - + QStringList disabledImageFetchers() const; + void setDisabledImageFetchers(QStringList newDisabledImageFetchers); - + QStringList imageFetcherOrder() const; + void setImageFetcherOrder(QStringList newImageFetcherOrder); - -signals: - void itemTypeChanged(QString newItemType); - void disabledMetadataSaversChanged(QStringList newDisabledMetadataSavers); - void localMetadataReaderOrderChanged(QStringList newLocalMetadataReaderOrder); - void disabledMetadataFetchersChanged(QStringList newDisabledMetadataFetchers); - void metadataFetcherOrderChanged(QStringList newMetadataFetcherOrder); - void disabledImageFetchersChanged(QStringList newDisabledImageFetchers); - void imageFetcherOrderChanged(QStringList newImageFetcherOrder); + protected: QString m_itemType; QStringList m_disabledMetadataSavers; @@ -94,6 +90,18 @@ protected: QStringList m_imageFetcherOrder; }; +} // NS DTO + +namespace Support { + +using MetadataOptions = Jellyfin::DTO::MetadataOptions; + +template <> +MetadataOptions fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MetadataOptions::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/metadatarefreshmode.h b/core/include/JellyfinQt/DTO/metadatarefreshmode.h index 278d2f1..2ce8f52 100644 --- a/core/include/JellyfinQt/DTO/metadatarefreshmode.h +++ b/core/include/JellyfinQt/DTO/metadatarefreshmode.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_METADATAREFRESHMODE_H #define JELLYFIN_DTO_METADATAREFRESHMODE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class MetadataRefreshModeClass { Q_GADGET public: enum Value { + EnumNotSet, None, ValidationOnly, Default, @@ -48,8 +53,37 @@ public: private: explicit MetadataRefreshModeClass(); }; + typedef MetadataRefreshModeClass::Value MetadataRefreshMode; +} // NS DTO + +namespace Support { + +using MetadataRefreshMode = Jellyfin::DTO::MetadataRefreshMode; +using MetadataRefreshModeClass = Jellyfin::DTO::MetadataRefreshModeClass; + +template <> +MetadataRefreshMode fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return MetadataRefreshModeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("None")) { + return MetadataRefreshModeClass::None; + } + if (str == QStringLiteral("ValidationOnly")) { + return MetadataRefreshModeClass::ValidationOnly; + } + if (str == QStringLiteral("Default")) { + return MetadataRefreshModeClass::Default; + } + if (str == QStringLiteral("FullRefresh")) { + return MetadataRefreshModeClass::FullRefresh; + } + + return MetadataRefreshModeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/moveplaylistitemrequestdto.h b/core/include/JellyfinQt/DTO/moveplaylistitemrequestdto.h index 5fdd48a..87a16a7 100644 --- a/core/include/JellyfinQt/DTO/moveplaylistitemrequestdto.h +++ b/core/include/JellyfinQt/DTO/moveplaylistitemrequestdto.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_MOVEPLAYLISTITEMREQUESTDTO_H #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MovePlaylistItemRequestDto : public QObject { - Q_OBJECT -public: - explicit MovePlaylistItemRequestDto(QObject *parent = nullptr); - static MovePlaylistItemRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class MovePlaylistItemRequestDto { +public: + explicit MovePlaylistItemRequestDto(); + static MovePlaylistItemRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the playlist identifier of the item. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QUuid playlistItemId() const; + /** + * @brief Gets or sets the playlist identifier of the item. + */ + void setPlaylistItemId(QUuid newPlaylistItemId); /** * @brief Gets or sets the new position. */ - Q_PROPERTY(qint32 newIndex READ newIndex WRITE setNewIndex NOTIFY newIndexChanged) - - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - qint32 newIndex() const; + /** + * @brief Gets or sets the new position. + */ void setNewIndex(qint32 newNewIndex); - -signals: - void playlistItemIdChanged(QString newPlaylistItemId); - void newIndexChanged(qint32 newNewIndex); + protected: - QString m_playlistItemId; + QUuid m_playlistItemId; qint32 m_newIndex; }; +} // NS DTO + +namespace Support { + +using MovePlaylistItemRequestDto = Jellyfin::DTO::MovePlaylistItemRequestDto; + +template <> +MovePlaylistItemRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MovePlaylistItemRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/movieinfo.h b/core/include/JellyfinQt/DTO/movieinfo.h index 050644b..f03935d 100644 --- a/core/include/JellyfinQt/DTO/movieinfo.h +++ b/core/include/JellyfinQt/DTO/movieinfo.h @@ -32,90 +32,89 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MovieInfo : public QObject { - Q_OBJECT -public: - explicit MovieInfo(QObject *parent = nullptr); - static MovieInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class MovieInfo { +public: + explicit MovieInfo(); + static MovieInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); + protected: QString m_name; QString m_path; @@ -129,6 +128,18 @@ protected: bool m_isAutomated; }; +} // NS DTO + +namespace Support { + +using MovieInfo = Jellyfin::DTO::MovieInfo; + +template <> +MovieInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MovieInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/movieinforemotesearchquery.h b/core/include/JellyfinQt/DTO/movieinforemotesearchquery.h index cccede8..b7279ea 100644 --- a/core/include/JellyfinQt/DTO/movieinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/movieinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_MOVIEINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/movieinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MovieInfo; -class MovieInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class MovieInfoRemoteSearchQuery { public: - explicit MovieInfoRemoteSearchQuery(QObject *parent = nullptr); - static MovieInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit MovieInfoRemoteSearchQuery(); + static MovieInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(MovieInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - MovieInfo * searchInfo() const; - void setSearchInfo(MovieInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(MovieInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - MovieInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using MovieInfoRemoteSearchQuery = Jellyfin::DTO::MovieInfoRemoteSearchQuery; + +template <> +MovieInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MovieInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/musicvideoinfo.h b/core/include/JellyfinQt/DTO/musicvideoinfo.h index 7418a27..a53fdf0 100644 --- a/core/include/JellyfinQt/DTO/musicvideoinfo.h +++ b/core/include/JellyfinQt/DTO/musicvideoinfo.h @@ -32,97 +32,95 @@ #include #include +#include #include -#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MusicVideoInfo : public QObject { - Q_OBJECT -public: - explicit MusicVideoInfo(QObject *parent = nullptr); - static MusicVideoInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class MusicVideoInfo { +public: + explicit MusicVideoInfo(); + static MusicVideoInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - Q_PROPERTY(QStringList artists READ artists WRITE setArtists NOTIFY artistsChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - + QStringList artists() const; + void setArtists(QStringList newArtists); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); - void artistsChanged(QStringList newArtists); + protected: QString m_name; QString m_path; @@ -137,6 +135,18 @@ protected: QStringList m_artists; }; +} // NS DTO + +namespace Support { + +using MusicVideoInfo = Jellyfin::DTO::MusicVideoInfo; + +template <> +MusicVideoInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MusicVideoInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/musicvideoinforemotesearchquery.h b/core/include/JellyfinQt/DTO/musicvideoinforemotesearchquery.h index e6cc277..8ff9616 100644 --- a/core/include/JellyfinQt/DTO/musicvideoinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/musicvideoinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_MUSICVIDEOINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/musicvideoinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MusicVideoInfo; -class MusicVideoInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class MusicVideoInfoRemoteSearchQuery { public: - explicit MusicVideoInfoRemoteSearchQuery(QObject *parent = nullptr); - static MusicVideoInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit MusicVideoInfoRemoteSearchQuery(); + static MusicVideoInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(MusicVideoInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - MusicVideoInfo * searchInfo() const; - void setSearchInfo(MusicVideoInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(MusicVideoInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - MusicVideoInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using MusicVideoInfoRemoteSearchQuery = Jellyfin::DTO::MusicVideoInfoRemoteSearchQuery; + +template <> +MusicVideoInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return MusicVideoInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/nameguidpair.h b/core/include/JellyfinQt/DTO/nameguidpair.h index ba935f5..c379925 100644 --- a/core/include/JellyfinQt/DTO/nameguidpair.h +++ b/core/include/JellyfinQt/DTO/nameguidpair.h @@ -31,37 +31,51 @@ #define JELLYFIN_DTO_NAMEGUIDPAIR_H #include -#include +#include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NameGuidPair : public QObject { - Q_OBJECT -public: - explicit NameGuidPair(QObject *parent = nullptr); - static NameGuidPair *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) +class NameGuidPair { +public: + explicit NameGuidPair(); + static NameGuidPair fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString name() const; + void setName(QString newName); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - -signals: - void nameChanged(QString newName); - void jellyfinIdChanged(QString newJellyfinId); + + QUuid jellyfinId() const; + + void setJellyfinId(QUuid newJellyfinId); + protected: QString m_name; - QString m_jellyfinId; + QUuid m_jellyfinId; }; +} // NS DTO + +namespace Support { + +using NameGuidPair = Jellyfin::DTO::NameGuidPair; + +template <> +NameGuidPair fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NameGuidPair::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/nameidpair.h b/core/include/JellyfinQt/DTO/nameidpair.h index 02ffb9b..1db8f10 100644 --- a/core/include/JellyfinQt/DTO/nameidpair.h +++ b/core/include/JellyfinQt/DTO/nameidpair.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_NAMEIDPAIR_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NameIdPair : public QObject { - Q_OBJECT -public: - explicit NameIdPair(QObject *parent = nullptr); - static NameIdPair *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class NameIdPair { +public: + explicit NameIdPair(); + static NameIdPair fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the identifier. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - - QString name() const; - void setName(QString newName); - QString jellyfinId() const; + /** + * @brief Gets or sets the identifier. + */ void setJellyfinId(QString newJellyfinId); - -signals: - void nameChanged(QString newName); - void jellyfinIdChanged(QString newJellyfinId); + protected: QString m_name; QString m_jellyfinId; }; +} // NS DTO + +namespace Support { + +using NameIdPair = Jellyfin::DTO::NameIdPair; + +template <> +NameIdPair fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NameIdPair::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/namevaluepair.h b/core/include/JellyfinQt/DTO/namevaluepair.h index cb9088c..e3756cb 100644 --- a/core/include/JellyfinQt/DTO/namevaluepair.h +++ b/core/include/JellyfinQt/DTO/namevaluepair.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_NAMEVALUEPAIR_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NameValuePair : public QObject { - Q_OBJECT -public: - explicit NameValuePair(QObject *parent = nullptr); - static NameValuePair *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class NameValuePair { +public: + explicit NameValuePair(); + static NameValuePair fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the value. */ - Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged) - - QString name() const; - void setName(QString newName); - QString value() const; + /** + * @brief Gets or sets the value. + */ void setValue(QString newValue); - -signals: - void nameChanged(QString newName); - void valueChanged(QString newValue); + protected: QString m_name; QString m_value; }; +} // NS DTO + +namespace Support { + +using NameValuePair = Jellyfin::DTO::NameValuePair; + +template <> +NameValuePair fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NameValuePair::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/newgrouprequestdto.h b/core/include/JellyfinQt/DTO/newgrouprequestdto.h index 2b85dca..0835374 100644 --- a/core/include/JellyfinQt/DTO/newgrouprequestdto.h +++ b/core/include/JellyfinQt/DTO/newgrouprequestdto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_NEWGROUPREQUESTDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NewGroupRequestDto : public QObject { - Q_OBJECT -public: - explicit NewGroupRequestDto(QObject *parent = nullptr); - static NewGroupRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class NewGroupRequestDto { +public: + explicit NewGroupRequestDto(); + static NewGroupRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the group name. */ - Q_PROPERTY(QString groupName READ groupName WRITE setGroupName NOTIFY groupNameChanged) - QString groupName() const; + /** + * @brief Gets or sets the group name. + */ void setGroupName(QString newGroupName); - -signals: - void groupNameChanged(QString newGroupName); + protected: QString m_groupName; }; +} // NS DTO + +namespace Support { + +using NewGroupRequestDto = Jellyfin::DTO::NewGroupRequestDto; + +template <> +NewGroupRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NewGroupRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/nextitemrequestdto.h b/core/include/JellyfinQt/DTO/nextitemrequestdto.h index b9e1998..b520b98 100644 --- a/core/include/JellyfinQt/DTO/nextitemrequestdto.h +++ b/core/include/JellyfinQt/DTO/nextitemrequestdto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_NEXTITEMREQUESTDTO_H #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NextItemRequestDto : public QObject { - Q_OBJECT -public: - explicit NextItemRequestDto(QObject *parent = nullptr); - static NextItemRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class NextItemRequestDto { +public: + explicit NextItemRequestDto(); + static NextItemRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the playing item identifier. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QUuid playlistItemId() const; + /** + * @brief Gets or sets the playing item identifier. + */ + void setPlaylistItemId(QUuid newPlaylistItemId); - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void playlistItemIdChanged(QString newPlaylistItemId); protected: - QString m_playlistItemId; + QUuid m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using NextItemRequestDto = Jellyfin::DTO::NextItemRequestDto; + +template <> +NextItemRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NextItemRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/notificationdto.h b/core/include/JellyfinQt/DTO/notificationdto.h index db93416..c7e7576 100644 --- a/core/include/JellyfinQt/DTO/notificationdto.h +++ b/core/include/JellyfinQt/DTO/notificationdto.h @@ -32,85 +32,86 @@ #include #include -#include +#include #include +#include #include "JellyfinQt/DTO/notificationlevel.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NotificationDto : public QObject { - Q_OBJECT -public: - explicit NotificationDto(QObject *parent = nullptr); - static NotificationDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class NotificationDto { +public: + explicit NotificationDto(); + static NotificationDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the notification ID. Defaults to an empty string. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the notification ID. Defaults to an empty string. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets the notification's user ID. Defaults to an empty string. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QString userId() const; + /** + * @brief Gets or sets the notification's user ID. Defaults to an empty string. + */ + void setUserId(QString newUserId); /** * @brief Gets or sets the notification date. */ - Q_PROPERTY(QDateTime date READ date WRITE setDate NOTIFY dateChanged) + QDateTime date() const; + /** + * @brief Gets or sets the notification date. + */ + void setDate(QDateTime newDate); /** * @brief Gets or sets a value indicating whether the notification has been read. Defaults to false. */ - Q_PROPERTY(bool isRead READ isRead WRITE setIsRead NOTIFY isReadChanged) + bool isRead() const; + /** + * @brief Gets or sets a value indicating whether the notification has been read. Defaults to false. + */ + void setIsRead(bool newIsRead); /** * @brief Gets or sets the notification's name. Defaults to an empty string. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the notification's name. Defaults to an empty string. + */ + void setName(QString newName); /** * @brief Gets or sets the notification's description. Defaults to an empty string. */ - Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged) + QString description() const; + /** + * @brief Gets or sets the notification's description. Defaults to an empty string. + */ + void setDescription(QString newDescription); /** * @brief Gets or sets the notification's URL. Defaults to an empty string. */ - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(NotificationLevel level READ level WRITE setLevel NOTIFY levelChanged) - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString userId() const; - void setUserId(QString newUserId); - - QDateTime date() const; - void setDate(QDateTime newDate); - - bool isRead() const; - void setIsRead(bool newIsRead); - - QString name() const; - void setName(QString newName); - - QString description() const; - void setDescription(QString newDescription); - QString url() const; + /** + * @brief Gets or sets the notification's URL. Defaults to an empty string. + */ void setUrl(QString newUrl); - + NotificationLevel level() const; + void setLevel(NotificationLevel newLevel); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void userIdChanged(QString newUserId); - void dateChanged(QDateTime newDate); - void isReadChanged(bool newIsRead); - void nameChanged(QString newName); - void descriptionChanged(QString newDescription); - void urlChanged(QString newUrl); - void levelChanged(NotificationLevel newLevel); + protected: QString m_jellyfinId; QString m_userId; @@ -122,6 +123,18 @@ protected: NotificationLevel m_level; }; +} // NS DTO + +namespace Support { + +using NotificationDto = Jellyfin::DTO::NotificationDto; + +template <> +NotificationDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NotificationDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/notificationlevel.h b/core/include/JellyfinQt/DTO/notificationlevel.h index 50c1e5c..acb8bf2 100644 --- a/core/include/JellyfinQt/DTO/notificationlevel.h +++ b/core/include/JellyfinQt/DTO/notificationlevel.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_NOTIFICATIONLEVEL_H #define JELLYFIN_DTO_NOTIFICATIONLEVEL_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class NotificationLevelClass { Q_GADGET public: enum Value { + EnumNotSet, Normal, Warning, Error, @@ -47,8 +52,34 @@ public: private: explicit NotificationLevelClass(); }; + typedef NotificationLevelClass::Value NotificationLevel; +} // NS DTO + +namespace Support { + +using NotificationLevel = Jellyfin::DTO::NotificationLevel; +using NotificationLevelClass = Jellyfin::DTO::NotificationLevelClass; + +template <> +NotificationLevel fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return NotificationLevelClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Normal")) { + return NotificationLevelClass::Normal; + } + if (str == QStringLiteral("Warning")) { + return NotificationLevelClass::Warning; + } + if (str == QStringLiteral("Error")) { + return NotificationLevelClass::Error; + } + + return NotificationLevelClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/notificationresultdto.h b/core/include/JellyfinQt/DTO/notificationresultdto.h index 5e8a954..4d3c484 100644 --- a/core/include/JellyfinQt/DTO/notificationresultdto.h +++ b/core/include/JellyfinQt/DTO/notificationresultdto.h @@ -31,46 +31,61 @@ #define JELLYFIN_DTO_NOTIFICATIONRESULTDTO_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/notificationdto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NotificationDto; -class NotificationResultDto : public QObject { - Q_OBJECT +class NotificationResultDto { public: - explicit NotificationResultDto(QObject *parent = nullptr); - static NotificationResultDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit NotificationResultDto(); + static NotificationResultDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the current page of notifications. */ - Q_PROPERTY(QList notifications READ notifications WRITE setNotifications NOTIFY notificationsChanged) + QList> notifications() const; + /** + * @brief Gets or sets the current page of notifications. + */ + void setNotifications(QList> newNotifications); /** * @brief Gets or sets the total number of notifications. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) - - QList notifications() const; - void setNotifications(QList newNotifications); - qint32 totalRecordCount() const; + /** + * @brief Gets or sets the total number of notifications. + */ void setTotalRecordCount(qint32 newTotalRecordCount); - -signals: - void notificationsChanged(QList newNotifications); - void totalRecordCountChanged(qint32 newTotalRecordCount); + protected: - QList m_notifications; + QList> m_notifications; qint32 m_totalRecordCount; }; +} // NS DTO + +namespace Support { + +using NotificationResultDto = Jellyfin::DTO::NotificationResultDto; + +template <> +NotificationResultDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NotificationResultDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/notificationssummarydto.h b/core/include/JellyfinQt/DTO/notificationssummarydto.h index 7e1b89e..1569ffd 100644 --- a/core/include/JellyfinQt/DTO/notificationssummarydto.h +++ b/core/include/JellyfinQt/DTO/notificationssummarydto.h @@ -31,41 +31,54 @@ #define JELLYFIN_DTO_NOTIFICATIONSSUMMARYDTO_H #include -#include +#include +#include #include "JellyfinQt/DTO/notificationlevel.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NotificationsSummaryDto : public QObject { - Q_OBJECT -public: - explicit NotificationsSummaryDto(QObject *parent = nullptr); - static NotificationsSummaryDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class NotificationsSummaryDto { +public: + explicit NotificationsSummaryDto(); + static NotificationsSummaryDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the number of unread notifications. */ - Q_PROPERTY(qint32 unreadCount READ unreadCount WRITE setUnreadCount NOTIFY unreadCountChanged) - Q_PROPERTY(NotificationLevel maxUnreadNotificationLevel READ maxUnreadNotificationLevel WRITE setMaxUnreadNotificationLevel NOTIFY maxUnreadNotificationLevelChanged) - qint32 unreadCount() const; + /** + * @brief Gets or sets the number of unread notifications. + */ void setUnreadCount(qint32 newUnreadCount); - + NotificationLevel maxUnreadNotificationLevel() const; + void setMaxUnreadNotificationLevel(NotificationLevel newMaxUnreadNotificationLevel); - -signals: - void unreadCountChanged(qint32 newUnreadCount); - void maxUnreadNotificationLevelChanged(NotificationLevel newMaxUnreadNotificationLevel); + protected: qint32 m_unreadCount; NotificationLevel m_maxUnreadNotificationLevel; }; +} // NS DTO + +namespace Support { + +using NotificationsSummaryDto = Jellyfin::DTO::NotificationsSummaryDto; + +template <> +NotificationsSummaryDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NotificationsSummaryDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/notificationtypeinfo.h b/core/include/JellyfinQt/DTO/notificationtypeinfo.h index 11f7213..0dc4fab 100644 --- a/core/include/JellyfinQt/DTO/notificationtypeinfo.h +++ b/core/include/JellyfinQt/DTO/notificationtypeinfo.h @@ -31,47 +31,45 @@ #define JELLYFIN_DTO_NOTIFICATIONTYPEINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NotificationTypeInfo : public QObject { - Q_OBJECT -public: - explicit NotificationTypeInfo(QObject *parent = nullptr); - static NotificationTypeInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged) - Q_PROPERTY(bool isBasedOnUserEvent READ isBasedOnUserEvent WRITE setIsBasedOnUserEvent NOTIFY isBasedOnUserEventChanged) +class NotificationTypeInfo { +public: + explicit NotificationTypeInfo(); + static NotificationTypeInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString type() const; + void setType(QString newType); - + QString name() const; + void setName(QString newName); - + bool enabled() const; + void setEnabled(bool newEnabled); - + QString category() const; + void setCategory(QString newCategory); - + bool isBasedOnUserEvent() const; + void setIsBasedOnUserEvent(bool newIsBasedOnUserEvent); - -signals: - void typeChanged(QString newType); - void nameChanged(QString newName); - void enabledChanged(bool newEnabled); - void categoryChanged(QString newCategory); - void isBasedOnUserEventChanged(bool newIsBasedOnUserEvent); + protected: QString m_type; QString m_name; @@ -80,6 +78,18 @@ protected: bool m_isBasedOnUserEvent; }; +} // NS DTO + +namespace Support { + +using NotificationTypeInfo = Jellyfin::DTO::NotificationTypeInfo; + +template <> +NotificationTypeInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return NotificationTypeInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/objectgroupupdate.h b/core/include/JellyfinQt/DTO/objectgroupupdate.h index 7a51d15..1f1a057 100644 --- a/core/include/JellyfinQt/DTO/objectgroupupdate.h +++ b/core/include/JellyfinQt/DTO/objectgroupupdate.h @@ -31,52 +31,65 @@ #define JELLYFIN_DTO_OBJECTGROUPUPDATE_H #include -#include -#include +#include +#include #include +#include #include "JellyfinQt/DTO/groupupdatetype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ObjectGroupUpdate : public QObject { - Q_OBJECT -public: - explicit ObjectGroupUpdate(QObject *parent = nullptr); - static ObjectGroupUpdate *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ObjectGroupUpdate { +public: + explicit ObjectGroupUpdate(); + static ObjectGroupUpdate fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the group identifier. */ - Q_PROPERTY(QString groupId READ groupId WRITE setGroupId NOTIFY groupIdChanged) - Q_PROPERTY(GroupUpdateType type READ type WRITE setType NOTIFY typeChanged) + QUuid groupId() const; + /** + * @brief Gets the group identifier. + */ + void setGroupId(QUuid newGroupId); + + GroupUpdateType type() const; + + void setType(GroupUpdateType newType); /** * @brief Gets the update data. */ - Q_PROPERTY(QVariant data READ data WRITE setData NOTIFY dataChanged) - - QString groupId() const; - void setGroupId(QString newGroupId); - - GroupUpdateType type() const; - void setType(GroupUpdateType newType); - QVariant data() const; + /** + * @brief Gets the update data. + */ void setData(QVariant newData); - -signals: - void groupIdChanged(QString newGroupId); - void typeChanged(GroupUpdateType newType); - void dataChanged(QVariant newData); + protected: - QString m_groupId; + QUuid m_groupId; GroupUpdateType m_type; QVariant m_data; }; +} // NS DTO + +namespace Support { + +using ObjectGroupUpdate = Jellyfin::DTO::ObjectGroupUpdate; + +template <> +ObjectGroupUpdate fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ObjectGroupUpdate::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/openlivestreamdto.h b/core/include/JellyfinQt/DTO/openlivestreamdto.h index c9c6ba2..c376a9b 100644 --- a/core/include/JellyfinQt/DTO/openlivestreamdto.h +++ b/core/include/JellyfinQt/DTO/openlivestreamdto.h @@ -31,145 +31,159 @@ #define JELLYFIN_DTO_OPENLIVESTREAMDTO_H #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/deviceprofile.h" #include "JellyfinQt/DTO/mediaprotocol.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DeviceProfile; -class OpenLiveStreamDto : public QObject { - Q_OBJECT +class OpenLiveStreamDto { public: - explicit OpenLiveStreamDto(QObject *parent = nullptr); - static OpenLiveStreamDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit OpenLiveStreamDto(); + static OpenLiveStreamDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the open token. */ - Q_PROPERTY(QString openToken READ openToken WRITE setOpenToken NOTIFY openTokenChanged) + QString openToken() const; + /** + * @brief Gets or sets the open token. + */ + void setOpenToken(QString newOpenToken); /** * @brief Gets or sets the user id. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets the user id. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets the play session id. */ - Q_PROPERTY(QString playSessionId READ playSessionId WRITE setPlaySessionId NOTIFY playSessionIdChanged) + QString playSessionId() const; + /** + * @brief Gets or sets the play session id. + */ + void setPlaySessionId(QString newPlaySessionId); /** * @brief Gets or sets the max streaming bitrate. */ - Q_PROPERTY(qint32 maxStreamingBitrate READ maxStreamingBitrate WRITE setMaxStreamingBitrate NOTIFY maxStreamingBitrateChanged) + qint32 maxStreamingBitrate() const; + /** + * @brief Gets or sets the max streaming bitrate. + */ + void setMaxStreamingBitrate(qint32 newMaxStreamingBitrate); /** * @brief Gets or sets the start time in ticks. */ - Q_PROPERTY(qint64 startTimeTicks READ startTimeTicks WRITE setStartTimeTicks NOTIFY startTimeTicksChanged) + qint64 startTimeTicks() const; + /** + * @brief Gets or sets the start time in ticks. + */ + void setStartTimeTicks(qint64 newStartTimeTicks); /** * @brief Gets or sets the audio stream index. */ - Q_PROPERTY(qint32 audioStreamIndex READ audioStreamIndex WRITE setAudioStreamIndex NOTIFY audioStreamIndexChanged) + qint32 audioStreamIndex() const; + /** + * @brief Gets or sets the audio stream index. + */ + void setAudioStreamIndex(qint32 newAudioStreamIndex); /** * @brief Gets or sets the subtitle stream index. */ - Q_PROPERTY(qint32 subtitleStreamIndex READ subtitleStreamIndex WRITE setSubtitleStreamIndex NOTIFY subtitleStreamIndexChanged) + qint32 subtitleStreamIndex() const; + /** + * @brief Gets or sets the subtitle stream index. + */ + void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); /** * @brief Gets or sets the max audio channels. */ - Q_PROPERTY(qint32 maxAudioChannels READ maxAudioChannels WRITE setMaxAudioChannels NOTIFY maxAudioChannelsChanged) + qint32 maxAudioChannels() const; + /** + * @brief Gets or sets the max audio channels. + */ + void setMaxAudioChannels(qint32 newMaxAudioChannels); /** * @brief Gets or sets the item id. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QUuid itemId() const; + /** + * @brief Gets or sets the item id. + */ + void setItemId(QUuid newItemId); /** * @brief Gets or sets a value indicating whether to enable direct play. */ - Q_PROPERTY(bool enableDirectPlay READ enableDirectPlay WRITE setEnableDirectPlay NOTIFY enableDirectPlayChanged) + bool enableDirectPlay() const; + /** + * @brief Gets or sets a value indicating whether to enable direct play. + */ + void setEnableDirectPlay(bool newEnableDirectPlay); /** * @brief Gets or sets a value indicating whether to enale direct stream. */ - Q_PROPERTY(bool enableDirectStream READ enableDirectStream WRITE setEnableDirectStream NOTIFY enableDirectStreamChanged) - Q_PROPERTY(DeviceProfile * deviceProfile READ deviceProfile WRITE setDeviceProfile NOTIFY deviceProfileChanged) + bool enableDirectStream() const; + /** + * @brief Gets or sets a value indicating whether to enale direct stream. + */ + void setEnableDirectStream(bool newEnableDirectStream); + + QSharedPointer deviceProfile() const; + + void setDeviceProfile(QSharedPointer newDeviceProfile); /** * @brief Gets or sets the device play protocols. */ - Q_PROPERTY(QList directPlayProtocols READ directPlayProtocols WRITE setDirectPlayProtocols NOTIFY directPlayProtocolsChanged) - - QString openToken() const; - void setOpenToken(QString newOpenToken); - - QString userId() const; - void setUserId(QString newUserId); - - QString playSessionId() const; - void setPlaySessionId(QString newPlaySessionId); - - qint32 maxStreamingBitrate() const; - void setMaxStreamingBitrate(qint32 newMaxStreamingBitrate); - - qint64 startTimeTicks() const; - void setStartTimeTicks(qint64 newStartTimeTicks); - - qint32 audioStreamIndex() const; - void setAudioStreamIndex(qint32 newAudioStreamIndex); - - qint32 subtitleStreamIndex() const; - void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); - - qint32 maxAudioChannels() const; - void setMaxAudioChannels(qint32 newMaxAudioChannels); - - QString itemId() const; - void setItemId(QString newItemId); - - bool enableDirectPlay() const; - void setEnableDirectPlay(bool newEnableDirectPlay); - - bool enableDirectStream() const; - void setEnableDirectStream(bool newEnableDirectStream); - - DeviceProfile * deviceProfile() const; - void setDeviceProfile(DeviceProfile * newDeviceProfile); - QList directPlayProtocols() const; + /** + * @brief Gets or sets the device play protocols. + */ void setDirectPlayProtocols(QList newDirectPlayProtocols); - -signals: - void openTokenChanged(QString newOpenToken); - void userIdChanged(QString newUserId); - void playSessionIdChanged(QString newPlaySessionId); - void maxStreamingBitrateChanged(qint32 newMaxStreamingBitrate); - void startTimeTicksChanged(qint64 newStartTimeTicks); - void audioStreamIndexChanged(qint32 newAudioStreamIndex); - void subtitleStreamIndexChanged(qint32 newSubtitleStreamIndex); - void maxAudioChannelsChanged(qint32 newMaxAudioChannels); - void itemIdChanged(QString newItemId); - void enableDirectPlayChanged(bool newEnableDirectPlay); - void enableDirectStreamChanged(bool newEnableDirectStream); - void deviceProfileChanged(DeviceProfile * newDeviceProfile); - void directPlayProtocolsChanged(QList newDirectPlayProtocols); + protected: QString m_openToken; - QString m_userId; + QUuid m_userId; QString m_playSessionId; qint32 m_maxStreamingBitrate; qint64 m_startTimeTicks; qint32 m_audioStreamIndex; qint32 m_subtitleStreamIndex; qint32 m_maxAudioChannels; - QString m_itemId; + QUuid m_itemId; bool m_enableDirectPlay; bool m_enableDirectStream; - DeviceProfile * m_deviceProfile = nullptr; + QSharedPointer m_deviceProfile = nullptr; QList m_directPlayProtocols; }; +} // NS DTO + +namespace Support { + +using OpenLiveStreamDto = Jellyfin::DTO::OpenLiveStreamDto; + +template <> +OpenLiveStreamDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return OpenLiveStreamDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/packageinfo.h b/core/include/JellyfinQt/DTO/packageinfo.h index e8d5813..73f2d7c 100644 --- a/core/include/JellyfinQt/DTO/packageinfo.h +++ b/core/include/JellyfinQt/DTO/packageinfo.h @@ -31,91 +31,95 @@ #define JELLYFIN_DTO_PACKAGEINFO_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/versioninfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class VersionInfo; -class PackageInfo : public QObject { - Q_OBJECT +class PackageInfo { public: - explicit PackageInfo(QObject *parent = nullptr); - static PackageInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit PackageInfo(); + static PackageInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets a long description of the plugin containing features or helpful explanations. */ - Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged) + QString description() const; + /** + * @brief Gets or sets a long description of the plugin containing features or helpful explanations. + */ + void setDescription(QString newDescription); /** * @brief Gets or sets a short overview of what the plugin does. */ - Q_PROPERTY(QString overview READ overview WRITE setOverview NOTIFY overviewChanged) + QString overview() const; + /** + * @brief Gets or sets a short overview of what the plugin does. + */ + void setOverview(QString newOverview); /** * @brief Gets or sets the owner. */ - Q_PROPERTY(QString owner READ owner WRITE setOwner NOTIFY ownerChanged) + QString owner() const; + /** + * @brief Gets or sets the owner. + */ + void setOwner(QString newOwner); /** * @brief Gets or sets the category. */ - Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged) + QString category() const; + /** + * @brief Gets or sets the category. + */ + void setCategory(QString newCategory); /** * @brief Gets or sets the guid of the assembly associated with this plugin. This is used to identify the proper item for automatic updates. */ - Q_PROPERTY(QString guid READ guid WRITE setGuid NOTIFY guidChanged) + QString guid() const; + /** + * @brief Gets or sets the guid of the assembly associated with this plugin. +This is used to identify the proper item for automatic updates. + */ + void setGuid(QString newGuid); /** * @brief Gets or sets the versions. */ - Q_PROPERTY(QList versions READ versions WRITE setVersions NOTIFY versionsChanged) + QList> versions() const; + /** + * @brief Gets or sets the versions. + */ + void setVersions(QList> newVersions); /** * @brief Gets or sets the image url for the package. */ - Q_PROPERTY(QString imageUrl READ imageUrl WRITE setImageUrl NOTIFY imageUrlChanged) - - QString name() const; - void setName(QString newName); - - QString description() const; - void setDescription(QString newDescription); - - QString overview() const; - void setOverview(QString newOverview); - - QString owner() const; - void setOwner(QString newOwner); - - QString category() const; - void setCategory(QString newCategory); - - QString guid() const; - void setGuid(QString newGuid); - - QList versions() const; - void setVersions(QList newVersions); - QString imageUrl() const; + /** + * @brief Gets or sets the image url for the package. + */ void setImageUrl(QString newImageUrl); - -signals: - void nameChanged(QString newName); - void descriptionChanged(QString newDescription); - void overviewChanged(QString newOverview); - void ownerChanged(QString newOwner); - void categoryChanged(QString newCategory); - void guidChanged(QString newGuid); - void versionsChanged(QList newVersions); - void imageUrlChanged(QString newImageUrl); + protected: QString m_name; QString m_description; @@ -123,10 +127,22 @@ protected: QString m_owner; QString m_category; QString m_guid; - QList m_versions; + QList> m_versions; QString m_imageUrl; }; +} // NS DTO + +namespace Support { + +using PackageInfo = Jellyfin::DTO::PackageInfo; + +template <> +PackageInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PackageInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/parentalrating.h b/core/include/JellyfinQt/DTO/parentalrating.h index 0c49e4f..dec58a4 100644 --- a/core/include/JellyfinQt/DTO/parentalrating.h +++ b/core/include/JellyfinQt/DTO/parentalrating.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_PARENTALRATING_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ParentalRating : public QObject { - Q_OBJECT -public: - explicit ParentalRating(QObject *parent = nullptr); - static ParentalRating *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ParentalRating { +public: + explicit ParentalRating(); + static ParentalRating fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the value. */ - Q_PROPERTY(qint32 value READ value WRITE setValue NOTIFY valueChanged) - - QString name() const; - void setName(QString newName); - qint32 value() const; + /** + * @brief Gets or sets the value. + */ void setValue(qint32 newValue); - -signals: - void nameChanged(QString newName); - void valueChanged(qint32 newValue); + protected: QString m_name; qint32 m_value; }; +} // NS DTO + +namespace Support { + +using ParentalRating = Jellyfin::DTO::ParentalRating; + +template <> +ParentalRating fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ParentalRating::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/pathsubstitution.h b/core/include/JellyfinQt/DTO/pathsubstitution.h index d3ddcea..71d977d 100644 --- a/core/include/JellyfinQt/DTO/pathsubstitution.h +++ b/core/include/JellyfinQt/DTO/pathsubstitution.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_PATHSUBSTITUTION_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PathSubstitution : public QObject { - Q_OBJECT -public: - explicit PathSubstitution(QObject *parent = nullptr); - static PathSubstitution *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PathSubstitution { +public: + explicit PathSubstitution(); + static PathSubstitution fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the value to substitute. */ - Q_PROPERTY(QString from READ from WRITE setFrom NOTIFY fromChanged) + QString from() const; + /** + * @brief Gets or sets the value to substitute. + */ + void setFrom(QString newFrom); /** * @brief Gets or sets the value to substitution with. */ - Q_PROPERTY(QString to READ to WRITE setTo NOTIFY toChanged) - - QString from() const; - void setFrom(QString newFrom); - QString to() const; + /** + * @brief Gets or sets the value to substitution with. + */ void setTo(QString newTo); - -signals: - void fromChanged(QString newFrom); - void toChanged(QString newTo); + protected: QString m_from; QString m_to; }; +} // NS DTO + +namespace Support { + +using PathSubstitution = Jellyfin::DTO::PathSubstitution; + +template <> +PathSubstitution fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PathSubstitution::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/personlookupinfo.h b/core/include/JellyfinQt/DTO/personlookupinfo.h index 742d83d..7e63f11 100644 --- a/core/include/JellyfinQt/DTO/personlookupinfo.h +++ b/core/include/JellyfinQt/DTO/personlookupinfo.h @@ -32,90 +32,89 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PersonLookupInfo : public QObject { - Q_OBJECT -public: - explicit PersonLookupInfo(QObject *parent = nullptr); - static PersonLookupInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PersonLookupInfo { +public: + explicit PersonLookupInfo(); + static PersonLookupInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); + protected: QString m_name; QString m_path; @@ -129,6 +128,18 @@ protected: bool m_isAutomated; }; +} // NS DTO + +namespace Support { + +using PersonLookupInfo = Jellyfin::DTO::PersonLookupInfo; + +template <> +PersonLookupInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PersonLookupInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/personlookupinforemotesearchquery.h b/core/include/JellyfinQt/DTO/personlookupinforemotesearchquery.h index 7813b5c..0a0711e 100644 --- a/core/include/JellyfinQt/DTO/personlookupinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/personlookupinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_PERSONLOOKUPINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/personlookupinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PersonLookupInfo; -class PersonLookupInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class PersonLookupInfoRemoteSearchQuery { public: - explicit PersonLookupInfoRemoteSearchQuery(QObject *parent = nullptr); - static PersonLookupInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit PersonLookupInfoRemoteSearchQuery(); + static PersonLookupInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(PersonLookupInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - PersonLookupInfo * searchInfo() const; - void setSearchInfo(PersonLookupInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(PersonLookupInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - PersonLookupInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using PersonLookupInfoRemoteSearchQuery = Jellyfin::DTO::PersonLookupInfoRemoteSearchQuery; + +template <> +PersonLookupInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PersonLookupInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/pingrequestdto.h b/core/include/JellyfinQt/DTO/pingrequestdto.h index cd91b18..c98f94e 100644 --- a/core/include/JellyfinQt/DTO/pingrequestdto.h +++ b/core/include/JellyfinQt/DTO/pingrequestdto.h @@ -31,33 +31,48 @@ #define JELLYFIN_DTO_PINGREQUESTDTO_H #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PingRequestDto : public QObject { - Q_OBJECT -public: - explicit PingRequestDto(QObject *parent = nullptr); - static PingRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PingRequestDto { +public: + explicit PingRequestDto(); + static PingRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the ping time. */ - Q_PROPERTY(qint64 ping READ ping WRITE setPing NOTIFY pingChanged) - qint64 ping() const; + /** + * @brief Gets or sets the ping time. + */ void setPing(qint64 newPing); - -signals: - void pingChanged(qint64 newPing); + protected: qint64 m_ping; }; +} // NS DTO + +namespace Support { + +using PingRequestDto = Jellyfin::DTO::PingRequestDto; + +template <> +PingRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PingRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/pinredeemresult.h b/core/include/JellyfinQt/DTO/pinredeemresult.h index 7a3bae3..bf1b26a 100644 --- a/core/include/JellyfinQt/DTO/pinredeemresult.h +++ b/core/include/JellyfinQt/DTO/pinredeemresult.h @@ -31,45 +31,60 @@ #define JELLYFIN_DTO_PINREDEEMRESULT_H #include +#include #include -#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PinRedeemResult : public QObject { - Q_OBJECT -public: - explicit PinRedeemResult(QObject *parent = nullptr); - static PinRedeemResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PinRedeemResult { +public: + explicit PinRedeemResult(); + static PinRedeemResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Users.PinRedeemResult is success. */ - Q_PROPERTY(bool success READ success WRITE setSuccess NOTIFY successChanged) + bool success() const; + /** + * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Users.PinRedeemResult is success. + */ + void setSuccess(bool newSuccess); /** * @brief Gets or sets the users reset. */ - Q_PROPERTY(QStringList usersReset READ usersReset WRITE setUsersReset NOTIFY usersResetChanged) - - bool success() const; - void setSuccess(bool newSuccess); - QStringList usersReset() const; + /** + * @brief Gets or sets the users reset. + */ void setUsersReset(QStringList newUsersReset); - -signals: - void successChanged(bool newSuccess); - void usersResetChanged(QStringList newUsersReset); + protected: bool m_success; QStringList m_usersReset; }; +} // NS DTO + +namespace Support { + +using PinRedeemResult = Jellyfin::DTO::PinRedeemResult; + +template <> +PinRedeemResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PinRedeemResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playaccess.h b/core/include/JellyfinQt/DTO/playaccess.h index 508feb7..231956c 100644 --- a/core/include/JellyfinQt/DTO/playaccess.h +++ b/core/include/JellyfinQt/DTO/playaccess.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PLAYACCESS_H #define JELLYFIN_DTO_PLAYACCESS_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class PlayAccessClass { Q_GADGET public: enum Value { + EnumNotSet, Full, None, }; @@ -46,8 +51,31 @@ public: private: explicit PlayAccessClass(); }; + typedef PlayAccessClass::Value PlayAccess; +} // NS DTO + +namespace Support { + +using PlayAccess = Jellyfin::DTO::PlayAccess; +using PlayAccessClass = Jellyfin::DTO::PlayAccessClass; + +template <> +PlayAccess fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return PlayAccessClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Full")) { + return PlayAccessClass::Full; + } + if (str == QStringLiteral("None")) { + return PlayAccessClass::None; + } + + return PlayAccessClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playbackerrorcode.h b/core/include/JellyfinQt/DTO/playbackerrorcode.h index a574692..b8cc9be 100644 --- a/core/include/JellyfinQt/DTO/playbackerrorcode.h +++ b/core/include/JellyfinQt/DTO/playbackerrorcode.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PLAYBACKERRORCODE_H #define JELLYFIN_DTO_PLAYBACKERRORCODE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class PlaybackErrorCodeClass { Q_GADGET public: enum Value { + EnumNotSet, NotAllowed, NoCompatibleStream, RateLimitExceeded, @@ -47,8 +52,34 @@ public: private: explicit PlaybackErrorCodeClass(); }; + typedef PlaybackErrorCodeClass::Value PlaybackErrorCode; +} // NS DTO + +namespace Support { + +using PlaybackErrorCode = Jellyfin::DTO::PlaybackErrorCode; +using PlaybackErrorCodeClass = Jellyfin::DTO::PlaybackErrorCodeClass; + +template <> +PlaybackErrorCode fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return PlaybackErrorCodeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("NotAllowed")) { + return PlaybackErrorCodeClass::NotAllowed; + } + if (str == QStringLiteral("NoCompatibleStream")) { + return PlaybackErrorCodeClass::NoCompatibleStream; + } + if (str == QStringLiteral("RateLimitExceeded")) { + return PlaybackErrorCodeClass::RateLimitExceeded; + } + + return PlaybackErrorCodeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playbackinfodto.h b/core/include/JellyfinQt/DTO/playbackinfodto.h index b40a518..b1e32cd 100644 --- a/core/include/JellyfinQt/DTO/playbackinfodto.h +++ b/core/include/JellyfinQt/DTO/playbackinfodto.h @@ -31,143 +31,146 @@ #define JELLYFIN_DTO_PLAYBACKINFODTO_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/deviceprofile.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class DeviceProfile; -class PlaybackInfoDto : public QObject { - Q_OBJECT +class PlaybackInfoDto { public: - explicit PlaybackInfoDto(QObject *parent = nullptr); - static PlaybackInfoDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit PlaybackInfoDto(); + static PlaybackInfoDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the playback userId. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets the playback userId. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets the max streaming bitrate. */ - Q_PROPERTY(qint32 maxStreamingBitrate READ maxStreamingBitrate WRITE setMaxStreamingBitrate NOTIFY maxStreamingBitrateChanged) + qint32 maxStreamingBitrate() const; + /** + * @brief Gets or sets the max streaming bitrate. + */ + void setMaxStreamingBitrate(qint32 newMaxStreamingBitrate); /** * @brief Gets or sets the start time in ticks. */ - Q_PROPERTY(qint64 startTimeTicks READ startTimeTicks WRITE setStartTimeTicks NOTIFY startTimeTicksChanged) + qint64 startTimeTicks() const; + /** + * @brief Gets or sets the start time in ticks. + */ + void setStartTimeTicks(qint64 newStartTimeTicks); /** * @brief Gets or sets the audio stream index. */ - Q_PROPERTY(qint32 audioStreamIndex READ audioStreamIndex WRITE setAudioStreamIndex NOTIFY audioStreamIndexChanged) + qint32 audioStreamIndex() const; + /** + * @brief Gets or sets the audio stream index. + */ + void setAudioStreamIndex(qint32 newAudioStreamIndex); /** * @brief Gets or sets the subtitle stream index. */ - Q_PROPERTY(qint32 subtitleStreamIndex READ subtitleStreamIndex WRITE setSubtitleStreamIndex NOTIFY subtitleStreamIndexChanged) + qint32 subtitleStreamIndex() const; + /** + * @brief Gets or sets the subtitle stream index. + */ + void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); /** * @brief Gets or sets the max audio channels. */ - Q_PROPERTY(qint32 maxAudioChannels READ maxAudioChannels WRITE setMaxAudioChannels NOTIFY maxAudioChannelsChanged) + qint32 maxAudioChannels() const; + /** + * @brief Gets or sets the max audio channels. + */ + void setMaxAudioChannels(qint32 newMaxAudioChannels); /** * @brief Gets or sets the media source id. */ - Q_PROPERTY(QString mediaSourceId READ mediaSourceId WRITE setMediaSourceId NOTIFY mediaSourceIdChanged) + QString mediaSourceId() const; + /** + * @brief Gets or sets the media source id. + */ + void setMediaSourceId(QString newMediaSourceId); /** * @brief Gets or sets the live stream id. */ - Q_PROPERTY(QString liveStreamId READ liveStreamId WRITE setLiveStreamId NOTIFY liveStreamIdChanged) - Q_PROPERTY(DeviceProfile * deviceProfile READ deviceProfile WRITE setDeviceProfile NOTIFY deviceProfileChanged) + QString liveStreamId() const; + /** + * @brief Gets or sets the live stream id. + */ + void setLiveStreamId(QString newLiveStreamId); + + QSharedPointer deviceProfile() const; + + void setDeviceProfile(QSharedPointer newDeviceProfile); /** * @brief Gets or sets a value indicating whether to enable direct play. */ - Q_PROPERTY(bool enableDirectPlay READ enableDirectPlay WRITE setEnableDirectPlay NOTIFY enableDirectPlayChanged) + bool enableDirectPlay() const; + /** + * @brief Gets or sets a value indicating whether to enable direct play. + */ + void setEnableDirectPlay(bool newEnableDirectPlay); /** * @brief Gets or sets a value indicating whether to enable direct stream. */ - Q_PROPERTY(bool enableDirectStream READ enableDirectStream WRITE setEnableDirectStream NOTIFY enableDirectStreamChanged) + bool enableDirectStream() const; + /** + * @brief Gets or sets a value indicating whether to enable direct stream. + */ + void setEnableDirectStream(bool newEnableDirectStream); /** * @brief Gets or sets a value indicating whether to enable transcoding. */ - Q_PROPERTY(bool enableTranscoding READ enableTranscoding WRITE setEnableTranscoding NOTIFY enableTranscodingChanged) + bool enableTranscoding() const; + /** + * @brief Gets or sets a value indicating whether to enable transcoding. + */ + void setEnableTranscoding(bool newEnableTranscoding); /** * @brief Gets or sets a value indicating whether to enable video stream copy. */ - Q_PROPERTY(bool allowVideoStreamCopy READ allowVideoStreamCopy WRITE setAllowVideoStreamCopy NOTIFY allowVideoStreamCopyChanged) + bool allowVideoStreamCopy() const; + /** + * @brief Gets or sets a value indicating whether to enable video stream copy. + */ + void setAllowVideoStreamCopy(bool newAllowVideoStreamCopy); /** * @brief Gets or sets a value indicating whether to allow audio stream copy. */ - Q_PROPERTY(bool allowAudioStreamCopy READ allowAudioStreamCopy WRITE setAllowAudioStreamCopy NOTIFY allowAudioStreamCopyChanged) + bool allowAudioStreamCopy() const; + /** + * @brief Gets or sets a value indicating whether to allow audio stream copy. + */ + void setAllowAudioStreamCopy(bool newAllowAudioStreamCopy); /** * @brief Gets or sets a value indicating whether to auto open the live stream. */ - Q_PROPERTY(bool autoOpenLiveStream READ autoOpenLiveStream WRITE setAutoOpenLiveStream NOTIFY autoOpenLiveStreamChanged) - - QString userId() const; - void setUserId(QString newUserId); - - qint32 maxStreamingBitrate() const; - void setMaxStreamingBitrate(qint32 newMaxStreamingBitrate); - - qint64 startTimeTicks() const; - void setStartTimeTicks(qint64 newStartTimeTicks); - - qint32 audioStreamIndex() const; - void setAudioStreamIndex(qint32 newAudioStreamIndex); - - qint32 subtitleStreamIndex() const; - void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); - - qint32 maxAudioChannels() const; - void setMaxAudioChannels(qint32 newMaxAudioChannels); - - QString mediaSourceId() const; - void setMediaSourceId(QString newMediaSourceId); - - QString liveStreamId() const; - void setLiveStreamId(QString newLiveStreamId); - - DeviceProfile * deviceProfile() const; - void setDeviceProfile(DeviceProfile * newDeviceProfile); - - bool enableDirectPlay() const; - void setEnableDirectPlay(bool newEnableDirectPlay); - - bool enableDirectStream() const; - void setEnableDirectStream(bool newEnableDirectStream); - - bool enableTranscoding() const; - void setEnableTranscoding(bool newEnableTranscoding); - - bool allowVideoStreamCopy() const; - void setAllowVideoStreamCopy(bool newAllowVideoStreamCopy); - - bool allowAudioStreamCopy() const; - void setAllowAudioStreamCopy(bool newAllowAudioStreamCopy); - bool autoOpenLiveStream() const; + /** + * @brief Gets or sets a value indicating whether to auto open the live stream. + */ void setAutoOpenLiveStream(bool newAutoOpenLiveStream); - -signals: - void userIdChanged(QString newUserId); - void maxStreamingBitrateChanged(qint32 newMaxStreamingBitrate); - void startTimeTicksChanged(qint64 newStartTimeTicks); - void audioStreamIndexChanged(qint32 newAudioStreamIndex); - void subtitleStreamIndexChanged(qint32 newSubtitleStreamIndex); - void maxAudioChannelsChanged(qint32 newMaxAudioChannels); - void mediaSourceIdChanged(QString newMediaSourceId); - void liveStreamIdChanged(QString newLiveStreamId); - void deviceProfileChanged(DeviceProfile * newDeviceProfile); - void enableDirectPlayChanged(bool newEnableDirectPlay); - void enableDirectStreamChanged(bool newEnableDirectStream); - void enableTranscodingChanged(bool newEnableTranscoding); - void allowVideoStreamCopyChanged(bool newAllowVideoStreamCopy); - void allowAudioStreamCopyChanged(bool newAllowAudioStreamCopy); - void autoOpenLiveStreamChanged(bool newAutoOpenLiveStream); + protected: - QString m_userId; + QUuid m_userId; qint32 m_maxStreamingBitrate; qint64 m_startTimeTicks; qint32 m_audioStreamIndex; @@ -175,7 +178,7 @@ protected: qint32 m_maxAudioChannels; QString m_mediaSourceId; QString m_liveStreamId; - DeviceProfile * m_deviceProfile = nullptr; + QSharedPointer m_deviceProfile = nullptr; bool m_enableDirectPlay; bool m_enableDirectStream; bool m_enableTranscoding; @@ -184,6 +187,18 @@ protected: bool m_autoOpenLiveStream; }; +} // NS DTO + +namespace Support { + +using PlaybackInfoDto = Jellyfin::DTO::PlaybackInfoDto; + +template <> +PlaybackInfoDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlaybackInfoDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playbackinforesponse.h b/core/include/JellyfinQt/DTO/playbackinforesponse.h index 9e9ce04..6e61c4b 100644 --- a/core/include/JellyfinQt/DTO/playbackinforesponse.h +++ b/core/include/JellyfinQt/DTO/playbackinforesponse.h @@ -31,55 +31,68 @@ #define JELLYFIN_DTO_PLAYBACKINFORESPONSE_H #include +#include #include -#include +#include #include #include +#include +#include "JellyfinQt/DTO/mediasourceinfo.h" #include "JellyfinQt/DTO/playbackerrorcode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MediaSourceInfo; -class PlaybackInfoResponse : public QObject { - Q_OBJECT +class PlaybackInfoResponse { public: - explicit PlaybackInfoResponse(QObject *parent = nullptr); - static PlaybackInfoResponse *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit PlaybackInfoResponse(); + static PlaybackInfoResponse fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the media sources. */ - Q_PROPERTY(QList mediaSources READ mediaSources WRITE setMediaSources NOTIFY mediaSourcesChanged) + QList> mediaSources() const; + /** + * @brief Gets or sets the media sources. + */ + void setMediaSources(QList> newMediaSources); /** * @brief Gets or sets the play session identifier. */ - Q_PROPERTY(QString playSessionId READ playSessionId WRITE setPlaySessionId NOTIFY playSessionIdChanged) - Q_PROPERTY(PlaybackErrorCode errorCode READ errorCode WRITE setErrorCode NOTIFY errorCodeChanged) - - QList mediaSources() const; - void setMediaSources(QList newMediaSources); - QString playSessionId() const; + /** + * @brief Gets or sets the play session identifier. + */ void setPlaySessionId(QString newPlaySessionId); - + PlaybackErrorCode errorCode() const; + void setErrorCode(PlaybackErrorCode newErrorCode); - -signals: - void mediaSourcesChanged(QList newMediaSources); - void playSessionIdChanged(QString newPlaySessionId); - void errorCodeChanged(PlaybackErrorCode newErrorCode); + protected: - QList m_mediaSources; + QList> m_mediaSources; QString m_playSessionId; PlaybackErrorCode m_errorCode; }; +} // NS DTO + +namespace Support { + +using PlaybackInfoResponse = Jellyfin::DTO::PlaybackInfoResponse; + +template <> +PlaybackInfoResponse fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlaybackInfoResponse::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playbackprogressinfo.h b/core/include/JellyfinQt/DTO/playbackprogressinfo.h index 05d9462..a7beefa 100644 --- a/core/include/JellyfinQt/DTO/playbackprogressinfo.h +++ b/core/include/JellyfinQt/DTO/playbackprogressinfo.h @@ -31,170 +31,165 @@ #define JELLYFIN_DTO_PLAYBACKPROGRESSINFO_H #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/baseitemdto.h" #include "JellyfinQt/DTO/playmethod.h" +#include "JellyfinQt/DTO/queueitem.h" #include "JellyfinQt/DTO/repeatmode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemDto; -class QueueItem; -class PlaybackProgressInfo : public QObject { - Q_OBJECT +class PlaybackProgressInfo { public: - explicit PlaybackProgressInfo(QObject *parent = nullptr); - static PlaybackProgressInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit PlaybackProgressInfo(); + static PlaybackProgressInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets a value indicating whether this instance can seek. */ - Q_PROPERTY(bool canSeek READ canSeek WRITE setCanSeek NOTIFY canSeekChanged) - Q_PROPERTY(BaseItemDto * item READ item WRITE setItem NOTIFY itemChanged) + bool canSeek() const; + /** + * @brief Gets or sets a value indicating whether this instance can seek. + */ + void setCanSeek(bool newCanSeek); + + QSharedPointer item() const; + + void setItem(QSharedPointer newItem); /** * @brief Gets or sets the item identifier. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QUuid itemId() const; + /** + * @brief Gets or sets the item identifier. + */ + void setItemId(QUuid newItemId); /** * @brief Gets or sets the session id. */ - Q_PROPERTY(QString sessionId READ sessionId WRITE setSessionId NOTIFY sessionIdChanged) + QString sessionId() const; + /** + * @brief Gets or sets the session id. + */ + void setSessionId(QString newSessionId); /** * @brief Gets or sets the media version identifier. */ - Q_PROPERTY(QString mediaSourceId READ mediaSourceId WRITE setMediaSourceId NOTIFY mediaSourceIdChanged) + QString mediaSourceId() const; + /** + * @brief Gets or sets the media version identifier. + */ + void setMediaSourceId(QString newMediaSourceId); /** * @brief Gets or sets the index of the audio stream. */ - Q_PROPERTY(qint32 audioStreamIndex READ audioStreamIndex WRITE setAudioStreamIndex NOTIFY audioStreamIndexChanged) + qint32 audioStreamIndex() const; + /** + * @brief Gets or sets the index of the audio stream. + */ + void setAudioStreamIndex(qint32 newAudioStreamIndex); /** * @brief Gets or sets the index of the subtitle stream. */ - Q_PROPERTY(qint32 subtitleStreamIndex READ subtitleStreamIndex WRITE setSubtitleStreamIndex NOTIFY subtitleStreamIndexChanged) + qint32 subtitleStreamIndex() const; + /** + * @brief Gets or sets the index of the subtitle stream. + */ + void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); /** * @brief Gets or sets a value indicating whether this instance is paused. */ - Q_PROPERTY(bool isPaused READ isPaused WRITE setIsPaused NOTIFY isPausedChanged) + bool isPaused() const; + /** + * @brief Gets or sets a value indicating whether this instance is paused. + */ + void setIsPaused(bool newIsPaused); /** * @brief Gets or sets a value indicating whether this instance is muted. */ - Q_PROPERTY(bool isMuted READ isMuted WRITE setIsMuted NOTIFY isMutedChanged) + bool isMuted() const; + /** + * @brief Gets or sets a value indicating whether this instance is muted. + */ + void setIsMuted(bool newIsMuted); /** * @brief Gets or sets the position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) - Q_PROPERTY(qint64 playbackStartTimeTicks READ playbackStartTimeTicks WRITE setPlaybackStartTimeTicks NOTIFY playbackStartTimeTicksChanged) + qint64 positionTicks() const; + /** + * @brief Gets or sets the position ticks. + */ + void setPositionTicks(qint64 newPositionTicks); + + qint64 playbackStartTimeTicks() const; + + void setPlaybackStartTimeTicks(qint64 newPlaybackStartTimeTicks); /** * @brief Gets or sets the volume level. */ - Q_PROPERTY(qint32 volumeLevel READ volumeLevel WRITE setVolumeLevel NOTIFY volumeLevelChanged) - Q_PROPERTY(qint32 brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) - Q_PROPERTY(QString aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged) - Q_PROPERTY(PlayMethod playMethod READ playMethod WRITE setPlayMethod NOTIFY playMethodChanged) + qint32 volumeLevel() const; + /** + * @brief Gets or sets the volume level. + */ + void setVolumeLevel(qint32 newVolumeLevel); + + qint32 brightness() const; + + void setBrightness(qint32 newBrightness); + + QString aspectRatio() const; + + void setAspectRatio(QString newAspectRatio); + + PlayMethod playMethod() const; + + void setPlayMethod(PlayMethod newPlayMethod); /** * @brief Gets or sets the live stream identifier. */ - Q_PROPERTY(QString liveStreamId READ liveStreamId WRITE setLiveStreamId NOTIFY liveStreamIdChanged) + QString liveStreamId() const; + /** + * @brief Gets or sets the live stream identifier. + */ + void setLiveStreamId(QString newLiveStreamId); /** * @brief Gets or sets the play session identifier. */ - Q_PROPERTY(QString playSessionId READ playSessionId WRITE setPlaySessionId NOTIFY playSessionIdChanged) - Q_PROPERTY(RepeatMode repeatMode READ repeatMode WRITE setRepeatMode NOTIFY repeatModeChanged) - Q_PROPERTY(QList nowPlayingQueue READ nowPlayingQueue WRITE setNowPlayingQueue NOTIFY nowPlayingQueueChanged) - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) - - bool canSeek() const; - void setCanSeek(bool newCanSeek); - - BaseItemDto * item() const; - void setItem(BaseItemDto * newItem); - - QString itemId() const; - void setItemId(QString newItemId); - - QString sessionId() const; - void setSessionId(QString newSessionId); - - QString mediaSourceId() const; - void setMediaSourceId(QString newMediaSourceId); - - qint32 audioStreamIndex() const; - void setAudioStreamIndex(qint32 newAudioStreamIndex); - - qint32 subtitleStreamIndex() const; - void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); - - bool isPaused() const; - void setIsPaused(bool newIsPaused); - - bool isMuted() const; - void setIsMuted(bool newIsMuted); - - qint64 positionTicks() const; - void setPositionTicks(qint64 newPositionTicks); - - qint64 playbackStartTimeTicks() const; - void setPlaybackStartTimeTicks(qint64 newPlaybackStartTimeTicks); - - qint32 volumeLevel() const; - void setVolumeLevel(qint32 newVolumeLevel); - - qint32 brightness() const; - void setBrightness(qint32 newBrightness); - - QString aspectRatio() const; - void setAspectRatio(QString newAspectRatio); - - PlayMethod playMethod() const; - void setPlayMethod(PlayMethod newPlayMethod); - - QString liveStreamId() const; - void setLiveStreamId(QString newLiveStreamId); - QString playSessionId() const; + /** + * @brief Gets or sets the play session identifier. + */ void setPlaySessionId(QString newPlaySessionId); - + RepeatMode repeatMode() const; + void setRepeatMode(RepeatMode newRepeatMode); - - QList nowPlayingQueue() const; - void setNowPlayingQueue(QList newNowPlayingQueue); - + + QList> nowPlayingQueue() const; + + void setNowPlayingQueue(QList> newNowPlayingQueue); + QString playlistItemId() const; + void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void canSeekChanged(bool newCanSeek); - void itemChanged(BaseItemDto * newItem); - void itemIdChanged(QString newItemId); - void sessionIdChanged(QString newSessionId); - void mediaSourceIdChanged(QString newMediaSourceId); - void audioStreamIndexChanged(qint32 newAudioStreamIndex); - void subtitleStreamIndexChanged(qint32 newSubtitleStreamIndex); - void isPausedChanged(bool newIsPaused); - void isMutedChanged(bool newIsMuted); - void positionTicksChanged(qint64 newPositionTicks); - void playbackStartTimeTicksChanged(qint64 newPlaybackStartTimeTicks); - void volumeLevelChanged(qint32 newVolumeLevel); - void brightnessChanged(qint32 newBrightness); - void aspectRatioChanged(QString newAspectRatio); - void playMethodChanged(PlayMethod newPlayMethod); - void liveStreamIdChanged(QString newLiveStreamId); - void playSessionIdChanged(QString newPlaySessionId); - void repeatModeChanged(RepeatMode newRepeatMode); - void nowPlayingQueueChanged(QList newNowPlayingQueue); - void playlistItemIdChanged(QString newPlaylistItemId); + protected: bool m_canSeek; - BaseItemDto * m_item = nullptr; - QString m_itemId; + QSharedPointer m_item = nullptr; + QUuid m_itemId; QString m_sessionId; QString m_mediaSourceId; qint32 m_audioStreamIndex; @@ -210,10 +205,22 @@ protected: QString m_liveStreamId; QString m_playSessionId; RepeatMode m_repeatMode; - QList m_nowPlayingQueue; + QList> m_nowPlayingQueue; QString m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using PlaybackProgressInfo = Jellyfin::DTO::PlaybackProgressInfo; + +template <> +PlaybackProgressInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlaybackProgressInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playbackstartinfo.h b/core/include/JellyfinQt/DTO/playbackstartinfo.h index 6b59733..bf3a325 100644 --- a/core/include/JellyfinQt/DTO/playbackstartinfo.h +++ b/core/include/JellyfinQt/DTO/playbackstartinfo.h @@ -31,170 +31,165 @@ #define JELLYFIN_DTO_PLAYBACKSTARTINFO_H #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/baseitemdto.h" #include "JellyfinQt/DTO/playmethod.h" +#include "JellyfinQt/DTO/queueitem.h" #include "JellyfinQt/DTO/repeatmode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemDto; -class QueueItem; -class PlaybackStartInfo : public QObject { - Q_OBJECT +class PlaybackStartInfo { public: - explicit PlaybackStartInfo(QObject *parent = nullptr); - static PlaybackStartInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit PlaybackStartInfo(); + static PlaybackStartInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets a value indicating whether this instance can seek. */ - Q_PROPERTY(bool canSeek READ canSeek WRITE setCanSeek NOTIFY canSeekChanged) - Q_PROPERTY(BaseItemDto * item READ item WRITE setItem NOTIFY itemChanged) + bool canSeek() const; + /** + * @brief Gets or sets a value indicating whether this instance can seek. + */ + void setCanSeek(bool newCanSeek); + + QSharedPointer item() const; + + void setItem(QSharedPointer newItem); /** * @brief Gets or sets the item identifier. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QUuid itemId() const; + /** + * @brief Gets or sets the item identifier. + */ + void setItemId(QUuid newItemId); /** * @brief Gets or sets the session id. */ - Q_PROPERTY(QString sessionId READ sessionId WRITE setSessionId NOTIFY sessionIdChanged) + QString sessionId() const; + /** + * @brief Gets or sets the session id. + */ + void setSessionId(QString newSessionId); /** * @brief Gets or sets the media version identifier. */ - Q_PROPERTY(QString mediaSourceId READ mediaSourceId WRITE setMediaSourceId NOTIFY mediaSourceIdChanged) + QString mediaSourceId() const; + /** + * @brief Gets or sets the media version identifier. + */ + void setMediaSourceId(QString newMediaSourceId); /** * @brief Gets or sets the index of the audio stream. */ - Q_PROPERTY(qint32 audioStreamIndex READ audioStreamIndex WRITE setAudioStreamIndex NOTIFY audioStreamIndexChanged) + qint32 audioStreamIndex() const; + /** + * @brief Gets or sets the index of the audio stream. + */ + void setAudioStreamIndex(qint32 newAudioStreamIndex); /** * @brief Gets or sets the index of the subtitle stream. */ - Q_PROPERTY(qint32 subtitleStreamIndex READ subtitleStreamIndex WRITE setSubtitleStreamIndex NOTIFY subtitleStreamIndexChanged) + qint32 subtitleStreamIndex() const; + /** + * @brief Gets or sets the index of the subtitle stream. + */ + void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); /** * @brief Gets or sets a value indicating whether this instance is paused. */ - Q_PROPERTY(bool isPaused READ isPaused WRITE setIsPaused NOTIFY isPausedChanged) + bool isPaused() const; + /** + * @brief Gets or sets a value indicating whether this instance is paused. + */ + void setIsPaused(bool newIsPaused); /** * @brief Gets or sets a value indicating whether this instance is muted. */ - Q_PROPERTY(bool isMuted READ isMuted WRITE setIsMuted NOTIFY isMutedChanged) + bool isMuted() const; + /** + * @brief Gets or sets a value indicating whether this instance is muted. + */ + void setIsMuted(bool newIsMuted); /** * @brief Gets or sets the position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) - Q_PROPERTY(qint64 playbackStartTimeTicks READ playbackStartTimeTicks WRITE setPlaybackStartTimeTicks NOTIFY playbackStartTimeTicksChanged) + qint64 positionTicks() const; + /** + * @brief Gets or sets the position ticks. + */ + void setPositionTicks(qint64 newPositionTicks); + + qint64 playbackStartTimeTicks() const; + + void setPlaybackStartTimeTicks(qint64 newPlaybackStartTimeTicks); /** * @brief Gets or sets the volume level. */ - Q_PROPERTY(qint32 volumeLevel READ volumeLevel WRITE setVolumeLevel NOTIFY volumeLevelChanged) - Q_PROPERTY(qint32 brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) - Q_PROPERTY(QString aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged) - Q_PROPERTY(PlayMethod playMethod READ playMethod WRITE setPlayMethod NOTIFY playMethodChanged) + qint32 volumeLevel() const; + /** + * @brief Gets or sets the volume level. + */ + void setVolumeLevel(qint32 newVolumeLevel); + + qint32 brightness() const; + + void setBrightness(qint32 newBrightness); + + QString aspectRatio() const; + + void setAspectRatio(QString newAspectRatio); + + PlayMethod playMethod() const; + + void setPlayMethod(PlayMethod newPlayMethod); /** * @brief Gets or sets the live stream identifier. */ - Q_PROPERTY(QString liveStreamId READ liveStreamId WRITE setLiveStreamId NOTIFY liveStreamIdChanged) + QString liveStreamId() const; + /** + * @brief Gets or sets the live stream identifier. + */ + void setLiveStreamId(QString newLiveStreamId); /** * @brief Gets or sets the play session identifier. */ - Q_PROPERTY(QString playSessionId READ playSessionId WRITE setPlaySessionId NOTIFY playSessionIdChanged) - Q_PROPERTY(RepeatMode repeatMode READ repeatMode WRITE setRepeatMode NOTIFY repeatModeChanged) - Q_PROPERTY(QList nowPlayingQueue READ nowPlayingQueue WRITE setNowPlayingQueue NOTIFY nowPlayingQueueChanged) - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) - - bool canSeek() const; - void setCanSeek(bool newCanSeek); - - BaseItemDto * item() const; - void setItem(BaseItemDto * newItem); - - QString itemId() const; - void setItemId(QString newItemId); - - QString sessionId() const; - void setSessionId(QString newSessionId); - - QString mediaSourceId() const; - void setMediaSourceId(QString newMediaSourceId); - - qint32 audioStreamIndex() const; - void setAudioStreamIndex(qint32 newAudioStreamIndex); - - qint32 subtitleStreamIndex() const; - void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); - - bool isPaused() const; - void setIsPaused(bool newIsPaused); - - bool isMuted() const; - void setIsMuted(bool newIsMuted); - - qint64 positionTicks() const; - void setPositionTicks(qint64 newPositionTicks); - - qint64 playbackStartTimeTicks() const; - void setPlaybackStartTimeTicks(qint64 newPlaybackStartTimeTicks); - - qint32 volumeLevel() const; - void setVolumeLevel(qint32 newVolumeLevel); - - qint32 brightness() const; - void setBrightness(qint32 newBrightness); - - QString aspectRatio() const; - void setAspectRatio(QString newAspectRatio); - - PlayMethod playMethod() const; - void setPlayMethod(PlayMethod newPlayMethod); - - QString liveStreamId() const; - void setLiveStreamId(QString newLiveStreamId); - QString playSessionId() const; + /** + * @brief Gets or sets the play session identifier. + */ void setPlaySessionId(QString newPlaySessionId); - + RepeatMode repeatMode() const; + void setRepeatMode(RepeatMode newRepeatMode); - - QList nowPlayingQueue() const; - void setNowPlayingQueue(QList newNowPlayingQueue); - + + QList> nowPlayingQueue() const; + + void setNowPlayingQueue(QList> newNowPlayingQueue); + QString playlistItemId() const; + void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void canSeekChanged(bool newCanSeek); - void itemChanged(BaseItemDto * newItem); - void itemIdChanged(QString newItemId); - void sessionIdChanged(QString newSessionId); - void mediaSourceIdChanged(QString newMediaSourceId); - void audioStreamIndexChanged(qint32 newAudioStreamIndex); - void subtitleStreamIndexChanged(qint32 newSubtitleStreamIndex); - void isPausedChanged(bool newIsPaused); - void isMutedChanged(bool newIsMuted); - void positionTicksChanged(qint64 newPositionTicks); - void playbackStartTimeTicksChanged(qint64 newPlaybackStartTimeTicks); - void volumeLevelChanged(qint32 newVolumeLevel); - void brightnessChanged(qint32 newBrightness); - void aspectRatioChanged(QString newAspectRatio); - void playMethodChanged(PlayMethod newPlayMethod); - void liveStreamIdChanged(QString newLiveStreamId); - void playSessionIdChanged(QString newPlaySessionId); - void repeatModeChanged(RepeatMode newRepeatMode); - void nowPlayingQueueChanged(QList newNowPlayingQueue); - void playlistItemIdChanged(QString newPlaylistItemId); + protected: bool m_canSeek; - BaseItemDto * m_item = nullptr; - QString m_itemId; + QSharedPointer m_item = nullptr; + QUuid m_itemId; QString m_sessionId; QString m_mediaSourceId; qint32 m_audioStreamIndex; @@ -210,10 +205,22 @@ protected: QString m_liveStreamId; QString m_playSessionId; RepeatMode m_repeatMode; - QList m_nowPlayingQueue; + QList> m_nowPlayingQueue; QString m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using PlaybackStartInfo = Jellyfin::DTO::PlaybackStartInfo; + +template <> +PlaybackStartInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlaybackStartInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playbackstopinfo.h b/core/include/JellyfinQt/DTO/playbackstopinfo.h index c910195..b99bc21 100644 --- a/core/include/JellyfinQt/DTO/playbackstopinfo.h +++ b/core/include/JellyfinQt/DTO/playbackstopinfo.h @@ -31,106 +31,106 @@ #define JELLYFIN_DTO_PLAYBACKSTOPINFO_H #include +#include #include -#include +#include #include #include +#include +#include + +#include "JellyfinQt/DTO/baseitemdto.h" +#include "JellyfinQt/DTO/queueitem.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemDto; -class QueueItem; -class PlaybackStopInfo : public QObject { - Q_OBJECT +class PlaybackStopInfo { public: - explicit PlaybackStopInfo(QObject *parent = nullptr); - static PlaybackStopInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit PlaybackStopInfo(); + static PlaybackStopInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(BaseItemDto * item READ item WRITE setItem NOTIFY itemChanged) + QSharedPointer item() const; + + void setItem(QSharedPointer newItem); /** * @brief Gets or sets the item identifier. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QUuid itemId() const; + /** + * @brief Gets or sets the item identifier. + */ + void setItemId(QUuid newItemId); /** * @brief Gets or sets the session id. */ - Q_PROPERTY(QString sessionId READ sessionId WRITE setSessionId NOTIFY sessionIdChanged) + QString sessionId() const; + /** + * @brief Gets or sets the session id. + */ + void setSessionId(QString newSessionId); /** * @brief Gets or sets the media version identifier. */ - Q_PROPERTY(QString mediaSourceId READ mediaSourceId WRITE setMediaSourceId NOTIFY mediaSourceIdChanged) + QString mediaSourceId() const; + /** + * @brief Gets or sets the media version identifier. + */ + void setMediaSourceId(QString newMediaSourceId); /** * @brief Gets or sets the position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) + qint64 positionTicks() const; + /** + * @brief Gets or sets the position ticks. + */ + void setPositionTicks(qint64 newPositionTicks); /** * @brief Gets or sets the live stream identifier. */ - Q_PROPERTY(QString liveStreamId READ liveStreamId WRITE setLiveStreamId NOTIFY liveStreamIdChanged) + QString liveStreamId() const; + /** + * @brief Gets or sets the live stream identifier. + */ + void setLiveStreamId(QString newLiveStreamId); /** * @brief Gets or sets the play session identifier. */ - Q_PROPERTY(QString playSessionId READ playSessionId WRITE setPlaySessionId NOTIFY playSessionIdChanged) + QString playSessionId() const; + /** + * @brief Gets or sets the play session identifier. + */ + void setPlaySessionId(QString newPlaySessionId); /** * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Session.PlaybackStopInfo is failed. */ - Q_PROPERTY(bool failed READ failed WRITE setFailed NOTIFY failedChanged) - Q_PROPERTY(QString nextMediaType READ nextMediaType WRITE setNextMediaType NOTIFY nextMediaTypeChanged) - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) - Q_PROPERTY(QList nowPlayingQueue READ nowPlayingQueue WRITE setNowPlayingQueue NOTIFY nowPlayingQueueChanged) - - BaseItemDto * item() const; - void setItem(BaseItemDto * newItem); - - QString itemId() const; - void setItemId(QString newItemId); - - QString sessionId() const; - void setSessionId(QString newSessionId); - - QString mediaSourceId() const; - void setMediaSourceId(QString newMediaSourceId); - - qint64 positionTicks() const; - void setPositionTicks(qint64 newPositionTicks); - - QString liveStreamId() const; - void setLiveStreamId(QString newLiveStreamId); - - QString playSessionId() const; - void setPlaySessionId(QString newPlaySessionId); - bool failed() const; + /** + * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Session.PlaybackStopInfo is failed. + */ void setFailed(bool newFailed); - + QString nextMediaType() const; + void setNextMediaType(QString newNextMediaType); - + QString playlistItemId() const; + void setPlaylistItemId(QString newPlaylistItemId); - - QList nowPlayingQueue() const; - void setNowPlayingQueue(QList newNowPlayingQueue); - -signals: - void itemChanged(BaseItemDto * newItem); - void itemIdChanged(QString newItemId); - void sessionIdChanged(QString newSessionId); - void mediaSourceIdChanged(QString newMediaSourceId); - void positionTicksChanged(qint64 newPositionTicks); - void liveStreamIdChanged(QString newLiveStreamId); - void playSessionIdChanged(QString newPlaySessionId); - void failedChanged(bool newFailed); - void nextMediaTypeChanged(QString newNextMediaType); - void playlistItemIdChanged(QString newPlaylistItemId); - void nowPlayingQueueChanged(QList newNowPlayingQueue); + + QList> nowPlayingQueue() const; + + void setNowPlayingQueue(QList> newNowPlayingQueue); + protected: - BaseItemDto * m_item = nullptr; - QString m_itemId; + QSharedPointer m_item = nullptr; + QUuid m_itemId; QString m_sessionId; QString m_mediaSourceId; qint64 m_positionTicks; @@ -139,9 +139,21 @@ protected: bool m_failed; QString m_nextMediaType; QString m_playlistItemId; - QList m_nowPlayingQueue; + QList> m_nowPlayingQueue; }; +} // NS DTO + +namespace Support { + +using PlaybackStopInfo = Jellyfin::DTO::PlaybackStopInfo; + +template <> +PlaybackStopInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlaybackStopInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playcommand.h b/core/include/JellyfinQt/DTO/playcommand.h index d3cad9f..fcc0f90 100644 --- a/core/include/JellyfinQt/DTO/playcommand.h +++ b/core/include/JellyfinQt/DTO/playcommand.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PLAYCOMMAND_H #define JELLYFIN_DTO_PLAYCOMMAND_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class PlayCommandClass { Q_GADGET public: enum Value { + EnumNotSet, PlayNow, PlayNext, PlayLast, @@ -49,8 +54,40 @@ public: private: explicit PlayCommandClass(); }; + typedef PlayCommandClass::Value PlayCommand; +} // NS DTO + +namespace Support { + +using PlayCommand = Jellyfin::DTO::PlayCommand; +using PlayCommandClass = Jellyfin::DTO::PlayCommandClass; + +template <> +PlayCommand fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return PlayCommandClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("PlayNow")) { + return PlayCommandClass::PlayNow; + } + if (str == QStringLiteral("PlayNext")) { + return PlayCommandClass::PlayNext; + } + if (str == QStringLiteral("PlayLast")) { + return PlayCommandClass::PlayLast; + } + if (str == QStringLiteral("PlayInstantMix")) { + return PlayCommandClass::PlayInstantMix; + } + if (str == QStringLiteral("PlayShuffle")) { + return PlayCommandClass::PlayShuffle; + } + + return PlayCommandClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playerstateinfo.h b/core/include/JellyfinQt/DTO/playerstateinfo.h index ecc238f..ff7b9b0 100644 --- a/core/include/JellyfinQt/DTO/playerstateinfo.h +++ b/core/include/JellyfinQt/DTO/playerstateinfo.h @@ -31,99 +31,99 @@ #define JELLYFIN_DTO_PLAYERSTATEINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/playmethod.h" #include "JellyfinQt/DTO/repeatmode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PlayerStateInfo : public QObject { - Q_OBJECT -public: - explicit PlayerStateInfo(QObject *parent = nullptr); - static PlayerStateInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PlayerStateInfo { +public: + explicit PlayerStateInfo(); + static PlayerStateInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the now playing position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) + qint64 positionTicks() const; + /** + * @brief Gets or sets the now playing position ticks. + */ + void setPositionTicks(qint64 newPositionTicks); /** * @brief Gets or sets a value indicating whether this instance can seek. */ - Q_PROPERTY(bool canSeek READ canSeek WRITE setCanSeek NOTIFY canSeekChanged) + bool canSeek() const; + /** + * @brief Gets or sets a value indicating whether this instance can seek. + */ + void setCanSeek(bool newCanSeek); /** * @brief Gets or sets a value indicating whether this instance is paused. */ - Q_PROPERTY(bool isPaused READ isPaused WRITE setIsPaused NOTIFY isPausedChanged) + bool isPaused() const; + /** + * @brief Gets or sets a value indicating whether this instance is paused. + */ + void setIsPaused(bool newIsPaused); /** * @brief Gets or sets a value indicating whether this instance is muted. */ - Q_PROPERTY(bool isMuted READ isMuted WRITE setIsMuted NOTIFY isMutedChanged) + bool isMuted() const; + /** + * @brief Gets or sets a value indicating whether this instance is muted. + */ + void setIsMuted(bool newIsMuted); /** * @brief Gets or sets the volume level. */ - Q_PROPERTY(qint32 volumeLevel READ volumeLevel WRITE setVolumeLevel NOTIFY volumeLevelChanged) + qint32 volumeLevel() const; + /** + * @brief Gets or sets the volume level. + */ + void setVolumeLevel(qint32 newVolumeLevel); /** * @brief Gets or sets the index of the now playing audio stream. */ - Q_PROPERTY(qint32 audioStreamIndex READ audioStreamIndex WRITE setAudioStreamIndex NOTIFY audioStreamIndexChanged) + qint32 audioStreamIndex() const; + /** + * @brief Gets or sets the index of the now playing audio stream. + */ + void setAudioStreamIndex(qint32 newAudioStreamIndex); /** * @brief Gets or sets the index of the now playing subtitle stream. */ - Q_PROPERTY(qint32 subtitleStreamIndex READ subtitleStreamIndex WRITE setSubtitleStreamIndex NOTIFY subtitleStreamIndexChanged) + qint32 subtitleStreamIndex() const; + /** + * @brief Gets or sets the index of the now playing subtitle stream. + */ + void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); /** * @brief Gets or sets the now playing media version identifier. */ - Q_PROPERTY(QString mediaSourceId READ mediaSourceId WRITE setMediaSourceId NOTIFY mediaSourceIdChanged) - Q_PROPERTY(PlayMethod playMethod READ playMethod WRITE setPlayMethod NOTIFY playMethodChanged) - Q_PROPERTY(RepeatMode repeatMode READ repeatMode WRITE setRepeatMode NOTIFY repeatModeChanged) - - qint64 positionTicks() const; - void setPositionTicks(qint64 newPositionTicks); - - bool canSeek() const; - void setCanSeek(bool newCanSeek); - - bool isPaused() const; - void setIsPaused(bool newIsPaused); - - bool isMuted() const; - void setIsMuted(bool newIsMuted); - - qint32 volumeLevel() const; - void setVolumeLevel(qint32 newVolumeLevel); - - qint32 audioStreamIndex() const; - void setAudioStreamIndex(qint32 newAudioStreamIndex); - - qint32 subtitleStreamIndex() const; - void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); - QString mediaSourceId() const; + /** + * @brief Gets or sets the now playing media version identifier. + */ void setMediaSourceId(QString newMediaSourceId); - + PlayMethod playMethod() const; + void setPlayMethod(PlayMethod newPlayMethod); - + RepeatMode repeatMode() const; + void setRepeatMode(RepeatMode newRepeatMode); - -signals: - void positionTicksChanged(qint64 newPositionTicks); - void canSeekChanged(bool newCanSeek); - void isPausedChanged(bool newIsPaused); - void isMutedChanged(bool newIsMuted); - void volumeLevelChanged(qint32 newVolumeLevel); - void audioStreamIndexChanged(qint32 newAudioStreamIndex); - void subtitleStreamIndexChanged(qint32 newSubtitleStreamIndex); - void mediaSourceIdChanged(QString newMediaSourceId); - void playMethodChanged(PlayMethod newPlayMethod); - void repeatModeChanged(RepeatMode newRepeatMode); + protected: qint64 m_positionTicks; bool m_canSeek; @@ -137,6 +137,18 @@ protected: RepeatMode m_repeatMode; }; +} // NS DTO + +namespace Support { + +using PlayerStateInfo = Jellyfin::DTO::PlayerStateInfo; + +template <> +PlayerStateInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlayerStateInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playlistcreationresult.h b/core/include/JellyfinQt/DTO/playlistcreationresult.h index 18d09e1..2c10d08 100644 --- a/core/include/JellyfinQt/DTO/playlistcreationresult.h +++ b/core/include/JellyfinQt/DTO/playlistcreationresult.h @@ -31,31 +31,45 @@ #define JELLYFIN_DTO_PLAYLISTCREATIONRESULT_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PlaylistCreationResult : public QObject { - Q_OBJECT -public: - explicit PlaylistCreationResult(QObject *parent = nullptr); - static PlaylistCreationResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) +class PlaylistCreationResult { +public: + explicit PlaylistCreationResult(); + static PlaylistCreationResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString jellyfinId() const; + void setJellyfinId(QString newJellyfinId); - -signals: - void jellyfinIdChanged(QString newJellyfinId); + protected: QString m_jellyfinId; }; +} // NS DTO + +namespace Support { + +using PlaylistCreationResult = Jellyfin::DTO::PlaylistCreationResult; + +template <> +PlaylistCreationResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlaylistCreationResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playmethod.h b/core/include/JellyfinQt/DTO/playmethod.h index 4fefa01..f709d5e 100644 --- a/core/include/JellyfinQt/DTO/playmethod.h +++ b/core/include/JellyfinQt/DTO/playmethod.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PLAYMETHOD_H #define JELLYFIN_DTO_PLAYMETHOD_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class PlayMethodClass { Q_GADGET public: enum Value { + EnumNotSet, Transcode, DirectStream, DirectPlay, @@ -47,8 +52,34 @@ public: private: explicit PlayMethodClass(); }; + typedef PlayMethodClass::Value PlayMethod; +} // NS DTO + +namespace Support { + +using PlayMethod = Jellyfin::DTO::PlayMethod; +using PlayMethodClass = Jellyfin::DTO::PlayMethodClass; + +template <> +PlayMethod fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return PlayMethodClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Transcode")) { + return PlayMethodClass::Transcode; + } + if (str == QStringLiteral("DirectStream")) { + return PlayMethodClass::DirectStream; + } + if (str == QStringLiteral("DirectPlay")) { + return PlayMethodClass::DirectPlay; + } + + return PlayMethodClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playrequest.h b/core/include/JellyfinQt/DTO/playrequest.h index 1f3de6b..16b5467 100644 --- a/core/include/JellyfinQt/DTO/playrequest.h +++ b/core/include/JellyfinQt/DTO/playrequest.h @@ -31,86 +31,96 @@ #define JELLYFIN_DTO_PLAYREQUEST_H #include +#include #include -#include #include #include +#include +#include #include "JellyfinQt/DTO/playcommand.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PlayRequest : public QObject { - Q_OBJECT -public: - explicit PlayRequest(QObject *parent = nullptr); - static PlayRequest *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PlayRequest { +public: + explicit PlayRequest(); + static PlayRequest fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the item ids. */ - Q_PROPERTY(QStringList itemIds READ itemIds WRITE setItemIds NOTIFY itemIdsChanged) + QList itemIds() const; + /** + * @brief Gets or sets the item ids. + */ + void setItemIds(QList newItemIds); /** * @brief Gets or sets the start position ticks that the first item should be played at. */ - Q_PROPERTY(qint64 startPositionTicks READ startPositionTicks WRITE setStartPositionTicks NOTIFY startPositionTicksChanged) - Q_PROPERTY(PlayCommand playCommand READ playCommand WRITE setPlayCommand NOTIFY playCommandChanged) + qint64 startPositionTicks() const; + /** + * @brief Gets or sets the start position ticks that the first item should be played at. + */ + void setStartPositionTicks(qint64 newStartPositionTicks); + + PlayCommand playCommand() const; + + void setPlayCommand(PlayCommand newPlayCommand); /** * @brief Gets or sets the controlling user identifier. */ - Q_PROPERTY(QString controllingUserId READ controllingUserId WRITE setControllingUserId NOTIFY controllingUserIdChanged) - Q_PROPERTY(qint32 subtitleStreamIndex READ subtitleStreamIndex WRITE setSubtitleStreamIndex NOTIFY subtitleStreamIndexChanged) - Q_PROPERTY(qint32 audioStreamIndex READ audioStreamIndex WRITE setAudioStreamIndex NOTIFY audioStreamIndexChanged) - Q_PROPERTY(QString mediaSourceId READ mediaSourceId WRITE setMediaSourceId NOTIFY mediaSourceIdChanged) - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) + QUuid controllingUserId() const; + /** + * @brief Gets or sets the controlling user identifier. + */ + void setControllingUserId(QUuid newControllingUserId); - QStringList itemIds() const; - void setItemIds(QStringList newItemIds); - - qint64 startPositionTicks() const; - void setStartPositionTicks(qint64 newStartPositionTicks); - - PlayCommand playCommand() const; - void setPlayCommand(PlayCommand newPlayCommand); - - QString controllingUserId() const; - void setControllingUserId(QString newControllingUserId); - qint32 subtitleStreamIndex() const; + void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex); - + qint32 audioStreamIndex() const; + void setAudioStreamIndex(qint32 newAudioStreamIndex); - + QString mediaSourceId() const; + void setMediaSourceId(QString newMediaSourceId); - + qint32 startIndex() const; + void setStartIndex(qint32 newStartIndex); - -signals: - void itemIdsChanged(QStringList newItemIds); - void startPositionTicksChanged(qint64 newStartPositionTicks); - void playCommandChanged(PlayCommand newPlayCommand); - void controllingUserIdChanged(QString newControllingUserId); - void subtitleStreamIndexChanged(qint32 newSubtitleStreamIndex); - void audioStreamIndexChanged(qint32 newAudioStreamIndex); - void mediaSourceIdChanged(QString newMediaSourceId); - void startIndexChanged(qint32 newStartIndex); + protected: - QStringList m_itemIds; + QList m_itemIds; qint64 m_startPositionTicks; PlayCommand m_playCommand; - QString m_controllingUserId; + QUuid m_controllingUserId; qint32 m_subtitleStreamIndex; qint32 m_audioStreamIndex; QString m_mediaSourceId; qint32 m_startIndex; }; +} // NS DTO + +namespace Support { + +using PlayRequest = Jellyfin::DTO::PlayRequest; + +template <> +PlayRequest fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlayRequest::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playrequestdto.h b/core/include/JellyfinQt/DTO/playrequestdto.h index 200a723..ebdcba4 100644 --- a/core/include/JellyfinQt/DTO/playrequestdto.h +++ b/core/include/JellyfinQt/DTO/playrequestdto.h @@ -31,54 +31,69 @@ #define JELLYFIN_DTO_PLAYREQUESTDTO_H #include +#include #include -#include -#include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PlayRequestDto : public QObject { - Q_OBJECT -public: - explicit PlayRequestDto(QObject *parent = nullptr); - static PlayRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PlayRequestDto { +public: + explicit PlayRequestDto(); + static PlayRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the playing queue. */ - Q_PROPERTY(QStringList playingQueue READ playingQueue WRITE setPlayingQueue NOTIFY playingQueueChanged) + QList playingQueue() const; + /** + * @brief Gets or sets the playing queue. + */ + void setPlayingQueue(QList newPlayingQueue); /** * @brief Gets or sets the position of the playing item in the queue. */ - Q_PROPERTY(qint32 playingItemPosition READ playingItemPosition WRITE setPlayingItemPosition NOTIFY playingItemPositionChanged) + qint32 playingItemPosition() const; + /** + * @brief Gets or sets the position of the playing item in the queue. + */ + void setPlayingItemPosition(qint32 newPlayingItemPosition); /** * @brief Gets or sets the start position ticks. */ - Q_PROPERTY(qint64 startPositionTicks READ startPositionTicks WRITE setStartPositionTicks NOTIFY startPositionTicksChanged) - - QStringList playingQueue() const; - void setPlayingQueue(QStringList newPlayingQueue); - - qint32 playingItemPosition() const; - void setPlayingItemPosition(qint32 newPlayingItemPosition); - qint64 startPositionTicks() const; + /** + * @brief Gets or sets the start position ticks. + */ void setStartPositionTicks(qint64 newStartPositionTicks); - -signals: - void playingQueueChanged(QStringList newPlayingQueue); - void playingItemPositionChanged(qint32 newPlayingItemPosition); - void startPositionTicksChanged(qint64 newStartPositionTicks); + protected: - QStringList m_playingQueue; + QList m_playingQueue; qint32 m_playingItemPosition; qint64 m_startPositionTicks; }; +} // NS DTO + +namespace Support { + +using PlayRequestDto = Jellyfin::DTO::PlayRequestDto; + +template <> +PlayRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlayRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playstatecommand.h b/core/include/JellyfinQt/DTO/playstatecommand.h index 6a27105..26436d4 100644 --- a/core/include/JellyfinQt/DTO/playstatecommand.h +++ b/core/include/JellyfinQt/DTO/playstatecommand.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PLAYSTATECOMMAND_H #define JELLYFIN_DTO_PLAYSTATECOMMAND_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class PlaystateCommandClass { Q_GADGET public: enum Value { + EnumNotSet, Stop, Pause, Unpause, @@ -53,8 +58,52 @@ public: private: explicit PlaystateCommandClass(); }; + typedef PlaystateCommandClass::Value PlaystateCommand; +} // NS DTO + +namespace Support { + +using PlaystateCommand = Jellyfin::DTO::PlaystateCommand; +using PlaystateCommandClass = Jellyfin::DTO::PlaystateCommandClass; + +template <> +PlaystateCommand fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return PlaystateCommandClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Stop")) { + return PlaystateCommandClass::Stop; + } + if (str == QStringLiteral("Pause")) { + return PlaystateCommandClass::Pause; + } + if (str == QStringLiteral("Unpause")) { + return PlaystateCommandClass::Unpause; + } + if (str == QStringLiteral("NextTrack")) { + return PlaystateCommandClass::NextTrack; + } + if (str == QStringLiteral("PreviousTrack")) { + return PlaystateCommandClass::PreviousTrack; + } + if (str == QStringLiteral("Seek")) { + return PlaystateCommandClass::Seek; + } + if (str == QStringLiteral("Rewind")) { + return PlaystateCommandClass::Rewind; + } + if (str == QStringLiteral("FastForward")) { + return PlaystateCommandClass::FastForward; + } + if (str == QStringLiteral("PlayPause")) { + return PlaystateCommandClass::PlayPause; + } + + return PlaystateCommandClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/playstaterequest.h b/core/include/JellyfinQt/DTO/playstaterequest.h index 43af866..0758bdc 100644 --- a/core/include/JellyfinQt/DTO/playstaterequest.h +++ b/core/include/JellyfinQt/DTO/playstaterequest.h @@ -31,48 +31,60 @@ #define JELLYFIN_DTO_PLAYSTATEREQUEST_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/playstatecommand.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PlaystateRequest : public QObject { - Q_OBJECT -public: - explicit PlaystateRequest(QObject *parent = nullptr); - static PlaystateRequest *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(PlaystateCommand command READ command WRITE setCommand NOTIFY commandChanged) - Q_PROPERTY(qint64 seekPositionTicks READ seekPositionTicks WRITE setSeekPositionTicks NOTIFY seekPositionTicksChanged) +class PlaystateRequest { +public: + explicit PlaystateRequest(); + static PlaystateRequest fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties + + PlaystateCommand command() const; + + void setCommand(PlaystateCommand newCommand); + + qint64 seekPositionTicks() const; + + void setSeekPositionTicks(qint64 newSeekPositionTicks); /** * @brief Gets or sets the controlling user identifier. */ - Q_PROPERTY(QString controllingUserId READ controllingUserId WRITE setControllingUserId NOTIFY controllingUserIdChanged) - - PlaystateCommand command() const; - void setCommand(PlaystateCommand newCommand); - - qint64 seekPositionTicks() const; - void setSeekPositionTicks(qint64 newSeekPositionTicks); - QString controllingUserId() const; + /** + * @brief Gets or sets the controlling user identifier. + */ void setControllingUserId(QString newControllingUserId); - -signals: - void commandChanged(PlaystateCommand newCommand); - void seekPositionTicksChanged(qint64 newSeekPositionTicks); - void controllingUserIdChanged(QString newControllingUserId); + protected: PlaystateCommand m_command; qint64 m_seekPositionTicks; QString m_controllingUserId; }; +} // NS DTO + +namespace Support { + +using PlaystateRequest = Jellyfin::DTO::PlaystateRequest; + +template <> +PlaystateRequest fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PlaystateRequest::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/plugininfo.h b/core/include/JellyfinQt/DTO/plugininfo.h index 8462a88..a9cf77e 100644 --- a/core/include/JellyfinQt/DTO/plugininfo.h +++ b/core/include/JellyfinQt/DTO/plugininfo.h @@ -31,95 +31,108 @@ #define JELLYFIN_DTO_PLUGININFO_H #include -#include +#include +#include #include +#include +#include #include "JellyfinQt/DTO/pluginstatus.h" +#include "JellyfinQt/DTO/version.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class Version; -class PluginInfo : public QObject { - Q_OBJECT +class PluginInfo { public: - explicit PluginInfo(QObject *parent = nullptr); - static PluginInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit PluginInfo(); + static PluginInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(Version * version READ version WRITE setVersion NOTIFY versionChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); + + QSharedPointer version() const; + + void setVersion(QSharedPointer newVersion); /** * @brief Gets or sets the name of the configuration file. */ - Q_PROPERTY(QString configurationFileName READ configurationFileName WRITE setConfigurationFileName NOTIFY configurationFileNameChanged) + QString configurationFileName() const; + /** + * @brief Gets or sets the name of the configuration file. + */ + void setConfigurationFileName(QString newConfigurationFileName); /** * @brief Gets or sets the description. */ - Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged) + QString description() const; + /** + * @brief Gets or sets the description. + */ + void setDescription(QString newDescription); /** * @brief Gets or sets the unique id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QUuid jellyfinId() const; + /** + * @brief Gets or sets the unique id. + */ + void setJellyfinId(QUuid newJellyfinId); /** * @brief Gets or sets a value indicating whether the plugin can be uninstalled. */ - Q_PROPERTY(bool canUninstall READ canUninstall WRITE setCanUninstall NOTIFY canUninstallChanged) + bool canUninstall() const; + /** + * @brief Gets or sets a value indicating whether the plugin can be uninstalled. + */ + void setCanUninstall(bool newCanUninstall); /** * @brief Gets or sets a value indicating whether this plugin has a valid image. */ - Q_PROPERTY(bool hasImage READ hasImage WRITE setHasImage NOTIFY hasImageChanged) - Q_PROPERTY(PluginStatus status READ status WRITE setStatus NOTIFY statusChanged) - - QString name() const; - void setName(QString newName); - - Version * version() const; - void setVersion(Version * newVersion); - - QString configurationFileName() const; - void setConfigurationFileName(QString newConfigurationFileName); - - QString description() const; - void setDescription(QString newDescription); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - bool canUninstall() const; - void setCanUninstall(bool newCanUninstall); - bool hasImage() const; + /** + * @brief Gets or sets a value indicating whether this plugin has a valid image. + */ void setHasImage(bool newHasImage); - + PluginStatus status() const; + void setStatus(PluginStatus newStatus); - -signals: - void nameChanged(QString newName); - void versionChanged(Version * newVersion); - void configurationFileNameChanged(QString newConfigurationFileName); - void descriptionChanged(QString newDescription); - void jellyfinIdChanged(QString newJellyfinId); - void canUninstallChanged(bool newCanUninstall); - void hasImageChanged(bool newHasImage); - void statusChanged(PluginStatus newStatus); + protected: QString m_name; - Version * m_version = nullptr; + QSharedPointer m_version = nullptr; QString m_configurationFileName; QString m_description; - QString m_jellyfinId; + QUuid m_jellyfinId; bool m_canUninstall; bool m_hasImage; PluginStatus m_status; }; +} // NS DTO + +namespace Support { + +using PluginInfo = Jellyfin::DTO::PluginInfo; + +template <> +PluginInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PluginInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/pluginsecurityinfo.h b/core/include/JellyfinQt/DTO/pluginsecurityinfo.h index 264082b..0c32bd0 100644 --- a/core/include/JellyfinQt/DTO/pluginsecurityinfo.h +++ b/core/include/JellyfinQt/DTO/pluginsecurityinfo.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_PLUGINSECURITYINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PluginSecurityInfo : public QObject { - Q_OBJECT -public: - explicit PluginSecurityInfo(QObject *parent = nullptr); - static PluginSecurityInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PluginSecurityInfo { +public: + explicit PluginSecurityInfo(); + static PluginSecurityInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the supporter key. */ - Q_PROPERTY(QString supporterKey READ supporterKey WRITE setSupporterKey NOTIFY supporterKeyChanged) + QString supporterKey() const; + /** + * @brief Gets or sets the supporter key. + */ + void setSupporterKey(QString newSupporterKey); /** * @brief Gets or sets a value indicating whether is mb supporter. */ - Q_PROPERTY(bool isMbSupporter READ isMbSupporter WRITE setIsMbSupporter NOTIFY isMbSupporterChanged) - - QString supporterKey() const; - void setSupporterKey(QString newSupporterKey); - bool isMbSupporter() const; + /** + * @brief Gets or sets a value indicating whether is mb supporter. + */ void setIsMbSupporter(bool newIsMbSupporter); - -signals: - void supporterKeyChanged(QString newSupporterKey); - void isMbSupporterChanged(bool newIsMbSupporter); + protected: QString m_supporterKey; bool m_isMbSupporter; }; +} // NS DTO + +namespace Support { + +using PluginSecurityInfo = Jellyfin::DTO::PluginSecurityInfo; + +template <> +PluginSecurityInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PluginSecurityInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/pluginstatus.h b/core/include/JellyfinQt/DTO/pluginstatus.h index e87b565..795ceb4 100644 --- a/core/include/JellyfinQt/DTO/pluginstatus.h +++ b/core/include/JellyfinQt/DTO/pluginstatus.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PLUGINSTATUS_H #define JELLYFIN_DTO_PLUGINSTATUS_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class PluginStatusClass { Q_GADGET public: enum Value { + EnumNotSet, Active, Restart, Deleted, @@ -51,8 +56,46 @@ public: private: explicit PluginStatusClass(); }; + typedef PluginStatusClass::Value PluginStatus; +} // NS DTO + +namespace Support { + +using PluginStatus = Jellyfin::DTO::PluginStatus; +using PluginStatusClass = Jellyfin::DTO::PluginStatusClass; + +template <> +PluginStatus fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return PluginStatusClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Active")) { + return PluginStatusClass::Active; + } + if (str == QStringLiteral("Restart")) { + return PluginStatusClass::Restart; + } + if (str == QStringLiteral("Deleted")) { + return PluginStatusClass::Deleted; + } + if (str == QStringLiteral("Superceded")) { + return PluginStatusClass::Superceded; + } + if (str == QStringLiteral("Malfunctioned")) { + return PluginStatusClass::Malfunctioned; + } + if (str == QStringLiteral("NotSupported")) { + return PluginStatusClass::NotSupported; + } + if (str == QStringLiteral("Disabled")) { + return PluginStatusClass::Disabled; + } + + return PluginStatusClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/previousitemrequestdto.h b/core/include/JellyfinQt/DTO/previousitemrequestdto.h index eaf1bc3..76a9950 100644 --- a/core/include/JellyfinQt/DTO/previousitemrequestdto.h +++ b/core/include/JellyfinQt/DTO/previousitemrequestdto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_PREVIOUSITEMREQUESTDTO_H #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PreviousItemRequestDto : public QObject { - Q_OBJECT -public: - explicit PreviousItemRequestDto(QObject *parent = nullptr); - static PreviousItemRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PreviousItemRequestDto { +public: + explicit PreviousItemRequestDto(); + static PreviousItemRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the playing item identifier. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QUuid playlistItemId() const; + /** + * @brief Gets or sets the playing item identifier. + */ + void setPlaylistItemId(QUuid newPlaylistItemId); - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void playlistItemIdChanged(QString newPlaylistItemId); protected: - QString m_playlistItemId; + QUuid m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using PreviousItemRequestDto = Jellyfin::DTO::PreviousItemRequestDto; + +template <> +PreviousItemRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PreviousItemRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/problemdetails.h b/core/include/JellyfinQt/DTO/problemdetails.h index f44ae1b..f0c8e6f 100644 --- a/core/include/JellyfinQt/DTO/problemdetails.h +++ b/core/include/JellyfinQt/DTO/problemdetails.h @@ -31,47 +31,45 @@ #define JELLYFIN_DTO_PROBLEMDETAILS_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ProblemDetails : public QObject { - Q_OBJECT -public: - explicit ProblemDetails(QObject *parent = nullptr); - static ProblemDetails *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) - Q_PROPERTY(qint32 status READ status WRITE setStatus NOTIFY statusChanged) - Q_PROPERTY(QString detail READ detail WRITE setDetail NOTIFY detailChanged) - Q_PROPERTY(QString instance READ instance WRITE setInstance NOTIFY instanceChanged) +class ProblemDetails { +public: + explicit ProblemDetails(); + static ProblemDetails fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString type() const; + void setType(QString newType); - + QString title() const; + void setTitle(QString newTitle); - + qint32 status() const; + void setStatus(qint32 newStatus); - + QString detail() const; + void setDetail(QString newDetail); - + QString instance() const; + void setInstance(QString newInstance); - -signals: - void typeChanged(QString newType); - void titleChanged(QString newTitle); - void statusChanged(qint32 newStatus); - void detailChanged(QString newDetail); - void instanceChanged(QString newInstance); + protected: QString m_type; QString m_title; @@ -80,6 +78,18 @@ protected: QString m_instance; }; +} // NS DTO + +namespace Support { + +using ProblemDetails = Jellyfin::DTO::ProblemDetails; + +template <> +ProblemDetails fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ProblemDetails::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/profilecondition.h b/core/include/JellyfinQt/DTO/profilecondition.h index 4871575..1098b7f 100644 --- a/core/include/JellyfinQt/DTO/profilecondition.h +++ b/core/include/JellyfinQt/DTO/profilecondition.h @@ -31,45 +31,43 @@ #define JELLYFIN_DTO_PROFILECONDITION_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/profileconditiontype.h" #include "JellyfinQt/DTO/profileconditionvalue.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ProfileCondition : public QObject { - Q_OBJECT -public: - explicit ProfileCondition(QObject *parent = nullptr); - static ProfileCondition *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(ProfileConditionType condition READ condition WRITE setCondition NOTIFY conditionChanged) - Q_PROPERTY(ProfileConditionValue property READ property WRITE setProperty NOTIFY propertyChanged) - Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged) - Q_PROPERTY(bool isRequired READ isRequired WRITE setIsRequired NOTIFY isRequiredChanged) +class ProfileCondition { +public: + explicit ProfileCondition(); + static ProfileCondition fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties ProfileConditionType condition() const; + void setCondition(ProfileConditionType newCondition); - + ProfileConditionValue property() const; + void setProperty(ProfileConditionValue newProperty); - + QString value() const; + void setValue(QString newValue); - + bool isRequired() const; + void setIsRequired(bool newIsRequired); - -signals: - void conditionChanged(ProfileConditionType newCondition); - void propertyChanged(ProfileConditionValue newProperty); - void valueChanged(QString newValue); - void isRequiredChanged(bool newIsRequired); + protected: ProfileConditionType m_condition; ProfileConditionValue m_property; @@ -77,6 +75,18 @@ protected: bool m_isRequired; }; +} // NS DTO + +namespace Support { + +using ProfileCondition = Jellyfin::DTO::ProfileCondition; + +template <> +ProfileCondition fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ProfileCondition::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/profileconditiontype.h b/core/include/JellyfinQt/DTO/profileconditiontype.h index 87169fb..8a51152 100644 --- a/core/include/JellyfinQt/DTO/profileconditiontype.h +++ b/core/include/JellyfinQt/DTO/profileconditiontype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PROFILECONDITIONTYPE_H #define JELLYFIN_DTO_PROFILECONDITIONTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ProfileConditionTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Equals, NotEquals, LessThanEqual, @@ -49,8 +54,40 @@ public: private: explicit ProfileConditionTypeClass(); }; + typedef ProfileConditionTypeClass::Value ProfileConditionType; +} // NS DTO + +namespace Support { + +using ProfileConditionType = Jellyfin::DTO::ProfileConditionType; +using ProfileConditionTypeClass = Jellyfin::DTO::ProfileConditionTypeClass; + +template <> +ProfileConditionType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ProfileConditionTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Equals")) { + return ProfileConditionTypeClass::Equals; + } + if (str == QStringLiteral("NotEquals")) { + return ProfileConditionTypeClass::NotEquals; + } + if (str == QStringLiteral("LessThanEqual")) { + return ProfileConditionTypeClass::LessThanEqual; + } + if (str == QStringLiteral("GreaterThanEqual")) { + return ProfileConditionTypeClass::GreaterThanEqual; + } + if (str == QStringLiteral("EqualsAny")) { + return ProfileConditionTypeClass::EqualsAny; + } + + return ProfileConditionTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/profileconditionvalue.h b/core/include/JellyfinQt/DTO/profileconditionvalue.h index 1010301..c5bebdd 100644 --- a/core/include/JellyfinQt/DTO/profileconditionvalue.h +++ b/core/include/JellyfinQt/DTO/profileconditionvalue.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PROFILECONDITIONVALUE_H #define JELLYFIN_DTO_PROFILECONDITIONVALUE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ProfileConditionValueClass { Q_GADGET public: enum Value { + EnumNotSet, AudioChannels, AudioBitrate, AudioProfile, @@ -67,8 +72,94 @@ public: private: explicit ProfileConditionValueClass(); }; + typedef ProfileConditionValueClass::Value ProfileConditionValue; +} // NS DTO + +namespace Support { + +using ProfileConditionValue = Jellyfin::DTO::ProfileConditionValue; +using ProfileConditionValueClass = Jellyfin::DTO::ProfileConditionValueClass; + +template <> +ProfileConditionValue fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ProfileConditionValueClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("AudioChannels")) { + return ProfileConditionValueClass::AudioChannels; + } + if (str == QStringLiteral("AudioBitrate")) { + return ProfileConditionValueClass::AudioBitrate; + } + if (str == QStringLiteral("AudioProfile")) { + return ProfileConditionValueClass::AudioProfile; + } + if (str == QStringLiteral("Width")) { + return ProfileConditionValueClass::Width; + } + if (str == QStringLiteral("Height")) { + return ProfileConditionValueClass::Height; + } + if (str == QStringLiteral("Has64BitOffsets")) { + return ProfileConditionValueClass::Has64BitOffsets; + } + if (str == QStringLiteral("PacketLength")) { + return ProfileConditionValueClass::PacketLength; + } + if (str == QStringLiteral("VideoBitDepth")) { + return ProfileConditionValueClass::VideoBitDepth; + } + if (str == QStringLiteral("VideoBitrate")) { + return ProfileConditionValueClass::VideoBitrate; + } + if (str == QStringLiteral("VideoFramerate")) { + return ProfileConditionValueClass::VideoFramerate; + } + if (str == QStringLiteral("VideoLevel")) { + return ProfileConditionValueClass::VideoLevel; + } + if (str == QStringLiteral("VideoProfile")) { + return ProfileConditionValueClass::VideoProfile; + } + if (str == QStringLiteral("VideoTimestamp")) { + return ProfileConditionValueClass::VideoTimestamp; + } + if (str == QStringLiteral("IsAnamorphic")) { + return ProfileConditionValueClass::IsAnamorphic; + } + if (str == QStringLiteral("RefFrames")) { + return ProfileConditionValueClass::RefFrames; + } + if (str == QStringLiteral("NumAudioStreams")) { + return ProfileConditionValueClass::NumAudioStreams; + } + if (str == QStringLiteral("NumVideoStreams")) { + return ProfileConditionValueClass::NumVideoStreams; + } + if (str == QStringLiteral("IsSecondaryAudio")) { + return ProfileConditionValueClass::IsSecondaryAudio; + } + if (str == QStringLiteral("VideoCodecTag")) { + return ProfileConditionValueClass::VideoCodecTag; + } + if (str == QStringLiteral("IsAvc")) { + return ProfileConditionValueClass::IsAvc; + } + if (str == QStringLiteral("IsInterlaced")) { + return ProfileConditionValueClass::IsInterlaced; + } + if (str == QStringLiteral("AudioSampleRate")) { + return ProfileConditionValueClass::AudioSampleRate; + } + if (str == QStringLiteral("AudioBitDepth")) { + return ProfileConditionValueClass::AudioBitDepth; + } + + return ProfileConditionValueClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/programaudio.h b/core/include/JellyfinQt/DTO/programaudio.h index a4d6de2..f10f7d9 100644 --- a/core/include/JellyfinQt/DTO/programaudio.h +++ b/core/include/JellyfinQt/DTO/programaudio.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_PROGRAMAUDIO_H #define JELLYFIN_DTO_PROGRAMAUDIO_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ProgramAudioClass { Q_GADGET public: enum Value { + EnumNotSet, Mono, Stereo, Dolby, @@ -50,8 +55,43 @@ public: private: explicit ProgramAudioClass(); }; + typedef ProgramAudioClass::Value ProgramAudio; +} // NS DTO + +namespace Support { + +using ProgramAudio = Jellyfin::DTO::ProgramAudio; +using ProgramAudioClass = Jellyfin::DTO::ProgramAudioClass; + +template <> +ProgramAudio fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ProgramAudioClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Mono")) { + return ProgramAudioClass::Mono; + } + if (str == QStringLiteral("Stereo")) { + return ProgramAudioClass::Stereo; + } + if (str == QStringLiteral("Dolby")) { + return ProgramAudioClass::Dolby; + } + if (str == QStringLiteral("DolbyDigital")) { + return ProgramAudioClass::DolbyDigital; + } + if (str == QStringLiteral("Thx")) { + return ProgramAudioClass::Thx; + } + if (str == QStringLiteral("Atmos")) { + return ProgramAudioClass::Atmos; + } + + return ProgramAudioClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/publicsysteminfo.h b/core/include/JellyfinQt/DTO/publicsysteminfo.h index 9c7bc6d..d2b7f1c 100644 --- a/core/include/JellyfinQt/DTO/publicsysteminfo.h +++ b/core/include/JellyfinQt/DTO/publicsysteminfo.h @@ -31,78 +31,81 @@ #define JELLYFIN_DTO_PUBLICSYSTEMINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class PublicSystemInfo : public QObject { - Q_OBJECT -public: - explicit PublicSystemInfo(QObject *parent = nullptr); - static PublicSystemInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class PublicSystemInfo { +public: + explicit PublicSystemInfo(); + static PublicSystemInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the local address. */ - Q_PROPERTY(QString localAddress READ localAddress WRITE setLocalAddress NOTIFY localAddressChanged) + QString localAddress() const; + /** + * @brief Gets or sets the local address. + */ + void setLocalAddress(QString newLocalAddress); /** * @brief Gets or sets the name of the server. */ - Q_PROPERTY(QString serverName READ serverName WRITE setServerName NOTIFY serverNameChanged) + QString serverName() const; + /** + * @brief Gets or sets the name of the server. + */ + void setServerName(QString newServerName); /** * @brief Gets or sets the server version. */ - Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY versionChanged) + QString version() const; + /** + * @brief Gets or sets the server version. + */ + void setVersion(QString newVersion); /** * @brief Gets or sets the product name. This is the AssemblyProduct name. */ - Q_PROPERTY(QString productName READ productName WRITE setProductName NOTIFY productNameChanged) + QString productName() const; + /** + * @brief Gets or sets the product name. This is the AssemblyProduct name. + */ + void setProductName(QString newProductName); /** * @brief Gets or sets the operating system. */ - Q_PROPERTY(QString operatingSystem READ operatingSystem WRITE setOperatingSystem NOTIFY operatingSystemChanged) + QString operatingSystem() const; + /** + * @brief Gets or sets the operating system. + */ + void setOperatingSystem(QString newOperatingSystem); /** * @brief Gets or sets the id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the id. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets a value indicating whether the startup wizard is completed. */ - Q_PROPERTY(bool startupWizardCompleted READ startupWizardCompleted WRITE setStartupWizardCompleted NOTIFY startupWizardCompletedChanged) - - QString localAddress() const; - void setLocalAddress(QString newLocalAddress); - - QString serverName() const; - void setServerName(QString newServerName); - - QString version() const; - void setVersion(QString newVersion); - - QString productName() const; - void setProductName(QString newProductName); - - QString operatingSystem() const; - void setOperatingSystem(QString newOperatingSystem); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - bool startupWizardCompleted() const; + /** + * @brief Gets or sets a value indicating whether the startup wizard is completed. + */ void setStartupWizardCompleted(bool newStartupWizardCompleted); - -signals: - void localAddressChanged(QString newLocalAddress); - void serverNameChanged(QString newServerName); - void versionChanged(QString newVersion); - void productNameChanged(QString newProductName); - void operatingSystemChanged(QString newOperatingSystem); - void jellyfinIdChanged(QString newJellyfinId); - void startupWizardCompletedChanged(bool newStartupWizardCompleted); + protected: QString m_localAddress; QString m_serverName; @@ -113,6 +116,18 @@ protected: bool m_startupWizardCompleted; }; +} // NS DTO + +namespace Support { + +using PublicSystemInfo = Jellyfin::DTO::PublicSystemInfo; + +template <> +PublicSystemInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return PublicSystemInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/queryfilters.h b/core/include/JellyfinQt/DTO/queryfilters.h index df37156..b00316d 100644 --- a/core/include/JellyfinQt/DTO/queryfilters.h +++ b/core/include/JellyfinQt/DTO/queryfilters.h @@ -31,40 +31,53 @@ #define JELLYFIN_DTO_QUERYFILTERS_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/nameguidpair.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class NameGuidPair; -class QueryFilters : public QObject { - Q_OBJECT +class QueryFilters { public: - explicit QueryFilters(QObject *parent = nullptr); - static QueryFilters *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QList genres READ genres WRITE setGenres NOTIFY genresChanged) - Q_PROPERTY(QStringList tags READ tags WRITE setTags NOTIFY tagsChanged) - - QList genres() const; - void setGenres(QList newGenres); + explicit QueryFilters(); + static QueryFilters fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + // Properties + + QList> genres() const; + + void setGenres(QList> newGenres); + QStringList tags() const; + void setTags(QStringList newTags); - -signals: - void genresChanged(QList newGenres); - void tagsChanged(QStringList newTags); + protected: - QList m_genres; + QList> m_genres; QStringList m_tags; }; +} // NS DTO + +namespace Support { + +using QueryFilters = Jellyfin::DTO::QueryFilters; + +template <> +QueryFilters fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return QueryFilters::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/queryfilterslegacy.h b/core/include/JellyfinQt/DTO/queryfilterslegacy.h index bf42c1c..035d483 100644 --- a/core/include/JellyfinQt/DTO/queryfilterslegacy.h +++ b/core/include/JellyfinQt/DTO/queryfilterslegacy.h @@ -31,44 +31,43 @@ #define JELLYFIN_DTO_QUERYFILTERSLEGACY_H #include +#include #include -#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class QueryFiltersLegacy : public QObject { - Q_OBJECT -public: - explicit QueryFiltersLegacy(QObject *parent = nullptr); - static QueryFiltersLegacy *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QStringList genres READ genres WRITE setGenres NOTIFY genresChanged) - Q_PROPERTY(QStringList tags READ tags WRITE setTags NOTIFY tagsChanged) - Q_PROPERTY(QStringList officialRatings READ officialRatings WRITE setOfficialRatings NOTIFY officialRatingsChanged) - Q_PROPERTY(QList years READ years WRITE setYears NOTIFY yearsChanged) +class QueryFiltersLegacy { +public: + explicit QueryFiltersLegacy(); + static QueryFiltersLegacy fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QStringList genres() const; + void setGenres(QStringList newGenres); - + QStringList tags() const; + void setTags(QStringList newTags); - + QStringList officialRatings() const; + void setOfficialRatings(QStringList newOfficialRatings); - + QList years() const; + void setYears(QList newYears); - -signals: - void genresChanged(QStringList newGenres); - void tagsChanged(QStringList newTags); - void officialRatingsChanged(QStringList newOfficialRatings); - void yearsChanged(QList newYears); + protected: QStringList m_genres; QStringList m_tags; @@ -76,6 +75,18 @@ protected: QList m_years; }; +} // NS DTO + +namespace Support { + +using QueryFiltersLegacy = Jellyfin::DTO::QueryFiltersLegacy; + +template <> +QueryFiltersLegacy fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return QueryFiltersLegacy::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/queueitem.h b/core/include/JellyfinQt/DTO/queueitem.h index 1e67089..6408c56 100644 --- a/core/include/JellyfinQt/DTO/queueitem.h +++ b/core/include/JellyfinQt/DTO/queueitem.h @@ -31,37 +31,51 @@ #define JELLYFIN_DTO_QUEUEITEM_H #include -#include +#include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class QueueItem : public QObject { - Q_OBJECT + +class QueueItem { public: - explicit QueueItem(QObject *parent = nullptr); - static QueueItem *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); + explicit QueueItem(); + static QueueItem fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + // Properties + + QUuid jellyfinId() const; + + void setJellyfinId(QUuid newJellyfinId); + QString playlistItemId() const; + void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void playlistItemIdChanged(QString newPlaylistItemId); + protected: - QString m_jellyfinId; + QUuid m_jellyfinId; QString m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using QueueItem = Jellyfin::DTO::QueueItem; + +template <> +QueueItem fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return QueueItem::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/queuerequestdto.h b/core/include/JellyfinQt/DTO/queuerequestdto.h index e1773c4..586b43c 100644 --- a/core/include/JellyfinQt/DTO/queuerequestdto.h +++ b/core/include/JellyfinQt/DTO/queuerequestdto.h @@ -31,44 +31,57 @@ #define JELLYFIN_DTO_QUEUEREQUESTDTO_H #include +#include #include -#include -#include #include +#include +#include #include "JellyfinQt/DTO/groupqueuemode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class QueueRequestDto : public QObject { - Q_OBJECT -public: - explicit QueueRequestDto(QObject *parent = nullptr); - static QueueRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class QueueRequestDto { +public: + explicit QueueRequestDto(); + static QueueRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items to enqueue. */ - Q_PROPERTY(QStringList itemIds READ itemIds WRITE setItemIds NOTIFY itemIdsChanged) - Q_PROPERTY(GroupQueueMode mode READ mode WRITE setMode NOTIFY modeChanged) + QList itemIds() const; + /** + * @brief Gets or sets the items to enqueue. + */ + void setItemIds(QList newItemIds); - QStringList itemIds() const; - void setItemIds(QStringList newItemIds); - GroupQueueMode mode() const; + void setMode(GroupQueueMode newMode); - -signals: - void itemIdsChanged(QStringList newItemIds); - void modeChanged(GroupQueueMode newMode); + protected: - QStringList m_itemIds; + QList m_itemIds; GroupQueueMode m_mode; }; +} // NS DTO + +namespace Support { + +using QueueRequestDto = Jellyfin::DTO::QueueRequestDto; + +template <> +QueueRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return QueueRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/quickconnectdto.h b/core/include/JellyfinQt/DTO/quickconnectdto.h index d74e7c3..121f05b 100644 --- a/core/include/JellyfinQt/DTO/quickconnectdto.h +++ b/core/include/JellyfinQt/DTO/quickconnectdto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_QUICKCONNECTDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class QuickConnectDto : public QObject { - Q_OBJECT -public: - explicit QuickConnectDto(QObject *parent = nullptr); - static QuickConnectDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class QuickConnectDto { +public: + explicit QuickConnectDto(); + static QuickConnectDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the quick connect token. */ - Q_PROPERTY(QString token READ token WRITE setToken NOTIFY tokenChanged) - QString token() const; + /** + * @brief Gets or sets the quick connect token. + */ void setToken(QString newToken); - -signals: - void tokenChanged(QString newToken); + protected: QString m_token; }; +} // NS DTO + +namespace Support { + +using QuickConnectDto = Jellyfin::DTO::QuickConnectDto; + +template <> +QuickConnectDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return QuickConnectDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/quickconnectresult.h b/core/include/JellyfinQt/DTO/quickconnectresult.h index af116a3..3fc2020 100644 --- a/core/include/JellyfinQt/DTO/quickconnectresult.h +++ b/core/include/JellyfinQt/DTO/quickconnectresult.h @@ -32,70 +32,73 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class QuickConnectResult : public QObject { - Q_OBJECT -public: - explicit QuickConnectResult(QObject *parent = nullptr); - static QuickConnectResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class QuickConnectResult { +public: + explicit QuickConnectResult(); + static QuickConnectResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets a value indicating whether this request is authorized. */ - Q_PROPERTY(bool authenticated READ authenticated WRITE setAuthenticated NOTIFY authenticatedChanged) + bool authenticated() const; + /** + * @brief Gets a value indicating whether this request is authorized. + */ + void setAuthenticated(bool newAuthenticated); /** * @brief Gets or sets the secret value used to uniquely identify this request. Can be used to retrieve authentication information. */ - Q_PROPERTY(QString secret READ secret WRITE setSecret NOTIFY secretChanged) + QString secret() const; + /** + * @brief Gets or sets the secret value used to uniquely identify this request. Can be used to retrieve authentication information. + */ + void setSecret(QString newSecret); /** * @brief Gets or sets the user facing code used so the user can quickly differentiate this request from others. */ - Q_PROPERTY(QString code READ code WRITE setCode NOTIFY codeChanged) + QString code() const; + /** + * @brief Gets or sets the user facing code used so the user can quickly differentiate this request from others. + */ + void setCode(QString newCode); /** * @brief Gets or sets the private access token. */ - Q_PROPERTY(QString authentication READ authentication WRITE setAuthentication NOTIFY authenticationChanged) + QString authentication() const; + /** + * @brief Gets or sets the private access token. + */ + void setAuthentication(QString newAuthentication); /** * @brief Gets or sets an error message. */ - Q_PROPERTY(QString error READ error WRITE setError NOTIFY errorChanged) + QString error() const; + /** + * @brief Gets or sets an error message. + */ + void setError(QString newError); /** * @brief Gets or sets the DateTime that this request was created. */ - Q_PROPERTY(QDateTime dateAdded READ dateAdded WRITE setDateAdded NOTIFY dateAddedChanged) - - bool authenticated() const; - void setAuthenticated(bool newAuthenticated); - - QString secret() const; - void setSecret(QString newSecret); - - QString code() const; - void setCode(QString newCode); - - QString authentication() const; - void setAuthentication(QString newAuthentication); - - QString error() const; - void setError(QString newError); - QDateTime dateAdded() const; + /** + * @brief Gets or sets the DateTime that this request was created. + */ void setDateAdded(QDateTime newDateAdded); - -signals: - void authenticatedChanged(bool newAuthenticated); - void secretChanged(QString newSecret); - void codeChanged(QString newCode); - void authenticationChanged(QString newAuthentication); - void errorChanged(QString newError); - void dateAddedChanged(QDateTime newDateAdded); + protected: bool m_authenticated; QString m_secret; @@ -105,6 +108,18 @@ protected: QDateTime m_dateAdded; }; +} // NS DTO + +namespace Support { + +using QuickConnectResult = Jellyfin::DTO::QuickConnectResult; + +template <> +QuickConnectResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return QuickConnectResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/quickconnectstate.h b/core/include/JellyfinQt/DTO/quickconnectstate.h index c945b86..9d5e0f2 100644 --- a/core/include/JellyfinQt/DTO/quickconnectstate.h +++ b/core/include/JellyfinQt/DTO/quickconnectstate.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_QUICKCONNECTSTATE_H #define JELLYFIN_DTO_QUICKCONNECTSTATE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class QuickConnectStateClass { Q_GADGET public: enum Value { + EnumNotSet, Unavailable, Available, Active, @@ -47,8 +52,34 @@ public: private: explicit QuickConnectStateClass(); }; + typedef QuickConnectStateClass::Value QuickConnectState; +} // NS DTO + +namespace Support { + +using QuickConnectState = Jellyfin::DTO::QuickConnectState; +using QuickConnectStateClass = Jellyfin::DTO::QuickConnectStateClass; + +template <> +QuickConnectState fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return QuickConnectStateClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Unavailable")) { + return QuickConnectStateClass::Unavailable; + } + if (str == QStringLiteral("Available")) { + return QuickConnectStateClass::Available; + } + if (str == QStringLiteral("Active")) { + return QuickConnectStateClass::Active; + } + + return QuickConnectStateClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/ratingtype.h b/core/include/JellyfinQt/DTO/ratingtype.h index 112cc2f..2a8271c 100644 --- a/core/include/JellyfinQt/DTO/ratingtype.h +++ b/core/include/JellyfinQt/DTO/ratingtype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_RATINGTYPE_H #define JELLYFIN_DTO_RATINGTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class RatingTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Score, Likes, }; @@ -46,8 +51,31 @@ public: private: explicit RatingTypeClass(); }; + typedef RatingTypeClass::Value RatingType; +} // NS DTO + +namespace Support { + +using RatingType = Jellyfin::DTO::RatingType; +using RatingTypeClass = Jellyfin::DTO::RatingTypeClass; + +template <> +RatingType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return RatingTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Score")) { + return RatingTypeClass::Score; + } + if (str == QStringLiteral("Likes")) { + return RatingTypeClass::Likes; + } + + return RatingTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/readyrequestdto.h b/core/include/JellyfinQt/DTO/readyrequestdto.h index f7aec24..221bdb9 100644 --- a/core/include/JellyfinQt/DTO/readyrequestdto.h +++ b/core/include/JellyfinQt/DTO/readyrequestdto.h @@ -32,61 +32,76 @@ #include #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ReadyRequestDto : public QObject { - Q_OBJECT -public: - explicit ReadyRequestDto(QObject *parent = nullptr); - static ReadyRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ReadyRequestDto { +public: + explicit ReadyRequestDto(); + static ReadyRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets when the request has been made by the client. */ - Q_PROPERTY(QDateTime when READ when WRITE setWhen NOTIFY whenChanged) + QDateTime when() const; + /** + * @brief Gets or sets when the request has been made by the client. + */ + void setWhen(QDateTime newWhen); /** * @brief Gets or sets the position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) + qint64 positionTicks() const; + /** + * @brief Gets or sets the position ticks. + */ + void setPositionTicks(qint64 newPositionTicks); /** * @brief Gets or sets a value indicating whether the client playback is unpaused. */ - Q_PROPERTY(bool isPlaying READ isPlaying WRITE setIsPlaying NOTIFY isPlayingChanged) + bool isPlaying() const; + /** + * @brief Gets or sets a value indicating whether the client playback is unpaused. + */ + void setIsPlaying(bool newIsPlaying); /** * @brief Gets or sets the playlist item identifier of the playing item. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QUuid playlistItemId() const; + /** + * @brief Gets or sets the playlist item identifier of the playing item. + */ + void setPlaylistItemId(QUuid newPlaylistItemId); - QDateTime when() const; - void setWhen(QDateTime newWhen); - - qint64 positionTicks() const; - void setPositionTicks(qint64 newPositionTicks); - - bool isPlaying() const; - void setIsPlaying(bool newIsPlaying); - - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void whenChanged(QDateTime newWhen); - void positionTicksChanged(qint64 newPositionTicks); - void isPlayingChanged(bool newIsPlaying); - void playlistItemIdChanged(QString newPlaylistItemId); protected: QDateTime m_when; qint64 m_positionTicks; bool m_isPlaying; - QString m_playlistItemId; + QUuid m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using ReadyRequestDto = Jellyfin::DTO::ReadyRequestDto; + +template <> +ReadyRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ReadyRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/recommendationdto.h b/core/include/JellyfinQt/DTO/recommendationdto.h index b71406b..a220850 100644 --- a/core/include/JellyfinQt/DTO/recommendationdto.h +++ b/core/include/JellyfinQt/DTO/recommendationdto.h @@ -31,55 +31,66 @@ #define JELLYFIN_DTO_RECOMMENDATIONDTO_H #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/baseitemdto.h" #include "JellyfinQt/DTO/recommendationtype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemDto; -class RecommendationDto : public QObject { - Q_OBJECT +class RecommendationDto { public: - explicit RecommendationDto(QObject *parent = nullptr); - static RecommendationDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) - Q_PROPERTY(RecommendationType recommendationType READ recommendationType WRITE setRecommendationType NOTIFY recommendationTypeChanged) - Q_PROPERTY(QString baselineItemName READ baselineItemName WRITE setBaselineItemName NOTIFY baselineItemNameChanged) - Q_PROPERTY(QString categoryId READ categoryId WRITE setCategoryId NOTIFY categoryIdChanged) - - QList items() const; - void setItems(QList newItems); + explicit RecommendationDto(); + static RecommendationDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + // Properties + + QList> items() const; + + void setItems(QList> newItems); + RecommendationType recommendationType() const; + void setRecommendationType(RecommendationType newRecommendationType); - + QString baselineItemName() const; + void setBaselineItemName(QString newBaselineItemName); - - QString categoryId() const; - void setCategoryId(QString newCategoryId); - -signals: - void itemsChanged(QList newItems); - void recommendationTypeChanged(RecommendationType newRecommendationType); - void baselineItemNameChanged(QString newBaselineItemName); - void categoryIdChanged(QString newCategoryId); + + QUuid categoryId() const; + + void setCategoryId(QUuid newCategoryId); + protected: - QList m_items; + QList> m_items; RecommendationType m_recommendationType; QString m_baselineItemName; - QString m_categoryId; + QUuid m_categoryId; }; +} // NS DTO + +namespace Support { + +using RecommendationDto = Jellyfin::DTO::RecommendationDto; + +template <> +RecommendationDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return RecommendationDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/recommendationtype.h b/core/include/JellyfinQt/DTO/recommendationtype.h index 80cfdc0..2a99823 100644 --- a/core/include/JellyfinQt/DTO/recommendationtype.h +++ b/core/include/JellyfinQt/DTO/recommendationtype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_RECOMMENDATIONTYPE_H #define JELLYFIN_DTO_RECOMMENDATIONTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class RecommendationTypeClass { Q_GADGET public: enum Value { + EnumNotSet, SimilarToRecentlyPlayed, SimilarToLikedItem, HasDirectorFromRecentlyPlayed, @@ -50,8 +55,43 @@ public: private: explicit RecommendationTypeClass(); }; + typedef RecommendationTypeClass::Value RecommendationType; +} // NS DTO + +namespace Support { + +using RecommendationType = Jellyfin::DTO::RecommendationType; +using RecommendationTypeClass = Jellyfin::DTO::RecommendationTypeClass; + +template <> +RecommendationType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return RecommendationTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("SimilarToRecentlyPlayed")) { + return RecommendationTypeClass::SimilarToRecentlyPlayed; + } + if (str == QStringLiteral("SimilarToLikedItem")) { + return RecommendationTypeClass::SimilarToLikedItem; + } + if (str == QStringLiteral("HasDirectorFromRecentlyPlayed")) { + return RecommendationTypeClass::HasDirectorFromRecentlyPlayed; + } + if (str == QStringLiteral("HasActorFromRecentlyPlayed")) { + return RecommendationTypeClass::HasActorFromRecentlyPlayed; + } + if (str == QStringLiteral("HasLikedDirector")) { + return RecommendationTypeClass::HasLikedDirector; + } + if (str == QStringLiteral("HasLikedActor")) { + return RecommendationTypeClass::HasLikedActor; + } + + return RecommendationTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/recordingstatus.h b/core/include/JellyfinQt/DTO/recordingstatus.h index b06076e..1b4bdfa 100644 --- a/core/include/JellyfinQt/DTO/recordingstatus.h +++ b/core/include/JellyfinQt/DTO/recordingstatus.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_RECORDINGSTATUS_H #define JELLYFIN_DTO_RECORDINGSTATUS_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class RecordingStatusClass { Q_GADGET public: enum Value { + EnumNotSet, New, InProgress, Completed, @@ -51,8 +56,46 @@ public: private: explicit RecordingStatusClass(); }; + typedef RecordingStatusClass::Value RecordingStatus; +} // NS DTO + +namespace Support { + +using RecordingStatus = Jellyfin::DTO::RecordingStatus; +using RecordingStatusClass = Jellyfin::DTO::RecordingStatusClass; + +template <> +RecordingStatus fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return RecordingStatusClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("New")) { + return RecordingStatusClass::New; + } + if (str == QStringLiteral("InProgress")) { + return RecordingStatusClass::InProgress; + } + if (str == QStringLiteral("Completed")) { + return RecordingStatusClass::Completed; + } + if (str == QStringLiteral("Cancelled")) { + return RecordingStatusClass::Cancelled; + } + if (str == QStringLiteral("ConflictedOk")) { + return RecordingStatusClass::ConflictedOk; + } + if (str == QStringLiteral("ConflictedNotOk")) { + return RecordingStatusClass::ConflictedNotOk; + } + if (str == QStringLiteral("Error")) { + return RecordingStatusClass::Error; + } + + return RecordingStatusClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/remoteimageinfo.h b/core/include/JellyfinQt/DTO/remoteimageinfo.h index 91ceb55..8228f56 100644 --- a/core/include/JellyfinQt/DTO/remoteimageinfo.h +++ b/core/include/JellyfinQt/DTO/remoteimageinfo.h @@ -31,99 +31,99 @@ #define JELLYFIN_DTO_REMOTEIMAGEINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/imagetype.h" #include "JellyfinQt/DTO/ratingtype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class RemoteImageInfo : public QObject { - Q_OBJECT -public: - explicit RemoteImageInfo(QObject *parent = nullptr); - static RemoteImageInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class RemoteImageInfo { +public: + explicit RemoteImageInfo(); + static RemoteImageInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name of the provider. */ - Q_PROPERTY(QString providerName READ providerName WRITE setProviderName NOTIFY providerNameChanged) + QString providerName() const; + /** + * @brief Gets or sets the name of the provider. + */ + void setProviderName(QString newProviderName); /** * @brief Gets or sets the URL. */ - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) + QString url() const; + /** + * @brief Gets or sets the URL. + */ + void setUrl(QString newUrl); /** * @brief Gets a url used for previewing a smaller version. */ - Q_PROPERTY(QString thumbnailUrl READ thumbnailUrl WRITE setThumbnailUrl NOTIFY thumbnailUrlChanged) + QString thumbnailUrl() const; + /** + * @brief Gets a url used for previewing a smaller version. + */ + void setThumbnailUrl(QString newThumbnailUrl); /** * @brief Gets or sets the height. */ - Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged) + qint32 height() const; + /** + * @brief Gets or sets the height. + */ + void setHeight(qint32 newHeight); /** * @brief Gets or sets the width. */ - Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged) + qint32 width() const; + /** + * @brief Gets or sets the width. + */ + void setWidth(qint32 newWidth); /** * @brief Gets or sets the community rating. */ - Q_PROPERTY(double communityRating READ communityRating WRITE setCommunityRating NOTIFY communityRatingChanged) + double communityRating() const; + /** + * @brief Gets or sets the community rating. + */ + void setCommunityRating(double newCommunityRating); /** * @brief Gets or sets the vote count. */ - Q_PROPERTY(qint32 voteCount READ voteCount WRITE setVoteCount NOTIFY voteCountChanged) + qint32 voteCount() const; + /** + * @brief Gets or sets the vote count. + */ + void setVoteCount(qint32 newVoteCount); /** * @brief Gets or sets the language. */ - Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged) - Q_PROPERTY(ImageType type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(RatingType ratingType READ ratingType WRITE setRatingType NOTIFY ratingTypeChanged) - - QString providerName() const; - void setProviderName(QString newProviderName); - - QString url() const; - void setUrl(QString newUrl); - - QString thumbnailUrl() const; - void setThumbnailUrl(QString newThumbnailUrl); - - qint32 height() const; - void setHeight(qint32 newHeight); - - qint32 width() const; - void setWidth(qint32 newWidth); - - double communityRating() const; - void setCommunityRating(double newCommunityRating); - - qint32 voteCount() const; - void setVoteCount(qint32 newVoteCount); - QString language() const; + /** + * @brief Gets or sets the language. + */ void setLanguage(QString newLanguage); - + ImageType type() const; + void setType(ImageType newType); - + RatingType ratingType() const; + void setRatingType(RatingType newRatingType); - -signals: - void providerNameChanged(QString newProviderName); - void urlChanged(QString newUrl); - void thumbnailUrlChanged(QString newThumbnailUrl); - void heightChanged(qint32 newHeight); - void widthChanged(qint32 newWidth); - void communityRatingChanged(double newCommunityRating); - void voteCountChanged(qint32 newVoteCount); - void languageChanged(QString newLanguage); - void typeChanged(ImageType newType); - void ratingTypeChanged(RatingType newRatingType); + protected: QString m_providerName; QString m_url; @@ -137,6 +137,18 @@ protected: RatingType m_ratingType; }; +} // NS DTO + +namespace Support { + +using RemoteImageInfo = Jellyfin::DTO::RemoteImageInfo; + +template <> +RemoteImageInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return RemoteImageInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/remoteimageresult.h b/core/include/JellyfinQt/DTO/remoteimageresult.h index d3f9666..6e82885 100644 --- a/core/include/JellyfinQt/DTO/remoteimageresult.h +++ b/core/include/JellyfinQt/DTO/remoteimageresult.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_REMOTEIMAGERESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/remoteimageinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class RemoteImageInfo; -class RemoteImageResult : public QObject { - Q_OBJECT +class RemoteImageResult { public: - explicit RemoteImageResult(QObject *parent = nullptr); - static RemoteImageResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit RemoteImageResult(); + static RemoteImageResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the images. */ - Q_PROPERTY(QList images READ images WRITE setImages NOTIFY imagesChanged) + QList> images() const; + /** + * @brief Gets or sets the images. + */ + void setImages(QList> newImages); /** * @brief Gets or sets the total record count. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief Gets or sets the total record count. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief Gets or sets the providers. */ - Q_PROPERTY(QStringList providers READ providers WRITE setProviders NOTIFY providersChanged) - - QList images() const; - void setImages(QList newImages); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - QStringList providers() const; + /** + * @brief Gets or sets the providers. + */ void setProviders(QStringList newProviders); - -signals: - void imagesChanged(QList newImages); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void providersChanged(QStringList newProviders); + protected: - QList m_images; + QList> m_images; qint32 m_totalRecordCount; QStringList m_providers; }; +} // NS DTO + +namespace Support { + +using RemoteImageResult = Jellyfin::DTO::RemoteImageResult; + +template <> +RemoteImageResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return RemoteImageResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/remotesearchresult.h b/core/include/JellyfinQt/DTO/remotesearchresult.h index b97cac0..55ee7fd 100644 --- a/core/include/JellyfinQt/DTO/remotesearchresult.h +++ b/core/include/JellyfinQt/DTO/remotesearchresult.h @@ -32,94 +32,88 @@ #include #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class RemoteSearchResult : public QObject { - Q_OBJECT +class RemoteSearchResult { public: - explicit RemoteSearchResult(QObject *parent = nullptr); - static RemoteSearchResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit RemoteSearchResult(); + static RemoteSearchResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 productionYear READ productionYear WRITE setProductionYear NOTIFY productionYearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 indexNumberEnd READ indexNumberEnd WRITE setIndexNumberEnd NOTIFY indexNumberEndChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(QString imageUrl READ imageUrl WRITE setImageUrl NOTIFY imageUrlChanged) - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) - Q_PROPERTY(QString overview READ overview WRITE setOverview NOTIFY overviewChanged) - Q_PROPERTY(RemoteSearchResult * albumArtist READ albumArtist WRITE setAlbumArtist NOTIFY albumArtistChanged) - Q_PROPERTY(QList artists READ artists WRITE setArtists NOTIFY artistsChanged) - - QString name() const; - void setName(QString newName); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 productionYear() const; + /** + * @brief Gets or sets the year. + */ void setProductionYear(qint32 newProductionYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 indexNumberEnd() const; + void setIndexNumberEnd(qint32 newIndexNumberEnd); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + QString imageUrl() const; + void setImageUrl(QString newImageUrl); - + QString searchProviderName() const; + void setSearchProviderName(QString newSearchProviderName); - + QString overview() const; + void setOverview(QString newOverview); - - RemoteSearchResult * albumArtist() const; - void setAlbumArtist(RemoteSearchResult * newAlbumArtist); - - QList artists() const; - void setArtists(QList newArtists); - -signals: - void nameChanged(QString newName); - void providerIdsChanged(QJsonObject newProviderIds); - void productionYearChanged(qint32 newProductionYear); - void indexNumberChanged(qint32 newIndexNumber); - void indexNumberEndChanged(qint32 newIndexNumberEnd); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void imageUrlChanged(QString newImageUrl); - void searchProviderNameChanged(QString newSearchProviderName); - void overviewChanged(QString newOverview); - void albumArtistChanged(RemoteSearchResult * newAlbumArtist); - void artistsChanged(QList newArtists); + + QSharedPointer albumArtist() const; + + void setAlbumArtist(QSharedPointer newAlbumArtist); + + QList> artists() const; + + void setArtists(QList> newArtists); + protected: QString m_name; QJsonObject m_providerIds; @@ -131,10 +125,22 @@ protected: QString m_imageUrl; QString m_searchProviderName; QString m_overview; - RemoteSearchResult * m_albumArtist = nullptr; - QList m_artists; + QSharedPointer m_albumArtist = nullptr; + QList> m_artists; }; +} // NS DTO + +namespace Support { + +using RemoteSearchResult = Jellyfin::DTO::RemoteSearchResult; + +template <> +RemoteSearchResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return RemoteSearchResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/remotesubtitleinfo.h b/core/include/JellyfinQt/DTO/remotesubtitleinfo.h index 169dff6..cbee670 100644 --- a/core/include/JellyfinQt/DTO/remotesubtitleinfo.h +++ b/core/include/JellyfinQt/DTO/remotesubtitleinfo.h @@ -32,77 +32,69 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class RemoteSubtitleInfo : public QObject { - Q_OBJECT -public: - explicit RemoteSubtitleInfo(QObject *parent = nullptr); - static RemoteSubtitleInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString threeLetterISOLanguageName READ threeLetterISOLanguageName WRITE setThreeLetterISOLanguageName NOTIFY threeLetterISOLanguageNameChanged) - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString providerName READ providerName WRITE setProviderName NOTIFY providerNameChanged) - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged) - Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged) - Q_PROPERTY(QString comment READ comment WRITE setComment NOTIFY commentChanged) - Q_PROPERTY(QDateTime dateCreated READ dateCreated WRITE setDateCreated NOTIFY dateCreatedChanged) - Q_PROPERTY(float communityRating READ communityRating WRITE setCommunityRating NOTIFY communityRatingChanged) - Q_PROPERTY(qint32 downloadCount READ downloadCount WRITE setDownloadCount NOTIFY downloadCountChanged) - Q_PROPERTY(bool isHashMatch READ isHashMatch WRITE setIsHashMatch NOTIFY isHashMatchChanged) +class RemoteSubtitleInfo { +public: + explicit RemoteSubtitleInfo(); + static RemoteSubtitleInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString threeLetterISOLanguageName() const; + void setThreeLetterISOLanguageName(QString newThreeLetterISOLanguageName); - + QString jellyfinId() const; + void setJellyfinId(QString newJellyfinId); - + QString providerName() const; + void setProviderName(QString newProviderName); - + QString name() const; + void setName(QString newName); - + QString format() const; + void setFormat(QString newFormat); - + QString author() const; + void setAuthor(QString newAuthor); - + QString comment() const; + void setComment(QString newComment); - + QDateTime dateCreated() const; + void setDateCreated(QDateTime newDateCreated); - + float communityRating() const; + void setCommunityRating(float newCommunityRating); - + qint32 downloadCount() const; + void setDownloadCount(qint32 newDownloadCount); - + bool isHashMatch() const; + void setIsHashMatch(bool newIsHashMatch); - -signals: - void threeLetterISOLanguageNameChanged(QString newThreeLetterISOLanguageName); - void jellyfinIdChanged(QString newJellyfinId); - void providerNameChanged(QString newProviderName); - void nameChanged(QString newName); - void formatChanged(QString newFormat); - void authorChanged(QString newAuthor); - void commentChanged(QString newComment); - void dateCreatedChanged(QDateTime newDateCreated); - void communityRatingChanged(float newCommunityRating); - void downloadCountChanged(qint32 newDownloadCount); - void isHashMatchChanged(bool newIsHashMatch); + protected: QString m_threeLetterISOLanguageName; QString m_jellyfinId; @@ -117,6 +109,18 @@ protected: bool m_isHashMatch; }; +} // NS DTO + +namespace Support { + +using RemoteSubtitleInfo = Jellyfin::DTO::RemoteSubtitleInfo; + +template <> +RemoteSubtitleInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return RemoteSubtitleInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/removefromplaylistrequestdto.h b/core/include/JellyfinQt/DTO/removefromplaylistrequestdto.h index 9d38cd9..bcd668f 100644 --- a/core/include/JellyfinQt/DTO/removefromplaylistrequestdto.h +++ b/core/include/JellyfinQt/DTO/removefromplaylistrequestdto.h @@ -31,36 +31,51 @@ #define JELLYFIN_DTO_REMOVEFROMPLAYLISTREQUESTDTO_H #include +#include #include -#include -#include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class RemoveFromPlaylistRequestDto : public QObject { - Q_OBJECT -public: - explicit RemoveFromPlaylistRequestDto(QObject *parent = nullptr); - static RemoveFromPlaylistRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class RemoveFromPlaylistRequestDto { +public: + explicit RemoveFromPlaylistRequestDto(); + static RemoveFromPlaylistRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the playlist identifiers ot the items. */ - Q_PROPERTY(QStringList playlistItemIds READ playlistItemIds WRITE setPlaylistItemIds NOTIFY playlistItemIdsChanged) + QList playlistItemIds() const; + /** + * @brief Gets or sets the playlist identifiers ot the items. + */ + void setPlaylistItemIds(QList newPlaylistItemIds); - QStringList playlistItemIds() const; - void setPlaylistItemIds(QStringList newPlaylistItemIds); - -signals: - void playlistItemIdsChanged(QStringList newPlaylistItemIds); protected: - QStringList m_playlistItemIds; + QList m_playlistItemIds; }; +} // NS DTO + +namespace Support { + +using RemoveFromPlaylistRequestDto = Jellyfin::DTO::RemoveFromPlaylistRequestDto; + +template <> +RemoveFromPlaylistRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return RemoveFromPlaylistRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/repeatmode.h b/core/include/JellyfinQt/DTO/repeatmode.h index 9075d42..099d1c7 100644 --- a/core/include/JellyfinQt/DTO/repeatmode.h +++ b/core/include/JellyfinQt/DTO/repeatmode.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_REPEATMODE_H #define JELLYFIN_DTO_REPEATMODE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class RepeatModeClass { Q_GADGET public: enum Value { + EnumNotSet, RepeatNone, RepeatAll, RepeatOne, @@ -47,8 +52,34 @@ public: private: explicit RepeatModeClass(); }; + typedef RepeatModeClass::Value RepeatMode; +} // NS DTO + +namespace Support { + +using RepeatMode = Jellyfin::DTO::RepeatMode; +using RepeatModeClass = Jellyfin::DTO::RepeatModeClass; + +template <> +RepeatMode fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return RepeatModeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("RepeatNone")) { + return RepeatModeClass::RepeatNone; + } + if (str == QStringLiteral("RepeatAll")) { + return RepeatModeClass::RepeatAll; + } + if (str == QStringLiteral("RepeatOne")) { + return RepeatModeClass::RepeatOne; + } + + return RepeatModeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/repositoryinfo.h b/core/include/JellyfinQt/DTO/repositoryinfo.h index ebcd85c..ddceef2 100644 --- a/core/include/JellyfinQt/DTO/repositoryinfo.h +++ b/core/include/JellyfinQt/DTO/repositoryinfo.h @@ -31,52 +31,67 @@ #define JELLYFIN_DTO_REPOSITORYINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class RepositoryInfo : public QObject { - Q_OBJECT -public: - explicit RepositoryInfo(QObject *parent = nullptr); - static RepositoryInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class RepositoryInfo { +public: + explicit RepositoryInfo(); + static RepositoryInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the URL. */ - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) + QString url() const; + /** + * @brief Gets or sets the URL. + */ + void setUrl(QString newUrl); /** * @brief Gets or sets a value indicating whether the repository is enabled. */ - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - - QString name() const; - void setName(QString newName); - - QString url() const; - void setUrl(QString newUrl); - bool enabled() const; + /** + * @brief Gets or sets a value indicating whether the repository is enabled. + */ void setEnabled(bool newEnabled); - -signals: - void nameChanged(QString newName); - void urlChanged(QString newUrl); - void enabledChanged(bool newEnabled); + protected: QString m_name; QString m_url; bool m_enabled; }; +} // NS DTO + +namespace Support { + +using RepositoryInfo = Jellyfin::DTO::RepositoryInfo; + +template <> +RepositoryInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return RepositoryInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/responseprofile.h b/core/include/JellyfinQt/DTO/responseprofile.h index ce1aec4..025bf33 100644 --- a/core/include/JellyfinQt/DTO/responseprofile.h +++ b/core/include/JellyfinQt/DTO/responseprofile.h @@ -31,63 +31,58 @@ #define JELLYFIN_DTO_RESPONSEPROFILE_H #include +#include #include -#include +#include #include #include +#include #include "JellyfinQt/DTO/dlnaprofiletype.h" +#include "JellyfinQt/DTO/profilecondition.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ProfileCondition; -class ResponseProfile : public QObject { - Q_OBJECT +class ResponseProfile { public: - explicit ResponseProfile(QObject *parent = nullptr); - static ResponseProfile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) - Q_PROPERTY(QString audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged) - Q_PROPERTY(QString videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged) - Q_PROPERTY(DlnaProfileType type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QString orgPn READ orgPn WRITE setOrgPn NOTIFY orgPnChanged) - Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType NOTIFY mimeTypeChanged) - Q_PROPERTY(QList conditions READ conditions WRITE setConditions NOTIFY conditionsChanged) + explicit ResponseProfile(); + static ResponseProfile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString container() const; + void setContainer(QString newContainer); - + QString audioCodec() const; + void setAudioCodec(QString newAudioCodec); - + QString videoCodec() const; + void setVideoCodec(QString newVideoCodec); - + DlnaProfileType type() const; + void setType(DlnaProfileType newType); - + QString orgPn() const; + void setOrgPn(QString newOrgPn); - + QString mimeType() const; + void setMimeType(QString newMimeType); - - QList conditions() const; - void setConditions(QList newConditions); - -signals: - void containerChanged(QString newContainer); - void audioCodecChanged(QString newAudioCodec); - void videoCodecChanged(QString newVideoCodec); - void typeChanged(DlnaProfileType newType); - void orgPnChanged(QString newOrgPn); - void mimeTypeChanged(QString newMimeType); - void conditionsChanged(QList newConditions); + + QList> conditions() const; + + void setConditions(QList> newConditions); + protected: QString m_container; QString m_audioCodec; @@ -95,9 +90,21 @@ protected: DlnaProfileType m_type; QString m_orgPn; QString m_mimeType; - QList m_conditions; + QList> m_conditions; }; +} // NS DTO + +namespace Support { + +using ResponseProfile = Jellyfin::DTO::ResponseProfile; + +template <> +ResponseProfile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ResponseProfile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/scrolldirection.h b/core/include/JellyfinQt/DTO/scrolldirection.h index a62f7b2..1c90464 100644 --- a/core/include/JellyfinQt/DTO/scrolldirection.h +++ b/core/include/JellyfinQt/DTO/scrolldirection.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_SCROLLDIRECTION_H #define JELLYFIN_DTO_SCROLLDIRECTION_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class ScrollDirectionClass { Q_GADGET public: enum Value { + EnumNotSet, Horizontal, Vertical, }; @@ -46,8 +51,31 @@ public: private: explicit ScrollDirectionClass(); }; + typedef ScrollDirectionClass::Value ScrollDirection; +} // NS DTO + +namespace Support { + +using ScrollDirection = Jellyfin::DTO::ScrollDirection; +using ScrollDirectionClass = Jellyfin::DTO::ScrollDirectionClass; + +template <> +ScrollDirection fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return ScrollDirectionClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Horizontal")) { + return ScrollDirectionClass::Horizontal; + } + if (str == QStringLiteral("Vertical")) { + return ScrollDirectionClass::Vertical; + } + + return ScrollDirectionClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/searchhint.h b/core/include/JellyfinQt/DTO/searchhint.h index 85425c8..76e0ad4 100644 --- a/core/include/JellyfinQt/DTO/searchhint.h +++ b/core/include/JellyfinQt/DTO/searchhint.h @@ -32,241 +32,239 @@ #include #include +#include #include -#include #include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SearchHint : public QObject { - Q_OBJECT -public: - explicit SearchHint(QObject *parent = nullptr); - static SearchHint *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SearchHint { +public: + explicit SearchHint(); + static SearchHint fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the item id. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QUuid itemId() const; + /** + * @brief Gets or sets the item id. + */ + void setItemId(QUuid newItemId); + + QUuid jellyfinId() const; + + void setJellyfinId(QUuid newJellyfinId); /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the matched term. */ - Q_PROPERTY(QString matchedTerm READ matchedTerm WRITE setMatchedTerm NOTIFY matchedTermChanged) + QString matchedTerm() const; + /** + * @brief Gets or sets the matched term. + */ + void setMatchedTerm(QString newMatchedTerm); /** * @brief Gets or sets the index number. */ - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) + qint32 indexNumber() const; + /** + * @brief Gets or sets the index number. + */ + void setIndexNumber(qint32 newIndexNumber); /** * @brief Gets or sets the production year. */ - Q_PROPERTY(qint32 productionYear READ productionYear WRITE setProductionYear NOTIFY productionYearChanged) + qint32 productionYear() const; + /** + * @brief Gets or sets the production year. + */ + void setProductionYear(qint32 newProductionYear); /** * @brief Gets or sets the parent index number. */ - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) + qint32 parentIndexNumber() const; + /** + * @brief Gets or sets the parent index number. + */ + void setParentIndexNumber(qint32 newParentIndexNumber); /** * @brief Gets or sets the image tag. */ - Q_PROPERTY(QString primaryImageTag READ primaryImageTag WRITE setPrimaryImageTag NOTIFY primaryImageTagChanged) + QString primaryImageTag() const; + /** + * @brief Gets or sets the image tag. + */ + void setPrimaryImageTag(QString newPrimaryImageTag); /** * @brief Gets or sets the thumb image tag. */ - Q_PROPERTY(QString thumbImageTag READ thumbImageTag WRITE setThumbImageTag NOTIFY thumbImageTagChanged) + QString thumbImageTag() const; + /** + * @brief Gets or sets the thumb image tag. + */ + void setThumbImageTag(QString newThumbImageTag); /** * @brief Gets or sets the thumb image item identifier. */ - Q_PROPERTY(QString thumbImageItemId READ thumbImageItemId WRITE setThumbImageItemId NOTIFY thumbImageItemIdChanged) + QString thumbImageItemId() const; + /** + * @brief Gets or sets the thumb image item identifier. + */ + void setThumbImageItemId(QString newThumbImageItemId); /** * @brief Gets or sets the backdrop image tag. */ - Q_PROPERTY(QString backdropImageTag READ backdropImageTag WRITE setBackdropImageTag NOTIFY backdropImageTagChanged) + QString backdropImageTag() const; + /** + * @brief Gets or sets the backdrop image tag. + */ + void setBackdropImageTag(QString newBackdropImageTag); /** * @brief Gets or sets the backdrop image item identifier. */ - Q_PROPERTY(QString backdropImageItemId READ backdropImageItemId WRITE setBackdropImageItemId NOTIFY backdropImageItemIdChanged) + QString backdropImageItemId() const; + /** + * @brief Gets or sets the backdrop image item identifier. + */ + void setBackdropImageItemId(QString newBackdropImageItemId); /** * @brief Gets or sets the type. */ - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(bool isFolder READ isFolder WRITE setIsFolder NOTIFY isFolderChanged) + QString type() const; + /** + * @brief Gets or sets the type. + */ + void setType(QString newType); + + bool isFolder() const; + + void setIsFolder(bool newIsFolder); /** * @brief Gets or sets the run time ticks. */ - Q_PROPERTY(qint64 runTimeTicks READ runTimeTicks WRITE setRunTimeTicks NOTIFY runTimeTicksChanged) + qint64 runTimeTicks() const; + /** + * @brief Gets or sets the run time ticks. + */ + void setRunTimeTicks(qint64 newRunTimeTicks); /** * @brief Gets or sets the type of the media. */ - Q_PROPERTY(QString mediaType READ mediaType WRITE setMediaType NOTIFY mediaTypeChanged) - Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged) - Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged) + QString mediaType() const; + /** + * @brief Gets or sets the type of the media. + */ + void setMediaType(QString newMediaType); + + QDateTime startDate() const; + + void setStartDate(QDateTime newStartDate); + + QDateTime endDate() const; + + void setEndDate(QDateTime newEndDate); /** * @brief Gets or sets the series. */ - Q_PROPERTY(QString series READ series WRITE setSeries NOTIFY seriesChanged) - Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged) + QString series() const; + /** + * @brief Gets or sets the series. + */ + void setSeries(QString newSeries); + + QString status() const; + + void setStatus(QString newStatus); /** * @brief Gets or sets the album. */ - Q_PROPERTY(QString album READ album WRITE setAlbum NOTIFY albumChanged) - Q_PROPERTY(QString albumId READ albumId WRITE setAlbumId NOTIFY albumIdChanged) + QString album() const; + /** + * @brief Gets or sets the album. + */ + void setAlbum(QString newAlbum); + + QUuid albumId() const; + + void setAlbumId(QUuid newAlbumId); /** * @brief Gets or sets the album artist. */ - Q_PROPERTY(QString albumArtist READ albumArtist WRITE setAlbumArtist NOTIFY albumArtistChanged) + QString albumArtist() const; + /** + * @brief Gets or sets the album artist. + */ + void setAlbumArtist(QString newAlbumArtist); /** * @brief Gets or sets the artists. */ - Q_PROPERTY(QStringList artists READ artists WRITE setArtists NOTIFY artistsChanged) + QStringList artists() const; + /** + * @brief Gets or sets the artists. + */ + void setArtists(QStringList newArtists); /** * @brief Gets or sets the song count. */ - Q_PROPERTY(qint32 songCount READ songCount WRITE setSongCount NOTIFY songCountChanged) + qint32 songCount() const; + /** + * @brief Gets or sets the song count. + */ + void setSongCount(qint32 newSongCount); /** * @brief Gets or sets the episode count. */ - Q_PROPERTY(qint32 episodeCount READ episodeCount WRITE setEpisodeCount NOTIFY episodeCountChanged) + qint32 episodeCount() const; + /** + * @brief Gets or sets the episode count. + */ + void setEpisodeCount(qint32 newEpisodeCount); /** * @brief Gets or sets the channel identifier. */ - Q_PROPERTY(QString channelId READ channelId WRITE setChannelId NOTIFY channelIdChanged) + QUuid channelId() const; + /** + * @brief Gets or sets the channel identifier. + */ + void setChannelId(QUuid newChannelId); /** * @brief Gets or sets the name of the channel. */ - Q_PROPERTY(QString channelName READ channelName WRITE setChannelName NOTIFY channelNameChanged) + QString channelName() const; + /** + * @brief Gets or sets the name of the channel. + */ + void setChannelName(QString newChannelName); /** * @brief Gets or sets the primary image aspect ratio. */ - Q_PROPERTY(double primaryImageAspectRatio READ primaryImageAspectRatio WRITE setPrimaryImageAspectRatio NOTIFY primaryImageAspectRatioChanged) - - QString itemId() const; - void setItemId(QString newItemId); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString name() const; - void setName(QString newName); - - QString matchedTerm() const; - void setMatchedTerm(QString newMatchedTerm); - - qint32 indexNumber() const; - void setIndexNumber(qint32 newIndexNumber); - - qint32 productionYear() const; - void setProductionYear(qint32 newProductionYear); - - qint32 parentIndexNumber() const; - void setParentIndexNumber(qint32 newParentIndexNumber); - - QString primaryImageTag() const; - void setPrimaryImageTag(QString newPrimaryImageTag); - - QString thumbImageTag() const; - void setThumbImageTag(QString newThumbImageTag); - - QString thumbImageItemId() const; - void setThumbImageItemId(QString newThumbImageItemId); - - QString backdropImageTag() const; - void setBackdropImageTag(QString newBackdropImageTag); - - QString backdropImageItemId() const; - void setBackdropImageItemId(QString newBackdropImageItemId); - - QString type() const; - void setType(QString newType); - - bool isFolder() const; - void setIsFolder(bool newIsFolder); - - qint64 runTimeTicks() const; - void setRunTimeTicks(qint64 newRunTimeTicks); - - QString mediaType() const; - void setMediaType(QString newMediaType); - - QDateTime startDate() const; - void setStartDate(QDateTime newStartDate); - - QDateTime endDate() const; - void setEndDate(QDateTime newEndDate); - - QString series() const; - void setSeries(QString newSeries); - - QString status() const; - void setStatus(QString newStatus); - - QString album() const; - void setAlbum(QString newAlbum); - - QString albumId() const; - void setAlbumId(QString newAlbumId); - - QString albumArtist() const; - void setAlbumArtist(QString newAlbumArtist); - - QStringList artists() const; - void setArtists(QStringList newArtists); - - qint32 songCount() const; - void setSongCount(qint32 newSongCount); - - qint32 episodeCount() const; - void setEpisodeCount(qint32 newEpisodeCount); - - QString channelId() const; - void setChannelId(QString newChannelId); - - QString channelName() const; - void setChannelName(QString newChannelName); - double primaryImageAspectRatio() const; + /** + * @brief Gets or sets the primary image aspect ratio. + */ void setPrimaryImageAspectRatio(double newPrimaryImageAspectRatio); - -signals: - void itemIdChanged(QString newItemId); - void jellyfinIdChanged(QString newJellyfinId); - void nameChanged(QString newName); - void matchedTermChanged(QString newMatchedTerm); - void indexNumberChanged(qint32 newIndexNumber); - void productionYearChanged(qint32 newProductionYear); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void primaryImageTagChanged(QString newPrimaryImageTag); - void thumbImageTagChanged(QString newThumbImageTag); - void thumbImageItemIdChanged(QString newThumbImageItemId); - void backdropImageTagChanged(QString newBackdropImageTag); - void backdropImageItemIdChanged(QString newBackdropImageItemId); - void typeChanged(QString newType); - void isFolderChanged(bool newIsFolder); - void runTimeTicksChanged(qint64 newRunTimeTicks); - void mediaTypeChanged(QString newMediaType); - void startDateChanged(QDateTime newStartDate); - void endDateChanged(QDateTime newEndDate); - void seriesChanged(QString newSeries); - void statusChanged(QString newStatus); - void albumChanged(QString newAlbum); - void albumIdChanged(QString newAlbumId); - void albumArtistChanged(QString newAlbumArtist); - void artistsChanged(QStringList newArtists); - void songCountChanged(qint32 newSongCount); - void episodeCountChanged(qint32 newEpisodeCount); - void channelIdChanged(QString newChannelId); - void channelNameChanged(QString newChannelName); - void primaryImageAspectRatioChanged(double newPrimaryImageAspectRatio); + protected: - QString m_itemId; - QString m_jellyfinId; + QUuid m_itemId; + QUuid m_jellyfinId; QString m_name; QString m_matchedTerm; qint32 m_indexNumber; @@ -286,16 +284,28 @@ protected: QString m_series; QString m_status; QString m_album; - QString m_albumId; + QUuid m_albumId; QString m_albumArtist; QStringList m_artists; qint32 m_songCount; qint32 m_episodeCount; - QString m_channelId; + QUuid m_channelId; QString m_channelName; double m_primaryImageAspectRatio; }; +} // NS DTO + +namespace Support { + +using SearchHint = Jellyfin::DTO::SearchHint; + +template <> +SearchHint fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SearchHint::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/searchhintresult.h b/core/include/JellyfinQt/DTO/searchhintresult.h index b03676c..74c9f05 100644 --- a/core/include/JellyfinQt/DTO/searchhintresult.h +++ b/core/include/JellyfinQt/DTO/searchhintresult.h @@ -31,46 +31,61 @@ #define JELLYFIN_DTO_SEARCHHINTRESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/searchhint.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SearchHint; -class SearchHintResult : public QObject { - Q_OBJECT +class SearchHintResult { public: - explicit SearchHintResult(QObject *parent = nullptr); - static SearchHintResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit SearchHintResult(); + static SearchHintResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the search hints. */ - Q_PROPERTY(QList searchHints READ searchHints WRITE setSearchHints NOTIFY searchHintsChanged) + QList> searchHints() const; + /** + * @brief Gets or sets the search hints. + */ + void setSearchHints(QList> newSearchHints); /** * @brief Gets or sets the total record count. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) - - QList searchHints() const; - void setSearchHints(QList newSearchHints); - qint32 totalRecordCount() const; + /** + * @brief Gets or sets the total record count. + */ void setTotalRecordCount(qint32 newTotalRecordCount); - -signals: - void searchHintsChanged(QList newSearchHints); - void totalRecordCountChanged(qint32 newTotalRecordCount); + protected: - QList m_searchHints; + QList> m_searchHints; qint32 m_totalRecordCount; }; +} // NS DTO + +namespace Support { + +using SearchHintResult = Jellyfin::DTO::SearchHintResult; + +template <> +SearchHintResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SearchHintResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/seekrequestdto.h b/core/include/JellyfinQt/DTO/seekrequestdto.h index 46a0e78..5739ee8 100644 --- a/core/include/JellyfinQt/DTO/seekrequestdto.h +++ b/core/include/JellyfinQt/DTO/seekrequestdto.h @@ -31,33 +31,48 @@ #define JELLYFIN_DTO_SEEKREQUESTDTO_H #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SeekRequestDto : public QObject { - Q_OBJECT -public: - explicit SeekRequestDto(QObject *parent = nullptr); - static SeekRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SeekRequestDto { +public: + explicit SeekRequestDto(); + static SeekRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) - qint64 positionTicks() const; + /** + * @brief Gets or sets the position ticks. + */ void setPositionTicks(qint64 newPositionTicks); - -signals: - void positionTicksChanged(qint64 newPositionTicks); + protected: qint64 m_positionTicks; }; +} // NS DTO + +namespace Support { + +using SeekRequestDto = Jellyfin::DTO::SeekRequestDto; + +template <> +SeekRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SeekRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/sendcommand.h b/core/include/JellyfinQt/DTO/sendcommand.h index cca3302..8d80a3d 100644 --- a/core/include/JellyfinQt/DTO/sendcommand.h +++ b/core/include/JellyfinQt/DTO/sendcommand.h @@ -32,78 +32,91 @@ #include #include -#include -#include +#include +#include +#include #include "JellyfinQt/DTO/sendcommandtype.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SendCommand : public QObject { - Q_OBJECT -public: - explicit SendCommand(QObject *parent = nullptr); - static SendCommand *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SendCommand { +public: + explicit SendCommand(); + static SendCommand fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the group identifier. */ - Q_PROPERTY(QString groupId READ groupId WRITE setGroupId NOTIFY groupIdChanged) + QUuid groupId() const; + /** + * @brief Gets the group identifier. + */ + void setGroupId(QUuid newGroupId); /** * @brief Gets the playlist identifier of the playing item. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QUuid playlistItemId() const; + /** + * @brief Gets the playlist identifier of the playing item. + */ + void setPlaylistItemId(QUuid newPlaylistItemId); /** * @brief Gets or sets the UTC time when to execute the command. */ - Q_PROPERTY(QDateTime when READ when WRITE setWhen NOTIFY whenChanged) + QDateTime when() const; + /** + * @brief Gets or sets the UTC time when to execute the command. + */ + void setWhen(QDateTime newWhen); /** * @brief Gets the position ticks. */ - Q_PROPERTY(qint64 positionTicks READ positionTicks WRITE setPositionTicks NOTIFY positionTicksChanged) - Q_PROPERTY(SendCommandType command READ command WRITE setCommand NOTIFY commandChanged) + qint64 positionTicks() const; + /** + * @brief Gets the position ticks. + */ + void setPositionTicks(qint64 newPositionTicks); + + SendCommandType command() const; + + void setCommand(SendCommandType newCommand); /** * @brief Gets the UTC time when this command has been emitted. */ - Q_PROPERTY(QDateTime emittedAt READ emittedAt WRITE setEmittedAt NOTIFY emittedAtChanged) - - QString groupId() const; - void setGroupId(QString newGroupId); - - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - - QDateTime when() const; - void setWhen(QDateTime newWhen); - - qint64 positionTicks() const; - void setPositionTicks(qint64 newPositionTicks); - - SendCommandType command() const; - void setCommand(SendCommandType newCommand); - QDateTime emittedAt() const; + /** + * @brief Gets the UTC time when this command has been emitted. + */ void setEmittedAt(QDateTime newEmittedAt); - -signals: - void groupIdChanged(QString newGroupId); - void playlistItemIdChanged(QString newPlaylistItemId); - void whenChanged(QDateTime newWhen); - void positionTicksChanged(qint64 newPositionTicks); - void commandChanged(SendCommandType newCommand); - void emittedAtChanged(QDateTime newEmittedAt); + protected: - QString m_groupId; - QString m_playlistItemId; + QUuid m_groupId; + QUuid m_playlistItemId; QDateTime m_when; qint64 m_positionTicks; SendCommandType m_command; QDateTime m_emittedAt; }; +} // NS DTO + +namespace Support { + +using SendCommand = Jellyfin::DTO::SendCommand; + +template <> +SendCommand fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SendCommand::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/sendcommandtype.h b/core/include/JellyfinQt/DTO/sendcommandtype.h index 9290bf5..66e18f7 100644 --- a/core/include/JellyfinQt/DTO/sendcommandtype.h +++ b/core/include/JellyfinQt/DTO/sendcommandtype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_SENDCOMMANDTYPE_H #define JELLYFIN_DTO_SENDCOMMANDTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class SendCommandTypeClass { Q_GADGET public: enum Value { + EnumNotSet, Unpause, Pause, Stop, @@ -48,8 +53,37 @@ public: private: explicit SendCommandTypeClass(); }; + typedef SendCommandTypeClass::Value SendCommandType; +} // NS DTO + +namespace Support { + +using SendCommandType = Jellyfin::DTO::SendCommandType; +using SendCommandTypeClass = Jellyfin::DTO::SendCommandTypeClass; + +template <> +SendCommandType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return SendCommandTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Unpause")) { + return SendCommandTypeClass::Unpause; + } + if (str == QStringLiteral("Pause")) { + return SendCommandTypeClass::Pause; + } + if (str == QStringLiteral("Stop")) { + return SendCommandTypeClass::Stop; + } + if (str == QStringLiteral("Seek")) { + return SendCommandTypeClass::Seek; + } + + return SendCommandTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/seriesinfo.h b/core/include/JellyfinQt/DTO/seriesinfo.h index 45f7ce7..3543aaf 100644 --- a/core/include/JellyfinQt/DTO/seriesinfo.h +++ b/core/include/JellyfinQt/DTO/seriesinfo.h @@ -32,90 +32,89 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SeriesInfo : public QObject { - Q_OBJECT -public: - explicit SeriesInfo(QObject *parent = nullptr); - static SeriesInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SeriesInfo { +public: + explicit SeriesInfo(); + static SeriesInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); + protected: QString m_name; QString m_path; @@ -129,6 +128,18 @@ protected: bool m_isAutomated; }; +} // NS DTO + +namespace Support { + +using SeriesInfo = Jellyfin::DTO::SeriesInfo; + +template <> +SeriesInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SeriesInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/seriesinforemotesearchquery.h b/core/include/JellyfinQt/DTO/seriesinforemotesearchquery.h index 829d585..e08cd6f 100644 --- a/core/include/JellyfinQt/DTO/seriesinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/seriesinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_SERIESINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/seriesinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SeriesInfo; -class SeriesInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class SeriesInfoRemoteSearchQuery { public: - explicit SeriesInfoRemoteSearchQuery(QObject *parent = nullptr); - static SeriesInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit SeriesInfoRemoteSearchQuery(); + static SeriesInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(SeriesInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - SeriesInfo * searchInfo() const; - void setSearchInfo(SeriesInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(SeriesInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - SeriesInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using SeriesInfoRemoteSearchQuery = Jellyfin::DTO::SeriesInfoRemoteSearchQuery; + +template <> +SeriesInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SeriesInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/seriesstatus.h b/core/include/JellyfinQt/DTO/seriesstatus.h index ef8eceb..906353a 100644 --- a/core/include/JellyfinQt/DTO/seriesstatus.h +++ b/core/include/JellyfinQt/DTO/seriesstatus.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_SERIESSTATUS_H #define JELLYFIN_DTO_SERIESSTATUS_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class SeriesStatusClass { Q_GADGET public: enum Value { + EnumNotSet, Continuing, Ended, }; @@ -46,8 +51,31 @@ public: private: explicit SeriesStatusClass(); }; + typedef SeriesStatusClass::Value SeriesStatus; +} // NS DTO + +namespace Support { + +using SeriesStatus = Jellyfin::DTO::SeriesStatus; +using SeriesStatusClass = Jellyfin::DTO::SeriesStatusClass; + +template <> +SeriesStatus fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return SeriesStatusClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Continuing")) { + return SeriesStatusClass::Continuing; + } + if (str == QStringLiteral("Ended")) { + return SeriesStatusClass::Ended; + } + + return SeriesStatusClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/seriestimerinfodto.h b/core/include/JellyfinQt/DTO/seriestimerinfodto.h index e70266e..6f04be0 100644 --- a/core/include/JellyfinQt/DTO/seriestimerinfodto.h +++ b/core/include/JellyfinQt/DTO/seriestimerinfodto.h @@ -32,296 +32,293 @@ #include #include +#include #include -#include #include #include +#include +#include #include "JellyfinQt/DTO/dayofweek.h" #include "JellyfinQt/DTO/daypattern.h" #include "JellyfinQt/DTO/keepuntil.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SeriesTimerInfoDto : public QObject { - Q_OBJECT -public: - explicit SeriesTimerInfoDto(QObject *parent = nullptr); - static SeriesTimerInfoDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SeriesTimerInfoDto { +public: + explicit SeriesTimerInfoDto(); + static SeriesTimerInfoDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Id of the recording. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + QString jellyfinId() const; + /** + * @brief Id of the recording. + */ + void setJellyfinId(QString newJellyfinId); + + QString type() const; + + void setType(QString newType); /** * @brief Gets or sets the server identifier. */ - Q_PROPERTY(QString serverId READ serverId WRITE setServerId NOTIFY serverIdChanged) + QString serverId() const; + /** + * @brief Gets or sets the server identifier. + */ + void setServerId(QString newServerId); /** * @brief Gets or sets the external identifier. */ - Q_PROPERTY(QString externalId READ externalId WRITE setExternalId NOTIFY externalIdChanged) + QString externalId() const; + /** + * @brief Gets or sets the external identifier. + */ + void setExternalId(QString newExternalId); /** * @brief ChannelId of the recording. */ - Q_PROPERTY(QString channelId READ channelId WRITE setChannelId NOTIFY channelIdChanged) + QUuid channelId() const; + /** + * @brief ChannelId of the recording. + */ + void setChannelId(QUuid newChannelId); /** * @brief Gets or sets the external channel identifier. */ - Q_PROPERTY(QString externalChannelId READ externalChannelId WRITE setExternalChannelId NOTIFY externalChannelIdChanged) + QString externalChannelId() const; + /** + * @brief Gets or sets the external channel identifier. + */ + void setExternalChannelId(QString newExternalChannelId); /** * @brief ChannelName of the recording. */ - Q_PROPERTY(QString channelName READ channelName WRITE setChannelName NOTIFY channelNameChanged) - Q_PROPERTY(QString channelPrimaryImageTag READ channelPrimaryImageTag WRITE setChannelPrimaryImageTag NOTIFY channelPrimaryImageTagChanged) + QString channelName() const; + /** + * @brief ChannelName of the recording. + */ + void setChannelName(QString newChannelName); + + QString channelPrimaryImageTag() const; + + void setChannelPrimaryImageTag(QString newChannelPrimaryImageTag); /** * @brief Gets or sets the program identifier. */ - Q_PROPERTY(QString programId READ programId WRITE setProgramId NOTIFY programIdChanged) + QString programId() const; + /** + * @brief Gets or sets the program identifier. + */ + void setProgramId(QString newProgramId); /** * @brief Gets or sets the external program identifier. */ - Q_PROPERTY(QString externalProgramId READ externalProgramId WRITE setExternalProgramId NOTIFY externalProgramIdChanged) + QString externalProgramId() const; + /** + * @brief Gets or sets the external program identifier. + */ + void setExternalProgramId(QString newExternalProgramId); /** * @brief Name of the recording. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Name of the recording. + */ + void setName(QString newName); /** * @brief Description of the recording. */ - Q_PROPERTY(QString overview READ overview WRITE setOverview NOTIFY overviewChanged) + QString overview() const; + /** + * @brief Description of the recording. + */ + void setOverview(QString newOverview); /** * @brief The start date of the recording, in UTC. */ - Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged) + QDateTime startDate() const; + /** + * @brief The start date of the recording, in UTC. + */ + void setStartDate(QDateTime newStartDate); /** * @brief The end date of the recording, in UTC. */ - Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged) + QDateTime endDate() const; + /** + * @brief The end date of the recording, in UTC. + */ + void setEndDate(QDateTime newEndDate); /** * @brief Gets or sets the name of the service. */ - Q_PROPERTY(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged) + QString serviceName() const; + /** + * @brief Gets or sets the name of the service. + */ + void setServiceName(QString newServiceName); /** * @brief Gets or sets the priority. */ - Q_PROPERTY(qint32 priority READ priority WRITE setPriority NOTIFY priorityChanged) + qint32 priority() const; + /** + * @brief Gets or sets the priority. + */ + void setPriority(qint32 newPriority); /** * @brief Gets or sets the pre padding seconds. */ - Q_PROPERTY(qint32 prePaddingSeconds READ prePaddingSeconds WRITE setPrePaddingSeconds NOTIFY prePaddingSecondsChanged) + qint32 prePaddingSeconds() const; + /** + * @brief Gets or sets the pre padding seconds. + */ + void setPrePaddingSeconds(qint32 newPrePaddingSeconds); /** * @brief Gets or sets the post padding seconds. */ - Q_PROPERTY(qint32 postPaddingSeconds READ postPaddingSeconds WRITE setPostPaddingSeconds NOTIFY postPaddingSecondsChanged) + qint32 postPaddingSeconds() const; + /** + * @brief Gets or sets the post padding seconds. + */ + void setPostPaddingSeconds(qint32 newPostPaddingSeconds); /** * @brief Gets or sets a value indicating whether this instance is pre padding required. */ - Q_PROPERTY(bool isPrePaddingRequired READ isPrePaddingRequired WRITE setIsPrePaddingRequired NOTIFY isPrePaddingRequiredChanged) + bool isPrePaddingRequired() const; + /** + * @brief Gets or sets a value indicating whether this instance is pre padding required. + */ + void setIsPrePaddingRequired(bool newIsPrePaddingRequired); /** * @brief If the item does not have any backdrops, this will hold the Id of the Parent that has one. */ - Q_PROPERTY(QString parentBackdropItemId READ parentBackdropItemId WRITE setParentBackdropItemId NOTIFY parentBackdropItemIdChanged) + QString parentBackdropItemId() const; + /** + * @brief If the item does not have any backdrops, this will hold the Id of the Parent that has one. + */ + void setParentBackdropItemId(QString newParentBackdropItemId); /** * @brief Gets or sets the parent backdrop image tags. */ - Q_PROPERTY(QStringList parentBackdropImageTags READ parentBackdropImageTags WRITE setParentBackdropImageTags NOTIFY parentBackdropImageTagsChanged) + QStringList parentBackdropImageTags() const; + /** + * @brief Gets or sets the parent backdrop image tags. + */ + void setParentBackdropImageTags(QStringList newParentBackdropImageTags); /** * @brief Gets or sets a value indicating whether this instance is post padding required. */ - Q_PROPERTY(bool isPostPaddingRequired READ isPostPaddingRequired WRITE setIsPostPaddingRequired NOTIFY isPostPaddingRequiredChanged) - Q_PROPERTY(KeepUntil keepUntil READ keepUntil WRITE setKeepUntil NOTIFY keepUntilChanged) + bool isPostPaddingRequired() const; + /** + * @brief Gets or sets a value indicating whether this instance is post padding required. + */ + void setIsPostPaddingRequired(bool newIsPostPaddingRequired); + + KeepUntil keepUntil() const; + + void setKeepUntil(KeepUntil newKeepUntil); /** * @brief Gets or sets a value indicating whether [record any time]. */ - Q_PROPERTY(bool recordAnyTime READ recordAnyTime WRITE setRecordAnyTime NOTIFY recordAnyTimeChanged) - Q_PROPERTY(bool skipEpisodesInLibrary READ skipEpisodesInLibrary WRITE setSkipEpisodesInLibrary NOTIFY skipEpisodesInLibraryChanged) + bool recordAnyTime() const; + /** + * @brief Gets or sets a value indicating whether [record any time]. + */ + void setRecordAnyTime(bool newRecordAnyTime); + + bool skipEpisodesInLibrary() const; + + void setSkipEpisodesInLibrary(bool newSkipEpisodesInLibrary); /** * @brief Gets or sets a value indicating whether [record any channel]. */ - Q_PROPERTY(bool recordAnyChannel READ recordAnyChannel WRITE setRecordAnyChannel NOTIFY recordAnyChannelChanged) - Q_PROPERTY(qint32 keepUpTo READ keepUpTo WRITE setKeepUpTo NOTIFY keepUpToChanged) + bool recordAnyChannel() const; + /** + * @brief Gets or sets a value indicating whether [record any channel]. + */ + void setRecordAnyChannel(bool newRecordAnyChannel); + + qint32 keepUpTo() const; + + void setKeepUpTo(qint32 newKeepUpTo); /** * @brief Gets or sets a value indicating whether [record new only]. */ - Q_PROPERTY(bool recordNewOnly READ recordNewOnly WRITE setRecordNewOnly NOTIFY recordNewOnlyChanged) + bool recordNewOnly() const; + /** + * @brief Gets or sets a value indicating whether [record new only]. + */ + void setRecordNewOnly(bool newRecordNewOnly); /** * @brief Gets or sets the days. */ - Q_PROPERTY(QList days READ days WRITE setDays NOTIFY daysChanged) - Q_PROPERTY(DayPattern dayPattern READ dayPattern WRITE setDayPattern NOTIFY dayPatternChanged) + QList days() const; + /** + * @brief Gets or sets the days. + */ + void setDays(QList newDays); + + DayPattern dayPattern() const; + + void setDayPattern(DayPattern newDayPattern); /** * @brief Gets or sets the image tags. */ - Q_PROPERTY(QJsonObject imageTags READ imageTags WRITE setImageTags NOTIFY imageTagsChanged) + QJsonObject imageTags() const; + /** + * @brief Gets or sets the image tags. + */ + void setImageTags(QJsonObject newImageTags); /** * @brief Gets or sets the parent thumb item id. */ - Q_PROPERTY(QString parentThumbItemId READ parentThumbItemId WRITE setParentThumbItemId NOTIFY parentThumbItemIdChanged) + QString parentThumbItemId() const; + /** + * @brief Gets or sets the parent thumb item id. + */ + void setParentThumbItemId(QString newParentThumbItemId); /** * @brief Gets or sets the parent thumb image tag. */ - Q_PROPERTY(QString parentThumbImageTag READ parentThumbImageTag WRITE setParentThumbImageTag NOTIFY parentThumbImageTagChanged) + QString parentThumbImageTag() const; + /** + * @brief Gets or sets the parent thumb image tag. + */ + void setParentThumbImageTag(QString newParentThumbImageTag); /** * @brief Gets or sets the parent primary image item identifier. */ - Q_PROPERTY(QString parentPrimaryImageItemId READ parentPrimaryImageItemId WRITE setParentPrimaryImageItemId NOTIFY parentPrimaryImageItemIdChanged) + QString parentPrimaryImageItemId() const; + /** + * @brief Gets or sets the parent primary image item identifier. + */ + void setParentPrimaryImageItemId(QString newParentPrimaryImageItemId); /** * @brief Gets or sets the parent primary image tag. */ - Q_PROPERTY(QString parentPrimaryImageTag READ parentPrimaryImageTag WRITE setParentPrimaryImageTag NOTIFY parentPrimaryImageTagChanged) - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString type() const; - void setType(QString newType); - - QString serverId() const; - void setServerId(QString newServerId); - - QString externalId() const; - void setExternalId(QString newExternalId); - - QString channelId() const; - void setChannelId(QString newChannelId); - - QString externalChannelId() const; - void setExternalChannelId(QString newExternalChannelId); - - QString channelName() const; - void setChannelName(QString newChannelName); - - QString channelPrimaryImageTag() const; - void setChannelPrimaryImageTag(QString newChannelPrimaryImageTag); - - QString programId() const; - void setProgramId(QString newProgramId); - - QString externalProgramId() const; - void setExternalProgramId(QString newExternalProgramId); - - QString name() const; - void setName(QString newName); - - QString overview() const; - void setOverview(QString newOverview); - - QDateTime startDate() const; - void setStartDate(QDateTime newStartDate); - - QDateTime endDate() const; - void setEndDate(QDateTime newEndDate); - - QString serviceName() const; - void setServiceName(QString newServiceName); - - qint32 priority() const; - void setPriority(qint32 newPriority); - - qint32 prePaddingSeconds() const; - void setPrePaddingSeconds(qint32 newPrePaddingSeconds); - - qint32 postPaddingSeconds() const; - void setPostPaddingSeconds(qint32 newPostPaddingSeconds); - - bool isPrePaddingRequired() const; - void setIsPrePaddingRequired(bool newIsPrePaddingRequired); - - QString parentBackdropItemId() const; - void setParentBackdropItemId(QString newParentBackdropItemId); - - QStringList parentBackdropImageTags() const; - void setParentBackdropImageTags(QStringList newParentBackdropImageTags); - - bool isPostPaddingRequired() const; - void setIsPostPaddingRequired(bool newIsPostPaddingRequired); - - KeepUntil keepUntil() const; - void setKeepUntil(KeepUntil newKeepUntil); - - bool recordAnyTime() const; - void setRecordAnyTime(bool newRecordAnyTime); - - bool skipEpisodesInLibrary() const; - void setSkipEpisodesInLibrary(bool newSkipEpisodesInLibrary); - - bool recordAnyChannel() const; - void setRecordAnyChannel(bool newRecordAnyChannel); - - qint32 keepUpTo() const; - void setKeepUpTo(qint32 newKeepUpTo); - - bool recordNewOnly() const; - void setRecordNewOnly(bool newRecordNewOnly); - - QList days() const; - void setDays(QList newDays); - - DayPattern dayPattern() const; - void setDayPattern(DayPattern newDayPattern); - - QJsonObject imageTags() const; - void setImageTags(QJsonObject newImageTags); - - QString parentThumbItemId() const; - void setParentThumbItemId(QString newParentThumbItemId); - - QString parentThumbImageTag() const; - void setParentThumbImageTag(QString newParentThumbImageTag); - - QString parentPrimaryImageItemId() const; - void setParentPrimaryImageItemId(QString newParentPrimaryImageItemId); - QString parentPrimaryImageTag() const; + /** + * @brief Gets or sets the parent primary image tag. + */ void setParentPrimaryImageTag(QString newParentPrimaryImageTag); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void typeChanged(QString newType); - void serverIdChanged(QString newServerId); - void externalIdChanged(QString newExternalId); - void channelIdChanged(QString newChannelId); - void externalChannelIdChanged(QString newExternalChannelId); - void channelNameChanged(QString newChannelName); - void channelPrimaryImageTagChanged(QString newChannelPrimaryImageTag); - void programIdChanged(QString newProgramId); - void externalProgramIdChanged(QString newExternalProgramId); - void nameChanged(QString newName); - void overviewChanged(QString newOverview); - void startDateChanged(QDateTime newStartDate); - void endDateChanged(QDateTime newEndDate); - void serviceNameChanged(QString newServiceName); - void priorityChanged(qint32 newPriority); - void prePaddingSecondsChanged(qint32 newPrePaddingSeconds); - void postPaddingSecondsChanged(qint32 newPostPaddingSeconds); - void isPrePaddingRequiredChanged(bool newIsPrePaddingRequired); - void parentBackdropItemIdChanged(QString newParentBackdropItemId); - void parentBackdropImageTagsChanged(QStringList newParentBackdropImageTags); - void isPostPaddingRequiredChanged(bool newIsPostPaddingRequired); - void keepUntilChanged(KeepUntil newKeepUntil); - void recordAnyTimeChanged(bool newRecordAnyTime); - void skipEpisodesInLibraryChanged(bool newSkipEpisodesInLibrary); - void recordAnyChannelChanged(bool newRecordAnyChannel); - void keepUpToChanged(qint32 newKeepUpTo); - void recordNewOnlyChanged(bool newRecordNewOnly); - void daysChanged(QList newDays); - void dayPatternChanged(DayPattern newDayPattern); - void imageTagsChanged(QJsonObject newImageTags); - void parentThumbItemIdChanged(QString newParentThumbItemId); - void parentThumbImageTagChanged(QString newParentThumbImageTag); - void parentPrimaryImageItemIdChanged(QString newParentPrimaryImageItemId); - void parentPrimaryImageTagChanged(QString newParentPrimaryImageTag); + protected: QString m_jellyfinId; QString m_type; QString m_serverId; QString m_externalId; - QString m_channelId; + QUuid m_channelId; QString m_externalChannelId; QString m_channelName; QString m_channelPrimaryImageTag; @@ -354,6 +351,18 @@ protected: QString m_parentPrimaryImageTag; }; +} // NS DTO + +namespace Support { + +using SeriesTimerInfoDto = Jellyfin::DTO::SeriesTimerInfoDto; + +template <> +SeriesTimerInfoDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SeriesTimerInfoDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/seriestimerinfodtoqueryresult.h b/core/include/JellyfinQt/DTO/seriestimerinfodtoqueryresult.h index a38e797..26b8b7e 100644 --- a/core/include/JellyfinQt/DTO/seriestimerinfodtoqueryresult.h +++ b/core/include/JellyfinQt/DTO/seriestimerinfodtoqueryresult.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_SERIESTIMERINFODTOQUERYRESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/seriestimerinfodto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SeriesTimerInfoDto; -class SeriesTimerInfoDtoQueryResult : public QObject { - Q_OBJECT +class SeriesTimerInfoDtoQueryResult { public: - explicit SeriesTimerInfoDtoQueryResult(QObject *parent = nullptr); - static SeriesTimerInfoDtoQueryResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit SeriesTimerInfoDtoQueryResult(); + static SeriesTimerInfoDtoQueryResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items. */ - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) + QList> items() const; + /** + * @brief Gets or sets the items. + */ + void setItems(QList> newItems); /** * @brief The total number of records available. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief The total number of records available. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief The index of the first record in Items. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) - - QList items() const; - void setItems(QList newItems); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - qint32 startIndex() const; + /** + * @brief The index of the first record in Items. + */ void setStartIndex(qint32 newStartIndex); - -signals: - void itemsChanged(QList newItems); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void startIndexChanged(qint32 newStartIndex); + protected: - QList m_items; + QList> m_items; qint32 m_totalRecordCount; qint32 m_startIndex; }; +} // NS DTO + +namespace Support { + +using SeriesTimerInfoDtoQueryResult = Jellyfin::DTO::SeriesTimerInfoDtoQueryResult; + +template <> +SeriesTimerInfoDtoQueryResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SeriesTimerInfoDtoQueryResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/serverconfiguration.h b/core/include/JellyfinQt/DTO/serverconfiguration.h index 0867da9..0ab3bf6 100644 --- a/core/include/JellyfinQt/DTO/serverconfiguration.h +++ b/core/include/JellyfinQt/DTO/serverconfiguration.h @@ -31,652 +31,637 @@ #define JELLYFIN_DTO_SERVERCONFIGURATION_H #include +#include #include -#include +#include #include #include +#include #include "JellyfinQt/DTO/imagesavingconvention.h" +#include "JellyfinQt/DTO/metadataoptions.h" +#include "JellyfinQt/DTO/namevaluepair.h" +#include "JellyfinQt/DTO/pathsubstitution.h" +#include "JellyfinQt/DTO/repositoryinfo.h" +#include "JellyfinQt/DTO/version.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class MetadataOptions; -class NameValuePair; -class PathSubstitution; -class RepositoryInfo; -class Version; -class ServerConfiguration : public QObject { - Q_OBJECT +class ServerConfiguration { public: - explicit ServerConfiguration(QObject *parent = nullptr); - static ServerConfiguration *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit ServerConfiguration(); + static ServerConfiguration fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the number of days we should retain log files. */ - Q_PROPERTY(qint32 logFileRetentionDays READ logFileRetentionDays WRITE setLogFileRetentionDays NOTIFY logFileRetentionDaysChanged) + qint32 logFileRetentionDays() const; + /** + * @brief Gets or sets the number of days we should retain log files. + */ + void setLogFileRetentionDays(qint32 newLogFileRetentionDays); /** * @brief Gets or sets a value indicating whether this instance is first run. */ - Q_PROPERTY(bool isStartupWizardCompleted READ isStartupWizardCompleted WRITE setIsStartupWizardCompleted NOTIFY isStartupWizardCompletedChanged) + bool isStartupWizardCompleted() const; + /** + * @brief Gets or sets a value indicating whether this instance is first run. + */ + void setIsStartupWizardCompleted(bool newIsStartupWizardCompleted); /** * @brief Gets or sets the cache path. */ - Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath NOTIFY cachePathChanged) - Q_PROPERTY(Version * previousVersion READ previousVersion WRITE setPreviousVersion NOTIFY previousVersionChanged) + QString cachePath() const; + /** + * @brief Gets or sets the cache path. + */ + void setCachePath(QString newCachePath); + + QSharedPointer previousVersion() const; + + void setPreviousVersion(QSharedPointer newPreviousVersion); /** * @brief Gets or sets the stringified PreviousVersion to be stored/loaded, because System.Version itself isn't xml-serializable. */ - Q_PROPERTY(QString previousVersionStr READ previousVersionStr WRITE setPreviousVersionStr NOTIFY previousVersionStrChanged) + QString previousVersionStr() const; + /** + * @brief Gets or sets the stringified PreviousVersion to be stored/loaded, +because System.Version itself isn't xml-serializable. + */ + void setPreviousVersionStr(QString newPreviousVersionStr); /** * @brief Gets or sets a value indicating whether to enable automatic port forwarding. */ - Q_PROPERTY(bool enableUPnP READ enableUPnP WRITE setEnableUPnP NOTIFY enableUPnPChanged) + bool enableUPnP() const; + /** + * @brief Gets or sets a value indicating whether to enable automatic port forwarding. + */ + void setEnableUPnP(bool newEnableUPnP); /** * @brief Gets or sets a value indicating whether to enable prometheus metrics exporting. */ - Q_PROPERTY(bool enableMetrics READ enableMetrics WRITE setEnableMetrics NOTIFY enableMetricsChanged) + bool enableMetrics() const; + /** + * @brief Gets or sets a value indicating whether to enable prometheus metrics exporting. + */ + void setEnableMetrics(bool newEnableMetrics); /** * @brief Gets or sets the public mapped port. */ - Q_PROPERTY(qint32 publicPort READ publicPort WRITE setPublicPort NOTIFY publicPortChanged) + qint32 publicPort() const; + /** + * @brief Gets or sets the public mapped port. + */ + void setPublicPort(qint32 newPublicPort); /** * @brief Gets or sets a value indicating whether the http port should be mapped as part of UPnP automatic port forwarding. */ - Q_PROPERTY(bool uPnPCreateHttpPortMap READ uPnPCreateHttpPortMap WRITE setUPnPCreateHttpPortMap NOTIFY uPnPCreateHttpPortMapChanged) + bool uPnPCreateHttpPortMap() const; + /** + * @brief Gets or sets a value indicating whether the http port should be mapped as part of UPnP automatic port forwarding. + */ + void setUPnPCreateHttpPortMap(bool newUPnPCreateHttpPortMap); /** * @brief Gets or sets client udp port range. */ - Q_PROPERTY(QString uDPPortRange READ uDPPortRange WRITE setUDPPortRange NOTIFY uDPPortRangeChanged) + QString uDPPortRange() const; + /** + * @brief Gets or sets client udp port range. + */ + void setUDPPortRange(QString newUDPPortRange); /** * @brief Gets or sets a value indicating whether IPV6 capability is enabled. */ - Q_PROPERTY(bool enableIPV6 READ enableIPV6 WRITE setEnableIPV6 NOTIFY enableIPV6Changed) + bool enableIPV6() const; + /** + * @brief Gets or sets a value indicating whether IPV6 capability is enabled. + */ + void setEnableIPV6(bool newEnableIPV6); /** * @brief Gets or sets a value indicating whether IPV4 capability is enabled. */ - Q_PROPERTY(bool enableIPV4 READ enableIPV4 WRITE setEnableIPV4 NOTIFY enableIPV4Changed) + bool enableIPV4() const; + /** + * @brief Gets or sets a value indicating whether IPV4 capability is enabled. + */ + void setEnableIPV4(bool newEnableIPV4); /** * @brief Gets or sets a value indicating whether detailed ssdp logs are sent to the console/log. "Emby.Dlna": "Debug" must be set in logging.default.json for this property to work. */ - Q_PROPERTY(bool enableSSDPTracing READ enableSSDPTracing WRITE setEnableSSDPTracing NOTIFY enableSSDPTracingChanged) + bool enableSSDPTracing() const; + /** + * @brief Gets or sets a value indicating whether detailed ssdp logs are sent to the console/log. +"Emby.Dlna": "Debug" must be set in logging.default.json for this property to work. + */ + void setEnableSSDPTracing(bool newEnableSSDPTracing); /** * @brief Gets or sets a value indicating whether an IP address is to be used to filter the detailed ssdp logs that are being sent to the console/log. If the setting "Emby.Dlna": "Debug" msut be set in logging.default.json for this property to work. */ - Q_PROPERTY(QString sSDPTracingFilter READ sSDPTracingFilter WRITE setSSDPTracingFilter NOTIFY sSDPTracingFilterChanged) + QString sSDPTracingFilter() const; + /** + * @brief Gets or sets a value indicating whether an IP address is to be used to filter the detailed ssdp logs that are being sent to the console/log. +If the setting "Emby.Dlna": "Debug" msut be set in logging.default.json for this property to work. + */ + void setSSDPTracingFilter(QString newSSDPTracingFilter); /** * @brief Gets or sets the number of times SSDP UDP messages are sent. */ - Q_PROPERTY(qint32 uDPSendCount READ uDPSendCount WRITE setUDPSendCount NOTIFY uDPSendCountChanged) + qint32 uDPSendCount() const; + /** + * @brief Gets or sets the number of times SSDP UDP messages are sent. + */ + void setUDPSendCount(qint32 newUDPSendCount); /** * @brief Gets or sets the delay between each groups of SSDP messages (in ms). */ - Q_PROPERTY(qint32 uDPSendDelay READ uDPSendDelay WRITE setUDPSendDelay NOTIFY uDPSendDelayChanged) + qint32 uDPSendDelay() const; + /** + * @brief Gets or sets the delay between each groups of SSDP messages (in ms). + */ + void setUDPSendDelay(qint32 newUDPSendDelay); /** * @brief Gets or sets a value indicating whether address names that match MediaBrowser.Model.Configuration.ServerConfiguration.VirtualInterfaceNames should be Ignore for the purposes of binding. */ - Q_PROPERTY(bool ignoreVirtualInterfaces READ ignoreVirtualInterfaces WRITE setIgnoreVirtualInterfaces NOTIFY ignoreVirtualInterfacesChanged) + bool ignoreVirtualInterfaces() const; + /** + * @brief Gets or sets a value indicating whether address names that match MediaBrowser.Model.Configuration.ServerConfiguration.VirtualInterfaceNames should be Ignore for the purposes of binding. + */ + void setIgnoreVirtualInterfaces(bool newIgnoreVirtualInterfaces); /** * @brief Gets or sets a value indicating the interfaces that should be ignored. The list can be comma separated. . */ - Q_PROPERTY(QString virtualInterfaceNames READ virtualInterfaceNames WRITE setVirtualInterfaceNames NOTIFY virtualInterfaceNamesChanged) + QString virtualInterfaceNames() const; + /** + * @brief Gets or sets a value indicating the interfaces that should be ignored. The list can be comma separated. . + */ + void setVirtualInterfaceNames(QString newVirtualInterfaceNames); /** * @brief Gets or sets the time (in seconds) between the pings of SSDP gateway monitor. */ - Q_PROPERTY(qint32 gatewayMonitorPeriod READ gatewayMonitorPeriod WRITE setGatewayMonitorPeriod NOTIFY gatewayMonitorPeriodChanged) + qint32 gatewayMonitorPeriod() const; + /** + * @brief Gets or sets the time (in seconds) between the pings of SSDP gateway monitor. + */ + void setGatewayMonitorPeriod(qint32 newGatewayMonitorPeriod); /** * @brief Gets a value indicating whether multi-socket binding is available. */ - Q_PROPERTY(bool enableMultiSocketBinding READ enableMultiSocketBinding WRITE setEnableMultiSocketBinding NOTIFY enableMultiSocketBindingChanged) + bool enableMultiSocketBinding() const; + /** + * @brief Gets a value indicating whether multi-socket binding is available. + */ + void setEnableMultiSocketBinding(bool newEnableMultiSocketBinding); /** * @brief Gets or sets a value indicating whether all IPv6 interfaces should be treated as on the internal network. Depending on the address range implemented ULA ranges might not be used. */ - Q_PROPERTY(bool trustAllIP6Interfaces READ trustAllIP6Interfaces WRITE setTrustAllIP6Interfaces NOTIFY trustAllIP6InterfacesChanged) + bool trustAllIP6Interfaces() const; + /** + * @brief Gets or sets a value indicating whether all IPv6 interfaces should be treated as on the internal network. +Depending on the address range implemented ULA ranges might not be used. + */ + void setTrustAllIP6Interfaces(bool newTrustAllIP6Interfaces); /** * @brief Gets or sets the ports that HDHomerun uses. */ - Q_PROPERTY(QString hDHomerunPortRange READ hDHomerunPortRange WRITE setHDHomerunPortRange NOTIFY hDHomerunPortRangeChanged) + QString hDHomerunPortRange() const; + /** + * @brief Gets or sets the ports that HDHomerun uses. + */ + void setHDHomerunPortRange(QString newHDHomerunPortRange); /** * @brief Gets or sets PublishedServerUri to advertise for specific subnets. */ - Q_PROPERTY(QStringList publishedServerUriBySubnet READ publishedServerUriBySubnet WRITE setPublishedServerUriBySubnet NOTIFY publishedServerUriBySubnetChanged) + QStringList publishedServerUriBySubnet() const; + /** + * @brief Gets or sets PublishedServerUri to advertise for specific subnets. + */ + void setPublishedServerUriBySubnet(QStringList newPublishedServerUriBySubnet); /** * @brief Gets or sets a value indicating whether Autodiscovery tracing is enabled. */ - Q_PROPERTY(bool autoDiscoveryTracing READ autoDiscoveryTracing WRITE setAutoDiscoveryTracing NOTIFY autoDiscoveryTracingChanged) + bool autoDiscoveryTracing() const; + /** + * @brief Gets or sets a value indicating whether Autodiscovery tracing is enabled. + */ + void setAutoDiscoveryTracing(bool newAutoDiscoveryTracing); /** * @brief Gets or sets a value indicating whether Autodiscovery is enabled. */ - Q_PROPERTY(bool autoDiscovery READ autoDiscovery WRITE setAutoDiscovery NOTIFY autoDiscoveryChanged) + bool autoDiscovery() const; + /** + * @brief Gets or sets a value indicating whether Autodiscovery is enabled. + */ + void setAutoDiscovery(bool newAutoDiscovery); /** * @brief Gets or sets the public HTTPS port. */ - Q_PROPERTY(qint32 publicHttpsPort READ publicHttpsPort WRITE setPublicHttpsPort NOTIFY publicHttpsPortChanged) + qint32 publicHttpsPort() const; + /** + * @brief Gets or sets the public HTTPS port. + */ + void setPublicHttpsPort(qint32 newPublicHttpsPort); /** * @brief Gets or sets the HTTP server port number. */ - Q_PROPERTY(qint32 httpServerPortNumber READ httpServerPortNumber WRITE setHttpServerPortNumber NOTIFY httpServerPortNumberChanged) + qint32 httpServerPortNumber() const; + /** + * @brief Gets or sets the HTTP server port number. + */ + void setHttpServerPortNumber(qint32 newHttpServerPortNumber); /** * @brief Gets or sets the HTTPS server port number. */ - Q_PROPERTY(qint32 httpsPortNumber READ httpsPortNumber WRITE setHttpsPortNumber NOTIFY httpsPortNumberChanged) + qint32 httpsPortNumber() const; + /** + * @brief Gets or sets the HTTPS server port number. + */ + void setHttpsPortNumber(qint32 newHttpsPortNumber); /** * @brief Gets or sets a value indicating whether to use HTTPS. */ - Q_PROPERTY(bool enableHttps READ enableHttps WRITE setEnableHttps NOTIFY enableHttpsChanged) - Q_PROPERTY(bool enableNormalizedItemByNameIds READ enableNormalizedItemByNameIds WRITE setEnableNormalizedItemByNameIds NOTIFY enableNormalizedItemByNameIdsChanged) + bool enableHttps() const; + /** + * @brief Gets or sets a value indicating whether to use HTTPS. + */ + void setEnableHttps(bool newEnableHttps); + + bool enableNormalizedItemByNameIds() const; + + void setEnableNormalizedItemByNameIds(bool newEnableNormalizedItemByNameIds); /** * @brief Gets or sets the filesystem path of an X.509 certificate to use for SSL. */ - Q_PROPERTY(QString certificatePath READ certificatePath WRITE setCertificatePath NOTIFY certificatePathChanged) + QString certificatePath() const; + /** + * @brief Gets or sets the filesystem path of an X.509 certificate to use for SSL. + */ + void setCertificatePath(QString newCertificatePath); /** * @brief Gets or sets the password required to access the X.509 certificate data in the file specified by MediaBrowser.Model.Configuration.ServerConfiguration.CertificatePath. */ - Q_PROPERTY(QString certificatePassword READ certificatePassword WRITE setCertificatePassword NOTIFY certificatePasswordChanged) + QString certificatePassword() const; + /** + * @brief Gets or sets the password required to access the X.509 certificate data in the file specified by MediaBrowser.Model.Configuration.ServerConfiguration.CertificatePath. + */ + void setCertificatePassword(QString newCertificatePassword); /** * @brief Gets or sets a value indicating whether this instance is port authorized. */ - Q_PROPERTY(bool isPortAuthorized READ isPortAuthorized WRITE setIsPortAuthorized NOTIFY isPortAuthorizedChanged) + bool isPortAuthorized() const; + /** + * @brief Gets or sets a value indicating whether this instance is port authorized. + */ + void setIsPortAuthorized(bool newIsPortAuthorized); /** * @brief Gets or sets a value indicating whether quick connect is available for use on this server. */ - Q_PROPERTY(bool quickConnectAvailable READ quickConnectAvailable WRITE setQuickConnectAvailable NOTIFY quickConnectAvailableChanged) + bool quickConnectAvailable() const; + /** + * @brief Gets or sets a value indicating whether quick connect is available for use on this server. + */ + void setQuickConnectAvailable(bool newQuickConnectAvailable); /** * @brief Gets or sets a value indicating whether access outside of the LAN is permitted. */ - Q_PROPERTY(bool enableRemoteAccess READ enableRemoteAccess WRITE setEnableRemoteAccess NOTIFY enableRemoteAccessChanged) + bool enableRemoteAccess() const; + /** + * @brief Gets or sets a value indicating whether access outside of the LAN is permitted. + */ + void setEnableRemoteAccess(bool newEnableRemoteAccess); /** * @brief Gets or sets a value indicating whether [enable case sensitive item ids]. */ - Q_PROPERTY(bool enableCaseSensitiveItemIds READ enableCaseSensitiveItemIds WRITE setEnableCaseSensitiveItemIds NOTIFY enableCaseSensitiveItemIdsChanged) - Q_PROPERTY(bool disableLiveTvChannelUserDataName READ disableLiveTvChannelUserDataName WRITE setDisableLiveTvChannelUserDataName NOTIFY disableLiveTvChannelUserDataNameChanged) + bool enableCaseSensitiveItemIds() const; + /** + * @brief Gets or sets a value indicating whether [enable case sensitive item ids]. + */ + void setEnableCaseSensitiveItemIds(bool newEnableCaseSensitiveItemIds); + + bool disableLiveTvChannelUserDataName() const; + + void setDisableLiveTvChannelUserDataName(bool newDisableLiveTvChannelUserDataName); /** * @brief Gets or sets the metadata path. */ - Q_PROPERTY(QString metadataPath READ metadataPath WRITE setMetadataPath NOTIFY metadataPathChanged) - Q_PROPERTY(QString metadataNetworkPath READ metadataNetworkPath WRITE setMetadataNetworkPath NOTIFY metadataNetworkPathChanged) + QString metadataPath() const; + /** + * @brief Gets or sets the metadata path. + */ + void setMetadataPath(QString newMetadataPath); + + QString metadataNetworkPath() const; + + void setMetadataNetworkPath(QString newMetadataNetworkPath); /** * @brief Gets or sets the preferred metadata language. */ - Q_PROPERTY(QString preferredMetadataLanguage READ preferredMetadataLanguage WRITE setPreferredMetadataLanguage NOTIFY preferredMetadataLanguageChanged) + QString preferredMetadataLanguage() const; + /** + * @brief Gets or sets the preferred metadata language. + */ + void setPreferredMetadataLanguage(QString newPreferredMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets characters to be replaced with a ' ' in strings to create a sort name. */ - Q_PROPERTY(QStringList sortReplaceCharacters READ sortReplaceCharacters WRITE setSortReplaceCharacters NOTIFY sortReplaceCharactersChanged) + QStringList sortReplaceCharacters() const; + /** + * @brief Gets or sets characters to be replaced with a ' ' in strings to create a sort name. + */ + void setSortReplaceCharacters(QStringList newSortReplaceCharacters); /** * @brief Gets or sets characters to be removed from strings to create a sort name. */ - Q_PROPERTY(QStringList sortRemoveCharacters READ sortRemoveCharacters WRITE setSortRemoveCharacters NOTIFY sortRemoveCharactersChanged) + QStringList sortRemoveCharacters() const; + /** + * @brief Gets or sets characters to be removed from strings to create a sort name. + */ + void setSortRemoveCharacters(QStringList newSortRemoveCharacters); /** * @brief Gets or sets words to be removed from strings to create a sort name. */ - Q_PROPERTY(QStringList sortRemoveWords READ sortRemoveWords WRITE setSortRemoveWords NOTIFY sortRemoveWordsChanged) + QStringList sortRemoveWords() const; + /** + * @brief Gets or sets words to be removed from strings to create a sort name. + */ + void setSortRemoveWords(QStringList newSortRemoveWords); /** * @brief Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated. */ - Q_PROPERTY(qint32 minResumePct READ minResumePct WRITE setMinResumePct NOTIFY minResumePctChanged) + qint32 minResumePct() const; + /** + * @brief Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated. + */ + void setMinResumePct(qint32 newMinResumePct); /** * @brief Gets or sets the maximum percentage of an item that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched. */ - Q_PROPERTY(qint32 maxResumePct READ maxResumePct WRITE setMaxResumePct NOTIFY maxResumePctChanged) + qint32 maxResumePct() const; + /** + * @brief Gets or sets the maximum percentage of an item that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched. + */ + void setMaxResumePct(qint32 newMaxResumePct); /** * @brief Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates.. */ - Q_PROPERTY(qint32 minResumeDurationSeconds READ minResumeDurationSeconds WRITE setMinResumeDurationSeconds NOTIFY minResumeDurationSecondsChanged) + qint32 minResumeDurationSeconds() const; + /** + * @brief Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates.. + */ + void setMinResumeDurationSeconds(qint32 newMinResumeDurationSeconds); /** * @brief Gets or sets the minimum minutes of a book that must be played in order for playstate to be updated. */ - Q_PROPERTY(qint32 minAudiobookResume READ minAudiobookResume WRITE setMinAudiobookResume NOTIFY minAudiobookResumeChanged) + qint32 minAudiobookResume() const; + /** + * @brief Gets or sets the minimum minutes of a book that must be played in order for playstate to be updated. + */ + void setMinAudiobookResume(qint32 newMinAudiobookResume); /** * @brief Gets or sets the remaining minutes of a book that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched. */ - Q_PROPERTY(qint32 maxAudiobookResume READ maxAudiobookResume WRITE setMaxAudiobookResume NOTIFY maxAudiobookResumeChanged) + qint32 maxAudiobookResume() const; + /** + * @brief Gets or sets the remaining minutes of a book that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched. + */ + void setMaxAudiobookResume(qint32 newMaxAudiobookResume); /** * @brief Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed Some delay is necessary with some items because their creation is not atomic. It involves the creation of several different directories and files. */ - Q_PROPERTY(qint32 libraryMonitorDelay READ libraryMonitorDelay WRITE setLibraryMonitorDelay NOTIFY libraryMonitorDelayChanged) + qint32 libraryMonitorDelay() const; + /** + * @brief Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed +Some delay is necessary with some items because their creation is not atomic. It involves the creation of several +different directories and files. + */ + void setLibraryMonitorDelay(qint32 newLibraryMonitorDelay); /** * @brief Gets or sets a value indicating whether [enable dashboard response caching]. Allows potential contributors without visual studio to modify production dashboard code and test changes. */ - Q_PROPERTY(bool enableDashboardResponseCaching READ enableDashboardResponseCaching WRITE setEnableDashboardResponseCaching NOTIFY enableDashboardResponseCachingChanged) - Q_PROPERTY(ImageSavingConvention imageSavingConvention READ imageSavingConvention WRITE setImageSavingConvention NOTIFY imageSavingConventionChanged) - Q_PROPERTY(QList metadataOptions READ metadataOptions WRITE setMetadataOptions NOTIFY metadataOptionsChanged) - Q_PROPERTY(bool skipDeserializationForBasicTypes READ skipDeserializationForBasicTypes WRITE setSkipDeserializationForBasicTypes NOTIFY skipDeserializationForBasicTypesChanged) - Q_PROPERTY(QString serverName READ serverName WRITE setServerName NOTIFY serverNameChanged) - Q_PROPERTY(QString baseUrl READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged) - Q_PROPERTY(QString uICulture READ uICulture WRITE setUICulture NOTIFY uICultureChanged) - Q_PROPERTY(bool saveMetadataHidden READ saveMetadataHidden WRITE setSaveMetadataHidden NOTIFY saveMetadataHiddenChanged) - Q_PROPERTY(QList contentTypes READ contentTypes WRITE setContentTypes NOTIFY contentTypesChanged) - Q_PROPERTY(qint32 remoteClientBitrateLimit READ remoteClientBitrateLimit WRITE setRemoteClientBitrateLimit NOTIFY remoteClientBitrateLimitChanged) - Q_PROPERTY(bool enableFolderView READ enableFolderView WRITE setEnableFolderView NOTIFY enableFolderViewChanged) - Q_PROPERTY(bool enableGroupingIntoCollections READ enableGroupingIntoCollections WRITE setEnableGroupingIntoCollections NOTIFY enableGroupingIntoCollectionsChanged) - Q_PROPERTY(bool displaySpecialsWithinSeasons READ displaySpecialsWithinSeasons WRITE setDisplaySpecialsWithinSeasons NOTIFY displaySpecialsWithinSeasonsChanged) + bool enableDashboardResponseCaching() const; + /** + * @brief Gets or sets a value indicating whether [enable dashboard response caching]. +Allows potential contributors without visual studio to modify production dashboard code and test changes. + */ + void setEnableDashboardResponseCaching(bool newEnableDashboardResponseCaching); + + ImageSavingConvention imageSavingConvention() const; + + void setImageSavingConvention(ImageSavingConvention newImageSavingConvention); + + QList> metadataOptions() const; + + void setMetadataOptions(QList> newMetadataOptions); + + bool skipDeserializationForBasicTypes() const; + + void setSkipDeserializationForBasicTypes(bool newSkipDeserializationForBasicTypes); + + QString serverName() const; + + void setServerName(QString newServerName); + + QString baseUrl() const; + + void setBaseUrl(QString newBaseUrl); + + QString uICulture() const; + + void setUICulture(QString newUICulture); + + bool saveMetadataHidden() const; + + void setSaveMetadataHidden(bool newSaveMetadataHidden); + + QList> contentTypes() const; + + void setContentTypes(QList> newContentTypes); + + qint32 remoteClientBitrateLimit() const; + + void setRemoteClientBitrateLimit(qint32 newRemoteClientBitrateLimit); + + bool enableFolderView() const; + + void setEnableFolderView(bool newEnableFolderView); + + bool enableGroupingIntoCollections() const; + + void setEnableGroupingIntoCollections(bool newEnableGroupingIntoCollections); + + bool displaySpecialsWithinSeasons() const; + + void setDisplaySpecialsWithinSeasons(bool newDisplaySpecialsWithinSeasons); /** * @brief Gets or sets the subnets that are deemed to make up the LAN. */ - Q_PROPERTY(QStringList localNetworkSubnets READ localNetworkSubnets WRITE setLocalNetworkSubnets NOTIFY localNetworkSubnetsChanged) + QStringList localNetworkSubnets() const; + /** + * @brief Gets or sets the subnets that are deemed to make up the LAN. + */ + void setLocalNetworkSubnets(QStringList newLocalNetworkSubnets); /** * @brief Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used. */ - Q_PROPERTY(QStringList localNetworkAddresses READ localNetworkAddresses WRITE setLocalNetworkAddresses NOTIFY localNetworkAddressesChanged) - Q_PROPERTY(QStringList codecsUsed READ codecsUsed WRITE setCodecsUsed NOTIFY codecsUsedChanged) - Q_PROPERTY(QList pluginRepositories READ pluginRepositories WRITE setPluginRepositories NOTIFY pluginRepositoriesChanged) - Q_PROPERTY(bool enableExternalContentInSuggestions READ enableExternalContentInSuggestions WRITE setEnableExternalContentInSuggestions NOTIFY enableExternalContentInSuggestionsChanged) + QStringList localNetworkAddresses() const; + /** + * @brief Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used. + */ + void setLocalNetworkAddresses(QStringList newLocalNetworkAddresses); + + QStringList codecsUsed() const; + + void setCodecsUsed(QStringList newCodecsUsed); + + QList> pluginRepositories() const; + + void setPluginRepositories(QList> newPluginRepositories); + + bool enableExternalContentInSuggestions() const; + + void setEnableExternalContentInSuggestions(bool newEnableExternalContentInSuggestions); /** * @brief Gets or sets a value indicating whether the server should force connections over HTTPS. */ - Q_PROPERTY(bool requireHttps READ requireHttps WRITE setRequireHttps NOTIFY requireHttpsChanged) - Q_PROPERTY(bool enableNewOmdbSupport READ enableNewOmdbSupport WRITE setEnableNewOmdbSupport NOTIFY enableNewOmdbSupportChanged) + bool requireHttps() const; + /** + * @brief Gets or sets a value indicating whether the server should force connections over HTTPS. + */ + void setRequireHttps(bool newRequireHttps); + + bool enableNewOmdbSupport() const; + + void setEnableNewOmdbSupport(bool newEnableNewOmdbSupport); /** * @brief Gets or sets the filter for remote IP connectivity. Used in conjuntion with . */ - Q_PROPERTY(QStringList remoteIPFilter READ remoteIPFilter WRITE setRemoteIPFilter NOTIFY remoteIPFilterChanged) + QStringList remoteIPFilter() const; + /** + * @brief Gets or sets the filter for remote IP connectivity. Used in conjuntion with . + */ + void setRemoteIPFilter(QStringList newRemoteIPFilter); /** * @brief Gets or sets a value indicating whether contains a blacklist or a whitelist. Default is a whitelist. */ - Q_PROPERTY(bool isRemoteIPFilterBlacklist READ isRemoteIPFilterBlacklist WRITE setIsRemoteIPFilterBlacklist NOTIFY isRemoteIPFilterBlacklistChanged) - Q_PROPERTY(qint32 imageExtractionTimeoutMs READ imageExtractionTimeoutMs WRITE setImageExtractionTimeoutMs NOTIFY imageExtractionTimeoutMsChanged) - Q_PROPERTY(QList pathSubstitutions READ pathSubstitutions WRITE setPathSubstitutions NOTIFY pathSubstitutionsChanged) - Q_PROPERTY(bool enableSimpleArtistDetection READ enableSimpleArtistDetection WRITE setEnableSimpleArtistDetection NOTIFY enableSimpleArtistDetectionChanged) - Q_PROPERTY(QStringList uninstalledPlugins READ uninstalledPlugins WRITE setUninstalledPlugins NOTIFY uninstalledPluginsChanged) + bool isRemoteIPFilterBlacklist() const; + /** + * @brief Gets or sets a value indicating whether contains a blacklist or a whitelist. Default is a whitelist. + */ + void setIsRemoteIPFilterBlacklist(bool newIsRemoteIPFilterBlacklist); + + qint32 imageExtractionTimeoutMs() const; + + void setImageExtractionTimeoutMs(qint32 newImageExtractionTimeoutMs); + + QList> pathSubstitutions() const; + + void setPathSubstitutions(QList> newPathSubstitutions); + + bool enableSimpleArtistDetection() const; + + void setEnableSimpleArtistDetection(bool newEnableSimpleArtistDetection); + + QStringList uninstalledPlugins() const; + + void setUninstalledPlugins(QStringList newUninstalledPlugins); /** * @brief Gets or sets a value indicating whether slow server responses should be logged as a warning. */ - Q_PROPERTY(bool enableSlowResponseWarning READ enableSlowResponseWarning WRITE setEnableSlowResponseWarning NOTIFY enableSlowResponseWarningChanged) + bool enableSlowResponseWarning() const; + /** + * @brief Gets or sets a value indicating whether slow server responses should be logged as a warning. + */ + void setEnableSlowResponseWarning(bool newEnableSlowResponseWarning); /** * @brief Gets or sets the threshold for the slow response time warning in ms. */ - Q_PROPERTY(qint64 slowResponseThresholdMs READ slowResponseThresholdMs WRITE setSlowResponseThresholdMs NOTIFY slowResponseThresholdMsChanged) + qint64 slowResponseThresholdMs() const; + /** + * @brief Gets or sets the threshold for the slow response time warning in ms. + */ + void setSlowResponseThresholdMs(qint64 newSlowResponseThresholdMs); /** * @brief Gets or sets the cors hosts. */ - Q_PROPERTY(QStringList corsHosts READ corsHosts WRITE setCorsHosts NOTIFY corsHostsChanged) + QStringList corsHosts() const; + /** + * @brief Gets or sets the cors hosts. + */ + void setCorsHosts(QStringList newCorsHosts); /** * @brief Gets or sets the known proxies. */ - Q_PROPERTY(QStringList knownProxies READ knownProxies WRITE setKnownProxies NOTIFY knownProxiesChanged) + QStringList knownProxies() const; + /** + * @brief Gets or sets the known proxies. + */ + void setKnownProxies(QStringList newKnownProxies); /** * @brief Gets or sets the number of days we should retain activity logs. */ - Q_PROPERTY(qint32 activityLogRetentionDays READ activityLogRetentionDays WRITE setActivityLogRetentionDays NOTIFY activityLogRetentionDaysChanged) + qint32 activityLogRetentionDays() const; + /** + * @brief Gets or sets the number of days we should retain activity logs. + */ + void setActivityLogRetentionDays(qint32 newActivityLogRetentionDays); /** * @brief Gets or sets the how the library scan fans out. */ - Q_PROPERTY(qint32 libraryScanFanoutConcurrency READ libraryScanFanoutConcurrency WRITE setLibraryScanFanoutConcurrency NOTIFY libraryScanFanoutConcurrencyChanged) + qint32 libraryScanFanoutConcurrency() const; + /** + * @brief Gets or sets the how the library scan fans out. + */ + void setLibraryScanFanoutConcurrency(qint32 newLibraryScanFanoutConcurrency); /** * @brief Gets or sets the how many metadata refreshes can run concurrently. */ - Q_PROPERTY(qint32 libraryMetadataRefreshConcurrency READ libraryMetadataRefreshConcurrency WRITE setLibraryMetadataRefreshConcurrency NOTIFY libraryMetadataRefreshConcurrencyChanged) + qint32 libraryMetadataRefreshConcurrency() const; + /** + * @brief Gets or sets the how many metadata refreshes can run concurrently. + */ + void setLibraryMetadataRefreshConcurrency(qint32 newLibraryMetadataRefreshConcurrency); /** * @brief Gets or sets a value indicating whether older plugins should automatically be deleted from the plugin folder. */ - Q_PROPERTY(bool removeOldPlugins READ removeOldPlugins WRITE setRemoveOldPlugins NOTIFY removeOldPluginsChanged) + bool removeOldPlugins() const; + /** + * @brief Gets or sets a value indicating whether older plugins should automatically be deleted from the plugin folder. + */ + void setRemoveOldPlugins(bool newRemoveOldPlugins); /** * @brief Gets or sets a value indicating whether plugin image should be disabled. */ - Q_PROPERTY(bool disablePluginImages READ disablePluginImages WRITE setDisablePluginImages NOTIFY disablePluginImagesChanged) - - qint32 logFileRetentionDays() const; - void setLogFileRetentionDays(qint32 newLogFileRetentionDays); - - bool isStartupWizardCompleted() const; - void setIsStartupWizardCompleted(bool newIsStartupWizardCompleted); - - QString cachePath() const; - void setCachePath(QString newCachePath); - - Version * previousVersion() const; - void setPreviousVersion(Version * newPreviousVersion); - - QString previousVersionStr() const; - void setPreviousVersionStr(QString newPreviousVersionStr); - - bool enableUPnP() const; - void setEnableUPnP(bool newEnableUPnP); - - bool enableMetrics() const; - void setEnableMetrics(bool newEnableMetrics); - - qint32 publicPort() const; - void setPublicPort(qint32 newPublicPort); - - bool uPnPCreateHttpPortMap() const; - void setUPnPCreateHttpPortMap(bool newUPnPCreateHttpPortMap); - - QString uDPPortRange() const; - void setUDPPortRange(QString newUDPPortRange); - - bool enableIPV6() const; - void setEnableIPV6(bool newEnableIPV6); - - bool enableIPV4() const; - void setEnableIPV4(bool newEnableIPV4); - - bool enableSSDPTracing() const; - void setEnableSSDPTracing(bool newEnableSSDPTracing); - - QString sSDPTracingFilter() const; - void setSSDPTracingFilter(QString newSSDPTracingFilter); - - qint32 uDPSendCount() const; - void setUDPSendCount(qint32 newUDPSendCount); - - qint32 uDPSendDelay() const; - void setUDPSendDelay(qint32 newUDPSendDelay); - - bool ignoreVirtualInterfaces() const; - void setIgnoreVirtualInterfaces(bool newIgnoreVirtualInterfaces); - - QString virtualInterfaceNames() const; - void setVirtualInterfaceNames(QString newVirtualInterfaceNames); - - qint32 gatewayMonitorPeriod() const; - void setGatewayMonitorPeriod(qint32 newGatewayMonitorPeriod); - - bool enableMultiSocketBinding() const; - void setEnableMultiSocketBinding(bool newEnableMultiSocketBinding); - - bool trustAllIP6Interfaces() const; - void setTrustAllIP6Interfaces(bool newTrustAllIP6Interfaces); - - QString hDHomerunPortRange() const; - void setHDHomerunPortRange(QString newHDHomerunPortRange); - - QStringList publishedServerUriBySubnet() const; - void setPublishedServerUriBySubnet(QStringList newPublishedServerUriBySubnet); - - bool autoDiscoveryTracing() const; - void setAutoDiscoveryTracing(bool newAutoDiscoveryTracing); - - bool autoDiscovery() const; - void setAutoDiscovery(bool newAutoDiscovery); - - qint32 publicHttpsPort() const; - void setPublicHttpsPort(qint32 newPublicHttpsPort); - - qint32 httpServerPortNumber() const; - void setHttpServerPortNumber(qint32 newHttpServerPortNumber); - - qint32 httpsPortNumber() const; - void setHttpsPortNumber(qint32 newHttpsPortNumber); - - bool enableHttps() const; - void setEnableHttps(bool newEnableHttps); - - bool enableNormalizedItemByNameIds() const; - void setEnableNormalizedItemByNameIds(bool newEnableNormalizedItemByNameIds); - - QString certificatePath() const; - void setCertificatePath(QString newCertificatePath); - - QString certificatePassword() const; - void setCertificatePassword(QString newCertificatePassword); - - bool isPortAuthorized() const; - void setIsPortAuthorized(bool newIsPortAuthorized); - - bool quickConnectAvailable() const; - void setQuickConnectAvailable(bool newQuickConnectAvailable); - - bool enableRemoteAccess() const; - void setEnableRemoteAccess(bool newEnableRemoteAccess); - - bool enableCaseSensitiveItemIds() const; - void setEnableCaseSensitiveItemIds(bool newEnableCaseSensitiveItemIds); - - bool disableLiveTvChannelUserDataName() const; - void setDisableLiveTvChannelUserDataName(bool newDisableLiveTvChannelUserDataName); - - QString metadataPath() const; - void setMetadataPath(QString newMetadataPath); - - QString metadataNetworkPath() const; - void setMetadataNetworkPath(QString newMetadataNetworkPath); - - QString preferredMetadataLanguage() const; - void setPreferredMetadataLanguage(QString newPreferredMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QStringList sortReplaceCharacters() const; - void setSortReplaceCharacters(QStringList newSortReplaceCharacters); - - QStringList sortRemoveCharacters() const; - void setSortRemoveCharacters(QStringList newSortRemoveCharacters); - - QStringList sortRemoveWords() const; - void setSortRemoveWords(QStringList newSortRemoveWords); - - qint32 minResumePct() const; - void setMinResumePct(qint32 newMinResumePct); - - qint32 maxResumePct() const; - void setMaxResumePct(qint32 newMaxResumePct); - - qint32 minResumeDurationSeconds() const; - void setMinResumeDurationSeconds(qint32 newMinResumeDurationSeconds); - - qint32 minAudiobookResume() const; - void setMinAudiobookResume(qint32 newMinAudiobookResume); - - qint32 maxAudiobookResume() const; - void setMaxAudiobookResume(qint32 newMaxAudiobookResume); - - qint32 libraryMonitorDelay() const; - void setLibraryMonitorDelay(qint32 newLibraryMonitorDelay); - - bool enableDashboardResponseCaching() const; - void setEnableDashboardResponseCaching(bool newEnableDashboardResponseCaching); - - ImageSavingConvention imageSavingConvention() const; - void setImageSavingConvention(ImageSavingConvention newImageSavingConvention); - - QList metadataOptions() const; - void setMetadataOptions(QList newMetadataOptions); - - bool skipDeserializationForBasicTypes() const; - void setSkipDeserializationForBasicTypes(bool newSkipDeserializationForBasicTypes); - - QString serverName() const; - void setServerName(QString newServerName); - - QString baseUrl() const; - void setBaseUrl(QString newBaseUrl); - - QString uICulture() const; - void setUICulture(QString newUICulture); - - bool saveMetadataHidden() const; - void setSaveMetadataHidden(bool newSaveMetadataHidden); - - QList contentTypes() const; - void setContentTypes(QList newContentTypes); - - qint32 remoteClientBitrateLimit() const; - void setRemoteClientBitrateLimit(qint32 newRemoteClientBitrateLimit); - - bool enableFolderView() const; - void setEnableFolderView(bool newEnableFolderView); - - bool enableGroupingIntoCollections() const; - void setEnableGroupingIntoCollections(bool newEnableGroupingIntoCollections); - - bool displaySpecialsWithinSeasons() const; - void setDisplaySpecialsWithinSeasons(bool newDisplaySpecialsWithinSeasons); - - QStringList localNetworkSubnets() const; - void setLocalNetworkSubnets(QStringList newLocalNetworkSubnets); - - QStringList localNetworkAddresses() const; - void setLocalNetworkAddresses(QStringList newLocalNetworkAddresses); - - QStringList codecsUsed() const; - void setCodecsUsed(QStringList newCodecsUsed); - - QList pluginRepositories() const; - void setPluginRepositories(QList newPluginRepositories); - - bool enableExternalContentInSuggestions() const; - void setEnableExternalContentInSuggestions(bool newEnableExternalContentInSuggestions); - - bool requireHttps() const; - void setRequireHttps(bool newRequireHttps); - - bool enableNewOmdbSupport() const; - void setEnableNewOmdbSupport(bool newEnableNewOmdbSupport); - - QStringList remoteIPFilter() const; - void setRemoteIPFilter(QStringList newRemoteIPFilter); - - bool isRemoteIPFilterBlacklist() const; - void setIsRemoteIPFilterBlacklist(bool newIsRemoteIPFilterBlacklist); - - qint32 imageExtractionTimeoutMs() const; - void setImageExtractionTimeoutMs(qint32 newImageExtractionTimeoutMs); - - QList pathSubstitutions() const; - void setPathSubstitutions(QList newPathSubstitutions); - - bool enableSimpleArtistDetection() const; - void setEnableSimpleArtistDetection(bool newEnableSimpleArtistDetection); - - QStringList uninstalledPlugins() const; - void setUninstalledPlugins(QStringList newUninstalledPlugins); - - bool enableSlowResponseWarning() const; - void setEnableSlowResponseWarning(bool newEnableSlowResponseWarning); - - qint64 slowResponseThresholdMs() const; - void setSlowResponseThresholdMs(qint64 newSlowResponseThresholdMs); - - QStringList corsHosts() const; - void setCorsHosts(QStringList newCorsHosts); - - QStringList knownProxies() const; - void setKnownProxies(QStringList newKnownProxies); - - qint32 activityLogRetentionDays() const; - void setActivityLogRetentionDays(qint32 newActivityLogRetentionDays); - - qint32 libraryScanFanoutConcurrency() const; - void setLibraryScanFanoutConcurrency(qint32 newLibraryScanFanoutConcurrency); - - qint32 libraryMetadataRefreshConcurrency() const; - void setLibraryMetadataRefreshConcurrency(qint32 newLibraryMetadataRefreshConcurrency); - - bool removeOldPlugins() const; - void setRemoveOldPlugins(bool newRemoveOldPlugins); - bool disablePluginImages() const; + /** + * @brief Gets or sets a value indicating whether plugin image should be disabled. + */ void setDisablePluginImages(bool newDisablePluginImages); - -signals: - void logFileRetentionDaysChanged(qint32 newLogFileRetentionDays); - void isStartupWizardCompletedChanged(bool newIsStartupWizardCompleted); - void cachePathChanged(QString newCachePath); - void previousVersionChanged(Version * newPreviousVersion); - void previousVersionStrChanged(QString newPreviousVersionStr); - void enableUPnPChanged(bool newEnableUPnP); - void enableMetricsChanged(bool newEnableMetrics); - void publicPortChanged(qint32 newPublicPort); - void uPnPCreateHttpPortMapChanged(bool newUPnPCreateHttpPortMap); - void uDPPortRangeChanged(QString newUDPPortRange); - void enableIPV6Changed(bool newEnableIPV6); - void enableIPV4Changed(bool newEnableIPV4); - void enableSSDPTracingChanged(bool newEnableSSDPTracing); - void sSDPTracingFilterChanged(QString newSSDPTracingFilter); - void uDPSendCountChanged(qint32 newUDPSendCount); - void uDPSendDelayChanged(qint32 newUDPSendDelay); - void ignoreVirtualInterfacesChanged(bool newIgnoreVirtualInterfaces); - void virtualInterfaceNamesChanged(QString newVirtualInterfaceNames); - void gatewayMonitorPeriodChanged(qint32 newGatewayMonitorPeriod); - void enableMultiSocketBindingChanged(bool newEnableMultiSocketBinding); - void trustAllIP6InterfacesChanged(bool newTrustAllIP6Interfaces); - void hDHomerunPortRangeChanged(QString newHDHomerunPortRange); - void publishedServerUriBySubnetChanged(QStringList newPublishedServerUriBySubnet); - void autoDiscoveryTracingChanged(bool newAutoDiscoveryTracing); - void autoDiscoveryChanged(bool newAutoDiscovery); - void publicHttpsPortChanged(qint32 newPublicHttpsPort); - void httpServerPortNumberChanged(qint32 newHttpServerPortNumber); - void httpsPortNumberChanged(qint32 newHttpsPortNumber); - void enableHttpsChanged(bool newEnableHttps); - void enableNormalizedItemByNameIdsChanged(bool newEnableNormalizedItemByNameIds); - void certificatePathChanged(QString newCertificatePath); - void certificatePasswordChanged(QString newCertificatePassword); - void isPortAuthorizedChanged(bool newIsPortAuthorized); - void quickConnectAvailableChanged(bool newQuickConnectAvailable); - void enableRemoteAccessChanged(bool newEnableRemoteAccess); - void enableCaseSensitiveItemIdsChanged(bool newEnableCaseSensitiveItemIds); - void disableLiveTvChannelUserDataNameChanged(bool newDisableLiveTvChannelUserDataName); - void metadataPathChanged(QString newMetadataPath); - void metadataNetworkPathChanged(QString newMetadataNetworkPath); - void preferredMetadataLanguageChanged(QString newPreferredMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void sortReplaceCharactersChanged(QStringList newSortReplaceCharacters); - void sortRemoveCharactersChanged(QStringList newSortRemoveCharacters); - void sortRemoveWordsChanged(QStringList newSortRemoveWords); - void minResumePctChanged(qint32 newMinResumePct); - void maxResumePctChanged(qint32 newMaxResumePct); - void minResumeDurationSecondsChanged(qint32 newMinResumeDurationSeconds); - void minAudiobookResumeChanged(qint32 newMinAudiobookResume); - void maxAudiobookResumeChanged(qint32 newMaxAudiobookResume); - void libraryMonitorDelayChanged(qint32 newLibraryMonitorDelay); - void enableDashboardResponseCachingChanged(bool newEnableDashboardResponseCaching); - void imageSavingConventionChanged(ImageSavingConvention newImageSavingConvention); - void metadataOptionsChanged(QList newMetadataOptions); - void skipDeserializationForBasicTypesChanged(bool newSkipDeserializationForBasicTypes); - void serverNameChanged(QString newServerName); - void baseUrlChanged(QString newBaseUrl); - void uICultureChanged(QString newUICulture); - void saveMetadataHiddenChanged(bool newSaveMetadataHidden); - void contentTypesChanged(QList newContentTypes); - void remoteClientBitrateLimitChanged(qint32 newRemoteClientBitrateLimit); - void enableFolderViewChanged(bool newEnableFolderView); - void enableGroupingIntoCollectionsChanged(bool newEnableGroupingIntoCollections); - void displaySpecialsWithinSeasonsChanged(bool newDisplaySpecialsWithinSeasons); - void localNetworkSubnetsChanged(QStringList newLocalNetworkSubnets); - void localNetworkAddressesChanged(QStringList newLocalNetworkAddresses); - void codecsUsedChanged(QStringList newCodecsUsed); - void pluginRepositoriesChanged(QList newPluginRepositories); - void enableExternalContentInSuggestionsChanged(bool newEnableExternalContentInSuggestions); - void requireHttpsChanged(bool newRequireHttps); - void enableNewOmdbSupportChanged(bool newEnableNewOmdbSupport); - void remoteIPFilterChanged(QStringList newRemoteIPFilter); - void isRemoteIPFilterBlacklistChanged(bool newIsRemoteIPFilterBlacklist); - void imageExtractionTimeoutMsChanged(qint32 newImageExtractionTimeoutMs); - void pathSubstitutionsChanged(QList newPathSubstitutions); - void enableSimpleArtistDetectionChanged(bool newEnableSimpleArtistDetection); - void uninstalledPluginsChanged(QStringList newUninstalledPlugins); - void enableSlowResponseWarningChanged(bool newEnableSlowResponseWarning); - void slowResponseThresholdMsChanged(qint64 newSlowResponseThresholdMs); - void corsHostsChanged(QStringList newCorsHosts); - void knownProxiesChanged(QStringList newKnownProxies); - void activityLogRetentionDaysChanged(qint32 newActivityLogRetentionDays); - void libraryScanFanoutConcurrencyChanged(qint32 newLibraryScanFanoutConcurrency); - void libraryMetadataRefreshConcurrencyChanged(qint32 newLibraryMetadataRefreshConcurrency); - void removeOldPluginsChanged(bool newRemoveOldPlugins); - void disablePluginImagesChanged(bool newDisablePluginImages); + protected: qint32 m_logFileRetentionDays; bool m_isStartupWizardCompleted; QString m_cachePath; - Version * m_previousVersion = nullptr; + QSharedPointer m_previousVersion = nullptr; QString m_previousVersionStr; bool m_enableUPnP; bool m_enableMetrics; @@ -725,13 +710,13 @@ protected: qint32 m_libraryMonitorDelay; bool m_enableDashboardResponseCaching; ImageSavingConvention m_imageSavingConvention; - QList m_metadataOptions; + QList> m_metadataOptions; bool m_skipDeserializationForBasicTypes; QString m_serverName; QString m_baseUrl; QString m_uICulture; bool m_saveMetadataHidden; - QList m_contentTypes; + QList> m_contentTypes; qint32 m_remoteClientBitrateLimit; bool m_enableFolderView; bool m_enableGroupingIntoCollections; @@ -739,14 +724,14 @@ protected: QStringList m_localNetworkSubnets; QStringList m_localNetworkAddresses; QStringList m_codecsUsed; - QList m_pluginRepositories; + QList> m_pluginRepositories; bool m_enableExternalContentInSuggestions; bool m_requireHttps; bool m_enableNewOmdbSupport; QStringList m_remoteIPFilter; bool m_isRemoteIPFilterBlacklist; qint32 m_imageExtractionTimeoutMs; - QList m_pathSubstitutions; + QList> m_pathSubstitutions; bool m_enableSimpleArtistDetection; QStringList m_uninstalledPlugins; bool m_enableSlowResponseWarning; @@ -760,6 +745,18 @@ protected: bool m_disablePluginImages; }; +} // NS DTO + +namespace Support { + +using ServerConfiguration = Jellyfin::DTO::ServerConfiguration; + +template <> +ServerConfiguration fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ServerConfiguration::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/sessioninfo.h b/core/include/JellyfinQt/DTO/sessioninfo.h index 551db3d..5dafb4f 100644 --- a/core/include/JellyfinQt/DTO/sessioninfo.h +++ b/core/include/JellyfinQt/DTO/sessioninfo.h @@ -32,241 +32,229 @@ #include #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/baseitem.h" +#include "JellyfinQt/DTO/baseitemdto.h" +#include "JellyfinQt/DTO/clientcapabilities.h" #include "JellyfinQt/DTO/generalcommandtype.h" +#include "JellyfinQt/DTO/playerstateinfo.h" +#include "JellyfinQt/DTO/queueitem.h" +#include "JellyfinQt/DTO/sessionuserinfo.h" +#include "JellyfinQt/DTO/transcodinginfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItem; -class BaseItemDto; -class BaseItemDto; -class ClientCapabilities; -class PlayerStateInfo; -class QueueItem; -class SessionUserInfo; -class TranscodingInfo; -class SessionInfo : public QObject { - Q_OBJECT +class SessionInfo { public: - explicit SessionInfo(QObject *parent = nullptr); - static SessionInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit SessionInfo(); + static SessionInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(PlayerStateInfo * playState READ playState WRITE setPlayState NOTIFY playStateChanged) - Q_PROPERTY(QList additionalUsers READ additionalUsers WRITE setAdditionalUsers NOTIFY additionalUsersChanged) - Q_PROPERTY(ClientCapabilities * capabilities READ capabilities WRITE setCapabilities NOTIFY capabilitiesChanged) + QSharedPointer playState() const; + + void setPlayState(QSharedPointer newPlayState); + + QList> additionalUsers() const; + + void setAdditionalUsers(QList> newAdditionalUsers); + + QSharedPointer capabilities() const; + + void setCapabilities(QSharedPointer newCapabilities); /** * @brief Gets or sets the remote end point. */ - Q_PROPERTY(QString remoteEndPoint READ remoteEndPoint WRITE setRemoteEndPoint NOTIFY remoteEndPointChanged) + QString remoteEndPoint() const; + /** + * @brief Gets or sets the remote end point. + */ + void setRemoteEndPoint(QString newRemoteEndPoint); /** * @brief Gets or sets the playable media types. */ - Q_PROPERTY(QStringList playableMediaTypes READ playableMediaTypes WRITE setPlayableMediaTypes NOTIFY playableMediaTypesChanged) + QStringList playableMediaTypes() const; + /** + * @brief Gets or sets the playable media types. + */ + void setPlayableMediaTypes(QStringList newPlayableMediaTypes); /** * @brief Gets or sets the id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the id. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets the user id. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets the user id. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets the username. */ - Q_PROPERTY(QString userName READ userName WRITE setUserName NOTIFY userNameChanged) + QString userName() const; + /** + * @brief Gets or sets the username. + */ + void setUserName(QString newUserName); /** * @brief Gets or sets the type of the client. */ - Q_PROPERTY(QString client READ client WRITE setClient NOTIFY clientChanged) + QString client() const; + /** + * @brief Gets or sets the type of the client. + */ + void setClient(QString newClient); /** * @brief Gets or sets the last activity date. */ - Q_PROPERTY(QDateTime lastActivityDate READ lastActivityDate WRITE setLastActivityDate NOTIFY lastActivityDateChanged) + QDateTime lastActivityDate() const; + /** + * @brief Gets or sets the last activity date. + */ + void setLastActivityDate(QDateTime newLastActivityDate); /** * @brief Gets or sets the last playback check in. */ - Q_PROPERTY(QDateTime lastPlaybackCheckIn READ lastPlaybackCheckIn WRITE setLastPlaybackCheckIn NOTIFY lastPlaybackCheckInChanged) + QDateTime lastPlaybackCheckIn() const; + /** + * @brief Gets or sets the last playback check in. + */ + void setLastPlaybackCheckIn(QDateTime newLastPlaybackCheckIn); /** * @brief Gets or sets the name of the device. */ - Q_PROPERTY(QString deviceName READ deviceName WRITE setDeviceName NOTIFY deviceNameChanged) + QString deviceName() const; + /** + * @brief Gets or sets the name of the device. + */ + void setDeviceName(QString newDeviceName); /** * @brief Gets or sets the type of the device. */ - Q_PROPERTY(QString deviceType READ deviceType WRITE setDeviceType NOTIFY deviceTypeChanged) - Q_PROPERTY(BaseItemDto * nowPlayingItem READ nowPlayingItem WRITE setNowPlayingItem NOTIFY nowPlayingItemChanged) - Q_PROPERTY(BaseItem * fullNowPlayingItem READ fullNowPlayingItem WRITE setFullNowPlayingItem NOTIFY fullNowPlayingItemChanged) - Q_PROPERTY(BaseItemDto * nowViewingItem READ nowViewingItem WRITE setNowViewingItem NOTIFY nowViewingItemChanged) + QString deviceType() const; + /** + * @brief Gets or sets the type of the device. + */ + void setDeviceType(QString newDeviceType); + + QSharedPointer nowPlayingItem() const; + + void setNowPlayingItem(QSharedPointer newNowPlayingItem); + + QSharedPointer fullNowPlayingItem() const; + + void setFullNowPlayingItem(QSharedPointer newFullNowPlayingItem); + + QSharedPointer nowViewingItem() const; + + void setNowViewingItem(QSharedPointer newNowViewingItem); /** * @brief Gets or sets the device id. */ - Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged) + QString deviceId() const; + /** + * @brief Gets or sets the device id. + */ + void setDeviceId(QString newDeviceId); /** * @brief Gets or sets the application version. */ - Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion NOTIFY applicationVersionChanged) - Q_PROPERTY(TranscodingInfo * transcodingInfo READ transcodingInfo WRITE setTranscodingInfo NOTIFY transcodingInfoChanged) + QString applicationVersion() const; + /** + * @brief Gets or sets the application version. + */ + void setApplicationVersion(QString newApplicationVersion); + + QSharedPointer transcodingInfo() const; + + void setTranscodingInfo(QSharedPointer newTranscodingInfo); /** * @brief Gets a value indicating whether this instance is active. */ - Q_PROPERTY(bool isActive READ isActive WRITE setIsActive NOTIFY isActiveChanged) - Q_PROPERTY(bool supportsMediaControl READ supportsMediaControl WRITE setSupportsMediaControl NOTIFY supportsMediaControlChanged) - Q_PROPERTY(bool supportsRemoteControl READ supportsRemoteControl WRITE setSupportsRemoteControl NOTIFY supportsRemoteControlChanged) - Q_PROPERTY(QList nowPlayingQueue READ nowPlayingQueue WRITE setNowPlayingQueue NOTIFY nowPlayingQueueChanged) - Q_PROPERTY(bool hasCustomDeviceName READ hasCustomDeviceName WRITE setHasCustomDeviceName NOTIFY hasCustomDeviceNameChanged) - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) - Q_PROPERTY(QString serverId READ serverId WRITE setServerId NOTIFY serverIdChanged) - Q_PROPERTY(QString userPrimaryImageTag READ userPrimaryImageTag WRITE setUserPrimaryImageTag NOTIFY userPrimaryImageTagChanged) + bool isActive() const; + /** + * @brief Gets a value indicating whether this instance is active. + */ + void setIsActive(bool newIsActive); + + bool supportsMediaControl() const; + + void setSupportsMediaControl(bool newSupportsMediaControl); + + bool supportsRemoteControl() const; + + void setSupportsRemoteControl(bool newSupportsRemoteControl); + + QList> nowPlayingQueue() const; + + void setNowPlayingQueue(QList> newNowPlayingQueue); + + bool hasCustomDeviceName() const; + + void setHasCustomDeviceName(bool newHasCustomDeviceName); + + QString playlistItemId() const; + + void setPlaylistItemId(QString newPlaylistItemId); + + QString serverId() const; + + void setServerId(QString newServerId); + + QString userPrimaryImageTag() const; + + void setUserPrimaryImageTag(QString newUserPrimaryImageTag); /** * @brief Gets or sets the supported commands. */ - Q_PROPERTY(QList supportedCommands READ supportedCommands WRITE setSupportedCommands NOTIFY supportedCommandsChanged) - - PlayerStateInfo * playState() const; - void setPlayState(PlayerStateInfo * newPlayState); - - QList additionalUsers() const; - void setAdditionalUsers(QList newAdditionalUsers); - - ClientCapabilities * capabilities() const; - void setCapabilities(ClientCapabilities * newCapabilities); - - QString remoteEndPoint() const; - void setRemoteEndPoint(QString newRemoteEndPoint); - - QStringList playableMediaTypes() const; - void setPlayableMediaTypes(QStringList newPlayableMediaTypes); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString userId() const; - void setUserId(QString newUserId); - - QString userName() const; - void setUserName(QString newUserName); - - QString client() const; - void setClient(QString newClient); - - QDateTime lastActivityDate() const; - void setLastActivityDate(QDateTime newLastActivityDate); - - QDateTime lastPlaybackCheckIn() const; - void setLastPlaybackCheckIn(QDateTime newLastPlaybackCheckIn); - - QString deviceName() const; - void setDeviceName(QString newDeviceName); - - QString deviceType() const; - void setDeviceType(QString newDeviceType); - - BaseItemDto * nowPlayingItem() const; - void setNowPlayingItem(BaseItemDto * newNowPlayingItem); - - BaseItem * fullNowPlayingItem() const; - void setFullNowPlayingItem(BaseItem * newFullNowPlayingItem); - - BaseItemDto * nowViewingItem() const; - void setNowViewingItem(BaseItemDto * newNowViewingItem); - - QString deviceId() const; - void setDeviceId(QString newDeviceId); - - QString applicationVersion() const; - void setApplicationVersion(QString newApplicationVersion); - - TranscodingInfo * transcodingInfo() const; - void setTranscodingInfo(TranscodingInfo * newTranscodingInfo); - - bool isActive() const; - void setIsActive(bool newIsActive); - - bool supportsMediaControl() const; - void setSupportsMediaControl(bool newSupportsMediaControl); - - bool supportsRemoteControl() const; - void setSupportsRemoteControl(bool newSupportsRemoteControl); - - QList nowPlayingQueue() const; - void setNowPlayingQueue(QList newNowPlayingQueue); - - bool hasCustomDeviceName() const; - void setHasCustomDeviceName(bool newHasCustomDeviceName); - - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - - QString serverId() const; - void setServerId(QString newServerId); - - QString userPrimaryImageTag() const; - void setUserPrimaryImageTag(QString newUserPrimaryImageTag); - QList supportedCommands() const; + /** + * @brief Gets or sets the supported commands. + */ void setSupportedCommands(QList newSupportedCommands); - -signals: - void playStateChanged(PlayerStateInfo * newPlayState); - void additionalUsersChanged(QList newAdditionalUsers); - void capabilitiesChanged(ClientCapabilities * newCapabilities); - void remoteEndPointChanged(QString newRemoteEndPoint); - void playableMediaTypesChanged(QStringList newPlayableMediaTypes); - void jellyfinIdChanged(QString newJellyfinId); - void userIdChanged(QString newUserId); - void userNameChanged(QString newUserName); - void clientChanged(QString newClient); - void lastActivityDateChanged(QDateTime newLastActivityDate); - void lastPlaybackCheckInChanged(QDateTime newLastPlaybackCheckIn); - void deviceNameChanged(QString newDeviceName); - void deviceTypeChanged(QString newDeviceType); - void nowPlayingItemChanged(BaseItemDto * newNowPlayingItem); - void fullNowPlayingItemChanged(BaseItem * newFullNowPlayingItem); - void nowViewingItemChanged(BaseItemDto * newNowViewingItem); - void deviceIdChanged(QString newDeviceId); - void applicationVersionChanged(QString newApplicationVersion); - void transcodingInfoChanged(TranscodingInfo * newTranscodingInfo); - void isActiveChanged(bool newIsActive); - void supportsMediaControlChanged(bool newSupportsMediaControl); - void supportsRemoteControlChanged(bool newSupportsRemoteControl); - void nowPlayingQueueChanged(QList newNowPlayingQueue); - void hasCustomDeviceNameChanged(bool newHasCustomDeviceName); - void playlistItemIdChanged(QString newPlaylistItemId); - void serverIdChanged(QString newServerId); - void userPrimaryImageTagChanged(QString newUserPrimaryImageTag); - void supportedCommandsChanged(QList newSupportedCommands); + protected: - PlayerStateInfo * m_playState = nullptr; - QList m_additionalUsers; - ClientCapabilities * m_capabilities = nullptr; + QSharedPointer m_playState = nullptr; + QList> m_additionalUsers; + QSharedPointer m_capabilities = nullptr; QString m_remoteEndPoint; QStringList m_playableMediaTypes; QString m_jellyfinId; - QString m_userId; + QUuid m_userId; QString m_userName; QString m_client; QDateTime m_lastActivityDate; QDateTime m_lastPlaybackCheckIn; QString m_deviceName; QString m_deviceType; - BaseItemDto * m_nowPlayingItem = nullptr; - BaseItem * m_fullNowPlayingItem = nullptr; - BaseItemDto * m_nowViewingItem = nullptr; + QSharedPointer m_nowPlayingItem = nullptr; + QSharedPointer m_fullNowPlayingItem = nullptr; + QSharedPointer m_nowViewingItem = nullptr; QString m_deviceId; QString m_applicationVersion; - TranscodingInfo * m_transcodingInfo = nullptr; + QSharedPointer m_transcodingInfo = nullptr; bool m_isActive; bool m_supportsMediaControl; bool m_supportsRemoteControl; - QList m_nowPlayingQueue; + QList> m_nowPlayingQueue; bool m_hasCustomDeviceName; QString m_playlistItemId; QString m_serverId; @@ -274,6 +262,18 @@ protected: QList m_supportedCommands; }; +} // NS DTO + +namespace Support { + +using SessionInfo = Jellyfin::DTO::SessionInfo; + +template <> +SessionInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SessionInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/sessionuserinfo.h b/core/include/JellyfinQt/DTO/sessionuserinfo.h index 43b1b36..3c15bdc 100644 --- a/core/include/JellyfinQt/DTO/sessionuserinfo.h +++ b/core/include/JellyfinQt/DTO/sessionuserinfo.h @@ -31,43 +31,59 @@ #define JELLYFIN_DTO_SESSIONUSERINFO_H #include -#include +#include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SessionUserInfo : public QObject { - Q_OBJECT -public: - explicit SessionUserInfo(QObject *parent = nullptr); - static SessionUserInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SessionUserInfo { +public: + explicit SessionUserInfo(); + static SessionUserInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the user identifier. */ - Q_PROPERTY(QString userId READ userId WRITE setUserId NOTIFY userIdChanged) + QUuid userId() const; + /** + * @brief Gets or sets the user identifier. + */ + void setUserId(QUuid newUserId); /** * @brief Gets or sets the name of the user. */ - Q_PROPERTY(QString userName READ userName WRITE setUserName NOTIFY userNameChanged) - - QString userId() const; - void setUserId(QString newUserId); - QString userName() const; + /** + * @brief Gets or sets the name of the user. + */ void setUserName(QString newUserName); - -signals: - void userIdChanged(QString newUserId); - void userNameChanged(QString newUserName); + protected: - QString m_userId; + QUuid m_userId; QString m_userName; }; +} // NS DTO + +namespace Support { + +using SessionUserInfo = Jellyfin::DTO::SessionUserInfo; + +template <> +SessionUserInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SessionUserInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/setchannelmappingdto.h b/core/include/JellyfinQt/DTO/setchannelmappingdto.h index 79e0848..52b1131 100644 --- a/core/include/JellyfinQt/DTO/setchannelmappingdto.h +++ b/core/include/JellyfinQt/DTO/setchannelmappingdto.h @@ -31,52 +31,67 @@ #define JELLYFIN_DTO_SETCHANNELMAPPINGDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SetChannelMappingDto : public QObject { - Q_OBJECT -public: - explicit SetChannelMappingDto(QObject *parent = nullptr); - static SetChannelMappingDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SetChannelMappingDto { +public: + explicit SetChannelMappingDto(); + static SetChannelMappingDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the provider id. */ - Q_PROPERTY(QString providerId READ providerId WRITE setProviderId NOTIFY providerIdChanged) + QString providerId() const; + /** + * @brief Gets or sets the provider id. + */ + void setProviderId(QString newProviderId); /** * @brief Gets or sets the tuner channel id. */ - Q_PROPERTY(QString tunerChannelId READ tunerChannelId WRITE setTunerChannelId NOTIFY tunerChannelIdChanged) + QString tunerChannelId() const; + /** + * @brief Gets or sets the tuner channel id. + */ + void setTunerChannelId(QString newTunerChannelId); /** * @brief Gets or sets the provider channel id. */ - Q_PROPERTY(QString providerChannelId READ providerChannelId WRITE setProviderChannelId NOTIFY providerChannelIdChanged) - - QString providerId() const; - void setProviderId(QString newProviderId); - - QString tunerChannelId() const; - void setTunerChannelId(QString newTunerChannelId); - QString providerChannelId() const; + /** + * @brief Gets or sets the provider channel id. + */ void setProviderChannelId(QString newProviderChannelId); - -signals: - void providerIdChanged(QString newProviderId); - void tunerChannelIdChanged(QString newTunerChannelId); - void providerChannelIdChanged(QString newProviderChannelId); + protected: QString m_providerId; QString m_tunerChannelId; QString m_providerChannelId; }; +} // NS DTO + +namespace Support { + +using SetChannelMappingDto = Jellyfin::DTO::SetChannelMappingDto; + +template <> +SetChannelMappingDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SetChannelMappingDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/setplaylistitemrequestdto.h b/core/include/JellyfinQt/DTO/setplaylistitemrequestdto.h index ff3cc92..8e3bd75 100644 --- a/core/include/JellyfinQt/DTO/setplaylistitemrequestdto.h +++ b/core/include/JellyfinQt/DTO/setplaylistitemrequestdto.h @@ -31,34 +31,49 @@ #define JELLYFIN_DTO_SETPLAYLISTITEMREQUESTDTO_H #include -#include -#include +#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SetPlaylistItemRequestDto : public QObject { - Q_OBJECT -public: - explicit SetPlaylistItemRequestDto(QObject *parent = nullptr); - static SetPlaylistItemRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SetPlaylistItemRequestDto { +public: + explicit SetPlaylistItemRequestDto(); + static SetPlaylistItemRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the playlist identifier of the playing item. */ - Q_PROPERTY(QString playlistItemId READ playlistItemId WRITE setPlaylistItemId NOTIFY playlistItemIdChanged) + QUuid playlistItemId() const; + /** + * @brief Gets or sets the playlist identifier of the playing item. + */ + void setPlaylistItemId(QUuid newPlaylistItemId); - QString playlistItemId() const; - void setPlaylistItemId(QString newPlaylistItemId); - -signals: - void playlistItemIdChanged(QString newPlaylistItemId); protected: - QString m_playlistItemId; + QUuid m_playlistItemId; }; +} // NS DTO + +namespace Support { + +using SetPlaylistItemRequestDto = Jellyfin::DTO::SetPlaylistItemRequestDto; + +template <> +SetPlaylistItemRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SetPlaylistItemRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/setrepeatmoderequestdto.h b/core/include/JellyfinQt/DTO/setrepeatmoderequestdto.h index 5551ca3..e2c03e6 100644 --- a/core/include/JellyfinQt/DTO/setrepeatmoderequestdto.h +++ b/core/include/JellyfinQt/DTO/setrepeatmoderequestdto.h @@ -31,32 +31,45 @@ #define JELLYFIN_DTO_SETREPEATMODEREQUESTDTO_H #include -#include +#include +#include #include "JellyfinQt/DTO/grouprepeatmode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SetRepeatModeRequestDto : public QObject { - Q_OBJECT -public: - explicit SetRepeatModeRequestDto(QObject *parent = nullptr); - static SetRepeatModeRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(GroupRepeatMode mode READ mode WRITE setMode NOTIFY modeChanged) +class SetRepeatModeRequestDto { +public: + explicit SetRepeatModeRequestDto(); + static SetRepeatModeRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties GroupRepeatMode mode() const; + void setMode(GroupRepeatMode newMode); - -signals: - void modeChanged(GroupRepeatMode newMode); + protected: GroupRepeatMode m_mode; }; +} // NS DTO + +namespace Support { + +using SetRepeatModeRequestDto = Jellyfin::DTO::SetRepeatModeRequestDto; + +template <> +SetRepeatModeRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SetRepeatModeRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/setshufflemoderequestdto.h b/core/include/JellyfinQt/DTO/setshufflemoderequestdto.h index d1864fb..20161af 100644 --- a/core/include/JellyfinQt/DTO/setshufflemoderequestdto.h +++ b/core/include/JellyfinQt/DTO/setshufflemoderequestdto.h @@ -31,32 +31,45 @@ #define JELLYFIN_DTO_SETSHUFFLEMODEREQUESTDTO_H #include -#include +#include +#include #include "JellyfinQt/DTO/groupshufflemode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SetShuffleModeRequestDto : public QObject { - Q_OBJECT -public: - explicit SetShuffleModeRequestDto(QObject *parent = nullptr); - static SetShuffleModeRequestDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(GroupShuffleMode mode READ mode WRITE setMode NOTIFY modeChanged) +class SetShuffleModeRequestDto { +public: + explicit SetShuffleModeRequestDto(); + static SetShuffleModeRequestDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties GroupShuffleMode mode() const; + void setMode(GroupShuffleMode newMode); - -signals: - void modeChanged(GroupShuffleMode newMode); + protected: GroupShuffleMode m_mode; }; +} // NS DTO + +namespace Support { + +using SetShuffleModeRequestDto = Jellyfin::DTO::SetShuffleModeRequestDto; + +template <> +SetShuffleModeRequestDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SetShuffleModeRequestDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/songinfo.h b/core/include/JellyfinQt/DTO/songinfo.h index 472234b..9a4bc58 100644 --- a/core/include/JellyfinQt/DTO/songinfo.h +++ b/core/include/JellyfinQt/DTO/songinfo.h @@ -32,107 +32,103 @@ #include #include +#include #include -#include #include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SongInfo : public QObject { - Q_OBJECT -public: - explicit SongInfo(QObject *parent = nullptr); - static SongInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SongInfo { +public: + explicit SongInfo(); + static SongInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - Q_PROPERTY(QStringList albumArtists READ albumArtists WRITE setAlbumArtists NOTIFY albumArtistsChanged) - Q_PROPERTY(QString album READ album WRITE setAlbum NOTIFY albumChanged) - Q_PROPERTY(QStringList artists READ artists WRITE setArtists NOTIFY artistsChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - + QStringList albumArtists() const; + void setAlbumArtists(QStringList newAlbumArtists); - + QString album() const; + void setAlbum(QString newAlbum); - + QStringList artists() const; + void setArtists(QStringList newArtists); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); - void albumArtistsChanged(QStringList newAlbumArtists); - void albumChanged(QString newAlbum); - void artistsChanged(QStringList newArtists); + protected: QString m_name; QString m_path; @@ -149,6 +145,18 @@ protected: QStringList m_artists; }; +} // NS DTO + +namespace Support { + +using SongInfo = Jellyfin::DTO::SongInfo; + +template <> +SongInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SongInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/sortorder.h b/core/include/JellyfinQt/DTO/sortorder.h index 5d12f46..22d2ff1 100644 --- a/core/include/JellyfinQt/DTO/sortorder.h +++ b/core/include/JellyfinQt/DTO/sortorder.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_SORTORDER_H #define JELLYFIN_DTO_SORTORDER_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class SortOrderClass { Q_GADGET public: enum Value { + EnumNotSet, Ascending, Descending, }; @@ -46,8 +51,31 @@ public: private: explicit SortOrderClass(); }; + typedef SortOrderClass::Value SortOrder; +} // NS DTO + +namespace Support { + +using SortOrder = Jellyfin::DTO::SortOrder; +using SortOrderClass = Jellyfin::DTO::SortOrderClass; + +template <> +SortOrder fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return SortOrderClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Ascending")) { + return SortOrderClass::Ascending; + } + if (str == QStringLiteral("Descending")) { + return SortOrderClass::Descending; + } + + return SortOrderClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/specialviewoptiondto.h b/core/include/JellyfinQt/DTO/specialviewoptiondto.h index fd6ccf8..7a9d921 100644 --- a/core/include/JellyfinQt/DTO/specialviewoptiondto.h +++ b/core/include/JellyfinQt/DTO/specialviewoptiondto.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_SPECIALVIEWOPTIONDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SpecialViewOptionDto : public QObject { - Q_OBJECT -public: - explicit SpecialViewOptionDto(QObject *parent = nullptr); - static SpecialViewOptionDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class SpecialViewOptionDto { +public: + explicit SpecialViewOptionDto(); + static SpecialViewOptionDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets view option name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets view option name. + */ + void setName(QString newName); /** * @brief Gets or sets view option id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - - QString name() const; - void setName(QString newName); - QString jellyfinId() const; + /** + * @brief Gets or sets view option id. + */ void setJellyfinId(QString newJellyfinId); - -signals: - void nameChanged(QString newName); - void jellyfinIdChanged(QString newJellyfinId); + protected: QString m_name; QString m_jellyfinId; }; +} // NS DTO + +namespace Support { + +using SpecialViewOptionDto = Jellyfin::DTO::SpecialViewOptionDto; + +template <> +SpecialViewOptionDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SpecialViewOptionDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/startupconfigurationdto.h b/core/include/JellyfinQt/DTO/startupconfigurationdto.h index fd53b02..9f3deb0 100644 --- a/core/include/JellyfinQt/DTO/startupconfigurationdto.h +++ b/core/include/JellyfinQt/DTO/startupconfigurationdto.h @@ -31,52 +31,67 @@ #define JELLYFIN_DTO_STARTUPCONFIGURATIONDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class StartupConfigurationDto : public QObject { - Q_OBJECT -public: - explicit StartupConfigurationDto(QObject *parent = nullptr); - static StartupConfigurationDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class StartupConfigurationDto { +public: + explicit StartupConfigurationDto(); + static StartupConfigurationDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets UI language culture. */ - Q_PROPERTY(QString uICulture READ uICulture WRITE setUICulture NOTIFY uICultureChanged) + QString uICulture() const; + /** + * @brief Gets or sets UI language culture. + */ + void setUICulture(QString newUICulture); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the preferred language for the metadata. */ - Q_PROPERTY(QString preferredMetadataLanguage READ preferredMetadataLanguage WRITE setPreferredMetadataLanguage NOTIFY preferredMetadataLanguageChanged) - - QString uICulture() const; - void setUICulture(QString newUICulture); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - QString preferredMetadataLanguage() const; + /** + * @brief Gets or sets the preferred language for the metadata. + */ void setPreferredMetadataLanguage(QString newPreferredMetadataLanguage); - -signals: - void uICultureChanged(QString newUICulture); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void preferredMetadataLanguageChanged(QString newPreferredMetadataLanguage); + protected: QString m_uICulture; QString m_metadataCountryCode; QString m_preferredMetadataLanguage; }; +} // NS DTO + +namespace Support { + +using StartupConfigurationDto = Jellyfin::DTO::StartupConfigurationDto; + +template <> +StartupConfigurationDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return StartupConfigurationDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/startupremoteaccessdto.h b/core/include/JellyfinQt/DTO/startupremoteaccessdto.h index f5b9094..04e3f96 100644 --- a/core/include/JellyfinQt/DTO/startupremoteaccessdto.h +++ b/core/include/JellyfinQt/DTO/startupremoteaccessdto.h @@ -31,42 +31,57 @@ #define JELLYFIN_DTO_STARTUPREMOTEACCESSDTO_H #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class StartupRemoteAccessDto : public QObject { - Q_OBJECT -public: - explicit StartupRemoteAccessDto(QObject *parent = nullptr); - static StartupRemoteAccessDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class StartupRemoteAccessDto { +public: + explicit StartupRemoteAccessDto(); + static StartupRemoteAccessDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets a value indicating whether enable remote access. */ - Q_PROPERTY(bool enableRemoteAccess READ enableRemoteAccess WRITE setEnableRemoteAccess NOTIFY enableRemoteAccessChanged) + bool enableRemoteAccess() const; + /** + * @brief Gets or sets a value indicating whether enable remote access. + */ + void setEnableRemoteAccess(bool newEnableRemoteAccess); /** * @brief Gets or sets a value indicating whether enable automatic port mapping. */ - Q_PROPERTY(bool enableAutomaticPortMapping READ enableAutomaticPortMapping WRITE setEnableAutomaticPortMapping NOTIFY enableAutomaticPortMappingChanged) - - bool enableRemoteAccess() const; - void setEnableRemoteAccess(bool newEnableRemoteAccess); - bool enableAutomaticPortMapping() const; + /** + * @brief Gets or sets a value indicating whether enable automatic port mapping. + */ void setEnableAutomaticPortMapping(bool newEnableAutomaticPortMapping); - -signals: - void enableRemoteAccessChanged(bool newEnableRemoteAccess); - void enableAutomaticPortMappingChanged(bool newEnableAutomaticPortMapping); + protected: bool m_enableRemoteAccess; bool m_enableAutomaticPortMapping; }; +} // NS DTO + +namespace Support { + +using StartupRemoteAccessDto = Jellyfin::DTO::StartupRemoteAccessDto; + +template <> +StartupRemoteAccessDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return StartupRemoteAccessDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/startupuserdto.h b/core/include/JellyfinQt/DTO/startupuserdto.h index e380992..fe52704 100644 --- a/core/include/JellyfinQt/DTO/startupuserdto.h +++ b/core/include/JellyfinQt/DTO/startupuserdto.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_STARTUPUSERDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class StartupUserDto : public QObject { - Q_OBJECT -public: - explicit StartupUserDto(QObject *parent = nullptr); - static StartupUserDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class StartupUserDto { +public: + explicit StartupUserDto(); + static StartupUserDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the username. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the username. + */ + void setName(QString newName); /** * @brief Gets or sets the user's password. */ - Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) - - QString name() const; - void setName(QString newName); - QString password() const; + /** + * @brief Gets or sets the user's password. + */ void setPassword(QString newPassword); - -signals: - void nameChanged(QString newName); - void passwordChanged(QString newPassword); + protected: QString m_name; QString m_password; }; +} // NS DTO + +namespace Support { + +using StartupUserDto = Jellyfin::DTO::StartupUserDto; + +template <> +StartupUserDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return StartupUserDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/subtitledeliverymethod.h b/core/include/JellyfinQt/DTO/subtitledeliverymethod.h index 5258ba7..7a6c9c3 100644 --- a/core/include/JellyfinQt/DTO/subtitledeliverymethod.h +++ b/core/include/JellyfinQt/DTO/subtitledeliverymethod.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_SUBTITLEDELIVERYMETHOD_H #define JELLYFIN_DTO_SUBTITLEDELIVERYMETHOD_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class SubtitleDeliveryMethodClass { Q_GADGET public: enum Value { + EnumNotSet, Encode, Embed, External, @@ -48,8 +53,37 @@ public: private: explicit SubtitleDeliveryMethodClass(); }; + typedef SubtitleDeliveryMethodClass::Value SubtitleDeliveryMethod; +} // NS DTO + +namespace Support { + +using SubtitleDeliveryMethod = Jellyfin::DTO::SubtitleDeliveryMethod; +using SubtitleDeliveryMethodClass = Jellyfin::DTO::SubtitleDeliveryMethodClass; + +template <> +SubtitleDeliveryMethod fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return SubtitleDeliveryMethodClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Encode")) { + return SubtitleDeliveryMethodClass::Encode; + } + if (str == QStringLiteral("Embed")) { + return SubtitleDeliveryMethodClass::Embed; + } + if (str == QStringLiteral("External")) { + return SubtitleDeliveryMethodClass::External; + } + if (str == QStringLiteral("Hls")) { + return SubtitleDeliveryMethodClass::Hls; + } + + return SubtitleDeliveryMethodClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/subtitleplaybackmode.h b/core/include/JellyfinQt/DTO/subtitleplaybackmode.h index ff12583..217efe9 100644 --- a/core/include/JellyfinQt/DTO/subtitleplaybackmode.h +++ b/core/include/JellyfinQt/DTO/subtitleplaybackmode.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_SUBTITLEPLAYBACKMODE_H #define JELLYFIN_DTO_SUBTITLEPLAYBACKMODE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class SubtitlePlaybackModeClass { Q_GADGET public: enum Value { + EnumNotSet, Default, Always, OnlyForced, @@ -49,8 +54,40 @@ public: private: explicit SubtitlePlaybackModeClass(); }; + typedef SubtitlePlaybackModeClass::Value SubtitlePlaybackMode; +} // NS DTO + +namespace Support { + +using SubtitlePlaybackMode = Jellyfin::DTO::SubtitlePlaybackMode; +using SubtitlePlaybackModeClass = Jellyfin::DTO::SubtitlePlaybackModeClass; + +template <> +SubtitlePlaybackMode fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return SubtitlePlaybackModeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Default")) { + return SubtitlePlaybackModeClass::Default; + } + if (str == QStringLiteral("Always")) { + return SubtitlePlaybackModeClass::Always; + } + if (str == QStringLiteral("OnlyForced")) { + return SubtitlePlaybackModeClass::OnlyForced; + } + if (str == QStringLiteral("None")) { + return SubtitlePlaybackModeClass::None; + } + if (str == QStringLiteral("Smart")) { + return SubtitlePlaybackModeClass::Smart; + } + + return SubtitlePlaybackModeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/subtitleprofile.h b/core/include/JellyfinQt/DTO/subtitleprofile.h index 369a151..41c88c1 100644 --- a/core/include/JellyfinQt/DTO/subtitleprofile.h +++ b/core/include/JellyfinQt/DTO/subtitleprofile.h @@ -31,49 +31,46 @@ #define JELLYFIN_DTO_SUBTITLEPROFILE_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/subtitledeliverymethod.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class SubtitleProfile : public QObject { - Q_OBJECT -public: - explicit SubtitleProfile(QObject *parent = nullptr); - static SubtitleProfile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged) - Q_PROPERTY(SubtitleDeliveryMethod method READ method WRITE setMethod NOTIFY methodChanged) - Q_PROPERTY(QString didlMode READ didlMode WRITE setDidlMode NOTIFY didlModeChanged) - Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged) - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) +class SubtitleProfile { +public: + explicit SubtitleProfile(); + static SubtitleProfile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString format() const; + void setFormat(QString newFormat); - + SubtitleDeliveryMethod method() const; + void setMethod(SubtitleDeliveryMethod newMethod); - + QString didlMode() const; + void setDidlMode(QString newDidlMode); - + QString language() const; + void setLanguage(QString newLanguage); - + QString container() const; + void setContainer(QString newContainer); - -signals: - void formatChanged(QString newFormat); - void methodChanged(SubtitleDeliveryMethod newMethod); - void didlModeChanged(QString newDidlMode); - void languageChanged(QString newLanguage); - void containerChanged(QString newContainer); + protected: QString m_format; SubtitleDeliveryMethod m_method; @@ -82,6 +79,18 @@ protected: QString m_container; }; +} // NS DTO + +namespace Support { + +using SubtitleProfile = Jellyfin::DTO::SubtitleProfile; + +template <> +SubtitleProfile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SubtitleProfile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/syncplayuseraccesstype.h b/core/include/JellyfinQt/DTO/syncplayuseraccesstype.h index 88658a8..2838534 100644 --- a/core/include/JellyfinQt/DTO/syncplayuseraccesstype.h +++ b/core/include/JellyfinQt/DTO/syncplayuseraccesstype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_SYNCPLAYUSERACCESSTYPE_H #define JELLYFIN_DTO_SYNCPLAYUSERACCESSTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class SyncPlayUserAccessTypeClass { Q_GADGET public: enum Value { + EnumNotSet, CreateAndJoinGroups, JoinGroups, None, @@ -47,8 +52,34 @@ public: private: explicit SyncPlayUserAccessTypeClass(); }; + typedef SyncPlayUserAccessTypeClass::Value SyncPlayUserAccessType; +} // NS DTO + +namespace Support { + +using SyncPlayUserAccessType = Jellyfin::DTO::SyncPlayUserAccessType; +using SyncPlayUserAccessTypeClass = Jellyfin::DTO::SyncPlayUserAccessTypeClass; + +template <> +SyncPlayUserAccessType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return SyncPlayUserAccessTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("CreateAndJoinGroups")) { + return SyncPlayUserAccessTypeClass::CreateAndJoinGroups; + } + if (str == QStringLiteral("JoinGroups")) { + return SyncPlayUserAccessTypeClass::JoinGroups; + } + if (str == QStringLiteral("None")) { + return SyncPlayUserAccessTypeClass::None; + } + + return SyncPlayUserAccessTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/systeminfo.h b/core/include/JellyfinQt/DTO/systeminfo.h index b1c1f8c..a8a9762 100644 --- a/core/include/JellyfinQt/DTO/systeminfo.h +++ b/core/include/JellyfinQt/DTO/systeminfo.h @@ -31,225 +31,223 @@ #define JELLYFIN_DTO_SYSTEMINFO_H #include +#include #include -#include +#include #include #include +#include #include "JellyfinQt/DTO/architecture.h" #include "JellyfinQt/DTO/ffmpeglocation.h" +#include "JellyfinQt/DTO/installationinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class InstallationInfo; -class SystemInfo : public QObject { - Q_OBJECT +class SystemInfo { public: - explicit SystemInfo(QObject *parent = nullptr); - static SystemInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit SystemInfo(); + static SystemInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the local address. */ - Q_PROPERTY(QString localAddress READ localAddress WRITE setLocalAddress NOTIFY localAddressChanged) + QString localAddress() const; + /** + * @brief Gets or sets the local address. + */ + void setLocalAddress(QString newLocalAddress); /** * @brief Gets or sets the name of the server. */ - Q_PROPERTY(QString serverName READ serverName WRITE setServerName NOTIFY serverNameChanged) + QString serverName() const; + /** + * @brief Gets or sets the name of the server. + */ + void setServerName(QString newServerName); /** * @brief Gets or sets the server version. */ - Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY versionChanged) + QString version() const; + /** + * @brief Gets or sets the server version. + */ + void setVersion(QString newVersion); /** * @brief Gets or sets the product name. This is the AssemblyProduct name. */ - Q_PROPERTY(QString productName READ productName WRITE setProductName NOTIFY productNameChanged) + QString productName() const; + /** + * @brief Gets or sets the product name. This is the AssemblyProduct name. + */ + void setProductName(QString newProductName); /** * @brief Gets or sets the operating system. */ - Q_PROPERTY(QString operatingSystem READ operatingSystem WRITE setOperatingSystem NOTIFY operatingSystemChanged) + QString operatingSystem() const; + /** + * @brief Gets or sets the operating system. + */ + void setOperatingSystem(QString newOperatingSystem); /** * @brief Gets or sets the id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the id. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets a value indicating whether the startup wizard is completed. */ - Q_PROPERTY(bool startupWizardCompleted READ startupWizardCompleted WRITE setStartupWizardCompleted NOTIFY startupWizardCompletedChanged) + bool startupWizardCompleted() const; + /** + * @brief Gets or sets a value indicating whether the startup wizard is completed. + */ + void setStartupWizardCompleted(bool newStartupWizardCompleted); /** * @brief Gets or sets the display name of the operating system. */ - Q_PROPERTY(QString operatingSystemDisplayName READ operatingSystemDisplayName WRITE setOperatingSystemDisplayName NOTIFY operatingSystemDisplayNameChanged) + QString operatingSystemDisplayName() const; + /** + * @brief Gets or sets the display name of the operating system. + */ + void setOperatingSystemDisplayName(QString newOperatingSystemDisplayName); /** * @brief Get or sets the package name. */ - Q_PROPERTY(QString packageName READ packageName WRITE setPackageName NOTIFY packageNameChanged) + QString packageName() const; + /** + * @brief Get or sets the package name. + */ + void setPackageName(QString newPackageName); /** * @brief Gets or sets a value indicating whether this instance has pending restart. */ - Q_PROPERTY(bool hasPendingRestart READ hasPendingRestart WRITE setHasPendingRestart NOTIFY hasPendingRestartChanged) - Q_PROPERTY(bool isShuttingDown READ isShuttingDown WRITE setIsShuttingDown NOTIFY isShuttingDownChanged) + bool hasPendingRestart() const; + /** + * @brief Gets or sets a value indicating whether this instance has pending restart. + */ + void setHasPendingRestart(bool newHasPendingRestart); + + bool isShuttingDown() const; + + void setIsShuttingDown(bool newIsShuttingDown); /** * @brief Gets or sets a value indicating whether [supports library monitor]. */ - Q_PROPERTY(bool supportsLibraryMonitor READ supportsLibraryMonitor WRITE setSupportsLibraryMonitor NOTIFY supportsLibraryMonitorChanged) + bool supportsLibraryMonitor() const; + /** + * @brief Gets or sets a value indicating whether [supports library monitor]. + */ + void setSupportsLibraryMonitor(bool newSupportsLibraryMonitor); /** * @brief Gets or sets the web socket port number. */ - Q_PROPERTY(qint32 webSocketPortNumber READ webSocketPortNumber WRITE setWebSocketPortNumber NOTIFY webSocketPortNumberChanged) + qint32 webSocketPortNumber() const; + /** + * @brief Gets or sets the web socket port number. + */ + void setWebSocketPortNumber(qint32 newWebSocketPortNumber); /** * @brief Gets or sets the completed installations. */ - Q_PROPERTY(QList completedInstallations READ completedInstallations WRITE setCompletedInstallations NOTIFY completedInstallationsChanged) + QList> completedInstallations() const; + /** + * @brief Gets or sets the completed installations. + */ + void setCompletedInstallations(QList> newCompletedInstallations); /** * @brief Gets or sets a value indicating whether this instance can self restart. */ - Q_PROPERTY(bool canSelfRestart READ canSelfRestart WRITE setCanSelfRestart NOTIFY canSelfRestartChanged) - Q_PROPERTY(bool canLaunchWebBrowser READ canLaunchWebBrowser WRITE setCanLaunchWebBrowser NOTIFY canLaunchWebBrowserChanged) + bool canSelfRestart() const; + /** + * @brief Gets or sets a value indicating whether this instance can self restart. + */ + void setCanSelfRestart(bool newCanSelfRestart); + + bool canLaunchWebBrowser() const; + + void setCanLaunchWebBrowser(bool newCanLaunchWebBrowser); /** * @brief Gets or sets the program data path. */ - Q_PROPERTY(QString programDataPath READ programDataPath WRITE setProgramDataPath NOTIFY programDataPathChanged) + QString programDataPath() const; + /** + * @brief Gets or sets the program data path. + */ + void setProgramDataPath(QString newProgramDataPath); /** * @brief Gets or sets the web UI resources path. */ - Q_PROPERTY(QString webPath READ webPath WRITE setWebPath NOTIFY webPathChanged) + QString webPath() const; + /** + * @brief Gets or sets the web UI resources path. + */ + void setWebPath(QString newWebPath); /** * @brief Gets or sets the items by name path. */ - Q_PROPERTY(QString itemsByNamePath READ itemsByNamePath WRITE setItemsByNamePath NOTIFY itemsByNamePathChanged) + QString itemsByNamePath() const; + /** + * @brief Gets or sets the items by name path. + */ + void setItemsByNamePath(QString newItemsByNamePath); /** * @brief Gets or sets the cache path. */ - Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath NOTIFY cachePathChanged) + QString cachePath() const; + /** + * @brief Gets or sets the cache path. + */ + void setCachePath(QString newCachePath); /** * @brief Gets or sets the log path. */ - Q_PROPERTY(QString logPath READ logPath WRITE setLogPath NOTIFY logPathChanged) + QString logPath() const; + /** + * @brief Gets or sets the log path. + */ + void setLogPath(QString newLogPath); /** * @brief Gets or sets the internal metadata path. */ - Q_PROPERTY(QString internalMetadataPath READ internalMetadataPath WRITE setInternalMetadataPath NOTIFY internalMetadataPathChanged) + QString internalMetadataPath() const; + /** + * @brief Gets or sets the internal metadata path. + */ + void setInternalMetadataPath(QString newInternalMetadataPath); /** * @brief Gets or sets the transcode path. */ - Q_PROPERTY(QString transcodingTempPath READ transcodingTempPath WRITE setTranscodingTempPath NOTIFY transcodingTempPathChanged) + QString transcodingTempPath() const; + /** + * @brief Gets or sets the transcode path. + */ + void setTranscodingTempPath(QString newTranscodingTempPath); /** * @brief Gets or sets a value indicating whether this instance has update available. */ - Q_PROPERTY(bool hasUpdateAvailable READ hasUpdateAvailable WRITE setHasUpdateAvailable NOTIFY hasUpdateAvailableChanged) - Q_PROPERTY(FFmpegLocation encoderLocation READ encoderLocation WRITE setEncoderLocation NOTIFY encoderLocationChanged) - Q_PROPERTY(Architecture systemArchitecture READ systemArchitecture WRITE setSystemArchitecture NOTIFY systemArchitectureChanged) - - QString localAddress() const; - void setLocalAddress(QString newLocalAddress); - - QString serverName() const; - void setServerName(QString newServerName); - - QString version() const; - void setVersion(QString newVersion); - - QString productName() const; - void setProductName(QString newProductName); - - QString operatingSystem() const; - void setOperatingSystem(QString newOperatingSystem); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - bool startupWizardCompleted() const; - void setStartupWizardCompleted(bool newStartupWizardCompleted); - - QString operatingSystemDisplayName() const; - void setOperatingSystemDisplayName(QString newOperatingSystemDisplayName); - - QString packageName() const; - void setPackageName(QString newPackageName); - - bool hasPendingRestart() const; - void setHasPendingRestart(bool newHasPendingRestart); - - bool isShuttingDown() const; - void setIsShuttingDown(bool newIsShuttingDown); - - bool supportsLibraryMonitor() const; - void setSupportsLibraryMonitor(bool newSupportsLibraryMonitor); - - qint32 webSocketPortNumber() const; - void setWebSocketPortNumber(qint32 newWebSocketPortNumber); - - QList completedInstallations() const; - void setCompletedInstallations(QList newCompletedInstallations); - - bool canSelfRestart() const; - void setCanSelfRestart(bool newCanSelfRestart); - - bool canLaunchWebBrowser() const; - void setCanLaunchWebBrowser(bool newCanLaunchWebBrowser); - - QString programDataPath() const; - void setProgramDataPath(QString newProgramDataPath); - - QString webPath() const; - void setWebPath(QString newWebPath); - - QString itemsByNamePath() const; - void setItemsByNamePath(QString newItemsByNamePath); - - QString cachePath() const; - void setCachePath(QString newCachePath); - - QString logPath() const; - void setLogPath(QString newLogPath); - - QString internalMetadataPath() const; - void setInternalMetadataPath(QString newInternalMetadataPath); - - QString transcodingTempPath() const; - void setTranscodingTempPath(QString newTranscodingTempPath); - bool hasUpdateAvailable() const; + /** + * @brief Gets or sets a value indicating whether this instance has update available. + */ void setHasUpdateAvailable(bool newHasUpdateAvailable); - + FFmpegLocation encoderLocation() const; + void setEncoderLocation(FFmpegLocation newEncoderLocation); - + Architecture systemArchitecture() const; + void setSystemArchitecture(Architecture newSystemArchitecture); - -signals: - void localAddressChanged(QString newLocalAddress); - void serverNameChanged(QString newServerName); - void versionChanged(QString newVersion); - void productNameChanged(QString newProductName); - void operatingSystemChanged(QString newOperatingSystem); - void jellyfinIdChanged(QString newJellyfinId); - void startupWizardCompletedChanged(bool newStartupWizardCompleted); - void operatingSystemDisplayNameChanged(QString newOperatingSystemDisplayName); - void packageNameChanged(QString newPackageName); - void hasPendingRestartChanged(bool newHasPendingRestart); - void isShuttingDownChanged(bool newIsShuttingDown); - void supportsLibraryMonitorChanged(bool newSupportsLibraryMonitor); - void webSocketPortNumberChanged(qint32 newWebSocketPortNumber); - void completedInstallationsChanged(QList newCompletedInstallations); - void canSelfRestartChanged(bool newCanSelfRestart); - void canLaunchWebBrowserChanged(bool newCanLaunchWebBrowser); - void programDataPathChanged(QString newProgramDataPath); - void webPathChanged(QString newWebPath); - void itemsByNamePathChanged(QString newItemsByNamePath); - void cachePathChanged(QString newCachePath); - void logPathChanged(QString newLogPath); - void internalMetadataPathChanged(QString newInternalMetadataPath); - void transcodingTempPathChanged(QString newTranscodingTempPath); - void hasUpdateAvailableChanged(bool newHasUpdateAvailable); - void encoderLocationChanged(FFmpegLocation newEncoderLocation); - void systemArchitectureChanged(Architecture newSystemArchitecture); + protected: QString m_localAddress; QString m_serverName; @@ -264,7 +262,7 @@ protected: bool m_isShuttingDown; bool m_supportsLibraryMonitor; qint32 m_webSocketPortNumber; - QList m_completedInstallations; + QList> m_completedInstallations; bool m_canSelfRestart; bool m_canLaunchWebBrowser; QString m_programDataPath; @@ -279,6 +277,18 @@ protected: Architecture m_systemArchitecture; }; +} // NS DTO + +namespace Support { + +using SystemInfo = Jellyfin::DTO::SystemInfo; + +template <> +SystemInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return SystemInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/taskcompletionstatus.h b/core/include/JellyfinQt/DTO/taskcompletionstatus.h index 7782bdd..b4ce2b3 100644 --- a/core/include/JellyfinQt/DTO/taskcompletionstatus.h +++ b/core/include/JellyfinQt/DTO/taskcompletionstatus.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_TASKCOMPLETIONSTATUS_H #define JELLYFIN_DTO_TASKCOMPLETIONSTATUS_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class TaskCompletionStatusClass { Q_GADGET public: enum Value { + EnumNotSet, Completed, Failed, Cancelled, @@ -48,8 +53,37 @@ public: private: explicit TaskCompletionStatusClass(); }; + typedef TaskCompletionStatusClass::Value TaskCompletionStatus; +} // NS DTO + +namespace Support { + +using TaskCompletionStatus = Jellyfin::DTO::TaskCompletionStatus; +using TaskCompletionStatusClass = Jellyfin::DTO::TaskCompletionStatusClass; + +template <> +TaskCompletionStatus fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return TaskCompletionStatusClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Completed")) { + return TaskCompletionStatusClass::Completed; + } + if (str == QStringLiteral("Failed")) { + return TaskCompletionStatusClass::Failed; + } + if (str == QStringLiteral("Cancelled")) { + return TaskCompletionStatusClass::Cancelled; + } + if (str == QStringLiteral("Aborted")) { + return TaskCompletionStatusClass::Aborted; + } + + return TaskCompletionStatusClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/taskinfo.h b/core/include/JellyfinQt/DTO/taskinfo.h index 5dd4b17..48ff19f 100644 --- a/core/include/JellyfinQt/DTO/taskinfo.h +++ b/core/include/JellyfinQt/DTO/taskinfo.h @@ -31,116 +31,128 @@ #define JELLYFIN_DTO_TASKINFO_H #include +#include #include -#include +#include #include #include +#include +#include "JellyfinQt/DTO/taskresult.h" #include "JellyfinQt/DTO/taskstate.h" +#include "JellyfinQt/DTO/tasktriggerinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TaskResult; -class TaskTriggerInfo; -class TaskInfo : public QObject { - Q_OBJECT +class TaskInfo { public: - explicit TaskInfo(QObject *parent = nullptr); - static TaskInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit TaskInfo(); + static TaskInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(TaskState state READ state WRITE setState NOTIFY stateChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); + + TaskState state() const; + + void setState(TaskState newState); /** * @brief Gets or sets the progress. */ - Q_PROPERTY(double currentProgressPercentage READ currentProgressPercentage WRITE setCurrentProgressPercentage NOTIFY currentProgressPercentageChanged) + double currentProgressPercentage() const; + /** + * @brief Gets or sets the progress. + */ + void setCurrentProgressPercentage(double newCurrentProgressPercentage); /** * @brief Gets or sets the id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(TaskResult * lastExecutionResult READ lastExecutionResult WRITE setLastExecutionResult NOTIFY lastExecutionResultChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the id. + */ + void setJellyfinId(QString newJellyfinId); + + QSharedPointer lastExecutionResult() const; + + void setLastExecutionResult(QSharedPointer newLastExecutionResult); /** * @brief Gets or sets the triggers. */ - Q_PROPERTY(QList triggers READ triggers WRITE setTriggers NOTIFY triggersChanged) + QList> triggers() const; + /** + * @brief Gets or sets the triggers. + */ + void setTriggers(QList> newTriggers); /** * @brief Gets or sets the description. */ - Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged) + QString description() const; + /** + * @brief Gets or sets the description. + */ + void setDescription(QString newDescription); /** * @brief Gets or sets the category. */ - Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged) + QString category() const; + /** + * @brief Gets or sets the category. + */ + void setCategory(QString newCategory); /** * @brief Gets or sets a value indicating whether this instance is hidden. */ - Q_PROPERTY(bool isHidden READ isHidden WRITE setIsHidden NOTIFY isHiddenChanged) + bool isHidden() const; + /** + * @brief Gets or sets a value indicating whether this instance is hidden. + */ + void setIsHidden(bool newIsHidden); /** * @brief Gets or sets the key. */ - Q_PROPERTY(QString key READ key WRITE setKey NOTIFY keyChanged) - - QString name() const; - void setName(QString newName); - - TaskState state() const; - void setState(TaskState newState); - - double currentProgressPercentage() const; - void setCurrentProgressPercentage(double newCurrentProgressPercentage); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - TaskResult * lastExecutionResult() const; - void setLastExecutionResult(TaskResult * newLastExecutionResult); - - QList triggers() const; - void setTriggers(QList newTriggers); - - QString description() const; - void setDescription(QString newDescription); - - QString category() const; - void setCategory(QString newCategory); - - bool isHidden() const; - void setIsHidden(bool newIsHidden); - QString key() const; + /** + * @brief Gets or sets the key. + */ void setKey(QString newKey); - -signals: - void nameChanged(QString newName); - void stateChanged(TaskState newState); - void currentProgressPercentageChanged(double newCurrentProgressPercentage); - void jellyfinIdChanged(QString newJellyfinId); - void lastExecutionResultChanged(TaskResult * newLastExecutionResult); - void triggersChanged(QList newTriggers); - void descriptionChanged(QString newDescription); - void categoryChanged(QString newCategory); - void isHiddenChanged(bool newIsHidden); - void keyChanged(QString newKey); + protected: QString m_name; TaskState m_state; double m_currentProgressPercentage; QString m_jellyfinId; - TaskResult * m_lastExecutionResult = nullptr; - QList m_triggers; + QSharedPointer m_lastExecutionResult = nullptr; + QList> m_triggers; QString m_description; QString m_category; bool m_isHidden; QString m_key; }; +} // NS DTO + +namespace Support { + +using TaskInfo = Jellyfin::DTO::TaskInfo; + +template <> +TaskInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TaskInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/taskresult.h b/core/include/JellyfinQt/DTO/taskresult.h index be56e89..0480714 100644 --- a/core/include/JellyfinQt/DTO/taskresult.h +++ b/core/include/JellyfinQt/DTO/taskresult.h @@ -32,85 +32,86 @@ #include #include -#include +#include #include +#include #include "JellyfinQt/DTO/taskcompletionstatus.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TaskResult : public QObject { - Q_OBJECT -public: - explicit TaskResult(QObject *parent = nullptr); - static TaskResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class TaskResult { +public: + explicit TaskResult(); + static TaskResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the start time UTC. */ - Q_PROPERTY(QDateTime startTimeUtc READ startTimeUtc WRITE setStartTimeUtc NOTIFY startTimeUtcChanged) + QDateTime startTimeUtc() const; + /** + * @brief Gets or sets the start time UTC. + */ + void setStartTimeUtc(QDateTime newStartTimeUtc); /** * @brief Gets or sets the end time UTC. */ - Q_PROPERTY(QDateTime endTimeUtc READ endTimeUtc WRITE setEndTimeUtc NOTIFY endTimeUtcChanged) - Q_PROPERTY(TaskCompletionStatus status READ status WRITE setStatus NOTIFY statusChanged) + QDateTime endTimeUtc() const; + /** + * @brief Gets or sets the end time UTC. + */ + void setEndTimeUtc(QDateTime newEndTimeUtc); + + TaskCompletionStatus status() const; + + void setStatus(TaskCompletionStatus newStatus); /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the key. */ - Q_PROPERTY(QString key READ key WRITE setKey NOTIFY keyChanged) + QString key() const; + /** + * @brief Gets or sets the key. + */ + void setKey(QString newKey); /** * @brief Gets or sets the id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QString jellyfinId() const; + /** + * @brief Gets or sets the id. + */ + void setJellyfinId(QString newJellyfinId); /** * @brief Gets or sets the error message. */ - Q_PROPERTY(QString errorMessage READ errorMessage WRITE setErrorMessage NOTIFY errorMessageChanged) + QString errorMessage() const; + /** + * @brief Gets or sets the error message. + */ + void setErrorMessage(QString newErrorMessage); /** * @brief Gets or sets the long error message. */ - Q_PROPERTY(QString longErrorMessage READ longErrorMessage WRITE setLongErrorMessage NOTIFY longErrorMessageChanged) - - QDateTime startTimeUtc() const; - void setStartTimeUtc(QDateTime newStartTimeUtc); - - QDateTime endTimeUtc() const; - void setEndTimeUtc(QDateTime newEndTimeUtc); - - TaskCompletionStatus status() const; - void setStatus(TaskCompletionStatus newStatus); - - QString name() const; - void setName(QString newName); - - QString key() const; - void setKey(QString newKey); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString errorMessage() const; - void setErrorMessage(QString newErrorMessage); - QString longErrorMessage() const; + /** + * @brief Gets or sets the long error message. + */ void setLongErrorMessage(QString newLongErrorMessage); - -signals: - void startTimeUtcChanged(QDateTime newStartTimeUtc); - void endTimeUtcChanged(QDateTime newEndTimeUtc); - void statusChanged(TaskCompletionStatus newStatus); - void nameChanged(QString newName); - void keyChanged(QString newKey); - void jellyfinIdChanged(QString newJellyfinId); - void errorMessageChanged(QString newErrorMessage); - void longErrorMessageChanged(QString newLongErrorMessage); + protected: QDateTime m_startTimeUtc; QDateTime m_endTimeUtc; @@ -122,6 +123,18 @@ protected: QString m_longErrorMessage; }; +} // NS DTO + +namespace Support { + +using TaskResult = Jellyfin::DTO::TaskResult; + +template <> +TaskResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TaskResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/taskstate.h b/core/include/JellyfinQt/DTO/taskstate.h index 4317861..7ed6873 100644 --- a/core/include/JellyfinQt/DTO/taskstate.h +++ b/core/include/JellyfinQt/DTO/taskstate.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_TASKSTATE_H #define JELLYFIN_DTO_TASKSTATE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class TaskStateClass { Q_GADGET public: enum Value { + EnumNotSet, Idle, Cancelling, Running, @@ -47,8 +52,34 @@ public: private: explicit TaskStateClass(); }; + typedef TaskStateClass::Value TaskState; +} // NS DTO + +namespace Support { + +using TaskState = Jellyfin::DTO::TaskState; +using TaskStateClass = Jellyfin::DTO::TaskStateClass; + +template <> +TaskState fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return TaskStateClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Idle")) { + return TaskStateClass::Idle; + } + if (str == QStringLiteral("Cancelling")) { + return TaskStateClass::Cancelling; + } + if (str == QStringLiteral("Running")) { + return TaskStateClass::Running; + } + + return TaskStateClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/tasktriggerinfo.h b/core/include/JellyfinQt/DTO/tasktriggerinfo.h index 3cb7fd0..fe8e854 100644 --- a/core/include/JellyfinQt/DTO/tasktriggerinfo.h +++ b/core/include/JellyfinQt/DTO/tasktriggerinfo.h @@ -31,61 +31,62 @@ #define JELLYFIN_DTO_TASKTRIGGERINFO_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/dayofweek.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TaskTriggerInfo : public QObject { - Q_OBJECT -public: - explicit TaskTriggerInfo(QObject *parent = nullptr); - static TaskTriggerInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class TaskTriggerInfo { +public: + explicit TaskTriggerInfo(); + static TaskTriggerInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the type. */ - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + QString type() const; + /** + * @brief Gets or sets the type. + */ + void setType(QString newType); /** * @brief Gets or sets the time of day. */ - Q_PROPERTY(qint64 timeOfDayTicks READ timeOfDayTicks WRITE setTimeOfDayTicks NOTIFY timeOfDayTicksChanged) + qint64 timeOfDayTicks() const; + /** + * @brief Gets or sets the time of day. + */ + void setTimeOfDayTicks(qint64 newTimeOfDayTicks); /** * @brief Gets or sets the interval. */ - Q_PROPERTY(qint64 intervalTicks READ intervalTicks WRITE setIntervalTicks NOTIFY intervalTicksChanged) - Q_PROPERTY(DayOfWeek dayOfWeek READ dayOfWeek WRITE setDayOfWeek NOTIFY dayOfWeekChanged) + qint64 intervalTicks() const; + /** + * @brief Gets or sets the interval. + */ + void setIntervalTicks(qint64 newIntervalTicks); + + DayOfWeek dayOfWeek() const; + + void setDayOfWeek(DayOfWeek newDayOfWeek); /** * @brief Gets or sets the maximum runtime ticks. */ - Q_PROPERTY(qint64 maxRuntimeTicks READ maxRuntimeTicks WRITE setMaxRuntimeTicks NOTIFY maxRuntimeTicksChanged) - - QString type() const; - void setType(QString newType); - - qint64 timeOfDayTicks() const; - void setTimeOfDayTicks(qint64 newTimeOfDayTicks); - - qint64 intervalTicks() const; - void setIntervalTicks(qint64 newIntervalTicks); - - DayOfWeek dayOfWeek() const; - void setDayOfWeek(DayOfWeek newDayOfWeek); - qint64 maxRuntimeTicks() const; + /** + * @brief Gets or sets the maximum runtime ticks. + */ void setMaxRuntimeTicks(qint64 newMaxRuntimeTicks); - -signals: - void typeChanged(QString newType); - void timeOfDayTicksChanged(qint64 newTimeOfDayTicks); - void intervalTicksChanged(qint64 newIntervalTicks); - void dayOfWeekChanged(DayOfWeek newDayOfWeek); - void maxRuntimeTicksChanged(qint64 newMaxRuntimeTicks); + protected: QString m_type; qint64 m_timeOfDayTicks; @@ -94,6 +95,18 @@ protected: qint64 m_maxRuntimeTicks; }; +} // NS DTO + +namespace Support { + +using TaskTriggerInfo = Jellyfin::DTO::TaskTriggerInfo; + +template <> +TaskTriggerInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TaskTriggerInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/thememediaresult.h b/core/include/JellyfinQt/DTO/thememediaresult.h index d37398d..feac230 100644 --- a/core/include/JellyfinQt/DTO/thememediaresult.h +++ b/core/include/JellyfinQt/DTO/thememediaresult.h @@ -31,65 +31,80 @@ #define JELLYFIN_DTO_THEMEMEDIARESULT_H #include +#include #include -#include -#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/baseitemdto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemDto; -class ThemeMediaResult : public QObject { - Q_OBJECT +class ThemeMediaResult { public: - explicit ThemeMediaResult(QObject *parent = nullptr); - static ThemeMediaResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit ThemeMediaResult(); + static ThemeMediaResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items. */ - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) + QList> items() const; + /** + * @brief Gets or sets the items. + */ + void setItems(QList> newItems); /** * @brief The total number of records available. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief The total number of records available. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief The index of the first record in Items. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) + qint32 startIndex() const; + /** + * @brief The index of the first record in Items. + */ + void setStartIndex(qint32 newStartIndex); /** * @brief Gets or sets the owner id. */ - Q_PROPERTY(QString ownerId READ ownerId WRITE setOwnerId NOTIFY ownerIdChanged) + QUuid ownerId() const; + /** + * @brief Gets or sets the owner id. + */ + void setOwnerId(QUuid newOwnerId); - QList items() const; - void setItems(QList newItems); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - - qint32 startIndex() const; - void setStartIndex(qint32 newStartIndex); - - QString ownerId() const; - void setOwnerId(QString newOwnerId); - -signals: - void itemsChanged(QList newItems); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void startIndexChanged(qint32 newStartIndex); - void ownerIdChanged(QString newOwnerId); protected: - QList m_items; + QList> m_items; qint32 m_totalRecordCount; qint32 m_startIndex; - QString m_ownerId; + QUuid m_ownerId; }; +} // NS DTO + +namespace Support { + +using ThemeMediaResult = Jellyfin::DTO::ThemeMediaResult; + +template <> +ThemeMediaResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ThemeMediaResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/timereventinfo.h b/core/include/JellyfinQt/DTO/timereventinfo.h index d1153ba..1bf3774 100644 --- a/core/include/JellyfinQt/DTO/timereventinfo.h +++ b/core/include/JellyfinQt/DTO/timereventinfo.h @@ -31,37 +31,51 @@ #define JELLYFIN_DTO_TIMEREVENTINFO_H #include -#include +#include #include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TimerEventInfo : public QObject { - Q_OBJECT -public: - explicit TimerEventInfo(QObject *parent = nullptr); - static TimerEventInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString programId READ programId WRITE setProgramId NOTIFY programIdChanged) +class TimerEventInfo { +public: + explicit TimerEventInfo(); + static TimerEventInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString jellyfinId() const; + void setJellyfinId(QString newJellyfinId); - - QString programId() const; - void setProgramId(QString newProgramId); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void programIdChanged(QString newProgramId); + + QUuid programId() const; + + void setProgramId(QUuid newProgramId); + protected: QString m_jellyfinId; - QString m_programId; + QUuid m_programId; }; +} // NS DTO + +namespace Support { + +using TimerEventInfo = Jellyfin::DTO::TimerEventInfo; + +template <> +TimerEventInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TimerEventInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/timerinfodto.h b/core/include/JellyfinQt/DTO/timerinfodto.h index 7185982..c3abd8b 100644 --- a/core/include/JellyfinQt/DTO/timerinfodto.h +++ b/core/include/JellyfinQt/DTO/timerinfodto.h @@ -32,244 +32,242 @@ #include #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/baseitemdto.h" #include "JellyfinQt/DTO/keepuntil.h" #include "JellyfinQt/DTO/recordingstatus.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class BaseItemDto; -class TimerInfoDto : public QObject { - Q_OBJECT +class TimerInfoDto { public: - explicit TimerInfoDto(QObject *parent = nullptr); - static TimerInfoDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit TimerInfoDto(); + static TimerInfoDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Id of the recording. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + QString jellyfinId() const; + /** + * @brief Id of the recording. + */ + void setJellyfinId(QString newJellyfinId); + + QString type() const; + + void setType(QString newType); /** * @brief Gets or sets the server identifier. */ - Q_PROPERTY(QString serverId READ serverId WRITE setServerId NOTIFY serverIdChanged) + QString serverId() const; + /** + * @brief Gets or sets the server identifier. + */ + void setServerId(QString newServerId); /** * @brief Gets or sets the external identifier. */ - Q_PROPERTY(QString externalId READ externalId WRITE setExternalId NOTIFY externalIdChanged) + QString externalId() const; + /** + * @brief Gets or sets the external identifier. + */ + void setExternalId(QString newExternalId); /** * @brief ChannelId of the recording. */ - Q_PROPERTY(QString channelId READ channelId WRITE setChannelId NOTIFY channelIdChanged) + QUuid channelId() const; + /** + * @brief ChannelId of the recording. + */ + void setChannelId(QUuid newChannelId); /** * @brief Gets or sets the external channel identifier. */ - Q_PROPERTY(QString externalChannelId READ externalChannelId WRITE setExternalChannelId NOTIFY externalChannelIdChanged) + QString externalChannelId() const; + /** + * @brief Gets or sets the external channel identifier. + */ + void setExternalChannelId(QString newExternalChannelId); /** * @brief ChannelName of the recording. */ - Q_PROPERTY(QString channelName READ channelName WRITE setChannelName NOTIFY channelNameChanged) - Q_PROPERTY(QString channelPrimaryImageTag READ channelPrimaryImageTag WRITE setChannelPrimaryImageTag NOTIFY channelPrimaryImageTagChanged) + QString channelName() const; + /** + * @brief ChannelName of the recording. + */ + void setChannelName(QString newChannelName); + + QString channelPrimaryImageTag() const; + + void setChannelPrimaryImageTag(QString newChannelPrimaryImageTag); /** * @brief Gets or sets the program identifier. */ - Q_PROPERTY(QString programId READ programId WRITE setProgramId NOTIFY programIdChanged) + QString programId() const; + /** + * @brief Gets or sets the program identifier. + */ + void setProgramId(QString newProgramId); /** * @brief Gets or sets the external program identifier. */ - Q_PROPERTY(QString externalProgramId READ externalProgramId WRITE setExternalProgramId NOTIFY externalProgramIdChanged) + QString externalProgramId() const; + /** + * @brief Gets or sets the external program identifier. + */ + void setExternalProgramId(QString newExternalProgramId); /** * @brief Name of the recording. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Name of the recording. + */ + void setName(QString newName); /** * @brief Description of the recording. */ - Q_PROPERTY(QString overview READ overview WRITE setOverview NOTIFY overviewChanged) + QString overview() const; + /** + * @brief Description of the recording. + */ + void setOverview(QString newOverview); /** * @brief The start date of the recording, in UTC. */ - Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged) + QDateTime startDate() const; + /** + * @brief The start date of the recording, in UTC. + */ + void setStartDate(QDateTime newStartDate); /** * @brief The end date of the recording, in UTC. */ - Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged) + QDateTime endDate() const; + /** + * @brief The end date of the recording, in UTC. + */ + void setEndDate(QDateTime newEndDate); /** * @brief Gets or sets the name of the service. */ - Q_PROPERTY(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged) + QString serviceName() const; + /** + * @brief Gets or sets the name of the service. + */ + void setServiceName(QString newServiceName); /** * @brief Gets or sets the priority. */ - Q_PROPERTY(qint32 priority READ priority WRITE setPriority NOTIFY priorityChanged) + qint32 priority() const; + /** + * @brief Gets or sets the priority. + */ + void setPriority(qint32 newPriority); /** * @brief Gets or sets the pre padding seconds. */ - Q_PROPERTY(qint32 prePaddingSeconds READ prePaddingSeconds WRITE setPrePaddingSeconds NOTIFY prePaddingSecondsChanged) + qint32 prePaddingSeconds() const; + /** + * @brief Gets or sets the pre padding seconds. + */ + void setPrePaddingSeconds(qint32 newPrePaddingSeconds); /** * @brief Gets or sets the post padding seconds. */ - Q_PROPERTY(qint32 postPaddingSeconds READ postPaddingSeconds WRITE setPostPaddingSeconds NOTIFY postPaddingSecondsChanged) + qint32 postPaddingSeconds() const; + /** + * @brief Gets or sets the post padding seconds. + */ + void setPostPaddingSeconds(qint32 newPostPaddingSeconds); /** * @brief Gets or sets a value indicating whether this instance is pre padding required. */ - Q_PROPERTY(bool isPrePaddingRequired READ isPrePaddingRequired WRITE setIsPrePaddingRequired NOTIFY isPrePaddingRequiredChanged) + bool isPrePaddingRequired() const; + /** + * @brief Gets or sets a value indicating whether this instance is pre padding required. + */ + void setIsPrePaddingRequired(bool newIsPrePaddingRequired); /** * @brief If the item does not have any backdrops, this will hold the Id of the Parent that has one. */ - Q_PROPERTY(QString parentBackdropItemId READ parentBackdropItemId WRITE setParentBackdropItemId NOTIFY parentBackdropItemIdChanged) + QString parentBackdropItemId() const; + /** + * @brief If the item does not have any backdrops, this will hold the Id of the Parent that has one. + */ + void setParentBackdropItemId(QString newParentBackdropItemId); /** * @brief Gets or sets the parent backdrop image tags. */ - Q_PROPERTY(QStringList parentBackdropImageTags READ parentBackdropImageTags WRITE setParentBackdropImageTags NOTIFY parentBackdropImageTagsChanged) + QStringList parentBackdropImageTags() const; + /** + * @brief Gets or sets the parent backdrop image tags. + */ + void setParentBackdropImageTags(QStringList newParentBackdropImageTags); /** * @brief Gets or sets a value indicating whether this instance is post padding required. */ - Q_PROPERTY(bool isPostPaddingRequired READ isPostPaddingRequired WRITE setIsPostPaddingRequired NOTIFY isPostPaddingRequiredChanged) - Q_PROPERTY(KeepUntil keepUntil READ keepUntil WRITE setKeepUntil NOTIFY keepUntilChanged) - Q_PROPERTY(RecordingStatus status READ status WRITE setStatus NOTIFY statusChanged) + bool isPostPaddingRequired() const; + /** + * @brief Gets or sets a value indicating whether this instance is post padding required. + */ + void setIsPostPaddingRequired(bool newIsPostPaddingRequired); + + KeepUntil keepUntil() const; + + void setKeepUntil(KeepUntil newKeepUntil); + + RecordingStatus status() const; + + void setStatus(RecordingStatus newStatus); /** * @brief Gets or sets the series timer identifier. */ - Q_PROPERTY(QString seriesTimerId READ seriesTimerId WRITE setSeriesTimerId NOTIFY seriesTimerIdChanged) + QString seriesTimerId() const; + /** + * @brief Gets or sets the series timer identifier. + */ + void setSeriesTimerId(QString newSeriesTimerId); /** * @brief Gets or sets the external series timer identifier. */ - Q_PROPERTY(QString externalSeriesTimerId READ externalSeriesTimerId WRITE setExternalSeriesTimerId NOTIFY externalSeriesTimerIdChanged) + QString externalSeriesTimerId() const; + /** + * @brief Gets or sets the external series timer identifier. + */ + void setExternalSeriesTimerId(QString newExternalSeriesTimerId); /** * @brief Gets or sets the run time ticks. */ - Q_PROPERTY(qint64 runTimeTicks READ runTimeTicks WRITE setRunTimeTicks NOTIFY runTimeTicksChanged) - Q_PROPERTY(BaseItemDto * programInfo READ programInfo WRITE setProgramInfo NOTIFY programInfoChanged) - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString type() const; - void setType(QString newType); - - QString serverId() const; - void setServerId(QString newServerId); - - QString externalId() const; - void setExternalId(QString newExternalId); - - QString channelId() const; - void setChannelId(QString newChannelId); - - QString externalChannelId() const; - void setExternalChannelId(QString newExternalChannelId); - - QString channelName() const; - void setChannelName(QString newChannelName); - - QString channelPrimaryImageTag() const; - void setChannelPrimaryImageTag(QString newChannelPrimaryImageTag); - - QString programId() const; - void setProgramId(QString newProgramId); - - QString externalProgramId() const; - void setExternalProgramId(QString newExternalProgramId); - - QString name() const; - void setName(QString newName); - - QString overview() const; - void setOverview(QString newOverview); - - QDateTime startDate() const; - void setStartDate(QDateTime newStartDate); - - QDateTime endDate() const; - void setEndDate(QDateTime newEndDate); - - QString serviceName() const; - void setServiceName(QString newServiceName); - - qint32 priority() const; - void setPriority(qint32 newPriority); - - qint32 prePaddingSeconds() const; - void setPrePaddingSeconds(qint32 newPrePaddingSeconds); - - qint32 postPaddingSeconds() const; - void setPostPaddingSeconds(qint32 newPostPaddingSeconds); - - bool isPrePaddingRequired() const; - void setIsPrePaddingRequired(bool newIsPrePaddingRequired); - - QString parentBackdropItemId() const; - void setParentBackdropItemId(QString newParentBackdropItemId); - - QStringList parentBackdropImageTags() const; - void setParentBackdropImageTags(QStringList newParentBackdropImageTags); - - bool isPostPaddingRequired() const; - void setIsPostPaddingRequired(bool newIsPostPaddingRequired); - - KeepUntil keepUntil() const; - void setKeepUntil(KeepUntil newKeepUntil); - - RecordingStatus status() const; - void setStatus(RecordingStatus newStatus); - - QString seriesTimerId() const; - void setSeriesTimerId(QString newSeriesTimerId); - - QString externalSeriesTimerId() const; - void setExternalSeriesTimerId(QString newExternalSeriesTimerId); - qint64 runTimeTicks() const; + /** + * @brief Gets or sets the run time ticks. + */ void setRunTimeTicks(qint64 newRunTimeTicks); - - BaseItemDto * programInfo() const; - void setProgramInfo(BaseItemDto * newProgramInfo); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void typeChanged(QString newType); - void serverIdChanged(QString newServerId); - void externalIdChanged(QString newExternalId); - void channelIdChanged(QString newChannelId); - void externalChannelIdChanged(QString newExternalChannelId); - void channelNameChanged(QString newChannelName); - void channelPrimaryImageTagChanged(QString newChannelPrimaryImageTag); - void programIdChanged(QString newProgramId); - void externalProgramIdChanged(QString newExternalProgramId); - void nameChanged(QString newName); - void overviewChanged(QString newOverview); - void startDateChanged(QDateTime newStartDate); - void endDateChanged(QDateTime newEndDate); - void serviceNameChanged(QString newServiceName); - void priorityChanged(qint32 newPriority); - void prePaddingSecondsChanged(qint32 newPrePaddingSeconds); - void postPaddingSecondsChanged(qint32 newPostPaddingSeconds); - void isPrePaddingRequiredChanged(bool newIsPrePaddingRequired); - void parentBackdropItemIdChanged(QString newParentBackdropItemId); - void parentBackdropImageTagsChanged(QStringList newParentBackdropImageTags); - void isPostPaddingRequiredChanged(bool newIsPostPaddingRequired); - void keepUntilChanged(KeepUntil newKeepUntil); - void statusChanged(RecordingStatus newStatus); - void seriesTimerIdChanged(QString newSeriesTimerId); - void externalSeriesTimerIdChanged(QString newExternalSeriesTimerId); - void runTimeTicksChanged(qint64 newRunTimeTicks); - void programInfoChanged(BaseItemDto * newProgramInfo); + + QSharedPointer programInfo() const; + + void setProgramInfo(QSharedPointer newProgramInfo); + protected: QString m_jellyfinId; QString m_type; QString m_serverId; QString m_externalId; - QString m_channelId; + QUuid m_channelId; QString m_externalChannelId; QString m_channelName; QString m_channelPrimaryImageTag; @@ -292,9 +290,21 @@ protected: QString m_seriesTimerId; QString m_externalSeriesTimerId; qint64 m_runTimeTicks; - BaseItemDto * m_programInfo = nullptr; + QSharedPointer m_programInfo = nullptr; }; +} // NS DTO + +namespace Support { + +using TimerInfoDto = Jellyfin::DTO::TimerInfoDto; + +template <> +TimerInfoDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TimerInfoDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/timerinfodtoqueryresult.h b/core/include/JellyfinQt/DTO/timerinfodtoqueryresult.h index 000fbb7..090ac0b 100644 --- a/core/include/JellyfinQt/DTO/timerinfodtoqueryresult.h +++ b/core/include/JellyfinQt/DTO/timerinfodtoqueryresult.h @@ -31,55 +31,70 @@ #define JELLYFIN_DTO_TIMERINFODTOQUERYRESULT_H #include +#include #include -#include +#include #include +#include + +#include "JellyfinQt/DTO/timerinfodto.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TimerInfoDto; -class TimerInfoDtoQueryResult : public QObject { - Q_OBJECT +class TimerInfoDtoQueryResult { public: - explicit TimerInfoDtoQueryResult(QObject *parent = nullptr); - static TimerInfoDtoQueryResult *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit TimerInfoDtoQueryResult(); + static TimerInfoDtoQueryResult fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the items. */ - Q_PROPERTY(QList items READ items WRITE setItems NOTIFY itemsChanged) + QList> items() const; + /** + * @brief Gets or sets the items. + */ + void setItems(QList> newItems); /** * @brief The total number of records available. */ - Q_PROPERTY(qint32 totalRecordCount READ totalRecordCount WRITE setTotalRecordCount NOTIFY totalRecordCountChanged) + qint32 totalRecordCount() const; + /** + * @brief The total number of records available. + */ + void setTotalRecordCount(qint32 newTotalRecordCount); /** * @brief The index of the first record in Items. */ - Q_PROPERTY(qint32 startIndex READ startIndex WRITE setStartIndex NOTIFY startIndexChanged) - - QList items() const; - void setItems(QList newItems); - - qint32 totalRecordCount() const; - void setTotalRecordCount(qint32 newTotalRecordCount); - qint32 startIndex() const; + /** + * @brief The index of the first record in Items. + */ void setStartIndex(qint32 newStartIndex); - -signals: - void itemsChanged(QList newItems); - void totalRecordCountChanged(qint32 newTotalRecordCount); - void startIndexChanged(qint32 newStartIndex); + protected: - QList m_items; + QList> m_items; qint32 m_totalRecordCount; qint32 m_startIndex; }; +} // NS DTO + +namespace Support { + +using TimerInfoDtoQueryResult = Jellyfin::DTO::TimerInfoDtoQueryResult; + +template <> +TimerInfoDtoQueryResult fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TimerInfoDtoQueryResult::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/trailerinfo.h b/core/include/JellyfinQt/DTO/trailerinfo.h index d6a417d..6334a4f 100644 --- a/core/include/JellyfinQt/DTO/trailerinfo.h +++ b/core/include/JellyfinQt/DTO/trailerinfo.h @@ -32,90 +32,89 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TrailerInfo : public QObject { - Q_OBJECT -public: - explicit TrailerInfo(QObject *parent = nullptr); - static TrailerInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class TrailerInfo { +public: + explicit TrailerInfo(); + static TrailerInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets the metadata language. */ - Q_PROPERTY(QString metadataLanguage READ metadataLanguage WRITE setMetadataLanguage NOTIFY metadataLanguageChanged) + QString metadataLanguage() const; + /** + * @brief Gets or sets the metadata language. + */ + void setMetadataLanguage(QString newMetadataLanguage); /** * @brief Gets or sets the metadata country code. */ - Q_PROPERTY(QString metadataCountryCode READ metadataCountryCode WRITE setMetadataCountryCode NOTIFY metadataCountryCodeChanged) + QString metadataCountryCode() const; + /** + * @brief Gets or sets the metadata country code. + */ + void setMetadataCountryCode(QString newMetadataCountryCode); /** * @brief Gets or sets the provider ids. */ - Q_PROPERTY(QJsonObject providerIds READ providerIds WRITE setProviderIds NOTIFY providerIdsChanged) + QJsonObject providerIds() const; + /** + * @brief Gets or sets the provider ids. + */ + void setProviderIds(QJsonObject newProviderIds); /** * @brief Gets or sets the year. */ - Q_PROPERTY(qint32 year READ year WRITE setYear NOTIFY yearChanged) - Q_PROPERTY(qint32 indexNumber READ indexNumber WRITE setIndexNumber NOTIFY indexNumberChanged) - Q_PROPERTY(qint32 parentIndexNumber READ parentIndexNumber WRITE setParentIndexNumber NOTIFY parentIndexNumberChanged) - Q_PROPERTY(QDateTime premiereDate READ premiereDate WRITE setPremiereDate NOTIFY premiereDateChanged) - Q_PROPERTY(bool isAutomated READ isAutomated WRITE setIsAutomated NOTIFY isAutomatedChanged) - - QString name() const; - void setName(QString newName); - - QString path() const; - void setPath(QString newPath); - - QString metadataLanguage() const; - void setMetadataLanguage(QString newMetadataLanguage); - - QString metadataCountryCode() const; - void setMetadataCountryCode(QString newMetadataCountryCode); - - QJsonObject providerIds() const; - void setProviderIds(QJsonObject newProviderIds); - qint32 year() const; + /** + * @brief Gets or sets the year. + */ void setYear(qint32 newYear); - + qint32 indexNumber() const; + void setIndexNumber(qint32 newIndexNumber); - + qint32 parentIndexNumber() const; + void setParentIndexNumber(qint32 newParentIndexNumber); - + QDateTime premiereDate() const; + void setPremiereDate(QDateTime newPremiereDate); - + bool isAutomated() const; + void setIsAutomated(bool newIsAutomated); - -signals: - void nameChanged(QString newName); - void pathChanged(QString newPath); - void metadataLanguageChanged(QString newMetadataLanguage); - void metadataCountryCodeChanged(QString newMetadataCountryCode); - void providerIdsChanged(QJsonObject newProviderIds); - void yearChanged(qint32 newYear); - void indexNumberChanged(qint32 newIndexNumber); - void parentIndexNumberChanged(qint32 newParentIndexNumber); - void premiereDateChanged(QDateTime newPremiereDate); - void isAutomatedChanged(bool newIsAutomated); + protected: QString m_name; QString m_path; @@ -129,6 +128,18 @@ protected: bool m_isAutomated; }; +} // NS DTO + +namespace Support { + +using TrailerInfo = Jellyfin::DTO::TrailerInfo; + +template <> +TrailerInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TrailerInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/trailerinforemotesearchquery.h b/core/include/JellyfinQt/DTO/trailerinforemotesearchquery.h index d82d279..913a59a 100644 --- a/core/include/JellyfinQt/DTO/trailerinforemotesearchquery.h +++ b/core/include/JellyfinQt/DTO/trailerinforemotesearchquery.h @@ -31,57 +31,71 @@ #define JELLYFIN_DTO_TRAILERINFOREMOTESEARCHQUERY_H #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/trailerinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TrailerInfo; -class TrailerInfoRemoteSearchQuery : public QObject { - Q_OBJECT +class TrailerInfoRemoteSearchQuery { public: - explicit TrailerInfoRemoteSearchQuery(QObject *parent = nullptr); - static TrailerInfoRemoteSearchQuery *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); + explicit TrailerInfoRemoteSearchQuery(); + static TrailerInfoRemoteSearchQuery fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties - Q_PROPERTY(TrailerInfo * searchInfo READ searchInfo WRITE setSearchInfo NOTIFY searchInfoChanged) - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QSharedPointer searchInfo() const; + + void setSearchInfo(QSharedPointer newSearchInfo); + + QUuid itemId() const; + + void setItemId(QUuid newItemId); /** * @brief Will only search within the given provider when set. */ - Q_PROPERTY(QString searchProviderName READ searchProviderName WRITE setSearchProviderName NOTIFY searchProviderNameChanged) + QString searchProviderName() const; + /** + * @brief Will only search within the given provider when set. + */ + void setSearchProviderName(QString newSearchProviderName); /** * @brief Gets or sets a value indicating whether disabled providers should be included. */ - Q_PROPERTY(bool includeDisabledProviders READ includeDisabledProviders WRITE setIncludeDisabledProviders NOTIFY includeDisabledProvidersChanged) - - TrailerInfo * searchInfo() const; - void setSearchInfo(TrailerInfo * newSearchInfo); - - QString itemId() const; - void setItemId(QString newItemId); - - QString searchProviderName() const; - void setSearchProviderName(QString newSearchProviderName); - bool includeDisabledProviders() const; + /** + * @brief Gets or sets a value indicating whether disabled providers should be included. + */ void setIncludeDisabledProviders(bool newIncludeDisabledProviders); - -signals: - void searchInfoChanged(TrailerInfo * newSearchInfo); - void itemIdChanged(QString newItemId); - void searchProviderNameChanged(QString newSearchProviderName); - void includeDisabledProvidersChanged(bool newIncludeDisabledProviders); + protected: - TrailerInfo * m_searchInfo = nullptr; - QString m_itemId; + QSharedPointer m_searchInfo = nullptr; + QUuid m_itemId; QString m_searchProviderName; bool m_includeDisabledProviders; }; +} // NS DTO + +namespace Support { + +using TrailerInfoRemoteSearchQuery = Jellyfin::DTO::TrailerInfoRemoteSearchQuery; + +template <> +TrailerInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TrailerInfoRemoteSearchQuery::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/transcodereason.h b/core/include/JellyfinQt/DTO/transcodereason.h index 10abd31..218aa68 100644 --- a/core/include/JellyfinQt/DTO/transcodereason.h +++ b/core/include/JellyfinQt/DTO/transcodereason.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_TRANSCODEREASON_H #define JELLYFIN_DTO_TRANSCODEREASON_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class TranscodeReasonClass { Q_GADGET public: enum Value { + EnumNotSet, ContainerNotSupported, VideoCodecNotSupported, AudioCodecNotSupported, @@ -67,8 +72,94 @@ public: private: explicit TranscodeReasonClass(); }; + typedef TranscodeReasonClass::Value TranscodeReason; +} // NS DTO + +namespace Support { + +using TranscodeReason = Jellyfin::DTO::TranscodeReason; +using TranscodeReasonClass = Jellyfin::DTO::TranscodeReasonClass; + +template <> +TranscodeReason fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return TranscodeReasonClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("ContainerNotSupported")) { + return TranscodeReasonClass::ContainerNotSupported; + } + if (str == QStringLiteral("VideoCodecNotSupported")) { + return TranscodeReasonClass::VideoCodecNotSupported; + } + if (str == QStringLiteral("AudioCodecNotSupported")) { + return TranscodeReasonClass::AudioCodecNotSupported; + } + if (str == QStringLiteral("ContainerBitrateExceedsLimit")) { + return TranscodeReasonClass::ContainerBitrateExceedsLimit; + } + if (str == QStringLiteral("AudioBitrateNotSupported")) { + return TranscodeReasonClass::AudioBitrateNotSupported; + } + if (str == QStringLiteral("AudioChannelsNotSupported")) { + return TranscodeReasonClass::AudioChannelsNotSupported; + } + if (str == QStringLiteral("VideoResolutionNotSupported")) { + return TranscodeReasonClass::VideoResolutionNotSupported; + } + if (str == QStringLiteral("UnknownVideoStreamInfo")) { + return TranscodeReasonClass::UnknownVideoStreamInfo; + } + if (str == QStringLiteral("UnknownAudioStreamInfo")) { + return TranscodeReasonClass::UnknownAudioStreamInfo; + } + if (str == QStringLiteral("AudioProfileNotSupported")) { + return TranscodeReasonClass::AudioProfileNotSupported; + } + if (str == QStringLiteral("AudioSampleRateNotSupported")) { + return TranscodeReasonClass::AudioSampleRateNotSupported; + } + if (str == QStringLiteral("AnamorphicVideoNotSupported")) { + return TranscodeReasonClass::AnamorphicVideoNotSupported; + } + if (str == QStringLiteral("InterlacedVideoNotSupported")) { + return TranscodeReasonClass::InterlacedVideoNotSupported; + } + if (str == QStringLiteral("SecondaryAudioNotSupported")) { + return TranscodeReasonClass::SecondaryAudioNotSupported; + } + if (str == QStringLiteral("RefFramesNotSupported")) { + return TranscodeReasonClass::RefFramesNotSupported; + } + if (str == QStringLiteral("VideoBitDepthNotSupported")) { + return TranscodeReasonClass::VideoBitDepthNotSupported; + } + if (str == QStringLiteral("VideoBitrateNotSupported")) { + return TranscodeReasonClass::VideoBitrateNotSupported; + } + if (str == QStringLiteral("VideoFramerateNotSupported")) { + return TranscodeReasonClass::VideoFramerateNotSupported; + } + if (str == QStringLiteral("VideoLevelNotSupported")) { + return TranscodeReasonClass::VideoLevelNotSupported; + } + if (str == QStringLiteral("VideoProfileNotSupported")) { + return TranscodeReasonClass::VideoProfileNotSupported; + } + if (str == QStringLiteral("AudioBitDepthNotSupported")) { + return TranscodeReasonClass::AudioBitDepthNotSupported; + } + if (str == QStringLiteral("SubtitleCodecNotSupported")) { + return TranscodeReasonClass::SubtitleCodecNotSupported; + } + if (str == QStringLiteral("DirectPlayError")) { + return TranscodeReasonClass::DirectPlayError; + } + + return TranscodeReasonClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/transcodeseekinfo.h b/core/include/JellyfinQt/DTO/transcodeseekinfo.h index 4a086f1..6239b8e 100644 --- a/core/include/JellyfinQt/DTO/transcodeseekinfo.h +++ b/core/include/JellyfinQt/DTO/transcodeseekinfo.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_TRANSCODESEEKINFO_H #define JELLYFIN_DTO_TRANSCODESEEKINFO_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class TranscodeSeekInfoClass { Q_GADGET public: enum Value { + EnumNotSet, Auto, Bytes, }; @@ -46,8 +51,31 @@ public: private: explicit TranscodeSeekInfoClass(); }; + typedef TranscodeSeekInfoClass::Value TranscodeSeekInfo; +} // NS DTO + +namespace Support { + +using TranscodeSeekInfo = Jellyfin::DTO::TranscodeSeekInfo; +using TranscodeSeekInfoClass = Jellyfin::DTO::TranscodeSeekInfoClass; + +template <> +TranscodeSeekInfo fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return TranscodeSeekInfoClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Auto")) { + return TranscodeSeekInfoClass::Auto; + } + if (str == QStringLiteral("Bytes")) { + return TranscodeSeekInfoClass::Bytes; + } + + return TranscodeSeekInfoClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/transcodinginfo.h b/core/include/JellyfinQt/DTO/transcodinginfo.h index b00dfbe..9ad26c1 100644 --- a/core/include/JellyfinQt/DTO/transcodinginfo.h +++ b/core/include/JellyfinQt/DTO/transcodinginfo.h @@ -31,86 +31,76 @@ #define JELLYFIN_DTO_TRANSCODINGINFO_H #include +#include #include -#include #include #include +#include #include "JellyfinQt/DTO/transcodereason.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TranscodingInfo : public QObject { - Q_OBJECT -public: - explicit TranscodingInfo(QObject *parent = nullptr); - static TranscodingInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged) - Q_PROPERTY(QString videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged) - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) - Q_PROPERTY(bool isVideoDirect READ isVideoDirect WRITE setIsVideoDirect NOTIFY isVideoDirectChanged) - Q_PROPERTY(bool isAudioDirect READ isAudioDirect WRITE setIsAudioDirect NOTIFY isAudioDirectChanged) - Q_PROPERTY(qint32 bitrate READ bitrate WRITE setBitrate NOTIFY bitrateChanged) - Q_PROPERTY(float framerate READ framerate WRITE setFramerate NOTIFY framerateChanged) - Q_PROPERTY(double completionPercentage READ completionPercentage WRITE setCompletionPercentage NOTIFY completionPercentageChanged) - Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged) - Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(qint32 audioChannels READ audioChannels WRITE setAudioChannels NOTIFY audioChannelsChanged) - Q_PROPERTY(QList transcodeReasons READ transcodeReasons WRITE setTranscodeReasons NOTIFY transcodeReasonsChanged) +class TranscodingInfo { +public: + explicit TranscodingInfo(); + static TranscodingInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString audioCodec() const; + void setAudioCodec(QString newAudioCodec); - + QString videoCodec() const; + void setVideoCodec(QString newVideoCodec); - + QString container() const; + void setContainer(QString newContainer); - + bool isVideoDirect() const; + void setIsVideoDirect(bool newIsVideoDirect); - + bool isAudioDirect() const; + void setIsAudioDirect(bool newIsAudioDirect); - + qint32 bitrate() const; + void setBitrate(qint32 newBitrate); - + float framerate() const; + void setFramerate(float newFramerate); - + double completionPercentage() const; + void setCompletionPercentage(double newCompletionPercentage); - + qint32 width() const; + void setWidth(qint32 newWidth); - + qint32 height() const; + void setHeight(qint32 newHeight); - + qint32 audioChannels() const; + void setAudioChannels(qint32 newAudioChannels); - + QList transcodeReasons() const; + void setTranscodeReasons(QList newTranscodeReasons); - -signals: - void audioCodecChanged(QString newAudioCodec); - void videoCodecChanged(QString newVideoCodec); - void containerChanged(QString newContainer); - void isVideoDirectChanged(bool newIsVideoDirect); - void isAudioDirectChanged(bool newIsAudioDirect); - void bitrateChanged(qint32 newBitrate); - void framerateChanged(float newFramerate); - void completionPercentageChanged(double newCompletionPercentage); - void widthChanged(qint32 newWidth); - void heightChanged(qint32 newHeight); - void audioChannelsChanged(qint32 newAudioChannels); - void transcodeReasonsChanged(QList newTranscodeReasons); + protected: QString m_audioCodec; QString m_videoCodec; @@ -126,6 +116,18 @@ protected: QList m_transcodeReasons; }; +} // NS DTO + +namespace Support { + +using TranscodingInfo = Jellyfin::DTO::TranscodingInfo; + +template <> +TranscodingInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TranscodingInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/transcodingprofile.h b/core/include/JellyfinQt/DTO/transcodingprofile.h index 306c8cb..852fe89 100644 --- a/core/include/JellyfinQt/DTO/transcodingprofile.h +++ b/core/include/JellyfinQt/DTO/transcodingprofile.h @@ -31,101 +31,88 @@ #define JELLYFIN_DTO_TRANSCODINGPROFILE_H #include -#include +#include #include +#include #include "JellyfinQt/DTO/dlnaprofiletype.h" #include "JellyfinQt/DTO/encodingcontext.h" #include "JellyfinQt/DTO/transcodeseekinfo.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TranscodingProfile : public QObject { - Q_OBJECT -public: - explicit TranscodingProfile(QObject *parent = nullptr); - static TranscodingProfile *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString container READ container WRITE setContainer NOTIFY containerChanged) - Q_PROPERTY(DlnaProfileType type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QString videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged) - Q_PROPERTY(QString audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged) - Q_PROPERTY(QString protocol READ protocol WRITE setProtocol NOTIFY protocolChanged) - Q_PROPERTY(bool estimateContentLength READ estimateContentLength WRITE setEstimateContentLength NOTIFY estimateContentLengthChanged) - Q_PROPERTY(bool enableMpegtsM2TsMode READ enableMpegtsM2TsMode WRITE setEnableMpegtsM2TsMode NOTIFY enableMpegtsM2TsModeChanged) - Q_PROPERTY(TranscodeSeekInfo transcodeSeekInfo READ transcodeSeekInfo WRITE setTranscodeSeekInfo NOTIFY transcodeSeekInfoChanged) - Q_PROPERTY(bool copyTimestamps READ copyTimestamps WRITE setCopyTimestamps NOTIFY copyTimestampsChanged) - Q_PROPERTY(EncodingContext context READ context WRITE setContext NOTIFY contextChanged) - Q_PROPERTY(bool enableSubtitlesInManifest READ enableSubtitlesInManifest WRITE setEnableSubtitlesInManifest NOTIFY enableSubtitlesInManifestChanged) - Q_PROPERTY(QString maxAudioChannels READ maxAudioChannels WRITE setMaxAudioChannels NOTIFY maxAudioChannelsChanged) - Q_PROPERTY(qint32 minSegments READ minSegments WRITE setMinSegments NOTIFY minSegmentsChanged) - Q_PROPERTY(qint32 segmentLength READ segmentLength WRITE setSegmentLength NOTIFY segmentLengthChanged) - Q_PROPERTY(bool breakOnNonKeyFrames READ breakOnNonKeyFrames WRITE setBreakOnNonKeyFrames NOTIFY breakOnNonKeyFramesChanged) +class TranscodingProfile { +public: + explicit TranscodingProfile(); + static TranscodingProfile fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString container() const; + void setContainer(QString newContainer); - + DlnaProfileType type() const; + void setType(DlnaProfileType newType); - + QString videoCodec() const; + void setVideoCodec(QString newVideoCodec); - + QString audioCodec() const; + void setAudioCodec(QString newAudioCodec); - + QString protocol() const; + void setProtocol(QString newProtocol); - + bool estimateContentLength() const; + void setEstimateContentLength(bool newEstimateContentLength); - + bool enableMpegtsM2TsMode() const; + void setEnableMpegtsM2TsMode(bool newEnableMpegtsM2TsMode); - + TranscodeSeekInfo transcodeSeekInfo() const; + void setTranscodeSeekInfo(TranscodeSeekInfo newTranscodeSeekInfo); - + bool copyTimestamps() const; + void setCopyTimestamps(bool newCopyTimestamps); - + EncodingContext context() const; + void setContext(EncodingContext newContext); - + bool enableSubtitlesInManifest() const; + void setEnableSubtitlesInManifest(bool newEnableSubtitlesInManifest); - + QString maxAudioChannels() const; + void setMaxAudioChannels(QString newMaxAudioChannels); - + qint32 minSegments() const; + void setMinSegments(qint32 newMinSegments); - + qint32 segmentLength() const; + void setSegmentLength(qint32 newSegmentLength); - + bool breakOnNonKeyFrames() const; + void setBreakOnNonKeyFrames(bool newBreakOnNonKeyFrames); - -signals: - void containerChanged(QString newContainer); - void typeChanged(DlnaProfileType newType); - void videoCodecChanged(QString newVideoCodec); - void audioCodecChanged(QString newAudioCodec); - void protocolChanged(QString newProtocol); - void estimateContentLengthChanged(bool newEstimateContentLength); - void enableMpegtsM2TsModeChanged(bool newEnableMpegtsM2TsMode); - void transcodeSeekInfoChanged(TranscodeSeekInfo newTranscodeSeekInfo); - void copyTimestampsChanged(bool newCopyTimestamps); - void contextChanged(EncodingContext newContext); - void enableSubtitlesInManifestChanged(bool newEnableSubtitlesInManifest); - void maxAudioChannelsChanged(QString newMaxAudioChannels); - void minSegmentsChanged(qint32 newMinSegments); - void segmentLengthChanged(qint32 newSegmentLength); - void breakOnNonKeyFramesChanged(bool newBreakOnNonKeyFrames); + protected: QString m_container; DlnaProfileType m_type; @@ -144,6 +131,18 @@ protected: bool m_breakOnNonKeyFrames; }; +} // NS DTO + +namespace Support { + +using TranscodingProfile = Jellyfin::DTO::TranscodingProfile; + +template <> +TranscodingProfile fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TranscodingProfile::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/transportstreamtimestamp.h b/core/include/JellyfinQt/DTO/transportstreamtimestamp.h index f4e4da9..fd2e7fc 100644 --- a/core/include/JellyfinQt/DTO/transportstreamtimestamp.h +++ b/core/include/JellyfinQt/DTO/transportstreamtimestamp.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_TRANSPORTSTREAMTIMESTAMP_H #define JELLYFIN_DTO_TRANSPORTSTREAMTIMESTAMP_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class TransportStreamTimestampClass { Q_GADGET public: enum Value { + EnumNotSet, None, Zero, Valid, @@ -47,8 +52,34 @@ public: private: explicit TransportStreamTimestampClass(); }; + typedef TransportStreamTimestampClass::Value TransportStreamTimestamp; +} // NS DTO + +namespace Support { + +using TransportStreamTimestamp = Jellyfin::DTO::TransportStreamTimestamp; +using TransportStreamTimestampClass = Jellyfin::DTO::TransportStreamTimestampClass; + +template <> +TransportStreamTimestamp fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return TransportStreamTimestampClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("None")) { + return TransportStreamTimestampClass::None; + } + if (str == QStringLiteral("Zero")) { + return TransportStreamTimestampClass::Zero; + } + if (str == QStringLiteral("Valid")) { + return TransportStreamTimestampClass::Valid; + } + + return TransportStreamTimestampClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/tunerchannelmapping.h b/core/include/JellyfinQt/DTO/tunerchannelmapping.h index ba82e31..83ce6eb 100644 --- a/core/include/JellyfinQt/DTO/tunerchannelmapping.h +++ b/core/include/JellyfinQt/DTO/tunerchannelmapping.h @@ -31,42 +31,41 @@ #define JELLYFIN_DTO_TUNERCHANNELMAPPING_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TunerChannelMapping : public QObject { - Q_OBJECT -public: - explicit TunerChannelMapping(QObject *parent = nullptr); - static TunerChannelMapping *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString providerChannelName READ providerChannelName WRITE setProviderChannelName NOTIFY providerChannelNameChanged) - Q_PROPERTY(QString providerChannelId READ providerChannelId WRITE setProviderChannelId NOTIFY providerChannelIdChanged) - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) +class TunerChannelMapping { +public: + explicit TunerChannelMapping(); + static TunerChannelMapping fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString name() const; + void setName(QString newName); - + QString providerChannelName() const; + void setProviderChannelName(QString newProviderChannelName); - + QString providerChannelId() const; + void setProviderChannelId(QString newProviderChannelId); - + QString jellyfinId() const; + void setJellyfinId(QString newJellyfinId); - -signals: - void nameChanged(QString newName); - void providerChannelNameChanged(QString newProviderChannelName); - void providerChannelIdChanged(QString newProviderChannelId); - void jellyfinIdChanged(QString newJellyfinId); + protected: QString m_name; QString m_providerChannelName; @@ -74,6 +73,18 @@ protected: QString m_jellyfinId; }; +} // NS DTO + +namespace Support { + +using TunerChannelMapping = Jellyfin::DTO::TunerChannelMapping; + +template <> +TunerChannelMapping fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TunerChannelMapping::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/tunerhostinfo.h b/core/include/JellyfinQt/DTO/tunerhostinfo.h index 546301f..e09aab3 100644 --- a/core/include/JellyfinQt/DTO/tunerhostinfo.h +++ b/core/include/JellyfinQt/DTO/tunerhostinfo.h @@ -31,77 +31,69 @@ #define JELLYFIN_DTO_TUNERHOSTINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class TunerHostInfo : public QObject { - Q_OBJECT -public: - explicit TunerHostInfo(QObject *parent = nullptr); - static TunerHostInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged) - Q_PROPERTY(QString friendlyName READ friendlyName WRITE setFriendlyName NOTIFY friendlyNameChanged) - Q_PROPERTY(bool importFavoritesOnly READ importFavoritesOnly WRITE setImportFavoritesOnly NOTIFY importFavoritesOnlyChanged) - Q_PROPERTY(bool allowHWTranscoding READ allowHWTranscoding WRITE setAllowHWTranscoding NOTIFY allowHWTranscodingChanged) - Q_PROPERTY(bool enableStreamLooping READ enableStreamLooping WRITE setEnableStreamLooping NOTIFY enableStreamLoopingChanged) - Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(qint32 tunerCount READ tunerCount WRITE setTunerCount NOTIFY tunerCountChanged) - Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged) +class TunerHostInfo { +public: + explicit TunerHostInfo(); + static TunerHostInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString jellyfinId() const; + void setJellyfinId(QString newJellyfinId); - + QString url() const; + void setUrl(QString newUrl); - + QString type() const; + void setType(QString newType); - + QString deviceId() const; + void setDeviceId(QString newDeviceId); - + QString friendlyName() const; + void setFriendlyName(QString newFriendlyName); - + bool importFavoritesOnly() const; + void setImportFavoritesOnly(bool newImportFavoritesOnly); - + bool allowHWTranscoding() const; + void setAllowHWTranscoding(bool newAllowHWTranscoding); - + bool enableStreamLooping() const; + void setEnableStreamLooping(bool newEnableStreamLooping); - + QString source() const; + void setSource(QString newSource); - + qint32 tunerCount() const; + void setTunerCount(qint32 newTunerCount); - + QString userAgent() const; + void setUserAgent(QString newUserAgent); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void urlChanged(QString newUrl); - void typeChanged(QString newType); - void deviceIdChanged(QString newDeviceId); - void friendlyNameChanged(QString newFriendlyName); - void importFavoritesOnlyChanged(bool newImportFavoritesOnly); - void allowHWTranscodingChanged(bool newAllowHWTranscoding); - void enableStreamLoopingChanged(bool newEnableStreamLooping); - void sourceChanged(QString newSource); - void tunerCountChanged(qint32 newTunerCount); - void userAgentChanged(QString newUserAgent); + protected: QString m_jellyfinId; QString m_url; @@ -116,6 +108,18 @@ protected: QString m_userAgent; }; +} // NS DTO + +namespace Support { + +using TunerHostInfo = Jellyfin::DTO::TunerHostInfo; + +template <> +TunerHostInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TunerHostInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/typeoptions.h b/core/include/JellyfinQt/DTO/typeoptions.h index cbb3f7e..843bb0c 100644 --- a/core/include/JellyfinQt/DTO/typeoptions.h +++ b/core/include/JellyfinQt/DTO/typeoptions.h @@ -31,65 +31,74 @@ #define JELLYFIN_DTO_TYPEOPTIONS_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/imageoption.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ImageOption; -class TypeOptions : public QObject { - Q_OBJECT +class TypeOptions { public: - explicit TypeOptions(QObject *parent = nullptr); - static TypeOptions *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QStringList metadataFetchers READ metadataFetchers WRITE setMetadataFetchers NOTIFY metadataFetchersChanged) - Q_PROPERTY(QStringList metadataFetcherOrder READ metadataFetcherOrder WRITE setMetadataFetcherOrder NOTIFY metadataFetcherOrderChanged) - Q_PROPERTY(QStringList imageFetchers READ imageFetchers WRITE setImageFetchers NOTIFY imageFetchersChanged) - Q_PROPERTY(QStringList imageFetcherOrder READ imageFetcherOrder WRITE setImageFetcherOrder NOTIFY imageFetcherOrderChanged) - Q_PROPERTY(QList imageOptions READ imageOptions WRITE setImageOptions NOTIFY imageOptionsChanged) + explicit TypeOptions(); + static TypeOptions fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties QString type() const; + void setType(QString newType); - + QStringList metadataFetchers() const; + void setMetadataFetchers(QStringList newMetadataFetchers); - + QStringList metadataFetcherOrder() const; + void setMetadataFetcherOrder(QStringList newMetadataFetcherOrder); - + QStringList imageFetchers() const; + void setImageFetchers(QStringList newImageFetchers); - + QStringList imageFetcherOrder() const; + void setImageFetcherOrder(QStringList newImageFetcherOrder); - - QList imageOptions() const; - void setImageOptions(QList newImageOptions); - -signals: - void typeChanged(QString newType); - void metadataFetchersChanged(QStringList newMetadataFetchers); - void metadataFetcherOrderChanged(QStringList newMetadataFetcherOrder); - void imageFetchersChanged(QStringList newImageFetchers); - void imageFetcherOrderChanged(QStringList newImageFetcherOrder); - void imageOptionsChanged(QList newImageOptions); + + QList> imageOptions() const; + + void setImageOptions(QList> newImageOptions); + protected: QString m_type; QStringList m_metadataFetchers; QStringList m_metadataFetcherOrder; QStringList m_imageFetchers; QStringList m_imageFetcherOrder; - QList m_imageOptions; + QList> m_imageOptions; }; +} // NS DTO + +namespace Support { + +using TypeOptions = Jellyfin::DTO::TypeOptions; + +template <> +TypeOptions fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return TypeOptions::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/unrateditem.h b/core/include/JellyfinQt/DTO/unrateditem.h index 6ff08bd..0b61b67 100644 --- a/core/include/JellyfinQt/DTO/unrateditem.h +++ b/core/include/JellyfinQt/DTO/unrateditem.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_UNRATEDITEM_H #define JELLYFIN_DTO_UNRATEDITEM_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class UnratedItemClass { Q_GADGET public: enum Value { + EnumNotSet, Movie, Trailer, Series, @@ -53,8 +58,52 @@ public: private: explicit UnratedItemClass(); }; + typedef UnratedItemClass::Value UnratedItem; +} // NS DTO + +namespace Support { + +using UnratedItem = Jellyfin::DTO::UnratedItem; +using UnratedItemClass = Jellyfin::DTO::UnratedItemClass; + +template <> +UnratedItem fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return UnratedItemClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("Movie")) { + return UnratedItemClass::Movie; + } + if (str == QStringLiteral("Trailer")) { + return UnratedItemClass::Trailer; + } + if (str == QStringLiteral("Series")) { + return UnratedItemClass::Series; + } + if (str == QStringLiteral("Music")) { + return UnratedItemClass::Music; + } + if (str == QStringLiteral("Book")) { + return UnratedItemClass::Book; + } + if (str == QStringLiteral("LiveTvChannel")) { + return UnratedItemClass::LiveTvChannel; + } + if (str == QStringLiteral("LiveTvProgram")) { + return UnratedItemClass::LiveTvProgram; + } + if (str == QStringLiteral("ChannelContent")) { + return UnratedItemClass::ChannelContent; + } + if (str == QStringLiteral("Other")) { + return UnratedItemClass::Other; + } + + return UnratedItemClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/updatelibraryoptionsdto.h b/core/include/JellyfinQt/DTO/updatelibraryoptionsdto.h index ca74050..751dfc6 100644 --- a/core/include/JellyfinQt/DTO/updatelibraryoptionsdto.h +++ b/core/include/JellyfinQt/DTO/updatelibraryoptionsdto.h @@ -31,42 +31,56 @@ #define JELLYFIN_DTO_UPDATELIBRARYOPTIONSDTO_H #include -#include -#include +#include +#include +#include +#include + +#include "JellyfinQt/DTO/libraryoptions.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LibraryOptions; -class UpdateLibraryOptionsDto : public QObject { - Q_OBJECT +class UpdateLibraryOptionsDto { public: - explicit UpdateLibraryOptionsDto(QObject *parent = nullptr); - static UpdateLibraryOptionsDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit UpdateLibraryOptionsDto(); + static UpdateLibraryOptionsDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the library item id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) - Q_PROPERTY(LibraryOptions * libraryOptions READ libraryOptions WRITE setLibraryOptions NOTIFY libraryOptionsChanged) + QUuid jellyfinId() const; + /** + * @brief Gets or sets the library item id. + */ + void setJellyfinId(QUuid newJellyfinId); + + QSharedPointer libraryOptions() const; + + void setLibraryOptions(QSharedPointer newLibraryOptions); - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - LibraryOptions * libraryOptions() const; - void setLibraryOptions(LibraryOptions * newLibraryOptions); - -signals: - void jellyfinIdChanged(QString newJellyfinId); - void libraryOptionsChanged(LibraryOptions * newLibraryOptions); protected: - QString m_jellyfinId; - LibraryOptions * m_libraryOptions = nullptr; + QUuid m_jellyfinId; + QSharedPointer m_libraryOptions = nullptr; }; +} // NS DTO + +namespace Support { + +using UpdateLibraryOptionsDto = Jellyfin::DTO::UpdateLibraryOptionsDto; + +template <> +UpdateLibraryOptionsDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UpdateLibraryOptionsDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/updateusereasypassword.h b/core/include/JellyfinQt/DTO/updateusereasypassword.h index 1648605..3d60e04 100644 --- a/core/include/JellyfinQt/DTO/updateusereasypassword.h +++ b/core/include/JellyfinQt/DTO/updateusereasypassword.h @@ -31,52 +31,67 @@ #define JELLYFIN_DTO_UPDATEUSEREASYPASSWORD_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class UpdateUserEasyPassword : public QObject { - Q_OBJECT -public: - explicit UpdateUserEasyPassword(QObject *parent = nullptr); - static UpdateUserEasyPassword *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class UpdateUserEasyPassword { +public: + explicit UpdateUserEasyPassword(); + static UpdateUserEasyPassword fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the new sha1-hashed password. */ - Q_PROPERTY(QString newPassword READ newPassword WRITE setNewPassword NOTIFY newPasswordChanged) + QString newPassword() const; + /** + * @brief Gets or sets the new sha1-hashed password. + */ + void setNewPassword(QString newNewPassword); /** * @brief Gets or sets the new password. */ - Q_PROPERTY(QString newPw READ newPw WRITE setNewPw NOTIFY newPwChanged) + QString newPw() const; + /** + * @brief Gets or sets the new password. + */ + void setNewPw(QString newNewPw); /** * @brief Gets or sets a value indicating whether to reset the password. */ - Q_PROPERTY(bool resetPassword READ resetPassword WRITE setResetPassword NOTIFY resetPasswordChanged) - - QString newPassword() const; - void setNewPassword(QString newNewPassword); - - QString newPw() const; - void setNewPw(QString newNewPw); - bool resetPassword() const; + /** + * @brief Gets or sets a value indicating whether to reset the password. + */ void setResetPassword(bool newResetPassword); - -signals: - void newPasswordChanged(QString newNewPassword); - void newPwChanged(QString newNewPw); - void resetPasswordChanged(bool newResetPassword); + protected: QString m_newPassword; QString m_newPw; bool m_resetPassword; }; +} // NS DTO + +namespace Support { + +using UpdateUserEasyPassword = Jellyfin::DTO::UpdateUserEasyPassword; + +template <> +UpdateUserEasyPassword fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UpdateUserEasyPassword::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/updateuserpassword.h b/core/include/JellyfinQt/DTO/updateuserpassword.h index 241c9df..2ebaddb 100644 --- a/core/include/JellyfinQt/DTO/updateuserpassword.h +++ b/core/include/JellyfinQt/DTO/updateuserpassword.h @@ -31,54 +31,57 @@ #define JELLYFIN_DTO_UPDATEUSERPASSWORD_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class UpdateUserPassword : public QObject { - Q_OBJECT -public: - explicit UpdateUserPassword(QObject *parent = nullptr); - static UpdateUserPassword *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class UpdateUserPassword { +public: + explicit UpdateUserPassword(); + static UpdateUserPassword fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the current sha1-hashed password. */ - Q_PROPERTY(QString currentPassword READ currentPassword WRITE setCurrentPassword NOTIFY currentPasswordChanged) + QString currentPassword() const; + /** + * @brief Gets or sets the current sha1-hashed password. + */ + void setCurrentPassword(QString newCurrentPassword); /** * @brief Gets or sets the current plain text password. */ - Q_PROPERTY(QString currentPw READ currentPw WRITE setCurrentPw NOTIFY currentPwChanged) + QString currentPw() const; + /** + * @brief Gets or sets the current plain text password. + */ + void setCurrentPw(QString newCurrentPw); /** * @brief Gets or sets the new plain text password. */ - Q_PROPERTY(QString newPw READ newPw WRITE setNewPw NOTIFY newPwChanged) + QString newPw() const; + /** + * @brief Gets or sets the new plain text password. + */ + void setNewPw(QString newNewPw); /** * @brief Gets or sets a value indicating whether to reset the password. */ - Q_PROPERTY(bool resetPassword READ resetPassword WRITE setResetPassword NOTIFY resetPasswordChanged) - - QString currentPassword() const; - void setCurrentPassword(QString newCurrentPassword); - - QString currentPw() const; - void setCurrentPw(QString newCurrentPw); - - QString newPw() const; - void setNewPw(QString newNewPw); - bool resetPassword() const; + /** + * @brief Gets or sets a value indicating whether to reset the password. + */ void setResetPassword(bool newResetPassword); - -signals: - void currentPasswordChanged(QString newCurrentPassword); - void currentPwChanged(QString newCurrentPw); - void newPwChanged(QString newNewPw); - void resetPasswordChanged(bool newResetPassword); + protected: QString m_currentPassword; QString m_currentPw; @@ -86,6 +89,18 @@ protected: bool m_resetPassword; }; +} // NS DTO + +namespace Support { + +using UpdateUserPassword = Jellyfin::DTO::UpdateUserPassword; + +template <> +UpdateUserPassword fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UpdateUserPassword::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/uploadsubtitledto.h b/core/include/JellyfinQt/DTO/uploadsubtitledto.h index 4908653..de3bcab 100644 --- a/core/include/JellyfinQt/DTO/uploadsubtitledto.h +++ b/core/include/JellyfinQt/DTO/uploadsubtitledto.h @@ -31,54 +31,57 @@ #define JELLYFIN_DTO_UPLOADSUBTITLEDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class UploadSubtitleDto : public QObject { - Q_OBJECT -public: - explicit UploadSubtitleDto(QObject *parent = nullptr); - static UploadSubtitleDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class UploadSubtitleDto { +public: + explicit UploadSubtitleDto(); + static UploadSubtitleDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the subtitle language. */ - Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged) + QString language() const; + /** + * @brief Gets or sets the subtitle language. + */ + void setLanguage(QString newLanguage); /** * @brief Gets or sets the subtitle format. */ - Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged) + QString format() const; + /** + * @brief Gets or sets the subtitle format. + */ + void setFormat(QString newFormat); /** * @brief Gets or sets a value indicating whether the subtitle is forced. */ - Q_PROPERTY(bool isForced READ isForced WRITE setIsForced NOTIFY isForcedChanged) + bool isForced() const; + /** + * @brief Gets or sets a value indicating whether the subtitle is forced. + */ + void setIsForced(bool newIsForced); /** * @brief Gets or sets the subtitle data. */ - Q_PROPERTY(QString data READ data WRITE setData NOTIFY dataChanged) - - QString language() const; - void setLanguage(QString newLanguage); - - QString format() const; - void setFormat(QString newFormat); - - bool isForced() const; - void setIsForced(bool newIsForced); - QString data() const; + /** + * @brief Gets or sets the subtitle data. + */ void setData(QString newData); - -signals: - void languageChanged(QString newLanguage); - void formatChanged(QString newFormat); - void isForcedChanged(bool newIsForced); - void dataChanged(QString newData); + protected: QString m_language; QString m_format; @@ -86,6 +89,18 @@ protected: QString m_data; }; +} // NS DTO + +namespace Support { + +using UploadSubtitleDto = Jellyfin::DTO::UploadSubtitleDto; + +template <> +UploadSubtitleDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UploadSubtitleDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/user.h b/core/include/JellyfinQt/DTO/user.h index dbd37eb..db2ae29 100644 --- a/core/include/JellyfinQt/DTO/user.h +++ b/core/include/JellyfinQt/DTO/user.h @@ -30,7 +30,7 @@ #ifndef JELLYFIN_DTO_USER_H #define JELLYFIN_DTO_USER_H -#include "JellyfinQt/DTO/userdto.h" +#include "JellyfinQt/UserDto" namespace Jellyfin { namespace DTO { diff --git a/core/include/JellyfinQt/DTO/userconfiguration.h b/core/include/JellyfinQt/DTO/userconfiguration.h index 92386f6..ad76d2f 100644 --- a/core/include/JellyfinQt/DTO/userconfiguration.h +++ b/core/include/JellyfinQt/DTO/userconfiguration.h @@ -31,110 +31,100 @@ #define JELLYFIN_DTO_USERCONFIGURATION_H #include +#include #include -#include #include #include +#include #include "JellyfinQt/DTO/subtitleplaybackmode.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class UserConfiguration : public QObject { - Q_OBJECT -public: - explicit UserConfiguration(QObject *parent = nullptr); - static UserConfiguration *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class UserConfiguration { +public: + explicit UserConfiguration(); + static UserConfiguration fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the audio language preference. */ - Q_PROPERTY(QString audioLanguagePreference READ audioLanguagePreference WRITE setAudioLanguagePreference NOTIFY audioLanguagePreferenceChanged) + QString audioLanguagePreference() const; + /** + * @brief Gets or sets the audio language preference. + */ + void setAudioLanguagePreference(QString newAudioLanguagePreference); /** * @brief Gets or sets a value indicating whether [play default audio track]. */ - Q_PROPERTY(bool playDefaultAudioTrack READ playDefaultAudioTrack WRITE setPlayDefaultAudioTrack NOTIFY playDefaultAudioTrackChanged) + bool playDefaultAudioTrack() const; + /** + * @brief Gets or sets a value indicating whether [play default audio track]. + */ + void setPlayDefaultAudioTrack(bool newPlayDefaultAudioTrack); /** * @brief Gets or sets the subtitle language preference. */ - Q_PROPERTY(QString subtitleLanguagePreference READ subtitleLanguagePreference WRITE setSubtitleLanguagePreference NOTIFY subtitleLanguagePreferenceChanged) - Q_PROPERTY(bool displayMissingEpisodes READ displayMissingEpisodes WRITE setDisplayMissingEpisodes NOTIFY displayMissingEpisodesChanged) - Q_PROPERTY(QStringList groupedFolders READ groupedFolders WRITE setGroupedFolders NOTIFY groupedFoldersChanged) - Q_PROPERTY(SubtitlePlaybackMode subtitleMode READ subtitleMode WRITE setSubtitleMode NOTIFY subtitleModeChanged) - Q_PROPERTY(bool displayCollectionsView READ displayCollectionsView WRITE setDisplayCollectionsView NOTIFY displayCollectionsViewChanged) - Q_PROPERTY(bool enableLocalPassword READ enableLocalPassword WRITE setEnableLocalPassword NOTIFY enableLocalPasswordChanged) - Q_PROPERTY(QStringList orderedViews READ orderedViews WRITE setOrderedViews NOTIFY orderedViewsChanged) - Q_PROPERTY(QStringList latestItemsExcludes READ latestItemsExcludes WRITE setLatestItemsExcludes NOTIFY latestItemsExcludesChanged) - Q_PROPERTY(QStringList myMediaExcludes READ myMediaExcludes WRITE setMyMediaExcludes NOTIFY myMediaExcludesChanged) - Q_PROPERTY(bool hidePlayedInLatest READ hidePlayedInLatest WRITE setHidePlayedInLatest NOTIFY hidePlayedInLatestChanged) - Q_PROPERTY(bool rememberAudioSelections READ rememberAudioSelections WRITE setRememberAudioSelections NOTIFY rememberAudioSelectionsChanged) - Q_PROPERTY(bool rememberSubtitleSelections READ rememberSubtitleSelections WRITE setRememberSubtitleSelections NOTIFY rememberSubtitleSelectionsChanged) - Q_PROPERTY(bool enableNextEpisodeAutoPlay READ enableNextEpisodeAutoPlay WRITE setEnableNextEpisodeAutoPlay NOTIFY enableNextEpisodeAutoPlayChanged) - - QString audioLanguagePreference() const; - void setAudioLanguagePreference(QString newAudioLanguagePreference); - - bool playDefaultAudioTrack() const; - void setPlayDefaultAudioTrack(bool newPlayDefaultAudioTrack); - QString subtitleLanguagePreference() const; + /** + * @brief Gets or sets the subtitle language preference. + */ void setSubtitleLanguagePreference(QString newSubtitleLanguagePreference); - + bool displayMissingEpisodes() const; + void setDisplayMissingEpisodes(bool newDisplayMissingEpisodes); - + QStringList groupedFolders() const; + void setGroupedFolders(QStringList newGroupedFolders); - + SubtitlePlaybackMode subtitleMode() const; + void setSubtitleMode(SubtitlePlaybackMode newSubtitleMode); - + bool displayCollectionsView() const; + void setDisplayCollectionsView(bool newDisplayCollectionsView); - + bool enableLocalPassword() const; + void setEnableLocalPassword(bool newEnableLocalPassword); - + QStringList orderedViews() const; + void setOrderedViews(QStringList newOrderedViews); - + QStringList latestItemsExcludes() const; + void setLatestItemsExcludes(QStringList newLatestItemsExcludes); - + QStringList myMediaExcludes() const; + void setMyMediaExcludes(QStringList newMyMediaExcludes); - + bool hidePlayedInLatest() const; + void setHidePlayedInLatest(bool newHidePlayedInLatest); - + bool rememberAudioSelections() const; + void setRememberAudioSelections(bool newRememberAudioSelections); - + bool rememberSubtitleSelections() const; + void setRememberSubtitleSelections(bool newRememberSubtitleSelections); - + bool enableNextEpisodeAutoPlay() const; + void setEnableNextEpisodeAutoPlay(bool newEnableNextEpisodeAutoPlay); - -signals: - void audioLanguagePreferenceChanged(QString newAudioLanguagePreference); - void playDefaultAudioTrackChanged(bool newPlayDefaultAudioTrack); - void subtitleLanguagePreferenceChanged(QString newSubtitleLanguagePreference); - void displayMissingEpisodesChanged(bool newDisplayMissingEpisodes); - void groupedFoldersChanged(QStringList newGroupedFolders); - void subtitleModeChanged(SubtitlePlaybackMode newSubtitleMode); - void displayCollectionsViewChanged(bool newDisplayCollectionsView); - void enableLocalPasswordChanged(bool newEnableLocalPassword); - void orderedViewsChanged(QStringList newOrderedViews); - void latestItemsExcludesChanged(QStringList newLatestItemsExcludes); - void myMediaExcludesChanged(QStringList newMyMediaExcludes); - void hidePlayedInLatestChanged(bool newHidePlayedInLatest); - void rememberAudioSelectionsChanged(bool newRememberAudioSelections); - void rememberSubtitleSelectionsChanged(bool newRememberSubtitleSelections); - void enableNextEpisodeAutoPlayChanged(bool newEnableNextEpisodeAutoPlay); + protected: QString m_audioLanguagePreference; bool m_playDefaultAudioTrack; @@ -153,6 +143,18 @@ protected: bool m_enableNextEpisodeAutoPlay; }; +} // NS DTO + +namespace Support { + +using UserConfiguration = Jellyfin::DTO::UserConfiguration; + +template <> +UserConfiguration fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UserConfiguration::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/userdata.h b/core/include/JellyfinQt/DTO/userdata.h index b7b2027..5a7ded4 100644 --- a/core/include/JellyfinQt/DTO/userdata.h +++ b/core/include/JellyfinQt/DTO/userdata.h @@ -30,7 +30,7 @@ #ifndef JELLYFIN_DTO_USERDATA_H #define JELLYFIN_DTO_USERDATA_H -#include "JellyfinQt/DTO/useritemdatadto.h" +#include "JellyfinQt/UserItemDataDto" namespace Jellyfin { namespace DTO { diff --git a/core/include/JellyfinQt/DTO/userdto.h b/core/include/JellyfinQt/DTO/userdto.h index 10a7980..99ea979 100644 --- a/core/include/JellyfinQt/DTO/userdto.h +++ b/core/include/JellyfinQt/DTO/userdto.h @@ -32,137 +32,140 @@ #include #include -#include +#include +#include #include +#include +#include + +#include "JellyfinQt/DTO/userconfiguration.h" +#include "JellyfinQt/DTO/userpolicy.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class UserConfiguration; -class UserPolicy; -class UserDto : public QObject { - Q_OBJECT +class UserDto { public: - explicit UserDto(QObject *parent = nullptr); - static UserDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit UserDto(); + static UserDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the server identifier. */ - Q_PROPERTY(QString serverId READ serverId WRITE setServerId NOTIFY serverIdChanged) + QString serverId() const; + /** + * @brief Gets or sets the server identifier. + */ + void setServerId(QString newServerId); /** * @brief Gets or sets the name of the server. This is not used by the server and is for client-side usage only. */ - Q_PROPERTY(QString serverName READ serverName WRITE setServerName NOTIFY serverNameChanged) + QString serverName() const; + /** + * @brief Gets or sets the name of the server. +This is not used by the server and is for client-side usage only. + */ + void setServerName(QString newServerName); /** * @brief Gets or sets the id. */ - Q_PROPERTY(QString jellyfinId READ jellyfinId WRITE setJellyfinId NOTIFY jellyfinIdChanged) + QUuid jellyfinId() const; + /** + * @brief Gets or sets the id. + */ + void setJellyfinId(QUuid newJellyfinId); /** * @brief Gets or sets the primary image tag. */ - Q_PROPERTY(QString primaryImageTag READ primaryImageTag WRITE setPrimaryImageTag NOTIFY primaryImageTagChanged) + QString primaryImageTag() const; + /** + * @brief Gets or sets the primary image tag. + */ + void setPrimaryImageTag(QString newPrimaryImageTag); /** * @brief Gets or sets a value indicating whether this instance has password. */ - Q_PROPERTY(bool hasPassword READ hasPassword WRITE setHasPassword NOTIFY hasPasswordChanged) + bool hasPassword() const; + /** + * @brief Gets or sets a value indicating whether this instance has password. + */ + void setHasPassword(bool newHasPassword); /** * @brief Gets or sets a value indicating whether this instance has configured password. */ - Q_PROPERTY(bool hasConfiguredPassword READ hasConfiguredPassword WRITE setHasConfiguredPassword NOTIFY hasConfiguredPasswordChanged) + bool hasConfiguredPassword() const; + /** + * @brief Gets or sets a value indicating whether this instance has configured password. + */ + void setHasConfiguredPassword(bool newHasConfiguredPassword); /** * @brief Gets or sets a value indicating whether this instance has configured easy password. */ - Q_PROPERTY(bool hasConfiguredEasyPassword READ hasConfiguredEasyPassword WRITE setHasConfiguredEasyPassword NOTIFY hasConfiguredEasyPasswordChanged) + bool hasConfiguredEasyPassword() const; + /** + * @brief Gets or sets a value indicating whether this instance has configured easy password. + */ + void setHasConfiguredEasyPassword(bool newHasConfiguredEasyPassword); /** * @brief Gets or sets whether async login is enabled or not. */ - Q_PROPERTY(bool enableAutoLogin READ enableAutoLogin WRITE setEnableAutoLogin NOTIFY enableAutoLoginChanged) + bool enableAutoLogin() const; + /** + * @brief Gets or sets whether async login is enabled or not. + */ + void setEnableAutoLogin(bool newEnableAutoLogin); /** * @brief Gets or sets the last login date. */ - Q_PROPERTY(QDateTime lastLoginDate READ lastLoginDate WRITE setLastLoginDate NOTIFY lastLoginDateChanged) + QDateTime lastLoginDate() const; + /** + * @brief Gets or sets the last login date. + */ + void setLastLoginDate(QDateTime newLastLoginDate); /** * @brief Gets or sets the last activity date. */ - Q_PROPERTY(QDateTime lastActivityDate READ lastActivityDate WRITE setLastActivityDate NOTIFY lastActivityDateChanged) - Q_PROPERTY(UserConfiguration * configuration READ configuration WRITE setConfiguration NOTIFY configurationChanged) - Q_PROPERTY(UserPolicy * policy READ policy WRITE setPolicy NOTIFY policyChanged) + QDateTime lastActivityDate() const; + /** + * @brief Gets or sets the last activity date. + */ + void setLastActivityDate(QDateTime newLastActivityDate); + + QSharedPointer configuration() const; + + void setConfiguration(QSharedPointer newConfiguration); + + QSharedPointer policy() const; + + void setPolicy(QSharedPointer newPolicy); /** * @brief Gets or sets the primary image aspect ratio. */ - Q_PROPERTY(double primaryImageAspectRatio READ primaryImageAspectRatio WRITE setPrimaryImageAspectRatio NOTIFY primaryImageAspectRatioChanged) - - QString name() const; - void setName(QString newName); - - QString serverId() const; - void setServerId(QString newServerId); - - QString serverName() const; - void setServerName(QString newServerName); - - QString jellyfinId() const; - void setJellyfinId(QString newJellyfinId); - - QString primaryImageTag() const; - void setPrimaryImageTag(QString newPrimaryImageTag); - - bool hasPassword() const; - void setHasPassword(bool newHasPassword); - - bool hasConfiguredPassword() const; - void setHasConfiguredPassword(bool newHasConfiguredPassword); - - bool hasConfiguredEasyPassword() const; - void setHasConfiguredEasyPassword(bool newHasConfiguredEasyPassword); - - bool enableAutoLogin() const; - void setEnableAutoLogin(bool newEnableAutoLogin); - - QDateTime lastLoginDate() const; - void setLastLoginDate(QDateTime newLastLoginDate); - - QDateTime lastActivityDate() const; - void setLastActivityDate(QDateTime newLastActivityDate); - - UserConfiguration * configuration() const; - void setConfiguration(UserConfiguration * newConfiguration); - - UserPolicy * policy() const; - void setPolicy(UserPolicy * newPolicy); - double primaryImageAspectRatio() const; + /** + * @brief Gets or sets the primary image aspect ratio. + */ void setPrimaryImageAspectRatio(double newPrimaryImageAspectRatio); - -signals: - void nameChanged(QString newName); - void serverIdChanged(QString newServerId); - void serverNameChanged(QString newServerName); - void jellyfinIdChanged(QString newJellyfinId); - void primaryImageTagChanged(QString newPrimaryImageTag); - void hasPasswordChanged(bool newHasPassword); - void hasConfiguredPasswordChanged(bool newHasConfiguredPassword); - void hasConfiguredEasyPasswordChanged(bool newHasConfiguredEasyPassword); - void enableAutoLoginChanged(bool newEnableAutoLogin); - void lastLoginDateChanged(QDateTime newLastLoginDate); - void lastActivityDateChanged(QDateTime newLastActivityDate); - void configurationChanged(UserConfiguration * newConfiguration); - void policyChanged(UserPolicy * newPolicy); - void primaryImageAspectRatioChanged(double newPrimaryImageAspectRatio); + protected: QString m_name; QString m_serverId; QString m_serverName; - QString m_jellyfinId; + QUuid m_jellyfinId; QString m_primaryImageTag; bool m_hasPassword; bool m_hasConfiguredPassword; @@ -170,11 +173,23 @@ protected: bool m_enableAutoLogin; QDateTime m_lastLoginDate; QDateTime m_lastActivityDate; - UserConfiguration * m_configuration = nullptr; - UserPolicy * m_policy = nullptr; + QSharedPointer m_configuration = nullptr; + QSharedPointer m_policy = nullptr; double m_primaryImageAspectRatio; }; +} // NS DTO + +namespace Support { + +using UserDto = Jellyfin::DTO::UserDto; + +template <> +UserDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UserDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/useritemdatadto.h b/core/include/JellyfinQt/DTO/useritemdatadto.h index 12e4a07..a74482b 100644 --- a/core/include/JellyfinQt/DTO/useritemdatadto.h +++ b/core/include/JellyfinQt/DTO/useritemdatadto.h @@ -32,110 +32,113 @@ #include #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class UserItemDataDto : public QObject { - Q_OBJECT -public: - explicit UserItemDataDto(QObject *parent = nullptr); - static UserItemDataDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class UserItemDataDto { +public: + explicit UserItemDataDto(); + static UserItemDataDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the rating. */ - Q_PROPERTY(double rating READ rating WRITE setRating NOTIFY ratingChanged) + double rating() const; + /** + * @brief Gets or sets the rating. + */ + void setRating(double newRating); /** * @brief Gets or sets the played percentage. */ - Q_PROPERTY(double playedPercentage READ playedPercentage WRITE setPlayedPercentage NOTIFY playedPercentageChanged) + double playedPercentage() const; + /** + * @brief Gets or sets the played percentage. + */ + void setPlayedPercentage(double newPlayedPercentage); /** * @brief Gets or sets the unplayed item count. */ - Q_PROPERTY(qint32 unplayedItemCount READ unplayedItemCount WRITE setUnplayedItemCount NOTIFY unplayedItemCountChanged) + qint32 unplayedItemCount() const; + /** + * @brief Gets or sets the unplayed item count. + */ + void setUnplayedItemCount(qint32 newUnplayedItemCount); /** * @brief Gets or sets the playback position ticks. */ - Q_PROPERTY(qint64 playbackPositionTicks READ playbackPositionTicks WRITE setPlaybackPositionTicks NOTIFY playbackPositionTicksChanged) + qint64 playbackPositionTicks() const; + /** + * @brief Gets or sets the playback position ticks. + */ + void setPlaybackPositionTicks(qint64 newPlaybackPositionTicks); /** * @brief Gets or sets the play count. */ - Q_PROPERTY(qint32 playCount READ playCount WRITE setPlayCount NOTIFY playCountChanged) + qint32 playCount() const; + /** + * @brief Gets or sets the play count. + */ + void setPlayCount(qint32 newPlayCount); /** * @brief Gets or sets a value indicating whether this instance is favorite. */ - Q_PROPERTY(bool isFavorite READ isFavorite WRITE setIsFavorite NOTIFY isFavoriteChanged) + bool isFavorite() const; + /** + * @brief Gets or sets a value indicating whether this instance is favorite. + */ + void setIsFavorite(bool newIsFavorite); /** * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Dto.UserItemDataDto is likes. */ - Q_PROPERTY(bool likes READ likes WRITE setLikes NOTIFY likesChanged) + bool likes() const; + /** + * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Dto.UserItemDataDto is likes. + */ + void setLikes(bool newLikes); /** * @brief Gets or sets the last played date. */ - Q_PROPERTY(QDateTime lastPlayedDate READ lastPlayedDate WRITE setLastPlayedDate NOTIFY lastPlayedDateChanged) + QDateTime lastPlayedDate() const; + /** + * @brief Gets or sets the last played date. + */ + void setLastPlayedDate(QDateTime newLastPlayedDate); /** * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Dto.UserItemDataDto is played. */ - Q_PROPERTY(bool played READ played WRITE setPlayed NOTIFY playedChanged) + bool played() const; + /** + * @brief Gets or sets a value indicating whether this MediaBrowser.Model.Dto.UserItemDataDto is played. + */ + void setPlayed(bool newPlayed); /** * @brief Gets or sets the key. */ - Q_PROPERTY(QString key READ key WRITE setKey NOTIFY keyChanged) + QString key() const; + /** + * @brief Gets or sets the key. + */ + void setKey(QString newKey); /** * @brief Gets or sets the item identifier. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) - - double rating() const; - void setRating(double newRating); - - double playedPercentage() const; - void setPlayedPercentage(double newPlayedPercentage); - - qint32 unplayedItemCount() const; - void setUnplayedItemCount(qint32 newUnplayedItemCount); - - qint64 playbackPositionTicks() const; - void setPlaybackPositionTicks(qint64 newPlaybackPositionTicks); - - qint32 playCount() const; - void setPlayCount(qint32 newPlayCount); - - bool isFavorite() const; - void setIsFavorite(bool newIsFavorite); - - bool likes() const; - void setLikes(bool newLikes); - - QDateTime lastPlayedDate() const; - void setLastPlayedDate(QDateTime newLastPlayedDate); - - bool played() const; - void setPlayed(bool newPlayed); - - QString key() const; - void setKey(QString newKey); - QString itemId() const; + /** + * @brief Gets or sets the item identifier. + */ void setItemId(QString newItemId); - -signals: - void ratingChanged(double newRating); - void playedPercentageChanged(double newPlayedPercentage); - void unplayedItemCountChanged(qint32 newUnplayedItemCount); - void playbackPositionTicksChanged(qint64 newPlaybackPositionTicks); - void playCountChanged(qint32 newPlayCount); - void isFavoriteChanged(bool newIsFavorite); - void likesChanged(bool newLikes); - void lastPlayedDateChanged(QDateTime newLastPlayedDate); - void playedChanged(bool newPlayed); - void keyChanged(QString newKey); - void itemIdChanged(QString newItemId); + protected: double m_rating; double m_playedPercentage; @@ -150,6 +153,18 @@ protected: QString m_itemId; }; +} // NS DTO + +namespace Support { + +using UserItemDataDto = Jellyfin::DTO::UserItemDataDto; + +template <> +UserItemDataDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UserItemDataDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/userpolicy.h b/core/include/JellyfinQt/DTO/userpolicy.h index 36050fa..7dca51b 100644 --- a/core/include/JellyfinQt/DTO/userpolicy.h +++ b/core/include/JellyfinQt/DTO/userpolicy.h @@ -31,239 +31,208 @@ #define JELLYFIN_DTO_USERPOLICY_H #include +#include #include -#include +#include #include #include +#include +#include +#include "JellyfinQt/DTO/accessschedule.h" #include "JellyfinQt/DTO/syncplayuseraccesstype.h" #include "JellyfinQt/DTO/unrateditem.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class AccessSchedule; -class UserPolicy : public QObject { - Q_OBJECT +class UserPolicy { public: - explicit UserPolicy(QObject *parent = nullptr); - static UserPolicy *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit UserPolicy(); + static UserPolicy fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets a value indicating whether this instance is administrator. */ - Q_PROPERTY(bool isAdministrator READ isAdministrator WRITE setIsAdministrator NOTIFY isAdministratorChanged) + bool isAdministrator() const; + /** + * @brief Gets or sets a value indicating whether this instance is administrator. + */ + void setIsAdministrator(bool newIsAdministrator); /** * @brief Gets or sets a value indicating whether this instance is hidden. */ - Q_PROPERTY(bool isHidden READ isHidden WRITE setIsHidden NOTIFY isHiddenChanged) + bool isHidden() const; + /** + * @brief Gets or sets a value indicating whether this instance is hidden. + */ + void setIsHidden(bool newIsHidden); /** * @brief Gets or sets a value indicating whether this instance is disabled. */ - Q_PROPERTY(bool isDisabled READ isDisabled WRITE setIsDisabled NOTIFY isDisabledChanged) + bool isDisabled() const; + /** + * @brief Gets or sets a value indicating whether this instance is disabled. + */ + void setIsDisabled(bool newIsDisabled); /** * @brief Gets or sets the max parental rating. */ - Q_PROPERTY(qint32 maxParentalRating READ maxParentalRating WRITE setMaxParentalRating NOTIFY maxParentalRatingChanged) - Q_PROPERTY(QStringList blockedTags READ blockedTags WRITE setBlockedTags NOTIFY blockedTagsChanged) - Q_PROPERTY(bool enableUserPreferenceAccess READ enableUserPreferenceAccess WRITE setEnableUserPreferenceAccess NOTIFY enableUserPreferenceAccessChanged) - Q_PROPERTY(QList accessSchedules READ accessSchedules WRITE setAccessSchedules NOTIFY accessSchedulesChanged) - Q_PROPERTY(QList blockUnratedItems READ blockUnratedItems WRITE setBlockUnratedItems NOTIFY blockUnratedItemsChanged) - Q_PROPERTY(bool enableRemoteControlOfOtherUsers READ enableRemoteControlOfOtherUsers WRITE setEnableRemoteControlOfOtherUsers NOTIFY enableRemoteControlOfOtherUsersChanged) - Q_PROPERTY(bool enableSharedDeviceControl READ enableSharedDeviceControl WRITE setEnableSharedDeviceControl NOTIFY enableSharedDeviceControlChanged) - Q_PROPERTY(bool enableRemoteAccess READ enableRemoteAccess WRITE setEnableRemoteAccess NOTIFY enableRemoteAccessChanged) - Q_PROPERTY(bool enableLiveTvManagement READ enableLiveTvManagement WRITE setEnableLiveTvManagement NOTIFY enableLiveTvManagementChanged) - Q_PROPERTY(bool enableLiveTvAccess READ enableLiveTvAccess WRITE setEnableLiveTvAccess NOTIFY enableLiveTvAccessChanged) - Q_PROPERTY(bool enableMediaPlayback READ enableMediaPlayback WRITE setEnableMediaPlayback NOTIFY enableMediaPlaybackChanged) - Q_PROPERTY(bool enableAudioPlaybackTranscoding READ enableAudioPlaybackTranscoding WRITE setEnableAudioPlaybackTranscoding NOTIFY enableAudioPlaybackTranscodingChanged) - Q_PROPERTY(bool enableVideoPlaybackTranscoding READ enableVideoPlaybackTranscoding WRITE setEnableVideoPlaybackTranscoding NOTIFY enableVideoPlaybackTranscodingChanged) - Q_PROPERTY(bool enablePlaybackRemuxing READ enablePlaybackRemuxing WRITE setEnablePlaybackRemuxing NOTIFY enablePlaybackRemuxingChanged) - Q_PROPERTY(bool forceRemoteSourceTranscoding READ forceRemoteSourceTranscoding WRITE setForceRemoteSourceTranscoding NOTIFY forceRemoteSourceTranscodingChanged) - Q_PROPERTY(bool enableContentDeletion READ enableContentDeletion WRITE setEnableContentDeletion NOTIFY enableContentDeletionChanged) - Q_PROPERTY(QStringList enableContentDeletionFromFolders READ enableContentDeletionFromFolders WRITE setEnableContentDeletionFromFolders NOTIFY enableContentDeletionFromFoldersChanged) - Q_PROPERTY(bool enableContentDownloading READ enableContentDownloading WRITE setEnableContentDownloading NOTIFY enableContentDownloadingChanged) + qint32 maxParentalRating() const; + /** + * @brief Gets or sets the max parental rating. + */ + void setMaxParentalRating(qint32 newMaxParentalRating); + + QStringList blockedTags() const; + + void setBlockedTags(QStringList newBlockedTags); + + bool enableUserPreferenceAccess() const; + + void setEnableUserPreferenceAccess(bool newEnableUserPreferenceAccess); + + QList> accessSchedules() const; + + void setAccessSchedules(QList> newAccessSchedules); + + QList blockUnratedItems() const; + + void setBlockUnratedItems(QList newBlockUnratedItems); + + bool enableRemoteControlOfOtherUsers() const; + + void setEnableRemoteControlOfOtherUsers(bool newEnableRemoteControlOfOtherUsers); + + bool enableSharedDeviceControl() const; + + void setEnableSharedDeviceControl(bool newEnableSharedDeviceControl); + + bool enableRemoteAccess() const; + + void setEnableRemoteAccess(bool newEnableRemoteAccess); + + bool enableLiveTvManagement() const; + + void setEnableLiveTvManagement(bool newEnableLiveTvManagement); + + bool enableLiveTvAccess() const; + + void setEnableLiveTvAccess(bool newEnableLiveTvAccess); + + bool enableMediaPlayback() const; + + void setEnableMediaPlayback(bool newEnableMediaPlayback); + + bool enableAudioPlaybackTranscoding() const; + + void setEnableAudioPlaybackTranscoding(bool newEnableAudioPlaybackTranscoding); + + bool enableVideoPlaybackTranscoding() const; + + void setEnableVideoPlaybackTranscoding(bool newEnableVideoPlaybackTranscoding); + + bool enablePlaybackRemuxing() const; + + void setEnablePlaybackRemuxing(bool newEnablePlaybackRemuxing); + + bool forceRemoteSourceTranscoding() const; + + void setForceRemoteSourceTranscoding(bool newForceRemoteSourceTranscoding); + + bool enableContentDeletion() const; + + void setEnableContentDeletion(bool newEnableContentDeletion); + + QStringList enableContentDeletionFromFolders() const; + + void setEnableContentDeletionFromFolders(QStringList newEnableContentDeletionFromFolders); + + bool enableContentDownloading() const; + + void setEnableContentDownloading(bool newEnableContentDownloading); /** * @brief Gets or sets a value indicating whether [enable synchronize]. */ - Q_PROPERTY(bool enableSyncTranscoding READ enableSyncTranscoding WRITE setEnableSyncTranscoding NOTIFY enableSyncTranscodingChanged) - Q_PROPERTY(bool enableMediaConversion READ enableMediaConversion WRITE setEnableMediaConversion NOTIFY enableMediaConversionChanged) - Q_PROPERTY(QStringList enabledDevices READ enabledDevices WRITE setEnabledDevices NOTIFY enabledDevicesChanged) - Q_PROPERTY(bool enableAllDevices READ enableAllDevices WRITE setEnableAllDevices NOTIFY enableAllDevicesChanged) - Q_PROPERTY(QStringList enabledChannels READ enabledChannels WRITE setEnabledChannels NOTIFY enabledChannelsChanged) - Q_PROPERTY(bool enableAllChannels READ enableAllChannels WRITE setEnableAllChannels NOTIFY enableAllChannelsChanged) - Q_PROPERTY(QStringList enabledFolders READ enabledFolders WRITE setEnabledFolders NOTIFY enabledFoldersChanged) - Q_PROPERTY(bool enableAllFolders READ enableAllFolders WRITE setEnableAllFolders NOTIFY enableAllFoldersChanged) - Q_PROPERTY(qint32 invalidLoginAttemptCount READ invalidLoginAttemptCount WRITE setInvalidLoginAttemptCount NOTIFY invalidLoginAttemptCountChanged) - Q_PROPERTY(qint32 loginAttemptsBeforeLockout READ loginAttemptsBeforeLockout WRITE setLoginAttemptsBeforeLockout NOTIFY loginAttemptsBeforeLockoutChanged) - Q_PROPERTY(qint32 maxActiveSessions READ maxActiveSessions WRITE setMaxActiveSessions NOTIFY maxActiveSessionsChanged) - Q_PROPERTY(bool enablePublicSharing READ enablePublicSharing WRITE setEnablePublicSharing NOTIFY enablePublicSharingChanged) - Q_PROPERTY(QStringList blockedMediaFolders READ blockedMediaFolders WRITE setBlockedMediaFolders NOTIFY blockedMediaFoldersChanged) - Q_PROPERTY(QStringList blockedChannels READ blockedChannels WRITE setBlockedChannels NOTIFY blockedChannelsChanged) - Q_PROPERTY(qint32 remoteClientBitrateLimit READ remoteClientBitrateLimit WRITE setRemoteClientBitrateLimit NOTIFY remoteClientBitrateLimitChanged) - Q_PROPERTY(QString authenticationProviderId READ authenticationProviderId WRITE setAuthenticationProviderId NOTIFY authenticationProviderIdChanged) - Q_PROPERTY(QString passwordResetProviderId READ passwordResetProviderId WRITE setPasswordResetProviderId NOTIFY passwordResetProviderIdChanged) - Q_PROPERTY(SyncPlayUserAccessType syncPlayAccess READ syncPlayAccess WRITE setSyncPlayAccess NOTIFY syncPlayAccessChanged) - - bool isAdministrator() const; - void setIsAdministrator(bool newIsAdministrator); - - bool isHidden() const; - void setIsHidden(bool newIsHidden); - - bool isDisabled() const; - void setIsDisabled(bool newIsDisabled); - - qint32 maxParentalRating() const; - void setMaxParentalRating(qint32 newMaxParentalRating); - - QStringList blockedTags() const; - void setBlockedTags(QStringList newBlockedTags); - - bool enableUserPreferenceAccess() const; - void setEnableUserPreferenceAccess(bool newEnableUserPreferenceAccess); - - QList accessSchedules() const; - void setAccessSchedules(QList newAccessSchedules); - - QList blockUnratedItems() const; - void setBlockUnratedItems(QList newBlockUnratedItems); - - bool enableRemoteControlOfOtherUsers() const; - void setEnableRemoteControlOfOtherUsers(bool newEnableRemoteControlOfOtherUsers); - - bool enableSharedDeviceControl() const; - void setEnableSharedDeviceControl(bool newEnableSharedDeviceControl); - - bool enableRemoteAccess() const; - void setEnableRemoteAccess(bool newEnableRemoteAccess); - - bool enableLiveTvManagement() const; - void setEnableLiveTvManagement(bool newEnableLiveTvManagement); - - bool enableLiveTvAccess() const; - void setEnableLiveTvAccess(bool newEnableLiveTvAccess); - - bool enableMediaPlayback() const; - void setEnableMediaPlayback(bool newEnableMediaPlayback); - - bool enableAudioPlaybackTranscoding() const; - void setEnableAudioPlaybackTranscoding(bool newEnableAudioPlaybackTranscoding); - - bool enableVideoPlaybackTranscoding() const; - void setEnableVideoPlaybackTranscoding(bool newEnableVideoPlaybackTranscoding); - - bool enablePlaybackRemuxing() const; - void setEnablePlaybackRemuxing(bool newEnablePlaybackRemuxing); - - bool forceRemoteSourceTranscoding() const; - void setForceRemoteSourceTranscoding(bool newForceRemoteSourceTranscoding); - - bool enableContentDeletion() const; - void setEnableContentDeletion(bool newEnableContentDeletion); - - QStringList enableContentDeletionFromFolders() const; - void setEnableContentDeletionFromFolders(QStringList newEnableContentDeletionFromFolders); - - bool enableContentDownloading() const; - void setEnableContentDownloading(bool newEnableContentDownloading); - bool enableSyncTranscoding() const; + /** + * @brief Gets or sets a value indicating whether [enable synchronize]. + */ void setEnableSyncTranscoding(bool newEnableSyncTranscoding); - + bool enableMediaConversion() const; + void setEnableMediaConversion(bool newEnableMediaConversion); - + QStringList enabledDevices() const; + void setEnabledDevices(QStringList newEnabledDevices); - + bool enableAllDevices() const; + void setEnableAllDevices(bool newEnableAllDevices); - - QStringList enabledChannels() const; - void setEnabledChannels(QStringList newEnabledChannels); - + + QList enabledChannels() const; + + void setEnabledChannels(QList newEnabledChannels); + bool enableAllChannels() const; + void setEnableAllChannels(bool newEnableAllChannels); - - QStringList enabledFolders() const; - void setEnabledFolders(QStringList newEnabledFolders); - + + QList enabledFolders() const; + + void setEnabledFolders(QList newEnabledFolders); + bool enableAllFolders() const; + void setEnableAllFolders(bool newEnableAllFolders); - + qint32 invalidLoginAttemptCount() const; + void setInvalidLoginAttemptCount(qint32 newInvalidLoginAttemptCount); - + qint32 loginAttemptsBeforeLockout() const; + void setLoginAttemptsBeforeLockout(qint32 newLoginAttemptsBeforeLockout); - + qint32 maxActiveSessions() const; + void setMaxActiveSessions(qint32 newMaxActiveSessions); - + bool enablePublicSharing() const; + void setEnablePublicSharing(bool newEnablePublicSharing); - - QStringList blockedMediaFolders() const; - void setBlockedMediaFolders(QStringList newBlockedMediaFolders); - - QStringList blockedChannels() const; - void setBlockedChannels(QStringList newBlockedChannels); - + + QList blockedMediaFolders() const; + + void setBlockedMediaFolders(QList newBlockedMediaFolders); + + QList blockedChannels() const; + + void setBlockedChannels(QList newBlockedChannels); + qint32 remoteClientBitrateLimit() const; + void setRemoteClientBitrateLimit(qint32 newRemoteClientBitrateLimit); - + QString authenticationProviderId() const; + void setAuthenticationProviderId(QString newAuthenticationProviderId); - + QString passwordResetProviderId() const; + void setPasswordResetProviderId(QString newPasswordResetProviderId); - + SyncPlayUserAccessType syncPlayAccess() const; + void setSyncPlayAccess(SyncPlayUserAccessType newSyncPlayAccess); - -signals: - void isAdministratorChanged(bool newIsAdministrator); - void isHiddenChanged(bool newIsHidden); - void isDisabledChanged(bool newIsDisabled); - void maxParentalRatingChanged(qint32 newMaxParentalRating); - void blockedTagsChanged(QStringList newBlockedTags); - void enableUserPreferenceAccessChanged(bool newEnableUserPreferenceAccess); - void accessSchedulesChanged(QList newAccessSchedules); - void blockUnratedItemsChanged(QList newBlockUnratedItems); - void enableRemoteControlOfOtherUsersChanged(bool newEnableRemoteControlOfOtherUsers); - void enableSharedDeviceControlChanged(bool newEnableSharedDeviceControl); - void enableRemoteAccessChanged(bool newEnableRemoteAccess); - void enableLiveTvManagementChanged(bool newEnableLiveTvManagement); - void enableLiveTvAccessChanged(bool newEnableLiveTvAccess); - void enableMediaPlaybackChanged(bool newEnableMediaPlayback); - void enableAudioPlaybackTranscodingChanged(bool newEnableAudioPlaybackTranscoding); - void enableVideoPlaybackTranscodingChanged(bool newEnableVideoPlaybackTranscoding); - void enablePlaybackRemuxingChanged(bool newEnablePlaybackRemuxing); - void forceRemoteSourceTranscodingChanged(bool newForceRemoteSourceTranscoding); - void enableContentDeletionChanged(bool newEnableContentDeletion); - void enableContentDeletionFromFoldersChanged(QStringList newEnableContentDeletionFromFolders); - void enableContentDownloadingChanged(bool newEnableContentDownloading); - void enableSyncTranscodingChanged(bool newEnableSyncTranscoding); - void enableMediaConversionChanged(bool newEnableMediaConversion); - void enabledDevicesChanged(QStringList newEnabledDevices); - void enableAllDevicesChanged(bool newEnableAllDevices); - void enabledChannelsChanged(QStringList newEnabledChannels); - void enableAllChannelsChanged(bool newEnableAllChannels); - void enabledFoldersChanged(QStringList newEnabledFolders); - void enableAllFoldersChanged(bool newEnableAllFolders); - void invalidLoginAttemptCountChanged(qint32 newInvalidLoginAttemptCount); - void loginAttemptsBeforeLockoutChanged(qint32 newLoginAttemptsBeforeLockout); - void maxActiveSessionsChanged(qint32 newMaxActiveSessions); - void enablePublicSharingChanged(bool newEnablePublicSharing); - void blockedMediaFoldersChanged(QStringList newBlockedMediaFolders); - void blockedChannelsChanged(QStringList newBlockedChannels); - void remoteClientBitrateLimitChanged(qint32 newRemoteClientBitrateLimit); - void authenticationProviderIdChanged(QString newAuthenticationProviderId); - void passwordResetProviderIdChanged(QString newPasswordResetProviderId); - void syncPlayAccessChanged(SyncPlayUserAccessType newSyncPlayAccess); + protected: bool m_isAdministrator; bool m_isHidden; @@ -271,7 +240,7 @@ protected: qint32 m_maxParentalRating; QStringList m_blockedTags; bool m_enableUserPreferenceAccess; - QList m_accessSchedules; + QList> m_accessSchedules; QList m_blockUnratedItems; bool m_enableRemoteControlOfOtherUsers; bool m_enableSharedDeviceControl; @@ -290,22 +259,34 @@ protected: bool m_enableMediaConversion; QStringList m_enabledDevices; bool m_enableAllDevices; - QStringList m_enabledChannels; + QList m_enabledChannels; bool m_enableAllChannels; - QStringList m_enabledFolders; + QList m_enabledFolders; bool m_enableAllFolders; qint32 m_invalidLoginAttemptCount; qint32 m_loginAttemptsBeforeLockout; qint32 m_maxActiveSessions; bool m_enablePublicSharing; - QStringList m_blockedMediaFolders; - QStringList m_blockedChannels; + QList m_blockedMediaFolders; + QList m_blockedChannels; qint32 m_remoteClientBitrateLimit; QString m_authenticationProviderId; QString m_passwordResetProviderId; SyncPlayUserAccessType m_syncPlayAccess; }; +} // NS DTO + +namespace Support { + +using UserPolicy = Jellyfin::DTO::UserPolicy; + +template <> +UserPolicy fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UserPolicy::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/utctimeresponse.h b/core/include/JellyfinQt/DTO/utctimeresponse.h index 45e94c2..48e9fff 100644 --- a/core/include/JellyfinQt/DTO/utctimeresponse.h +++ b/core/include/JellyfinQt/DTO/utctimeresponse.h @@ -32,42 +32,57 @@ #include #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class UtcTimeResponse : public QObject { - Q_OBJECT -public: - explicit UtcTimeResponse(QObject *parent = nullptr); - static UtcTimeResponse *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class UtcTimeResponse { +public: + explicit UtcTimeResponse(); + static UtcTimeResponse fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the UTC time when request has been received. */ - Q_PROPERTY(QDateTime requestReceptionTime READ requestReceptionTime WRITE setRequestReceptionTime NOTIFY requestReceptionTimeChanged) + QDateTime requestReceptionTime() const; + /** + * @brief Gets the UTC time when request has been received. + */ + void setRequestReceptionTime(QDateTime newRequestReceptionTime); /** * @brief Gets the UTC time when response has been sent. */ - Q_PROPERTY(QDateTime responseTransmissionTime READ responseTransmissionTime WRITE setResponseTransmissionTime NOTIFY responseTransmissionTimeChanged) - - QDateTime requestReceptionTime() const; - void setRequestReceptionTime(QDateTime newRequestReceptionTime); - QDateTime responseTransmissionTime() const; + /** + * @brief Gets the UTC time when response has been sent. + */ void setResponseTransmissionTime(QDateTime newResponseTransmissionTime); - -signals: - void requestReceptionTimeChanged(QDateTime newRequestReceptionTime); - void responseTransmissionTimeChanged(QDateTime newResponseTransmissionTime); + protected: QDateTime m_requestReceptionTime; QDateTime m_responseTransmissionTime; }; +} // NS DTO + +namespace Support { + +using UtcTimeResponse = Jellyfin::DTO::UtcTimeResponse; + +template <> +UtcTimeResponse fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return UtcTimeResponse::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/validatepathdto.h b/core/include/JellyfinQt/DTO/validatepathdto.h index 6766be9..cf3a892 100644 --- a/core/include/JellyfinQt/DTO/validatepathdto.h +++ b/core/include/JellyfinQt/DTO/validatepathdto.h @@ -31,52 +31,67 @@ #define JELLYFIN_DTO_VALIDATEPATHDTO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class ValidatePathDto : public QObject { - Q_OBJECT -public: - explicit ValidatePathDto(QObject *parent = nullptr); - static ValidatePathDto *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class ValidatePathDto { +public: + explicit ValidatePathDto(); + static ValidatePathDto fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets a value indicating whether validate if path is writable. */ - Q_PROPERTY(bool validateWritable READ validateWritable WRITE setValidateWritable NOTIFY validateWritableChanged) + bool validateWritable() const; + /** + * @brief Gets or sets a value indicating whether validate if path is writable. + */ + void setValidateWritable(bool newValidateWritable); /** * @brief Gets or sets the path. */ - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QString path() const; + /** + * @brief Gets or sets the path. + */ + void setPath(QString newPath); /** * @brief Gets or sets is path file. */ - Q_PROPERTY(bool isFile READ isFile WRITE setIsFile NOTIFY isFileChanged) - - bool validateWritable() const; - void setValidateWritable(bool newValidateWritable); - - QString path() const; - void setPath(QString newPath); - bool isFile() const; + /** + * @brief Gets or sets is path file. + */ void setIsFile(bool newIsFile); - -signals: - void validateWritableChanged(bool newValidateWritable); - void pathChanged(QString newPath); - void isFileChanged(bool newIsFile); + protected: bool m_validateWritable; QString m_path; bool m_isFile; }; +} // NS DTO + +namespace Support { + +using ValidatePathDto = Jellyfin::DTO::ValidatePathDto; + +template <> +ValidatePathDto fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return ValidatePathDto::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/version.h b/core/include/JellyfinQt/DTO/version.h index 75ac77c..bdad334 100644 --- a/core/include/JellyfinQt/DTO/version.h +++ b/core/include/JellyfinQt/DTO/version.h @@ -31,51 +31,48 @@ #define JELLYFIN_DTO_VERSION_H #include -#include +#include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class Version : public QObject { - Q_OBJECT -public: - explicit Version(QObject *parent = nullptr); - static Version *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - Q_PROPERTY(qint32 major READ major WRITE setMajor NOTIFY majorChanged) - Q_PROPERTY(qint32 minor READ minor WRITE setMinor NOTIFY minorChanged) - Q_PROPERTY(qint32 build READ build WRITE setBuild NOTIFY buildChanged) - Q_PROPERTY(qint32 revision READ revision WRITE setRevision NOTIFY revisionChanged) - Q_PROPERTY(qint32 majorRevision READ majorRevision WRITE setMajorRevision NOTIFY majorRevisionChanged) - Q_PROPERTY(qint32 minorRevision READ minorRevision WRITE setMinorRevision NOTIFY minorRevisionChanged) +class Version { +public: + explicit Version(); + static Version fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties qint32 major() const; + void setMajor(qint32 newMajor); - + qint32 minor() const; + void setMinor(qint32 newMinor); - + qint32 build() const; + void setBuild(qint32 newBuild); - + qint32 revision() const; + void setRevision(qint32 newRevision); - + qint32 majorRevision() const; + void setMajorRevision(qint32 newMajorRevision); - + qint32 minorRevision() const; + void setMinorRevision(qint32 newMinorRevision); - -signals: - void majorChanged(qint32 newMajor); - void minorChanged(qint32 newMinor); - void buildChanged(qint32 newBuild); - void revisionChanged(qint32 newRevision); - void majorRevisionChanged(qint32 newMajorRevision); - void minorRevisionChanged(qint32 newMinorRevision); + protected: qint32 m_major; qint32 m_minor; @@ -85,6 +82,18 @@ protected: qint32 m_minorRevision; }; +} // NS DTO + +namespace Support { + +using Version = Jellyfin::DTO::Version; + +template <> +Version fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return Version::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/versioninfo.h b/core/include/JellyfinQt/DTO/versioninfo.h index 945cea0..231f5e2 100644 --- a/core/include/JellyfinQt/DTO/versioninfo.h +++ b/core/include/JellyfinQt/DTO/versioninfo.h @@ -31,96 +31,98 @@ #define JELLYFIN_DTO_VERSIONINFO_H #include -#include +#include +#include #include +#include + +#include "JellyfinQt/DTO/version.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class Version; -class VersionInfo : public QObject { - Q_OBJECT +class VersionInfo { public: - explicit VersionInfo(QObject *parent = nullptr); - static VersionInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit VersionInfo(); + static VersionInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the version. */ - Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY versionChanged) - Q_PROPERTY(Version * versionNumber READ versionNumber WRITE setVersionNumber NOTIFY versionNumberChanged) + QString version() const; + /** + * @brief Gets or sets the version. + */ + void setVersion(QString newVersion); + + QSharedPointer versionNumber() const; + + void setVersionNumber(QSharedPointer newVersionNumber); /** * @brief Gets or sets the changelog for this version. */ - Q_PROPERTY(QString changelog READ changelog WRITE setChangelog NOTIFY changelogChanged) + QString changelog() const; + /** + * @brief Gets or sets the changelog for this version. + */ + void setChangelog(QString newChangelog); /** * @brief Gets or sets the ABI that this version was built against. */ - Q_PROPERTY(QString targetAbi READ targetAbi WRITE setTargetAbi NOTIFY targetAbiChanged) + QString targetAbi() const; + /** + * @brief Gets or sets the ABI that this version was built against. + */ + void setTargetAbi(QString newTargetAbi); /** * @brief Gets or sets the source URL. */ - Q_PROPERTY(QString sourceUrl READ sourceUrl WRITE setSourceUrl NOTIFY sourceUrlChanged) + QString sourceUrl() const; + /** + * @brief Gets or sets the source URL. + */ + void setSourceUrl(QString newSourceUrl); /** * @brief Gets or sets a checksum for the binary. */ - Q_PROPERTY(QString checksum READ checksum WRITE setChecksum NOTIFY checksumChanged) + QString checksum() const; + /** + * @brief Gets or sets a checksum for the binary. + */ + void setChecksum(QString newChecksum); /** * @brief Gets or sets a timestamp of when the binary was built. */ - Q_PROPERTY(QString timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged) + QString timestamp() const; + /** + * @brief Gets or sets a timestamp of when the binary was built. + */ + void setTimestamp(QString newTimestamp); /** * @brief Gets or sets the repository name. */ - Q_PROPERTY(QString repositoryName READ repositoryName WRITE setRepositoryName NOTIFY repositoryNameChanged) + QString repositoryName() const; + /** + * @brief Gets or sets the repository name. + */ + void setRepositoryName(QString newRepositoryName); /** * @brief Gets or sets the repository url. */ - Q_PROPERTY(QString repositoryUrl READ repositoryUrl WRITE setRepositoryUrl NOTIFY repositoryUrlChanged) - - QString version() const; - void setVersion(QString newVersion); - - Version * versionNumber() const; - void setVersionNumber(Version * newVersionNumber); - - QString changelog() const; - void setChangelog(QString newChangelog); - - QString targetAbi() const; - void setTargetAbi(QString newTargetAbi); - - QString sourceUrl() const; - void setSourceUrl(QString newSourceUrl); - - QString checksum() const; - void setChecksum(QString newChecksum); - - QString timestamp() const; - void setTimestamp(QString newTimestamp); - - QString repositoryName() const; - void setRepositoryName(QString newRepositoryName); - QString repositoryUrl() const; + /** + * @brief Gets or sets the repository url. + */ void setRepositoryUrl(QString newRepositoryUrl); - -signals: - void versionChanged(QString newVersion); - void versionNumberChanged(Version * newVersionNumber); - void changelogChanged(QString newChangelog); - void targetAbiChanged(QString newTargetAbi); - void sourceUrlChanged(QString newSourceUrl); - void checksumChanged(QString newChecksum); - void timestampChanged(QString newTimestamp); - void repositoryNameChanged(QString newRepositoryName); - void repositoryUrlChanged(QString newRepositoryUrl); + protected: QString m_version; - Version * m_versionNumber = nullptr; + QSharedPointer m_versionNumber = nullptr; QString m_changelog; QString m_targetAbi; QString m_sourceUrl; @@ -130,6 +132,18 @@ protected: QString m_repositoryUrl; }; +} // NS DTO + +namespace Support { + +using VersionInfo = Jellyfin::DTO::VersionInfo; + +template <> +VersionInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return VersionInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/video3dformat.h b/core/include/JellyfinQt/DTO/video3dformat.h index 7e5e8c6..23d10b9 100644 --- a/core/include/JellyfinQt/DTO/video3dformat.h +++ b/core/include/JellyfinQt/DTO/video3dformat.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_VIDEO3DFORMAT_H #define JELLYFIN_DTO_VIDEO3DFORMAT_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class Video3DFormatClass { Q_GADGET public: enum Value { + EnumNotSet, HalfSideBySide, FullSideBySide, FullTopAndBottom, @@ -49,8 +54,40 @@ public: private: explicit Video3DFormatClass(); }; + typedef Video3DFormatClass::Value Video3DFormat; +} // NS DTO + +namespace Support { + +using Video3DFormat = Jellyfin::DTO::Video3DFormat; +using Video3DFormatClass = Jellyfin::DTO::Video3DFormatClass; + +template <> +Video3DFormat fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return Video3DFormatClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("HalfSideBySide")) { + return Video3DFormatClass::HalfSideBySide; + } + if (str == QStringLiteral("FullSideBySide")) { + return Video3DFormatClass::FullSideBySide; + } + if (str == QStringLiteral("FullTopAndBottom")) { + return Video3DFormatClass::FullTopAndBottom; + } + if (str == QStringLiteral("HalfTopAndBottom")) { + return Video3DFormatClass::HalfTopAndBottom; + } + if (str == QStringLiteral("MVC")) { + return Video3DFormatClass::MVC; + } + + return Video3DFormatClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/videotype.h b/core/include/JellyfinQt/DTO/videotype.h index 9be962f..5157541 100644 --- a/core/include/JellyfinQt/DTO/videotype.h +++ b/core/include/JellyfinQt/DTO/videotype.h @@ -30,7 +30,11 @@ #ifndef JELLYFIN_DTO_VIDEOTYPE_H #define JELLYFIN_DTO_VIDEOTYPE_H +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { @@ -39,6 +43,7 @@ class VideoTypeClass { Q_GADGET public: enum Value { + EnumNotSet, VideoFile, Iso, Dvd, @@ -48,8 +53,37 @@ public: private: explicit VideoTypeClass(); }; + typedef VideoTypeClass::Value VideoType; +} // NS DTO + +namespace Support { + +using VideoType = Jellyfin::DTO::VideoType; +using VideoTypeClass = Jellyfin::DTO::VideoTypeClass; + +template <> +VideoType fromJsonValue(const QJsonValue &source) { + if (!source.isString()) return VideoTypeClass::EnumNotSet; + + QString str = source.toString(); + if (str == QStringLiteral("VideoFile")) { + return VideoTypeClass::VideoFile; + } + if (str == QStringLiteral("Iso")) { + return VideoTypeClass::Iso; + } + if (str == QStringLiteral("Dvd")) { + return VideoTypeClass::Dvd; + } + if (str == QStringLiteral("BluRay")) { + return VideoTypeClass::BluRay; + } + + return VideoTypeClass::EnumNotSet; +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/virtualfolderinfo.h b/core/include/JellyfinQt/DTO/virtualfolderinfo.h index ce278bd..4e0b0ad 100644 --- a/core/include/JellyfinQt/DTO/virtualfolderinfo.h +++ b/core/include/JellyfinQt/DTO/virtualfolderinfo.h @@ -31,92 +31,104 @@ #define JELLYFIN_DTO_VIRTUALFOLDERINFO_H #include +#include #include -#include +#include #include #include +#include + +#include "JellyfinQt/DTO/libraryoptions.h" +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class LibraryOptions; -class VirtualFolderInfo : public QObject { - Q_OBJECT +class VirtualFolderInfo { public: - explicit VirtualFolderInfo(QObject *parent = nullptr); - static VirtualFolderInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); - + explicit VirtualFolderInfo(); + static VirtualFolderInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name. + */ + void setName(QString newName); /** * @brief Gets or sets the locations. */ - Q_PROPERTY(QStringList locations READ locations WRITE setLocations NOTIFY locationsChanged) + QStringList locations() const; + /** + * @brief Gets or sets the locations. + */ + void setLocations(QStringList newLocations); /** * @brief Gets or sets the type of the collection. */ - Q_PROPERTY(QString collectionType READ collectionType WRITE setCollectionType NOTIFY collectionTypeChanged) - Q_PROPERTY(LibraryOptions * libraryOptions READ libraryOptions WRITE setLibraryOptions NOTIFY libraryOptionsChanged) + QString collectionType() const; + /** + * @brief Gets or sets the type of the collection. + */ + void setCollectionType(QString newCollectionType); + + QSharedPointer libraryOptions() const; + + void setLibraryOptions(QSharedPointer newLibraryOptions); /** * @brief Gets or sets the item identifier. */ - Q_PROPERTY(QString itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) + QString itemId() const; + /** + * @brief Gets or sets the item identifier. + */ + void setItemId(QString newItemId); /** * @brief Gets or sets the primary image item identifier. */ - Q_PROPERTY(QString primaryImageItemId READ primaryImageItemId WRITE setPrimaryImageItemId NOTIFY primaryImageItemIdChanged) - Q_PROPERTY(double refreshProgress READ refreshProgress WRITE setRefreshProgress NOTIFY refreshProgressChanged) - Q_PROPERTY(QString refreshStatus READ refreshStatus WRITE setRefreshStatus NOTIFY refreshStatusChanged) - - QString name() const; - void setName(QString newName); - - QStringList locations() const; - void setLocations(QStringList newLocations); - - QString collectionType() const; - void setCollectionType(QString newCollectionType); - - LibraryOptions * libraryOptions() const; - void setLibraryOptions(LibraryOptions * newLibraryOptions); - - QString itemId() const; - void setItemId(QString newItemId); - QString primaryImageItemId() const; + /** + * @brief Gets or sets the primary image item identifier. + */ void setPrimaryImageItemId(QString newPrimaryImageItemId); - + double refreshProgress() const; + void setRefreshProgress(double newRefreshProgress); - + QString refreshStatus() const; + void setRefreshStatus(QString newRefreshStatus); - -signals: - void nameChanged(QString newName); - void locationsChanged(QStringList newLocations); - void collectionTypeChanged(QString newCollectionType); - void libraryOptionsChanged(LibraryOptions * newLibraryOptions); - void itemIdChanged(QString newItemId); - void primaryImageItemIdChanged(QString newPrimaryImageItemId); - void refreshProgressChanged(double newRefreshProgress); - void refreshStatusChanged(QString newRefreshStatus); + protected: QString m_name; QStringList m_locations; QString m_collectionType; - LibraryOptions * m_libraryOptions = nullptr; + QSharedPointer m_libraryOptions = nullptr; QString m_itemId; QString m_primaryImageItemId; double m_refreshProgress; QString m_refreshStatus; }; +} // NS DTO + +namespace Support { + +using VirtualFolderInfo = Jellyfin::DTO::VirtualFolderInfo; + +template <> +VirtualFolderInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return VirtualFolderInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/wakeonlaninfo.h b/core/include/JellyfinQt/DTO/wakeonlaninfo.h index 628c071..64f2f30 100644 --- a/core/include/JellyfinQt/DTO/wakeonlaninfo.h +++ b/core/include/JellyfinQt/DTO/wakeonlaninfo.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_WAKEONLANINFO_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class WakeOnLanInfo : public QObject { - Q_OBJECT -public: - explicit WakeOnLanInfo(QObject *parent = nullptr); - static WakeOnLanInfo *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class WakeOnLanInfo { +public: + explicit WakeOnLanInfo(); + static WakeOnLanInfo fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets the MAC address of the device. */ - Q_PROPERTY(QString macAddress READ macAddress WRITE setMacAddress NOTIFY macAddressChanged) + QString macAddress() const; + /** + * @brief Gets the MAC address of the device. + */ + void setMacAddress(QString newMacAddress); /** * @brief Gets or sets the wake-on-LAN port. */ - Q_PROPERTY(qint32 port READ port WRITE setPort NOTIFY portChanged) - - QString macAddress() const; - void setMacAddress(QString newMacAddress); - qint32 port() const; + /** + * @brief Gets or sets the wake-on-LAN port. + */ void setPort(qint32 newPort); - -signals: - void macAddressChanged(QString newMacAddress); - void portChanged(qint32 newPort); + protected: QString m_macAddress; qint32 m_port; }; +} // NS DTO + +namespace Support { + +using WakeOnLanInfo = Jellyfin::DTO::WakeOnLanInfo; + +template <> +WakeOnLanInfo fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return WakeOnLanInfo::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/DTO/xmlattribute.h b/core/include/JellyfinQt/DTO/xmlattribute.h index 7dea96e..d4aca1a 100644 --- a/core/include/JellyfinQt/DTO/xmlattribute.h +++ b/core/include/JellyfinQt/DTO/xmlattribute.h @@ -31,43 +31,58 @@ #define JELLYFIN_DTO_XMLATTRIBUTE_H #include -#include +#include #include +#include + +#include "JellyfinQt/support/jsonconv.h" namespace Jellyfin { namespace DTO { -class XmlAttribute : public QObject { - Q_OBJECT -public: - explicit XmlAttribute(QObject *parent = nullptr); - static XmlAttribute *fromJSON(QJsonObject source, QObject *parent = nullptr); - void updateFromJSON(QJsonObject source); - QJsonObject toJSON(); +class XmlAttribute { +public: + explicit XmlAttribute(); + static XmlAttribute fromJson(QJsonObject source); + void setFromJson(QJsonObject source); + QJsonObject toJson(); + + // Properties /** * @brief Gets or sets the name of the attribute. */ - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + QString name() const; + /** + * @brief Gets or sets the name of the attribute. + */ + void setName(QString newName); /** * @brief Gets or sets the value of the attribute. */ - Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged) - - QString name() const; - void setName(QString newName); - QString value() const; + /** + * @brief Gets or sets the value of the attribute. + */ void setValue(QString newValue); - -signals: - void nameChanged(QString newName); - void valueChanged(QString newValue); + protected: QString m_name; QString m_value; }; +} // NS DTO + +namespace Support { + +using XmlAttribute = Jellyfin::DTO::XmlAttribute; + +template <> +XmlAttribute fromJsonValue(const QJsonValue &source) { + if (!source.isObject()) throw new ParseException("Expected JSON Object"); + return XmlAttribute::fromJson(source.toObject()); +} + } // NS Jellyfin } // NS DTO diff --git a/core/include/JellyfinQt/support/jsonconv.h b/core/include/JellyfinQt/support/jsonconv.h new file mode 100644 index 0000000..b859791 --- /dev/null +++ b/core/include/JellyfinQt/support/jsonconv.h @@ -0,0 +1,159 @@ +#ifndef JELLYFIN_SUPPORT_JSONCONV_H +#define JELLYFIN_SUPPORT_JSONCONV_H + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace Jellyfin { +namespace Support { + +/** + * @brief Thrown when JSON cannot be parsed. + */ +class ParseException : public std::runtime_error { +public: + explicit ParseException(const char *message) + : std::runtime_error(message) {} +}; + +/** + * Template for converting types from JSON into their respective type. + */ +template +T fromJsonValue(const QJsonValue &source) { + Q_UNUSED(source) + Q_ASSERT_X(false, "fromJsonValue", "fromJsonValue called with unimplemented type"); +} + +template +QJsonValue toJsonValue(const T &source) { + Q_UNUSED(source) + Q_ASSERT_X(false, "toJsonValue", "toJsonValue called with unimplemented type"); +} + +// Trivial converters for built-in classes and simple types + +// int +template <> +int fromJsonValue(const QJsonValue &source) { + if (!source.isDouble()) throw new ParseException("Error while trying to parse JSON value as integer: not an integer"); + return source.toInt(); +} + +template <> +QJsonValue toJsonValue(const int &source) { + return QJsonValue(source); +} + +// bool +template <> +bool fromJsonValue(const QJsonValue &source) { + if (!source.isBool()) throw new ParseException("Error while trying to parse JSON value as boolean: not a boolean"); + return source.toBool(); +} + +template <> +QJsonValue toJsonValue(const bool &source) { + return QJsonValue(source); +} + +// QString +template <> +QString fromJsonValue(const QJsonValue &source) { + if (!source.isString()) throw new ParseException("Error while trying to parse JSON value as string: not a string"); + return source.toString(); +} + +template <> +QJsonValue toJsonValue(const QString &source) { + return QJsonValue(source); +} + +// Double +template <> +double fromJsonValue(const QJsonValue &source) { + if (!source.isDouble()) throw new ParseException("Error while trying to parse JSON value as integer: not a double"); + return source.toDouble(); +} + +template <> +QJsonValue toJsonValue(const double &source) { + return QJsonValue(source); +} + +// QDateTime +template <> +QDateTime fromJsonValue(const QJsonValue &source) { + if (!source.isString()) throw new ParseException("Error while trying to parse JSON value as DateTime: not a string"); + return QDateTime::fromString(source.toString(), Qt::ISODateWithMs); +} + +template <> +QJsonValue toJsonValue(const QDateTime &source) { + return QJsonValue(source.toString(Qt::ISODateWithMs)); +} + +// QUuid +template <> +QUuid fromJsonValue(const QJsonValue &source) { + if (!source.isString()) throw new ParseException("Error while trying to parse JSON value as QUuid: not a string"); + QString sourceString = source.toString(); + if (sourceString.size() != 32) throw new ParseException("Error while trying to parse JSON value as QUid: invalid length"); + // Convert xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (length: 32) + // to {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (length: 38) + QString qtParseableString; + qtParseableString.reserve(38); + qtParseableString += QStringLiteral("{") + + sourceString.mid(0, 8) + + QStringLiteral("-") + + sourceString.mid(8, 4) + + QStringLiteral("-") + + sourceString.mid(12, 4) + + QStringLiteral("-") + + sourceString.mid(16, 4) + + QStringLiteral("-") + + sourceString.mid(20, 12) + + QStringLiteral("}"); + + return QUuid(qtParseableString); +} + +template <> +QJsonValue toJsonValue(const QUuid &source) { + QString str = source.toString(); + // Convert {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (length: 38) + // to xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (lenght: 32) + return QJsonValue(str.mid(1, 8) + str.mid(10, 4) + str.mid(15, 4) + str.mid(20, 4) + str.mid(25 + 12)); +} + +// QList +template +QList fromJsonValue(const QJsonArray &source) { + QList result; + result.reserve(source.size()); + for (auto it = source.cbegin(); it != source.cend(); it++) { + result.append(fromJsonValue(*it)); + } + return result; +} + +template +QJsonValue toJsonValue(const QList &source) { + QJsonArray result; + for (auto it = source.cbegin(); it != source.cend(); it++) { + result.push_back(*it); + } + return result; +} + +} +} + +#endif // JSONCONV_H diff --git a/core/include/JellyfinQt/support/loader.h b/core/include/JellyfinQt/support/loader.h index e633b5b..08e74c8 100644 --- a/core/include/JellyfinQt/support/loader.h +++ b/core/include/JellyfinQt/support/loader.h @@ -32,9 +32,9 @@ static const int HTTP_TIMEOUT = 30000; // 30 seconds; */ template class Loader { - using ApiClient = Jellyfin::ApiClient; public: - explicit Loader(ApiClient *apiClient) : m_apiClient(apiClient) {} + explicit Loader(Jellyfin::ApiClient *apiClient) + : m_apiClient(apiClient) {} /** * @brief load Loads the given resource. * @param parameters Parameters to determine which resource should be loaded. @@ -50,14 +50,20 @@ public: */ virtual bool isAvailable() const; protected: - ApiClient *m_apiClient; + Jellyfin::ApiClient *m_apiClient; }; +/** + * Implementation of Loader that loads Items over HTTP + */ template class HttpLoader : public Loader { public: - R load(const P ¶meters) const override { - QNetworkReply *reply = m_apiClient->get(url(parameters), query(parameters)); + explicit HttpLoader(Jellyfin::ApiClient *apiClient) + : Loader (apiClient) {} + + virtual R load(const P ¶meters) const override { + QNetworkReply *reply = this->m_apiClient->get(url(parameters), query(parameters)); QByteArray array; while (!reply->atEnd()) { if (!reply->waitForReadyRead(HTTP_TIMEOUT)) { diff --git a/core/openapigenerator.d b/core/openapigenerator.d index 733c126..25dcd9f 100755 --- a/core/openapigenerator.d +++ b/core/openapigenerator.d @@ -65,7 +65,7 @@ string CMAKE_VAR_PREFIX = "openapi"; string INCLUDE_PREFIX = "JellyfinQt"; string SRC_PREFIX = ""; -string MODEL_FOLDER = "model"; +string MODEL_FOLDER = "DTO"; string SUPPORT_FOLDER = "support"; string[string] compatAliases; @@ -80,7 +80,10 @@ static this() { } CasePolicy OPENAPI_CASING = CasePolicy.PASCAL; -string[] CPP_NAMESPACE = ["Jellyfin", "DTO"]; +static immutable string[1] CPP_NAMESPACE = ["Jellyfin"]; +static immutable string[2] CPP_NAMESPACE_DTO = ["Jellyfin", "DTO"]; +static immutable string[2] CPP_NAMESPACE_SUPPORT = ["Jellyfin", "Support"]; + CasePolicy CPP_FILENAME_CASING = CasePolicy.LOWER; CasePolicy CPP_CLASS_CASING = CasePolicy.PASCAL; CasePolicy CPP_CLASS_MEMBER_CASING = CasePolicy.CAMEL; @@ -173,9 +176,9 @@ void writeCompatAliasFile(ref const string original, ref const string compatAlia File headerFile = File(buildPath(outputDirectory, "include", INCLUDE_PREFIX, MODEL_FOLDER, fileBase ~ ".h"), "w+"); File implementationFile = File(buildPath(outputDirectory, "src", SRC_PREFIX, MODEL_FOLDER, fileBase ~ ".cpp"), "w+"); - writeHeaderPreamble(headerFile, compatAlias, [], [original]); + writeHeaderPreamble(headerFile, CPP_NAMESPACE_DTO, compatAlias, [], [original]); headerFile.writefln("using %s = %s;", compatAlias, original); - writeHeaderPostamble(headerFile, compatAlias); + writeHeaderPostamble(headerFile, CPP_NAMESPACE_DTO, compatAlias); } void generateFileForSchema(ref string name, ref const Node scheme, Node allSchemas) { @@ -185,29 +188,34 @@ void generateFileForSchema(ref string name, ref const Node scheme, Node allSchem if ("enum" in scheme) { string[3] imports = ["QJsonValue", "QObject", "QString"]; - writeHeaderPreamble(headerFile, name, imports); + string[1] userImports = [buildPath(SUPPORT_FOLDER, "jsonconv.h")]; + writeHeaderPreamble(headerFile, CPP_NAMESPACE_DTO, name, imports, userImports); Appender!(string[]) values; foreach (string value; scheme["enum"]) { values ~= value; } writeEnumHeader(headerFile, name, values[]); - writeHeaderPostamble(headerFile, name); + writeHeaderPostamble(headerFile, CPP_NAMESPACE_DTO, name); - writeImplementationPreamble(implementationFile, name); + writeImplementationPreamble(implementationFile, CPP_NAMESPACE_DTO, name); writeEnumImplementation(implementationFile, name); - writeImplementationPostamble(implementationFile, name); + writeImplementationPostamble(implementationFile, CPP_NAMESPACE_DTO, name); } if (scheme["type"].as!string == "object" && "properties" in scheme) { // Determine all imports Appender!(string[]) systemImports, userImports; Appender!(string[]) forwardDeclarations; - systemImports ~= ["QObject", "QJsonObject"]; + systemImports ~= ["optional", "QJsonObject", "QJsonValue"]; userImports ~= [buildPath(SUPPORT_FOLDER, "jsonconv.h")]; MetaTypeInfo[] usedTypes = collectTypeInfo(scheme["properties"], allSchemas); bool importedContainers = false; void collectImports(MetaTypeInfo type) { + if (type.needsPointer && !systemImports[].canFind("QSharedPointer")) { + systemImports ~= ["QSharedPointer"]; + } + if (type.needsSystemImport && !systemImports[].canFind(type.typeName)) { if (type.isContainer) { if (!importedContainers) { @@ -220,11 +228,10 @@ void generateFileForSchema(ref string name, ref const Node scheme, Node allSchem } else { systemImports ~= [type.typeName]; } - } else if (type.needsLocalImport && !userImports[].canFind(type.typeName)) { - if (type.needsPointer) { - forwardDeclarations ~= type.typeName; - } else { - userImports ~= buildPath(MODEL_FOLDER, type.typeName.applyCasePolicy(OPENAPI_CASING, CasePolicy.LOWER) ~ ".h"); + } else { + string userImport = buildPath(MODEL_FOLDER, type.typeName.applyCasePolicy(OPENAPI_CASING, CasePolicy.LOWER) ~ ".h"); + if (type.needsLocalImport && !userImports[].canFind(userImport) && type.typeName != name) { + userImports ~= userImport; } } } @@ -238,13 +245,13 @@ void generateFileForSchema(ref string name, ref const Node scheme, Node allSchem string[] sortedForwardDeclarations = sort(forwardDeclarations[]).array; // Write implementation files - writeHeaderPreamble(headerFile, name, sortedSystemImports, sortedUserImports); + writeHeaderPreamble(headerFile, CPP_NAMESPACE_DTO, name, sortedSystemImports, sortedUserImports); writeObjectHeader(headerFile, name, usedTypes, sortedForwardDeclarations); - writeHeaderPostamble(headerFile, name); + writeHeaderPostamble(headerFile, CPP_NAMESPACE_DTO, name); - writeImplementationPreamble(implementationFile, name); + writeImplementationPreamble(implementationFile, CPP_NAMESPACE_DTO, name); writeObjectImplementation(implementationFile, name, usedTypes); - writeImplementationPostamble(implementationFile, name); + writeImplementationPostamble(implementationFile, CPP_NAMESPACE_DTO, name); } } @@ -268,14 +275,21 @@ MetaTypeInfo[] collectTypeInfo(Node properties, Node allSchemas) { if (type in allSchemas&& "type" in allSchemas[type] && allSchemas[type]["type"].as!string == "object") { info.needsPointer = true; - } + info.isTypeNullable = true; + info.typeNullableCheck = ".isNull()"; + info.typeNullableSetter = ".clear()"; + } + info.needsLocalImport = true; info.typeName = type; return info; } if (!("type" in node)) { info.typeName = "QVariant"; + info.isTypeNullable = true; info.needsSystemImport = true; + info.typeNullableCheck = ".isNull()"; + info.typeNullableSetter = ".clear()"; return info; } switch(node["type"].as!string) { @@ -288,13 +302,26 @@ MetaTypeInfo[] collectTypeInfo(Node properties, Node allSchemas) { case "date-time": info.typeName= "QDateTime"; info.needsSystemImport = true; + info.isTypeNullable = true; + info.typeNullableCheck = ".isNull()"; + info.typeNullableSetter = "= QDateTime()"; + return info; + case "uuid": + info.typeName = "QUuid"; + info.needsSystemImport = true; + info.isTypeNullable = true; + info.typeNullableCheck = ".isNull()"; + info.typeNullableSetter = "= QGuid()"; return info; default: break; } } + info.isTypeNullable = true; info.typeName= "QString"; info.needsSystemImport = true; + info.typeNullableCheck = ".isNull()"; + info.typeNullableSetter = ".clear()"; return info; case "integer": if ("format" in node) { @@ -323,6 +350,9 @@ MetaTypeInfo[] collectTypeInfo(Node properties, Node allSchemas) { info.needsSystemImport = true; info.isContainer = true; info.containerType = containedType; + info.isTypeNullable = true; + info.typeNullableCheck = ".size() == 0"; + info.typeNullableSetter = ".clear()"; if (containedType.typeName == "QString") { info.typeName = "QStringList"; } else { @@ -348,6 +378,7 @@ void writeObjectHeader(File output, string name, MetaTypeInfo[] properties, stri string className; MetaTypeInfo[] properties; string[] userImports; + string supportNamespace = namespaceString!CPP_NAMESPACE_SUPPORT; } Controller controller = new Controller(); controller.className = name.applyCasePolicy(OPENAPI_CASING, CPP_CLASS_CASING); @@ -363,6 +394,7 @@ void writeObjectImplementation(File output, string name, MetaTypeInfo[] properti class Controller { string className; MetaTypeInfo[] properties; + string supportNamespace = namespaceString!CPP_NAMESPACE_SUPPORT; } Controller controller = new Controller(); controller.className = name.applyCasePolicy(OPENAPI_CASING, CPP_CLASS_CASING); @@ -375,6 +407,7 @@ void writeEnumHeader(File output, string name, string[] values, string doc = "") class Controller { string className; string[] values; + string supportNamespace = namespaceString!CPP_NAMESPACE_SUPPORT; } Controller controller = new Controller(); controller.className = name.applyCasePolicy(OPENAPI_CASING, CPP_CLASS_CASING); @@ -388,9 +421,9 @@ void writeEnumImplementation(File output, string name) { } // Common -void writeHeaderPreamble(File output, string className, string[] imports = [], string[] userImports = []) { +void writeHeaderPreamble(File output, immutable string[] fileNamespace, string className, string[] imports = [], string[] userImports = []) { output.writeln(COPYRIGHT); - string guard = guardName(CPP_NAMESPACE, className); + string guard = guardName(fileNamespace, className); output.writefln("#ifndef %s", guard); output.writefln("#define %s", guard); output.writeln(); @@ -406,22 +439,22 @@ void writeHeaderPreamble(File output, string className, string[] imports = [], s } if (userImports.length > 0) output.writeln(); - foreach (namespace; CPP_NAMESPACE) { + foreach (namespace; fileNamespace) { output.writefln("namespace %s {", namespace); } output.writeln(); } -void writeHeaderPostamble(File output, string className) { +void writeHeaderPostamble(File output, immutable string[] fileNamespace, string className) { output.writeln(); - foreach(namespace; CPP_NAMESPACE) { + foreach(namespace; fileNamespace) { output.writefln("} // NS %s", namespace); } output.writeln(); - output.writefln("#endif // %s", guardName(CPP_NAMESPACE, className)); + output.writefln("#endif // %s", guardName(fileNamespace, className)); } -void writeImplementationPreamble(File output, string className, string[] imports = []) { +void writeImplementationPreamble(File output, immutable string[] fileNamespace, string className, string[] imports = []) { output.writeln(COPYRIGHT); output.writefln("#include <%s>", buildPath(INCLUDE_PREFIX, MODEL_FOLDER, className.applyCasePolicy(OPENAPI_CASING, CasePolicy.LOWER) ~ ".h")); output.writeln(); @@ -431,15 +464,15 @@ void writeImplementationPreamble(File output, string className, string[] imports } if (imports.length > 0) output.writeln(); - foreach (namespace; CPP_NAMESPACE) { + foreach (namespace; fileNamespace) { output.writefln("namespace %s {", namespace); } output.writeln(); } -void writeImplementationPostamble(File output, string className) { +void writeImplementationPostamble(File output, immutable string[] fileNamespace, string className) { output.writeln(); - foreach(namespace; CPP_NAMESPACE) { + foreach(namespace; fileNamespace) { output.writefln("} // NS %s", namespace); } } @@ -508,11 +541,20 @@ public: string originalName = ""; string name = ""; string typeName = ""; + /// Description of this property. string description = ""; + /// If this property is nullable according to the OpenAPI spec. + bool isNullable = false; bool needsPointer = false; + /// If the type needs a system import (Such as Qt types) bool needsSystemImport = false; + /// If the type needs a local import (such as types elsewhere in this project). bool needsLocalImport = false; + /// If the type is a container type bool isContainer = false; + /// If this type has a non-ambigious null state. + bool isTypeNullable = false; + /// If `isContainer` is true, the type of the container. MetaTypeInfo containerType = null; string writeName() { @@ -525,20 +567,59 @@ public: string typeNameWithQualifiers() { if (needsPointer) { - return typeName~ " *"; + return "QSharedPointer<" ~ typeName~ ">"; } else { return typeName; } } + bool needsOptional() { + return isNullable && !isTypeNullable; + } + + string typeNullableCheck; + string nullableCheck() { + if (typeNullableCheck.length > 0) { + return memberName ~ "." ~ typeNullableCheck; + } + if (needsOptional) { + return "!" ~ memberName ~ ".has_value()"; + } + return "Q_ASSERT(false)"; + } + + string typeNullableSetter = ""; + string nullableSetter() { + if (needsOptional) { + return memberName ~ "= std::nullopt"; + } + if (typeNullableSetter.startsWith("=")) { + return memberName ~ typeNullableSetter; + } else { + return typeNullableSetter; + } + } + string defaultInitializer() { if (needsPointer) return "nullptr"; + if (needsOptional) return "std::nullopt"; return ""; } } -string guardName(string[] namespace, string className) { +string guardName(immutable string[] namespace, string className) { return namespace.map!toUpper().join("_") ~ "_" ~ className.applyCasePolicy(OPENAPI_CASING, CasePolicy.UPPER) ~ "_H"; } + +string namespaceString(string[] name)() { + string result; + static foreach(idx, part; name) { + static if (idx != 0) { + result ~= "::"; + } + result ~= part; + } + return result; +} diff --git a/core/src/DTO/accessschedule.cpp b/core/src/DTO/accessschedule.cpp index 7d134cb..516e5c1 100644 --- a/core/src/DTO/accessschedule.cpp +++ b/core/src/DTO/accessschedule.cpp @@ -29,55 +29,61 @@ #include -#include - namespace Jellyfin { namespace DTO { -AccessSchedule::AccessSchedule(QObject *parent) : QObject(parent) {} +AccessSchedule::AccessSchedule(QObject *parent) {} -AccessSchedule *AccessSchedule::fromJSON(QJsonObject source, QObject *parent) { - AccessSchedule *instance = new AccessSchedule(parent); - instance->updateFromJSON(source); +AccessSchedule AccessSchedule::fromJson(QJsonObject source) {AccessSchedule instance; + instance->setFromJson(source, false); return instance; } -void AccessSchedule::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AccessSchedule::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_userId = fromJsonValue(source["UserId"]); + m_dayOfWeek = fromJsonValue(source["DayOfWeek"]); + m_startHour = fromJsonValue(source["StartHour"]); + m_endHour = fromJsonValue(source["EndHour"]); + } -QJsonObject AccessSchedule::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AccessSchedule::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["UserId"] = toJsonValue(m_userId); + result["DayOfWeek"] = toJsonValue(m_dayOfWeek); + result["StartHour"] = toJsonValue(m_startHour); + result["EndHour"] = toJsonValue(m_endHour); + return result; } + qint32 AccessSchedule::jellyfinId() const { return m_jellyfinId; } + void AccessSchedule::setJellyfinId(qint32 newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } +QUuid AccessSchedule::userId() const { return m_userId; } -QString AccessSchedule::userId() const { return m_userId; } -void AccessSchedule::setUserId(QString newUserId) { +void AccessSchedule::setUserId(QUuid newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - DynamicDayOfWeek AccessSchedule::dayOfWeek() const { return m_dayOfWeek; } + void AccessSchedule::setDayOfWeek(DynamicDayOfWeek newDayOfWeek) { m_dayOfWeek = newDayOfWeek; - emit dayOfWeekChanged(newDayOfWeek); } - double AccessSchedule::startHour() const { return m_startHour; } + void AccessSchedule::setStartHour(double newStartHour) { m_startHour = newStartHour; - emit startHourChanged(newStartHour); } - double AccessSchedule::endHour() const { return m_endHour; } + void AccessSchedule::setEndHour(double newEndHour) { m_endHour = newEndHour; - emit endHourChanged(newEndHour); } diff --git a/core/src/DTO/activitylogentry.cpp b/core/src/DTO/activitylogentry.cpp index 3d410fb..1f962c6 100644 --- a/core/src/DTO/activitylogentry.cpp +++ b/core/src/DTO/activitylogentry.cpp @@ -29,85 +29,96 @@ #include -#include - namespace Jellyfin { namespace DTO { -ActivityLogEntry::ActivityLogEntry(QObject *parent) : QObject(parent) {} +ActivityLogEntry::ActivityLogEntry(QObject *parent) {} -ActivityLogEntry *ActivityLogEntry::fromJSON(QJsonObject source, QObject *parent) { - ActivityLogEntry *instance = new ActivityLogEntry(parent); - instance->updateFromJSON(source); +ActivityLogEntry ActivityLogEntry::fromJson(QJsonObject source) {ActivityLogEntry instance; + instance->setFromJson(source, false); return instance; } -void ActivityLogEntry::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ActivityLogEntry::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_name = fromJsonValue(source["Name"]); + m_overview = fromJsonValue(source["Overview"]); + m_shortOverview = fromJsonValue(source["ShortOverview"]); + m_type = fromJsonValue(source["Type"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_date = fromJsonValue(source["Date"]); + m_userId = fromJsonValue(source["UserId"]); + m_userPrimaryImageTag = fromJsonValue(source["UserPrimaryImageTag"]); + m_severity = fromJsonValue(source["Severity"]); + } -QJsonObject ActivityLogEntry::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ActivityLogEntry::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["Name"] = toJsonValue(m_name); + result["Overview"] = toJsonValue(m_overview); + result["ShortOverview"] = toJsonValue(m_shortOverview); + result["Type"] = toJsonValue(m_type); + result["ItemId"] = toJsonValue(m_itemId); + result["Date"] = toJsonValue(m_date); + result["UserId"] = toJsonValue(m_userId); + result["UserPrimaryImageTag"] = toJsonValue(m_userPrimaryImageTag); + result["Severity"] = toJsonValue(m_severity); + return result; } + qint64 ActivityLogEntry::jellyfinId() const { return m_jellyfinId; } + void ActivityLogEntry::setJellyfinId(qint64 newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString ActivityLogEntry::name() const { return m_name; } + void ActivityLogEntry::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString ActivityLogEntry::overview() const { return m_overview; } + void ActivityLogEntry::setOverview(QString newOverview) { m_overview = newOverview; - emit overviewChanged(newOverview); } - QString ActivityLogEntry::shortOverview() const { return m_shortOverview; } + void ActivityLogEntry::setShortOverview(QString newShortOverview) { m_shortOverview = newShortOverview; - emit shortOverviewChanged(newShortOverview); } - QString ActivityLogEntry::type() const { return m_type; } + void ActivityLogEntry::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString ActivityLogEntry::itemId() const { return m_itemId; } + void ActivityLogEntry::setItemId(QString newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QDateTime ActivityLogEntry::date() const { return m_date; } + void ActivityLogEntry::setDate(QDateTime newDate) { m_date = newDate; - emit dateChanged(newDate); } +QUuid ActivityLogEntry::userId() const { return m_userId; } -QString ActivityLogEntry::userId() const { return m_userId; } -void ActivityLogEntry::setUserId(QString newUserId) { +void ActivityLogEntry::setUserId(QUuid newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - QString ActivityLogEntry::userPrimaryImageTag() const { return m_userPrimaryImageTag; } + void ActivityLogEntry::setUserPrimaryImageTag(QString newUserPrimaryImageTag) { m_userPrimaryImageTag = newUserPrimaryImageTag; - emit userPrimaryImageTagChanged(newUserPrimaryImageTag); } - LogLevel ActivityLogEntry::severity() const { return m_severity; } + void ActivityLogEntry::setSeverity(LogLevel newSeverity) { m_severity = newSeverity; - emit severityChanged(newSeverity); } diff --git a/core/src/DTO/activitylogentryqueryresult.cpp b/core/src/DTO/activitylogentryqueryresult.cpp index a77cc38..8453a2b 100644 --- a/core/src/DTO/activitylogentryqueryresult.cpp +++ b/core/src/DTO/activitylogentryqueryresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -ActivityLogEntryQueryResult::ActivityLogEntryQueryResult(QObject *parent) : QObject(parent) {} +ActivityLogEntryQueryResult::ActivityLogEntryQueryResult(QObject *parent) {} -ActivityLogEntryQueryResult *ActivityLogEntryQueryResult::fromJSON(QJsonObject source, QObject *parent) { - ActivityLogEntryQueryResult *instance = new ActivityLogEntryQueryResult(parent); - instance->updateFromJSON(source); +ActivityLogEntryQueryResult ActivityLogEntryQueryResult::fromJson(QJsonObject source) {ActivityLogEntryQueryResult instance; + instance->setFromJson(source, false); return instance; } -void ActivityLogEntryQueryResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ActivityLogEntryQueryResult::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + } -QJsonObject ActivityLogEntryQueryResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ActivityLogEntryQueryResult::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["StartIndex"] = toJsonValue(m_startIndex); + return result; } -QList ActivityLogEntryQueryResult::items() const { return m_items; } -void ActivityLogEntryQueryResult::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> ActivityLogEntryQueryResult::items() const { return m_items; } + +void ActivityLogEntryQueryResult::setItems(QList> newItems) { + m_items = newItems; +} qint32 ActivityLogEntryQueryResult::totalRecordCount() const { return m_totalRecordCount; } + void ActivityLogEntryQueryResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - qint32 ActivityLogEntryQueryResult::startIndex() const { return m_startIndex; } + void ActivityLogEntryQueryResult::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } diff --git a/core/src/DTO/addvirtualfolderdto.cpp b/core/src/DTO/addvirtualfolderdto.cpp index 37738df..af9f1df 100644 --- a/core/src/DTO/addvirtualfolderdto.cpp +++ b/core/src/DTO/addvirtualfolderdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -AddVirtualFolderDto::AddVirtualFolderDto(QObject *parent) : QObject(parent) {} +AddVirtualFolderDto::AddVirtualFolderDto(QObject *parent) {} -AddVirtualFolderDto *AddVirtualFolderDto::fromJSON(QJsonObject source, QObject *parent) { - AddVirtualFolderDto *instance = new AddVirtualFolderDto(parent); - instance->updateFromJSON(source); +AddVirtualFolderDto AddVirtualFolderDto::fromJson(QJsonObject source) {AddVirtualFolderDto instance; + instance->setFromJson(source, false); return instance; } -void AddVirtualFolderDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AddVirtualFolderDto::setFromJson(QJsonObject source) { + m_libraryOptions = fromJsonValue>(source["LibraryOptions"]); + } -QJsonObject AddVirtualFolderDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AddVirtualFolderDto::toJson() { QJsonObject result; + result["LibraryOptions"] = toJsonValue>(m_libraryOptions); + return result; } -LibraryOptions * AddVirtualFolderDto::libraryOptions() const { return m_libraryOptions; } -void AddVirtualFolderDto::setLibraryOptions(LibraryOptions * newLibraryOptions) { + +QSharedPointer AddVirtualFolderDto::libraryOptions() const { return m_libraryOptions; } + +void AddVirtualFolderDto::setLibraryOptions(QSharedPointer newLibraryOptions) { m_libraryOptions = newLibraryOptions; - emit libraryOptionsChanged(newLibraryOptions); } diff --git a/core/src/DTO/albuminfo.cpp b/core/src/DTO/albuminfo.cpp index 1728797..2c43f9e 100644 --- a/core/src/DTO/albuminfo.cpp +++ b/core/src/DTO/albuminfo.cpp @@ -32,98 +32,114 @@ namespace Jellyfin { namespace DTO { -AlbumInfo::AlbumInfo(QObject *parent) : QObject(parent) {} +AlbumInfo::AlbumInfo(QObject *parent) {} -AlbumInfo *AlbumInfo::fromJSON(QJsonObject source, QObject *parent) { - AlbumInfo *instance = new AlbumInfo(parent); - instance->updateFromJSON(source); +AlbumInfo AlbumInfo::fromJson(QJsonObject source) {AlbumInfo instance; + instance->setFromJson(source, false); return instance; } -void AlbumInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AlbumInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + m_albumArtists = fromJsonValue(source["AlbumArtists"]); + m_artistProviderIds = fromJsonValue(source["ArtistProviderIds"]); + m_songInfos = fromJsonValue>>(source["SongInfos"]); + } -QJsonObject AlbumInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AlbumInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + result["AlbumArtists"] = toJsonValue(m_albumArtists); + result["ArtistProviderIds"] = toJsonValue(m_artistProviderIds); + result["SongInfos"] = toJsonValue>>(m_songInfos); + return result; } + QString AlbumInfo::name() const { return m_name; } + void AlbumInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString AlbumInfo::path() const { return m_path; } + void AlbumInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString AlbumInfo::metadataLanguage() const { return m_metadataLanguage; } + void AlbumInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString AlbumInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void AlbumInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject AlbumInfo::providerIds() const { return m_providerIds; } + void AlbumInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 AlbumInfo::year() const { return m_year; } + void AlbumInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 AlbumInfo::indexNumber() const { return m_indexNumber; } + void AlbumInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 AlbumInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void AlbumInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime AlbumInfo::premiereDate() const { return m_premiereDate; } + void AlbumInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool AlbumInfo::isAutomated() const { return m_isAutomated; } + void AlbumInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } - QStringList AlbumInfo::albumArtists() const { return m_albumArtists; } + void AlbumInfo::setAlbumArtists(QStringList newAlbumArtists) { m_albumArtists = newAlbumArtists; - emit albumArtistsChanged(newAlbumArtists); } - QJsonObject AlbumInfo::artistProviderIds() const { return m_artistProviderIds; } + void AlbumInfo::setArtistProviderIds(QJsonObject newArtistProviderIds) { m_artistProviderIds = newArtistProviderIds; - emit artistProviderIdsChanged(newArtistProviderIds); } +QList> AlbumInfo::songInfos() const { return m_songInfos; } -QList AlbumInfo::songInfos() const { return m_songInfos; } -void AlbumInfo::setSongInfos(QList newSongInfos) { +void AlbumInfo::setSongInfos(QList> newSongInfos) { m_songInfos = newSongInfos; - emit songInfosChanged(newSongInfos); } diff --git a/core/src/DTO/albuminforemotesearchquery.cpp b/core/src/DTO/albuminforemotesearchquery.cpp index 2ba9fab..9f6d391 100644 --- a/core/src/DTO/albuminforemotesearchquery.cpp +++ b/core/src/DTO/albuminforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -AlbumInfoRemoteSearchQuery::AlbumInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +AlbumInfoRemoteSearchQuery::AlbumInfoRemoteSearchQuery(QObject *parent) {} -AlbumInfoRemoteSearchQuery *AlbumInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - AlbumInfoRemoteSearchQuery *instance = new AlbumInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +AlbumInfoRemoteSearchQuery AlbumInfoRemoteSearchQuery::fromJson(QJsonObject source) {AlbumInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void AlbumInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AlbumInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject AlbumInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AlbumInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -AlbumInfo * AlbumInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void AlbumInfoRemoteSearchQuery::setSearchInfo(AlbumInfo * newSearchInfo) { + +QSharedPointer AlbumInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void AlbumInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid AlbumInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString AlbumInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void AlbumInfoRemoteSearchQuery::setItemId(QString newItemId) { +void AlbumInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString AlbumInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void AlbumInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool AlbumInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void AlbumInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/allthememediaresult.cpp b/core/src/DTO/allthememediaresult.cpp index f2c2827..748eb23 100644 --- a/core/src/DTO/allthememediaresult.cpp +++ b/core/src/DTO/allthememediaresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -AllThemeMediaResult::AllThemeMediaResult(QObject *parent) : QObject(parent) {} +AllThemeMediaResult::AllThemeMediaResult(QObject *parent) {} -AllThemeMediaResult *AllThemeMediaResult::fromJSON(QJsonObject source, QObject *parent) { - AllThemeMediaResult *instance = new AllThemeMediaResult(parent); - instance->updateFromJSON(source); +AllThemeMediaResult AllThemeMediaResult::fromJson(QJsonObject source) {AllThemeMediaResult instance; + instance->setFromJson(source, false); return instance; } -void AllThemeMediaResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AllThemeMediaResult::setFromJson(QJsonObject source) { + m_themeVideosResult = fromJsonValue>(source["ThemeVideosResult"]); + m_themeSongsResult = fromJsonValue>(source["ThemeSongsResult"]); + m_soundtrackSongsResult = fromJsonValue>(source["SoundtrackSongsResult"]); + } -QJsonObject AllThemeMediaResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AllThemeMediaResult::toJson() { QJsonObject result; + result["ThemeVideosResult"] = toJsonValue>(m_themeVideosResult); + result["ThemeSongsResult"] = toJsonValue>(m_themeSongsResult); + result["SoundtrackSongsResult"] = toJsonValue>(m_soundtrackSongsResult); + return result; } -ThemeMediaResult * AllThemeMediaResult::themeVideosResult() const { return m_themeVideosResult; } -void AllThemeMediaResult::setThemeVideosResult(ThemeMediaResult * newThemeVideosResult) { + +QSharedPointer AllThemeMediaResult::themeVideosResult() const { return m_themeVideosResult; } + +void AllThemeMediaResult::setThemeVideosResult(QSharedPointer newThemeVideosResult) { m_themeVideosResult = newThemeVideosResult; - emit themeVideosResultChanged(newThemeVideosResult); } +QSharedPointer AllThemeMediaResult::themeSongsResult() const { return m_themeSongsResult; } -ThemeMediaResult * AllThemeMediaResult::themeSongsResult() const { return m_themeSongsResult; } -void AllThemeMediaResult::setThemeSongsResult(ThemeMediaResult * newThemeSongsResult) { +void AllThemeMediaResult::setThemeSongsResult(QSharedPointer newThemeSongsResult) { m_themeSongsResult = newThemeSongsResult; - emit themeSongsResultChanged(newThemeSongsResult); } +QSharedPointer AllThemeMediaResult::soundtrackSongsResult() const { return m_soundtrackSongsResult; } -ThemeMediaResult * AllThemeMediaResult::soundtrackSongsResult() const { return m_soundtrackSongsResult; } -void AllThemeMediaResult::setSoundtrackSongsResult(ThemeMediaResult * newSoundtrackSongsResult) { +void AllThemeMediaResult::setSoundtrackSongsResult(QSharedPointer newSoundtrackSongsResult) { m_soundtrackSongsResult = newSoundtrackSongsResult; - emit soundtrackSongsResultChanged(newSoundtrackSongsResult); } diff --git a/core/src/DTO/artistinfo.cpp b/core/src/DTO/artistinfo.cpp index 33836e8..00cdb96 100644 --- a/core/src/DTO/artistinfo.cpp +++ b/core/src/DTO/artistinfo.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -ArtistInfo::ArtistInfo(QObject *parent) : QObject(parent) {} +ArtistInfo::ArtistInfo(QObject *parent) {} -ArtistInfo *ArtistInfo::fromJSON(QJsonObject source, QObject *parent) { - ArtistInfo *instance = new ArtistInfo(parent); - instance->updateFromJSON(source); +ArtistInfo ArtistInfo::fromJson(QJsonObject source) {ArtistInfo instance; + instance->setFromJson(source, false); return instance; } -void ArtistInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ArtistInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + m_songInfos = fromJsonValue>>(source["SongInfos"]); + } -QJsonObject ArtistInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ArtistInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + result["SongInfos"] = toJsonValue>>(m_songInfos); + return result; } + QString ArtistInfo::name() const { return m_name; } + void ArtistInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString ArtistInfo::path() const { return m_path; } + void ArtistInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString ArtistInfo::metadataLanguage() const { return m_metadataLanguage; } + void ArtistInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString ArtistInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void ArtistInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject ArtistInfo::providerIds() const { return m_providerIds; } + void ArtistInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 ArtistInfo::year() const { return m_year; } + void ArtistInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 ArtistInfo::indexNumber() const { return m_indexNumber; } + void ArtistInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 ArtistInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void ArtistInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime ArtistInfo::premiereDate() const { return m_premiereDate; } + void ArtistInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool ArtistInfo::isAutomated() const { return m_isAutomated; } + void ArtistInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } +QList> ArtistInfo::songInfos() const { return m_songInfos; } -QList ArtistInfo::songInfos() const { return m_songInfos; } -void ArtistInfo::setSongInfos(QList newSongInfos) { +void ArtistInfo::setSongInfos(QList> newSongInfos) { m_songInfos = newSongInfos; - emit songInfosChanged(newSongInfos); } diff --git a/core/src/DTO/artistinforemotesearchquery.cpp b/core/src/DTO/artistinforemotesearchquery.cpp index a184f69..c86aa62 100644 --- a/core/src/DTO/artistinforemotesearchquery.cpp +++ b/core/src/DTO/artistinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -ArtistInfoRemoteSearchQuery::ArtistInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +ArtistInfoRemoteSearchQuery::ArtistInfoRemoteSearchQuery(QObject *parent) {} -ArtistInfoRemoteSearchQuery *ArtistInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - ArtistInfoRemoteSearchQuery *instance = new ArtistInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +ArtistInfoRemoteSearchQuery ArtistInfoRemoteSearchQuery::fromJson(QJsonObject source) {ArtistInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void ArtistInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ArtistInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject ArtistInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ArtistInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -ArtistInfo * ArtistInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void ArtistInfoRemoteSearchQuery::setSearchInfo(ArtistInfo * newSearchInfo) { + +QSharedPointer ArtistInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void ArtistInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid ArtistInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString ArtistInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void ArtistInfoRemoteSearchQuery::setItemId(QString newItemId) { +void ArtistInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString ArtistInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void ArtistInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool ArtistInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void ArtistInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/authenticateuserbyname.cpp b/core/src/DTO/authenticateuserbyname.cpp index 7a949ce..89dbb06 100644 --- a/core/src/DTO/authenticateuserbyname.cpp +++ b/core/src/DTO/authenticateuserbyname.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -AuthenticateUserByName::AuthenticateUserByName(QObject *parent) : QObject(parent) {} +AuthenticateUserByName::AuthenticateUserByName(QObject *parent) {} -AuthenticateUserByName *AuthenticateUserByName::fromJSON(QJsonObject source, QObject *parent) { - AuthenticateUserByName *instance = new AuthenticateUserByName(parent); - instance->updateFromJSON(source); +AuthenticateUserByName AuthenticateUserByName::fromJson(QJsonObject source) {AuthenticateUserByName instance; + instance->setFromJson(source, false); return instance; } -void AuthenticateUserByName::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AuthenticateUserByName::setFromJson(QJsonObject source) { + m_username = fromJsonValue(source["Username"]); + m_pw = fromJsonValue(source["Pw"]); + m_password = fromJsonValue(source["Password"]); + } -QJsonObject AuthenticateUserByName::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AuthenticateUserByName::toJson() { QJsonObject result; + result["Username"] = toJsonValue(m_username); + result["Pw"] = toJsonValue(m_pw); + result["Password"] = toJsonValue(m_password); + return result; } + QString AuthenticateUserByName::username() const { return m_username; } + void AuthenticateUserByName::setUsername(QString newUsername) { m_username = newUsername; - emit usernameChanged(newUsername); } - QString AuthenticateUserByName::pw() const { return m_pw; } + void AuthenticateUserByName::setPw(QString newPw) { m_pw = newPw; - emit pwChanged(newPw); } - QString AuthenticateUserByName::password() const { return m_password; } + void AuthenticateUserByName::setPassword(QString newPassword) { m_password = newPassword; - emit passwordChanged(newPassword); } diff --git a/core/src/DTO/authenticationinfo.cpp b/core/src/DTO/authenticationinfo.cpp index 0ec1609..0ea7234 100644 --- a/core/src/DTO/authenticationinfo.cpp +++ b/core/src/DTO/authenticationinfo.cpp @@ -32,92 +32,107 @@ namespace Jellyfin { namespace DTO { -AuthenticationInfo::AuthenticationInfo(QObject *parent) : QObject(parent) {} +AuthenticationInfo::AuthenticationInfo(QObject *parent) {} -AuthenticationInfo *AuthenticationInfo::fromJSON(QJsonObject source, QObject *parent) { - AuthenticationInfo *instance = new AuthenticationInfo(parent); - instance->updateFromJSON(source); +AuthenticationInfo AuthenticationInfo::fromJson(QJsonObject source) {AuthenticationInfo instance; + instance->setFromJson(source, false); return instance; } -void AuthenticationInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AuthenticationInfo::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_accessToken = fromJsonValue(source["AccessToken"]); + m_deviceId = fromJsonValue(source["DeviceId"]); + m_appName = fromJsonValue(source["AppName"]); + m_appVersion = fromJsonValue(source["AppVersion"]); + m_deviceName = fromJsonValue(source["DeviceName"]); + m_userId = fromJsonValue(source["UserId"]); + m_isActive = fromJsonValue(source["IsActive"]); + m_dateCreated = fromJsonValue(source["DateCreated"]); + m_dateRevoked = fromJsonValue(source["DateRevoked"]); + m_dateLastActivity = fromJsonValue(source["DateLastActivity"]); + m_userName = fromJsonValue(source["UserName"]); + } -QJsonObject AuthenticationInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AuthenticationInfo::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["AccessToken"] = toJsonValue(m_accessToken); + result["DeviceId"] = toJsonValue(m_deviceId); + result["AppName"] = toJsonValue(m_appName); + result["AppVersion"] = toJsonValue(m_appVersion); + result["DeviceName"] = toJsonValue(m_deviceName); + result["UserId"] = toJsonValue(m_userId); + result["IsActive"] = toJsonValue(m_isActive); + result["DateCreated"] = toJsonValue(m_dateCreated); + result["DateRevoked"] = toJsonValue(m_dateRevoked); + result["DateLastActivity"] = toJsonValue(m_dateLastActivity); + result["UserName"] = toJsonValue(m_userName); + return result; } + qint64 AuthenticationInfo::jellyfinId() const { return m_jellyfinId; } + void AuthenticationInfo::setJellyfinId(qint64 newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString AuthenticationInfo::accessToken() const { return m_accessToken; } + void AuthenticationInfo::setAccessToken(QString newAccessToken) { m_accessToken = newAccessToken; - emit accessTokenChanged(newAccessToken); } - QString AuthenticationInfo::deviceId() const { return m_deviceId; } + void AuthenticationInfo::setDeviceId(QString newDeviceId) { m_deviceId = newDeviceId; - emit deviceIdChanged(newDeviceId); } - QString AuthenticationInfo::appName() const { return m_appName; } + void AuthenticationInfo::setAppName(QString newAppName) { m_appName = newAppName; - emit appNameChanged(newAppName); } - QString AuthenticationInfo::appVersion() const { return m_appVersion; } + void AuthenticationInfo::setAppVersion(QString newAppVersion) { m_appVersion = newAppVersion; - emit appVersionChanged(newAppVersion); } - QString AuthenticationInfo::deviceName() const { return m_deviceName; } + void AuthenticationInfo::setDeviceName(QString newDeviceName) { m_deviceName = newDeviceName; - emit deviceNameChanged(newDeviceName); } +QUuid AuthenticationInfo::userId() const { return m_userId; } -QString AuthenticationInfo::userId() const { return m_userId; } -void AuthenticationInfo::setUserId(QString newUserId) { +void AuthenticationInfo::setUserId(QUuid newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - bool AuthenticationInfo::isActive() const { return m_isActive; } + void AuthenticationInfo::setIsActive(bool newIsActive) { m_isActive = newIsActive; - emit isActiveChanged(newIsActive); } - QDateTime AuthenticationInfo::dateCreated() const { return m_dateCreated; } + void AuthenticationInfo::setDateCreated(QDateTime newDateCreated) { m_dateCreated = newDateCreated; - emit dateCreatedChanged(newDateCreated); } - QDateTime AuthenticationInfo::dateRevoked() const { return m_dateRevoked; } + void AuthenticationInfo::setDateRevoked(QDateTime newDateRevoked) { m_dateRevoked = newDateRevoked; - emit dateRevokedChanged(newDateRevoked); } - QDateTime AuthenticationInfo::dateLastActivity() const { return m_dateLastActivity; } + void AuthenticationInfo::setDateLastActivity(QDateTime newDateLastActivity) { m_dateLastActivity = newDateLastActivity; - emit dateLastActivityChanged(newDateLastActivity); } - QString AuthenticationInfo::userName() const { return m_userName; } + void AuthenticationInfo::setUserName(QString newUserName) { m_userName = newUserName; - emit userNameChanged(newUserName); } diff --git a/core/src/DTO/authenticationinfoqueryresult.cpp b/core/src/DTO/authenticationinfoqueryresult.cpp index 6fec163..c0dd616 100644 --- a/core/src/DTO/authenticationinfoqueryresult.cpp +++ b/core/src/DTO/authenticationinfoqueryresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -AuthenticationInfoQueryResult::AuthenticationInfoQueryResult(QObject *parent) : QObject(parent) {} +AuthenticationInfoQueryResult::AuthenticationInfoQueryResult(QObject *parent) {} -AuthenticationInfoQueryResult *AuthenticationInfoQueryResult::fromJSON(QJsonObject source, QObject *parent) { - AuthenticationInfoQueryResult *instance = new AuthenticationInfoQueryResult(parent); - instance->updateFromJSON(source); +AuthenticationInfoQueryResult AuthenticationInfoQueryResult::fromJson(QJsonObject source) {AuthenticationInfoQueryResult instance; + instance->setFromJson(source, false); return instance; } -void AuthenticationInfoQueryResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AuthenticationInfoQueryResult::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + } -QJsonObject AuthenticationInfoQueryResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AuthenticationInfoQueryResult::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["StartIndex"] = toJsonValue(m_startIndex); + return result; } -QList AuthenticationInfoQueryResult::items() const { return m_items; } -void AuthenticationInfoQueryResult::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> AuthenticationInfoQueryResult::items() const { return m_items; } + +void AuthenticationInfoQueryResult::setItems(QList> newItems) { + m_items = newItems; +} qint32 AuthenticationInfoQueryResult::totalRecordCount() const { return m_totalRecordCount; } + void AuthenticationInfoQueryResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - qint32 AuthenticationInfoQueryResult::startIndex() const { return m_startIndex; } + void AuthenticationInfoQueryResult::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } diff --git a/core/src/DTO/authenticationresult.cpp b/core/src/DTO/authenticationresult.cpp index d5496cb..efbeaf2 100644 --- a/core/src/DTO/authenticationresult.cpp +++ b/core/src/DTO/authenticationresult.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -AuthenticationResult::AuthenticationResult(QObject *parent) : QObject(parent) {} +AuthenticationResult::AuthenticationResult(QObject *parent) {} -AuthenticationResult *AuthenticationResult::fromJSON(QJsonObject source, QObject *parent) { - AuthenticationResult *instance = new AuthenticationResult(parent); - instance->updateFromJSON(source); +AuthenticationResult AuthenticationResult::fromJson(QJsonObject source) {AuthenticationResult instance; + instance->setFromJson(source, false); return instance; } -void AuthenticationResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void AuthenticationResult::setFromJson(QJsonObject source) { + m_user = fromJsonValue>(source["User"]); + m_sessionInfo = fromJsonValue>(source["SessionInfo"]); + m_accessToken = fromJsonValue(source["AccessToken"]); + m_serverId = fromJsonValue(source["ServerId"]); + } -QJsonObject AuthenticationResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject AuthenticationResult::toJson() { QJsonObject result; + result["User"] = toJsonValue>(m_user); + result["SessionInfo"] = toJsonValue>(m_sessionInfo); + result["AccessToken"] = toJsonValue(m_accessToken); + result["ServerId"] = toJsonValue(m_serverId); + return result; } -UserDto * AuthenticationResult::user() const { return m_user; } -void AuthenticationResult::setUser(UserDto * newUser) { + +QSharedPointer AuthenticationResult::user() const { return m_user; } + +void AuthenticationResult::setUser(QSharedPointer newUser) { m_user = newUser; - emit userChanged(newUser); } +QSharedPointer AuthenticationResult::sessionInfo() const { return m_sessionInfo; } -SessionInfo * AuthenticationResult::sessionInfo() const { return m_sessionInfo; } -void AuthenticationResult::setSessionInfo(SessionInfo * newSessionInfo) { +void AuthenticationResult::setSessionInfo(QSharedPointer newSessionInfo) { m_sessionInfo = newSessionInfo; - emit sessionInfoChanged(newSessionInfo); } - QString AuthenticationResult::accessToken() const { return m_accessToken; } + void AuthenticationResult::setAccessToken(QString newAccessToken) { m_accessToken = newAccessToken; - emit accessTokenChanged(newAccessToken); } - QString AuthenticationResult::serverId() const { return m_serverId; } + void AuthenticationResult::setServerId(QString newServerId) { m_serverId = newServerId; - emit serverIdChanged(newServerId); } diff --git a/core/src/DTO/baseitem.cpp b/core/src/DTO/baseitem.cpp index 9b04ca3..4aca154 100644 --- a/core/src/DTO/baseitem.cpp +++ b/core/src/DTO/baseitem.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -BaseItem::BaseItem(QObject *parent) : QObject(parent) {} +BaseItem::BaseItem(QObject *parent) {} -BaseItem *BaseItem::fromJSON(QJsonObject source, QObject *parent) { - BaseItem *instance = new BaseItem(parent); - instance->updateFromJSON(source); +BaseItem BaseItem::fromJson(QJsonObject source) {BaseItem instance; + instance->setFromJson(source, false); return instance; } -void BaseItem::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BaseItem::setFromJson(QJsonObject source) { + m_size = fromJsonValue(source["Size"]); + m_container = fromJsonValue(source["Container"]); + m_dateLastSaved = fromJsonValue(source["DateLastSaved"]); + m_remoteTrailers = fromJsonValue>>(source["RemoteTrailers"]); + m_isHD = fromJsonValue(source["IsHD"]); + m_isShortcut = fromJsonValue(source["IsShortcut"]); + m_shortcutPath = fromJsonValue(source["ShortcutPath"]); + m_width = fromJsonValue(source["Width"]); + m_height = fromJsonValue(source["Height"]); + m_extraIds = fromJsonValue>(source["ExtraIds"]); + m_supportsExternalTransfer = fromJsonValue(source["SupportsExternalTransfer"]); + } -QJsonObject BaseItem::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BaseItem::toJson() { QJsonObject result; + result["Size"] = toJsonValue(m_size); + result["Container"] = toJsonValue(m_container); + result["DateLastSaved"] = toJsonValue(m_dateLastSaved); + result["RemoteTrailers"] = toJsonValue>>(m_remoteTrailers); + result["IsHD"] = toJsonValue(m_isHD); + result["IsShortcut"] = toJsonValue(m_isShortcut); + result["ShortcutPath"] = toJsonValue(m_shortcutPath); + result["Width"] = toJsonValue(m_width); + result["Height"] = toJsonValue(m_height); + result["ExtraIds"] = toJsonValue>(m_extraIds); + result["SupportsExternalTransfer"] = toJsonValue(m_supportsExternalTransfer); + return result; } + qint64 BaseItem::size() const { return m_size; } + void BaseItem::setSize(qint64 newSize) { m_size = newSize; - emit sizeChanged(newSize); } - QString BaseItem::container() const { return m_container; } + void BaseItem::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } - QDateTime BaseItem::dateLastSaved() const { return m_dateLastSaved; } + void BaseItem::setDateLastSaved(QDateTime newDateLastSaved) { m_dateLastSaved = newDateLastSaved; - emit dateLastSavedChanged(newDateLastSaved); } +QList> BaseItem::remoteTrailers() const { return m_remoteTrailers; } -QList BaseItem::remoteTrailers() const { return m_remoteTrailers; } -void BaseItem::setRemoteTrailers(QList newRemoteTrailers) { +void BaseItem::setRemoteTrailers(QList> newRemoteTrailers) { m_remoteTrailers = newRemoteTrailers; - emit remoteTrailersChanged(newRemoteTrailers); } - bool BaseItem::isHD() const { return m_isHD; } + void BaseItem::setIsHD(bool newIsHD) { m_isHD = newIsHD; - emit isHDChanged(newIsHD); } - bool BaseItem::isShortcut() const { return m_isShortcut; } + void BaseItem::setIsShortcut(bool newIsShortcut) { m_isShortcut = newIsShortcut; - emit isShortcutChanged(newIsShortcut); } - QString BaseItem::shortcutPath() const { return m_shortcutPath; } + void BaseItem::setShortcutPath(QString newShortcutPath) { m_shortcutPath = newShortcutPath; - emit shortcutPathChanged(newShortcutPath); } - qint32 BaseItem::width() const { return m_width; } + void BaseItem::setWidth(qint32 newWidth) { m_width = newWidth; - emit widthChanged(newWidth); } - qint32 BaseItem::height() const { return m_height; } + void BaseItem::setHeight(qint32 newHeight) { m_height = newHeight; - emit heightChanged(newHeight); } +QList BaseItem::extraIds() const { return m_extraIds; } -QStringList BaseItem::extraIds() const { return m_extraIds; } -void BaseItem::setExtraIds(QStringList newExtraIds) { +void BaseItem::setExtraIds(QList newExtraIds) { m_extraIds = newExtraIds; - emit extraIdsChanged(newExtraIds); } - bool BaseItem::supportsExternalTransfer() const { return m_supportsExternalTransfer; } + void BaseItem::setSupportsExternalTransfer(bool newSupportsExternalTransfer) { m_supportsExternalTransfer = newSupportsExternalTransfer; - emit supportsExternalTransferChanged(newSupportsExternalTransfer); } diff --git a/core/src/DTO/baseitemdto.cpp b/core/src/DTO/baseitemdto.cpp index d983147..fbe185c 100644 --- a/core/src/DTO/baseitemdto.cpp +++ b/core/src/DTO/baseitemdto.cpp @@ -29,940 +29,1083 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - namespace Jellyfin { namespace DTO { -BaseItemDto::BaseItemDto(QObject *parent) : QObject(parent) {} +BaseItemDto::BaseItemDto(QObject *parent) {} -BaseItemDto *BaseItemDto::fromJSON(QJsonObject source, QObject *parent) { - BaseItemDto *instance = new BaseItemDto(parent); - instance->updateFromJSON(source); +BaseItemDto BaseItemDto::fromJson(QJsonObject source) {BaseItemDto instance; + instance->setFromJson(source, false); return instance; } -void BaseItemDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BaseItemDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_originalTitle = fromJsonValue(source["OriginalTitle"]); + m_serverId = fromJsonValue(source["ServerId"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_etag = fromJsonValue(source["Etag"]); + m_sourceType = fromJsonValue(source["SourceType"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + m_dateCreated = fromJsonValue(source["DateCreated"]); + m_dateLastMediaAdded = fromJsonValue(source["DateLastMediaAdded"]); + m_extraType = fromJsonValue(source["ExtraType"]); + m_airsBeforeSeasonNumber = fromJsonValue(source["AirsBeforeSeasonNumber"]); + m_airsAfterSeasonNumber = fromJsonValue(source["AirsAfterSeasonNumber"]); + m_airsBeforeEpisodeNumber = fromJsonValue(source["AirsBeforeEpisodeNumber"]); + m_canDelete = fromJsonValue(source["CanDelete"]); + m_canDownload = fromJsonValue(source["CanDownload"]); + m_hasSubtitles = fromJsonValue(source["HasSubtitles"]); + m_preferredMetadataLanguage = fromJsonValue(source["PreferredMetadataLanguage"]); + m_preferredMetadataCountryCode = fromJsonValue(source["PreferredMetadataCountryCode"]); + m_supportsSync = fromJsonValue(source["SupportsSync"]); + m_container = fromJsonValue(source["Container"]); + m_sortName = fromJsonValue(source["SortName"]); + m_forcedSortName = fromJsonValue(source["ForcedSortName"]); + m_video3DFormat = fromJsonValue(source["Video3DFormat"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_externalUrls = fromJsonValue>>(source["ExternalUrls"]); + m_mediaSources = fromJsonValue>>(source["MediaSources"]); + m_criticRating = fromJsonValue(source["CriticRating"]); + m_productionLocations = fromJsonValue(source["ProductionLocations"]); + m_path = fromJsonValue(source["Path"]); + m_enableMediaSourceDisplay = fromJsonValue(source["EnableMediaSourceDisplay"]); + m_officialRating = fromJsonValue(source["OfficialRating"]); + m_customRating = fromJsonValue(source["CustomRating"]); + m_channelId = fromJsonValue(source["ChannelId"]); + m_channelName = fromJsonValue(source["ChannelName"]); + m_overview = fromJsonValue(source["Overview"]); + m_taglines = fromJsonValue(source["Taglines"]); + m_genres = fromJsonValue(source["Genres"]); + m_communityRating = fromJsonValue(source["CommunityRating"]); + m_cumulativeRunTimeTicks = fromJsonValue(source["CumulativeRunTimeTicks"]); + m_runTimeTicks = fromJsonValue(source["RunTimeTicks"]); + m_playAccess = fromJsonValue(source["PlayAccess"]); + m_aspectRatio = fromJsonValue(source["AspectRatio"]); + m_productionYear = fromJsonValue(source["ProductionYear"]); + m_isPlaceHolder = fromJsonValue(source["IsPlaceHolder"]); + m_number = fromJsonValue(source["Number"]); + m_channelNumber = fromJsonValue(source["ChannelNumber"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_indexNumberEnd = fromJsonValue(source["IndexNumberEnd"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_remoteTrailers = fromJsonValue>>(source["RemoteTrailers"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_isHD = fromJsonValue(source["IsHD"]); + m_isFolder = fromJsonValue(source["IsFolder"]); + m_parentId = fromJsonValue(source["ParentId"]); + m_type = fromJsonValue(source["Type"]); + m_people = fromJsonValue>>(source["People"]); + m_studios = fromJsonValue>>(source["Studios"]); + m_genreItems = fromJsonValue>>(source["GenreItems"]); + m_parentLogoItemId = fromJsonValue(source["ParentLogoItemId"]); + m_parentBackdropItemId = fromJsonValue(source["ParentBackdropItemId"]); + m_parentBackdropImageTags = fromJsonValue(source["ParentBackdropImageTags"]); + m_localTrailerCount = fromJsonValue(source["LocalTrailerCount"]); + m_userData = fromJsonValue>(source["UserData"]); + m_recursiveItemCount = fromJsonValue(source["RecursiveItemCount"]); + m_childCount = fromJsonValue(source["ChildCount"]); + m_seriesName = fromJsonValue(source["SeriesName"]); + m_seriesId = fromJsonValue(source["SeriesId"]); + m_seasonId = fromJsonValue(source["SeasonId"]); + m_specialFeatureCount = fromJsonValue(source["SpecialFeatureCount"]); + m_displayPreferencesId = fromJsonValue(source["DisplayPreferencesId"]); + m_status = fromJsonValue(source["Status"]); + m_airTime = fromJsonValue(source["AirTime"]); + m_airDays = fromJsonValue>(source["AirDays"]); + m_tags = fromJsonValue(source["Tags"]); + m_primaryImageAspectRatio = fromJsonValue(source["PrimaryImageAspectRatio"]); + m_artists = fromJsonValue(source["Artists"]); + m_artistItems = fromJsonValue>>(source["ArtistItems"]); + m_album = fromJsonValue(source["Album"]); + m_collectionType = fromJsonValue(source["CollectionType"]); + m_displayOrder = fromJsonValue(source["DisplayOrder"]); + m_albumId = fromJsonValue(source["AlbumId"]); + m_albumPrimaryImageTag = fromJsonValue(source["AlbumPrimaryImageTag"]); + m_seriesPrimaryImageTag = fromJsonValue(source["SeriesPrimaryImageTag"]); + m_albumArtist = fromJsonValue(source["AlbumArtist"]); + m_albumArtists = fromJsonValue>>(source["AlbumArtists"]); + m_seasonName = fromJsonValue(source["SeasonName"]); + m_mediaStreams = fromJsonValue>>(source["MediaStreams"]); + m_videoType = fromJsonValue(source["VideoType"]); + m_partCount = fromJsonValue(source["PartCount"]); + m_mediaSourceCount = fromJsonValue(source["MediaSourceCount"]); + m_imageTags = fromJsonValue(source["ImageTags"]); + m_backdropImageTags = fromJsonValue(source["BackdropImageTags"]); + m_screenshotImageTags = fromJsonValue(source["ScreenshotImageTags"]); + m_parentLogoImageTag = fromJsonValue(source["ParentLogoImageTag"]); + m_parentArtItemId = fromJsonValue(source["ParentArtItemId"]); + m_parentArtImageTag = fromJsonValue(source["ParentArtImageTag"]); + m_seriesThumbImageTag = fromJsonValue(source["SeriesThumbImageTag"]); + m_imageBlurHashes = fromJsonValue(source["ImageBlurHashes"]); + m_seriesStudio = fromJsonValue(source["SeriesStudio"]); + m_parentThumbItemId = fromJsonValue(source["ParentThumbItemId"]); + m_parentThumbImageTag = fromJsonValue(source["ParentThumbImageTag"]); + m_parentPrimaryImageItemId = fromJsonValue(source["ParentPrimaryImageItemId"]); + m_parentPrimaryImageTag = fromJsonValue(source["ParentPrimaryImageTag"]); + m_chapters = fromJsonValue>>(source["Chapters"]); + m_locationType = fromJsonValue(source["LocationType"]); + m_isoType = fromJsonValue(source["IsoType"]); + m_mediaType = fromJsonValue(source["MediaType"]); + m_endDate = fromJsonValue(source["EndDate"]); + m_lockedFields = fromJsonValue>(source["LockedFields"]); + m_trailerCount = fromJsonValue(source["TrailerCount"]); + m_movieCount = fromJsonValue(source["MovieCount"]); + m_seriesCount = fromJsonValue(source["SeriesCount"]); + m_programCount = fromJsonValue(source["ProgramCount"]); + m_episodeCount = fromJsonValue(source["EpisodeCount"]); + m_songCount = fromJsonValue(source["SongCount"]); + m_albumCount = fromJsonValue(source["AlbumCount"]); + m_artistCount = fromJsonValue(source["ArtistCount"]); + m_musicVideoCount = fromJsonValue(source["MusicVideoCount"]); + m_lockData = fromJsonValue(source["LockData"]); + m_width = fromJsonValue(source["Width"]); + m_height = fromJsonValue(source["Height"]); + m_cameraMake = fromJsonValue(source["CameraMake"]); + m_cameraModel = fromJsonValue(source["CameraModel"]); + m_software = fromJsonValue(source["Software"]); + m_exposureTime = fromJsonValue(source["ExposureTime"]); + m_focalLength = fromJsonValue(source["FocalLength"]); + m_imageOrientation = fromJsonValue(source["ImageOrientation"]); + m_aperture = fromJsonValue(source["Aperture"]); + m_shutterSpeed = fromJsonValue(source["ShutterSpeed"]); + m_latitude = fromJsonValue(source["Latitude"]); + m_longitude = fromJsonValue(source["Longitude"]); + m_altitude = fromJsonValue(source["Altitude"]); + m_isoSpeedRating = fromJsonValue(source["IsoSpeedRating"]); + m_seriesTimerId = fromJsonValue(source["SeriesTimerId"]); + m_programId = fromJsonValue(source["ProgramId"]); + m_channelPrimaryImageTag = fromJsonValue(source["ChannelPrimaryImageTag"]); + m_startDate = fromJsonValue(source["StartDate"]); + m_completionPercentage = fromJsonValue(source["CompletionPercentage"]); + m_isRepeat = fromJsonValue(source["IsRepeat"]); + m_episodeTitle = fromJsonValue(source["EpisodeTitle"]); + m_channelType = fromJsonValue(source["ChannelType"]); + m_audio = fromJsonValue(source["Audio"]); + m_isMovie = fromJsonValue(source["IsMovie"]); + m_isSports = fromJsonValue(source["IsSports"]); + m_isSeries = fromJsonValue(source["IsSeries"]); + m_isLive = fromJsonValue(source["IsLive"]); + m_isNews = fromJsonValue(source["IsNews"]); + m_isKids = fromJsonValue(source["IsKids"]); + m_isPremiere = fromJsonValue(source["IsPremiere"]); + m_timerId = fromJsonValue(source["TimerId"]); + m_currentProgram = fromJsonValue>(source["CurrentProgram"]); + } -QJsonObject BaseItemDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BaseItemDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["OriginalTitle"] = toJsonValue(m_originalTitle); + result["ServerId"] = toJsonValue(m_serverId); + result["Id"] = toJsonValue(m_jellyfinId); + result["Etag"] = toJsonValue(m_etag); + result["SourceType"] = toJsonValue(m_sourceType); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + result["DateCreated"] = toJsonValue(m_dateCreated); + result["DateLastMediaAdded"] = toJsonValue(m_dateLastMediaAdded); + result["ExtraType"] = toJsonValue(m_extraType); + result["AirsBeforeSeasonNumber"] = toJsonValue(m_airsBeforeSeasonNumber); + result["AirsAfterSeasonNumber"] = toJsonValue(m_airsAfterSeasonNumber); + result["AirsBeforeEpisodeNumber"] = toJsonValue(m_airsBeforeEpisodeNumber); + result["CanDelete"] = toJsonValue(m_canDelete); + result["CanDownload"] = toJsonValue(m_canDownload); + result["HasSubtitles"] = toJsonValue(m_hasSubtitles); + result["PreferredMetadataLanguage"] = toJsonValue(m_preferredMetadataLanguage); + result["PreferredMetadataCountryCode"] = toJsonValue(m_preferredMetadataCountryCode); + result["SupportsSync"] = toJsonValue(m_supportsSync); + result["Container"] = toJsonValue(m_container); + result["SortName"] = toJsonValue(m_sortName); + result["ForcedSortName"] = toJsonValue(m_forcedSortName); + result["Video3DFormat"] = toJsonValue(m_video3DFormat); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["ExternalUrls"] = toJsonValue>>(m_externalUrls); + result["MediaSources"] = toJsonValue>>(m_mediaSources); + result["CriticRating"] = toJsonValue(m_criticRating); + result["ProductionLocations"] = toJsonValue(m_productionLocations); + result["Path"] = toJsonValue(m_path); + result["EnableMediaSourceDisplay"] = toJsonValue(m_enableMediaSourceDisplay); + result["OfficialRating"] = toJsonValue(m_officialRating); + result["CustomRating"] = toJsonValue(m_customRating); + result["ChannelId"] = toJsonValue(m_channelId); + result["ChannelName"] = toJsonValue(m_channelName); + result["Overview"] = toJsonValue(m_overview); + result["Taglines"] = toJsonValue(m_taglines); + result["Genres"] = toJsonValue(m_genres); + result["CommunityRating"] = toJsonValue(m_communityRating); + result["CumulativeRunTimeTicks"] = toJsonValue(m_cumulativeRunTimeTicks); + result["RunTimeTicks"] = toJsonValue(m_runTimeTicks); + result["PlayAccess"] = toJsonValue(m_playAccess); + result["AspectRatio"] = toJsonValue(m_aspectRatio); + result["ProductionYear"] = toJsonValue(m_productionYear); + result["IsPlaceHolder"] = toJsonValue(m_isPlaceHolder); + result["Number"] = toJsonValue(m_number); + result["ChannelNumber"] = toJsonValue(m_channelNumber); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["IndexNumberEnd"] = toJsonValue(m_indexNumberEnd); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["RemoteTrailers"] = toJsonValue>>(m_remoteTrailers); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["IsHD"] = toJsonValue(m_isHD); + result["IsFolder"] = toJsonValue(m_isFolder); + result["ParentId"] = toJsonValue(m_parentId); + result["Type"] = toJsonValue(m_type); + result["People"] = toJsonValue>>(m_people); + result["Studios"] = toJsonValue>>(m_studios); + result["GenreItems"] = toJsonValue>>(m_genreItems); + result["ParentLogoItemId"] = toJsonValue(m_parentLogoItemId); + result["ParentBackdropItemId"] = toJsonValue(m_parentBackdropItemId); + result["ParentBackdropImageTags"] = toJsonValue(m_parentBackdropImageTags); + result["LocalTrailerCount"] = toJsonValue(m_localTrailerCount); + result["UserData"] = toJsonValue>(m_userData); + result["RecursiveItemCount"] = toJsonValue(m_recursiveItemCount); + result["ChildCount"] = toJsonValue(m_childCount); + result["SeriesName"] = toJsonValue(m_seriesName); + result["SeriesId"] = toJsonValue(m_seriesId); + result["SeasonId"] = toJsonValue(m_seasonId); + result["SpecialFeatureCount"] = toJsonValue(m_specialFeatureCount); + result["DisplayPreferencesId"] = toJsonValue(m_displayPreferencesId); + result["Status"] = toJsonValue(m_status); + result["AirTime"] = toJsonValue(m_airTime); + result["AirDays"] = toJsonValue>(m_airDays); + result["Tags"] = toJsonValue(m_tags); + result["PrimaryImageAspectRatio"] = toJsonValue(m_primaryImageAspectRatio); + result["Artists"] = toJsonValue(m_artists); + result["ArtistItems"] = toJsonValue>>(m_artistItems); + result["Album"] = toJsonValue(m_album); + result["CollectionType"] = toJsonValue(m_collectionType); + result["DisplayOrder"] = toJsonValue(m_displayOrder); + result["AlbumId"] = toJsonValue(m_albumId); + result["AlbumPrimaryImageTag"] = toJsonValue(m_albumPrimaryImageTag); + result["SeriesPrimaryImageTag"] = toJsonValue(m_seriesPrimaryImageTag); + result["AlbumArtist"] = toJsonValue(m_albumArtist); + result["AlbumArtists"] = toJsonValue>>(m_albumArtists); + result["SeasonName"] = toJsonValue(m_seasonName); + result["MediaStreams"] = toJsonValue>>(m_mediaStreams); + result["VideoType"] = toJsonValue(m_videoType); + result["PartCount"] = toJsonValue(m_partCount); + result["MediaSourceCount"] = toJsonValue(m_mediaSourceCount); + result["ImageTags"] = toJsonValue(m_imageTags); + result["BackdropImageTags"] = toJsonValue(m_backdropImageTags); + result["ScreenshotImageTags"] = toJsonValue(m_screenshotImageTags); + result["ParentLogoImageTag"] = toJsonValue(m_parentLogoImageTag); + result["ParentArtItemId"] = toJsonValue(m_parentArtItemId); + result["ParentArtImageTag"] = toJsonValue(m_parentArtImageTag); + result["SeriesThumbImageTag"] = toJsonValue(m_seriesThumbImageTag); + result["ImageBlurHashes"] = toJsonValue(m_imageBlurHashes); + result["SeriesStudio"] = toJsonValue(m_seriesStudio); + result["ParentThumbItemId"] = toJsonValue(m_parentThumbItemId); + result["ParentThumbImageTag"] = toJsonValue(m_parentThumbImageTag); + result["ParentPrimaryImageItemId"] = toJsonValue(m_parentPrimaryImageItemId); + result["ParentPrimaryImageTag"] = toJsonValue(m_parentPrimaryImageTag); + result["Chapters"] = toJsonValue>>(m_chapters); + result["LocationType"] = toJsonValue(m_locationType); + result["IsoType"] = toJsonValue(m_isoType); + result["MediaType"] = toJsonValue(m_mediaType); + result["EndDate"] = toJsonValue(m_endDate); + result["LockedFields"] = toJsonValue>(m_lockedFields); + result["TrailerCount"] = toJsonValue(m_trailerCount); + result["MovieCount"] = toJsonValue(m_movieCount); + result["SeriesCount"] = toJsonValue(m_seriesCount); + result["ProgramCount"] = toJsonValue(m_programCount); + result["EpisodeCount"] = toJsonValue(m_episodeCount); + result["SongCount"] = toJsonValue(m_songCount); + result["AlbumCount"] = toJsonValue(m_albumCount); + result["ArtistCount"] = toJsonValue(m_artistCount); + result["MusicVideoCount"] = toJsonValue(m_musicVideoCount); + result["LockData"] = toJsonValue(m_lockData); + result["Width"] = toJsonValue(m_width); + result["Height"] = toJsonValue(m_height); + result["CameraMake"] = toJsonValue(m_cameraMake); + result["CameraModel"] = toJsonValue(m_cameraModel); + result["Software"] = toJsonValue(m_software); + result["ExposureTime"] = toJsonValue(m_exposureTime); + result["FocalLength"] = toJsonValue(m_focalLength); + result["ImageOrientation"] = toJsonValue(m_imageOrientation); + result["Aperture"] = toJsonValue(m_aperture); + result["ShutterSpeed"] = toJsonValue(m_shutterSpeed); + result["Latitude"] = toJsonValue(m_latitude); + result["Longitude"] = toJsonValue(m_longitude); + result["Altitude"] = toJsonValue(m_altitude); + result["IsoSpeedRating"] = toJsonValue(m_isoSpeedRating); + result["SeriesTimerId"] = toJsonValue(m_seriesTimerId); + result["ProgramId"] = toJsonValue(m_programId); + result["ChannelPrimaryImageTag"] = toJsonValue(m_channelPrimaryImageTag); + result["StartDate"] = toJsonValue(m_startDate); + result["CompletionPercentage"] = toJsonValue(m_completionPercentage); + result["IsRepeat"] = toJsonValue(m_isRepeat); + result["EpisodeTitle"] = toJsonValue(m_episodeTitle); + result["ChannelType"] = toJsonValue(m_channelType); + result["Audio"] = toJsonValue(m_audio); + result["IsMovie"] = toJsonValue(m_isMovie); + result["IsSports"] = toJsonValue(m_isSports); + result["IsSeries"] = toJsonValue(m_isSeries); + result["IsLive"] = toJsonValue(m_isLive); + result["IsNews"] = toJsonValue(m_isNews); + result["IsKids"] = toJsonValue(m_isKids); + result["IsPremiere"] = toJsonValue(m_isPremiere); + result["TimerId"] = toJsonValue(m_timerId); + result["CurrentProgram"] = toJsonValue>(m_currentProgram); + return result; } + QString BaseItemDto::name() const { return m_name; } + void BaseItemDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString BaseItemDto::originalTitle() const { return m_originalTitle; } + void BaseItemDto::setOriginalTitle(QString newOriginalTitle) { m_originalTitle = newOriginalTitle; - emit originalTitleChanged(newOriginalTitle); } - QString BaseItemDto::serverId() const { return m_serverId; } + void BaseItemDto::setServerId(QString newServerId) { m_serverId = newServerId; - emit serverIdChanged(newServerId); } +QUuid BaseItemDto::jellyfinId() const { return m_jellyfinId; } -QString BaseItemDto::jellyfinId() const { return m_jellyfinId; } -void BaseItemDto::setJellyfinId(QString newJellyfinId) { +void BaseItemDto::setJellyfinId(QUuid newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString BaseItemDto::etag() const { return m_etag; } + void BaseItemDto::setEtag(QString newEtag) { m_etag = newEtag; - emit etagChanged(newEtag); } - QString BaseItemDto::sourceType() const { return m_sourceType; } + void BaseItemDto::setSourceType(QString newSourceType) { m_sourceType = newSourceType; - emit sourceTypeChanged(newSourceType); } - QString BaseItemDto::playlistItemId() const { return m_playlistItemId; } + void BaseItemDto::setPlaylistItemId(QString newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } - QDateTime BaseItemDto::dateCreated() const { return m_dateCreated; } + void BaseItemDto::setDateCreated(QDateTime newDateCreated) { m_dateCreated = newDateCreated; - emit dateCreatedChanged(newDateCreated); } - QDateTime BaseItemDto::dateLastMediaAdded() const { return m_dateLastMediaAdded; } + void BaseItemDto::setDateLastMediaAdded(QDateTime newDateLastMediaAdded) { m_dateLastMediaAdded = newDateLastMediaAdded; - emit dateLastMediaAddedChanged(newDateLastMediaAdded); } - QString BaseItemDto::extraType() const { return m_extraType; } + void BaseItemDto::setExtraType(QString newExtraType) { m_extraType = newExtraType; - emit extraTypeChanged(newExtraType); } - qint32 BaseItemDto::airsBeforeSeasonNumber() const { return m_airsBeforeSeasonNumber; } + void BaseItemDto::setAirsBeforeSeasonNumber(qint32 newAirsBeforeSeasonNumber) { m_airsBeforeSeasonNumber = newAirsBeforeSeasonNumber; - emit airsBeforeSeasonNumberChanged(newAirsBeforeSeasonNumber); } - qint32 BaseItemDto::airsAfterSeasonNumber() const { return m_airsAfterSeasonNumber; } + void BaseItemDto::setAirsAfterSeasonNumber(qint32 newAirsAfterSeasonNumber) { m_airsAfterSeasonNumber = newAirsAfterSeasonNumber; - emit airsAfterSeasonNumberChanged(newAirsAfterSeasonNumber); } - qint32 BaseItemDto::airsBeforeEpisodeNumber() const { return m_airsBeforeEpisodeNumber; } + void BaseItemDto::setAirsBeforeEpisodeNumber(qint32 newAirsBeforeEpisodeNumber) { m_airsBeforeEpisodeNumber = newAirsBeforeEpisodeNumber; - emit airsBeforeEpisodeNumberChanged(newAirsBeforeEpisodeNumber); } - bool BaseItemDto::canDelete() const { return m_canDelete; } + void BaseItemDto::setCanDelete(bool newCanDelete) { m_canDelete = newCanDelete; - emit canDeleteChanged(newCanDelete); } - bool BaseItemDto::canDownload() const { return m_canDownload; } + void BaseItemDto::setCanDownload(bool newCanDownload) { m_canDownload = newCanDownload; - emit canDownloadChanged(newCanDownload); } - bool BaseItemDto::hasSubtitles() const { return m_hasSubtitles; } + void BaseItemDto::setHasSubtitles(bool newHasSubtitles) { m_hasSubtitles = newHasSubtitles; - emit hasSubtitlesChanged(newHasSubtitles); } - QString BaseItemDto::preferredMetadataLanguage() const { return m_preferredMetadataLanguage; } + void BaseItemDto::setPreferredMetadataLanguage(QString newPreferredMetadataLanguage) { m_preferredMetadataLanguage = newPreferredMetadataLanguage; - emit preferredMetadataLanguageChanged(newPreferredMetadataLanguage); } - QString BaseItemDto::preferredMetadataCountryCode() const { return m_preferredMetadataCountryCode; } + void BaseItemDto::setPreferredMetadataCountryCode(QString newPreferredMetadataCountryCode) { m_preferredMetadataCountryCode = newPreferredMetadataCountryCode; - emit preferredMetadataCountryCodeChanged(newPreferredMetadataCountryCode); } - bool BaseItemDto::supportsSync() const { return m_supportsSync; } + void BaseItemDto::setSupportsSync(bool newSupportsSync) { m_supportsSync = newSupportsSync; - emit supportsSyncChanged(newSupportsSync); } - QString BaseItemDto::container() const { return m_container; } + void BaseItemDto::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } - QString BaseItemDto::sortName() const { return m_sortName; } + void BaseItemDto::setSortName(QString newSortName) { m_sortName = newSortName; - emit sortNameChanged(newSortName); } - QString BaseItemDto::forcedSortName() const { return m_forcedSortName; } + void BaseItemDto::setForcedSortName(QString newForcedSortName) { m_forcedSortName = newForcedSortName; - emit forcedSortNameChanged(newForcedSortName); } - Video3DFormat BaseItemDto::video3DFormat() const { return m_video3DFormat; } + void BaseItemDto::setVideo3DFormat(Video3DFormat newVideo3DFormat) { m_video3DFormat = newVideo3DFormat; - emit video3DFormatChanged(newVideo3DFormat); } - QDateTime BaseItemDto::premiereDate() const { return m_premiereDate; } + void BaseItemDto::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } +QList> BaseItemDto::externalUrls() const { return m_externalUrls; } -QList BaseItemDto::externalUrls() const { return m_externalUrls; } -void BaseItemDto::setExternalUrls(QList newExternalUrls) { +void BaseItemDto::setExternalUrls(QList> newExternalUrls) { m_externalUrls = newExternalUrls; - emit externalUrlsChanged(newExternalUrls); } +QList> BaseItemDto::mediaSources() const { return m_mediaSources; } -QList BaseItemDto::mediaSources() const { return m_mediaSources; } -void BaseItemDto::setMediaSources(QList newMediaSources) { +void BaseItemDto::setMediaSources(QList> newMediaSources) { m_mediaSources = newMediaSources; - emit mediaSourcesChanged(newMediaSources); } - float BaseItemDto::criticRating() const { return m_criticRating; } + void BaseItemDto::setCriticRating(float newCriticRating) { m_criticRating = newCriticRating; - emit criticRatingChanged(newCriticRating); } - QStringList BaseItemDto::productionLocations() const { return m_productionLocations; } + void BaseItemDto::setProductionLocations(QStringList newProductionLocations) { m_productionLocations = newProductionLocations; - emit productionLocationsChanged(newProductionLocations); } - QString BaseItemDto::path() const { return m_path; } + void BaseItemDto::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - bool BaseItemDto::enableMediaSourceDisplay() const { return m_enableMediaSourceDisplay; } + void BaseItemDto::setEnableMediaSourceDisplay(bool newEnableMediaSourceDisplay) { m_enableMediaSourceDisplay = newEnableMediaSourceDisplay; - emit enableMediaSourceDisplayChanged(newEnableMediaSourceDisplay); } - QString BaseItemDto::officialRating() const { return m_officialRating; } + void BaseItemDto::setOfficialRating(QString newOfficialRating) { m_officialRating = newOfficialRating; - emit officialRatingChanged(newOfficialRating); } - QString BaseItemDto::customRating() const { return m_customRating; } + void BaseItemDto::setCustomRating(QString newCustomRating) { m_customRating = newCustomRating; - emit customRatingChanged(newCustomRating); } +QUuid BaseItemDto::channelId() const { return m_channelId; } -QString BaseItemDto::channelId() const { return m_channelId; } -void BaseItemDto::setChannelId(QString newChannelId) { +void BaseItemDto::setChannelId(QUuid newChannelId) { m_channelId = newChannelId; - emit channelIdChanged(newChannelId); } - QString BaseItemDto::channelName() const { return m_channelName; } + void BaseItemDto::setChannelName(QString newChannelName) { m_channelName = newChannelName; - emit channelNameChanged(newChannelName); } - QString BaseItemDto::overview() const { return m_overview; } + void BaseItemDto::setOverview(QString newOverview) { m_overview = newOverview; - emit overviewChanged(newOverview); } - QStringList BaseItemDto::taglines() const { return m_taglines; } + void BaseItemDto::setTaglines(QStringList newTaglines) { m_taglines = newTaglines; - emit taglinesChanged(newTaglines); } - QStringList BaseItemDto::genres() const { return m_genres; } + void BaseItemDto::setGenres(QStringList newGenres) { m_genres = newGenres; - emit genresChanged(newGenres); } - float BaseItemDto::communityRating() const { return m_communityRating; } + void BaseItemDto::setCommunityRating(float newCommunityRating) { m_communityRating = newCommunityRating; - emit communityRatingChanged(newCommunityRating); } - qint64 BaseItemDto::cumulativeRunTimeTicks() const { return m_cumulativeRunTimeTicks; } + void BaseItemDto::setCumulativeRunTimeTicks(qint64 newCumulativeRunTimeTicks) { m_cumulativeRunTimeTicks = newCumulativeRunTimeTicks; - emit cumulativeRunTimeTicksChanged(newCumulativeRunTimeTicks); } - qint64 BaseItemDto::runTimeTicks() const { return m_runTimeTicks; } + void BaseItemDto::setRunTimeTicks(qint64 newRunTimeTicks) { m_runTimeTicks = newRunTimeTicks; - emit runTimeTicksChanged(newRunTimeTicks); } - PlayAccess BaseItemDto::playAccess() const { return m_playAccess; } + void BaseItemDto::setPlayAccess(PlayAccess newPlayAccess) { m_playAccess = newPlayAccess; - emit playAccessChanged(newPlayAccess); } - QString BaseItemDto::aspectRatio() const { return m_aspectRatio; } + void BaseItemDto::setAspectRatio(QString newAspectRatio) { m_aspectRatio = newAspectRatio; - emit aspectRatioChanged(newAspectRatio); } - qint32 BaseItemDto::productionYear() const { return m_productionYear; } + void BaseItemDto::setProductionYear(qint32 newProductionYear) { m_productionYear = newProductionYear; - emit productionYearChanged(newProductionYear); } - bool BaseItemDto::isPlaceHolder() const { return m_isPlaceHolder; } + void BaseItemDto::setIsPlaceHolder(bool newIsPlaceHolder) { m_isPlaceHolder = newIsPlaceHolder; - emit isPlaceHolderChanged(newIsPlaceHolder); } - QString BaseItemDto::number() const { return m_number; } + void BaseItemDto::setNumber(QString newNumber) { m_number = newNumber; - emit numberChanged(newNumber); } - QString BaseItemDto::channelNumber() const { return m_channelNumber; } + void BaseItemDto::setChannelNumber(QString newChannelNumber) { m_channelNumber = newChannelNumber; - emit channelNumberChanged(newChannelNumber); } - qint32 BaseItemDto::indexNumber() const { return m_indexNumber; } + void BaseItemDto::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 BaseItemDto::indexNumberEnd() const { return m_indexNumberEnd; } + void BaseItemDto::setIndexNumberEnd(qint32 newIndexNumberEnd) { m_indexNumberEnd = newIndexNumberEnd; - emit indexNumberEndChanged(newIndexNumberEnd); } - qint32 BaseItemDto::parentIndexNumber() const { return m_parentIndexNumber; } + void BaseItemDto::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } +QList> BaseItemDto::remoteTrailers() const { return m_remoteTrailers; } -QList BaseItemDto::remoteTrailers() const { return m_remoteTrailers; } -void BaseItemDto::setRemoteTrailers(QList newRemoteTrailers) { +void BaseItemDto::setRemoteTrailers(QList> newRemoteTrailers) { m_remoteTrailers = newRemoteTrailers; - emit remoteTrailersChanged(newRemoteTrailers); } - QJsonObject BaseItemDto::providerIds() const { return m_providerIds; } + void BaseItemDto::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - bool BaseItemDto::isHD() const { return m_isHD; } + void BaseItemDto::setIsHD(bool newIsHD) { m_isHD = newIsHD; - emit isHDChanged(newIsHD); } - bool BaseItemDto::isFolder() const { return m_isFolder; } + void BaseItemDto::setIsFolder(bool newIsFolder) { m_isFolder = newIsFolder; - emit isFolderChanged(newIsFolder); } +QUuid BaseItemDto::parentId() const { return m_parentId; } -QString BaseItemDto::parentId() const { return m_parentId; } -void BaseItemDto::setParentId(QString newParentId) { +void BaseItemDto::setParentId(QUuid newParentId) { m_parentId = newParentId; - emit parentIdChanged(newParentId); } - QString BaseItemDto::type() const { return m_type; } + void BaseItemDto::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } +QList> BaseItemDto::people() const { return m_people; } -QList BaseItemDto::people() const { return m_people; } -void BaseItemDto::setPeople(QList newPeople) { +void BaseItemDto::setPeople(QList> newPeople) { m_people = newPeople; - emit peopleChanged(newPeople); } +QList> BaseItemDto::studios() const { return m_studios; } -QList BaseItemDto::studios() const { return m_studios; } -void BaseItemDto::setStudios(QList newStudios) { +void BaseItemDto::setStudios(QList> newStudios) { m_studios = newStudios; - emit studiosChanged(newStudios); } +QList> BaseItemDto::genreItems() const { return m_genreItems; } -QList BaseItemDto::genreItems() const { return m_genreItems; } -void BaseItemDto::setGenreItems(QList newGenreItems) { +void BaseItemDto::setGenreItems(QList> newGenreItems) { m_genreItems = newGenreItems; - emit genreItemsChanged(newGenreItems); } - QString BaseItemDto::parentLogoItemId() const { return m_parentLogoItemId; } + void BaseItemDto::setParentLogoItemId(QString newParentLogoItemId) { m_parentLogoItemId = newParentLogoItemId; - emit parentLogoItemIdChanged(newParentLogoItemId); } - QString BaseItemDto::parentBackdropItemId() const { return m_parentBackdropItemId; } + void BaseItemDto::setParentBackdropItemId(QString newParentBackdropItemId) { m_parentBackdropItemId = newParentBackdropItemId; - emit parentBackdropItemIdChanged(newParentBackdropItemId); } - QStringList BaseItemDto::parentBackdropImageTags() const { return m_parentBackdropImageTags; } + void BaseItemDto::setParentBackdropImageTags(QStringList newParentBackdropImageTags) { m_parentBackdropImageTags = newParentBackdropImageTags; - emit parentBackdropImageTagsChanged(newParentBackdropImageTags); } - qint32 BaseItemDto::localTrailerCount() const { return m_localTrailerCount; } + void BaseItemDto::setLocalTrailerCount(qint32 newLocalTrailerCount) { m_localTrailerCount = newLocalTrailerCount; - emit localTrailerCountChanged(newLocalTrailerCount); } +QSharedPointer BaseItemDto::userData() const { return m_userData; } -UserItemDataDto * BaseItemDto::userData() const { return m_userData; } -void BaseItemDto::setUserData(UserItemDataDto * newUserData) { +void BaseItemDto::setUserData(QSharedPointer newUserData) { m_userData = newUserData; - emit userDataChanged(newUserData); } - qint32 BaseItemDto::recursiveItemCount() const { return m_recursiveItemCount; } + void BaseItemDto::setRecursiveItemCount(qint32 newRecursiveItemCount) { m_recursiveItemCount = newRecursiveItemCount; - emit recursiveItemCountChanged(newRecursiveItemCount); } - qint32 BaseItemDto::childCount() const { return m_childCount; } + void BaseItemDto::setChildCount(qint32 newChildCount) { m_childCount = newChildCount; - emit childCountChanged(newChildCount); } - QString BaseItemDto::seriesName() const { return m_seriesName; } + void BaseItemDto::setSeriesName(QString newSeriesName) { m_seriesName = newSeriesName; - emit seriesNameChanged(newSeriesName); } +QUuid BaseItemDto::seriesId() const { return m_seriesId; } -QString BaseItemDto::seriesId() const { return m_seriesId; } -void BaseItemDto::setSeriesId(QString newSeriesId) { +void BaseItemDto::setSeriesId(QUuid newSeriesId) { m_seriesId = newSeriesId; - emit seriesIdChanged(newSeriesId); } +QUuid BaseItemDto::seasonId() const { return m_seasonId; } -QString BaseItemDto::seasonId() const { return m_seasonId; } -void BaseItemDto::setSeasonId(QString newSeasonId) { +void BaseItemDto::setSeasonId(QUuid newSeasonId) { m_seasonId = newSeasonId; - emit seasonIdChanged(newSeasonId); } - qint32 BaseItemDto::specialFeatureCount() const { return m_specialFeatureCount; } + void BaseItemDto::setSpecialFeatureCount(qint32 newSpecialFeatureCount) { m_specialFeatureCount = newSpecialFeatureCount; - emit specialFeatureCountChanged(newSpecialFeatureCount); } - QString BaseItemDto::displayPreferencesId() const { return m_displayPreferencesId; } + void BaseItemDto::setDisplayPreferencesId(QString newDisplayPreferencesId) { m_displayPreferencesId = newDisplayPreferencesId; - emit displayPreferencesIdChanged(newDisplayPreferencesId); } - QString BaseItemDto::status() const { return m_status; } + void BaseItemDto::setStatus(QString newStatus) { m_status = newStatus; - emit statusChanged(newStatus); } - QString BaseItemDto::airTime() const { return m_airTime; } + void BaseItemDto::setAirTime(QString newAirTime) { m_airTime = newAirTime; - emit airTimeChanged(newAirTime); } - QList BaseItemDto::airDays() const { return m_airDays; } + void BaseItemDto::setAirDays(QList newAirDays) { m_airDays = newAirDays; - emit airDaysChanged(newAirDays); } - QStringList BaseItemDto::tags() const { return m_tags; } + void BaseItemDto::setTags(QStringList newTags) { m_tags = newTags; - emit tagsChanged(newTags); } - double BaseItemDto::primaryImageAspectRatio() const { return m_primaryImageAspectRatio; } + void BaseItemDto::setPrimaryImageAspectRatio(double newPrimaryImageAspectRatio) { m_primaryImageAspectRatio = newPrimaryImageAspectRatio; - emit primaryImageAspectRatioChanged(newPrimaryImageAspectRatio); } - QStringList BaseItemDto::artists() const { return m_artists; } + void BaseItemDto::setArtists(QStringList newArtists) { m_artists = newArtists; - emit artistsChanged(newArtists); } +QList> BaseItemDto::artistItems() const { return m_artistItems; } -QList BaseItemDto::artistItems() const { return m_artistItems; } -void BaseItemDto::setArtistItems(QList newArtistItems) { +void BaseItemDto::setArtistItems(QList> newArtistItems) { m_artistItems = newArtistItems; - emit artistItemsChanged(newArtistItems); } - QString BaseItemDto::album() const { return m_album; } + void BaseItemDto::setAlbum(QString newAlbum) { m_album = newAlbum; - emit albumChanged(newAlbum); } - QString BaseItemDto::collectionType() const { return m_collectionType; } + void BaseItemDto::setCollectionType(QString newCollectionType) { m_collectionType = newCollectionType; - emit collectionTypeChanged(newCollectionType); } - QString BaseItemDto::displayOrder() const { return m_displayOrder; } + void BaseItemDto::setDisplayOrder(QString newDisplayOrder) { m_displayOrder = newDisplayOrder; - emit displayOrderChanged(newDisplayOrder); } +QUuid BaseItemDto::albumId() const { return m_albumId; } -QString BaseItemDto::albumId() const { return m_albumId; } -void BaseItemDto::setAlbumId(QString newAlbumId) { +void BaseItemDto::setAlbumId(QUuid newAlbumId) { m_albumId = newAlbumId; - emit albumIdChanged(newAlbumId); } - QString BaseItemDto::albumPrimaryImageTag() const { return m_albumPrimaryImageTag; } + void BaseItemDto::setAlbumPrimaryImageTag(QString newAlbumPrimaryImageTag) { m_albumPrimaryImageTag = newAlbumPrimaryImageTag; - emit albumPrimaryImageTagChanged(newAlbumPrimaryImageTag); } - QString BaseItemDto::seriesPrimaryImageTag() const { return m_seriesPrimaryImageTag; } + void BaseItemDto::setSeriesPrimaryImageTag(QString newSeriesPrimaryImageTag) { m_seriesPrimaryImageTag = newSeriesPrimaryImageTag; - emit seriesPrimaryImageTagChanged(newSeriesPrimaryImageTag); } - QString BaseItemDto::albumArtist() const { return m_albumArtist; } + void BaseItemDto::setAlbumArtist(QString newAlbumArtist) { m_albumArtist = newAlbumArtist; - emit albumArtistChanged(newAlbumArtist); } +QList> BaseItemDto::albumArtists() const { return m_albumArtists; } -QList BaseItemDto::albumArtists() const { return m_albumArtists; } -void BaseItemDto::setAlbumArtists(QList newAlbumArtists) { +void BaseItemDto::setAlbumArtists(QList> newAlbumArtists) { m_albumArtists = newAlbumArtists; - emit albumArtistsChanged(newAlbumArtists); } - QString BaseItemDto::seasonName() const { return m_seasonName; } + void BaseItemDto::setSeasonName(QString newSeasonName) { m_seasonName = newSeasonName; - emit seasonNameChanged(newSeasonName); } +QList> BaseItemDto::mediaStreams() const { return m_mediaStreams; } -QList BaseItemDto::mediaStreams() const { return m_mediaStreams; } -void BaseItemDto::setMediaStreams(QList newMediaStreams) { +void BaseItemDto::setMediaStreams(QList> newMediaStreams) { m_mediaStreams = newMediaStreams; - emit mediaStreamsChanged(newMediaStreams); } - VideoType BaseItemDto::videoType() const { return m_videoType; } + void BaseItemDto::setVideoType(VideoType newVideoType) { m_videoType = newVideoType; - emit videoTypeChanged(newVideoType); } - qint32 BaseItemDto::partCount() const { return m_partCount; } + void BaseItemDto::setPartCount(qint32 newPartCount) { m_partCount = newPartCount; - emit partCountChanged(newPartCount); } - qint32 BaseItemDto::mediaSourceCount() const { return m_mediaSourceCount; } + void BaseItemDto::setMediaSourceCount(qint32 newMediaSourceCount) { m_mediaSourceCount = newMediaSourceCount; - emit mediaSourceCountChanged(newMediaSourceCount); } - QJsonObject BaseItemDto::imageTags() const { return m_imageTags; } + void BaseItemDto::setImageTags(QJsonObject newImageTags) { m_imageTags = newImageTags; - emit imageTagsChanged(newImageTags); } - QStringList BaseItemDto::backdropImageTags() const { return m_backdropImageTags; } + void BaseItemDto::setBackdropImageTags(QStringList newBackdropImageTags) { m_backdropImageTags = newBackdropImageTags; - emit backdropImageTagsChanged(newBackdropImageTags); } - QStringList BaseItemDto::screenshotImageTags() const { return m_screenshotImageTags; } + void BaseItemDto::setScreenshotImageTags(QStringList newScreenshotImageTags) { m_screenshotImageTags = newScreenshotImageTags; - emit screenshotImageTagsChanged(newScreenshotImageTags); } - QString BaseItemDto::parentLogoImageTag() const { return m_parentLogoImageTag; } + void BaseItemDto::setParentLogoImageTag(QString newParentLogoImageTag) { m_parentLogoImageTag = newParentLogoImageTag; - emit parentLogoImageTagChanged(newParentLogoImageTag); } - QString BaseItemDto::parentArtItemId() const { return m_parentArtItemId; } + void BaseItemDto::setParentArtItemId(QString newParentArtItemId) { m_parentArtItemId = newParentArtItemId; - emit parentArtItemIdChanged(newParentArtItemId); } - QString BaseItemDto::parentArtImageTag() const { return m_parentArtImageTag; } + void BaseItemDto::setParentArtImageTag(QString newParentArtImageTag) { m_parentArtImageTag = newParentArtImageTag; - emit parentArtImageTagChanged(newParentArtImageTag); } - QString BaseItemDto::seriesThumbImageTag() const { return m_seriesThumbImageTag; } + void BaseItemDto::setSeriesThumbImageTag(QString newSeriesThumbImageTag) { m_seriesThumbImageTag = newSeriesThumbImageTag; - emit seriesThumbImageTagChanged(newSeriesThumbImageTag); } - QJsonObject BaseItemDto::imageBlurHashes() const { return m_imageBlurHashes; } + void BaseItemDto::setImageBlurHashes(QJsonObject newImageBlurHashes) { m_imageBlurHashes = newImageBlurHashes; - emit imageBlurHashesChanged(newImageBlurHashes); } - QString BaseItemDto::seriesStudio() const { return m_seriesStudio; } + void BaseItemDto::setSeriesStudio(QString newSeriesStudio) { m_seriesStudio = newSeriesStudio; - emit seriesStudioChanged(newSeriesStudio); } - QString BaseItemDto::parentThumbItemId() const { return m_parentThumbItemId; } + void BaseItemDto::setParentThumbItemId(QString newParentThumbItemId) { m_parentThumbItemId = newParentThumbItemId; - emit parentThumbItemIdChanged(newParentThumbItemId); } - QString BaseItemDto::parentThumbImageTag() const { return m_parentThumbImageTag; } + void BaseItemDto::setParentThumbImageTag(QString newParentThumbImageTag) { m_parentThumbImageTag = newParentThumbImageTag; - emit parentThumbImageTagChanged(newParentThumbImageTag); } - QString BaseItemDto::parentPrimaryImageItemId() const { return m_parentPrimaryImageItemId; } + void BaseItemDto::setParentPrimaryImageItemId(QString newParentPrimaryImageItemId) { m_parentPrimaryImageItemId = newParentPrimaryImageItemId; - emit parentPrimaryImageItemIdChanged(newParentPrimaryImageItemId); } - QString BaseItemDto::parentPrimaryImageTag() const { return m_parentPrimaryImageTag; } + void BaseItemDto::setParentPrimaryImageTag(QString newParentPrimaryImageTag) { m_parentPrimaryImageTag = newParentPrimaryImageTag; - emit parentPrimaryImageTagChanged(newParentPrimaryImageTag); } +QList> BaseItemDto::chapters() const { return m_chapters; } -QList BaseItemDto::chapters() const { return m_chapters; } -void BaseItemDto::setChapters(QList newChapters) { +void BaseItemDto::setChapters(QList> newChapters) { m_chapters = newChapters; - emit chaptersChanged(newChapters); } - LocationType BaseItemDto::locationType() const { return m_locationType; } + void BaseItemDto::setLocationType(LocationType newLocationType) { m_locationType = newLocationType; - emit locationTypeChanged(newLocationType); } - IsoType BaseItemDto::isoType() const { return m_isoType; } + void BaseItemDto::setIsoType(IsoType newIsoType) { m_isoType = newIsoType; - emit isoTypeChanged(newIsoType); } - QString BaseItemDto::mediaType() const { return m_mediaType; } + void BaseItemDto::setMediaType(QString newMediaType) { m_mediaType = newMediaType; - emit mediaTypeChanged(newMediaType); } - QDateTime BaseItemDto::endDate() const { return m_endDate; } + void BaseItemDto::setEndDate(QDateTime newEndDate) { m_endDate = newEndDate; - emit endDateChanged(newEndDate); } - QList BaseItemDto::lockedFields() const { return m_lockedFields; } + void BaseItemDto::setLockedFields(QList newLockedFields) { m_lockedFields = newLockedFields; - emit lockedFieldsChanged(newLockedFields); } - qint32 BaseItemDto::trailerCount() const { return m_trailerCount; } + void BaseItemDto::setTrailerCount(qint32 newTrailerCount) { m_trailerCount = newTrailerCount; - emit trailerCountChanged(newTrailerCount); } - qint32 BaseItemDto::movieCount() const { return m_movieCount; } + void BaseItemDto::setMovieCount(qint32 newMovieCount) { m_movieCount = newMovieCount; - emit movieCountChanged(newMovieCount); } - qint32 BaseItemDto::seriesCount() const { return m_seriesCount; } + void BaseItemDto::setSeriesCount(qint32 newSeriesCount) { m_seriesCount = newSeriesCount; - emit seriesCountChanged(newSeriesCount); } - qint32 BaseItemDto::programCount() const { return m_programCount; } + void BaseItemDto::setProgramCount(qint32 newProgramCount) { m_programCount = newProgramCount; - emit programCountChanged(newProgramCount); } - qint32 BaseItemDto::episodeCount() const { return m_episodeCount; } + void BaseItemDto::setEpisodeCount(qint32 newEpisodeCount) { m_episodeCount = newEpisodeCount; - emit episodeCountChanged(newEpisodeCount); } - qint32 BaseItemDto::songCount() const { return m_songCount; } + void BaseItemDto::setSongCount(qint32 newSongCount) { m_songCount = newSongCount; - emit songCountChanged(newSongCount); } - qint32 BaseItemDto::albumCount() const { return m_albumCount; } + void BaseItemDto::setAlbumCount(qint32 newAlbumCount) { m_albumCount = newAlbumCount; - emit albumCountChanged(newAlbumCount); } - qint32 BaseItemDto::artistCount() const { return m_artistCount; } + void BaseItemDto::setArtistCount(qint32 newArtistCount) { m_artistCount = newArtistCount; - emit artistCountChanged(newArtistCount); } - qint32 BaseItemDto::musicVideoCount() const { return m_musicVideoCount; } + void BaseItemDto::setMusicVideoCount(qint32 newMusicVideoCount) { m_musicVideoCount = newMusicVideoCount; - emit musicVideoCountChanged(newMusicVideoCount); } - bool BaseItemDto::lockData() const { return m_lockData; } + void BaseItemDto::setLockData(bool newLockData) { m_lockData = newLockData; - emit lockDataChanged(newLockData); } - qint32 BaseItemDto::width() const { return m_width; } + void BaseItemDto::setWidth(qint32 newWidth) { m_width = newWidth; - emit widthChanged(newWidth); } - qint32 BaseItemDto::height() const { return m_height; } + void BaseItemDto::setHeight(qint32 newHeight) { m_height = newHeight; - emit heightChanged(newHeight); } - QString BaseItemDto::cameraMake() const { return m_cameraMake; } + void BaseItemDto::setCameraMake(QString newCameraMake) { m_cameraMake = newCameraMake; - emit cameraMakeChanged(newCameraMake); } - QString BaseItemDto::cameraModel() const { return m_cameraModel; } + void BaseItemDto::setCameraModel(QString newCameraModel) { m_cameraModel = newCameraModel; - emit cameraModelChanged(newCameraModel); } - QString BaseItemDto::software() const { return m_software; } + void BaseItemDto::setSoftware(QString newSoftware) { m_software = newSoftware; - emit softwareChanged(newSoftware); } - double BaseItemDto::exposureTime() const { return m_exposureTime; } + void BaseItemDto::setExposureTime(double newExposureTime) { m_exposureTime = newExposureTime; - emit exposureTimeChanged(newExposureTime); } - double BaseItemDto::focalLength() const { return m_focalLength; } + void BaseItemDto::setFocalLength(double newFocalLength) { m_focalLength = newFocalLength; - emit focalLengthChanged(newFocalLength); } - ImageOrientation BaseItemDto::imageOrientation() const { return m_imageOrientation; } + void BaseItemDto::setImageOrientation(ImageOrientation newImageOrientation) { m_imageOrientation = newImageOrientation; - emit imageOrientationChanged(newImageOrientation); } - double BaseItemDto::aperture() const { return m_aperture; } + void BaseItemDto::setAperture(double newAperture) { m_aperture = newAperture; - emit apertureChanged(newAperture); } - double BaseItemDto::shutterSpeed() const { return m_shutterSpeed; } + void BaseItemDto::setShutterSpeed(double newShutterSpeed) { m_shutterSpeed = newShutterSpeed; - emit shutterSpeedChanged(newShutterSpeed); } - double BaseItemDto::latitude() const { return m_latitude; } + void BaseItemDto::setLatitude(double newLatitude) { m_latitude = newLatitude; - emit latitudeChanged(newLatitude); } - double BaseItemDto::longitude() const { return m_longitude; } + void BaseItemDto::setLongitude(double newLongitude) { m_longitude = newLongitude; - emit longitudeChanged(newLongitude); } - double BaseItemDto::altitude() const { return m_altitude; } + void BaseItemDto::setAltitude(double newAltitude) { m_altitude = newAltitude; - emit altitudeChanged(newAltitude); } - qint32 BaseItemDto::isoSpeedRating() const { return m_isoSpeedRating; } + void BaseItemDto::setIsoSpeedRating(qint32 newIsoSpeedRating) { m_isoSpeedRating = newIsoSpeedRating; - emit isoSpeedRatingChanged(newIsoSpeedRating); } - QString BaseItemDto::seriesTimerId() const { return m_seriesTimerId; } + void BaseItemDto::setSeriesTimerId(QString newSeriesTimerId) { m_seriesTimerId = newSeriesTimerId; - emit seriesTimerIdChanged(newSeriesTimerId); } - QString BaseItemDto::programId() const { return m_programId; } + void BaseItemDto::setProgramId(QString newProgramId) { m_programId = newProgramId; - emit programIdChanged(newProgramId); } - QString BaseItemDto::channelPrimaryImageTag() const { return m_channelPrimaryImageTag; } + void BaseItemDto::setChannelPrimaryImageTag(QString newChannelPrimaryImageTag) { m_channelPrimaryImageTag = newChannelPrimaryImageTag; - emit channelPrimaryImageTagChanged(newChannelPrimaryImageTag); } - QDateTime BaseItemDto::startDate() const { return m_startDate; } + void BaseItemDto::setStartDate(QDateTime newStartDate) { m_startDate = newStartDate; - emit startDateChanged(newStartDate); } - double BaseItemDto::completionPercentage() const { return m_completionPercentage; } + void BaseItemDto::setCompletionPercentage(double newCompletionPercentage) { m_completionPercentage = newCompletionPercentage; - emit completionPercentageChanged(newCompletionPercentage); } - bool BaseItemDto::isRepeat() const { return m_isRepeat; } + void BaseItemDto::setIsRepeat(bool newIsRepeat) { m_isRepeat = newIsRepeat; - emit isRepeatChanged(newIsRepeat); } - QString BaseItemDto::episodeTitle() const { return m_episodeTitle; } + void BaseItemDto::setEpisodeTitle(QString newEpisodeTitle) { m_episodeTitle = newEpisodeTitle; - emit episodeTitleChanged(newEpisodeTitle); } - ChannelType BaseItemDto::channelType() const { return m_channelType; } + void BaseItemDto::setChannelType(ChannelType newChannelType) { m_channelType = newChannelType; - emit channelTypeChanged(newChannelType); } - ProgramAudio BaseItemDto::audio() const { return m_audio; } + void BaseItemDto::setAudio(ProgramAudio newAudio) { m_audio = newAudio; - emit audioChanged(newAudio); } - bool BaseItemDto::isMovie() const { return m_isMovie; } + void BaseItemDto::setIsMovie(bool newIsMovie) { m_isMovie = newIsMovie; - emit isMovieChanged(newIsMovie); } - bool BaseItemDto::isSports() const { return m_isSports; } + void BaseItemDto::setIsSports(bool newIsSports) { m_isSports = newIsSports; - emit isSportsChanged(newIsSports); } - bool BaseItemDto::isSeries() const { return m_isSeries; } + void BaseItemDto::setIsSeries(bool newIsSeries) { m_isSeries = newIsSeries; - emit isSeriesChanged(newIsSeries); } - bool BaseItemDto::isLive() const { return m_isLive; } + void BaseItemDto::setIsLive(bool newIsLive) { m_isLive = newIsLive; - emit isLiveChanged(newIsLive); } - bool BaseItemDto::isNews() const { return m_isNews; } + void BaseItemDto::setIsNews(bool newIsNews) { m_isNews = newIsNews; - emit isNewsChanged(newIsNews); } - bool BaseItemDto::isKids() const { return m_isKids; } + void BaseItemDto::setIsKids(bool newIsKids) { m_isKids = newIsKids; - emit isKidsChanged(newIsKids); } - bool BaseItemDto::isPremiere() const { return m_isPremiere; } + void BaseItemDto::setIsPremiere(bool newIsPremiere) { m_isPremiere = newIsPremiere; - emit isPremiereChanged(newIsPremiere); } - QString BaseItemDto::timerId() const { return m_timerId; } + void BaseItemDto::setTimerId(QString newTimerId) { m_timerId = newTimerId; - emit timerIdChanged(newTimerId); } +QSharedPointer BaseItemDto::currentProgram() const { return m_currentProgram; } -BaseItemDto * BaseItemDto::currentProgram() const { return m_currentProgram; } -void BaseItemDto::setCurrentProgram(BaseItemDto * newCurrentProgram) { +void BaseItemDto::setCurrentProgram(QSharedPointer newCurrentProgram) { m_currentProgram = newCurrentProgram; - emit currentProgramChanged(newCurrentProgram); } diff --git a/core/src/DTO/baseitemdtoqueryresult.cpp b/core/src/DTO/baseitemdtoqueryresult.cpp index bc79fc8..6730786 100644 --- a/core/src/DTO/baseitemdtoqueryresult.cpp +++ b/core/src/DTO/baseitemdtoqueryresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -BaseItemDtoQueryResult::BaseItemDtoQueryResult(QObject *parent) : QObject(parent) {} +BaseItemDtoQueryResult::BaseItemDtoQueryResult(QObject *parent) {} -BaseItemDtoQueryResult *BaseItemDtoQueryResult::fromJSON(QJsonObject source, QObject *parent) { - BaseItemDtoQueryResult *instance = new BaseItemDtoQueryResult(parent); - instance->updateFromJSON(source); +BaseItemDtoQueryResult BaseItemDtoQueryResult::fromJson(QJsonObject source) {BaseItemDtoQueryResult instance; + instance->setFromJson(source, false); return instance; } -void BaseItemDtoQueryResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BaseItemDtoQueryResult::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + } -QJsonObject BaseItemDtoQueryResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BaseItemDtoQueryResult::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["StartIndex"] = toJsonValue(m_startIndex); + return result; } -QList BaseItemDtoQueryResult::items() const { return m_items; } -void BaseItemDtoQueryResult::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> BaseItemDtoQueryResult::items() const { return m_items; } + +void BaseItemDtoQueryResult::setItems(QList> newItems) { + m_items = newItems; +} qint32 BaseItemDtoQueryResult::totalRecordCount() const { return m_totalRecordCount; } + void BaseItemDtoQueryResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - qint32 BaseItemDtoQueryResult::startIndex() const { return m_startIndex; } + void BaseItemDtoQueryResult::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } diff --git a/core/src/DTO/baseitemperson.cpp b/core/src/DTO/baseitemperson.cpp index 0b56a76..a462a5b 100644 --- a/core/src/DTO/baseitemperson.cpp +++ b/core/src/DTO/baseitemperson.cpp @@ -32,56 +32,65 @@ namespace Jellyfin { namespace DTO { -BaseItemPerson::BaseItemPerson(QObject *parent) : QObject(parent) {} +BaseItemPerson::BaseItemPerson(QObject *parent) {} -BaseItemPerson *BaseItemPerson::fromJSON(QJsonObject source, QObject *parent) { - BaseItemPerson *instance = new BaseItemPerson(parent); - instance->updateFromJSON(source); +BaseItemPerson BaseItemPerson::fromJson(QJsonObject source) {BaseItemPerson instance; + instance->setFromJson(source, false); return instance; } -void BaseItemPerson::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BaseItemPerson::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_role = fromJsonValue(source["Role"]); + m_type = fromJsonValue(source["Type"]); + m_primaryImageTag = fromJsonValue(source["PrimaryImageTag"]); + m_imageBlurHashes = fromJsonValue(source["ImageBlurHashes"]); + } -QJsonObject BaseItemPerson::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BaseItemPerson::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Id"] = toJsonValue(m_jellyfinId); + result["Role"] = toJsonValue(m_role); + result["Type"] = toJsonValue(m_type); + result["PrimaryImageTag"] = toJsonValue(m_primaryImageTag); + result["ImageBlurHashes"] = toJsonValue(m_imageBlurHashes); + return result; } + QString BaseItemPerson::name() const { return m_name; } + void BaseItemPerson::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString BaseItemPerson::jellyfinId() const { return m_jellyfinId; } + void BaseItemPerson::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString BaseItemPerson::role() const { return m_role; } + void BaseItemPerson::setRole(QString newRole) { m_role = newRole; - emit roleChanged(newRole); } - QString BaseItemPerson::type() const { return m_type; } + void BaseItemPerson::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString BaseItemPerson::primaryImageTag() const { return m_primaryImageTag; } + void BaseItemPerson::setPrimaryImageTag(QString newPrimaryImageTag) { m_primaryImageTag = newPrimaryImageTag; - emit primaryImageTagChanged(newPrimaryImageTag); } - QJsonObject BaseItemPerson::imageBlurHashes() const { return m_imageBlurHashes; } + void BaseItemPerson::setImageBlurHashes(QJsonObject newImageBlurHashes) { m_imageBlurHashes = newImageBlurHashes; - emit imageBlurHashesChanged(newImageBlurHashes); } diff --git a/core/src/DTO/bookinfo.cpp b/core/src/DTO/bookinfo.cpp index f1f95a2..098b55f 100644 --- a/core/src/DTO/bookinfo.cpp +++ b/core/src/DTO/bookinfo.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -BookInfo::BookInfo(QObject *parent) : QObject(parent) {} +BookInfo::BookInfo(QObject *parent) {} -BookInfo *BookInfo::fromJSON(QJsonObject source, QObject *parent) { - BookInfo *instance = new BookInfo(parent); - instance->updateFromJSON(source); +BookInfo BookInfo::fromJson(QJsonObject source) {BookInfo instance; + instance->setFromJson(source, false); return instance; } -void BookInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BookInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + m_seriesName = fromJsonValue(source["SeriesName"]); + } -QJsonObject BookInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BookInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + result["SeriesName"] = toJsonValue(m_seriesName); + return result; } + QString BookInfo::name() const { return m_name; } + void BookInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString BookInfo::path() const { return m_path; } + void BookInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString BookInfo::metadataLanguage() const { return m_metadataLanguage; } + void BookInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString BookInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void BookInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject BookInfo::providerIds() const { return m_providerIds; } + void BookInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 BookInfo::year() const { return m_year; } + void BookInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 BookInfo::indexNumber() const { return m_indexNumber; } + void BookInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 BookInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void BookInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime BookInfo::premiereDate() const { return m_premiereDate; } + void BookInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool BookInfo::isAutomated() const { return m_isAutomated; } + void BookInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } - QString BookInfo::seriesName() const { return m_seriesName; } + void BookInfo::setSeriesName(QString newSeriesName) { m_seriesName = newSeriesName; - emit seriesNameChanged(newSeriesName); } diff --git a/core/src/DTO/bookinforemotesearchquery.cpp b/core/src/DTO/bookinforemotesearchquery.cpp index e0fb40c..5be3d92 100644 --- a/core/src/DTO/bookinforemotesearchquery.cpp +++ b/core/src/DTO/bookinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -BookInfoRemoteSearchQuery::BookInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +BookInfoRemoteSearchQuery::BookInfoRemoteSearchQuery(QObject *parent) {} -BookInfoRemoteSearchQuery *BookInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - BookInfoRemoteSearchQuery *instance = new BookInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +BookInfoRemoteSearchQuery BookInfoRemoteSearchQuery::fromJson(QJsonObject source) {BookInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void BookInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BookInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject BookInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BookInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -BookInfo * BookInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void BookInfoRemoteSearchQuery::setSearchInfo(BookInfo * newSearchInfo) { + +QSharedPointer BookInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void BookInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid BookInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString BookInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void BookInfoRemoteSearchQuery::setItemId(QString newItemId) { +void BookInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString BookInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void BookInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool BookInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void BookInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/boxsetinfo.cpp b/core/src/DTO/boxsetinfo.cpp index cbd9f77..183fe4d 100644 --- a/core/src/DTO/boxsetinfo.cpp +++ b/core/src/DTO/boxsetinfo.cpp @@ -32,80 +32,93 @@ namespace Jellyfin { namespace DTO { -BoxSetInfo::BoxSetInfo(QObject *parent) : QObject(parent) {} +BoxSetInfo::BoxSetInfo(QObject *parent) {} -BoxSetInfo *BoxSetInfo::fromJSON(QJsonObject source, QObject *parent) { - BoxSetInfo *instance = new BoxSetInfo(parent); - instance->updateFromJSON(source); +BoxSetInfo BoxSetInfo::fromJson(QJsonObject source) {BoxSetInfo instance; + instance->setFromJson(source, false); return instance; } -void BoxSetInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BoxSetInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + } -QJsonObject BoxSetInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BoxSetInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + return result; } + QString BoxSetInfo::name() const { return m_name; } + void BoxSetInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString BoxSetInfo::path() const { return m_path; } + void BoxSetInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString BoxSetInfo::metadataLanguage() const { return m_metadataLanguage; } + void BoxSetInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString BoxSetInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void BoxSetInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject BoxSetInfo::providerIds() const { return m_providerIds; } + void BoxSetInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 BoxSetInfo::year() const { return m_year; } + void BoxSetInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 BoxSetInfo::indexNumber() const { return m_indexNumber; } + void BoxSetInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 BoxSetInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void BoxSetInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime BoxSetInfo::premiereDate() const { return m_premiereDate; } + void BoxSetInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool BoxSetInfo::isAutomated() const { return m_isAutomated; } + void BoxSetInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } diff --git a/core/src/DTO/boxsetinforemotesearchquery.cpp b/core/src/DTO/boxsetinforemotesearchquery.cpp index 0225701..8bc3136 100644 --- a/core/src/DTO/boxsetinforemotesearchquery.cpp +++ b/core/src/DTO/boxsetinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -BoxSetInfoRemoteSearchQuery::BoxSetInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +BoxSetInfoRemoteSearchQuery::BoxSetInfoRemoteSearchQuery(QObject *parent) {} -BoxSetInfoRemoteSearchQuery *BoxSetInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - BoxSetInfoRemoteSearchQuery *instance = new BoxSetInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +BoxSetInfoRemoteSearchQuery BoxSetInfoRemoteSearchQuery::fromJson(QJsonObject source) {BoxSetInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void BoxSetInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BoxSetInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject BoxSetInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BoxSetInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -BoxSetInfo * BoxSetInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void BoxSetInfoRemoteSearchQuery::setSearchInfo(BoxSetInfo * newSearchInfo) { + +QSharedPointer BoxSetInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void BoxSetInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid BoxSetInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString BoxSetInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void BoxSetInfoRemoteSearchQuery::setItemId(QString newItemId) { +void BoxSetInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString BoxSetInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void BoxSetInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool BoxSetInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void BoxSetInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/brandingoptions.cpp b/core/src/DTO/brandingoptions.cpp index 9f2226e..d282b3c 100644 --- a/core/src/DTO/brandingoptions.cpp +++ b/core/src/DTO/brandingoptions.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -BrandingOptions::BrandingOptions(QObject *parent) : QObject(parent) {} +BrandingOptions::BrandingOptions(QObject *parent) {} -BrandingOptions *BrandingOptions::fromJSON(QJsonObject source, QObject *parent) { - BrandingOptions *instance = new BrandingOptions(parent); - instance->updateFromJSON(source); +BrandingOptions BrandingOptions::fromJson(QJsonObject source) {BrandingOptions instance; + instance->setFromJson(source, false); return instance; } -void BrandingOptions::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BrandingOptions::setFromJson(QJsonObject source) { + m_loginDisclaimer = fromJsonValue(source["LoginDisclaimer"]); + m_customCss = fromJsonValue(source["CustomCss"]); + } -QJsonObject BrandingOptions::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BrandingOptions::toJson() { QJsonObject result; + result["LoginDisclaimer"] = toJsonValue(m_loginDisclaimer); + result["CustomCss"] = toJsonValue(m_customCss); + return result; } + QString BrandingOptions::loginDisclaimer() const { return m_loginDisclaimer; } + void BrandingOptions::setLoginDisclaimer(QString newLoginDisclaimer) { m_loginDisclaimer = newLoginDisclaimer; - emit loginDisclaimerChanged(newLoginDisclaimer); } - QString BrandingOptions::customCss() const { return m_customCss; } + void BrandingOptions::setCustomCss(QString newCustomCss) { m_customCss = newCustomCss; - emit customCssChanged(newCustomCss); } diff --git a/core/src/DTO/bufferrequestdto.cpp b/core/src/DTO/bufferrequestdto.cpp index 2186ba0..e77588b 100644 --- a/core/src/DTO/bufferrequestdto.cpp +++ b/core/src/DTO/bufferrequestdto.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -BufferRequestDto::BufferRequestDto(QObject *parent) : QObject(parent) {} +BufferRequestDto::BufferRequestDto(QObject *parent) {} -BufferRequestDto *BufferRequestDto::fromJSON(QJsonObject source, QObject *parent) { - BufferRequestDto *instance = new BufferRequestDto(parent); - instance->updateFromJSON(source); +BufferRequestDto BufferRequestDto::fromJson(QJsonObject source) {BufferRequestDto instance; + instance->setFromJson(source, false); return instance; } -void BufferRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void BufferRequestDto::setFromJson(QJsonObject source) { + m_when = fromJsonValue(source["When"]); + m_positionTicks = fromJsonValue(source["PositionTicks"]); + m_isPlaying = fromJsonValue(source["IsPlaying"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject BufferRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject BufferRequestDto::toJson() { QJsonObject result; + result["When"] = toJsonValue(m_when); + result["PositionTicks"] = toJsonValue(m_positionTicks); + result["IsPlaying"] = toJsonValue(m_isPlaying); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } + QDateTime BufferRequestDto::when() const { return m_when; } + void BufferRequestDto::setWhen(QDateTime newWhen) { m_when = newWhen; - emit whenChanged(newWhen); } - qint64 BufferRequestDto::positionTicks() const { return m_positionTicks; } + void BufferRequestDto::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } - bool BufferRequestDto::isPlaying() const { return m_isPlaying; } + void BufferRequestDto::setIsPlaying(bool newIsPlaying) { m_isPlaying = newIsPlaying; - emit isPlayingChanged(newIsPlaying); } +QUuid BufferRequestDto::playlistItemId() const { return m_playlistItemId; } -QString BufferRequestDto::playlistItemId() const { return m_playlistItemId; } -void BufferRequestDto::setPlaylistItemId(QString newPlaylistItemId) { +void BufferRequestDto::setPlaylistItemId(QUuid newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/channelfeatures.cpp b/core/src/DTO/channelfeatures.cpp index 6209015..371adb1 100644 --- a/core/src/DTO/channelfeatures.cpp +++ b/core/src/DTO/channelfeatures.cpp @@ -29,99 +29,110 @@ #include -#include -#include -#include - namespace Jellyfin { namespace DTO { -ChannelFeatures::ChannelFeatures(QObject *parent) : QObject(parent) {} +ChannelFeatures::ChannelFeatures(QObject *parent) {} -ChannelFeatures *ChannelFeatures::fromJSON(QJsonObject source, QObject *parent) { - ChannelFeatures *instance = new ChannelFeatures(parent); - instance->updateFromJSON(source); +ChannelFeatures ChannelFeatures::fromJson(QJsonObject source) {ChannelFeatures instance; + instance->setFromJson(source, false); return instance; } -void ChannelFeatures::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ChannelFeatures::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_canSearch = fromJsonValue(source["CanSearch"]); + m_mediaTypes = fromJsonValue>(source["MediaTypes"]); + m_contentTypes = fromJsonValue>(source["ContentTypes"]); + m_maxPageSize = fromJsonValue(source["MaxPageSize"]); + m_autoRefreshLevels = fromJsonValue(source["AutoRefreshLevels"]); + m_defaultSortFields = fromJsonValue>(source["DefaultSortFields"]); + m_supportsSortOrderToggle = fromJsonValue(source["SupportsSortOrderToggle"]); + m_supportsLatestMedia = fromJsonValue(source["SupportsLatestMedia"]); + m_canFilter = fromJsonValue(source["CanFilter"]); + m_supportsContentDownloading = fromJsonValue(source["SupportsContentDownloading"]); + } -QJsonObject ChannelFeatures::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ChannelFeatures::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Id"] = toJsonValue(m_jellyfinId); + result["CanSearch"] = toJsonValue(m_canSearch); + result["MediaTypes"] = toJsonValue>(m_mediaTypes); + result["ContentTypes"] = toJsonValue>(m_contentTypes); + result["MaxPageSize"] = toJsonValue(m_maxPageSize); + result["AutoRefreshLevels"] = toJsonValue(m_autoRefreshLevels); + result["DefaultSortFields"] = toJsonValue>(m_defaultSortFields); + result["SupportsSortOrderToggle"] = toJsonValue(m_supportsSortOrderToggle); + result["SupportsLatestMedia"] = toJsonValue(m_supportsLatestMedia); + result["CanFilter"] = toJsonValue(m_canFilter); + result["SupportsContentDownloading"] = toJsonValue(m_supportsContentDownloading); + return result; } + QString ChannelFeatures::name() const { return m_name; } + void ChannelFeatures::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString ChannelFeatures::jellyfinId() const { return m_jellyfinId; } + void ChannelFeatures::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - bool ChannelFeatures::canSearch() const { return m_canSearch; } + void ChannelFeatures::setCanSearch(bool newCanSearch) { m_canSearch = newCanSearch; - emit canSearchChanged(newCanSearch); } - QList ChannelFeatures::mediaTypes() const { return m_mediaTypes; } + void ChannelFeatures::setMediaTypes(QList newMediaTypes) { m_mediaTypes = newMediaTypes; - emit mediaTypesChanged(newMediaTypes); } - QList ChannelFeatures::contentTypes() const { return m_contentTypes; } + void ChannelFeatures::setContentTypes(QList newContentTypes) { m_contentTypes = newContentTypes; - emit contentTypesChanged(newContentTypes); } - qint32 ChannelFeatures::maxPageSize() const { return m_maxPageSize; } + void ChannelFeatures::setMaxPageSize(qint32 newMaxPageSize) { m_maxPageSize = newMaxPageSize; - emit maxPageSizeChanged(newMaxPageSize); } - qint32 ChannelFeatures::autoRefreshLevels() const { return m_autoRefreshLevels; } + void ChannelFeatures::setAutoRefreshLevels(qint32 newAutoRefreshLevels) { m_autoRefreshLevels = newAutoRefreshLevels; - emit autoRefreshLevelsChanged(newAutoRefreshLevels); } - QList ChannelFeatures::defaultSortFields() const { return m_defaultSortFields; } + void ChannelFeatures::setDefaultSortFields(QList newDefaultSortFields) { m_defaultSortFields = newDefaultSortFields; - emit defaultSortFieldsChanged(newDefaultSortFields); } - bool ChannelFeatures::supportsSortOrderToggle() const { return m_supportsSortOrderToggle; } + void ChannelFeatures::setSupportsSortOrderToggle(bool newSupportsSortOrderToggle) { m_supportsSortOrderToggle = newSupportsSortOrderToggle; - emit supportsSortOrderToggleChanged(newSupportsSortOrderToggle); } - bool ChannelFeatures::supportsLatestMedia() const { return m_supportsLatestMedia; } + void ChannelFeatures::setSupportsLatestMedia(bool newSupportsLatestMedia) { m_supportsLatestMedia = newSupportsLatestMedia; - emit supportsLatestMediaChanged(newSupportsLatestMedia); } - bool ChannelFeatures::canFilter() const { return m_canFilter; } + void ChannelFeatures::setCanFilter(bool newCanFilter) { m_canFilter = newCanFilter; - emit canFilterChanged(newCanFilter); } - bool ChannelFeatures::supportsContentDownloading() const { return m_supportsContentDownloading; } + void ChannelFeatures::setSupportsContentDownloading(bool newSupportsContentDownloading) { m_supportsContentDownloading = newSupportsContentDownloading; - emit supportsContentDownloadingChanged(newSupportsContentDownloading); } diff --git a/core/src/DTO/channelmappingoptionsdto.cpp b/core/src/DTO/channelmappingoptionsdto.cpp index 6ce6f39..93dfbf6 100644 --- a/core/src/DTO/channelmappingoptionsdto.cpp +++ b/core/src/DTO/channelmappingoptionsdto.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -ChannelMappingOptionsDto::ChannelMappingOptionsDto(QObject *parent) : QObject(parent) {} +ChannelMappingOptionsDto::ChannelMappingOptionsDto(QObject *parent) {} -ChannelMappingOptionsDto *ChannelMappingOptionsDto::fromJSON(QJsonObject source, QObject *parent) { - ChannelMappingOptionsDto *instance = new ChannelMappingOptionsDto(parent); - instance->updateFromJSON(source); +ChannelMappingOptionsDto ChannelMappingOptionsDto::fromJson(QJsonObject source) {ChannelMappingOptionsDto instance; + instance->setFromJson(source, false); return instance; } -void ChannelMappingOptionsDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ChannelMappingOptionsDto::setFromJson(QJsonObject source) { + m_tunerChannels = fromJsonValue>>(source["TunerChannels"]); + m_providerChannels = fromJsonValue>>(source["ProviderChannels"]); + m_mappings = fromJsonValue>>(source["Mappings"]); + m_providerName = fromJsonValue(source["ProviderName"]); + } -QJsonObject ChannelMappingOptionsDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ChannelMappingOptionsDto::toJson() { QJsonObject result; + result["TunerChannels"] = toJsonValue>>(m_tunerChannels); + result["ProviderChannels"] = toJsonValue>>(m_providerChannels); + result["Mappings"] = toJsonValue>>(m_mappings); + result["ProviderName"] = toJsonValue(m_providerName); + return result; } -QList ChannelMappingOptionsDto::tunerChannels() const { return m_tunerChannels; } -void ChannelMappingOptionsDto::setTunerChannels(QList newTunerChannels) { + +QList> ChannelMappingOptionsDto::tunerChannels() const { return m_tunerChannels; } + +void ChannelMappingOptionsDto::setTunerChannels(QList> newTunerChannels) { m_tunerChannels = newTunerChannels; - emit tunerChannelsChanged(newTunerChannels); } +QList> ChannelMappingOptionsDto::providerChannels() const { return m_providerChannels; } -QList ChannelMappingOptionsDto::providerChannels() const { return m_providerChannels; } -void ChannelMappingOptionsDto::setProviderChannels(QList newProviderChannels) { +void ChannelMappingOptionsDto::setProviderChannels(QList> newProviderChannels) { m_providerChannels = newProviderChannels; - emit providerChannelsChanged(newProviderChannels); } +QList> ChannelMappingOptionsDto::mappings() const { return m_mappings; } -QList ChannelMappingOptionsDto::mappings() const { return m_mappings; } -void ChannelMappingOptionsDto::setMappings(QList newMappings) { +void ChannelMappingOptionsDto::setMappings(QList> newMappings) { m_mappings = newMappings; - emit mappingsChanged(newMappings); } - QString ChannelMappingOptionsDto::providerName() const { return m_providerName; } + void ChannelMappingOptionsDto::setProviderName(QString newProviderName) { m_providerName = newProviderName; - emit providerNameChanged(newProviderName); } diff --git a/core/src/DTO/chapterinfo.cpp b/core/src/DTO/chapterinfo.cpp index c2f0821..86d76a3 100644 --- a/core/src/DTO/chapterinfo.cpp +++ b/core/src/DTO/chapterinfo.cpp @@ -32,50 +32,58 @@ namespace Jellyfin { namespace DTO { -ChapterInfo::ChapterInfo(QObject *parent) : QObject(parent) {} +ChapterInfo::ChapterInfo(QObject *parent) {} -ChapterInfo *ChapterInfo::fromJSON(QJsonObject source, QObject *parent) { - ChapterInfo *instance = new ChapterInfo(parent); - instance->updateFromJSON(source); +ChapterInfo ChapterInfo::fromJson(QJsonObject source) {ChapterInfo instance; + instance->setFromJson(source, false); return instance; } -void ChapterInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ChapterInfo::setFromJson(QJsonObject source) { + m_startPositionTicks = fromJsonValue(source["StartPositionTicks"]); + m_name = fromJsonValue(source["Name"]); + m_imagePath = fromJsonValue(source["ImagePath"]); + m_imageDateModified = fromJsonValue(source["ImageDateModified"]); + m_imageTag = fromJsonValue(source["ImageTag"]); + } -QJsonObject ChapterInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ChapterInfo::toJson() { QJsonObject result; + result["StartPositionTicks"] = toJsonValue(m_startPositionTicks); + result["Name"] = toJsonValue(m_name); + result["ImagePath"] = toJsonValue(m_imagePath); + result["ImageDateModified"] = toJsonValue(m_imageDateModified); + result["ImageTag"] = toJsonValue(m_imageTag); + return result; } + qint64 ChapterInfo::startPositionTicks() const { return m_startPositionTicks; } + void ChapterInfo::setStartPositionTicks(qint64 newStartPositionTicks) { m_startPositionTicks = newStartPositionTicks; - emit startPositionTicksChanged(newStartPositionTicks); } - QString ChapterInfo::name() const { return m_name; } + void ChapterInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString ChapterInfo::imagePath() const { return m_imagePath; } + void ChapterInfo::setImagePath(QString newImagePath) { m_imagePath = newImagePath; - emit imagePathChanged(newImagePath); } - QDateTime ChapterInfo::imageDateModified() const { return m_imageDateModified; } + void ChapterInfo::setImageDateModified(QDateTime newImageDateModified) { m_imageDateModified = newImageDateModified; - emit imageDateModifiedChanged(newImageDateModified); } - QString ChapterInfo::imageTag() const { return m_imageTag; } + void ChapterInfo::setImageTag(QString newImageTag) { m_imageTag = newImageTag; - emit imageTagChanged(newImageTag); } diff --git a/core/src/DTO/clientcapabilities.cpp b/core/src/DTO/clientcapabilities.cpp index 0e8128a..f3d0e7c 100644 --- a/core/src/DTO/clientcapabilities.cpp +++ b/core/src/DTO/clientcapabilities.cpp @@ -29,85 +29,96 @@ #include -#include - namespace Jellyfin { namespace DTO { -ClientCapabilities::ClientCapabilities(QObject *parent) : QObject(parent) {} +ClientCapabilities::ClientCapabilities(QObject *parent) {} -ClientCapabilities *ClientCapabilities::fromJSON(QJsonObject source, QObject *parent) { - ClientCapabilities *instance = new ClientCapabilities(parent); - instance->updateFromJSON(source); +ClientCapabilities ClientCapabilities::fromJson(QJsonObject source) {ClientCapabilities instance; + instance->setFromJson(source, false); return instance; } -void ClientCapabilities::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ClientCapabilities::setFromJson(QJsonObject source) { + m_playableMediaTypes = fromJsonValue(source["PlayableMediaTypes"]); + m_supportedCommands = fromJsonValue>(source["SupportedCommands"]); + m_supportsMediaControl = fromJsonValue(source["SupportsMediaControl"]); + m_supportsContentUploading = fromJsonValue(source["SupportsContentUploading"]); + m_messageCallbackUrl = fromJsonValue(source["MessageCallbackUrl"]); + m_supportsPersistentIdentifier = fromJsonValue(source["SupportsPersistentIdentifier"]); + m_supportsSync = fromJsonValue(source["SupportsSync"]); + m_deviceProfile = fromJsonValue>(source["DeviceProfile"]); + m_appStoreUrl = fromJsonValue(source["AppStoreUrl"]); + m_iconUrl = fromJsonValue(source["IconUrl"]); + } -QJsonObject ClientCapabilities::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ClientCapabilities::toJson() { QJsonObject result; + result["PlayableMediaTypes"] = toJsonValue(m_playableMediaTypes); + result["SupportedCommands"] = toJsonValue>(m_supportedCommands); + result["SupportsMediaControl"] = toJsonValue(m_supportsMediaControl); + result["SupportsContentUploading"] = toJsonValue(m_supportsContentUploading); + result["MessageCallbackUrl"] = toJsonValue(m_messageCallbackUrl); + result["SupportsPersistentIdentifier"] = toJsonValue(m_supportsPersistentIdentifier); + result["SupportsSync"] = toJsonValue(m_supportsSync); + result["DeviceProfile"] = toJsonValue>(m_deviceProfile); + result["AppStoreUrl"] = toJsonValue(m_appStoreUrl); + result["IconUrl"] = toJsonValue(m_iconUrl); + return result; } + QStringList ClientCapabilities::playableMediaTypes() const { return m_playableMediaTypes; } + void ClientCapabilities::setPlayableMediaTypes(QStringList newPlayableMediaTypes) { m_playableMediaTypes = newPlayableMediaTypes; - emit playableMediaTypesChanged(newPlayableMediaTypes); } - QList ClientCapabilities::supportedCommands() const { return m_supportedCommands; } + void ClientCapabilities::setSupportedCommands(QList newSupportedCommands) { m_supportedCommands = newSupportedCommands; - emit supportedCommandsChanged(newSupportedCommands); } - bool ClientCapabilities::supportsMediaControl() const { return m_supportsMediaControl; } + void ClientCapabilities::setSupportsMediaControl(bool newSupportsMediaControl) { m_supportsMediaControl = newSupportsMediaControl; - emit supportsMediaControlChanged(newSupportsMediaControl); } - bool ClientCapabilities::supportsContentUploading() const { return m_supportsContentUploading; } + void ClientCapabilities::setSupportsContentUploading(bool newSupportsContentUploading) { m_supportsContentUploading = newSupportsContentUploading; - emit supportsContentUploadingChanged(newSupportsContentUploading); } - QString ClientCapabilities::messageCallbackUrl() const { return m_messageCallbackUrl; } + void ClientCapabilities::setMessageCallbackUrl(QString newMessageCallbackUrl) { m_messageCallbackUrl = newMessageCallbackUrl; - emit messageCallbackUrlChanged(newMessageCallbackUrl); } - bool ClientCapabilities::supportsPersistentIdentifier() const { return m_supportsPersistentIdentifier; } + void ClientCapabilities::setSupportsPersistentIdentifier(bool newSupportsPersistentIdentifier) { m_supportsPersistentIdentifier = newSupportsPersistentIdentifier; - emit supportsPersistentIdentifierChanged(newSupportsPersistentIdentifier); } - bool ClientCapabilities::supportsSync() const { return m_supportsSync; } + void ClientCapabilities::setSupportsSync(bool newSupportsSync) { m_supportsSync = newSupportsSync; - emit supportsSyncChanged(newSupportsSync); } +QSharedPointer ClientCapabilities::deviceProfile() const { return m_deviceProfile; } -DeviceProfile * ClientCapabilities::deviceProfile() const { return m_deviceProfile; } -void ClientCapabilities::setDeviceProfile(DeviceProfile * newDeviceProfile) { +void ClientCapabilities::setDeviceProfile(QSharedPointer newDeviceProfile) { m_deviceProfile = newDeviceProfile; - emit deviceProfileChanged(newDeviceProfile); } - QString ClientCapabilities::appStoreUrl() const { return m_appStoreUrl; } + void ClientCapabilities::setAppStoreUrl(QString newAppStoreUrl) { m_appStoreUrl = newAppStoreUrl; - emit appStoreUrlChanged(newAppStoreUrl); } - QString ClientCapabilities::iconUrl() const { return m_iconUrl; } + void ClientCapabilities::setIconUrl(QString newIconUrl) { m_iconUrl = newIconUrl; - emit iconUrlChanged(newIconUrl); } diff --git a/core/src/DTO/clientcapabilitiesdto.cpp b/core/src/DTO/clientcapabilitiesdto.cpp index 51b038a..a37e83d 100644 --- a/core/src/DTO/clientcapabilitiesdto.cpp +++ b/core/src/DTO/clientcapabilitiesdto.cpp @@ -29,85 +29,96 @@ #include -#include - namespace Jellyfin { namespace DTO { -ClientCapabilitiesDto::ClientCapabilitiesDto(QObject *parent) : QObject(parent) {} +ClientCapabilitiesDto::ClientCapabilitiesDto(QObject *parent) {} -ClientCapabilitiesDto *ClientCapabilitiesDto::fromJSON(QJsonObject source, QObject *parent) { - ClientCapabilitiesDto *instance = new ClientCapabilitiesDto(parent); - instance->updateFromJSON(source); +ClientCapabilitiesDto ClientCapabilitiesDto::fromJson(QJsonObject source) {ClientCapabilitiesDto instance; + instance->setFromJson(source, false); return instance; } -void ClientCapabilitiesDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ClientCapabilitiesDto::setFromJson(QJsonObject source) { + m_playableMediaTypes = fromJsonValue(source["PlayableMediaTypes"]); + m_supportedCommands = fromJsonValue>(source["SupportedCommands"]); + m_supportsMediaControl = fromJsonValue(source["SupportsMediaControl"]); + m_supportsContentUploading = fromJsonValue(source["SupportsContentUploading"]); + m_messageCallbackUrl = fromJsonValue(source["MessageCallbackUrl"]); + m_supportsPersistentIdentifier = fromJsonValue(source["SupportsPersistentIdentifier"]); + m_supportsSync = fromJsonValue(source["SupportsSync"]); + m_deviceProfile = fromJsonValue>(source["DeviceProfile"]); + m_appStoreUrl = fromJsonValue(source["AppStoreUrl"]); + m_iconUrl = fromJsonValue(source["IconUrl"]); + } -QJsonObject ClientCapabilitiesDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ClientCapabilitiesDto::toJson() { QJsonObject result; + result["PlayableMediaTypes"] = toJsonValue(m_playableMediaTypes); + result["SupportedCommands"] = toJsonValue>(m_supportedCommands); + result["SupportsMediaControl"] = toJsonValue(m_supportsMediaControl); + result["SupportsContentUploading"] = toJsonValue(m_supportsContentUploading); + result["MessageCallbackUrl"] = toJsonValue(m_messageCallbackUrl); + result["SupportsPersistentIdentifier"] = toJsonValue(m_supportsPersistentIdentifier); + result["SupportsSync"] = toJsonValue(m_supportsSync); + result["DeviceProfile"] = toJsonValue>(m_deviceProfile); + result["AppStoreUrl"] = toJsonValue(m_appStoreUrl); + result["IconUrl"] = toJsonValue(m_iconUrl); + return result; } + QStringList ClientCapabilitiesDto::playableMediaTypes() const { return m_playableMediaTypes; } + void ClientCapabilitiesDto::setPlayableMediaTypes(QStringList newPlayableMediaTypes) { m_playableMediaTypes = newPlayableMediaTypes; - emit playableMediaTypesChanged(newPlayableMediaTypes); } - QList ClientCapabilitiesDto::supportedCommands() const { return m_supportedCommands; } + void ClientCapabilitiesDto::setSupportedCommands(QList newSupportedCommands) { m_supportedCommands = newSupportedCommands; - emit supportedCommandsChanged(newSupportedCommands); } - bool ClientCapabilitiesDto::supportsMediaControl() const { return m_supportsMediaControl; } + void ClientCapabilitiesDto::setSupportsMediaControl(bool newSupportsMediaControl) { m_supportsMediaControl = newSupportsMediaControl; - emit supportsMediaControlChanged(newSupportsMediaControl); } - bool ClientCapabilitiesDto::supportsContentUploading() const { return m_supportsContentUploading; } + void ClientCapabilitiesDto::setSupportsContentUploading(bool newSupportsContentUploading) { m_supportsContentUploading = newSupportsContentUploading; - emit supportsContentUploadingChanged(newSupportsContentUploading); } - QString ClientCapabilitiesDto::messageCallbackUrl() const { return m_messageCallbackUrl; } + void ClientCapabilitiesDto::setMessageCallbackUrl(QString newMessageCallbackUrl) { m_messageCallbackUrl = newMessageCallbackUrl; - emit messageCallbackUrlChanged(newMessageCallbackUrl); } - bool ClientCapabilitiesDto::supportsPersistentIdentifier() const { return m_supportsPersistentIdentifier; } + void ClientCapabilitiesDto::setSupportsPersistentIdentifier(bool newSupportsPersistentIdentifier) { m_supportsPersistentIdentifier = newSupportsPersistentIdentifier; - emit supportsPersistentIdentifierChanged(newSupportsPersistentIdentifier); } - bool ClientCapabilitiesDto::supportsSync() const { return m_supportsSync; } + void ClientCapabilitiesDto::setSupportsSync(bool newSupportsSync) { m_supportsSync = newSupportsSync; - emit supportsSyncChanged(newSupportsSync); } +QSharedPointer ClientCapabilitiesDto::deviceProfile() const { return m_deviceProfile; } -DeviceProfile * ClientCapabilitiesDto::deviceProfile() const { return m_deviceProfile; } -void ClientCapabilitiesDto::setDeviceProfile(DeviceProfile * newDeviceProfile) { +void ClientCapabilitiesDto::setDeviceProfile(QSharedPointer newDeviceProfile) { m_deviceProfile = newDeviceProfile; - emit deviceProfileChanged(newDeviceProfile); } - QString ClientCapabilitiesDto::appStoreUrl() const { return m_appStoreUrl; } + void ClientCapabilitiesDto::setAppStoreUrl(QString newAppStoreUrl) { m_appStoreUrl = newAppStoreUrl; - emit appStoreUrlChanged(newAppStoreUrl); } - QString ClientCapabilitiesDto::iconUrl() const { return m_iconUrl; } + void ClientCapabilitiesDto::setIconUrl(QString newIconUrl) { m_iconUrl = newIconUrl; - emit iconUrlChanged(newIconUrl); } diff --git a/core/src/DTO/codecprofile.cpp b/core/src/DTO/codecprofile.cpp index 8eb1b52..87a6d14 100644 --- a/core/src/DTO/codecprofile.cpp +++ b/core/src/DTO/codecprofile.cpp @@ -29,55 +29,61 @@ #include -#include - namespace Jellyfin { namespace DTO { -CodecProfile::CodecProfile(QObject *parent) : QObject(parent) {} +CodecProfile::CodecProfile(QObject *parent) {} -CodecProfile *CodecProfile::fromJSON(QJsonObject source, QObject *parent) { - CodecProfile *instance = new CodecProfile(parent); - instance->updateFromJSON(source); +CodecProfile CodecProfile::fromJson(QJsonObject source) {CodecProfile instance; + instance->setFromJson(source, false); return instance; } -void CodecProfile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void CodecProfile::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["Type"]); + m_conditions = fromJsonValue>>(source["Conditions"]); + m_applyConditions = fromJsonValue>>(source["ApplyConditions"]); + m_codec = fromJsonValue(source["Codec"]); + m_container = fromJsonValue(source["Container"]); + } -QJsonObject CodecProfile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject CodecProfile::toJson() { QJsonObject result; + result["Type"] = toJsonValue(m_type); + result["Conditions"] = toJsonValue>>(m_conditions); + result["ApplyConditions"] = toJsonValue>>(m_applyConditions); + result["Codec"] = toJsonValue(m_codec); + result["Container"] = toJsonValue(m_container); + return result; } + CodecType CodecProfile::type() const { return m_type; } + void CodecProfile::setType(CodecType newType) { m_type = newType; - emit typeChanged(newType); } +QList> CodecProfile::conditions() const { return m_conditions; } -QList CodecProfile::conditions() const { return m_conditions; } -void CodecProfile::setConditions(QList newConditions) { +void CodecProfile::setConditions(QList> newConditions) { m_conditions = newConditions; - emit conditionsChanged(newConditions); } +QList> CodecProfile::applyConditions() const { return m_applyConditions; } -QList CodecProfile::applyConditions() const { return m_applyConditions; } -void CodecProfile::setApplyConditions(QList newApplyConditions) { +void CodecProfile::setApplyConditions(QList> newApplyConditions) { m_applyConditions = newApplyConditions; - emit applyConditionsChanged(newApplyConditions); } - QString CodecProfile::codec() const { return m_codec; } + void CodecProfile::setCodec(QString newCodec) { m_codec = newCodec; - emit codecChanged(newCodec); } - QString CodecProfile::container() const { return m_container; } + void CodecProfile::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } diff --git a/core/src/DTO/collectioncreationresult.cpp b/core/src/DTO/collectioncreationresult.cpp index fef9a15..318934e 100644 --- a/core/src/DTO/collectioncreationresult.cpp +++ b/core/src/DTO/collectioncreationresult.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -CollectionCreationResult::CollectionCreationResult(QObject *parent) : QObject(parent) {} +CollectionCreationResult::CollectionCreationResult(QObject *parent) {} -CollectionCreationResult *CollectionCreationResult::fromJSON(QJsonObject source, QObject *parent) { - CollectionCreationResult *instance = new CollectionCreationResult(parent); - instance->updateFromJSON(source); +CollectionCreationResult CollectionCreationResult::fromJson(QJsonObject source) {CollectionCreationResult instance; + instance->setFromJson(source, false); return instance; } -void CollectionCreationResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void CollectionCreationResult::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + } -QJsonObject CollectionCreationResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject CollectionCreationResult::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + return result; } -QString CollectionCreationResult::jellyfinId() const { return m_jellyfinId; } -void CollectionCreationResult::setJellyfinId(QString newJellyfinId) { + +QUuid CollectionCreationResult::jellyfinId() const { return m_jellyfinId; } + +void CollectionCreationResult::setJellyfinId(QUuid newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } diff --git a/core/src/DTO/configurationpageinfo.cpp b/core/src/DTO/configurationpageinfo.cpp index d55fedb..42ef061 100644 --- a/core/src/DTO/configurationpageinfo.cpp +++ b/core/src/DTO/configurationpageinfo.cpp @@ -29,67 +29,75 @@ #include -#include - namespace Jellyfin { namespace DTO { -ConfigurationPageInfo::ConfigurationPageInfo(QObject *parent) : QObject(parent) {} +ConfigurationPageInfo::ConfigurationPageInfo(QObject *parent) {} -ConfigurationPageInfo *ConfigurationPageInfo::fromJSON(QJsonObject source, QObject *parent) { - ConfigurationPageInfo *instance = new ConfigurationPageInfo(parent); - instance->updateFromJSON(source); +ConfigurationPageInfo ConfigurationPageInfo::fromJson(QJsonObject source) {ConfigurationPageInfo instance; + instance->setFromJson(source, false); return instance; } -void ConfigurationPageInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ConfigurationPageInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_enableInMainMenu = fromJsonValue(source["EnableInMainMenu"]); + m_menuSection = fromJsonValue(source["MenuSection"]); + m_menuIcon = fromJsonValue(source["MenuIcon"]); + m_displayName = fromJsonValue(source["DisplayName"]); + m_configurationPageType = fromJsonValue(source["ConfigurationPageType"]); + m_pluginId = fromJsonValue(source["PluginId"]); + } -QJsonObject ConfigurationPageInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ConfigurationPageInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["EnableInMainMenu"] = toJsonValue(m_enableInMainMenu); + result["MenuSection"] = toJsonValue(m_menuSection); + result["MenuIcon"] = toJsonValue(m_menuIcon); + result["DisplayName"] = toJsonValue(m_displayName); + result["ConfigurationPageType"] = toJsonValue(m_configurationPageType); + result["PluginId"] = toJsonValue(m_pluginId); + return result; } + QString ConfigurationPageInfo::name() const { return m_name; } + void ConfigurationPageInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - bool ConfigurationPageInfo::enableInMainMenu() const { return m_enableInMainMenu; } + void ConfigurationPageInfo::setEnableInMainMenu(bool newEnableInMainMenu) { m_enableInMainMenu = newEnableInMainMenu; - emit enableInMainMenuChanged(newEnableInMainMenu); } - QString ConfigurationPageInfo::menuSection() const { return m_menuSection; } + void ConfigurationPageInfo::setMenuSection(QString newMenuSection) { m_menuSection = newMenuSection; - emit menuSectionChanged(newMenuSection); } - QString ConfigurationPageInfo::menuIcon() const { return m_menuIcon; } + void ConfigurationPageInfo::setMenuIcon(QString newMenuIcon) { m_menuIcon = newMenuIcon; - emit menuIconChanged(newMenuIcon); } - QString ConfigurationPageInfo::displayName() const { return m_displayName; } + void ConfigurationPageInfo::setDisplayName(QString newDisplayName) { m_displayName = newDisplayName; - emit displayNameChanged(newDisplayName); } - ConfigurationPageType ConfigurationPageInfo::configurationPageType() const { return m_configurationPageType; } + void ConfigurationPageInfo::setConfigurationPageType(ConfigurationPageType newConfigurationPageType) { m_configurationPageType = newConfigurationPageType; - emit configurationPageTypeChanged(newConfigurationPageType); } +QUuid ConfigurationPageInfo::pluginId() const { return m_pluginId; } -QString ConfigurationPageInfo::pluginId() const { return m_pluginId; } -void ConfigurationPageInfo::setPluginId(QString newPluginId) { +void ConfigurationPageInfo::setPluginId(QUuid newPluginId) { m_pluginId = newPluginId; - emit pluginIdChanged(newPluginId); } diff --git a/core/src/DTO/containerprofile.cpp b/core/src/DTO/containerprofile.cpp index 21c28f6..d0cca95 100644 --- a/core/src/DTO/containerprofile.cpp +++ b/core/src/DTO/containerprofile.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -ContainerProfile::ContainerProfile(QObject *parent) : QObject(parent) {} +ContainerProfile::ContainerProfile(QObject *parent) {} -ContainerProfile *ContainerProfile::fromJSON(QJsonObject source, QObject *parent) { - ContainerProfile *instance = new ContainerProfile(parent); - instance->updateFromJSON(source); +ContainerProfile ContainerProfile::fromJson(QJsonObject source) {ContainerProfile instance; + instance->setFromJson(source, false); return instance; } -void ContainerProfile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ContainerProfile::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["Type"]); + m_conditions = fromJsonValue>>(source["Conditions"]); + m_container = fromJsonValue(source["Container"]); + } -QJsonObject ContainerProfile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ContainerProfile::toJson() { QJsonObject result; + result["Type"] = toJsonValue(m_type); + result["Conditions"] = toJsonValue>>(m_conditions); + result["Container"] = toJsonValue(m_container); + return result; } + DlnaProfileType ContainerProfile::type() const { return m_type; } + void ContainerProfile::setType(DlnaProfileType newType) { m_type = newType; - emit typeChanged(newType); } +QList> ContainerProfile::conditions() const { return m_conditions; } -QList ContainerProfile::conditions() const { return m_conditions; } -void ContainerProfile::setConditions(QList newConditions) { +void ContainerProfile::setConditions(QList> newConditions) { m_conditions = newConditions; - emit conditionsChanged(newConditions); } - QString ContainerProfile::container() const { return m_container; } + void ContainerProfile::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } diff --git a/core/src/DTO/controlresponse.cpp b/core/src/DTO/controlresponse.cpp index 2084c4d..529f77e 100644 --- a/core/src/DTO/controlresponse.cpp +++ b/core/src/DTO/controlresponse.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -ControlResponse::ControlResponse(QObject *parent) : QObject(parent) {} +ControlResponse::ControlResponse(QObject *parent) {} -ControlResponse *ControlResponse::fromJSON(QJsonObject source, QObject *parent) { - ControlResponse *instance = new ControlResponse(parent); - instance->updateFromJSON(source); +ControlResponse ControlResponse::fromJson(QJsonObject source) {ControlResponse instance; + instance->setFromJson(source, false); return instance; } -void ControlResponse::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ControlResponse::setFromJson(QJsonObject source) { + m_headers = fromJsonValue(source["Headers"]); + m_xml = fromJsonValue(source["Xml"]); + m_isSuccessful = fromJsonValue(source["IsSuccessful"]); + } -QJsonObject ControlResponse::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ControlResponse::toJson() { QJsonObject result; + result["Headers"] = toJsonValue(m_headers); + result["Xml"] = toJsonValue(m_xml); + result["IsSuccessful"] = toJsonValue(m_isSuccessful); + return result; } + QJsonObject ControlResponse::headers() const { return m_headers; } + void ControlResponse::setHeaders(QJsonObject newHeaders) { m_headers = newHeaders; - emit headersChanged(newHeaders); } - QString ControlResponse::xml() const { return m_xml; } + void ControlResponse::setXml(QString newXml) { m_xml = newXml; - emit xmlChanged(newXml); } - bool ControlResponse::isSuccessful() const { return m_isSuccessful; } + void ControlResponse::setIsSuccessful(bool newIsSuccessful) { m_isSuccessful = newIsSuccessful; - emit isSuccessfulChanged(newIsSuccessful); } diff --git a/core/src/DTO/countryinfo.cpp b/core/src/DTO/countryinfo.cpp index 822fbe8..f6f2053 100644 --- a/core/src/DTO/countryinfo.cpp +++ b/core/src/DTO/countryinfo.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -CountryInfo::CountryInfo(QObject *parent) : QObject(parent) {} +CountryInfo::CountryInfo(QObject *parent) {} -CountryInfo *CountryInfo::fromJSON(QJsonObject source, QObject *parent) { - CountryInfo *instance = new CountryInfo(parent); - instance->updateFromJSON(source); +CountryInfo CountryInfo::fromJson(QJsonObject source) {CountryInfo instance; + instance->setFromJson(source, false); return instance; } -void CountryInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void CountryInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_displayName = fromJsonValue(source["DisplayName"]); + m_twoLetterISORegionName = fromJsonValue(source["TwoLetterISORegionName"]); + m_threeLetterISORegionName = fromJsonValue(source["ThreeLetterISORegionName"]); + } -QJsonObject CountryInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject CountryInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["DisplayName"] = toJsonValue(m_displayName); + result["TwoLetterISORegionName"] = toJsonValue(m_twoLetterISORegionName); + result["ThreeLetterISORegionName"] = toJsonValue(m_threeLetterISORegionName); + return result; } + QString CountryInfo::name() const { return m_name; } + void CountryInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString CountryInfo::displayName() const { return m_displayName; } + void CountryInfo::setDisplayName(QString newDisplayName) { m_displayName = newDisplayName; - emit displayNameChanged(newDisplayName); } - QString CountryInfo::twoLetterISORegionName() const { return m_twoLetterISORegionName; } + void CountryInfo::setTwoLetterISORegionName(QString newTwoLetterISORegionName) { m_twoLetterISORegionName = newTwoLetterISORegionName; - emit twoLetterISORegionNameChanged(newTwoLetterISORegionName); } - QString CountryInfo::threeLetterISORegionName() const { return m_threeLetterISORegionName; } + void CountryInfo::setThreeLetterISORegionName(QString newThreeLetterISORegionName) { m_threeLetterISORegionName = newThreeLetterISORegionName; - emit threeLetterISORegionNameChanged(newThreeLetterISORegionName); } diff --git a/core/src/DTO/createplaylistdto.cpp b/core/src/DTO/createplaylistdto.cpp index 2b57770..b9a859d 100644 --- a/core/src/DTO/createplaylistdto.cpp +++ b/core/src/DTO/createplaylistdto.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -CreatePlaylistDto::CreatePlaylistDto(QObject *parent) : QObject(parent) {} +CreatePlaylistDto::CreatePlaylistDto(QObject *parent) {} -CreatePlaylistDto *CreatePlaylistDto::fromJSON(QJsonObject source, QObject *parent) { - CreatePlaylistDto *instance = new CreatePlaylistDto(parent); - instance->updateFromJSON(source); +CreatePlaylistDto CreatePlaylistDto::fromJson(QJsonObject source) {CreatePlaylistDto instance; + instance->setFromJson(source, false); return instance; } -void CreatePlaylistDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void CreatePlaylistDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_ids = fromJsonValue>(source["Ids"]); + m_userId = fromJsonValue(source["UserId"]); + m_mediaType = fromJsonValue(source["MediaType"]); + } -QJsonObject CreatePlaylistDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject CreatePlaylistDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Ids"] = toJsonValue>(m_ids); + result["UserId"] = toJsonValue(m_userId); + result["MediaType"] = toJsonValue(m_mediaType); + return result; } + QString CreatePlaylistDto::name() const { return m_name; } + void CreatePlaylistDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } +QList CreatePlaylistDto::ids() const { return m_ids; } -QStringList CreatePlaylistDto::ids() const { return m_ids; } -void CreatePlaylistDto::setIds(QStringList newIds) { +void CreatePlaylistDto::setIds(QList newIds) { m_ids = newIds; - emit idsChanged(newIds); } +QUuid CreatePlaylistDto::userId() const { return m_userId; } -QString CreatePlaylistDto::userId() const { return m_userId; } -void CreatePlaylistDto::setUserId(QString newUserId) { +void CreatePlaylistDto::setUserId(QUuid newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - QString CreatePlaylistDto::mediaType() const { return m_mediaType; } + void CreatePlaylistDto::setMediaType(QString newMediaType) { m_mediaType = newMediaType; - emit mediaTypeChanged(newMediaType); } diff --git a/core/src/DTO/createuserbyname.cpp b/core/src/DTO/createuserbyname.cpp index b0b08f4..dc13016 100644 --- a/core/src/DTO/createuserbyname.cpp +++ b/core/src/DTO/createuserbyname.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -CreateUserByName::CreateUserByName(QObject *parent) : QObject(parent) {} +CreateUserByName::CreateUserByName(QObject *parent) {} -CreateUserByName *CreateUserByName::fromJSON(QJsonObject source, QObject *parent) { - CreateUserByName *instance = new CreateUserByName(parent); - instance->updateFromJSON(source); +CreateUserByName CreateUserByName::fromJson(QJsonObject source) {CreateUserByName instance; + instance->setFromJson(source, false); return instance; } -void CreateUserByName::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void CreateUserByName::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_password = fromJsonValue(source["Password"]); + } -QJsonObject CreateUserByName::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject CreateUserByName::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Password"] = toJsonValue(m_password); + return result; } + QString CreateUserByName::name() const { return m_name; } + void CreateUserByName::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString CreateUserByName::password() const { return m_password; } + void CreateUserByName::setPassword(QString newPassword) { m_password = newPassword; - emit passwordChanged(newPassword); } diff --git a/core/src/DTO/culturedto.cpp b/core/src/DTO/culturedto.cpp index ea35630..e183080 100644 --- a/core/src/DTO/culturedto.cpp +++ b/core/src/DTO/culturedto.cpp @@ -32,50 +32,58 @@ namespace Jellyfin { namespace DTO { -CultureDto::CultureDto(QObject *parent) : QObject(parent) {} +CultureDto::CultureDto(QObject *parent) {} -CultureDto *CultureDto::fromJSON(QJsonObject source, QObject *parent) { - CultureDto *instance = new CultureDto(parent); - instance->updateFromJSON(source); +CultureDto CultureDto::fromJson(QJsonObject source) {CultureDto instance; + instance->setFromJson(source, false); return instance; } -void CultureDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void CultureDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_displayName = fromJsonValue(source["DisplayName"]); + m_twoLetterISOLanguageName = fromJsonValue(source["TwoLetterISOLanguageName"]); + m_threeLetterISOLanguageName = fromJsonValue(source["ThreeLetterISOLanguageName"]); + m_threeLetterISOLanguageNames = fromJsonValue(source["ThreeLetterISOLanguageNames"]); + } -QJsonObject CultureDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject CultureDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["DisplayName"] = toJsonValue(m_displayName); + result["TwoLetterISOLanguageName"] = toJsonValue(m_twoLetterISOLanguageName); + result["ThreeLetterISOLanguageName"] = toJsonValue(m_threeLetterISOLanguageName); + result["ThreeLetterISOLanguageNames"] = toJsonValue(m_threeLetterISOLanguageNames); + return result; } + QString CultureDto::name() const { return m_name; } + void CultureDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString CultureDto::displayName() const { return m_displayName; } + void CultureDto::setDisplayName(QString newDisplayName) { m_displayName = newDisplayName; - emit displayNameChanged(newDisplayName); } - QString CultureDto::twoLetterISOLanguageName() const { return m_twoLetterISOLanguageName; } + void CultureDto::setTwoLetterISOLanguageName(QString newTwoLetterISOLanguageName) { m_twoLetterISOLanguageName = newTwoLetterISOLanguageName; - emit twoLetterISOLanguageNameChanged(newTwoLetterISOLanguageName); } - QString CultureDto::threeLetterISOLanguageName() const { return m_threeLetterISOLanguageName; } + void CultureDto::setThreeLetterISOLanguageName(QString newThreeLetterISOLanguageName) { m_threeLetterISOLanguageName = newThreeLetterISOLanguageName; - emit threeLetterISOLanguageNameChanged(newThreeLetterISOLanguageName); } - QStringList CultureDto::threeLetterISOLanguageNames() const { return m_threeLetterISOLanguageNames; } + void CultureDto::setThreeLetterISOLanguageNames(QStringList newThreeLetterISOLanguageNames) { m_threeLetterISOLanguageNames = newThreeLetterISOLanguageNames; - emit threeLetterISOLanguageNamesChanged(newThreeLetterISOLanguageNames); } diff --git a/core/src/DTO/defaultdirectorybrowserinfodto.cpp b/core/src/DTO/defaultdirectorybrowserinfodto.cpp index f160af1..ad03f9c 100644 --- a/core/src/DTO/defaultdirectorybrowserinfodto.cpp +++ b/core/src/DTO/defaultdirectorybrowserinfodto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -DefaultDirectoryBrowserInfoDto::DefaultDirectoryBrowserInfoDto(QObject *parent) : QObject(parent) {} +DefaultDirectoryBrowserInfoDto::DefaultDirectoryBrowserInfoDto(QObject *parent) {} -DefaultDirectoryBrowserInfoDto *DefaultDirectoryBrowserInfoDto::fromJSON(QJsonObject source, QObject *parent) { - DefaultDirectoryBrowserInfoDto *instance = new DefaultDirectoryBrowserInfoDto(parent); - instance->updateFromJSON(source); +DefaultDirectoryBrowserInfoDto DefaultDirectoryBrowserInfoDto::fromJson(QJsonObject source) {DefaultDirectoryBrowserInfoDto instance; + instance->setFromJson(source, false); return instance; } -void DefaultDirectoryBrowserInfoDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DefaultDirectoryBrowserInfoDto::setFromJson(QJsonObject source) { + m_path = fromJsonValue(source["Path"]); + } -QJsonObject DefaultDirectoryBrowserInfoDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DefaultDirectoryBrowserInfoDto::toJson() { QJsonObject result; + result["Path"] = toJsonValue(m_path); + return result; } + QString DefaultDirectoryBrowserInfoDto::path() const { return m_path; } + void DefaultDirectoryBrowserInfoDto::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } diff --git a/core/src/DTO/deviceidentification.cpp b/core/src/DTO/deviceidentification.cpp index 2447a40..4af656f 100644 --- a/core/src/DTO/deviceidentification.cpp +++ b/core/src/DTO/deviceidentification.cpp @@ -32,74 +32,86 @@ namespace Jellyfin { namespace DTO { -DeviceIdentification::DeviceIdentification(QObject *parent) : QObject(parent) {} +DeviceIdentification::DeviceIdentification(QObject *parent) {} -DeviceIdentification *DeviceIdentification::fromJSON(QJsonObject source, QObject *parent) { - DeviceIdentification *instance = new DeviceIdentification(parent); - instance->updateFromJSON(source); +DeviceIdentification DeviceIdentification::fromJson(QJsonObject source) {DeviceIdentification instance; + instance->setFromJson(source, false); return instance; } -void DeviceIdentification::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DeviceIdentification::setFromJson(QJsonObject source) { + m_friendlyName = fromJsonValue(source["FriendlyName"]); + m_modelNumber = fromJsonValue(source["ModelNumber"]); + m_serialNumber = fromJsonValue(source["SerialNumber"]); + m_modelName = fromJsonValue(source["ModelName"]); + m_modelDescription = fromJsonValue(source["ModelDescription"]); + m_modelUrl = fromJsonValue(source["ModelUrl"]); + m_manufacturer = fromJsonValue(source["Manufacturer"]); + m_manufacturerUrl = fromJsonValue(source["ManufacturerUrl"]); + m_headers = fromJsonValue>>(source["Headers"]); + } -QJsonObject DeviceIdentification::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DeviceIdentification::toJson() { QJsonObject result; + result["FriendlyName"] = toJsonValue(m_friendlyName); + result["ModelNumber"] = toJsonValue(m_modelNumber); + result["SerialNumber"] = toJsonValue(m_serialNumber); + result["ModelName"] = toJsonValue(m_modelName); + result["ModelDescription"] = toJsonValue(m_modelDescription); + result["ModelUrl"] = toJsonValue(m_modelUrl); + result["Manufacturer"] = toJsonValue(m_manufacturer); + result["ManufacturerUrl"] = toJsonValue(m_manufacturerUrl); + result["Headers"] = toJsonValue>>(m_headers); + return result; } + QString DeviceIdentification::friendlyName() const { return m_friendlyName; } + void DeviceIdentification::setFriendlyName(QString newFriendlyName) { m_friendlyName = newFriendlyName; - emit friendlyNameChanged(newFriendlyName); } - QString DeviceIdentification::modelNumber() const { return m_modelNumber; } + void DeviceIdentification::setModelNumber(QString newModelNumber) { m_modelNumber = newModelNumber; - emit modelNumberChanged(newModelNumber); } - QString DeviceIdentification::serialNumber() const { return m_serialNumber; } + void DeviceIdentification::setSerialNumber(QString newSerialNumber) { m_serialNumber = newSerialNumber; - emit serialNumberChanged(newSerialNumber); } - QString DeviceIdentification::modelName() const { return m_modelName; } + void DeviceIdentification::setModelName(QString newModelName) { m_modelName = newModelName; - emit modelNameChanged(newModelName); } - QString DeviceIdentification::modelDescription() const { return m_modelDescription; } + void DeviceIdentification::setModelDescription(QString newModelDescription) { m_modelDescription = newModelDescription; - emit modelDescriptionChanged(newModelDescription); } - QString DeviceIdentification::modelUrl() const { return m_modelUrl; } + void DeviceIdentification::setModelUrl(QString newModelUrl) { m_modelUrl = newModelUrl; - emit modelUrlChanged(newModelUrl); } - QString DeviceIdentification::manufacturer() const { return m_manufacturer; } + void DeviceIdentification::setManufacturer(QString newManufacturer) { m_manufacturer = newManufacturer; - emit manufacturerChanged(newManufacturer); } - QString DeviceIdentification::manufacturerUrl() const { return m_manufacturerUrl; } + void DeviceIdentification::setManufacturerUrl(QString newManufacturerUrl) { m_manufacturerUrl = newManufacturerUrl; - emit manufacturerUrlChanged(newManufacturerUrl); } +QList> DeviceIdentification::headers() const { return m_headers; } -QList DeviceIdentification::headers() const { return m_headers; } -void DeviceIdentification::setHeaders(QList newHeaders) { +void DeviceIdentification::setHeaders(QList> newHeaders) { m_headers = newHeaders; - emit headersChanged(newHeaders); } diff --git a/core/src/DTO/deviceinfo.cpp b/core/src/DTO/deviceinfo.cpp index 22b28f1..4c339c3 100644 --- a/core/src/DTO/deviceinfo.cpp +++ b/core/src/DTO/deviceinfo.cpp @@ -32,74 +32,86 @@ namespace Jellyfin { namespace DTO { -DeviceInfo::DeviceInfo(QObject *parent) : QObject(parent) {} +DeviceInfo::DeviceInfo(QObject *parent) {} -DeviceInfo *DeviceInfo::fromJSON(QJsonObject source, QObject *parent) { - DeviceInfo *instance = new DeviceInfo(parent); - instance->updateFromJSON(source); +DeviceInfo DeviceInfo::fromJson(QJsonObject source) {DeviceInfo instance; + instance->setFromJson(source, false); return instance; } -void DeviceInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DeviceInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_lastUserName = fromJsonValue(source["LastUserName"]); + m_appName = fromJsonValue(source["AppName"]); + m_appVersion = fromJsonValue(source["AppVersion"]); + m_lastUserId = fromJsonValue(source["LastUserId"]); + m_dateLastActivity = fromJsonValue(source["DateLastActivity"]); + m_capabilities = fromJsonValue>(source["Capabilities"]); + m_iconUrl = fromJsonValue(source["IconUrl"]); + } -QJsonObject DeviceInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DeviceInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Id"] = toJsonValue(m_jellyfinId); + result["LastUserName"] = toJsonValue(m_lastUserName); + result["AppName"] = toJsonValue(m_appName); + result["AppVersion"] = toJsonValue(m_appVersion); + result["LastUserId"] = toJsonValue(m_lastUserId); + result["DateLastActivity"] = toJsonValue(m_dateLastActivity); + result["Capabilities"] = toJsonValue>(m_capabilities); + result["IconUrl"] = toJsonValue(m_iconUrl); + return result; } + QString DeviceInfo::name() const { return m_name; } + void DeviceInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString DeviceInfo::jellyfinId() const { return m_jellyfinId; } + void DeviceInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString DeviceInfo::lastUserName() const { return m_lastUserName; } + void DeviceInfo::setLastUserName(QString newLastUserName) { m_lastUserName = newLastUserName; - emit lastUserNameChanged(newLastUserName); } - QString DeviceInfo::appName() const { return m_appName; } + void DeviceInfo::setAppName(QString newAppName) { m_appName = newAppName; - emit appNameChanged(newAppName); } - QString DeviceInfo::appVersion() const { return m_appVersion; } + void DeviceInfo::setAppVersion(QString newAppVersion) { m_appVersion = newAppVersion; - emit appVersionChanged(newAppVersion); } +QUuid DeviceInfo::lastUserId() const { return m_lastUserId; } -QString DeviceInfo::lastUserId() const { return m_lastUserId; } -void DeviceInfo::setLastUserId(QString newLastUserId) { +void DeviceInfo::setLastUserId(QUuid newLastUserId) { m_lastUserId = newLastUserId; - emit lastUserIdChanged(newLastUserId); } - QDateTime DeviceInfo::dateLastActivity() const { return m_dateLastActivity; } + void DeviceInfo::setDateLastActivity(QDateTime newDateLastActivity) { m_dateLastActivity = newDateLastActivity; - emit dateLastActivityChanged(newDateLastActivity); } +QSharedPointer DeviceInfo::capabilities() const { return m_capabilities; } -ClientCapabilities * DeviceInfo::capabilities() const { return m_capabilities; } -void DeviceInfo::setCapabilities(ClientCapabilities * newCapabilities) { +void DeviceInfo::setCapabilities(QSharedPointer newCapabilities) { m_capabilities = newCapabilities; - emit capabilitiesChanged(newCapabilities); } - QString DeviceInfo::iconUrl() const { return m_iconUrl; } + void DeviceInfo::setIconUrl(QString newIconUrl) { m_iconUrl = newIconUrl; - emit iconUrlChanged(newIconUrl); } diff --git a/core/src/DTO/deviceinfoqueryresult.cpp b/core/src/DTO/deviceinfoqueryresult.cpp index 4acd4c1..d4d9c08 100644 --- a/core/src/DTO/deviceinfoqueryresult.cpp +++ b/core/src/DTO/deviceinfoqueryresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -DeviceInfoQueryResult::DeviceInfoQueryResult(QObject *parent) : QObject(parent) {} +DeviceInfoQueryResult::DeviceInfoQueryResult(QObject *parent) {} -DeviceInfoQueryResult *DeviceInfoQueryResult::fromJSON(QJsonObject source, QObject *parent) { - DeviceInfoQueryResult *instance = new DeviceInfoQueryResult(parent); - instance->updateFromJSON(source); +DeviceInfoQueryResult DeviceInfoQueryResult::fromJson(QJsonObject source) {DeviceInfoQueryResult instance; + instance->setFromJson(source, false); return instance; } -void DeviceInfoQueryResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DeviceInfoQueryResult::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + } -QJsonObject DeviceInfoQueryResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DeviceInfoQueryResult::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["StartIndex"] = toJsonValue(m_startIndex); + return result; } -QList DeviceInfoQueryResult::items() const { return m_items; } -void DeviceInfoQueryResult::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> DeviceInfoQueryResult::items() const { return m_items; } + +void DeviceInfoQueryResult::setItems(QList> newItems) { + m_items = newItems; +} qint32 DeviceInfoQueryResult::totalRecordCount() const { return m_totalRecordCount; } + void DeviceInfoQueryResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - qint32 DeviceInfoQueryResult::startIndex() const { return m_startIndex; } + void DeviceInfoQueryResult::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } diff --git a/core/src/DTO/deviceoptions.cpp b/core/src/DTO/deviceoptions.cpp index 7446dba..e3f1cef 100644 --- a/core/src/DTO/deviceoptions.cpp +++ b/core/src/DTO/deviceoptions.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -DeviceOptions::DeviceOptions(QObject *parent) : QObject(parent) {} +DeviceOptions::DeviceOptions(QObject *parent) {} -DeviceOptions *DeviceOptions::fromJSON(QJsonObject source, QObject *parent) { - DeviceOptions *instance = new DeviceOptions(parent); - instance->updateFromJSON(source); +DeviceOptions DeviceOptions::fromJson(QJsonObject source) {DeviceOptions instance; + instance->setFromJson(source, false); return instance; } -void DeviceOptions::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DeviceOptions::setFromJson(QJsonObject source) { + m_customName = fromJsonValue(source["CustomName"]); + } -QJsonObject DeviceOptions::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DeviceOptions::toJson() { QJsonObject result; + result["CustomName"] = toJsonValue(m_customName); + return result; } + QString DeviceOptions::customName() const { return m_customName; } + void DeviceOptions::setCustomName(QString newCustomName) { m_customName = newCustomName; - emit customNameChanged(newCustomName); } diff --git a/core/src/DTO/deviceprofile.cpp b/core/src/DTO/deviceprofile.cpp index 2552514..5798324 100644 --- a/core/src/DTO/deviceprofile.cpp +++ b/core/src/DTO/deviceprofile.cpp @@ -32,254 +32,296 @@ namespace Jellyfin { namespace DTO { -DeviceProfile::DeviceProfile(QObject *parent) : QObject(parent) {} +DeviceProfile::DeviceProfile(QObject *parent) {} -DeviceProfile *DeviceProfile::fromJSON(QJsonObject source, QObject *parent) { - DeviceProfile *instance = new DeviceProfile(parent); - instance->updateFromJSON(source); +DeviceProfile DeviceProfile::fromJson(QJsonObject source) {DeviceProfile instance; + instance->setFromJson(source, false); return instance; } -void DeviceProfile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DeviceProfile::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_identification = fromJsonValue>(source["Identification"]); + m_friendlyName = fromJsonValue(source["FriendlyName"]); + m_manufacturer = fromJsonValue(source["Manufacturer"]); + m_manufacturerUrl = fromJsonValue(source["ManufacturerUrl"]); + m_modelName = fromJsonValue(source["ModelName"]); + m_modelDescription = fromJsonValue(source["ModelDescription"]); + m_modelNumber = fromJsonValue(source["ModelNumber"]); + m_modelUrl = fromJsonValue(source["ModelUrl"]); + m_serialNumber = fromJsonValue(source["SerialNumber"]); + m_enableAlbumArtInDidl = fromJsonValue(source["EnableAlbumArtInDidl"]); + m_enableSingleAlbumArtLimit = fromJsonValue(source["EnableSingleAlbumArtLimit"]); + m_enableSingleSubtitleLimit = fromJsonValue(source["EnableSingleSubtitleLimit"]); + m_supportedMediaTypes = fromJsonValue(source["SupportedMediaTypes"]); + m_userId = fromJsonValue(source["UserId"]); + m_albumArtPn = fromJsonValue(source["AlbumArtPn"]); + m_maxAlbumArtWidth = fromJsonValue(source["MaxAlbumArtWidth"]); + m_maxAlbumArtHeight = fromJsonValue(source["MaxAlbumArtHeight"]); + m_maxIconWidth = fromJsonValue(source["MaxIconWidth"]); + m_maxIconHeight = fromJsonValue(source["MaxIconHeight"]); + m_maxStreamingBitrate = fromJsonValue(source["MaxStreamingBitrate"]); + m_maxStaticBitrate = fromJsonValue(source["MaxStaticBitrate"]); + m_musicStreamingTranscodingBitrate = fromJsonValue(source["MusicStreamingTranscodingBitrate"]); + m_maxStaticMusicBitrate = fromJsonValue(source["MaxStaticMusicBitrate"]); + m_sonyAggregationFlags = fromJsonValue(source["SonyAggregationFlags"]); + m_protocolInfo = fromJsonValue(source["ProtocolInfo"]); + m_timelineOffsetSeconds = fromJsonValue(source["TimelineOffsetSeconds"]); + m_requiresPlainVideoItems = fromJsonValue(source["RequiresPlainVideoItems"]); + m_requiresPlainFolders = fromJsonValue(source["RequiresPlainFolders"]); + m_enableMSMediaReceiverRegistrar = fromJsonValue(source["EnableMSMediaReceiverRegistrar"]); + m_ignoreTranscodeByteRangeRequests = fromJsonValue(source["IgnoreTranscodeByteRangeRequests"]); + m_xmlRootAttributes = fromJsonValue>>(source["XmlRootAttributes"]); + m_directPlayProfiles = fromJsonValue>>(source["DirectPlayProfiles"]); + m_transcodingProfiles = fromJsonValue>>(source["TranscodingProfiles"]); + m_containerProfiles = fromJsonValue>>(source["ContainerProfiles"]); + m_codecProfiles = fromJsonValue>>(source["CodecProfiles"]); + m_responseProfiles = fromJsonValue>>(source["ResponseProfiles"]); + m_subtitleProfiles = fromJsonValue>>(source["SubtitleProfiles"]); + } -QJsonObject DeviceProfile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DeviceProfile::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Id"] = toJsonValue(m_jellyfinId); + result["Identification"] = toJsonValue>(m_identification); + result["FriendlyName"] = toJsonValue(m_friendlyName); + result["Manufacturer"] = toJsonValue(m_manufacturer); + result["ManufacturerUrl"] = toJsonValue(m_manufacturerUrl); + result["ModelName"] = toJsonValue(m_modelName); + result["ModelDescription"] = toJsonValue(m_modelDescription); + result["ModelNumber"] = toJsonValue(m_modelNumber); + result["ModelUrl"] = toJsonValue(m_modelUrl); + result["SerialNumber"] = toJsonValue(m_serialNumber); + result["EnableAlbumArtInDidl"] = toJsonValue(m_enableAlbumArtInDidl); + result["EnableSingleAlbumArtLimit"] = toJsonValue(m_enableSingleAlbumArtLimit); + result["EnableSingleSubtitleLimit"] = toJsonValue(m_enableSingleSubtitleLimit); + result["SupportedMediaTypes"] = toJsonValue(m_supportedMediaTypes); + result["UserId"] = toJsonValue(m_userId); + result["AlbumArtPn"] = toJsonValue(m_albumArtPn); + result["MaxAlbumArtWidth"] = toJsonValue(m_maxAlbumArtWidth); + result["MaxAlbumArtHeight"] = toJsonValue(m_maxAlbumArtHeight); + result["MaxIconWidth"] = toJsonValue(m_maxIconWidth); + result["MaxIconHeight"] = toJsonValue(m_maxIconHeight); + result["MaxStreamingBitrate"] = toJsonValue(m_maxStreamingBitrate); + result["MaxStaticBitrate"] = toJsonValue(m_maxStaticBitrate); + result["MusicStreamingTranscodingBitrate"] = toJsonValue(m_musicStreamingTranscodingBitrate); + result["MaxStaticMusicBitrate"] = toJsonValue(m_maxStaticMusicBitrate); + result["SonyAggregationFlags"] = toJsonValue(m_sonyAggregationFlags); + result["ProtocolInfo"] = toJsonValue(m_protocolInfo); + result["TimelineOffsetSeconds"] = toJsonValue(m_timelineOffsetSeconds); + result["RequiresPlainVideoItems"] = toJsonValue(m_requiresPlainVideoItems); + result["RequiresPlainFolders"] = toJsonValue(m_requiresPlainFolders); + result["EnableMSMediaReceiverRegistrar"] = toJsonValue(m_enableMSMediaReceiverRegistrar); + result["IgnoreTranscodeByteRangeRequests"] = toJsonValue(m_ignoreTranscodeByteRangeRequests); + result["XmlRootAttributes"] = toJsonValue>>(m_xmlRootAttributes); + result["DirectPlayProfiles"] = toJsonValue>>(m_directPlayProfiles); + result["TranscodingProfiles"] = toJsonValue>>(m_transcodingProfiles); + result["ContainerProfiles"] = toJsonValue>>(m_containerProfiles); + result["CodecProfiles"] = toJsonValue>>(m_codecProfiles); + result["ResponseProfiles"] = toJsonValue>>(m_responseProfiles); + result["SubtitleProfiles"] = toJsonValue>>(m_subtitleProfiles); + return result; } + QString DeviceProfile::name() const { return m_name; } + void DeviceProfile::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString DeviceProfile::jellyfinId() const { return m_jellyfinId; } + void DeviceProfile::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } +QSharedPointer DeviceProfile::identification() const { return m_identification; } -DeviceIdentification * DeviceProfile::identification() const { return m_identification; } -void DeviceProfile::setIdentification(DeviceIdentification * newIdentification) { +void DeviceProfile::setIdentification(QSharedPointer newIdentification) { m_identification = newIdentification; - emit identificationChanged(newIdentification); } - QString DeviceProfile::friendlyName() const { return m_friendlyName; } + void DeviceProfile::setFriendlyName(QString newFriendlyName) { m_friendlyName = newFriendlyName; - emit friendlyNameChanged(newFriendlyName); } - QString DeviceProfile::manufacturer() const { return m_manufacturer; } + void DeviceProfile::setManufacturer(QString newManufacturer) { m_manufacturer = newManufacturer; - emit manufacturerChanged(newManufacturer); } - QString DeviceProfile::manufacturerUrl() const { return m_manufacturerUrl; } + void DeviceProfile::setManufacturerUrl(QString newManufacturerUrl) { m_manufacturerUrl = newManufacturerUrl; - emit manufacturerUrlChanged(newManufacturerUrl); } - QString DeviceProfile::modelName() const { return m_modelName; } + void DeviceProfile::setModelName(QString newModelName) { m_modelName = newModelName; - emit modelNameChanged(newModelName); } - QString DeviceProfile::modelDescription() const { return m_modelDescription; } + void DeviceProfile::setModelDescription(QString newModelDescription) { m_modelDescription = newModelDescription; - emit modelDescriptionChanged(newModelDescription); } - QString DeviceProfile::modelNumber() const { return m_modelNumber; } + void DeviceProfile::setModelNumber(QString newModelNumber) { m_modelNumber = newModelNumber; - emit modelNumberChanged(newModelNumber); } - QString DeviceProfile::modelUrl() const { return m_modelUrl; } + void DeviceProfile::setModelUrl(QString newModelUrl) { m_modelUrl = newModelUrl; - emit modelUrlChanged(newModelUrl); } - QString DeviceProfile::serialNumber() const { return m_serialNumber; } + void DeviceProfile::setSerialNumber(QString newSerialNumber) { m_serialNumber = newSerialNumber; - emit serialNumberChanged(newSerialNumber); } - bool DeviceProfile::enableAlbumArtInDidl() const { return m_enableAlbumArtInDidl; } + void DeviceProfile::setEnableAlbumArtInDidl(bool newEnableAlbumArtInDidl) { m_enableAlbumArtInDidl = newEnableAlbumArtInDidl; - emit enableAlbumArtInDidlChanged(newEnableAlbumArtInDidl); } - bool DeviceProfile::enableSingleAlbumArtLimit() const { return m_enableSingleAlbumArtLimit; } + void DeviceProfile::setEnableSingleAlbumArtLimit(bool newEnableSingleAlbumArtLimit) { m_enableSingleAlbumArtLimit = newEnableSingleAlbumArtLimit; - emit enableSingleAlbumArtLimitChanged(newEnableSingleAlbumArtLimit); } - bool DeviceProfile::enableSingleSubtitleLimit() const { return m_enableSingleSubtitleLimit; } + void DeviceProfile::setEnableSingleSubtitleLimit(bool newEnableSingleSubtitleLimit) { m_enableSingleSubtitleLimit = newEnableSingleSubtitleLimit; - emit enableSingleSubtitleLimitChanged(newEnableSingleSubtitleLimit); } - QString DeviceProfile::supportedMediaTypes() const { return m_supportedMediaTypes; } + void DeviceProfile::setSupportedMediaTypes(QString newSupportedMediaTypes) { m_supportedMediaTypes = newSupportedMediaTypes; - emit supportedMediaTypesChanged(newSupportedMediaTypes); } - QString DeviceProfile::userId() const { return m_userId; } + void DeviceProfile::setUserId(QString newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - QString DeviceProfile::albumArtPn() const { return m_albumArtPn; } + void DeviceProfile::setAlbumArtPn(QString newAlbumArtPn) { m_albumArtPn = newAlbumArtPn; - emit albumArtPnChanged(newAlbumArtPn); } - qint32 DeviceProfile::maxAlbumArtWidth() const { return m_maxAlbumArtWidth; } + void DeviceProfile::setMaxAlbumArtWidth(qint32 newMaxAlbumArtWidth) { m_maxAlbumArtWidth = newMaxAlbumArtWidth; - emit maxAlbumArtWidthChanged(newMaxAlbumArtWidth); } - qint32 DeviceProfile::maxAlbumArtHeight() const { return m_maxAlbumArtHeight; } + void DeviceProfile::setMaxAlbumArtHeight(qint32 newMaxAlbumArtHeight) { m_maxAlbumArtHeight = newMaxAlbumArtHeight; - emit maxAlbumArtHeightChanged(newMaxAlbumArtHeight); } - qint32 DeviceProfile::maxIconWidth() const { return m_maxIconWidth; } + void DeviceProfile::setMaxIconWidth(qint32 newMaxIconWidth) { m_maxIconWidth = newMaxIconWidth; - emit maxIconWidthChanged(newMaxIconWidth); } - qint32 DeviceProfile::maxIconHeight() const { return m_maxIconHeight; } + void DeviceProfile::setMaxIconHeight(qint32 newMaxIconHeight) { m_maxIconHeight = newMaxIconHeight; - emit maxIconHeightChanged(newMaxIconHeight); } - qint32 DeviceProfile::maxStreamingBitrate() const { return m_maxStreamingBitrate; } + void DeviceProfile::setMaxStreamingBitrate(qint32 newMaxStreamingBitrate) { m_maxStreamingBitrate = newMaxStreamingBitrate; - emit maxStreamingBitrateChanged(newMaxStreamingBitrate); } - qint32 DeviceProfile::maxStaticBitrate() const { return m_maxStaticBitrate; } + void DeviceProfile::setMaxStaticBitrate(qint32 newMaxStaticBitrate) { m_maxStaticBitrate = newMaxStaticBitrate; - emit maxStaticBitrateChanged(newMaxStaticBitrate); } - qint32 DeviceProfile::musicStreamingTranscodingBitrate() const { return m_musicStreamingTranscodingBitrate; } + void DeviceProfile::setMusicStreamingTranscodingBitrate(qint32 newMusicStreamingTranscodingBitrate) { m_musicStreamingTranscodingBitrate = newMusicStreamingTranscodingBitrate; - emit musicStreamingTranscodingBitrateChanged(newMusicStreamingTranscodingBitrate); } - qint32 DeviceProfile::maxStaticMusicBitrate() const { return m_maxStaticMusicBitrate; } + void DeviceProfile::setMaxStaticMusicBitrate(qint32 newMaxStaticMusicBitrate) { m_maxStaticMusicBitrate = newMaxStaticMusicBitrate; - emit maxStaticMusicBitrateChanged(newMaxStaticMusicBitrate); } - QString DeviceProfile::sonyAggregationFlags() const { return m_sonyAggregationFlags; } + void DeviceProfile::setSonyAggregationFlags(QString newSonyAggregationFlags) { m_sonyAggregationFlags = newSonyAggregationFlags; - emit sonyAggregationFlagsChanged(newSonyAggregationFlags); } - QString DeviceProfile::protocolInfo() const { return m_protocolInfo; } + void DeviceProfile::setProtocolInfo(QString newProtocolInfo) { m_protocolInfo = newProtocolInfo; - emit protocolInfoChanged(newProtocolInfo); } - qint32 DeviceProfile::timelineOffsetSeconds() const { return m_timelineOffsetSeconds; } + void DeviceProfile::setTimelineOffsetSeconds(qint32 newTimelineOffsetSeconds) { m_timelineOffsetSeconds = newTimelineOffsetSeconds; - emit timelineOffsetSecondsChanged(newTimelineOffsetSeconds); } - bool DeviceProfile::requiresPlainVideoItems() const { return m_requiresPlainVideoItems; } + void DeviceProfile::setRequiresPlainVideoItems(bool newRequiresPlainVideoItems) { m_requiresPlainVideoItems = newRequiresPlainVideoItems; - emit requiresPlainVideoItemsChanged(newRequiresPlainVideoItems); } - bool DeviceProfile::requiresPlainFolders() const { return m_requiresPlainFolders; } + void DeviceProfile::setRequiresPlainFolders(bool newRequiresPlainFolders) { m_requiresPlainFolders = newRequiresPlainFolders; - emit requiresPlainFoldersChanged(newRequiresPlainFolders); } - bool DeviceProfile::enableMSMediaReceiverRegistrar() const { return m_enableMSMediaReceiverRegistrar; } + void DeviceProfile::setEnableMSMediaReceiverRegistrar(bool newEnableMSMediaReceiverRegistrar) { m_enableMSMediaReceiverRegistrar = newEnableMSMediaReceiverRegistrar; - emit enableMSMediaReceiverRegistrarChanged(newEnableMSMediaReceiverRegistrar); } - bool DeviceProfile::ignoreTranscodeByteRangeRequests() const { return m_ignoreTranscodeByteRangeRequests; } + void DeviceProfile::setIgnoreTranscodeByteRangeRequests(bool newIgnoreTranscodeByteRangeRequests) { m_ignoreTranscodeByteRangeRequests = newIgnoreTranscodeByteRangeRequests; - emit ignoreTranscodeByteRangeRequestsChanged(newIgnoreTranscodeByteRangeRequests); } +QList> DeviceProfile::xmlRootAttributes() const { return m_xmlRootAttributes; } -QList DeviceProfile::xmlRootAttributes() const { return m_xmlRootAttributes; } -void DeviceProfile::setXmlRootAttributes(QList newXmlRootAttributes) { +void DeviceProfile::setXmlRootAttributes(QList> newXmlRootAttributes) { m_xmlRootAttributes = newXmlRootAttributes; - emit xmlRootAttributesChanged(newXmlRootAttributes); } +QList> DeviceProfile::directPlayProfiles() const { return m_directPlayProfiles; } -QList DeviceProfile::directPlayProfiles() const { return m_directPlayProfiles; } -void DeviceProfile::setDirectPlayProfiles(QList newDirectPlayProfiles) { +void DeviceProfile::setDirectPlayProfiles(QList> newDirectPlayProfiles) { m_directPlayProfiles = newDirectPlayProfiles; - emit directPlayProfilesChanged(newDirectPlayProfiles); } +QList> DeviceProfile::transcodingProfiles() const { return m_transcodingProfiles; } -QList DeviceProfile::transcodingProfiles() const { return m_transcodingProfiles; } -void DeviceProfile::setTranscodingProfiles(QList newTranscodingProfiles) { +void DeviceProfile::setTranscodingProfiles(QList> newTranscodingProfiles) { m_transcodingProfiles = newTranscodingProfiles; - emit transcodingProfilesChanged(newTranscodingProfiles); } +QList> DeviceProfile::containerProfiles() const { return m_containerProfiles; } -QList DeviceProfile::containerProfiles() const { return m_containerProfiles; } -void DeviceProfile::setContainerProfiles(QList newContainerProfiles) { +void DeviceProfile::setContainerProfiles(QList> newContainerProfiles) { m_containerProfiles = newContainerProfiles; - emit containerProfilesChanged(newContainerProfiles); } +QList> DeviceProfile::codecProfiles() const { return m_codecProfiles; } -QList DeviceProfile::codecProfiles() const { return m_codecProfiles; } -void DeviceProfile::setCodecProfiles(QList newCodecProfiles) { +void DeviceProfile::setCodecProfiles(QList> newCodecProfiles) { m_codecProfiles = newCodecProfiles; - emit codecProfilesChanged(newCodecProfiles); } +QList> DeviceProfile::responseProfiles() const { return m_responseProfiles; } -QList DeviceProfile::responseProfiles() const { return m_responseProfiles; } -void DeviceProfile::setResponseProfiles(QList newResponseProfiles) { +void DeviceProfile::setResponseProfiles(QList> newResponseProfiles) { m_responseProfiles = newResponseProfiles; - emit responseProfilesChanged(newResponseProfiles); } +QList> DeviceProfile::subtitleProfiles() const { return m_subtitleProfiles; } -QList DeviceProfile::subtitleProfiles() const { return m_subtitleProfiles; } -void DeviceProfile::setSubtitleProfiles(QList newSubtitleProfiles) { +void DeviceProfile::setSubtitleProfiles(QList> newSubtitleProfiles) { m_subtitleProfiles = newSubtitleProfiles; - emit subtitleProfilesChanged(newSubtitleProfiles); } diff --git a/core/src/DTO/deviceprofileinfo.cpp b/core/src/DTO/deviceprofileinfo.cpp index 6ff07ce..b8238f2 100644 --- a/core/src/DTO/deviceprofileinfo.cpp +++ b/core/src/DTO/deviceprofileinfo.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -DeviceProfileInfo::DeviceProfileInfo(QObject *parent) : QObject(parent) {} +DeviceProfileInfo::DeviceProfileInfo(QObject *parent) {} -DeviceProfileInfo *DeviceProfileInfo::fromJSON(QJsonObject source, QObject *parent) { - DeviceProfileInfo *instance = new DeviceProfileInfo(parent); - instance->updateFromJSON(source); +DeviceProfileInfo DeviceProfileInfo::fromJson(QJsonObject source) {DeviceProfileInfo instance; + instance->setFromJson(source, false); return instance; } -void DeviceProfileInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DeviceProfileInfo::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_name = fromJsonValue(source["Name"]); + m_type = fromJsonValue(source["Type"]); + } -QJsonObject DeviceProfileInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DeviceProfileInfo::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["Name"] = toJsonValue(m_name); + result["Type"] = toJsonValue(m_type); + return result; } + QString DeviceProfileInfo::jellyfinId() const { return m_jellyfinId; } + void DeviceProfileInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString DeviceProfileInfo::name() const { return m_name; } + void DeviceProfileInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - DeviceProfileType DeviceProfileInfo::type() const { return m_type; } + void DeviceProfileInfo::setType(DeviceProfileType newType) { m_type = newType; - emit typeChanged(newType); } diff --git a/core/src/DTO/directplayprofile.cpp b/core/src/DTO/directplayprofile.cpp index f6645e8..be3e1db 100644 --- a/core/src/DTO/directplayprofile.cpp +++ b/core/src/DTO/directplayprofile.cpp @@ -29,49 +29,54 @@ #include -#include - namespace Jellyfin { namespace DTO { -DirectPlayProfile::DirectPlayProfile(QObject *parent) : QObject(parent) {} +DirectPlayProfile::DirectPlayProfile(QObject *parent) {} -DirectPlayProfile *DirectPlayProfile::fromJSON(QJsonObject source, QObject *parent) { - DirectPlayProfile *instance = new DirectPlayProfile(parent); - instance->updateFromJSON(source); +DirectPlayProfile DirectPlayProfile::fromJson(QJsonObject source) {DirectPlayProfile instance; + instance->setFromJson(source, false); return instance; } -void DirectPlayProfile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DirectPlayProfile::setFromJson(QJsonObject source) { + m_container = fromJsonValue(source["Container"]); + m_audioCodec = fromJsonValue(source["AudioCodec"]); + m_videoCodec = fromJsonValue(source["VideoCodec"]); + m_type = fromJsonValue(source["Type"]); + } -QJsonObject DirectPlayProfile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DirectPlayProfile::toJson() { QJsonObject result; + result["Container"] = toJsonValue(m_container); + result["AudioCodec"] = toJsonValue(m_audioCodec); + result["VideoCodec"] = toJsonValue(m_videoCodec); + result["Type"] = toJsonValue(m_type); + return result; } + QString DirectPlayProfile::container() const { return m_container; } + void DirectPlayProfile::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } - QString DirectPlayProfile::audioCodec() const { return m_audioCodec; } + void DirectPlayProfile::setAudioCodec(QString newAudioCodec) { m_audioCodec = newAudioCodec; - emit audioCodecChanged(newAudioCodec); } - QString DirectPlayProfile::videoCodec() const { return m_videoCodec; } + void DirectPlayProfile::setVideoCodec(QString newVideoCodec) { m_videoCodec = newVideoCodec; - emit videoCodecChanged(newVideoCodec); } - DlnaProfileType DirectPlayProfile::type() const { return m_type; } + void DirectPlayProfile::setType(DlnaProfileType newType) { m_type = newType; - emit typeChanged(newType); } diff --git a/core/src/DTO/displaypreferencesdto.cpp b/core/src/DTO/displaypreferencesdto.cpp index 39eadcb..4d5bb51 100644 --- a/core/src/DTO/displaypreferencesdto.cpp +++ b/core/src/DTO/displaypreferencesdto.cpp @@ -29,110 +29,124 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -DisplayPreferencesDto::DisplayPreferencesDto(QObject *parent) : QObject(parent) {} +DisplayPreferencesDto::DisplayPreferencesDto(QObject *parent) {} -DisplayPreferencesDto *DisplayPreferencesDto::fromJSON(QJsonObject source, QObject *parent) { - DisplayPreferencesDto *instance = new DisplayPreferencesDto(parent); - instance->updateFromJSON(source); +DisplayPreferencesDto DisplayPreferencesDto::fromJson(QJsonObject source) {DisplayPreferencesDto instance; + instance->setFromJson(source, false); return instance; } -void DisplayPreferencesDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void DisplayPreferencesDto::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_viewType = fromJsonValue(source["ViewType"]); + m_sortBy = fromJsonValue(source["SortBy"]); + m_indexBy = fromJsonValue(source["IndexBy"]); + m_rememberIndexing = fromJsonValue(source["RememberIndexing"]); + m_primaryImageHeight = fromJsonValue(source["PrimaryImageHeight"]); + m_primaryImageWidth = fromJsonValue(source["PrimaryImageWidth"]); + m_customPrefs = fromJsonValue(source["CustomPrefs"]); + m_scrollDirection = fromJsonValue(source["ScrollDirection"]); + m_showBackdrop = fromJsonValue(source["ShowBackdrop"]); + m_rememberSorting = fromJsonValue(source["RememberSorting"]); + m_sortOrder = fromJsonValue(source["SortOrder"]); + m_showSidebar = fromJsonValue(source["ShowSidebar"]); + m_client = fromJsonValue(source["Client"]); + } -QJsonObject DisplayPreferencesDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject DisplayPreferencesDto::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["ViewType"] = toJsonValue(m_viewType); + result["SortBy"] = toJsonValue(m_sortBy); + result["IndexBy"] = toJsonValue(m_indexBy); + result["RememberIndexing"] = toJsonValue(m_rememberIndexing); + result["PrimaryImageHeight"] = toJsonValue(m_primaryImageHeight); + result["PrimaryImageWidth"] = toJsonValue(m_primaryImageWidth); + result["CustomPrefs"] = toJsonValue(m_customPrefs); + result["ScrollDirection"] = toJsonValue(m_scrollDirection); + result["ShowBackdrop"] = toJsonValue(m_showBackdrop); + result["RememberSorting"] = toJsonValue(m_rememberSorting); + result["SortOrder"] = toJsonValue(m_sortOrder); + result["ShowSidebar"] = toJsonValue(m_showSidebar); + result["Client"] = toJsonValue(m_client); + return result; } + QString DisplayPreferencesDto::jellyfinId() const { return m_jellyfinId; } + void DisplayPreferencesDto::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString DisplayPreferencesDto::viewType() const { return m_viewType; } + void DisplayPreferencesDto::setViewType(QString newViewType) { m_viewType = newViewType; - emit viewTypeChanged(newViewType); } - QString DisplayPreferencesDto::sortBy() const { return m_sortBy; } + void DisplayPreferencesDto::setSortBy(QString newSortBy) { m_sortBy = newSortBy; - emit sortByChanged(newSortBy); } - QString DisplayPreferencesDto::indexBy() const { return m_indexBy; } + void DisplayPreferencesDto::setIndexBy(QString newIndexBy) { m_indexBy = newIndexBy; - emit indexByChanged(newIndexBy); } - bool DisplayPreferencesDto::rememberIndexing() const { return m_rememberIndexing; } + void DisplayPreferencesDto::setRememberIndexing(bool newRememberIndexing) { m_rememberIndexing = newRememberIndexing; - emit rememberIndexingChanged(newRememberIndexing); } - qint32 DisplayPreferencesDto::primaryImageHeight() const { return m_primaryImageHeight; } + void DisplayPreferencesDto::setPrimaryImageHeight(qint32 newPrimaryImageHeight) { m_primaryImageHeight = newPrimaryImageHeight; - emit primaryImageHeightChanged(newPrimaryImageHeight); } - qint32 DisplayPreferencesDto::primaryImageWidth() const { return m_primaryImageWidth; } + void DisplayPreferencesDto::setPrimaryImageWidth(qint32 newPrimaryImageWidth) { m_primaryImageWidth = newPrimaryImageWidth; - emit primaryImageWidthChanged(newPrimaryImageWidth); } - QJsonObject DisplayPreferencesDto::customPrefs() const { return m_customPrefs; } + void DisplayPreferencesDto::setCustomPrefs(QJsonObject newCustomPrefs) { m_customPrefs = newCustomPrefs; - emit customPrefsChanged(newCustomPrefs); } - ScrollDirection DisplayPreferencesDto::scrollDirection() const { return m_scrollDirection; } + void DisplayPreferencesDto::setScrollDirection(ScrollDirection newScrollDirection) { m_scrollDirection = newScrollDirection; - emit scrollDirectionChanged(newScrollDirection); } - bool DisplayPreferencesDto::showBackdrop() const { return m_showBackdrop; } + void DisplayPreferencesDto::setShowBackdrop(bool newShowBackdrop) { m_showBackdrop = newShowBackdrop; - emit showBackdropChanged(newShowBackdrop); } - bool DisplayPreferencesDto::rememberSorting() const { return m_rememberSorting; } + void DisplayPreferencesDto::setRememberSorting(bool newRememberSorting) { m_rememberSorting = newRememberSorting; - emit rememberSortingChanged(newRememberSorting); } - SortOrder DisplayPreferencesDto::sortOrder() const { return m_sortOrder; } + void DisplayPreferencesDto::setSortOrder(SortOrder newSortOrder) { m_sortOrder = newSortOrder; - emit sortOrderChanged(newSortOrder); } - bool DisplayPreferencesDto::showSidebar() const { return m_showSidebar; } + void DisplayPreferencesDto::setShowSidebar(bool newShowSidebar) { m_showSidebar = newShowSidebar; - emit showSidebarChanged(newShowSidebar); } - QString DisplayPreferencesDto::client() const { return m_client; } + void DisplayPreferencesDto::setClient(QString newClient) { m_client = newClient; - emit clientChanged(newClient); } diff --git a/core/src/DTO/endpointinfo.cpp b/core/src/DTO/endpointinfo.cpp index 2bf6f7d..d7e00a5 100644 --- a/core/src/DTO/endpointinfo.cpp +++ b/core/src/DTO/endpointinfo.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -EndPointInfo::EndPointInfo(QObject *parent) : QObject(parent) {} +EndPointInfo::EndPointInfo(QObject *parent) {} -EndPointInfo *EndPointInfo::fromJSON(QJsonObject source, QObject *parent) { - EndPointInfo *instance = new EndPointInfo(parent); - instance->updateFromJSON(source); +EndPointInfo EndPointInfo::fromJson(QJsonObject source) {EndPointInfo instance; + instance->setFromJson(source, false); return instance; } -void EndPointInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void EndPointInfo::setFromJson(QJsonObject source) { + m_isLocal = fromJsonValue(source["IsLocal"]); + m_isInNetwork = fromJsonValue(source["IsInNetwork"]); + } -QJsonObject EndPointInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject EndPointInfo::toJson() { QJsonObject result; + result["IsLocal"] = toJsonValue(m_isLocal); + result["IsInNetwork"] = toJsonValue(m_isInNetwork); + return result; } + bool EndPointInfo::isLocal() const { return m_isLocal; } + void EndPointInfo::setIsLocal(bool newIsLocal) { m_isLocal = newIsLocal; - emit isLocalChanged(newIsLocal); } - bool EndPointInfo::isInNetwork() const { return m_isInNetwork; } + void EndPointInfo::setIsInNetwork(bool newIsInNetwork) { m_isInNetwork = newIsInNetwork; - emit isInNetworkChanged(newIsInNetwork); } diff --git a/core/src/DTO/externalidinfo.cpp b/core/src/DTO/externalidinfo.cpp index 87e203b..063135b 100644 --- a/core/src/DTO/externalidinfo.cpp +++ b/core/src/DTO/externalidinfo.cpp @@ -29,49 +29,54 @@ #include -#include - namespace Jellyfin { namespace DTO { -ExternalIdInfo::ExternalIdInfo(QObject *parent) : QObject(parent) {} +ExternalIdInfo::ExternalIdInfo(QObject *parent) {} -ExternalIdInfo *ExternalIdInfo::fromJSON(QJsonObject source, QObject *parent) { - ExternalIdInfo *instance = new ExternalIdInfo(parent); - instance->updateFromJSON(source); +ExternalIdInfo ExternalIdInfo::fromJson(QJsonObject source) {ExternalIdInfo instance; + instance->setFromJson(source, false); return instance; } -void ExternalIdInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ExternalIdInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_key = fromJsonValue(source["Key"]); + m_type = fromJsonValue(source["Type"]); + m_urlFormatString = fromJsonValue(source["UrlFormatString"]); + } -QJsonObject ExternalIdInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ExternalIdInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Key"] = toJsonValue(m_key); + result["Type"] = toJsonValue(m_type); + result["UrlFormatString"] = toJsonValue(m_urlFormatString); + return result; } + QString ExternalIdInfo::name() const { return m_name; } + void ExternalIdInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString ExternalIdInfo::key() const { return m_key; } + void ExternalIdInfo::setKey(QString newKey) { m_key = newKey; - emit keyChanged(newKey); } - ExternalIdMediaType ExternalIdInfo::type() const { return m_type; } + void ExternalIdInfo::setType(ExternalIdMediaType newType) { m_type = newType; - emit typeChanged(newType); } - QString ExternalIdInfo::urlFormatString() const { return m_urlFormatString; } + void ExternalIdInfo::setUrlFormatString(QString newUrlFormatString) { m_urlFormatString = newUrlFormatString; - emit urlFormatStringChanged(newUrlFormatString); } diff --git a/core/src/DTO/externalurl.cpp b/core/src/DTO/externalurl.cpp index 5d12cd7..9326bc5 100644 --- a/core/src/DTO/externalurl.cpp +++ b/core/src/DTO/externalurl.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -ExternalUrl::ExternalUrl(QObject *parent) : QObject(parent) {} +ExternalUrl::ExternalUrl(QObject *parent) {} -ExternalUrl *ExternalUrl::fromJSON(QJsonObject source, QObject *parent) { - ExternalUrl *instance = new ExternalUrl(parent); - instance->updateFromJSON(source); +ExternalUrl ExternalUrl::fromJson(QJsonObject source) {ExternalUrl instance; + instance->setFromJson(source, false); return instance; } -void ExternalUrl::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ExternalUrl::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_url = fromJsonValue(source["Url"]); + } -QJsonObject ExternalUrl::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ExternalUrl::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Url"] = toJsonValue(m_url); + return result; } + QString ExternalUrl::name() const { return m_name; } + void ExternalUrl::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString ExternalUrl::url() const { return m_url; } + void ExternalUrl::setUrl(QString newUrl) { m_url = newUrl; - emit urlChanged(newUrl); } diff --git a/core/src/DTO/filesystementryinfo.cpp b/core/src/DTO/filesystementryinfo.cpp index ef2e3b6..d638a5b 100644 --- a/core/src/DTO/filesystementryinfo.cpp +++ b/core/src/DTO/filesystementryinfo.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -FileSystemEntryInfo::FileSystemEntryInfo(QObject *parent) : QObject(parent) {} +FileSystemEntryInfo::FileSystemEntryInfo(QObject *parent) {} -FileSystemEntryInfo *FileSystemEntryInfo::fromJSON(QJsonObject source, QObject *parent) { - FileSystemEntryInfo *instance = new FileSystemEntryInfo(parent); - instance->updateFromJSON(source); +FileSystemEntryInfo FileSystemEntryInfo::fromJson(QJsonObject source) {FileSystemEntryInfo instance; + instance->setFromJson(source, false); return instance; } -void FileSystemEntryInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void FileSystemEntryInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_type = fromJsonValue(source["Type"]); + } -QJsonObject FileSystemEntryInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject FileSystemEntryInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["Type"] = toJsonValue(m_type); + return result; } + QString FileSystemEntryInfo::name() const { return m_name; } + void FileSystemEntryInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString FileSystemEntryInfo::path() const { return m_path; } + void FileSystemEntryInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - FileSystemEntryType FileSystemEntryInfo::type() const { return m_type; } + void FileSystemEntryInfo::setType(FileSystemEntryType newType) { m_type = newType; - emit typeChanged(newType); } diff --git a/core/src/DTO/fontfile.cpp b/core/src/DTO/fontfile.cpp index a5a7d8b..8539534 100644 --- a/core/src/DTO/fontfile.cpp +++ b/core/src/DTO/fontfile.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -FontFile::FontFile(QObject *parent) : QObject(parent) {} +FontFile::FontFile(QObject *parent) {} -FontFile *FontFile::fromJSON(QJsonObject source, QObject *parent) { - FontFile *instance = new FontFile(parent); - instance->updateFromJSON(source); +FontFile FontFile::fromJson(QJsonObject source) {FontFile instance; + instance->setFromJson(source, false); return instance; } -void FontFile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void FontFile::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_size = fromJsonValue(source["Size"]); + m_dateCreated = fromJsonValue(source["DateCreated"]); + m_dateModified = fromJsonValue(source["DateModified"]); + } -QJsonObject FontFile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject FontFile::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Size"] = toJsonValue(m_size); + result["DateCreated"] = toJsonValue(m_dateCreated); + result["DateModified"] = toJsonValue(m_dateModified); + return result; } + QString FontFile::name() const { return m_name; } + void FontFile::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - qint64 FontFile::size() const { return m_size; } + void FontFile::setSize(qint64 newSize) { m_size = newSize; - emit sizeChanged(newSize); } - QDateTime FontFile::dateCreated() const { return m_dateCreated; } + void FontFile::setDateCreated(QDateTime newDateCreated) { m_dateCreated = newDateCreated; - emit dateCreatedChanged(newDateCreated); } - QDateTime FontFile::dateModified() const { return m_dateModified; } + void FontFile::setDateModified(QDateTime newDateModified) { m_dateModified = newDateModified; - emit dateModifiedChanged(newDateModified); } diff --git a/core/src/DTO/forgotpassworddto.cpp b/core/src/DTO/forgotpassworddto.cpp index 1bada60..dd5fa48 100644 --- a/core/src/DTO/forgotpassworddto.cpp +++ b/core/src/DTO/forgotpassworddto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -ForgotPasswordDto::ForgotPasswordDto(QObject *parent) : QObject(parent) {} +ForgotPasswordDto::ForgotPasswordDto(QObject *parent) {} -ForgotPasswordDto *ForgotPasswordDto::fromJSON(QJsonObject source, QObject *parent) { - ForgotPasswordDto *instance = new ForgotPasswordDto(parent); - instance->updateFromJSON(source); +ForgotPasswordDto ForgotPasswordDto::fromJson(QJsonObject source) {ForgotPasswordDto instance; + instance->setFromJson(source, false); return instance; } -void ForgotPasswordDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ForgotPasswordDto::setFromJson(QJsonObject source) { + m_enteredUsername = fromJsonValue(source["EnteredUsername"]); + } -QJsonObject ForgotPasswordDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ForgotPasswordDto::toJson() { QJsonObject result; + result["EnteredUsername"] = toJsonValue(m_enteredUsername); + return result; } + QString ForgotPasswordDto::enteredUsername() const { return m_enteredUsername; } + void ForgotPasswordDto::setEnteredUsername(QString newEnteredUsername) { m_enteredUsername = newEnteredUsername; - emit enteredUsernameChanged(newEnteredUsername); } diff --git a/core/src/DTO/forgotpasswordresult.cpp b/core/src/DTO/forgotpasswordresult.cpp index b18a27d..76cdedf 100644 --- a/core/src/DTO/forgotpasswordresult.cpp +++ b/core/src/DTO/forgotpasswordresult.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -ForgotPasswordResult::ForgotPasswordResult(QObject *parent) : QObject(parent) {} +ForgotPasswordResult::ForgotPasswordResult(QObject *parent) {} -ForgotPasswordResult *ForgotPasswordResult::fromJSON(QJsonObject source, QObject *parent) { - ForgotPasswordResult *instance = new ForgotPasswordResult(parent); - instance->updateFromJSON(source); +ForgotPasswordResult ForgotPasswordResult::fromJson(QJsonObject source) {ForgotPasswordResult instance; + instance->setFromJson(source, false); return instance; } -void ForgotPasswordResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ForgotPasswordResult::setFromJson(QJsonObject source) { + m_action = fromJsonValue(source["Action"]); + m_pinFile = fromJsonValue(source["PinFile"]); + m_pinExpirationDate = fromJsonValue(source["PinExpirationDate"]); + } -QJsonObject ForgotPasswordResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ForgotPasswordResult::toJson() { QJsonObject result; + result["Action"] = toJsonValue(m_action); + result["PinFile"] = toJsonValue(m_pinFile); + result["PinExpirationDate"] = toJsonValue(m_pinExpirationDate); + return result; } + ForgotPasswordAction ForgotPasswordResult::action() const { return m_action; } + void ForgotPasswordResult::setAction(ForgotPasswordAction newAction) { m_action = newAction; - emit actionChanged(newAction); } - QString ForgotPasswordResult::pinFile() const { return m_pinFile; } + void ForgotPasswordResult::setPinFile(QString newPinFile) { m_pinFile = newPinFile; - emit pinFileChanged(newPinFile); } - QDateTime ForgotPasswordResult::pinExpirationDate() const { return m_pinExpirationDate; } + void ForgotPasswordResult::setPinExpirationDate(QDateTime newPinExpirationDate) { m_pinExpirationDate = newPinExpirationDate; - emit pinExpirationDateChanged(newPinExpirationDate); } diff --git a/core/src/DTO/generalcommand.cpp b/core/src/DTO/generalcommand.cpp index bf541fd..a3644b4 100644 --- a/core/src/DTO/generalcommand.cpp +++ b/core/src/DTO/generalcommand.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -GeneralCommand::GeneralCommand(QObject *parent) : QObject(parent) {} +GeneralCommand::GeneralCommand(QObject *parent) {} -GeneralCommand *GeneralCommand::fromJSON(QJsonObject source, QObject *parent) { - GeneralCommand *instance = new GeneralCommand(parent); - instance->updateFromJSON(source); +GeneralCommand GeneralCommand::fromJson(QJsonObject source) {GeneralCommand instance; + instance->setFromJson(source, false); return instance; } -void GeneralCommand::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void GeneralCommand::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_controllingUserId = fromJsonValue(source["ControllingUserId"]); + m_arguments = fromJsonValue(source["Arguments"]); + } -QJsonObject GeneralCommand::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject GeneralCommand::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["ControllingUserId"] = toJsonValue(m_controllingUserId); + result["Arguments"] = toJsonValue(m_arguments); + return result; } + GeneralCommandType GeneralCommand::name() const { return m_name; } + void GeneralCommand::setName(GeneralCommandType newName) { m_name = newName; - emit nameChanged(newName); } +QUuid GeneralCommand::controllingUserId() const { return m_controllingUserId; } -QString GeneralCommand::controllingUserId() const { return m_controllingUserId; } -void GeneralCommand::setControllingUserId(QString newControllingUserId) { +void GeneralCommand::setControllingUserId(QUuid newControllingUserId) { m_controllingUserId = newControllingUserId; - emit controllingUserIdChanged(newControllingUserId); } - QJsonObject GeneralCommand::arguments() const { return m_arguments; } + void GeneralCommand::setArguments(QJsonObject newArguments) { m_arguments = newArguments; - emit argumentsChanged(newArguments); } diff --git a/core/src/DTO/getprogramsdto.cpp b/core/src/DTO/getprogramsdto.cpp index 62876ea..f90e197 100644 --- a/core/src/DTO/getprogramsdto.cpp +++ b/core/src/DTO/getprogramsdto.cpp @@ -29,188 +29,215 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -GetProgramsDto::GetProgramsDto(QObject *parent) : QObject(parent) {} +GetProgramsDto::GetProgramsDto(QObject *parent) {} -GetProgramsDto *GetProgramsDto::fromJSON(QJsonObject source, QObject *parent) { - GetProgramsDto *instance = new GetProgramsDto(parent); - instance->updateFromJSON(source); +GetProgramsDto GetProgramsDto::fromJson(QJsonObject source) {GetProgramsDto instance; + instance->setFromJson(source, false); return instance; } -void GetProgramsDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void GetProgramsDto::setFromJson(QJsonObject source) { + m_channelIds = fromJsonValue>(source["ChannelIds"]); + m_userId = fromJsonValue(source["UserId"]); + m_minStartDate = fromJsonValue(source["MinStartDate"]); + m_hasAired = fromJsonValue(source["HasAired"]); + m_isAiring = fromJsonValue(source["IsAiring"]); + m_maxStartDate = fromJsonValue(source["MaxStartDate"]); + m_minEndDate = fromJsonValue(source["MinEndDate"]); + m_maxEndDate = fromJsonValue(source["MaxEndDate"]); + m_isMovie = fromJsonValue(source["IsMovie"]); + m_isSeries = fromJsonValue(source["IsSeries"]); + m_isNews = fromJsonValue(source["IsNews"]); + m_isKids = fromJsonValue(source["IsKids"]); + m_isSports = fromJsonValue(source["IsSports"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + m_limit = fromJsonValue(source["Limit"]); + m_sortBy = fromJsonValue(source["SortBy"]); + m_sortOrder = fromJsonValue(source["SortOrder"]); + m_genres = fromJsonValue(source["Genres"]); + m_genreIds = fromJsonValue>(source["GenreIds"]); + m_enableImages = fromJsonValue(source["EnableImages"]); + m_enableTotalRecordCount = fromJsonValue(source["EnableTotalRecordCount"]); + m_imageTypeLimit = fromJsonValue(source["ImageTypeLimit"]); + m_enableImageTypes = fromJsonValue>(source["EnableImageTypes"]); + m_enableUserData = fromJsonValue(source["EnableUserData"]); + m_seriesTimerId = fromJsonValue(source["SeriesTimerId"]); + m_librarySeriesId = fromJsonValue(source["LibrarySeriesId"]); + m_fields = fromJsonValue>(source["Fields"]); + } -QJsonObject GetProgramsDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject GetProgramsDto::toJson() { QJsonObject result; + result["ChannelIds"] = toJsonValue>(m_channelIds); + result["UserId"] = toJsonValue(m_userId); + result["MinStartDate"] = toJsonValue(m_minStartDate); + result["HasAired"] = toJsonValue(m_hasAired); + result["IsAiring"] = toJsonValue(m_isAiring); + result["MaxStartDate"] = toJsonValue(m_maxStartDate); + result["MinEndDate"] = toJsonValue(m_minEndDate); + result["MaxEndDate"] = toJsonValue(m_maxEndDate); + result["IsMovie"] = toJsonValue(m_isMovie); + result["IsSeries"] = toJsonValue(m_isSeries); + result["IsNews"] = toJsonValue(m_isNews); + result["IsKids"] = toJsonValue(m_isKids); + result["IsSports"] = toJsonValue(m_isSports); + result["StartIndex"] = toJsonValue(m_startIndex); + result["Limit"] = toJsonValue(m_limit); + result["SortBy"] = toJsonValue(m_sortBy); + result["SortOrder"] = toJsonValue(m_sortOrder); + result["Genres"] = toJsonValue(m_genres); + result["GenreIds"] = toJsonValue>(m_genreIds); + result["EnableImages"] = toJsonValue(m_enableImages); + result["EnableTotalRecordCount"] = toJsonValue(m_enableTotalRecordCount); + result["ImageTypeLimit"] = toJsonValue(m_imageTypeLimit); + result["EnableImageTypes"] = toJsonValue>(m_enableImageTypes); + result["EnableUserData"] = toJsonValue(m_enableUserData); + result["SeriesTimerId"] = toJsonValue(m_seriesTimerId); + result["LibrarySeriesId"] = toJsonValue(m_librarySeriesId); + result["Fields"] = toJsonValue>(m_fields); + return result; } -QStringList GetProgramsDto::channelIds() const { return m_channelIds; } -void GetProgramsDto::setChannelIds(QStringList newChannelIds) { + +QList GetProgramsDto::channelIds() const { return m_channelIds; } + +void GetProgramsDto::setChannelIds(QList newChannelIds) { m_channelIds = newChannelIds; - emit channelIdsChanged(newChannelIds); } +QUuid GetProgramsDto::userId() const { return m_userId; } -QString GetProgramsDto::userId() const { return m_userId; } -void GetProgramsDto::setUserId(QString newUserId) { +void GetProgramsDto::setUserId(QUuid newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - QDateTime GetProgramsDto::minStartDate() const { return m_minStartDate; } + void GetProgramsDto::setMinStartDate(QDateTime newMinStartDate) { m_minStartDate = newMinStartDate; - emit minStartDateChanged(newMinStartDate); } - bool GetProgramsDto::hasAired() const { return m_hasAired; } + void GetProgramsDto::setHasAired(bool newHasAired) { m_hasAired = newHasAired; - emit hasAiredChanged(newHasAired); } - bool GetProgramsDto::isAiring() const { return m_isAiring; } + void GetProgramsDto::setIsAiring(bool newIsAiring) { m_isAiring = newIsAiring; - emit isAiringChanged(newIsAiring); } - QDateTime GetProgramsDto::maxStartDate() const { return m_maxStartDate; } + void GetProgramsDto::setMaxStartDate(QDateTime newMaxStartDate) { m_maxStartDate = newMaxStartDate; - emit maxStartDateChanged(newMaxStartDate); } - QDateTime GetProgramsDto::minEndDate() const { return m_minEndDate; } + void GetProgramsDto::setMinEndDate(QDateTime newMinEndDate) { m_minEndDate = newMinEndDate; - emit minEndDateChanged(newMinEndDate); } - QDateTime GetProgramsDto::maxEndDate() const { return m_maxEndDate; } + void GetProgramsDto::setMaxEndDate(QDateTime newMaxEndDate) { m_maxEndDate = newMaxEndDate; - emit maxEndDateChanged(newMaxEndDate); } - bool GetProgramsDto::isMovie() const { return m_isMovie; } + void GetProgramsDto::setIsMovie(bool newIsMovie) { m_isMovie = newIsMovie; - emit isMovieChanged(newIsMovie); } - bool GetProgramsDto::isSeries() const { return m_isSeries; } + void GetProgramsDto::setIsSeries(bool newIsSeries) { m_isSeries = newIsSeries; - emit isSeriesChanged(newIsSeries); } - bool GetProgramsDto::isNews() const { return m_isNews; } + void GetProgramsDto::setIsNews(bool newIsNews) { m_isNews = newIsNews; - emit isNewsChanged(newIsNews); } - bool GetProgramsDto::isKids() const { return m_isKids; } + void GetProgramsDto::setIsKids(bool newIsKids) { m_isKids = newIsKids; - emit isKidsChanged(newIsKids); } - bool GetProgramsDto::isSports() const { return m_isSports; } + void GetProgramsDto::setIsSports(bool newIsSports) { m_isSports = newIsSports; - emit isSportsChanged(newIsSports); } - qint32 GetProgramsDto::startIndex() const { return m_startIndex; } + void GetProgramsDto::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } - qint32 GetProgramsDto::limit() const { return m_limit; } + void GetProgramsDto::setLimit(qint32 newLimit) { m_limit = newLimit; - emit limitChanged(newLimit); } - QString GetProgramsDto::sortBy() const { return m_sortBy; } + void GetProgramsDto::setSortBy(QString newSortBy) { m_sortBy = newSortBy; - emit sortByChanged(newSortBy); } - QString GetProgramsDto::sortOrder() const { return m_sortOrder; } + void GetProgramsDto::setSortOrder(QString newSortOrder) { m_sortOrder = newSortOrder; - emit sortOrderChanged(newSortOrder); } - QStringList GetProgramsDto::genres() const { return m_genres; } + void GetProgramsDto::setGenres(QStringList newGenres) { m_genres = newGenres; - emit genresChanged(newGenres); } +QList GetProgramsDto::genreIds() const { return m_genreIds; } -QStringList GetProgramsDto::genreIds() const { return m_genreIds; } -void GetProgramsDto::setGenreIds(QStringList newGenreIds) { +void GetProgramsDto::setGenreIds(QList newGenreIds) { m_genreIds = newGenreIds; - emit genreIdsChanged(newGenreIds); } - bool GetProgramsDto::enableImages() const { return m_enableImages; } + void GetProgramsDto::setEnableImages(bool newEnableImages) { m_enableImages = newEnableImages; - emit enableImagesChanged(newEnableImages); } - bool GetProgramsDto::enableTotalRecordCount() const { return m_enableTotalRecordCount; } + void GetProgramsDto::setEnableTotalRecordCount(bool newEnableTotalRecordCount) { m_enableTotalRecordCount = newEnableTotalRecordCount; - emit enableTotalRecordCountChanged(newEnableTotalRecordCount); } - qint32 GetProgramsDto::imageTypeLimit() const { return m_imageTypeLimit; } + void GetProgramsDto::setImageTypeLimit(qint32 newImageTypeLimit) { m_imageTypeLimit = newImageTypeLimit; - emit imageTypeLimitChanged(newImageTypeLimit); } - QList GetProgramsDto::enableImageTypes() const { return m_enableImageTypes; } + void GetProgramsDto::setEnableImageTypes(QList newEnableImageTypes) { m_enableImageTypes = newEnableImageTypes; - emit enableImageTypesChanged(newEnableImageTypes); } - bool GetProgramsDto::enableUserData() const { return m_enableUserData; } + void GetProgramsDto::setEnableUserData(bool newEnableUserData) { m_enableUserData = newEnableUserData; - emit enableUserDataChanged(newEnableUserData); } - QString GetProgramsDto::seriesTimerId() const { return m_seriesTimerId; } + void GetProgramsDto::setSeriesTimerId(QString newSeriesTimerId) { m_seriesTimerId = newSeriesTimerId; - emit seriesTimerIdChanged(newSeriesTimerId); } +QUuid GetProgramsDto::librarySeriesId() const { return m_librarySeriesId; } -QString GetProgramsDto::librarySeriesId() const { return m_librarySeriesId; } -void GetProgramsDto::setLibrarySeriesId(QString newLibrarySeriesId) { +void GetProgramsDto::setLibrarySeriesId(QUuid newLibrarySeriesId) { m_librarySeriesId = newLibrarySeriesId; - emit librarySeriesIdChanged(newLibrarySeriesId); } - QList GetProgramsDto::fields() const { return m_fields; } + void GetProgramsDto::setFields(QList newFields) { m_fields = newFields; - emit fieldsChanged(newFields); } diff --git a/core/src/DTO/groupinfodto.cpp b/core/src/DTO/groupinfodto.cpp index d91b4ac..87564b7 100644 --- a/core/src/DTO/groupinfodto.cpp +++ b/core/src/DTO/groupinfodto.cpp @@ -29,55 +29,61 @@ #include -#include - namespace Jellyfin { namespace DTO { -GroupInfoDto::GroupInfoDto(QObject *parent) : QObject(parent) {} +GroupInfoDto::GroupInfoDto(QObject *parent) {} -GroupInfoDto *GroupInfoDto::fromJSON(QJsonObject source, QObject *parent) { - GroupInfoDto *instance = new GroupInfoDto(parent); - instance->updateFromJSON(source); +GroupInfoDto GroupInfoDto::fromJson(QJsonObject source) {GroupInfoDto instance; + instance->setFromJson(source, false); return instance; } -void GroupInfoDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void GroupInfoDto::setFromJson(QJsonObject source) { + m_groupId = fromJsonValue(source["GroupId"]); + m_groupName = fromJsonValue(source["GroupName"]); + m_state = fromJsonValue(source["State"]); + m_participants = fromJsonValue(source["Participants"]); + m_lastUpdatedAt = fromJsonValue(source["LastUpdatedAt"]); + } -QJsonObject GroupInfoDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject GroupInfoDto::toJson() { QJsonObject result; + result["GroupId"] = toJsonValue(m_groupId); + result["GroupName"] = toJsonValue(m_groupName); + result["State"] = toJsonValue(m_state); + result["Participants"] = toJsonValue(m_participants); + result["LastUpdatedAt"] = toJsonValue(m_lastUpdatedAt); + return result; } -QString GroupInfoDto::groupId() const { return m_groupId; } -void GroupInfoDto::setGroupId(QString newGroupId) { - m_groupId = newGroupId; - emit groupIdChanged(newGroupId); -} +QUuid GroupInfoDto::groupId() const { return m_groupId; } + +void GroupInfoDto::setGroupId(QUuid newGroupId) { + m_groupId = newGroupId; +} QString GroupInfoDto::groupName() const { return m_groupName; } + void GroupInfoDto::setGroupName(QString newGroupName) { m_groupName = newGroupName; - emit groupNameChanged(newGroupName); } - GroupStateType GroupInfoDto::state() const { return m_state; } + void GroupInfoDto::setState(GroupStateType newState) { m_state = newState; - emit stateChanged(newState); } - QStringList GroupInfoDto::participants() const { return m_participants; } + void GroupInfoDto::setParticipants(QStringList newParticipants) { m_participants = newParticipants; - emit participantsChanged(newParticipants); } - QDateTime GroupInfoDto::lastUpdatedAt() const { return m_lastUpdatedAt; } + void GroupInfoDto::setLastUpdatedAt(QDateTime newLastUpdatedAt) { m_lastUpdatedAt = newLastUpdatedAt; - emit lastUpdatedAtChanged(newLastUpdatedAt); } diff --git a/core/src/DTO/guideinfo.cpp b/core/src/DTO/guideinfo.cpp index ef82af7..d200adc 100644 --- a/core/src/DTO/guideinfo.cpp +++ b/core/src/DTO/guideinfo.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -GuideInfo::GuideInfo(QObject *parent) : QObject(parent) {} +GuideInfo::GuideInfo(QObject *parent) {} -GuideInfo *GuideInfo::fromJSON(QJsonObject source, QObject *parent) { - GuideInfo *instance = new GuideInfo(parent); - instance->updateFromJSON(source); +GuideInfo GuideInfo::fromJson(QJsonObject source) {GuideInfo instance; + instance->setFromJson(source, false); return instance; } -void GuideInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void GuideInfo::setFromJson(QJsonObject source) { + m_startDate = fromJsonValue(source["StartDate"]); + m_endDate = fromJsonValue(source["EndDate"]); + } -QJsonObject GuideInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject GuideInfo::toJson() { QJsonObject result; + result["StartDate"] = toJsonValue(m_startDate); + result["EndDate"] = toJsonValue(m_endDate); + return result; } + QDateTime GuideInfo::startDate() const { return m_startDate; } + void GuideInfo::setStartDate(QDateTime newStartDate) { m_startDate = newStartDate; - emit startDateChanged(newStartDate); } - QDateTime GuideInfo::endDate() const { return m_endDate; } + void GuideInfo::setEndDate(QDateTime newEndDate) { m_endDate = newEndDate; - emit endDateChanged(newEndDate); } diff --git a/core/src/DTO/httpheaderinfo.cpp b/core/src/DTO/httpheaderinfo.cpp index 6c3bc18..ea80618 100644 --- a/core/src/DTO/httpheaderinfo.cpp +++ b/core/src/DTO/httpheaderinfo.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -HttpHeaderInfo::HttpHeaderInfo(QObject *parent) : QObject(parent) {} +HttpHeaderInfo::HttpHeaderInfo(QObject *parent) {} -HttpHeaderInfo *HttpHeaderInfo::fromJSON(QJsonObject source, QObject *parent) { - HttpHeaderInfo *instance = new HttpHeaderInfo(parent); - instance->updateFromJSON(source); +HttpHeaderInfo HttpHeaderInfo::fromJson(QJsonObject source) {HttpHeaderInfo instance; + instance->setFromJson(source, false); return instance; } -void HttpHeaderInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void HttpHeaderInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_value = fromJsonValue(source["Value"]); + m_match = fromJsonValue(source["Match"]); + } -QJsonObject HttpHeaderInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject HttpHeaderInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Value"] = toJsonValue(m_value); + result["Match"] = toJsonValue(m_match); + return result; } + QString HttpHeaderInfo::name() const { return m_name; } + void HttpHeaderInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString HttpHeaderInfo::value() const { return m_value; } + void HttpHeaderInfo::setValue(QString newValue) { m_value = newValue; - emit valueChanged(newValue); } - HeaderMatchType HttpHeaderInfo::match() const { return m_match; } + void HttpHeaderInfo::setMatch(HeaderMatchType newMatch) { m_match = newMatch; - emit matchChanged(newMatch); } diff --git a/core/src/DTO/ignorewaitrequestdto.cpp b/core/src/DTO/ignorewaitrequestdto.cpp index 3643aab..2a43acd 100644 --- a/core/src/DTO/ignorewaitrequestdto.cpp +++ b/core/src/DTO/ignorewaitrequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -IgnoreWaitRequestDto::IgnoreWaitRequestDto(QObject *parent) : QObject(parent) {} +IgnoreWaitRequestDto::IgnoreWaitRequestDto(QObject *parent) {} -IgnoreWaitRequestDto *IgnoreWaitRequestDto::fromJSON(QJsonObject source, QObject *parent) { - IgnoreWaitRequestDto *instance = new IgnoreWaitRequestDto(parent); - instance->updateFromJSON(source); +IgnoreWaitRequestDto IgnoreWaitRequestDto::fromJson(QJsonObject source) {IgnoreWaitRequestDto instance; + instance->setFromJson(source, false); return instance; } -void IgnoreWaitRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void IgnoreWaitRequestDto::setFromJson(QJsonObject source) { + m_ignoreWait = fromJsonValue(source["IgnoreWait"]); + } -QJsonObject IgnoreWaitRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject IgnoreWaitRequestDto::toJson() { QJsonObject result; + result["IgnoreWait"] = toJsonValue(m_ignoreWait); + return result; } + bool IgnoreWaitRequestDto::ignoreWait() const { return m_ignoreWait; } + void IgnoreWaitRequestDto::setIgnoreWait(bool newIgnoreWait) { m_ignoreWait = newIgnoreWait; - emit ignoreWaitChanged(newIgnoreWait); } diff --git a/core/src/DTO/imagebynameinfo.cpp b/core/src/DTO/imagebynameinfo.cpp index b8a2861..bb98cd4 100644 --- a/core/src/DTO/imagebynameinfo.cpp +++ b/core/src/DTO/imagebynameinfo.cpp @@ -32,50 +32,58 @@ namespace Jellyfin { namespace DTO { -ImageByNameInfo::ImageByNameInfo(QObject *parent) : QObject(parent) {} +ImageByNameInfo::ImageByNameInfo(QObject *parent) {} -ImageByNameInfo *ImageByNameInfo::fromJSON(QJsonObject source, QObject *parent) { - ImageByNameInfo *instance = new ImageByNameInfo(parent); - instance->updateFromJSON(source); +ImageByNameInfo ImageByNameInfo::fromJson(QJsonObject source) {ImageByNameInfo instance; + instance->setFromJson(source, false); return instance; } -void ImageByNameInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ImageByNameInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_theme = fromJsonValue(source["Theme"]); + m_context = fromJsonValue(source["Context"]); + m_fileLength = fromJsonValue(source["FileLength"]); + m_format = fromJsonValue(source["Format"]); + } -QJsonObject ImageByNameInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ImageByNameInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Theme"] = toJsonValue(m_theme); + result["Context"] = toJsonValue(m_context); + result["FileLength"] = toJsonValue(m_fileLength); + result["Format"] = toJsonValue(m_format); + return result; } + QString ImageByNameInfo::name() const { return m_name; } + void ImageByNameInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString ImageByNameInfo::theme() const { return m_theme; } + void ImageByNameInfo::setTheme(QString newTheme) { m_theme = newTheme; - emit themeChanged(newTheme); } - QString ImageByNameInfo::context() const { return m_context; } + void ImageByNameInfo::setContext(QString newContext) { m_context = newContext; - emit contextChanged(newContext); } - qint64 ImageByNameInfo::fileLength() const { return m_fileLength; } + void ImageByNameInfo::setFileLength(qint64 newFileLength) { m_fileLength = newFileLength; - emit fileLengthChanged(newFileLength); } - QString ImageByNameInfo::format() const { return m_format; } + void ImageByNameInfo::setFormat(QString newFormat) { m_format = newFormat; - emit formatChanged(newFormat); } diff --git a/core/src/DTO/imageinfo.cpp b/core/src/DTO/imageinfo.cpp index 32b6410..edf0240 100644 --- a/core/src/DTO/imageinfo.cpp +++ b/core/src/DTO/imageinfo.cpp @@ -29,73 +29,82 @@ #include -#include - namespace Jellyfin { namespace DTO { -ImageInfo::ImageInfo(QObject *parent) : QObject(parent) {} +ImageInfo::ImageInfo(QObject *parent) {} -ImageInfo *ImageInfo::fromJSON(QJsonObject source, QObject *parent) { - ImageInfo *instance = new ImageInfo(parent); - instance->updateFromJSON(source); +ImageInfo ImageInfo::fromJson(QJsonObject source) {ImageInfo instance; + instance->setFromJson(source, false); return instance; } -void ImageInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ImageInfo::setFromJson(QJsonObject source) { + m_imageType = fromJsonValue(source["ImageType"]); + m_imageIndex = fromJsonValue(source["ImageIndex"]); + m_imageTag = fromJsonValue(source["ImageTag"]); + m_path = fromJsonValue(source["Path"]); + m_blurHash = fromJsonValue(source["BlurHash"]); + m_height = fromJsonValue(source["Height"]); + m_width = fromJsonValue(source["Width"]); + m_size = fromJsonValue(source["Size"]); + } -QJsonObject ImageInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ImageInfo::toJson() { QJsonObject result; + result["ImageType"] = toJsonValue(m_imageType); + result["ImageIndex"] = toJsonValue(m_imageIndex); + result["ImageTag"] = toJsonValue(m_imageTag); + result["Path"] = toJsonValue(m_path); + result["BlurHash"] = toJsonValue(m_blurHash); + result["Height"] = toJsonValue(m_height); + result["Width"] = toJsonValue(m_width); + result["Size"] = toJsonValue(m_size); + return result; } + ImageType ImageInfo::imageType() const { return m_imageType; } + void ImageInfo::setImageType(ImageType newImageType) { m_imageType = newImageType; - emit imageTypeChanged(newImageType); } - qint32 ImageInfo::imageIndex() const { return m_imageIndex; } + void ImageInfo::setImageIndex(qint32 newImageIndex) { m_imageIndex = newImageIndex; - emit imageIndexChanged(newImageIndex); } - QString ImageInfo::imageTag() const { return m_imageTag; } + void ImageInfo::setImageTag(QString newImageTag) { m_imageTag = newImageTag; - emit imageTagChanged(newImageTag); } - QString ImageInfo::path() const { return m_path; } + void ImageInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString ImageInfo::blurHash() const { return m_blurHash; } + void ImageInfo::setBlurHash(QString newBlurHash) { m_blurHash = newBlurHash; - emit blurHashChanged(newBlurHash); } - qint32 ImageInfo::height() const { return m_height; } + void ImageInfo::setHeight(qint32 newHeight) { m_height = newHeight; - emit heightChanged(newHeight); } - qint32 ImageInfo::width() const { return m_width; } + void ImageInfo::setWidth(qint32 newWidth) { m_width = newWidth; - emit widthChanged(newWidth); } - qint64 ImageInfo::size() const { return m_size; } + void ImageInfo::setSize(qint64 newSize) { m_size = newSize; - emit sizeChanged(newSize); } diff --git a/core/src/DTO/imageoption.cpp b/core/src/DTO/imageoption.cpp index 0dcbc76..8b6d675 100644 --- a/core/src/DTO/imageoption.cpp +++ b/core/src/DTO/imageoption.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -ImageOption::ImageOption(QObject *parent) : QObject(parent) {} +ImageOption::ImageOption(QObject *parent) {} -ImageOption *ImageOption::fromJSON(QJsonObject source, QObject *parent) { - ImageOption *instance = new ImageOption(parent); - instance->updateFromJSON(source); +ImageOption ImageOption::fromJson(QJsonObject source) {ImageOption instance; + instance->setFromJson(source, false); return instance; } -void ImageOption::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ImageOption::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["Type"]); + m_limit = fromJsonValue(source["Limit"]); + m_minWidth = fromJsonValue(source["MinWidth"]); + } -QJsonObject ImageOption::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ImageOption::toJson() { QJsonObject result; + result["Type"] = toJsonValue(m_type); + result["Limit"] = toJsonValue(m_limit); + result["MinWidth"] = toJsonValue(m_minWidth); + return result; } + ImageType ImageOption::type() const { return m_type; } + void ImageOption::setType(ImageType newType) { m_type = newType; - emit typeChanged(newType); } - qint32 ImageOption::limit() const { return m_limit; } + void ImageOption::setLimit(qint32 newLimit) { m_limit = newLimit; - emit limitChanged(newLimit); } - qint32 ImageOption::minWidth() const { return m_minWidth; } + void ImageOption::setMinWidth(qint32 newMinWidth) { m_minWidth = newMinWidth; - emit minWidthChanged(newMinWidth); } diff --git a/core/src/DTO/imageproviderinfo.cpp b/core/src/DTO/imageproviderinfo.cpp index 1e816b9..30de7a4 100644 --- a/core/src/DTO/imageproviderinfo.cpp +++ b/core/src/DTO/imageproviderinfo.cpp @@ -29,37 +29,40 @@ #include -#include - namespace Jellyfin { namespace DTO { -ImageProviderInfo::ImageProviderInfo(QObject *parent) : QObject(parent) {} +ImageProviderInfo::ImageProviderInfo(QObject *parent) {} -ImageProviderInfo *ImageProviderInfo::fromJSON(QJsonObject source, QObject *parent) { - ImageProviderInfo *instance = new ImageProviderInfo(parent); - instance->updateFromJSON(source); +ImageProviderInfo ImageProviderInfo::fromJson(QJsonObject source) {ImageProviderInfo instance; + instance->setFromJson(source, false); return instance; } -void ImageProviderInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ImageProviderInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_supportedImages = fromJsonValue>(source["SupportedImages"]); + } -QJsonObject ImageProviderInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ImageProviderInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["SupportedImages"] = toJsonValue>(m_supportedImages); + return result; } + QString ImageProviderInfo::name() const { return m_name; } + void ImageProviderInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QList ImageProviderInfo::supportedImages() const { return m_supportedImages; } + void ImageProviderInfo::setSupportedImages(QList newSupportedImages) { m_supportedImages = newSupportedImages; - emit supportedImagesChanged(newSupportedImages); } diff --git a/core/src/DTO/installationinfo.cpp b/core/src/DTO/installationinfo.cpp index dba4e36..ca3fb26 100644 --- a/core/src/DTO/installationinfo.cpp +++ b/core/src/DTO/installationinfo.cpp @@ -32,56 +32,65 @@ namespace Jellyfin { namespace DTO { -InstallationInfo::InstallationInfo(QObject *parent) : QObject(parent) {} +InstallationInfo::InstallationInfo(QObject *parent) {} -InstallationInfo *InstallationInfo::fromJSON(QJsonObject source, QObject *parent) { - InstallationInfo *instance = new InstallationInfo(parent); - instance->updateFromJSON(source); +InstallationInfo InstallationInfo::fromJson(QJsonObject source) {InstallationInfo instance; + instance->setFromJson(source, false); return instance; } -void InstallationInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void InstallationInfo::setFromJson(QJsonObject source) { + m_guid = fromJsonValue(source["Guid"]); + m_name = fromJsonValue(source["Name"]); + m_version = fromJsonValue>(source["Version"]); + m_changelog = fromJsonValue(source["Changelog"]); + m_sourceUrl = fromJsonValue(source["SourceUrl"]); + m_checksum = fromJsonValue(source["Checksum"]); + } -QJsonObject InstallationInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject InstallationInfo::toJson() { QJsonObject result; + result["Guid"] = toJsonValue(m_guid); + result["Name"] = toJsonValue(m_name); + result["Version"] = toJsonValue>(m_version); + result["Changelog"] = toJsonValue(m_changelog); + result["SourceUrl"] = toJsonValue(m_sourceUrl); + result["Checksum"] = toJsonValue(m_checksum); + return result; } -QString InstallationInfo::guid() const { return m_guid; } -void InstallationInfo::setGuid(QString newGuid) { - m_guid = newGuid; - emit guidChanged(newGuid); -} +QUuid InstallationInfo::guid() const { return m_guid; } + +void InstallationInfo::setGuid(QUuid newGuid) { + m_guid = newGuid; +} QString InstallationInfo::name() const { return m_name; } + void InstallationInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } +QSharedPointer InstallationInfo::version() const { return m_version; } -Version * InstallationInfo::version() const { return m_version; } -void InstallationInfo::setVersion(Version * newVersion) { +void InstallationInfo::setVersion(QSharedPointer newVersion) { m_version = newVersion; - emit versionChanged(newVersion); } - QString InstallationInfo::changelog() const { return m_changelog; } + void InstallationInfo::setChangelog(QString newChangelog) { m_changelog = newChangelog; - emit changelogChanged(newChangelog); } - QString InstallationInfo::sourceUrl() const { return m_sourceUrl; } + void InstallationInfo::setSourceUrl(QString newSourceUrl) { m_sourceUrl = newSourceUrl; - emit sourceUrlChanged(newSourceUrl); } - QString InstallationInfo::checksum() const { return m_checksum; } + void InstallationInfo::setChecksum(QString newChecksum) { m_checksum = newChecksum; - emit checksumChanged(newChecksum); } diff --git a/core/src/DTO/iplugin.cpp b/core/src/DTO/iplugin.cpp index 97f3ff9..2d10d7a 100644 --- a/core/src/DTO/iplugin.cpp +++ b/core/src/DTO/iplugin.cpp @@ -32,62 +32,72 @@ namespace Jellyfin { namespace DTO { -IPlugin::IPlugin(QObject *parent) : QObject(parent) {} +IPlugin::IPlugin(QObject *parent) {} -IPlugin *IPlugin::fromJSON(QJsonObject source, QObject *parent) { - IPlugin *instance = new IPlugin(parent); - instance->updateFromJSON(source); +IPlugin IPlugin::fromJson(QJsonObject source) {IPlugin instance; + instance->setFromJson(source, false); return instance; } -void IPlugin::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void IPlugin::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_description = fromJsonValue(source["Description"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_version = fromJsonValue>(source["Version"]); + m_assemblyFilePath = fromJsonValue(source["AssemblyFilePath"]); + m_canUninstall = fromJsonValue(source["CanUninstall"]); + m_dataFolderPath = fromJsonValue(source["DataFolderPath"]); + } -QJsonObject IPlugin::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject IPlugin::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Description"] = toJsonValue(m_description); + result["Id"] = toJsonValue(m_jellyfinId); + result["Version"] = toJsonValue>(m_version); + result["AssemblyFilePath"] = toJsonValue(m_assemblyFilePath); + result["CanUninstall"] = toJsonValue(m_canUninstall); + result["DataFolderPath"] = toJsonValue(m_dataFolderPath); + return result; } + QString IPlugin::name() const { return m_name; } + void IPlugin::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString IPlugin::description() const { return m_description; } + void IPlugin::setDescription(QString newDescription) { m_description = newDescription; - emit descriptionChanged(newDescription); } +QUuid IPlugin::jellyfinId() const { return m_jellyfinId; } -QString IPlugin::jellyfinId() const { return m_jellyfinId; } -void IPlugin::setJellyfinId(QString newJellyfinId) { +void IPlugin::setJellyfinId(QUuid newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } +QSharedPointer IPlugin::version() const { return m_version; } -Version * IPlugin::version() const { return m_version; } -void IPlugin::setVersion(Version * newVersion) { +void IPlugin::setVersion(QSharedPointer newVersion) { m_version = newVersion; - emit versionChanged(newVersion); } - QString IPlugin::assemblyFilePath() const { return m_assemblyFilePath; } + void IPlugin::setAssemblyFilePath(QString newAssemblyFilePath) { m_assemblyFilePath = newAssemblyFilePath; - emit assemblyFilePathChanged(newAssemblyFilePath); } - bool IPlugin::canUninstall() const { return m_canUninstall; } + void IPlugin::setCanUninstall(bool newCanUninstall) { m_canUninstall = newCanUninstall; - emit canUninstallChanged(newCanUninstall); } - QString IPlugin::dataFolderPath() const { return m_dataFolderPath; } + void IPlugin::setDataFolderPath(QString newDataFolderPath) { m_dataFolderPath = newDataFolderPath; - emit dataFolderPathChanged(newDataFolderPath); } diff --git a/core/src/DTO/itemcounts.cpp b/core/src/DTO/itemcounts.cpp index 1d78391..ecd3ef9 100644 --- a/core/src/DTO/itemcounts.cpp +++ b/core/src/DTO/itemcounts.cpp @@ -32,92 +32,107 @@ namespace Jellyfin { namespace DTO { -ItemCounts::ItemCounts(QObject *parent) : QObject(parent) {} +ItemCounts::ItemCounts(QObject *parent) {} -ItemCounts *ItemCounts::fromJSON(QJsonObject source, QObject *parent) { - ItemCounts *instance = new ItemCounts(parent); - instance->updateFromJSON(source); +ItemCounts ItemCounts::fromJson(QJsonObject source) {ItemCounts instance; + instance->setFromJson(source, false); return instance; } -void ItemCounts::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ItemCounts::setFromJson(QJsonObject source) { + m_movieCount = fromJsonValue(source["MovieCount"]); + m_seriesCount = fromJsonValue(source["SeriesCount"]); + m_episodeCount = fromJsonValue(source["EpisodeCount"]); + m_artistCount = fromJsonValue(source["ArtistCount"]); + m_programCount = fromJsonValue(source["ProgramCount"]); + m_trailerCount = fromJsonValue(source["TrailerCount"]); + m_songCount = fromJsonValue(source["SongCount"]); + m_albumCount = fromJsonValue(source["AlbumCount"]); + m_musicVideoCount = fromJsonValue(source["MusicVideoCount"]); + m_boxSetCount = fromJsonValue(source["BoxSetCount"]); + m_bookCount = fromJsonValue(source["BookCount"]); + m_itemCount = fromJsonValue(source["ItemCount"]); + } -QJsonObject ItemCounts::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ItemCounts::toJson() { QJsonObject result; + result["MovieCount"] = toJsonValue(m_movieCount); + result["SeriesCount"] = toJsonValue(m_seriesCount); + result["EpisodeCount"] = toJsonValue(m_episodeCount); + result["ArtistCount"] = toJsonValue(m_artistCount); + result["ProgramCount"] = toJsonValue(m_programCount); + result["TrailerCount"] = toJsonValue(m_trailerCount); + result["SongCount"] = toJsonValue(m_songCount); + result["AlbumCount"] = toJsonValue(m_albumCount); + result["MusicVideoCount"] = toJsonValue(m_musicVideoCount); + result["BoxSetCount"] = toJsonValue(m_boxSetCount); + result["BookCount"] = toJsonValue(m_bookCount); + result["ItemCount"] = toJsonValue(m_itemCount); + return result; } + qint32 ItemCounts::movieCount() const { return m_movieCount; } + void ItemCounts::setMovieCount(qint32 newMovieCount) { m_movieCount = newMovieCount; - emit movieCountChanged(newMovieCount); } - qint32 ItemCounts::seriesCount() const { return m_seriesCount; } + void ItemCounts::setSeriesCount(qint32 newSeriesCount) { m_seriesCount = newSeriesCount; - emit seriesCountChanged(newSeriesCount); } - qint32 ItemCounts::episodeCount() const { return m_episodeCount; } + void ItemCounts::setEpisodeCount(qint32 newEpisodeCount) { m_episodeCount = newEpisodeCount; - emit episodeCountChanged(newEpisodeCount); } - qint32 ItemCounts::artistCount() const { return m_artistCount; } + void ItemCounts::setArtistCount(qint32 newArtistCount) { m_artistCount = newArtistCount; - emit artistCountChanged(newArtistCount); } - qint32 ItemCounts::programCount() const { return m_programCount; } + void ItemCounts::setProgramCount(qint32 newProgramCount) { m_programCount = newProgramCount; - emit programCountChanged(newProgramCount); } - qint32 ItemCounts::trailerCount() const { return m_trailerCount; } + void ItemCounts::setTrailerCount(qint32 newTrailerCount) { m_trailerCount = newTrailerCount; - emit trailerCountChanged(newTrailerCount); } - qint32 ItemCounts::songCount() const { return m_songCount; } + void ItemCounts::setSongCount(qint32 newSongCount) { m_songCount = newSongCount; - emit songCountChanged(newSongCount); } - qint32 ItemCounts::albumCount() const { return m_albumCount; } + void ItemCounts::setAlbumCount(qint32 newAlbumCount) { m_albumCount = newAlbumCount; - emit albumCountChanged(newAlbumCount); } - qint32 ItemCounts::musicVideoCount() const { return m_musicVideoCount; } + void ItemCounts::setMusicVideoCount(qint32 newMusicVideoCount) { m_musicVideoCount = newMusicVideoCount; - emit musicVideoCountChanged(newMusicVideoCount); } - qint32 ItemCounts::boxSetCount() const { return m_boxSetCount; } + void ItemCounts::setBoxSetCount(qint32 newBoxSetCount) { m_boxSetCount = newBoxSetCount; - emit boxSetCountChanged(newBoxSetCount); } - qint32 ItemCounts::bookCount() const { return m_bookCount; } + void ItemCounts::setBookCount(qint32 newBookCount) { m_bookCount = newBookCount; - emit bookCountChanged(newBookCount); } - qint32 ItemCounts::itemCount() const { return m_itemCount; } + void ItemCounts::setItemCount(qint32 newItemCount) { m_itemCount = newItemCount; - emit itemCountChanged(newItemCount); } diff --git a/core/src/DTO/joingrouprequestdto.cpp b/core/src/DTO/joingrouprequestdto.cpp index 07000a2..926b8e5 100644 --- a/core/src/DTO/joingrouprequestdto.cpp +++ b/core/src/DTO/joingrouprequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -JoinGroupRequestDto::JoinGroupRequestDto(QObject *parent) : QObject(parent) {} +JoinGroupRequestDto::JoinGroupRequestDto(QObject *parent) {} -JoinGroupRequestDto *JoinGroupRequestDto::fromJSON(QJsonObject source, QObject *parent) { - JoinGroupRequestDto *instance = new JoinGroupRequestDto(parent); - instance->updateFromJSON(source); +JoinGroupRequestDto JoinGroupRequestDto::fromJson(QJsonObject source) {JoinGroupRequestDto instance; + instance->setFromJson(source, false); return instance; } -void JoinGroupRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void JoinGroupRequestDto::setFromJson(QJsonObject source) { + m_groupId = fromJsonValue(source["GroupId"]); + } -QJsonObject JoinGroupRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject JoinGroupRequestDto::toJson() { QJsonObject result; + result["GroupId"] = toJsonValue(m_groupId); + return result; } -QString JoinGroupRequestDto::groupId() const { return m_groupId; } -void JoinGroupRequestDto::setGroupId(QString newGroupId) { + +QUuid JoinGroupRequestDto::groupId() const { return m_groupId; } + +void JoinGroupRequestDto::setGroupId(QUuid newGroupId) { m_groupId = newGroupId; - emit groupIdChanged(newGroupId); } diff --git a/core/src/DTO/libraryoptioninfodto.cpp b/core/src/DTO/libraryoptioninfodto.cpp index 039cf1e..6975399 100644 --- a/core/src/DTO/libraryoptioninfodto.cpp +++ b/core/src/DTO/libraryoptioninfodto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -LibraryOptionInfoDto::LibraryOptionInfoDto(QObject *parent) : QObject(parent) {} +LibraryOptionInfoDto::LibraryOptionInfoDto(QObject *parent) {} -LibraryOptionInfoDto *LibraryOptionInfoDto::fromJSON(QJsonObject source, QObject *parent) { - LibraryOptionInfoDto *instance = new LibraryOptionInfoDto(parent); - instance->updateFromJSON(source); +LibraryOptionInfoDto LibraryOptionInfoDto::fromJson(QJsonObject source) {LibraryOptionInfoDto instance; + instance->setFromJson(source, false); return instance; } -void LibraryOptionInfoDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LibraryOptionInfoDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_defaultEnabled = fromJsonValue(source["DefaultEnabled"]); + } -QJsonObject LibraryOptionInfoDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LibraryOptionInfoDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["DefaultEnabled"] = toJsonValue(m_defaultEnabled); + return result; } + QString LibraryOptionInfoDto::name() const { return m_name; } + void LibraryOptionInfoDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - bool LibraryOptionInfoDto::defaultEnabled() const { return m_defaultEnabled; } + void LibraryOptionInfoDto::setDefaultEnabled(bool newDefaultEnabled) { m_defaultEnabled = newDefaultEnabled; - emit defaultEnabledChanged(newDefaultEnabled); } diff --git a/core/src/DTO/libraryoptions.cpp b/core/src/DTO/libraryoptions.cpp index d290b17..4e2a222 100644 --- a/core/src/DTO/libraryoptions.cpp +++ b/core/src/DTO/libraryoptions.cpp @@ -32,170 +32,198 @@ namespace Jellyfin { namespace DTO { -LibraryOptions::LibraryOptions(QObject *parent) : QObject(parent) {} +LibraryOptions::LibraryOptions(QObject *parent) {} -LibraryOptions *LibraryOptions::fromJSON(QJsonObject source, QObject *parent) { - LibraryOptions *instance = new LibraryOptions(parent); - instance->updateFromJSON(source); +LibraryOptions LibraryOptions::fromJson(QJsonObject source) {LibraryOptions instance; + instance->setFromJson(source, false); return instance; } -void LibraryOptions::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LibraryOptions::setFromJson(QJsonObject source) { + m_enablePhotos = fromJsonValue(source["EnablePhotos"]); + m_enableRealtimeMonitor = fromJsonValue(source["EnableRealtimeMonitor"]); + m_enableChapterImageExtraction = fromJsonValue(source["EnableChapterImageExtraction"]); + m_extractChapterImagesDuringLibraryScan = fromJsonValue(source["ExtractChapterImagesDuringLibraryScan"]); + m_pathInfos = fromJsonValue>>(source["PathInfos"]); + m_saveLocalMetadata = fromJsonValue(source["SaveLocalMetadata"]); + m_enableInternetProviders = fromJsonValue(source["EnableInternetProviders"]); + m_enableAutomaticSeriesGrouping = fromJsonValue(source["EnableAutomaticSeriesGrouping"]); + m_enableEmbeddedTitles = fromJsonValue(source["EnableEmbeddedTitles"]); + m_enableEmbeddedEpisodeInfos = fromJsonValue(source["EnableEmbeddedEpisodeInfos"]); + m_automaticRefreshIntervalDays = fromJsonValue(source["AutomaticRefreshIntervalDays"]); + m_preferredMetadataLanguage = fromJsonValue(source["PreferredMetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_seasonZeroDisplayName = fromJsonValue(source["SeasonZeroDisplayName"]); + m_metadataSavers = fromJsonValue(source["MetadataSavers"]); + m_disabledLocalMetadataReaders = fromJsonValue(source["DisabledLocalMetadataReaders"]); + m_localMetadataReaderOrder = fromJsonValue(source["LocalMetadataReaderOrder"]); + m_disabledSubtitleFetchers = fromJsonValue(source["DisabledSubtitleFetchers"]); + m_subtitleFetcherOrder = fromJsonValue(source["SubtitleFetcherOrder"]); + m_skipSubtitlesIfEmbeddedSubtitlesPresent = fromJsonValue(source["SkipSubtitlesIfEmbeddedSubtitlesPresent"]); + m_skipSubtitlesIfAudioTrackMatches = fromJsonValue(source["SkipSubtitlesIfAudioTrackMatches"]); + m_subtitleDownloadLanguages = fromJsonValue(source["SubtitleDownloadLanguages"]); + m_requirePerfectSubtitleMatch = fromJsonValue(source["RequirePerfectSubtitleMatch"]); + m_saveSubtitlesWithMedia = fromJsonValue(source["SaveSubtitlesWithMedia"]); + m_typeOptions = fromJsonValue>>(source["TypeOptions"]); + } -QJsonObject LibraryOptions::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LibraryOptions::toJson() { QJsonObject result; + result["EnablePhotos"] = toJsonValue(m_enablePhotos); + result["EnableRealtimeMonitor"] = toJsonValue(m_enableRealtimeMonitor); + result["EnableChapterImageExtraction"] = toJsonValue(m_enableChapterImageExtraction); + result["ExtractChapterImagesDuringLibraryScan"] = toJsonValue(m_extractChapterImagesDuringLibraryScan); + result["PathInfos"] = toJsonValue>>(m_pathInfos); + result["SaveLocalMetadata"] = toJsonValue(m_saveLocalMetadata); + result["EnableInternetProviders"] = toJsonValue(m_enableInternetProviders); + result["EnableAutomaticSeriesGrouping"] = toJsonValue(m_enableAutomaticSeriesGrouping); + result["EnableEmbeddedTitles"] = toJsonValue(m_enableEmbeddedTitles); + result["EnableEmbeddedEpisodeInfos"] = toJsonValue(m_enableEmbeddedEpisodeInfos); + result["AutomaticRefreshIntervalDays"] = toJsonValue(m_automaticRefreshIntervalDays); + result["PreferredMetadataLanguage"] = toJsonValue(m_preferredMetadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["SeasonZeroDisplayName"] = toJsonValue(m_seasonZeroDisplayName); + result["MetadataSavers"] = toJsonValue(m_metadataSavers); + result["DisabledLocalMetadataReaders"] = toJsonValue(m_disabledLocalMetadataReaders); + result["LocalMetadataReaderOrder"] = toJsonValue(m_localMetadataReaderOrder); + result["DisabledSubtitleFetchers"] = toJsonValue(m_disabledSubtitleFetchers); + result["SubtitleFetcherOrder"] = toJsonValue(m_subtitleFetcherOrder); + result["SkipSubtitlesIfEmbeddedSubtitlesPresent"] = toJsonValue(m_skipSubtitlesIfEmbeddedSubtitlesPresent); + result["SkipSubtitlesIfAudioTrackMatches"] = toJsonValue(m_skipSubtitlesIfAudioTrackMatches); + result["SubtitleDownloadLanguages"] = toJsonValue(m_subtitleDownloadLanguages); + result["RequirePerfectSubtitleMatch"] = toJsonValue(m_requirePerfectSubtitleMatch); + result["SaveSubtitlesWithMedia"] = toJsonValue(m_saveSubtitlesWithMedia); + result["TypeOptions"] = toJsonValue>>(m_typeOptions); + return result; } + bool LibraryOptions::enablePhotos() const { return m_enablePhotos; } + void LibraryOptions::setEnablePhotos(bool newEnablePhotos) { m_enablePhotos = newEnablePhotos; - emit enablePhotosChanged(newEnablePhotos); } - bool LibraryOptions::enableRealtimeMonitor() const { return m_enableRealtimeMonitor; } + void LibraryOptions::setEnableRealtimeMonitor(bool newEnableRealtimeMonitor) { m_enableRealtimeMonitor = newEnableRealtimeMonitor; - emit enableRealtimeMonitorChanged(newEnableRealtimeMonitor); } - bool LibraryOptions::enableChapterImageExtraction() const { return m_enableChapterImageExtraction; } + void LibraryOptions::setEnableChapterImageExtraction(bool newEnableChapterImageExtraction) { m_enableChapterImageExtraction = newEnableChapterImageExtraction; - emit enableChapterImageExtractionChanged(newEnableChapterImageExtraction); } - bool LibraryOptions::extractChapterImagesDuringLibraryScan() const { return m_extractChapterImagesDuringLibraryScan; } + void LibraryOptions::setExtractChapterImagesDuringLibraryScan(bool newExtractChapterImagesDuringLibraryScan) { m_extractChapterImagesDuringLibraryScan = newExtractChapterImagesDuringLibraryScan; - emit extractChapterImagesDuringLibraryScanChanged(newExtractChapterImagesDuringLibraryScan); } +QList> LibraryOptions::pathInfos() const { return m_pathInfos; } -QList LibraryOptions::pathInfos() const { return m_pathInfos; } -void LibraryOptions::setPathInfos(QList newPathInfos) { +void LibraryOptions::setPathInfos(QList> newPathInfos) { m_pathInfos = newPathInfos; - emit pathInfosChanged(newPathInfos); } - bool LibraryOptions::saveLocalMetadata() const { return m_saveLocalMetadata; } + void LibraryOptions::setSaveLocalMetadata(bool newSaveLocalMetadata) { m_saveLocalMetadata = newSaveLocalMetadata; - emit saveLocalMetadataChanged(newSaveLocalMetadata); } - bool LibraryOptions::enableInternetProviders() const { return m_enableInternetProviders; } + void LibraryOptions::setEnableInternetProviders(bool newEnableInternetProviders) { m_enableInternetProviders = newEnableInternetProviders; - emit enableInternetProvidersChanged(newEnableInternetProviders); } - bool LibraryOptions::enableAutomaticSeriesGrouping() const { return m_enableAutomaticSeriesGrouping; } + void LibraryOptions::setEnableAutomaticSeriesGrouping(bool newEnableAutomaticSeriesGrouping) { m_enableAutomaticSeriesGrouping = newEnableAutomaticSeriesGrouping; - emit enableAutomaticSeriesGroupingChanged(newEnableAutomaticSeriesGrouping); } - bool LibraryOptions::enableEmbeddedTitles() const { return m_enableEmbeddedTitles; } + void LibraryOptions::setEnableEmbeddedTitles(bool newEnableEmbeddedTitles) { m_enableEmbeddedTitles = newEnableEmbeddedTitles; - emit enableEmbeddedTitlesChanged(newEnableEmbeddedTitles); } - bool LibraryOptions::enableEmbeddedEpisodeInfos() const { return m_enableEmbeddedEpisodeInfos; } + void LibraryOptions::setEnableEmbeddedEpisodeInfos(bool newEnableEmbeddedEpisodeInfos) { m_enableEmbeddedEpisodeInfos = newEnableEmbeddedEpisodeInfos; - emit enableEmbeddedEpisodeInfosChanged(newEnableEmbeddedEpisodeInfos); } - qint32 LibraryOptions::automaticRefreshIntervalDays() const { return m_automaticRefreshIntervalDays; } + void LibraryOptions::setAutomaticRefreshIntervalDays(qint32 newAutomaticRefreshIntervalDays) { m_automaticRefreshIntervalDays = newAutomaticRefreshIntervalDays; - emit automaticRefreshIntervalDaysChanged(newAutomaticRefreshIntervalDays); } - QString LibraryOptions::preferredMetadataLanguage() const { return m_preferredMetadataLanguage; } + void LibraryOptions::setPreferredMetadataLanguage(QString newPreferredMetadataLanguage) { m_preferredMetadataLanguage = newPreferredMetadataLanguage; - emit preferredMetadataLanguageChanged(newPreferredMetadataLanguage); } - QString LibraryOptions::metadataCountryCode() const { return m_metadataCountryCode; } + void LibraryOptions::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QString LibraryOptions::seasonZeroDisplayName() const { return m_seasonZeroDisplayName; } + void LibraryOptions::setSeasonZeroDisplayName(QString newSeasonZeroDisplayName) { m_seasonZeroDisplayName = newSeasonZeroDisplayName; - emit seasonZeroDisplayNameChanged(newSeasonZeroDisplayName); } - QStringList LibraryOptions::metadataSavers() const { return m_metadataSavers; } + void LibraryOptions::setMetadataSavers(QStringList newMetadataSavers) { m_metadataSavers = newMetadataSavers; - emit metadataSaversChanged(newMetadataSavers); } - QStringList LibraryOptions::disabledLocalMetadataReaders() const { return m_disabledLocalMetadataReaders; } + void LibraryOptions::setDisabledLocalMetadataReaders(QStringList newDisabledLocalMetadataReaders) { m_disabledLocalMetadataReaders = newDisabledLocalMetadataReaders; - emit disabledLocalMetadataReadersChanged(newDisabledLocalMetadataReaders); } - QStringList LibraryOptions::localMetadataReaderOrder() const { return m_localMetadataReaderOrder; } + void LibraryOptions::setLocalMetadataReaderOrder(QStringList newLocalMetadataReaderOrder) { m_localMetadataReaderOrder = newLocalMetadataReaderOrder; - emit localMetadataReaderOrderChanged(newLocalMetadataReaderOrder); } - QStringList LibraryOptions::disabledSubtitleFetchers() const { return m_disabledSubtitleFetchers; } + void LibraryOptions::setDisabledSubtitleFetchers(QStringList newDisabledSubtitleFetchers) { m_disabledSubtitleFetchers = newDisabledSubtitleFetchers; - emit disabledSubtitleFetchersChanged(newDisabledSubtitleFetchers); } - QStringList LibraryOptions::subtitleFetcherOrder() const { return m_subtitleFetcherOrder; } + void LibraryOptions::setSubtitleFetcherOrder(QStringList newSubtitleFetcherOrder) { m_subtitleFetcherOrder = newSubtitleFetcherOrder; - emit subtitleFetcherOrderChanged(newSubtitleFetcherOrder); } - bool LibraryOptions::skipSubtitlesIfEmbeddedSubtitlesPresent() const { return m_skipSubtitlesIfEmbeddedSubtitlesPresent; } + void LibraryOptions::setSkipSubtitlesIfEmbeddedSubtitlesPresent(bool newSkipSubtitlesIfEmbeddedSubtitlesPresent) { m_skipSubtitlesIfEmbeddedSubtitlesPresent = newSkipSubtitlesIfEmbeddedSubtitlesPresent; - emit skipSubtitlesIfEmbeddedSubtitlesPresentChanged(newSkipSubtitlesIfEmbeddedSubtitlesPresent); } - bool LibraryOptions::skipSubtitlesIfAudioTrackMatches() const { return m_skipSubtitlesIfAudioTrackMatches; } + void LibraryOptions::setSkipSubtitlesIfAudioTrackMatches(bool newSkipSubtitlesIfAudioTrackMatches) { m_skipSubtitlesIfAudioTrackMatches = newSkipSubtitlesIfAudioTrackMatches; - emit skipSubtitlesIfAudioTrackMatchesChanged(newSkipSubtitlesIfAudioTrackMatches); } - QStringList LibraryOptions::subtitleDownloadLanguages() const { return m_subtitleDownloadLanguages; } + void LibraryOptions::setSubtitleDownloadLanguages(QStringList newSubtitleDownloadLanguages) { m_subtitleDownloadLanguages = newSubtitleDownloadLanguages; - emit subtitleDownloadLanguagesChanged(newSubtitleDownloadLanguages); } - bool LibraryOptions::requirePerfectSubtitleMatch() const { return m_requirePerfectSubtitleMatch; } + void LibraryOptions::setRequirePerfectSubtitleMatch(bool newRequirePerfectSubtitleMatch) { m_requirePerfectSubtitleMatch = newRequirePerfectSubtitleMatch; - emit requirePerfectSubtitleMatchChanged(newRequirePerfectSubtitleMatch); } - bool LibraryOptions::saveSubtitlesWithMedia() const { return m_saveSubtitlesWithMedia; } + void LibraryOptions::setSaveSubtitlesWithMedia(bool newSaveSubtitlesWithMedia) { m_saveSubtitlesWithMedia = newSaveSubtitlesWithMedia; - emit saveSubtitlesWithMediaChanged(newSaveSubtitlesWithMedia); } +QList> LibraryOptions::typeOptions() const { return m_typeOptions; } -QList LibraryOptions::typeOptions() const { return m_typeOptions; } -void LibraryOptions::setTypeOptions(QList newTypeOptions) { +void LibraryOptions::setTypeOptions(QList> newTypeOptions) { m_typeOptions = newTypeOptions; - emit typeOptionsChanged(newTypeOptions); } diff --git a/core/src/DTO/libraryoptionsresultdto.cpp b/core/src/DTO/libraryoptionsresultdto.cpp index 13fc132..d609fdd 100644 --- a/core/src/DTO/libraryoptionsresultdto.cpp +++ b/core/src/DTO/libraryoptionsresultdto.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -LibraryOptionsResultDto::LibraryOptionsResultDto(QObject *parent) : QObject(parent) {} +LibraryOptionsResultDto::LibraryOptionsResultDto(QObject *parent) {} -LibraryOptionsResultDto *LibraryOptionsResultDto::fromJSON(QJsonObject source, QObject *parent) { - LibraryOptionsResultDto *instance = new LibraryOptionsResultDto(parent); - instance->updateFromJSON(source); +LibraryOptionsResultDto LibraryOptionsResultDto::fromJson(QJsonObject source) {LibraryOptionsResultDto instance; + instance->setFromJson(source, false); return instance; } -void LibraryOptionsResultDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LibraryOptionsResultDto::setFromJson(QJsonObject source) { + m_metadataSavers = fromJsonValue>>(source["MetadataSavers"]); + m_metadataReaders = fromJsonValue>>(source["MetadataReaders"]); + m_subtitleFetchers = fromJsonValue>>(source["SubtitleFetchers"]); + m_typeOptions = fromJsonValue>>(source["TypeOptions"]); + } -QJsonObject LibraryOptionsResultDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LibraryOptionsResultDto::toJson() { QJsonObject result; + result["MetadataSavers"] = toJsonValue>>(m_metadataSavers); + result["MetadataReaders"] = toJsonValue>>(m_metadataReaders); + result["SubtitleFetchers"] = toJsonValue>>(m_subtitleFetchers); + result["TypeOptions"] = toJsonValue>>(m_typeOptions); + return result; } -QList LibraryOptionsResultDto::metadataSavers() const { return m_metadataSavers; } -void LibraryOptionsResultDto::setMetadataSavers(QList newMetadataSavers) { + +QList> LibraryOptionsResultDto::metadataSavers() const { return m_metadataSavers; } + +void LibraryOptionsResultDto::setMetadataSavers(QList> newMetadataSavers) { m_metadataSavers = newMetadataSavers; - emit metadataSaversChanged(newMetadataSavers); } +QList> LibraryOptionsResultDto::metadataReaders() const { return m_metadataReaders; } -QList LibraryOptionsResultDto::metadataReaders() const { return m_metadataReaders; } -void LibraryOptionsResultDto::setMetadataReaders(QList newMetadataReaders) { +void LibraryOptionsResultDto::setMetadataReaders(QList> newMetadataReaders) { m_metadataReaders = newMetadataReaders; - emit metadataReadersChanged(newMetadataReaders); } +QList> LibraryOptionsResultDto::subtitleFetchers() const { return m_subtitleFetchers; } -QList LibraryOptionsResultDto::subtitleFetchers() const { return m_subtitleFetchers; } -void LibraryOptionsResultDto::setSubtitleFetchers(QList newSubtitleFetchers) { +void LibraryOptionsResultDto::setSubtitleFetchers(QList> newSubtitleFetchers) { m_subtitleFetchers = newSubtitleFetchers; - emit subtitleFetchersChanged(newSubtitleFetchers); } +QList> LibraryOptionsResultDto::typeOptions() const { return m_typeOptions; } -QList LibraryOptionsResultDto::typeOptions() const { return m_typeOptions; } -void LibraryOptionsResultDto::setTypeOptions(QList newTypeOptions) { +void LibraryOptionsResultDto::setTypeOptions(QList> newTypeOptions) { m_typeOptions = newTypeOptions; - emit typeOptionsChanged(newTypeOptions); } diff --git a/core/src/DTO/librarytypeoptionsdto.cpp b/core/src/DTO/librarytypeoptionsdto.cpp index fac173c..79fcfff 100644 --- a/core/src/DTO/librarytypeoptionsdto.cpp +++ b/core/src/DTO/librarytypeoptionsdto.cpp @@ -29,55 +29,61 @@ #include -#include - namespace Jellyfin { namespace DTO { -LibraryTypeOptionsDto::LibraryTypeOptionsDto(QObject *parent) : QObject(parent) {} +LibraryTypeOptionsDto::LibraryTypeOptionsDto(QObject *parent) {} -LibraryTypeOptionsDto *LibraryTypeOptionsDto::fromJSON(QJsonObject source, QObject *parent) { - LibraryTypeOptionsDto *instance = new LibraryTypeOptionsDto(parent); - instance->updateFromJSON(source); +LibraryTypeOptionsDto LibraryTypeOptionsDto::fromJson(QJsonObject source) {LibraryTypeOptionsDto instance; + instance->setFromJson(source, false); return instance; } -void LibraryTypeOptionsDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LibraryTypeOptionsDto::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["Type"]); + m_metadataFetchers = fromJsonValue>>(source["MetadataFetchers"]); + m_imageFetchers = fromJsonValue>>(source["ImageFetchers"]); + m_supportedImageTypes = fromJsonValue>(source["SupportedImageTypes"]); + m_defaultImageOptions = fromJsonValue>>(source["DefaultImageOptions"]); + } -QJsonObject LibraryTypeOptionsDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LibraryTypeOptionsDto::toJson() { QJsonObject result; + result["Type"] = toJsonValue(m_type); + result["MetadataFetchers"] = toJsonValue>>(m_metadataFetchers); + result["ImageFetchers"] = toJsonValue>>(m_imageFetchers); + result["SupportedImageTypes"] = toJsonValue>(m_supportedImageTypes); + result["DefaultImageOptions"] = toJsonValue>>(m_defaultImageOptions); + return result; } + QString LibraryTypeOptionsDto::type() const { return m_type; } + void LibraryTypeOptionsDto::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } +QList> LibraryTypeOptionsDto::metadataFetchers() const { return m_metadataFetchers; } -QList LibraryTypeOptionsDto::metadataFetchers() const { return m_metadataFetchers; } -void LibraryTypeOptionsDto::setMetadataFetchers(QList newMetadataFetchers) { +void LibraryTypeOptionsDto::setMetadataFetchers(QList> newMetadataFetchers) { m_metadataFetchers = newMetadataFetchers; - emit metadataFetchersChanged(newMetadataFetchers); } +QList> LibraryTypeOptionsDto::imageFetchers() const { return m_imageFetchers; } -QList LibraryTypeOptionsDto::imageFetchers() const { return m_imageFetchers; } -void LibraryTypeOptionsDto::setImageFetchers(QList newImageFetchers) { +void LibraryTypeOptionsDto::setImageFetchers(QList> newImageFetchers) { m_imageFetchers = newImageFetchers; - emit imageFetchersChanged(newImageFetchers); } - QList LibraryTypeOptionsDto::supportedImageTypes() const { return m_supportedImageTypes; } + void LibraryTypeOptionsDto::setSupportedImageTypes(QList newSupportedImageTypes) { m_supportedImageTypes = newSupportedImageTypes; - emit supportedImageTypesChanged(newSupportedImageTypes); } +QList> LibraryTypeOptionsDto::defaultImageOptions() const { return m_defaultImageOptions; } -QList LibraryTypeOptionsDto::defaultImageOptions() const { return m_defaultImageOptions; } -void LibraryTypeOptionsDto::setDefaultImageOptions(QList newDefaultImageOptions) { +void LibraryTypeOptionsDto::setDefaultImageOptions(QList> newDefaultImageOptions) { m_defaultImageOptions = newDefaultImageOptions; - emit defaultImageOptionsChanged(newDefaultImageOptions); } diff --git a/core/src/DTO/libraryupdateinfo.cpp b/core/src/DTO/libraryupdateinfo.cpp index dfc58de..7939a46 100644 --- a/core/src/DTO/libraryupdateinfo.cpp +++ b/core/src/DTO/libraryupdateinfo.cpp @@ -32,62 +32,72 @@ namespace Jellyfin { namespace DTO { -LibraryUpdateInfo::LibraryUpdateInfo(QObject *parent) : QObject(parent) {} +LibraryUpdateInfo::LibraryUpdateInfo(QObject *parent) {} -LibraryUpdateInfo *LibraryUpdateInfo::fromJSON(QJsonObject source, QObject *parent) { - LibraryUpdateInfo *instance = new LibraryUpdateInfo(parent); - instance->updateFromJSON(source); +LibraryUpdateInfo LibraryUpdateInfo::fromJson(QJsonObject source) {LibraryUpdateInfo instance; + instance->setFromJson(source, false); return instance; } -void LibraryUpdateInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LibraryUpdateInfo::setFromJson(QJsonObject source) { + m_foldersAddedTo = fromJsonValue(source["FoldersAddedTo"]); + m_foldersRemovedFrom = fromJsonValue(source["FoldersRemovedFrom"]); + m_itemsAdded = fromJsonValue(source["ItemsAdded"]); + m_itemsRemoved = fromJsonValue(source["ItemsRemoved"]); + m_itemsUpdated = fromJsonValue(source["ItemsUpdated"]); + m_collectionFolders = fromJsonValue(source["CollectionFolders"]); + m_isEmpty = fromJsonValue(source["IsEmpty"]); + } -QJsonObject LibraryUpdateInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LibraryUpdateInfo::toJson() { QJsonObject result; + result["FoldersAddedTo"] = toJsonValue(m_foldersAddedTo); + result["FoldersRemovedFrom"] = toJsonValue(m_foldersRemovedFrom); + result["ItemsAdded"] = toJsonValue(m_itemsAdded); + result["ItemsRemoved"] = toJsonValue(m_itemsRemoved); + result["ItemsUpdated"] = toJsonValue(m_itemsUpdated); + result["CollectionFolders"] = toJsonValue(m_collectionFolders); + result["IsEmpty"] = toJsonValue(m_isEmpty); + return result; } + QStringList LibraryUpdateInfo::foldersAddedTo() const { return m_foldersAddedTo; } + void LibraryUpdateInfo::setFoldersAddedTo(QStringList newFoldersAddedTo) { m_foldersAddedTo = newFoldersAddedTo; - emit foldersAddedToChanged(newFoldersAddedTo); } - QStringList LibraryUpdateInfo::foldersRemovedFrom() const { return m_foldersRemovedFrom; } + void LibraryUpdateInfo::setFoldersRemovedFrom(QStringList newFoldersRemovedFrom) { m_foldersRemovedFrom = newFoldersRemovedFrom; - emit foldersRemovedFromChanged(newFoldersRemovedFrom); } - QStringList LibraryUpdateInfo::itemsAdded() const { return m_itemsAdded; } + void LibraryUpdateInfo::setItemsAdded(QStringList newItemsAdded) { m_itemsAdded = newItemsAdded; - emit itemsAddedChanged(newItemsAdded); } - QStringList LibraryUpdateInfo::itemsRemoved() const { return m_itemsRemoved; } + void LibraryUpdateInfo::setItemsRemoved(QStringList newItemsRemoved) { m_itemsRemoved = newItemsRemoved; - emit itemsRemovedChanged(newItemsRemoved); } - QStringList LibraryUpdateInfo::itemsUpdated() const { return m_itemsUpdated; } + void LibraryUpdateInfo::setItemsUpdated(QStringList newItemsUpdated) { m_itemsUpdated = newItemsUpdated; - emit itemsUpdatedChanged(newItemsUpdated); } - QStringList LibraryUpdateInfo::collectionFolders() const { return m_collectionFolders; } + void LibraryUpdateInfo::setCollectionFolders(QStringList newCollectionFolders) { m_collectionFolders = newCollectionFolders; - emit collectionFoldersChanged(newCollectionFolders); } - bool LibraryUpdateInfo::isEmpty() const { return m_isEmpty; } + void LibraryUpdateInfo::setIsEmpty(bool newIsEmpty) { m_isEmpty = newIsEmpty; - emit isEmptyChanged(newIsEmpty); } diff --git a/core/src/DTO/listingsproviderinfo.cpp b/core/src/DTO/listingsproviderinfo.cpp index cbed69a..da02c85 100644 --- a/core/src/DTO/listingsproviderinfo.cpp +++ b/core/src/DTO/listingsproviderinfo.cpp @@ -32,128 +32,149 @@ namespace Jellyfin { namespace DTO { -ListingsProviderInfo::ListingsProviderInfo(QObject *parent) : QObject(parent) {} +ListingsProviderInfo::ListingsProviderInfo(QObject *parent) {} -ListingsProviderInfo *ListingsProviderInfo::fromJSON(QJsonObject source, QObject *parent) { - ListingsProviderInfo *instance = new ListingsProviderInfo(parent); - instance->updateFromJSON(source); +ListingsProviderInfo ListingsProviderInfo::fromJson(QJsonObject source) {ListingsProviderInfo instance; + instance->setFromJson(source, false); return instance; } -void ListingsProviderInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ListingsProviderInfo::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_type = fromJsonValue(source["Type"]); + m_username = fromJsonValue(source["Username"]); + m_password = fromJsonValue(source["Password"]); + m_listingsId = fromJsonValue(source["ListingsId"]); + m_zipCode = fromJsonValue(source["ZipCode"]); + m_country = fromJsonValue(source["Country"]); + m_path = fromJsonValue(source["Path"]); + m_enabledTuners = fromJsonValue(source["EnabledTuners"]); + m_enableAllTuners = fromJsonValue(source["EnableAllTuners"]); + m_newsCategories = fromJsonValue(source["NewsCategories"]); + m_sportsCategories = fromJsonValue(source["SportsCategories"]); + m_kidsCategories = fromJsonValue(source["KidsCategories"]); + m_movieCategories = fromJsonValue(source["MovieCategories"]); + m_channelMappings = fromJsonValue>>(source["ChannelMappings"]); + m_moviePrefix = fromJsonValue(source["MoviePrefix"]); + m_preferredLanguage = fromJsonValue(source["PreferredLanguage"]); + m_userAgent = fromJsonValue(source["UserAgent"]); + } -QJsonObject ListingsProviderInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ListingsProviderInfo::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["Type"] = toJsonValue(m_type); + result["Username"] = toJsonValue(m_username); + result["Password"] = toJsonValue(m_password); + result["ListingsId"] = toJsonValue(m_listingsId); + result["ZipCode"] = toJsonValue(m_zipCode); + result["Country"] = toJsonValue(m_country); + result["Path"] = toJsonValue(m_path); + result["EnabledTuners"] = toJsonValue(m_enabledTuners); + result["EnableAllTuners"] = toJsonValue(m_enableAllTuners); + result["NewsCategories"] = toJsonValue(m_newsCategories); + result["SportsCategories"] = toJsonValue(m_sportsCategories); + result["KidsCategories"] = toJsonValue(m_kidsCategories); + result["MovieCategories"] = toJsonValue(m_movieCategories); + result["ChannelMappings"] = toJsonValue>>(m_channelMappings); + result["MoviePrefix"] = toJsonValue(m_moviePrefix); + result["PreferredLanguage"] = toJsonValue(m_preferredLanguage); + result["UserAgent"] = toJsonValue(m_userAgent); + return result; } + QString ListingsProviderInfo::jellyfinId() const { return m_jellyfinId; } + void ListingsProviderInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString ListingsProviderInfo::type() const { return m_type; } + void ListingsProviderInfo::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString ListingsProviderInfo::username() const { return m_username; } + void ListingsProviderInfo::setUsername(QString newUsername) { m_username = newUsername; - emit usernameChanged(newUsername); } - QString ListingsProviderInfo::password() const { return m_password; } + void ListingsProviderInfo::setPassword(QString newPassword) { m_password = newPassword; - emit passwordChanged(newPassword); } - QString ListingsProviderInfo::listingsId() const { return m_listingsId; } + void ListingsProviderInfo::setListingsId(QString newListingsId) { m_listingsId = newListingsId; - emit listingsIdChanged(newListingsId); } - QString ListingsProviderInfo::zipCode() const { return m_zipCode; } + void ListingsProviderInfo::setZipCode(QString newZipCode) { m_zipCode = newZipCode; - emit zipCodeChanged(newZipCode); } - QString ListingsProviderInfo::country() const { return m_country; } + void ListingsProviderInfo::setCountry(QString newCountry) { m_country = newCountry; - emit countryChanged(newCountry); } - QString ListingsProviderInfo::path() const { return m_path; } + void ListingsProviderInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QStringList ListingsProviderInfo::enabledTuners() const { return m_enabledTuners; } + void ListingsProviderInfo::setEnabledTuners(QStringList newEnabledTuners) { m_enabledTuners = newEnabledTuners; - emit enabledTunersChanged(newEnabledTuners); } - bool ListingsProviderInfo::enableAllTuners() const { return m_enableAllTuners; } + void ListingsProviderInfo::setEnableAllTuners(bool newEnableAllTuners) { m_enableAllTuners = newEnableAllTuners; - emit enableAllTunersChanged(newEnableAllTuners); } - QStringList ListingsProviderInfo::newsCategories() const { return m_newsCategories; } + void ListingsProviderInfo::setNewsCategories(QStringList newNewsCategories) { m_newsCategories = newNewsCategories; - emit newsCategoriesChanged(newNewsCategories); } - QStringList ListingsProviderInfo::sportsCategories() const { return m_sportsCategories; } + void ListingsProviderInfo::setSportsCategories(QStringList newSportsCategories) { m_sportsCategories = newSportsCategories; - emit sportsCategoriesChanged(newSportsCategories); } - QStringList ListingsProviderInfo::kidsCategories() const { return m_kidsCategories; } + void ListingsProviderInfo::setKidsCategories(QStringList newKidsCategories) { m_kidsCategories = newKidsCategories; - emit kidsCategoriesChanged(newKidsCategories); } - QStringList ListingsProviderInfo::movieCategories() const { return m_movieCategories; } + void ListingsProviderInfo::setMovieCategories(QStringList newMovieCategories) { m_movieCategories = newMovieCategories; - emit movieCategoriesChanged(newMovieCategories); } +QList> ListingsProviderInfo::channelMappings() const { return m_channelMappings; } -QList ListingsProviderInfo::channelMappings() const { return m_channelMappings; } -void ListingsProviderInfo::setChannelMappings(QList newChannelMappings) { +void ListingsProviderInfo::setChannelMappings(QList> newChannelMappings) { m_channelMappings = newChannelMappings; - emit channelMappingsChanged(newChannelMappings); } - QString ListingsProviderInfo::moviePrefix() const { return m_moviePrefix; } + void ListingsProviderInfo::setMoviePrefix(QString newMoviePrefix) { m_moviePrefix = newMoviePrefix; - emit moviePrefixChanged(newMoviePrefix); } - QString ListingsProviderInfo::preferredLanguage() const { return m_preferredLanguage; } + void ListingsProviderInfo::setPreferredLanguage(QString newPreferredLanguage) { m_preferredLanguage = newPreferredLanguage; - emit preferredLanguageChanged(newPreferredLanguage); } - QString ListingsProviderInfo::userAgent() const { return m_userAgent; } + void ListingsProviderInfo::setUserAgent(QString newUserAgent) { m_userAgent = newUserAgent; - emit userAgentChanged(newUserAgent); } diff --git a/core/src/DTO/livestreamresponse.cpp b/core/src/DTO/livestreamresponse.cpp index 8ce54e5..be29bfc 100644 --- a/core/src/DTO/livestreamresponse.cpp +++ b/core/src/DTO/livestreamresponse.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -LiveStreamResponse::LiveStreamResponse(QObject *parent) : QObject(parent) {} +LiveStreamResponse::LiveStreamResponse(QObject *parent) {} -LiveStreamResponse *LiveStreamResponse::fromJSON(QJsonObject source, QObject *parent) { - LiveStreamResponse *instance = new LiveStreamResponse(parent); - instance->updateFromJSON(source); +LiveStreamResponse LiveStreamResponse::fromJson(QJsonObject source) {LiveStreamResponse instance; + instance->setFromJson(source, false); return instance; } -void LiveStreamResponse::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LiveStreamResponse::setFromJson(QJsonObject source) { + m_mediaSource = fromJsonValue>(source["MediaSource"]); + } -QJsonObject LiveStreamResponse::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LiveStreamResponse::toJson() { QJsonObject result; + result["MediaSource"] = toJsonValue>(m_mediaSource); + return result; } -MediaSourceInfo * LiveStreamResponse::mediaSource() const { return m_mediaSource; } -void LiveStreamResponse::setMediaSource(MediaSourceInfo * newMediaSource) { + +QSharedPointer LiveStreamResponse::mediaSource() const { return m_mediaSource; } + +void LiveStreamResponse::setMediaSource(QSharedPointer newMediaSource) { m_mediaSource = newMediaSource; - emit mediaSourceChanged(newMediaSource); } diff --git a/core/src/DTO/livetvinfo.cpp b/core/src/DTO/livetvinfo.cpp index a659dab..f0851dd 100644 --- a/core/src/DTO/livetvinfo.cpp +++ b/core/src/DTO/livetvinfo.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -LiveTvInfo::LiveTvInfo(QObject *parent) : QObject(parent) {} +LiveTvInfo::LiveTvInfo(QObject *parent) {} -LiveTvInfo *LiveTvInfo::fromJSON(QJsonObject source, QObject *parent) { - LiveTvInfo *instance = new LiveTvInfo(parent); - instance->updateFromJSON(source); +LiveTvInfo LiveTvInfo::fromJson(QJsonObject source) {LiveTvInfo instance; + instance->setFromJson(source, false); return instance; } -void LiveTvInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LiveTvInfo::setFromJson(QJsonObject source) { + m_services = fromJsonValue>>(source["Services"]); + m_isEnabled = fromJsonValue(source["IsEnabled"]); + m_enabledUsers = fromJsonValue(source["EnabledUsers"]); + } -QJsonObject LiveTvInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LiveTvInfo::toJson() { QJsonObject result; + result["Services"] = toJsonValue>>(m_services); + result["IsEnabled"] = toJsonValue(m_isEnabled); + result["EnabledUsers"] = toJsonValue(m_enabledUsers); + return result; } -QList LiveTvInfo::services() const { return m_services; } -void LiveTvInfo::setServices(QList newServices) { - m_services = newServices; - emit servicesChanged(newServices); -} +QList> LiveTvInfo::services() const { return m_services; } + +void LiveTvInfo::setServices(QList> newServices) { + m_services = newServices; +} bool LiveTvInfo::isEnabled() const { return m_isEnabled; } + void LiveTvInfo::setIsEnabled(bool newIsEnabled) { m_isEnabled = newIsEnabled; - emit isEnabledChanged(newIsEnabled); } - QStringList LiveTvInfo::enabledUsers() const { return m_enabledUsers; } + void LiveTvInfo::setEnabledUsers(QStringList newEnabledUsers) { m_enabledUsers = newEnabledUsers; - emit enabledUsersChanged(newEnabledUsers); } diff --git a/core/src/DTO/livetvserviceinfo.cpp b/core/src/DTO/livetvserviceinfo.cpp index 5f93253..d6a3d94 100644 --- a/core/src/DTO/livetvserviceinfo.cpp +++ b/core/src/DTO/livetvserviceinfo.cpp @@ -29,73 +29,82 @@ #include -#include - namespace Jellyfin { namespace DTO { -LiveTvServiceInfo::LiveTvServiceInfo(QObject *parent) : QObject(parent) {} +LiveTvServiceInfo::LiveTvServiceInfo(QObject *parent) {} -LiveTvServiceInfo *LiveTvServiceInfo::fromJSON(QJsonObject source, QObject *parent) { - LiveTvServiceInfo *instance = new LiveTvServiceInfo(parent); - instance->updateFromJSON(source); +LiveTvServiceInfo LiveTvServiceInfo::fromJson(QJsonObject source) {LiveTvServiceInfo instance; + instance->setFromJson(source, false); return instance; } -void LiveTvServiceInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LiveTvServiceInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_homePageUrl = fromJsonValue(source["HomePageUrl"]); + m_status = fromJsonValue(source["Status"]); + m_statusMessage = fromJsonValue(source["StatusMessage"]); + m_version = fromJsonValue(source["Version"]); + m_hasUpdateAvailable = fromJsonValue(source["HasUpdateAvailable"]); + m_isVisible = fromJsonValue(source["IsVisible"]); + m_tuners = fromJsonValue(source["Tuners"]); + } -QJsonObject LiveTvServiceInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LiveTvServiceInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["HomePageUrl"] = toJsonValue(m_homePageUrl); + result["Status"] = toJsonValue(m_status); + result["StatusMessage"] = toJsonValue(m_statusMessage); + result["Version"] = toJsonValue(m_version); + result["HasUpdateAvailable"] = toJsonValue(m_hasUpdateAvailable); + result["IsVisible"] = toJsonValue(m_isVisible); + result["Tuners"] = toJsonValue(m_tuners); + return result; } + QString LiveTvServiceInfo::name() const { return m_name; } + void LiveTvServiceInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString LiveTvServiceInfo::homePageUrl() const { return m_homePageUrl; } + void LiveTvServiceInfo::setHomePageUrl(QString newHomePageUrl) { m_homePageUrl = newHomePageUrl; - emit homePageUrlChanged(newHomePageUrl); } - LiveTvServiceStatus LiveTvServiceInfo::status() const { return m_status; } + void LiveTvServiceInfo::setStatus(LiveTvServiceStatus newStatus) { m_status = newStatus; - emit statusChanged(newStatus); } - QString LiveTvServiceInfo::statusMessage() const { return m_statusMessage; } + void LiveTvServiceInfo::setStatusMessage(QString newStatusMessage) { m_statusMessage = newStatusMessage; - emit statusMessageChanged(newStatusMessage); } - QString LiveTvServiceInfo::version() const { return m_version; } + void LiveTvServiceInfo::setVersion(QString newVersion) { m_version = newVersion; - emit versionChanged(newVersion); } - bool LiveTvServiceInfo::hasUpdateAvailable() const { return m_hasUpdateAvailable; } + void LiveTvServiceInfo::setHasUpdateAvailable(bool newHasUpdateAvailable) { m_hasUpdateAvailable = newHasUpdateAvailable; - emit hasUpdateAvailableChanged(newHasUpdateAvailable); } - bool LiveTvServiceInfo::isVisible() const { return m_isVisible; } + void LiveTvServiceInfo::setIsVisible(bool newIsVisible) { m_isVisible = newIsVisible; - emit isVisibleChanged(newIsVisible); } - QStringList LiveTvServiceInfo::tuners() const { return m_tuners; } + void LiveTvServiceInfo::setTuners(QStringList newTuners) { m_tuners = newTuners; - emit tunersChanged(newTuners); } diff --git a/core/src/DTO/localizationoption.cpp b/core/src/DTO/localizationoption.cpp index 0b2013b..018aa27 100644 --- a/core/src/DTO/localizationoption.cpp +++ b/core/src/DTO/localizationoption.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -LocalizationOption::LocalizationOption(QObject *parent) : QObject(parent) {} +LocalizationOption::LocalizationOption(QObject *parent) {} -LocalizationOption *LocalizationOption::fromJSON(QJsonObject source, QObject *parent) { - LocalizationOption *instance = new LocalizationOption(parent); - instance->updateFromJSON(source); +LocalizationOption LocalizationOption::fromJson(QJsonObject source) {LocalizationOption instance; + instance->setFromJson(source, false); return instance; } -void LocalizationOption::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LocalizationOption::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_value = fromJsonValue(source["Value"]); + } -QJsonObject LocalizationOption::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LocalizationOption::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Value"] = toJsonValue(m_value); + return result; } + QString LocalizationOption::name() const { return m_name; } + void LocalizationOption::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString LocalizationOption::value() const { return m_value; } + void LocalizationOption::setValue(QString newValue) { m_value = newValue; - emit valueChanged(newValue); } diff --git a/core/src/DTO/logfile.cpp b/core/src/DTO/logfile.cpp index 5c73609..9168197 100644 --- a/core/src/DTO/logfile.cpp +++ b/core/src/DTO/logfile.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -LogFile::LogFile(QObject *parent) : QObject(parent) {} +LogFile::LogFile(QObject *parent) {} -LogFile *LogFile::fromJSON(QJsonObject source, QObject *parent) { - LogFile *instance = new LogFile(parent); - instance->updateFromJSON(source); +LogFile LogFile::fromJson(QJsonObject source) {LogFile instance; + instance->setFromJson(source, false); return instance; } -void LogFile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void LogFile::setFromJson(QJsonObject source) { + m_dateCreated = fromJsonValue(source["DateCreated"]); + m_dateModified = fromJsonValue(source["DateModified"]); + m_size = fromJsonValue(source["Size"]); + m_name = fromJsonValue(source["Name"]); + } -QJsonObject LogFile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject LogFile::toJson() { QJsonObject result; + result["DateCreated"] = toJsonValue(m_dateCreated); + result["DateModified"] = toJsonValue(m_dateModified); + result["Size"] = toJsonValue(m_size); + result["Name"] = toJsonValue(m_name); + return result; } + QDateTime LogFile::dateCreated() const { return m_dateCreated; } + void LogFile::setDateCreated(QDateTime newDateCreated) { m_dateCreated = newDateCreated; - emit dateCreatedChanged(newDateCreated); } - QDateTime LogFile::dateModified() const { return m_dateModified; } + void LogFile::setDateModified(QDateTime newDateModified) { m_dateModified = newDateModified; - emit dateModifiedChanged(newDateModified); } - qint64 LogFile::size() const { return m_size; } + void LogFile::setSize(qint64 newSize) { m_size = newSize; - emit sizeChanged(newSize); } - QString LogFile::name() const { return m_name; } + void LogFile::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } diff --git a/core/src/DTO/mediaattachment.cpp b/core/src/DTO/mediaattachment.cpp index c28b802..8622c78 100644 --- a/core/src/DTO/mediaattachment.cpp +++ b/core/src/DTO/mediaattachment.cpp @@ -32,62 +32,72 @@ namespace Jellyfin { namespace DTO { -MediaAttachment::MediaAttachment(QObject *parent) : QObject(parent) {} +MediaAttachment::MediaAttachment(QObject *parent) {} -MediaAttachment *MediaAttachment::fromJSON(QJsonObject source, QObject *parent) { - MediaAttachment *instance = new MediaAttachment(parent); - instance->updateFromJSON(source); +MediaAttachment MediaAttachment::fromJson(QJsonObject source) {MediaAttachment instance; + instance->setFromJson(source, false); return instance; } -void MediaAttachment::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaAttachment::setFromJson(QJsonObject source) { + m_codec = fromJsonValue(source["Codec"]); + m_codecTag = fromJsonValue(source["CodecTag"]); + m_comment = fromJsonValue(source["Comment"]); + m_index = fromJsonValue(source["Index"]); + m_fileName = fromJsonValue(source["FileName"]); + m_mimeType = fromJsonValue(source["MimeType"]); + m_deliveryUrl = fromJsonValue(source["DeliveryUrl"]); + } -QJsonObject MediaAttachment::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaAttachment::toJson() { QJsonObject result; + result["Codec"] = toJsonValue(m_codec); + result["CodecTag"] = toJsonValue(m_codecTag); + result["Comment"] = toJsonValue(m_comment); + result["Index"] = toJsonValue(m_index); + result["FileName"] = toJsonValue(m_fileName); + result["MimeType"] = toJsonValue(m_mimeType); + result["DeliveryUrl"] = toJsonValue(m_deliveryUrl); + return result; } + QString MediaAttachment::codec() const { return m_codec; } + void MediaAttachment::setCodec(QString newCodec) { m_codec = newCodec; - emit codecChanged(newCodec); } - QString MediaAttachment::codecTag() const { return m_codecTag; } + void MediaAttachment::setCodecTag(QString newCodecTag) { m_codecTag = newCodecTag; - emit codecTagChanged(newCodecTag); } - QString MediaAttachment::comment() const { return m_comment; } + void MediaAttachment::setComment(QString newComment) { m_comment = newComment; - emit commentChanged(newComment); } - qint32 MediaAttachment::index() const { return m_index; } + void MediaAttachment::setIndex(qint32 newIndex) { m_index = newIndex; - emit indexChanged(newIndex); } - QString MediaAttachment::fileName() const { return m_fileName; } + void MediaAttachment::setFileName(QString newFileName) { m_fileName = newFileName; - emit fileNameChanged(newFileName); } - QString MediaAttachment::mimeType() const { return m_mimeType; } + void MediaAttachment::setMimeType(QString newMimeType) { m_mimeType = newMimeType; - emit mimeTypeChanged(newMimeType); } - QString MediaAttachment::deliveryUrl() const { return m_deliveryUrl; } + void MediaAttachment::setDeliveryUrl(QString newDeliveryUrl) { m_deliveryUrl = newDeliveryUrl; - emit deliveryUrlChanged(newDeliveryUrl); } diff --git a/core/src/DTO/mediaencoderpathdto.cpp b/core/src/DTO/mediaencoderpathdto.cpp index 22102c3..5e3ed54 100644 --- a/core/src/DTO/mediaencoderpathdto.cpp +++ b/core/src/DTO/mediaencoderpathdto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -MediaEncoderPathDto::MediaEncoderPathDto(QObject *parent) : QObject(parent) {} +MediaEncoderPathDto::MediaEncoderPathDto(QObject *parent) {} -MediaEncoderPathDto *MediaEncoderPathDto::fromJSON(QJsonObject source, QObject *parent) { - MediaEncoderPathDto *instance = new MediaEncoderPathDto(parent); - instance->updateFromJSON(source); +MediaEncoderPathDto MediaEncoderPathDto::fromJson(QJsonObject source) {MediaEncoderPathDto instance; + instance->setFromJson(source, false); return instance; } -void MediaEncoderPathDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaEncoderPathDto::setFromJson(QJsonObject source) { + m_path = fromJsonValue(source["Path"]); + m_pathType = fromJsonValue(source["PathType"]); + } -QJsonObject MediaEncoderPathDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaEncoderPathDto::toJson() { QJsonObject result; + result["Path"] = toJsonValue(m_path); + result["PathType"] = toJsonValue(m_pathType); + return result; } + QString MediaEncoderPathDto::path() const { return m_path; } + void MediaEncoderPathDto::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString MediaEncoderPathDto::pathType() const { return m_pathType; } + void MediaEncoderPathDto::setPathType(QString newPathType) { m_pathType = newPathType; - emit pathTypeChanged(newPathType); } diff --git a/core/src/DTO/mediapathdto.cpp b/core/src/DTO/mediapathdto.cpp index 2b73508..ee9950c 100644 --- a/core/src/DTO/mediapathdto.cpp +++ b/core/src/DTO/mediapathdto.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -MediaPathDto::MediaPathDto(QObject *parent) : QObject(parent) {} +MediaPathDto::MediaPathDto(QObject *parent) {} -MediaPathDto *MediaPathDto::fromJSON(QJsonObject source, QObject *parent) { - MediaPathDto *instance = new MediaPathDto(parent); - instance->updateFromJSON(source); +MediaPathDto MediaPathDto::fromJson(QJsonObject source) {MediaPathDto instance; + instance->setFromJson(source, false); return instance; } -void MediaPathDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaPathDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_pathInfo = fromJsonValue>(source["PathInfo"]); + } -QJsonObject MediaPathDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaPathDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["PathInfo"] = toJsonValue>(m_pathInfo); + return result; } + QString MediaPathDto::name() const { return m_name; } + void MediaPathDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString MediaPathDto::path() const { return m_path; } + void MediaPathDto::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } +QSharedPointer MediaPathDto::pathInfo() const { return m_pathInfo; } -MediaPathInfo * MediaPathDto::pathInfo() const { return m_pathInfo; } -void MediaPathDto::setPathInfo(MediaPathInfo * newPathInfo) { +void MediaPathDto::setPathInfo(QSharedPointer newPathInfo) { m_pathInfo = newPathInfo; - emit pathInfoChanged(newPathInfo); } diff --git a/core/src/DTO/mediapathinfo.cpp b/core/src/DTO/mediapathinfo.cpp index b3f8048..1e93938 100644 --- a/core/src/DTO/mediapathinfo.cpp +++ b/core/src/DTO/mediapathinfo.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -MediaPathInfo::MediaPathInfo(QObject *parent) : QObject(parent) {} +MediaPathInfo::MediaPathInfo(QObject *parent) {} -MediaPathInfo *MediaPathInfo::fromJSON(QJsonObject source, QObject *parent) { - MediaPathInfo *instance = new MediaPathInfo(parent); - instance->updateFromJSON(source); +MediaPathInfo MediaPathInfo::fromJson(QJsonObject source) {MediaPathInfo instance; + instance->setFromJson(source, false); return instance; } -void MediaPathInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaPathInfo::setFromJson(QJsonObject source) { + m_path = fromJsonValue(source["Path"]); + m_networkPath = fromJsonValue(source["NetworkPath"]); + } -QJsonObject MediaPathInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaPathInfo::toJson() { QJsonObject result; + result["Path"] = toJsonValue(m_path); + result["NetworkPath"] = toJsonValue(m_networkPath); + return result; } + QString MediaPathInfo::path() const { return m_path; } + void MediaPathInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString MediaPathInfo::networkPath() const { return m_networkPath; } + void MediaPathInfo::setNetworkPath(QString newNetworkPath) { m_networkPath = newNetworkPath; - emit networkPathChanged(newNetworkPath); } diff --git a/core/src/DTO/mediasourceinfo.cpp b/core/src/DTO/mediasourceinfo.cpp index c3bc53e..8175b65 100644 --- a/core/src/DTO/mediasourceinfo.cpp +++ b/core/src/DTO/mediasourceinfo.cpp @@ -29,282 +29,320 @@ #include -#include -#include -#include -#include -#include -#include - namespace Jellyfin { namespace DTO { -MediaSourceInfo::MediaSourceInfo(QObject *parent) : QObject(parent) {} +MediaSourceInfo::MediaSourceInfo(QObject *parent) {} -MediaSourceInfo *MediaSourceInfo::fromJSON(QJsonObject source, QObject *parent) { - MediaSourceInfo *instance = new MediaSourceInfo(parent); - instance->updateFromJSON(source); +MediaSourceInfo MediaSourceInfo::fromJson(QJsonObject source) {MediaSourceInfo instance; + instance->setFromJson(source, false); return instance; } -void MediaSourceInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaSourceInfo::setFromJson(QJsonObject source) { + m_protocol = fromJsonValue(source["Protocol"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_path = fromJsonValue(source["Path"]); + m_encoderPath = fromJsonValue(source["EncoderPath"]); + m_encoderProtocol = fromJsonValue(source["EncoderProtocol"]); + m_type = fromJsonValue(source["Type"]); + m_container = fromJsonValue(source["Container"]); + m_size = fromJsonValue(source["Size"]); + m_name = fromJsonValue(source["Name"]); + m_isRemote = fromJsonValue(source["IsRemote"]); + m_eTag = fromJsonValue(source["ETag"]); + m_runTimeTicks = fromJsonValue(source["RunTimeTicks"]); + m_readAtNativeFramerate = fromJsonValue(source["ReadAtNativeFramerate"]); + m_ignoreDts = fromJsonValue(source["IgnoreDts"]); + m_ignoreIndex = fromJsonValue(source["IgnoreIndex"]); + m_genPtsInput = fromJsonValue(source["GenPtsInput"]); + m_supportsTranscoding = fromJsonValue(source["SupportsTranscoding"]); + m_supportsDirectStream = fromJsonValue(source["SupportsDirectStream"]); + m_supportsDirectPlay = fromJsonValue(source["SupportsDirectPlay"]); + m_isInfiniteStream = fromJsonValue(source["IsInfiniteStream"]); + m_requiresOpening = fromJsonValue(source["RequiresOpening"]); + m_openToken = fromJsonValue(source["OpenToken"]); + m_requiresClosing = fromJsonValue(source["RequiresClosing"]); + m_liveStreamId = fromJsonValue(source["LiveStreamId"]); + m_bufferMs = fromJsonValue(source["BufferMs"]); + m_requiresLooping = fromJsonValue(source["RequiresLooping"]); + m_supportsProbing = fromJsonValue(source["SupportsProbing"]); + m_videoType = fromJsonValue(source["VideoType"]); + m_isoType = fromJsonValue(source["IsoType"]); + m_video3DFormat = fromJsonValue(source["Video3DFormat"]); + m_mediaStreams = fromJsonValue>>(source["MediaStreams"]); + m_mediaAttachments = fromJsonValue>>(source["MediaAttachments"]); + m_formats = fromJsonValue(source["Formats"]); + m_bitrate = fromJsonValue(source["Bitrate"]); + m_timestamp = fromJsonValue(source["Timestamp"]); + m_requiredHttpHeaders = fromJsonValue(source["RequiredHttpHeaders"]); + m_transcodingUrl = fromJsonValue(source["TranscodingUrl"]); + m_transcodingSubProtocol = fromJsonValue(source["TranscodingSubProtocol"]); + m_transcodingContainer = fromJsonValue(source["TranscodingContainer"]); + m_analyzeDurationMs = fromJsonValue(source["AnalyzeDurationMs"]); + m_defaultAudioStreamIndex = fromJsonValue(source["DefaultAudioStreamIndex"]); + m_defaultSubtitleStreamIndex = fromJsonValue(source["DefaultSubtitleStreamIndex"]); + } -QJsonObject MediaSourceInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaSourceInfo::toJson() { QJsonObject result; + result["Protocol"] = toJsonValue(m_protocol); + result["Id"] = toJsonValue(m_jellyfinId); + result["Path"] = toJsonValue(m_path); + result["EncoderPath"] = toJsonValue(m_encoderPath); + result["EncoderProtocol"] = toJsonValue(m_encoderProtocol); + result["Type"] = toJsonValue(m_type); + result["Container"] = toJsonValue(m_container); + result["Size"] = toJsonValue(m_size); + result["Name"] = toJsonValue(m_name); + result["IsRemote"] = toJsonValue(m_isRemote); + result["ETag"] = toJsonValue(m_eTag); + result["RunTimeTicks"] = toJsonValue(m_runTimeTicks); + result["ReadAtNativeFramerate"] = toJsonValue(m_readAtNativeFramerate); + result["IgnoreDts"] = toJsonValue(m_ignoreDts); + result["IgnoreIndex"] = toJsonValue(m_ignoreIndex); + result["GenPtsInput"] = toJsonValue(m_genPtsInput); + result["SupportsTranscoding"] = toJsonValue(m_supportsTranscoding); + result["SupportsDirectStream"] = toJsonValue(m_supportsDirectStream); + result["SupportsDirectPlay"] = toJsonValue(m_supportsDirectPlay); + result["IsInfiniteStream"] = toJsonValue(m_isInfiniteStream); + result["RequiresOpening"] = toJsonValue(m_requiresOpening); + result["OpenToken"] = toJsonValue(m_openToken); + result["RequiresClosing"] = toJsonValue(m_requiresClosing); + result["LiveStreamId"] = toJsonValue(m_liveStreamId); + result["BufferMs"] = toJsonValue(m_bufferMs); + result["RequiresLooping"] = toJsonValue(m_requiresLooping); + result["SupportsProbing"] = toJsonValue(m_supportsProbing); + result["VideoType"] = toJsonValue(m_videoType); + result["IsoType"] = toJsonValue(m_isoType); + result["Video3DFormat"] = toJsonValue(m_video3DFormat); + result["MediaStreams"] = toJsonValue>>(m_mediaStreams); + result["MediaAttachments"] = toJsonValue>>(m_mediaAttachments); + result["Formats"] = toJsonValue(m_formats); + result["Bitrate"] = toJsonValue(m_bitrate); + result["Timestamp"] = toJsonValue(m_timestamp); + result["RequiredHttpHeaders"] = toJsonValue(m_requiredHttpHeaders); + result["TranscodingUrl"] = toJsonValue(m_transcodingUrl); + result["TranscodingSubProtocol"] = toJsonValue(m_transcodingSubProtocol); + result["TranscodingContainer"] = toJsonValue(m_transcodingContainer); + result["AnalyzeDurationMs"] = toJsonValue(m_analyzeDurationMs); + result["DefaultAudioStreamIndex"] = toJsonValue(m_defaultAudioStreamIndex); + result["DefaultSubtitleStreamIndex"] = toJsonValue(m_defaultSubtitleStreamIndex); + return result; } + MediaProtocol MediaSourceInfo::protocol() const { return m_protocol; } + void MediaSourceInfo::setProtocol(MediaProtocol newProtocol) { m_protocol = newProtocol; - emit protocolChanged(newProtocol); } - QString MediaSourceInfo::jellyfinId() const { return m_jellyfinId; } + void MediaSourceInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString MediaSourceInfo::path() const { return m_path; } + void MediaSourceInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString MediaSourceInfo::encoderPath() const { return m_encoderPath; } + void MediaSourceInfo::setEncoderPath(QString newEncoderPath) { m_encoderPath = newEncoderPath; - emit encoderPathChanged(newEncoderPath); } - MediaProtocol MediaSourceInfo::encoderProtocol() const { return m_encoderProtocol; } + void MediaSourceInfo::setEncoderProtocol(MediaProtocol newEncoderProtocol) { m_encoderProtocol = newEncoderProtocol; - emit encoderProtocolChanged(newEncoderProtocol); } - MediaSourceType MediaSourceInfo::type() const { return m_type; } + void MediaSourceInfo::setType(MediaSourceType newType) { m_type = newType; - emit typeChanged(newType); } - QString MediaSourceInfo::container() const { return m_container; } + void MediaSourceInfo::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } - qint64 MediaSourceInfo::size() const { return m_size; } + void MediaSourceInfo::setSize(qint64 newSize) { m_size = newSize; - emit sizeChanged(newSize); } - QString MediaSourceInfo::name() const { return m_name; } + void MediaSourceInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - bool MediaSourceInfo::isRemote() const { return m_isRemote; } + void MediaSourceInfo::setIsRemote(bool newIsRemote) { m_isRemote = newIsRemote; - emit isRemoteChanged(newIsRemote); } - QString MediaSourceInfo::eTag() const { return m_eTag; } + void MediaSourceInfo::setETag(QString newETag) { m_eTag = newETag; - emit eTagChanged(newETag); } - qint64 MediaSourceInfo::runTimeTicks() const { return m_runTimeTicks; } + void MediaSourceInfo::setRunTimeTicks(qint64 newRunTimeTicks) { m_runTimeTicks = newRunTimeTicks; - emit runTimeTicksChanged(newRunTimeTicks); } - bool MediaSourceInfo::readAtNativeFramerate() const { return m_readAtNativeFramerate; } + void MediaSourceInfo::setReadAtNativeFramerate(bool newReadAtNativeFramerate) { m_readAtNativeFramerate = newReadAtNativeFramerate; - emit readAtNativeFramerateChanged(newReadAtNativeFramerate); } - bool MediaSourceInfo::ignoreDts() const { return m_ignoreDts; } + void MediaSourceInfo::setIgnoreDts(bool newIgnoreDts) { m_ignoreDts = newIgnoreDts; - emit ignoreDtsChanged(newIgnoreDts); } - bool MediaSourceInfo::ignoreIndex() const { return m_ignoreIndex; } + void MediaSourceInfo::setIgnoreIndex(bool newIgnoreIndex) { m_ignoreIndex = newIgnoreIndex; - emit ignoreIndexChanged(newIgnoreIndex); } - bool MediaSourceInfo::genPtsInput() const { return m_genPtsInput; } + void MediaSourceInfo::setGenPtsInput(bool newGenPtsInput) { m_genPtsInput = newGenPtsInput; - emit genPtsInputChanged(newGenPtsInput); } - bool MediaSourceInfo::supportsTranscoding() const { return m_supportsTranscoding; } + void MediaSourceInfo::setSupportsTranscoding(bool newSupportsTranscoding) { m_supportsTranscoding = newSupportsTranscoding; - emit supportsTranscodingChanged(newSupportsTranscoding); } - bool MediaSourceInfo::supportsDirectStream() const { return m_supportsDirectStream; } + void MediaSourceInfo::setSupportsDirectStream(bool newSupportsDirectStream) { m_supportsDirectStream = newSupportsDirectStream; - emit supportsDirectStreamChanged(newSupportsDirectStream); } - bool MediaSourceInfo::supportsDirectPlay() const { return m_supportsDirectPlay; } + void MediaSourceInfo::setSupportsDirectPlay(bool newSupportsDirectPlay) { m_supportsDirectPlay = newSupportsDirectPlay; - emit supportsDirectPlayChanged(newSupportsDirectPlay); } - bool MediaSourceInfo::isInfiniteStream() const { return m_isInfiniteStream; } + void MediaSourceInfo::setIsInfiniteStream(bool newIsInfiniteStream) { m_isInfiniteStream = newIsInfiniteStream; - emit isInfiniteStreamChanged(newIsInfiniteStream); } - bool MediaSourceInfo::requiresOpening() const { return m_requiresOpening; } + void MediaSourceInfo::setRequiresOpening(bool newRequiresOpening) { m_requiresOpening = newRequiresOpening; - emit requiresOpeningChanged(newRequiresOpening); } - QString MediaSourceInfo::openToken() const { return m_openToken; } + void MediaSourceInfo::setOpenToken(QString newOpenToken) { m_openToken = newOpenToken; - emit openTokenChanged(newOpenToken); } - bool MediaSourceInfo::requiresClosing() const { return m_requiresClosing; } + void MediaSourceInfo::setRequiresClosing(bool newRequiresClosing) { m_requiresClosing = newRequiresClosing; - emit requiresClosingChanged(newRequiresClosing); } - QString MediaSourceInfo::liveStreamId() const { return m_liveStreamId; } + void MediaSourceInfo::setLiveStreamId(QString newLiveStreamId) { m_liveStreamId = newLiveStreamId; - emit liveStreamIdChanged(newLiveStreamId); } - qint32 MediaSourceInfo::bufferMs() const { return m_bufferMs; } + void MediaSourceInfo::setBufferMs(qint32 newBufferMs) { m_bufferMs = newBufferMs; - emit bufferMsChanged(newBufferMs); } - bool MediaSourceInfo::requiresLooping() const { return m_requiresLooping; } + void MediaSourceInfo::setRequiresLooping(bool newRequiresLooping) { m_requiresLooping = newRequiresLooping; - emit requiresLoopingChanged(newRequiresLooping); } - bool MediaSourceInfo::supportsProbing() const { return m_supportsProbing; } + void MediaSourceInfo::setSupportsProbing(bool newSupportsProbing) { m_supportsProbing = newSupportsProbing; - emit supportsProbingChanged(newSupportsProbing); } - VideoType MediaSourceInfo::videoType() const { return m_videoType; } + void MediaSourceInfo::setVideoType(VideoType newVideoType) { m_videoType = newVideoType; - emit videoTypeChanged(newVideoType); } - IsoType MediaSourceInfo::isoType() const { return m_isoType; } + void MediaSourceInfo::setIsoType(IsoType newIsoType) { m_isoType = newIsoType; - emit isoTypeChanged(newIsoType); } - Video3DFormat MediaSourceInfo::video3DFormat() const { return m_video3DFormat; } + void MediaSourceInfo::setVideo3DFormat(Video3DFormat newVideo3DFormat) { m_video3DFormat = newVideo3DFormat; - emit video3DFormatChanged(newVideo3DFormat); } +QList> MediaSourceInfo::mediaStreams() const { return m_mediaStreams; } -QList MediaSourceInfo::mediaStreams() const { return m_mediaStreams; } -void MediaSourceInfo::setMediaStreams(QList newMediaStreams) { +void MediaSourceInfo::setMediaStreams(QList> newMediaStreams) { m_mediaStreams = newMediaStreams; - emit mediaStreamsChanged(newMediaStreams); } +QList> MediaSourceInfo::mediaAttachments() const { return m_mediaAttachments; } -QList MediaSourceInfo::mediaAttachments() const { return m_mediaAttachments; } -void MediaSourceInfo::setMediaAttachments(QList newMediaAttachments) { +void MediaSourceInfo::setMediaAttachments(QList> newMediaAttachments) { m_mediaAttachments = newMediaAttachments; - emit mediaAttachmentsChanged(newMediaAttachments); } - QStringList MediaSourceInfo::formats() const { return m_formats; } + void MediaSourceInfo::setFormats(QStringList newFormats) { m_formats = newFormats; - emit formatsChanged(newFormats); } - qint32 MediaSourceInfo::bitrate() const { return m_bitrate; } + void MediaSourceInfo::setBitrate(qint32 newBitrate) { m_bitrate = newBitrate; - emit bitrateChanged(newBitrate); } - TransportStreamTimestamp MediaSourceInfo::timestamp() const { return m_timestamp; } + void MediaSourceInfo::setTimestamp(TransportStreamTimestamp newTimestamp) { m_timestamp = newTimestamp; - emit timestampChanged(newTimestamp); } - QJsonObject MediaSourceInfo::requiredHttpHeaders() const { return m_requiredHttpHeaders; } + void MediaSourceInfo::setRequiredHttpHeaders(QJsonObject newRequiredHttpHeaders) { m_requiredHttpHeaders = newRequiredHttpHeaders; - emit requiredHttpHeadersChanged(newRequiredHttpHeaders); } - QString MediaSourceInfo::transcodingUrl() const { return m_transcodingUrl; } + void MediaSourceInfo::setTranscodingUrl(QString newTranscodingUrl) { m_transcodingUrl = newTranscodingUrl; - emit transcodingUrlChanged(newTranscodingUrl); } - QString MediaSourceInfo::transcodingSubProtocol() const { return m_transcodingSubProtocol; } + void MediaSourceInfo::setTranscodingSubProtocol(QString newTranscodingSubProtocol) { m_transcodingSubProtocol = newTranscodingSubProtocol; - emit transcodingSubProtocolChanged(newTranscodingSubProtocol); } - QString MediaSourceInfo::transcodingContainer() const { return m_transcodingContainer; } + void MediaSourceInfo::setTranscodingContainer(QString newTranscodingContainer) { m_transcodingContainer = newTranscodingContainer; - emit transcodingContainerChanged(newTranscodingContainer); } - qint32 MediaSourceInfo::analyzeDurationMs() const { return m_analyzeDurationMs; } + void MediaSourceInfo::setAnalyzeDurationMs(qint32 newAnalyzeDurationMs) { m_analyzeDurationMs = newAnalyzeDurationMs; - emit analyzeDurationMsChanged(newAnalyzeDurationMs); } - qint32 MediaSourceInfo::defaultAudioStreamIndex() const { return m_defaultAudioStreamIndex; } + void MediaSourceInfo::setDefaultAudioStreamIndex(qint32 newDefaultAudioStreamIndex) { m_defaultAudioStreamIndex = newDefaultAudioStreamIndex; - emit defaultAudioStreamIndexChanged(newDefaultAudioStreamIndex); } - qint32 MediaSourceInfo::defaultSubtitleStreamIndex() const { return m_defaultSubtitleStreamIndex; } + void MediaSourceInfo::setDefaultSubtitleStreamIndex(qint32 newDefaultSubtitleStreamIndex) { m_defaultSubtitleStreamIndex = newDefaultSubtitleStreamIndex; - emit defaultSubtitleStreamIndexChanged(newDefaultSubtitleStreamIndex); } diff --git a/core/src/DTO/mediastream.cpp b/core/src/DTO/mediastream.cpp index 1d0708c..9571ffd 100644 --- a/core/src/DTO/mediastream.cpp +++ b/core/src/DTO/mediastream.cpp @@ -29,308 +29,355 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -MediaStream::MediaStream(QObject *parent) : QObject(parent) {} +MediaStream::MediaStream(QObject *parent) {} -MediaStream *MediaStream::fromJSON(QJsonObject source, QObject *parent) { - MediaStream *instance = new MediaStream(parent); - instance->updateFromJSON(source); +MediaStream MediaStream::fromJson(QJsonObject source) {MediaStream instance; + instance->setFromJson(source, false); return instance; } -void MediaStream::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaStream::setFromJson(QJsonObject source) { + m_codec = fromJsonValue(source["Codec"]); + m_codecTag = fromJsonValue(source["CodecTag"]); + m_language = fromJsonValue(source["Language"]); + m_colorRange = fromJsonValue(source["ColorRange"]); + m_colorSpace = fromJsonValue(source["ColorSpace"]); + m_colorTransfer = fromJsonValue(source["ColorTransfer"]); + m_colorPrimaries = fromJsonValue(source["ColorPrimaries"]); + m_comment = fromJsonValue(source["Comment"]); + m_timeBase = fromJsonValue(source["TimeBase"]); + m_codecTimeBase = fromJsonValue(source["CodecTimeBase"]); + m_title = fromJsonValue(source["Title"]); + m_videoRange = fromJsonValue(source["VideoRange"]); + m_localizedUndefined = fromJsonValue(source["localizedUndefined"]); + m_localizedDefault = fromJsonValue(source["localizedDefault"]); + m_localizedForced = fromJsonValue(source["localizedForced"]); + m_displayTitle = fromJsonValue(source["DisplayTitle"]); + m_nalLengthSize = fromJsonValue(source["NalLengthSize"]); + m_isInterlaced = fromJsonValue(source["IsInterlaced"]); + m_isAVC = fromJsonValue(source["IsAVC"]); + m_channelLayout = fromJsonValue(source["ChannelLayout"]); + m_bitRate = fromJsonValue(source["BitRate"]); + m_bitDepth = fromJsonValue(source["BitDepth"]); + m_refFrames = fromJsonValue(source["RefFrames"]); + m_packetLength = fromJsonValue(source["PacketLength"]); + m_channels = fromJsonValue(source["Channels"]); + m_sampleRate = fromJsonValue(source["SampleRate"]); + m_isDefault = fromJsonValue(source["IsDefault"]); + m_isForced = fromJsonValue(source["IsForced"]); + m_height = fromJsonValue(source["Height"]); + m_width = fromJsonValue(source["Width"]); + m_averageFrameRate = fromJsonValue(source["AverageFrameRate"]); + m_realFrameRate = fromJsonValue(source["RealFrameRate"]); + m_profile = fromJsonValue(source["Profile"]); + m_type = fromJsonValue(source["Type"]); + m_aspectRatio = fromJsonValue(source["AspectRatio"]); + m_index = fromJsonValue(source["Index"]); + m_score = fromJsonValue(source["Score"]); + m_isExternal = fromJsonValue(source["IsExternal"]); + m_deliveryMethod = fromJsonValue(source["DeliveryMethod"]); + m_deliveryUrl = fromJsonValue(source["DeliveryUrl"]); + m_isExternalUrl = fromJsonValue(source["IsExternalUrl"]); + m_isTextSubtitleStream = fromJsonValue(source["IsTextSubtitleStream"]); + m_supportsExternalStream = fromJsonValue(source["SupportsExternalStream"]); + m_path = fromJsonValue(source["Path"]); + m_pixelFormat = fromJsonValue(source["PixelFormat"]); + m_level = fromJsonValue(source["Level"]); + m_isAnamorphic = fromJsonValue(source["IsAnamorphic"]); + } -QJsonObject MediaStream::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaStream::toJson() { QJsonObject result; + result["Codec"] = toJsonValue(m_codec); + result["CodecTag"] = toJsonValue(m_codecTag); + result["Language"] = toJsonValue(m_language); + result["ColorRange"] = toJsonValue(m_colorRange); + result["ColorSpace"] = toJsonValue(m_colorSpace); + result["ColorTransfer"] = toJsonValue(m_colorTransfer); + result["ColorPrimaries"] = toJsonValue(m_colorPrimaries); + result["Comment"] = toJsonValue(m_comment); + result["TimeBase"] = toJsonValue(m_timeBase); + result["CodecTimeBase"] = toJsonValue(m_codecTimeBase); + result["Title"] = toJsonValue(m_title); + result["VideoRange"] = toJsonValue(m_videoRange); + result["localizedUndefined"] = toJsonValue(m_localizedUndefined); + result["localizedDefault"] = toJsonValue(m_localizedDefault); + result["localizedForced"] = toJsonValue(m_localizedForced); + result["DisplayTitle"] = toJsonValue(m_displayTitle); + result["NalLengthSize"] = toJsonValue(m_nalLengthSize); + result["IsInterlaced"] = toJsonValue(m_isInterlaced); + result["IsAVC"] = toJsonValue(m_isAVC); + result["ChannelLayout"] = toJsonValue(m_channelLayout); + result["BitRate"] = toJsonValue(m_bitRate); + result["BitDepth"] = toJsonValue(m_bitDepth); + result["RefFrames"] = toJsonValue(m_refFrames); + result["PacketLength"] = toJsonValue(m_packetLength); + result["Channels"] = toJsonValue(m_channels); + result["SampleRate"] = toJsonValue(m_sampleRate); + result["IsDefault"] = toJsonValue(m_isDefault); + result["IsForced"] = toJsonValue(m_isForced); + result["Height"] = toJsonValue(m_height); + result["Width"] = toJsonValue(m_width); + result["AverageFrameRate"] = toJsonValue(m_averageFrameRate); + result["RealFrameRate"] = toJsonValue(m_realFrameRate); + result["Profile"] = toJsonValue(m_profile); + result["Type"] = toJsonValue(m_type); + result["AspectRatio"] = toJsonValue(m_aspectRatio); + result["Index"] = toJsonValue(m_index); + result["Score"] = toJsonValue(m_score); + result["IsExternal"] = toJsonValue(m_isExternal); + result["DeliveryMethod"] = toJsonValue(m_deliveryMethod); + result["DeliveryUrl"] = toJsonValue(m_deliveryUrl); + result["IsExternalUrl"] = toJsonValue(m_isExternalUrl); + result["IsTextSubtitleStream"] = toJsonValue(m_isTextSubtitleStream); + result["SupportsExternalStream"] = toJsonValue(m_supportsExternalStream); + result["Path"] = toJsonValue(m_path); + result["PixelFormat"] = toJsonValue(m_pixelFormat); + result["Level"] = toJsonValue(m_level); + result["IsAnamorphic"] = toJsonValue(m_isAnamorphic); + return result; } + QString MediaStream::codec() const { return m_codec; } + void MediaStream::setCodec(QString newCodec) { m_codec = newCodec; - emit codecChanged(newCodec); } - QString MediaStream::codecTag() const { return m_codecTag; } + void MediaStream::setCodecTag(QString newCodecTag) { m_codecTag = newCodecTag; - emit codecTagChanged(newCodecTag); } - QString MediaStream::language() const { return m_language; } + void MediaStream::setLanguage(QString newLanguage) { m_language = newLanguage; - emit languageChanged(newLanguage); } - QString MediaStream::colorRange() const { return m_colorRange; } + void MediaStream::setColorRange(QString newColorRange) { m_colorRange = newColorRange; - emit colorRangeChanged(newColorRange); } - QString MediaStream::colorSpace() const { return m_colorSpace; } + void MediaStream::setColorSpace(QString newColorSpace) { m_colorSpace = newColorSpace; - emit colorSpaceChanged(newColorSpace); } - QString MediaStream::colorTransfer() const { return m_colorTransfer; } + void MediaStream::setColorTransfer(QString newColorTransfer) { m_colorTransfer = newColorTransfer; - emit colorTransferChanged(newColorTransfer); } - QString MediaStream::colorPrimaries() const { return m_colorPrimaries; } + void MediaStream::setColorPrimaries(QString newColorPrimaries) { m_colorPrimaries = newColorPrimaries; - emit colorPrimariesChanged(newColorPrimaries); } - QString MediaStream::comment() const { return m_comment; } + void MediaStream::setComment(QString newComment) { m_comment = newComment; - emit commentChanged(newComment); } - QString MediaStream::timeBase() const { return m_timeBase; } + void MediaStream::setTimeBase(QString newTimeBase) { m_timeBase = newTimeBase; - emit timeBaseChanged(newTimeBase); } - QString MediaStream::codecTimeBase() const { return m_codecTimeBase; } + void MediaStream::setCodecTimeBase(QString newCodecTimeBase) { m_codecTimeBase = newCodecTimeBase; - emit codecTimeBaseChanged(newCodecTimeBase); } - QString MediaStream::title() const { return m_title; } + void MediaStream::setTitle(QString newTitle) { m_title = newTitle; - emit titleChanged(newTitle); } - QString MediaStream::videoRange() const { return m_videoRange; } + void MediaStream::setVideoRange(QString newVideoRange) { m_videoRange = newVideoRange; - emit videoRangeChanged(newVideoRange); } - QString MediaStream::localizedUndefined() const { return m_localizedUndefined; } + void MediaStream::setLocalizedUndefined(QString newLocalizedUndefined) { m_localizedUndefined = newLocalizedUndefined; - emit localizedUndefinedChanged(newLocalizedUndefined); } - QString MediaStream::localizedDefault() const { return m_localizedDefault; } + void MediaStream::setLocalizedDefault(QString newLocalizedDefault) { m_localizedDefault = newLocalizedDefault; - emit localizedDefaultChanged(newLocalizedDefault); } - QString MediaStream::localizedForced() const { return m_localizedForced; } + void MediaStream::setLocalizedForced(QString newLocalizedForced) { m_localizedForced = newLocalizedForced; - emit localizedForcedChanged(newLocalizedForced); } - QString MediaStream::displayTitle() const { return m_displayTitle; } + void MediaStream::setDisplayTitle(QString newDisplayTitle) { m_displayTitle = newDisplayTitle; - emit displayTitleChanged(newDisplayTitle); } - QString MediaStream::nalLengthSize() const { return m_nalLengthSize; } + void MediaStream::setNalLengthSize(QString newNalLengthSize) { m_nalLengthSize = newNalLengthSize; - emit nalLengthSizeChanged(newNalLengthSize); } - bool MediaStream::isInterlaced() const { return m_isInterlaced; } + void MediaStream::setIsInterlaced(bool newIsInterlaced) { m_isInterlaced = newIsInterlaced; - emit isInterlacedChanged(newIsInterlaced); } - bool MediaStream::isAVC() const { return m_isAVC; } + void MediaStream::setIsAVC(bool newIsAVC) { m_isAVC = newIsAVC; - emit isAVCChanged(newIsAVC); } - QString MediaStream::channelLayout() const { return m_channelLayout; } + void MediaStream::setChannelLayout(QString newChannelLayout) { m_channelLayout = newChannelLayout; - emit channelLayoutChanged(newChannelLayout); } - qint32 MediaStream::bitRate() const { return m_bitRate; } + void MediaStream::setBitRate(qint32 newBitRate) { m_bitRate = newBitRate; - emit bitRateChanged(newBitRate); } - qint32 MediaStream::bitDepth() const { return m_bitDepth; } + void MediaStream::setBitDepth(qint32 newBitDepth) { m_bitDepth = newBitDepth; - emit bitDepthChanged(newBitDepth); } - qint32 MediaStream::refFrames() const { return m_refFrames; } + void MediaStream::setRefFrames(qint32 newRefFrames) { m_refFrames = newRefFrames; - emit refFramesChanged(newRefFrames); } - qint32 MediaStream::packetLength() const { return m_packetLength; } + void MediaStream::setPacketLength(qint32 newPacketLength) { m_packetLength = newPacketLength; - emit packetLengthChanged(newPacketLength); } - qint32 MediaStream::channels() const { return m_channels; } + void MediaStream::setChannels(qint32 newChannels) { m_channels = newChannels; - emit channelsChanged(newChannels); } - qint32 MediaStream::sampleRate() const { return m_sampleRate; } + void MediaStream::setSampleRate(qint32 newSampleRate) { m_sampleRate = newSampleRate; - emit sampleRateChanged(newSampleRate); } - bool MediaStream::isDefault() const { return m_isDefault; } + void MediaStream::setIsDefault(bool newIsDefault) { m_isDefault = newIsDefault; - emit isDefaultChanged(newIsDefault); } - bool MediaStream::isForced() const { return m_isForced; } + void MediaStream::setIsForced(bool newIsForced) { m_isForced = newIsForced; - emit isForcedChanged(newIsForced); } - qint32 MediaStream::height() const { return m_height; } + void MediaStream::setHeight(qint32 newHeight) { m_height = newHeight; - emit heightChanged(newHeight); } - qint32 MediaStream::width() const { return m_width; } + void MediaStream::setWidth(qint32 newWidth) { m_width = newWidth; - emit widthChanged(newWidth); } - float MediaStream::averageFrameRate() const { return m_averageFrameRate; } + void MediaStream::setAverageFrameRate(float newAverageFrameRate) { m_averageFrameRate = newAverageFrameRate; - emit averageFrameRateChanged(newAverageFrameRate); } - float MediaStream::realFrameRate() const { return m_realFrameRate; } + void MediaStream::setRealFrameRate(float newRealFrameRate) { m_realFrameRate = newRealFrameRate; - emit realFrameRateChanged(newRealFrameRate); } - QString MediaStream::profile() const { return m_profile; } + void MediaStream::setProfile(QString newProfile) { m_profile = newProfile; - emit profileChanged(newProfile); } - MediaStreamType MediaStream::type() const { return m_type; } + void MediaStream::setType(MediaStreamType newType) { m_type = newType; - emit typeChanged(newType); } - QString MediaStream::aspectRatio() const { return m_aspectRatio; } + void MediaStream::setAspectRatio(QString newAspectRatio) { m_aspectRatio = newAspectRatio; - emit aspectRatioChanged(newAspectRatio); } - qint32 MediaStream::index() const { return m_index; } + void MediaStream::setIndex(qint32 newIndex) { m_index = newIndex; - emit indexChanged(newIndex); } - qint32 MediaStream::score() const { return m_score; } + void MediaStream::setScore(qint32 newScore) { m_score = newScore; - emit scoreChanged(newScore); } - bool MediaStream::isExternal() const { return m_isExternal; } + void MediaStream::setIsExternal(bool newIsExternal) { m_isExternal = newIsExternal; - emit isExternalChanged(newIsExternal); } - SubtitleDeliveryMethod MediaStream::deliveryMethod() const { return m_deliveryMethod; } + void MediaStream::setDeliveryMethod(SubtitleDeliveryMethod newDeliveryMethod) { m_deliveryMethod = newDeliveryMethod; - emit deliveryMethodChanged(newDeliveryMethod); } - QString MediaStream::deliveryUrl() const { return m_deliveryUrl; } + void MediaStream::setDeliveryUrl(QString newDeliveryUrl) { m_deliveryUrl = newDeliveryUrl; - emit deliveryUrlChanged(newDeliveryUrl); } - bool MediaStream::isExternalUrl() const { return m_isExternalUrl; } + void MediaStream::setIsExternalUrl(bool newIsExternalUrl) { m_isExternalUrl = newIsExternalUrl; - emit isExternalUrlChanged(newIsExternalUrl); } - bool MediaStream::isTextSubtitleStream() const { return m_isTextSubtitleStream; } + void MediaStream::setIsTextSubtitleStream(bool newIsTextSubtitleStream) { m_isTextSubtitleStream = newIsTextSubtitleStream; - emit isTextSubtitleStreamChanged(newIsTextSubtitleStream); } - bool MediaStream::supportsExternalStream() const { return m_supportsExternalStream; } + void MediaStream::setSupportsExternalStream(bool newSupportsExternalStream) { m_supportsExternalStream = newSupportsExternalStream; - emit supportsExternalStreamChanged(newSupportsExternalStream); } - QString MediaStream::path() const { return m_path; } + void MediaStream::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString MediaStream::pixelFormat() const { return m_pixelFormat; } + void MediaStream::setPixelFormat(QString newPixelFormat) { m_pixelFormat = newPixelFormat; - emit pixelFormatChanged(newPixelFormat); } - double MediaStream::level() const { return m_level; } + void MediaStream::setLevel(double newLevel) { m_level = newLevel; - emit levelChanged(newLevel); } - bool MediaStream::isAnamorphic() const { return m_isAnamorphic; } + void MediaStream::setIsAnamorphic(bool newIsAnamorphic) { m_isAnamorphic = newIsAnamorphic; - emit isAnamorphicChanged(newIsAnamorphic); } diff --git a/core/src/DTO/mediaupdateinfodto.cpp b/core/src/DTO/mediaupdateinfodto.cpp index 7712661..c0f0cab 100644 --- a/core/src/DTO/mediaupdateinfodto.cpp +++ b/core/src/DTO/mediaupdateinfodto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -MediaUpdateInfoDto::MediaUpdateInfoDto(QObject *parent) : QObject(parent) {} +MediaUpdateInfoDto::MediaUpdateInfoDto(QObject *parent) {} -MediaUpdateInfoDto *MediaUpdateInfoDto::fromJSON(QJsonObject source, QObject *parent) { - MediaUpdateInfoDto *instance = new MediaUpdateInfoDto(parent); - instance->updateFromJSON(source); +MediaUpdateInfoDto MediaUpdateInfoDto::fromJson(QJsonObject source) {MediaUpdateInfoDto instance; + instance->setFromJson(source, false); return instance; } -void MediaUpdateInfoDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaUpdateInfoDto::setFromJson(QJsonObject source) { + m_path = fromJsonValue(source["Path"]); + m_updateType = fromJsonValue(source["UpdateType"]); + } -QJsonObject MediaUpdateInfoDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaUpdateInfoDto::toJson() { QJsonObject result; + result["Path"] = toJsonValue(m_path); + result["UpdateType"] = toJsonValue(m_updateType); + return result; } + QString MediaUpdateInfoDto::path() const { return m_path; } + void MediaUpdateInfoDto::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString MediaUpdateInfoDto::updateType() const { return m_updateType; } + void MediaUpdateInfoDto::setUpdateType(QString newUpdateType) { m_updateType = newUpdateType; - emit updateTypeChanged(newUpdateType); } diff --git a/core/src/DTO/mediaurl.cpp b/core/src/DTO/mediaurl.cpp index f57606b..3f67bf6 100644 --- a/core/src/DTO/mediaurl.cpp +++ b/core/src/DTO/mediaurl.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -MediaUrl::MediaUrl(QObject *parent) : QObject(parent) {} +MediaUrl::MediaUrl(QObject *parent) {} -MediaUrl *MediaUrl::fromJSON(QJsonObject source, QObject *parent) { - MediaUrl *instance = new MediaUrl(parent); - instance->updateFromJSON(source); +MediaUrl MediaUrl::fromJson(QJsonObject source) {MediaUrl instance; + instance->setFromJson(source, false); return instance; } -void MediaUrl::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MediaUrl::setFromJson(QJsonObject source) { + m_url = fromJsonValue(source["Url"]); + m_name = fromJsonValue(source["Name"]); + } -QJsonObject MediaUrl::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MediaUrl::toJson() { QJsonObject result; + result["Url"] = toJsonValue(m_url); + result["Name"] = toJsonValue(m_name); + return result; } + QString MediaUrl::url() const { return m_url; } + void MediaUrl::setUrl(QString newUrl) { m_url = newUrl; - emit urlChanged(newUrl); } - QString MediaUrl::name() const { return m_name; } + void MediaUrl::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } diff --git a/core/src/DTO/metadataeditorinfo.cpp b/core/src/DTO/metadataeditorinfo.cpp index 7d12963..5789d66 100644 --- a/core/src/DTO/metadataeditorinfo.cpp +++ b/core/src/DTO/metadataeditorinfo.cpp @@ -32,56 +32,65 @@ namespace Jellyfin { namespace DTO { -MetadataEditorInfo::MetadataEditorInfo(QObject *parent) : QObject(parent) {} +MetadataEditorInfo::MetadataEditorInfo(QObject *parent) {} -MetadataEditorInfo *MetadataEditorInfo::fromJSON(QJsonObject source, QObject *parent) { - MetadataEditorInfo *instance = new MetadataEditorInfo(parent); - instance->updateFromJSON(source); +MetadataEditorInfo MetadataEditorInfo::fromJson(QJsonObject source) {MetadataEditorInfo instance; + instance->setFromJson(source, false); return instance; } -void MetadataEditorInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MetadataEditorInfo::setFromJson(QJsonObject source) { + m_parentalRatingOptions = fromJsonValue>>(source["ParentalRatingOptions"]); + m_countries = fromJsonValue>>(source["Countries"]); + m_cultures = fromJsonValue>>(source["Cultures"]); + m_externalIdInfos = fromJsonValue>>(source["ExternalIdInfos"]); + m_contentType = fromJsonValue(source["ContentType"]); + m_contentTypeOptions = fromJsonValue>>(source["ContentTypeOptions"]); + } -QJsonObject MetadataEditorInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MetadataEditorInfo::toJson() { QJsonObject result; + result["ParentalRatingOptions"] = toJsonValue>>(m_parentalRatingOptions); + result["Countries"] = toJsonValue>>(m_countries); + result["Cultures"] = toJsonValue>>(m_cultures); + result["ExternalIdInfos"] = toJsonValue>>(m_externalIdInfos); + result["ContentType"] = toJsonValue(m_contentType); + result["ContentTypeOptions"] = toJsonValue>>(m_contentTypeOptions); + return result; } -QList MetadataEditorInfo::parentalRatingOptions() const { return m_parentalRatingOptions; } -void MetadataEditorInfo::setParentalRatingOptions(QList newParentalRatingOptions) { + +QList> MetadataEditorInfo::parentalRatingOptions() const { return m_parentalRatingOptions; } + +void MetadataEditorInfo::setParentalRatingOptions(QList> newParentalRatingOptions) { m_parentalRatingOptions = newParentalRatingOptions; - emit parentalRatingOptionsChanged(newParentalRatingOptions); } +QList> MetadataEditorInfo::countries() const { return m_countries; } -QList MetadataEditorInfo::countries() const { return m_countries; } -void MetadataEditorInfo::setCountries(QList newCountries) { +void MetadataEditorInfo::setCountries(QList> newCountries) { m_countries = newCountries; - emit countriesChanged(newCountries); } +QList> MetadataEditorInfo::cultures() const { return m_cultures; } -QList MetadataEditorInfo::cultures() const { return m_cultures; } -void MetadataEditorInfo::setCultures(QList newCultures) { +void MetadataEditorInfo::setCultures(QList> newCultures) { m_cultures = newCultures; - emit culturesChanged(newCultures); } +QList> MetadataEditorInfo::externalIdInfos() const { return m_externalIdInfos; } -QList MetadataEditorInfo::externalIdInfos() const { return m_externalIdInfos; } -void MetadataEditorInfo::setExternalIdInfos(QList newExternalIdInfos) { +void MetadataEditorInfo::setExternalIdInfos(QList> newExternalIdInfos) { m_externalIdInfos = newExternalIdInfos; - emit externalIdInfosChanged(newExternalIdInfos); } - QString MetadataEditorInfo::contentType() const { return m_contentType; } + void MetadataEditorInfo::setContentType(QString newContentType) { m_contentType = newContentType; - emit contentTypeChanged(newContentType); } +QList> MetadataEditorInfo::contentTypeOptions() const { return m_contentTypeOptions; } -QList MetadataEditorInfo::contentTypeOptions() const { return m_contentTypeOptions; } -void MetadataEditorInfo::setContentTypeOptions(QList newContentTypeOptions) { +void MetadataEditorInfo::setContentTypeOptions(QList> newContentTypeOptions) { m_contentTypeOptions = newContentTypeOptions; - emit contentTypeOptionsChanged(newContentTypeOptions); } diff --git a/core/src/DTO/metadataoptions.cpp b/core/src/DTO/metadataoptions.cpp index 9555fce..20e4909 100644 --- a/core/src/DTO/metadataoptions.cpp +++ b/core/src/DTO/metadataoptions.cpp @@ -32,62 +32,72 @@ namespace Jellyfin { namespace DTO { -MetadataOptions::MetadataOptions(QObject *parent) : QObject(parent) {} +MetadataOptions::MetadataOptions(QObject *parent) {} -MetadataOptions *MetadataOptions::fromJSON(QJsonObject source, QObject *parent) { - MetadataOptions *instance = new MetadataOptions(parent); - instance->updateFromJSON(source); +MetadataOptions MetadataOptions::fromJson(QJsonObject source) {MetadataOptions instance; + instance->setFromJson(source, false); return instance; } -void MetadataOptions::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MetadataOptions::setFromJson(QJsonObject source) { + m_itemType = fromJsonValue(source["ItemType"]); + m_disabledMetadataSavers = fromJsonValue(source["DisabledMetadataSavers"]); + m_localMetadataReaderOrder = fromJsonValue(source["LocalMetadataReaderOrder"]); + m_disabledMetadataFetchers = fromJsonValue(source["DisabledMetadataFetchers"]); + m_metadataFetcherOrder = fromJsonValue(source["MetadataFetcherOrder"]); + m_disabledImageFetchers = fromJsonValue(source["DisabledImageFetchers"]); + m_imageFetcherOrder = fromJsonValue(source["ImageFetcherOrder"]); + } -QJsonObject MetadataOptions::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MetadataOptions::toJson() { QJsonObject result; + result["ItemType"] = toJsonValue(m_itemType); + result["DisabledMetadataSavers"] = toJsonValue(m_disabledMetadataSavers); + result["LocalMetadataReaderOrder"] = toJsonValue(m_localMetadataReaderOrder); + result["DisabledMetadataFetchers"] = toJsonValue(m_disabledMetadataFetchers); + result["MetadataFetcherOrder"] = toJsonValue(m_metadataFetcherOrder); + result["DisabledImageFetchers"] = toJsonValue(m_disabledImageFetchers); + result["ImageFetcherOrder"] = toJsonValue(m_imageFetcherOrder); + return result; } + QString MetadataOptions::itemType() const { return m_itemType; } + void MetadataOptions::setItemType(QString newItemType) { m_itemType = newItemType; - emit itemTypeChanged(newItemType); } - QStringList MetadataOptions::disabledMetadataSavers() const { return m_disabledMetadataSavers; } + void MetadataOptions::setDisabledMetadataSavers(QStringList newDisabledMetadataSavers) { m_disabledMetadataSavers = newDisabledMetadataSavers; - emit disabledMetadataSaversChanged(newDisabledMetadataSavers); } - QStringList MetadataOptions::localMetadataReaderOrder() const { return m_localMetadataReaderOrder; } + void MetadataOptions::setLocalMetadataReaderOrder(QStringList newLocalMetadataReaderOrder) { m_localMetadataReaderOrder = newLocalMetadataReaderOrder; - emit localMetadataReaderOrderChanged(newLocalMetadataReaderOrder); } - QStringList MetadataOptions::disabledMetadataFetchers() const { return m_disabledMetadataFetchers; } + void MetadataOptions::setDisabledMetadataFetchers(QStringList newDisabledMetadataFetchers) { m_disabledMetadataFetchers = newDisabledMetadataFetchers; - emit disabledMetadataFetchersChanged(newDisabledMetadataFetchers); } - QStringList MetadataOptions::metadataFetcherOrder() const { return m_metadataFetcherOrder; } + void MetadataOptions::setMetadataFetcherOrder(QStringList newMetadataFetcherOrder) { m_metadataFetcherOrder = newMetadataFetcherOrder; - emit metadataFetcherOrderChanged(newMetadataFetcherOrder); } - QStringList MetadataOptions::disabledImageFetchers() const { return m_disabledImageFetchers; } + void MetadataOptions::setDisabledImageFetchers(QStringList newDisabledImageFetchers) { m_disabledImageFetchers = newDisabledImageFetchers; - emit disabledImageFetchersChanged(newDisabledImageFetchers); } - QStringList MetadataOptions::imageFetcherOrder() const { return m_imageFetcherOrder; } + void MetadataOptions::setImageFetcherOrder(QStringList newImageFetcherOrder) { m_imageFetcherOrder = newImageFetcherOrder; - emit imageFetcherOrderChanged(newImageFetcherOrder); } diff --git a/core/src/DTO/moveplaylistitemrequestdto.cpp b/core/src/DTO/moveplaylistitemrequestdto.cpp index 22f51bc..b58bda4 100644 --- a/core/src/DTO/moveplaylistitemrequestdto.cpp +++ b/core/src/DTO/moveplaylistitemrequestdto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -MovePlaylistItemRequestDto::MovePlaylistItemRequestDto(QObject *parent) : QObject(parent) {} +MovePlaylistItemRequestDto::MovePlaylistItemRequestDto(QObject *parent) {} -MovePlaylistItemRequestDto *MovePlaylistItemRequestDto::fromJSON(QJsonObject source, QObject *parent) { - MovePlaylistItemRequestDto *instance = new MovePlaylistItemRequestDto(parent); - instance->updateFromJSON(source); +MovePlaylistItemRequestDto MovePlaylistItemRequestDto::fromJson(QJsonObject source) {MovePlaylistItemRequestDto instance; + instance->setFromJson(source, false); return instance; } -void MovePlaylistItemRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MovePlaylistItemRequestDto::setFromJson(QJsonObject source) { + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + m_newIndex = fromJsonValue(source["NewIndex"]); + } -QJsonObject MovePlaylistItemRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MovePlaylistItemRequestDto::toJson() { QJsonObject result; + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + result["NewIndex"] = toJsonValue(m_newIndex); + return result; } -QString MovePlaylistItemRequestDto::playlistItemId() const { return m_playlistItemId; } -void MovePlaylistItemRequestDto::setPlaylistItemId(QString newPlaylistItemId) { - m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); -} +QUuid MovePlaylistItemRequestDto::playlistItemId() const { return m_playlistItemId; } + +void MovePlaylistItemRequestDto::setPlaylistItemId(QUuid newPlaylistItemId) { + m_playlistItemId = newPlaylistItemId; +} qint32 MovePlaylistItemRequestDto::newIndex() const { return m_newIndex; } + void MovePlaylistItemRequestDto::setNewIndex(qint32 newNewIndex) { m_newIndex = newNewIndex; - emit newIndexChanged(newNewIndex); } diff --git a/core/src/DTO/movieinfo.cpp b/core/src/DTO/movieinfo.cpp index 317a9ae..52ebed7 100644 --- a/core/src/DTO/movieinfo.cpp +++ b/core/src/DTO/movieinfo.cpp @@ -32,80 +32,93 @@ namespace Jellyfin { namespace DTO { -MovieInfo::MovieInfo(QObject *parent) : QObject(parent) {} +MovieInfo::MovieInfo(QObject *parent) {} -MovieInfo *MovieInfo::fromJSON(QJsonObject source, QObject *parent) { - MovieInfo *instance = new MovieInfo(parent); - instance->updateFromJSON(source); +MovieInfo MovieInfo::fromJson(QJsonObject source) {MovieInfo instance; + instance->setFromJson(source, false); return instance; } -void MovieInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MovieInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + } -QJsonObject MovieInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MovieInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + return result; } + QString MovieInfo::name() const { return m_name; } + void MovieInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString MovieInfo::path() const { return m_path; } + void MovieInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString MovieInfo::metadataLanguage() const { return m_metadataLanguage; } + void MovieInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString MovieInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void MovieInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject MovieInfo::providerIds() const { return m_providerIds; } + void MovieInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 MovieInfo::year() const { return m_year; } + void MovieInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 MovieInfo::indexNumber() const { return m_indexNumber; } + void MovieInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 MovieInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void MovieInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime MovieInfo::premiereDate() const { return m_premiereDate; } + void MovieInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool MovieInfo::isAutomated() const { return m_isAutomated; } + void MovieInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } diff --git a/core/src/DTO/movieinforemotesearchquery.cpp b/core/src/DTO/movieinforemotesearchquery.cpp index a3071f1..2ab6ef5 100644 --- a/core/src/DTO/movieinforemotesearchquery.cpp +++ b/core/src/DTO/movieinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -MovieInfoRemoteSearchQuery::MovieInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +MovieInfoRemoteSearchQuery::MovieInfoRemoteSearchQuery(QObject *parent) {} -MovieInfoRemoteSearchQuery *MovieInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - MovieInfoRemoteSearchQuery *instance = new MovieInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +MovieInfoRemoteSearchQuery MovieInfoRemoteSearchQuery::fromJson(QJsonObject source) {MovieInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void MovieInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MovieInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject MovieInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MovieInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -MovieInfo * MovieInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void MovieInfoRemoteSearchQuery::setSearchInfo(MovieInfo * newSearchInfo) { + +QSharedPointer MovieInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void MovieInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid MovieInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString MovieInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void MovieInfoRemoteSearchQuery::setItemId(QString newItemId) { +void MovieInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString MovieInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void MovieInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool MovieInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void MovieInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/musicvideoinfo.cpp b/core/src/DTO/musicvideoinfo.cpp index 4609a64..06e768b 100644 --- a/core/src/DTO/musicvideoinfo.cpp +++ b/core/src/DTO/musicvideoinfo.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -MusicVideoInfo::MusicVideoInfo(QObject *parent) : QObject(parent) {} +MusicVideoInfo::MusicVideoInfo(QObject *parent) {} -MusicVideoInfo *MusicVideoInfo::fromJSON(QJsonObject source, QObject *parent) { - MusicVideoInfo *instance = new MusicVideoInfo(parent); - instance->updateFromJSON(source); +MusicVideoInfo MusicVideoInfo::fromJson(QJsonObject source) {MusicVideoInfo instance; + instance->setFromJson(source, false); return instance; } -void MusicVideoInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MusicVideoInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + m_artists = fromJsonValue(source["Artists"]); + } -QJsonObject MusicVideoInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MusicVideoInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + result["Artists"] = toJsonValue(m_artists); + return result; } + QString MusicVideoInfo::name() const { return m_name; } + void MusicVideoInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString MusicVideoInfo::path() const { return m_path; } + void MusicVideoInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString MusicVideoInfo::metadataLanguage() const { return m_metadataLanguage; } + void MusicVideoInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString MusicVideoInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void MusicVideoInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject MusicVideoInfo::providerIds() const { return m_providerIds; } + void MusicVideoInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 MusicVideoInfo::year() const { return m_year; } + void MusicVideoInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 MusicVideoInfo::indexNumber() const { return m_indexNumber; } + void MusicVideoInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 MusicVideoInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void MusicVideoInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime MusicVideoInfo::premiereDate() const { return m_premiereDate; } + void MusicVideoInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool MusicVideoInfo::isAutomated() const { return m_isAutomated; } + void MusicVideoInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } - QStringList MusicVideoInfo::artists() const { return m_artists; } + void MusicVideoInfo::setArtists(QStringList newArtists) { m_artists = newArtists; - emit artistsChanged(newArtists); } diff --git a/core/src/DTO/musicvideoinforemotesearchquery.cpp b/core/src/DTO/musicvideoinforemotesearchquery.cpp index ddd2bf4..a5c4dd9 100644 --- a/core/src/DTO/musicvideoinforemotesearchquery.cpp +++ b/core/src/DTO/musicvideoinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -MusicVideoInfoRemoteSearchQuery::MusicVideoInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +MusicVideoInfoRemoteSearchQuery::MusicVideoInfoRemoteSearchQuery(QObject *parent) {} -MusicVideoInfoRemoteSearchQuery *MusicVideoInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - MusicVideoInfoRemoteSearchQuery *instance = new MusicVideoInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +MusicVideoInfoRemoteSearchQuery MusicVideoInfoRemoteSearchQuery::fromJson(QJsonObject source) {MusicVideoInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void MusicVideoInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void MusicVideoInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject MusicVideoInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject MusicVideoInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -MusicVideoInfo * MusicVideoInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void MusicVideoInfoRemoteSearchQuery::setSearchInfo(MusicVideoInfo * newSearchInfo) { + +QSharedPointer MusicVideoInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void MusicVideoInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid MusicVideoInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString MusicVideoInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void MusicVideoInfoRemoteSearchQuery::setItemId(QString newItemId) { +void MusicVideoInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString MusicVideoInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void MusicVideoInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool MusicVideoInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void MusicVideoInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/nameguidpair.cpp b/core/src/DTO/nameguidpair.cpp index ac5b5eb..7cc7c2c 100644 --- a/core/src/DTO/nameguidpair.cpp +++ b/core/src/DTO/nameguidpair.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -NameGuidPair::NameGuidPair(QObject *parent) : QObject(parent) {} +NameGuidPair::NameGuidPair(QObject *parent) {} -NameGuidPair *NameGuidPair::fromJSON(QJsonObject source, QObject *parent) { - NameGuidPair *instance = new NameGuidPair(parent); - instance->updateFromJSON(source); +NameGuidPair NameGuidPair::fromJson(QJsonObject source) {NameGuidPair instance; + instance->setFromJson(source, false); return instance; } -void NameGuidPair::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NameGuidPair::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_jellyfinId = fromJsonValue(source["Id"]); + } -QJsonObject NameGuidPair::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NameGuidPair::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Id"] = toJsonValue(m_jellyfinId); + return result; } + QString NameGuidPair::name() const { return m_name; } + void NameGuidPair::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } +QUuid NameGuidPair::jellyfinId() const { return m_jellyfinId; } -QString NameGuidPair::jellyfinId() const { return m_jellyfinId; } -void NameGuidPair::setJellyfinId(QString newJellyfinId) { +void NameGuidPair::setJellyfinId(QUuid newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } diff --git a/core/src/DTO/nameidpair.cpp b/core/src/DTO/nameidpair.cpp index 9d2831a..3d33962 100644 --- a/core/src/DTO/nameidpair.cpp +++ b/core/src/DTO/nameidpair.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -NameIdPair::NameIdPair(QObject *parent) : QObject(parent) {} +NameIdPair::NameIdPair(QObject *parent) {} -NameIdPair *NameIdPair::fromJSON(QJsonObject source, QObject *parent) { - NameIdPair *instance = new NameIdPair(parent); - instance->updateFromJSON(source); +NameIdPair NameIdPair::fromJson(QJsonObject source) {NameIdPair instance; + instance->setFromJson(source, false); return instance; } -void NameIdPair::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NameIdPair::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_jellyfinId = fromJsonValue(source["Id"]); + } -QJsonObject NameIdPair::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NameIdPair::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Id"] = toJsonValue(m_jellyfinId); + return result; } + QString NameIdPair::name() const { return m_name; } + void NameIdPair::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString NameIdPair::jellyfinId() const { return m_jellyfinId; } + void NameIdPair::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } diff --git a/core/src/DTO/namevaluepair.cpp b/core/src/DTO/namevaluepair.cpp index db6cff2..e3c99a0 100644 --- a/core/src/DTO/namevaluepair.cpp +++ b/core/src/DTO/namevaluepair.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -NameValuePair::NameValuePair(QObject *parent) : QObject(parent) {} +NameValuePair::NameValuePair(QObject *parent) {} -NameValuePair *NameValuePair::fromJSON(QJsonObject source, QObject *parent) { - NameValuePair *instance = new NameValuePair(parent); - instance->updateFromJSON(source); +NameValuePair NameValuePair::fromJson(QJsonObject source) {NameValuePair instance; + instance->setFromJson(source, false); return instance; } -void NameValuePair::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NameValuePair::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_value = fromJsonValue(source["Value"]); + } -QJsonObject NameValuePair::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NameValuePair::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Value"] = toJsonValue(m_value); + return result; } + QString NameValuePair::name() const { return m_name; } + void NameValuePair::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString NameValuePair::value() const { return m_value; } + void NameValuePair::setValue(QString newValue) { m_value = newValue; - emit valueChanged(newValue); } diff --git a/core/src/DTO/newgrouprequestdto.cpp b/core/src/DTO/newgrouprequestdto.cpp index 3035aa6..10f2260 100644 --- a/core/src/DTO/newgrouprequestdto.cpp +++ b/core/src/DTO/newgrouprequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -NewGroupRequestDto::NewGroupRequestDto(QObject *parent) : QObject(parent) {} +NewGroupRequestDto::NewGroupRequestDto(QObject *parent) {} -NewGroupRequestDto *NewGroupRequestDto::fromJSON(QJsonObject source, QObject *parent) { - NewGroupRequestDto *instance = new NewGroupRequestDto(parent); - instance->updateFromJSON(source); +NewGroupRequestDto NewGroupRequestDto::fromJson(QJsonObject source) {NewGroupRequestDto instance; + instance->setFromJson(source, false); return instance; } -void NewGroupRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NewGroupRequestDto::setFromJson(QJsonObject source) { + m_groupName = fromJsonValue(source["GroupName"]); + } -QJsonObject NewGroupRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NewGroupRequestDto::toJson() { QJsonObject result; + result["GroupName"] = toJsonValue(m_groupName); + return result; } + QString NewGroupRequestDto::groupName() const { return m_groupName; } + void NewGroupRequestDto::setGroupName(QString newGroupName) { m_groupName = newGroupName; - emit groupNameChanged(newGroupName); } diff --git a/core/src/DTO/nextitemrequestdto.cpp b/core/src/DTO/nextitemrequestdto.cpp index 44e9ca4..0534e18 100644 --- a/core/src/DTO/nextitemrequestdto.cpp +++ b/core/src/DTO/nextitemrequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -NextItemRequestDto::NextItemRequestDto(QObject *parent) : QObject(parent) {} +NextItemRequestDto::NextItemRequestDto(QObject *parent) {} -NextItemRequestDto *NextItemRequestDto::fromJSON(QJsonObject source, QObject *parent) { - NextItemRequestDto *instance = new NextItemRequestDto(parent); - instance->updateFromJSON(source); +NextItemRequestDto NextItemRequestDto::fromJson(QJsonObject source) {NextItemRequestDto instance; + instance->setFromJson(source, false); return instance; } -void NextItemRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NextItemRequestDto::setFromJson(QJsonObject source) { + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject NextItemRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NextItemRequestDto::toJson() { QJsonObject result; + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } -QString NextItemRequestDto::playlistItemId() const { return m_playlistItemId; } -void NextItemRequestDto::setPlaylistItemId(QString newPlaylistItemId) { + +QUuid NextItemRequestDto::playlistItemId() const { return m_playlistItemId; } + +void NextItemRequestDto::setPlaylistItemId(QUuid newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/notificationdto.cpp b/core/src/DTO/notificationdto.cpp index e6a251f..5715156 100644 --- a/core/src/DTO/notificationdto.cpp +++ b/core/src/DTO/notificationdto.cpp @@ -29,73 +29,82 @@ #include -#include - namespace Jellyfin { namespace DTO { -NotificationDto::NotificationDto(QObject *parent) : QObject(parent) {} +NotificationDto::NotificationDto(QObject *parent) {} -NotificationDto *NotificationDto::fromJSON(QJsonObject source, QObject *parent) { - NotificationDto *instance = new NotificationDto(parent); - instance->updateFromJSON(source); +NotificationDto NotificationDto::fromJson(QJsonObject source) {NotificationDto instance; + instance->setFromJson(source, false); return instance; } -void NotificationDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NotificationDto::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_userId = fromJsonValue(source["UserId"]); + m_date = fromJsonValue(source["Date"]); + m_isRead = fromJsonValue(source["IsRead"]); + m_name = fromJsonValue(source["Name"]); + m_description = fromJsonValue(source["Description"]); + m_url = fromJsonValue(source["Url"]); + m_level = fromJsonValue(source["Level"]); + } -QJsonObject NotificationDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NotificationDto::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["UserId"] = toJsonValue(m_userId); + result["Date"] = toJsonValue(m_date); + result["IsRead"] = toJsonValue(m_isRead); + result["Name"] = toJsonValue(m_name); + result["Description"] = toJsonValue(m_description); + result["Url"] = toJsonValue(m_url); + result["Level"] = toJsonValue(m_level); + return result; } + QString NotificationDto::jellyfinId() const { return m_jellyfinId; } + void NotificationDto::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString NotificationDto::userId() const { return m_userId; } + void NotificationDto::setUserId(QString newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - QDateTime NotificationDto::date() const { return m_date; } + void NotificationDto::setDate(QDateTime newDate) { m_date = newDate; - emit dateChanged(newDate); } - bool NotificationDto::isRead() const { return m_isRead; } + void NotificationDto::setIsRead(bool newIsRead) { m_isRead = newIsRead; - emit isReadChanged(newIsRead); } - QString NotificationDto::name() const { return m_name; } + void NotificationDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString NotificationDto::description() const { return m_description; } + void NotificationDto::setDescription(QString newDescription) { m_description = newDescription; - emit descriptionChanged(newDescription); } - QString NotificationDto::url() const { return m_url; } + void NotificationDto::setUrl(QString newUrl) { m_url = newUrl; - emit urlChanged(newUrl); } - NotificationLevel NotificationDto::level() const { return m_level; } + void NotificationDto::setLevel(NotificationLevel newLevel) { m_level = newLevel; - emit levelChanged(newLevel); } diff --git a/core/src/DTO/notificationresultdto.cpp b/core/src/DTO/notificationresultdto.cpp index 60dd1f4..36c14fe 100644 --- a/core/src/DTO/notificationresultdto.cpp +++ b/core/src/DTO/notificationresultdto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -NotificationResultDto::NotificationResultDto(QObject *parent) : QObject(parent) {} +NotificationResultDto::NotificationResultDto(QObject *parent) {} -NotificationResultDto *NotificationResultDto::fromJSON(QJsonObject source, QObject *parent) { - NotificationResultDto *instance = new NotificationResultDto(parent); - instance->updateFromJSON(source); +NotificationResultDto NotificationResultDto::fromJson(QJsonObject source) {NotificationResultDto instance; + instance->setFromJson(source, false); return instance; } -void NotificationResultDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NotificationResultDto::setFromJson(QJsonObject source) { + m_notifications = fromJsonValue>>(source["Notifications"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + } -QJsonObject NotificationResultDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NotificationResultDto::toJson() { QJsonObject result; + result["Notifications"] = toJsonValue>>(m_notifications); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + return result; } -QList NotificationResultDto::notifications() const { return m_notifications; } -void NotificationResultDto::setNotifications(QList newNotifications) { - m_notifications = newNotifications; - emit notificationsChanged(newNotifications); -} +QList> NotificationResultDto::notifications() const { return m_notifications; } + +void NotificationResultDto::setNotifications(QList> newNotifications) { + m_notifications = newNotifications; +} qint32 NotificationResultDto::totalRecordCount() const { return m_totalRecordCount; } + void NotificationResultDto::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } diff --git a/core/src/DTO/notificationssummarydto.cpp b/core/src/DTO/notificationssummarydto.cpp index 731c942..9943bfc 100644 --- a/core/src/DTO/notificationssummarydto.cpp +++ b/core/src/DTO/notificationssummarydto.cpp @@ -29,37 +29,40 @@ #include -#include - namespace Jellyfin { namespace DTO { -NotificationsSummaryDto::NotificationsSummaryDto(QObject *parent) : QObject(parent) {} +NotificationsSummaryDto::NotificationsSummaryDto(QObject *parent) {} -NotificationsSummaryDto *NotificationsSummaryDto::fromJSON(QJsonObject source, QObject *parent) { - NotificationsSummaryDto *instance = new NotificationsSummaryDto(parent); - instance->updateFromJSON(source); +NotificationsSummaryDto NotificationsSummaryDto::fromJson(QJsonObject source) {NotificationsSummaryDto instance; + instance->setFromJson(source, false); return instance; } -void NotificationsSummaryDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NotificationsSummaryDto::setFromJson(QJsonObject source) { + m_unreadCount = fromJsonValue(source["UnreadCount"]); + m_maxUnreadNotificationLevel = fromJsonValue(source["MaxUnreadNotificationLevel"]); + } -QJsonObject NotificationsSummaryDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NotificationsSummaryDto::toJson() { QJsonObject result; + result["UnreadCount"] = toJsonValue(m_unreadCount); + result["MaxUnreadNotificationLevel"] = toJsonValue(m_maxUnreadNotificationLevel); + return result; } + qint32 NotificationsSummaryDto::unreadCount() const { return m_unreadCount; } + void NotificationsSummaryDto::setUnreadCount(qint32 newUnreadCount) { m_unreadCount = newUnreadCount; - emit unreadCountChanged(newUnreadCount); } - NotificationLevel NotificationsSummaryDto::maxUnreadNotificationLevel() const { return m_maxUnreadNotificationLevel; } + void NotificationsSummaryDto::setMaxUnreadNotificationLevel(NotificationLevel newMaxUnreadNotificationLevel) { m_maxUnreadNotificationLevel = newMaxUnreadNotificationLevel; - emit maxUnreadNotificationLevelChanged(newMaxUnreadNotificationLevel); } diff --git a/core/src/DTO/notificationtypeinfo.cpp b/core/src/DTO/notificationtypeinfo.cpp index 3502b26..38eebef 100644 --- a/core/src/DTO/notificationtypeinfo.cpp +++ b/core/src/DTO/notificationtypeinfo.cpp @@ -32,50 +32,58 @@ namespace Jellyfin { namespace DTO { -NotificationTypeInfo::NotificationTypeInfo(QObject *parent) : QObject(parent) {} +NotificationTypeInfo::NotificationTypeInfo(QObject *parent) {} -NotificationTypeInfo *NotificationTypeInfo::fromJSON(QJsonObject source, QObject *parent) { - NotificationTypeInfo *instance = new NotificationTypeInfo(parent); - instance->updateFromJSON(source); +NotificationTypeInfo NotificationTypeInfo::fromJson(QJsonObject source) {NotificationTypeInfo instance; + instance->setFromJson(source, false); return instance; } -void NotificationTypeInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void NotificationTypeInfo::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["Type"]); + m_name = fromJsonValue(source["Name"]); + m_enabled = fromJsonValue(source["Enabled"]); + m_category = fromJsonValue(source["Category"]); + m_isBasedOnUserEvent = fromJsonValue(source["IsBasedOnUserEvent"]); + } -QJsonObject NotificationTypeInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject NotificationTypeInfo::toJson() { QJsonObject result; + result["Type"] = toJsonValue(m_type); + result["Name"] = toJsonValue(m_name); + result["Enabled"] = toJsonValue(m_enabled); + result["Category"] = toJsonValue(m_category); + result["IsBasedOnUserEvent"] = toJsonValue(m_isBasedOnUserEvent); + return result; } + QString NotificationTypeInfo::type() const { return m_type; } + void NotificationTypeInfo::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString NotificationTypeInfo::name() const { return m_name; } + void NotificationTypeInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - bool NotificationTypeInfo::enabled() const { return m_enabled; } + void NotificationTypeInfo::setEnabled(bool newEnabled) { m_enabled = newEnabled; - emit enabledChanged(newEnabled); } - QString NotificationTypeInfo::category() const { return m_category; } + void NotificationTypeInfo::setCategory(QString newCategory) { m_category = newCategory; - emit categoryChanged(newCategory); } - bool NotificationTypeInfo::isBasedOnUserEvent() const { return m_isBasedOnUserEvent; } + void NotificationTypeInfo::setIsBasedOnUserEvent(bool newIsBasedOnUserEvent) { m_isBasedOnUserEvent = newIsBasedOnUserEvent; - emit isBasedOnUserEventChanged(newIsBasedOnUserEvent); } diff --git a/core/src/DTO/objectgroupupdate.cpp b/core/src/DTO/objectgroupupdate.cpp index 569a1ea..ed95dff 100644 --- a/core/src/DTO/objectgroupupdate.cpp +++ b/core/src/DTO/objectgroupupdate.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -ObjectGroupUpdate::ObjectGroupUpdate(QObject *parent) : QObject(parent) {} +ObjectGroupUpdate::ObjectGroupUpdate(QObject *parent) {} -ObjectGroupUpdate *ObjectGroupUpdate::fromJSON(QJsonObject source, QObject *parent) { - ObjectGroupUpdate *instance = new ObjectGroupUpdate(parent); - instance->updateFromJSON(source); +ObjectGroupUpdate ObjectGroupUpdate::fromJson(QJsonObject source) {ObjectGroupUpdate instance; + instance->setFromJson(source, false); return instance; } -void ObjectGroupUpdate::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ObjectGroupUpdate::setFromJson(QJsonObject source) { + m_groupId = fromJsonValue(source["GroupId"]); + m_type = fromJsonValue(source["Type"]); + m_data = fromJsonValue(source["Data"]); + } -QJsonObject ObjectGroupUpdate::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ObjectGroupUpdate::toJson() { QJsonObject result; + result["GroupId"] = toJsonValue(m_groupId); + result["Type"] = toJsonValue(m_type); + result["Data"] = toJsonValue(m_data); + return result; } -QString ObjectGroupUpdate::groupId() const { return m_groupId; } -void ObjectGroupUpdate::setGroupId(QString newGroupId) { - m_groupId = newGroupId; - emit groupIdChanged(newGroupId); -} +QUuid ObjectGroupUpdate::groupId() const { return m_groupId; } + +void ObjectGroupUpdate::setGroupId(QUuid newGroupId) { + m_groupId = newGroupId; +} GroupUpdateType ObjectGroupUpdate::type() const { return m_type; } + void ObjectGroupUpdate::setType(GroupUpdateType newType) { m_type = newType; - emit typeChanged(newType); } - QVariant ObjectGroupUpdate::data() const { return m_data; } + void ObjectGroupUpdate::setData(QVariant newData) { m_data = newData; - emit dataChanged(newData); } diff --git a/core/src/DTO/openlivestreamdto.cpp b/core/src/DTO/openlivestreamdto.cpp index c72787b..4ffda7c 100644 --- a/core/src/DTO/openlivestreamdto.cpp +++ b/core/src/DTO/openlivestreamdto.cpp @@ -29,103 +29,117 @@ #include -#include - namespace Jellyfin { namespace DTO { -OpenLiveStreamDto::OpenLiveStreamDto(QObject *parent) : QObject(parent) {} +OpenLiveStreamDto::OpenLiveStreamDto(QObject *parent) {} -OpenLiveStreamDto *OpenLiveStreamDto::fromJSON(QJsonObject source, QObject *parent) { - OpenLiveStreamDto *instance = new OpenLiveStreamDto(parent); - instance->updateFromJSON(source); +OpenLiveStreamDto OpenLiveStreamDto::fromJson(QJsonObject source) {OpenLiveStreamDto instance; + instance->setFromJson(source, false); return instance; } -void OpenLiveStreamDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void OpenLiveStreamDto::setFromJson(QJsonObject source) { + m_openToken = fromJsonValue(source["OpenToken"]); + m_userId = fromJsonValue(source["UserId"]); + m_playSessionId = fromJsonValue(source["PlaySessionId"]); + m_maxStreamingBitrate = fromJsonValue(source["MaxStreamingBitrate"]); + m_startTimeTicks = fromJsonValue(source["StartTimeTicks"]); + m_audioStreamIndex = fromJsonValue(source["AudioStreamIndex"]); + m_subtitleStreamIndex = fromJsonValue(source["SubtitleStreamIndex"]); + m_maxAudioChannels = fromJsonValue(source["MaxAudioChannels"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_enableDirectPlay = fromJsonValue(source["EnableDirectPlay"]); + m_enableDirectStream = fromJsonValue(source["EnableDirectStream"]); + m_deviceProfile = fromJsonValue>(source["DeviceProfile"]); + m_directPlayProtocols = fromJsonValue>(source["DirectPlayProtocols"]); + } -QJsonObject OpenLiveStreamDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject OpenLiveStreamDto::toJson() { QJsonObject result; + result["OpenToken"] = toJsonValue(m_openToken); + result["UserId"] = toJsonValue(m_userId); + result["PlaySessionId"] = toJsonValue(m_playSessionId); + result["MaxStreamingBitrate"] = toJsonValue(m_maxStreamingBitrate); + result["StartTimeTicks"] = toJsonValue(m_startTimeTicks); + result["AudioStreamIndex"] = toJsonValue(m_audioStreamIndex); + result["SubtitleStreamIndex"] = toJsonValue(m_subtitleStreamIndex); + result["MaxAudioChannels"] = toJsonValue(m_maxAudioChannels); + result["ItemId"] = toJsonValue(m_itemId); + result["EnableDirectPlay"] = toJsonValue(m_enableDirectPlay); + result["EnableDirectStream"] = toJsonValue(m_enableDirectStream); + result["DeviceProfile"] = toJsonValue>(m_deviceProfile); + result["DirectPlayProtocols"] = toJsonValue>(m_directPlayProtocols); + return result; } + QString OpenLiveStreamDto::openToken() const { return m_openToken; } + void OpenLiveStreamDto::setOpenToken(QString newOpenToken) { m_openToken = newOpenToken; - emit openTokenChanged(newOpenToken); } +QUuid OpenLiveStreamDto::userId() const { return m_userId; } -QString OpenLiveStreamDto::userId() const { return m_userId; } -void OpenLiveStreamDto::setUserId(QString newUserId) { +void OpenLiveStreamDto::setUserId(QUuid newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - QString OpenLiveStreamDto::playSessionId() const { return m_playSessionId; } + void OpenLiveStreamDto::setPlaySessionId(QString newPlaySessionId) { m_playSessionId = newPlaySessionId; - emit playSessionIdChanged(newPlaySessionId); } - qint32 OpenLiveStreamDto::maxStreamingBitrate() const { return m_maxStreamingBitrate; } + void OpenLiveStreamDto::setMaxStreamingBitrate(qint32 newMaxStreamingBitrate) { m_maxStreamingBitrate = newMaxStreamingBitrate; - emit maxStreamingBitrateChanged(newMaxStreamingBitrate); } - qint64 OpenLiveStreamDto::startTimeTicks() const { return m_startTimeTicks; } + void OpenLiveStreamDto::setStartTimeTicks(qint64 newStartTimeTicks) { m_startTimeTicks = newStartTimeTicks; - emit startTimeTicksChanged(newStartTimeTicks); } - qint32 OpenLiveStreamDto::audioStreamIndex() const { return m_audioStreamIndex; } + void OpenLiveStreamDto::setAudioStreamIndex(qint32 newAudioStreamIndex) { m_audioStreamIndex = newAudioStreamIndex; - emit audioStreamIndexChanged(newAudioStreamIndex); } - qint32 OpenLiveStreamDto::subtitleStreamIndex() const { return m_subtitleStreamIndex; } + void OpenLiveStreamDto::setSubtitleStreamIndex(qint32 newSubtitleStreamIndex) { m_subtitleStreamIndex = newSubtitleStreamIndex; - emit subtitleStreamIndexChanged(newSubtitleStreamIndex); } - qint32 OpenLiveStreamDto::maxAudioChannels() const { return m_maxAudioChannels; } + void OpenLiveStreamDto::setMaxAudioChannels(qint32 newMaxAudioChannels) { m_maxAudioChannels = newMaxAudioChannels; - emit maxAudioChannelsChanged(newMaxAudioChannels); } +QUuid OpenLiveStreamDto::itemId() const { return m_itemId; } -QString OpenLiveStreamDto::itemId() const { return m_itemId; } -void OpenLiveStreamDto::setItemId(QString newItemId) { +void OpenLiveStreamDto::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - bool OpenLiveStreamDto::enableDirectPlay() const { return m_enableDirectPlay; } + void OpenLiveStreamDto::setEnableDirectPlay(bool newEnableDirectPlay) { m_enableDirectPlay = newEnableDirectPlay; - emit enableDirectPlayChanged(newEnableDirectPlay); } - bool OpenLiveStreamDto::enableDirectStream() const { return m_enableDirectStream; } + void OpenLiveStreamDto::setEnableDirectStream(bool newEnableDirectStream) { m_enableDirectStream = newEnableDirectStream; - emit enableDirectStreamChanged(newEnableDirectStream); } +QSharedPointer OpenLiveStreamDto::deviceProfile() const { return m_deviceProfile; } -DeviceProfile * OpenLiveStreamDto::deviceProfile() const { return m_deviceProfile; } -void OpenLiveStreamDto::setDeviceProfile(DeviceProfile * newDeviceProfile) { +void OpenLiveStreamDto::setDeviceProfile(QSharedPointer newDeviceProfile) { m_deviceProfile = newDeviceProfile; - emit deviceProfileChanged(newDeviceProfile); } - QList OpenLiveStreamDto::directPlayProtocols() const { return m_directPlayProtocols; } + void OpenLiveStreamDto::setDirectPlayProtocols(QList newDirectPlayProtocols) { m_directPlayProtocols = newDirectPlayProtocols; - emit directPlayProtocolsChanged(newDirectPlayProtocols); } diff --git a/core/src/DTO/packageinfo.cpp b/core/src/DTO/packageinfo.cpp index d8dcdcc..fa38ef5 100644 --- a/core/src/DTO/packageinfo.cpp +++ b/core/src/DTO/packageinfo.cpp @@ -32,68 +32,79 @@ namespace Jellyfin { namespace DTO { -PackageInfo::PackageInfo(QObject *parent) : QObject(parent) {} +PackageInfo::PackageInfo(QObject *parent) {} -PackageInfo *PackageInfo::fromJSON(QJsonObject source, QObject *parent) { - PackageInfo *instance = new PackageInfo(parent); - instance->updateFromJSON(source); +PackageInfo PackageInfo::fromJson(QJsonObject source) {PackageInfo instance; + instance->setFromJson(source, false); return instance; } -void PackageInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PackageInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["name"]); + m_description = fromJsonValue(source["description"]); + m_overview = fromJsonValue(source["overview"]); + m_owner = fromJsonValue(source["owner"]); + m_category = fromJsonValue(source["category"]); + m_guid = fromJsonValue(source["guid"]); + m_versions = fromJsonValue>>(source["versions"]); + m_imageUrl = fromJsonValue(source["imageUrl"]); + } -QJsonObject PackageInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PackageInfo::toJson() { QJsonObject result; + result["name"] = toJsonValue(m_name); + result["description"] = toJsonValue(m_description); + result["overview"] = toJsonValue(m_overview); + result["owner"] = toJsonValue(m_owner); + result["category"] = toJsonValue(m_category); + result["guid"] = toJsonValue(m_guid); + result["versions"] = toJsonValue>>(m_versions); + result["imageUrl"] = toJsonValue(m_imageUrl); + return result; } + QString PackageInfo::name() const { return m_name; } + void PackageInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString PackageInfo::description() const { return m_description; } + void PackageInfo::setDescription(QString newDescription) { m_description = newDescription; - emit descriptionChanged(newDescription); } - QString PackageInfo::overview() const { return m_overview; } + void PackageInfo::setOverview(QString newOverview) { m_overview = newOverview; - emit overviewChanged(newOverview); } - QString PackageInfo::owner() const { return m_owner; } + void PackageInfo::setOwner(QString newOwner) { m_owner = newOwner; - emit ownerChanged(newOwner); } - QString PackageInfo::category() const { return m_category; } + void PackageInfo::setCategory(QString newCategory) { m_category = newCategory; - emit categoryChanged(newCategory); } - QString PackageInfo::guid() const { return m_guid; } + void PackageInfo::setGuid(QString newGuid) { m_guid = newGuid; - emit guidChanged(newGuid); } +QList> PackageInfo::versions() const { return m_versions; } -QList PackageInfo::versions() const { return m_versions; } -void PackageInfo::setVersions(QList newVersions) { +void PackageInfo::setVersions(QList> newVersions) { m_versions = newVersions; - emit versionsChanged(newVersions); } - QString PackageInfo::imageUrl() const { return m_imageUrl; } + void PackageInfo::setImageUrl(QString newImageUrl) { m_imageUrl = newImageUrl; - emit imageUrlChanged(newImageUrl); } diff --git a/core/src/DTO/parentalrating.cpp b/core/src/DTO/parentalrating.cpp index 53af024..39f1c40 100644 --- a/core/src/DTO/parentalrating.cpp +++ b/core/src/DTO/parentalrating.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -ParentalRating::ParentalRating(QObject *parent) : QObject(parent) {} +ParentalRating::ParentalRating(QObject *parent) {} -ParentalRating *ParentalRating::fromJSON(QJsonObject source, QObject *parent) { - ParentalRating *instance = new ParentalRating(parent); - instance->updateFromJSON(source); +ParentalRating ParentalRating::fromJson(QJsonObject source) {ParentalRating instance; + instance->setFromJson(source, false); return instance; } -void ParentalRating::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ParentalRating::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_value = fromJsonValue(source["Value"]); + } -QJsonObject ParentalRating::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ParentalRating::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Value"] = toJsonValue(m_value); + return result; } + QString ParentalRating::name() const { return m_name; } + void ParentalRating::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - qint32 ParentalRating::value() const { return m_value; } + void ParentalRating::setValue(qint32 newValue) { m_value = newValue; - emit valueChanged(newValue); } diff --git a/core/src/DTO/pathsubstitution.cpp b/core/src/DTO/pathsubstitution.cpp index 5f0cace..980fe46 100644 --- a/core/src/DTO/pathsubstitution.cpp +++ b/core/src/DTO/pathsubstitution.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -PathSubstitution::PathSubstitution(QObject *parent) : QObject(parent) {} +PathSubstitution::PathSubstitution(QObject *parent) {} -PathSubstitution *PathSubstitution::fromJSON(QJsonObject source, QObject *parent) { - PathSubstitution *instance = new PathSubstitution(parent); - instance->updateFromJSON(source); +PathSubstitution PathSubstitution::fromJson(QJsonObject source) {PathSubstitution instance; + instance->setFromJson(source, false); return instance; } -void PathSubstitution::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PathSubstitution::setFromJson(QJsonObject source) { + m_from = fromJsonValue(source["From"]); + m_to = fromJsonValue(source["To"]); + } -QJsonObject PathSubstitution::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PathSubstitution::toJson() { QJsonObject result; + result["From"] = toJsonValue(m_from); + result["To"] = toJsonValue(m_to); + return result; } + QString PathSubstitution::from() const { return m_from; } + void PathSubstitution::setFrom(QString newFrom) { m_from = newFrom; - emit fromChanged(newFrom); } - QString PathSubstitution::to() const { return m_to; } + void PathSubstitution::setTo(QString newTo) { m_to = newTo; - emit toChanged(newTo); } diff --git a/core/src/DTO/personlookupinfo.cpp b/core/src/DTO/personlookupinfo.cpp index a7a6203..98df859 100644 --- a/core/src/DTO/personlookupinfo.cpp +++ b/core/src/DTO/personlookupinfo.cpp @@ -32,80 +32,93 @@ namespace Jellyfin { namespace DTO { -PersonLookupInfo::PersonLookupInfo(QObject *parent) : QObject(parent) {} +PersonLookupInfo::PersonLookupInfo(QObject *parent) {} -PersonLookupInfo *PersonLookupInfo::fromJSON(QJsonObject source, QObject *parent) { - PersonLookupInfo *instance = new PersonLookupInfo(parent); - instance->updateFromJSON(source); +PersonLookupInfo PersonLookupInfo::fromJson(QJsonObject source) {PersonLookupInfo instance; + instance->setFromJson(source, false); return instance; } -void PersonLookupInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PersonLookupInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + } -QJsonObject PersonLookupInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PersonLookupInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + return result; } + QString PersonLookupInfo::name() const { return m_name; } + void PersonLookupInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString PersonLookupInfo::path() const { return m_path; } + void PersonLookupInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString PersonLookupInfo::metadataLanguage() const { return m_metadataLanguage; } + void PersonLookupInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString PersonLookupInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void PersonLookupInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject PersonLookupInfo::providerIds() const { return m_providerIds; } + void PersonLookupInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 PersonLookupInfo::year() const { return m_year; } + void PersonLookupInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 PersonLookupInfo::indexNumber() const { return m_indexNumber; } + void PersonLookupInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 PersonLookupInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void PersonLookupInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime PersonLookupInfo::premiereDate() const { return m_premiereDate; } + void PersonLookupInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool PersonLookupInfo::isAutomated() const { return m_isAutomated; } + void PersonLookupInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } diff --git a/core/src/DTO/personlookupinforemotesearchquery.cpp b/core/src/DTO/personlookupinforemotesearchquery.cpp index db7d23f..9aadefd 100644 --- a/core/src/DTO/personlookupinforemotesearchquery.cpp +++ b/core/src/DTO/personlookupinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -PersonLookupInfoRemoteSearchQuery::PersonLookupInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +PersonLookupInfoRemoteSearchQuery::PersonLookupInfoRemoteSearchQuery(QObject *parent) {} -PersonLookupInfoRemoteSearchQuery *PersonLookupInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - PersonLookupInfoRemoteSearchQuery *instance = new PersonLookupInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +PersonLookupInfoRemoteSearchQuery PersonLookupInfoRemoteSearchQuery::fromJson(QJsonObject source) {PersonLookupInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void PersonLookupInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PersonLookupInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject PersonLookupInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PersonLookupInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -PersonLookupInfo * PersonLookupInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void PersonLookupInfoRemoteSearchQuery::setSearchInfo(PersonLookupInfo * newSearchInfo) { + +QSharedPointer PersonLookupInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void PersonLookupInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid PersonLookupInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString PersonLookupInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void PersonLookupInfoRemoteSearchQuery::setItemId(QString newItemId) { +void PersonLookupInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString PersonLookupInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void PersonLookupInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool PersonLookupInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void PersonLookupInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/pingrequestdto.cpp b/core/src/DTO/pingrequestdto.cpp index 0cc3076..9c9610c 100644 --- a/core/src/DTO/pingrequestdto.cpp +++ b/core/src/DTO/pingrequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -PingRequestDto::PingRequestDto(QObject *parent) : QObject(parent) {} +PingRequestDto::PingRequestDto(QObject *parent) {} -PingRequestDto *PingRequestDto::fromJSON(QJsonObject source, QObject *parent) { - PingRequestDto *instance = new PingRequestDto(parent); - instance->updateFromJSON(source); +PingRequestDto PingRequestDto::fromJson(QJsonObject source) {PingRequestDto instance; + instance->setFromJson(source, false); return instance; } -void PingRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PingRequestDto::setFromJson(QJsonObject source) { + m_ping = fromJsonValue(source["Ping"]); + } -QJsonObject PingRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PingRequestDto::toJson() { QJsonObject result; + result["Ping"] = toJsonValue(m_ping); + return result; } + qint64 PingRequestDto::ping() const { return m_ping; } + void PingRequestDto::setPing(qint64 newPing) { m_ping = newPing; - emit pingChanged(newPing); } diff --git a/core/src/DTO/pinredeemresult.cpp b/core/src/DTO/pinredeemresult.cpp index c9ee0a8..350eea0 100644 --- a/core/src/DTO/pinredeemresult.cpp +++ b/core/src/DTO/pinredeemresult.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -PinRedeemResult::PinRedeemResult(QObject *parent) : QObject(parent) {} +PinRedeemResult::PinRedeemResult(QObject *parent) {} -PinRedeemResult *PinRedeemResult::fromJSON(QJsonObject source, QObject *parent) { - PinRedeemResult *instance = new PinRedeemResult(parent); - instance->updateFromJSON(source); +PinRedeemResult PinRedeemResult::fromJson(QJsonObject source) {PinRedeemResult instance; + instance->setFromJson(source, false); return instance; } -void PinRedeemResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PinRedeemResult::setFromJson(QJsonObject source) { + m_success = fromJsonValue(source["Success"]); + m_usersReset = fromJsonValue(source["UsersReset"]); + } -QJsonObject PinRedeemResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PinRedeemResult::toJson() { QJsonObject result; + result["Success"] = toJsonValue(m_success); + result["UsersReset"] = toJsonValue(m_usersReset); + return result; } + bool PinRedeemResult::success() const { return m_success; } + void PinRedeemResult::setSuccess(bool newSuccess) { m_success = newSuccess; - emit successChanged(newSuccess); } - QStringList PinRedeemResult::usersReset() const { return m_usersReset; } + void PinRedeemResult::setUsersReset(QStringList newUsersReset) { m_usersReset = newUsersReset; - emit usersResetChanged(newUsersReset); } diff --git a/core/src/DTO/playbackinfodto.cpp b/core/src/DTO/playbackinfodto.cpp index d653a29..c123e2b 100644 --- a/core/src/DTO/playbackinfodto.cpp +++ b/core/src/DTO/playbackinfodto.cpp @@ -32,110 +32,128 @@ namespace Jellyfin { namespace DTO { -PlaybackInfoDto::PlaybackInfoDto(QObject *parent) : QObject(parent) {} +PlaybackInfoDto::PlaybackInfoDto(QObject *parent) {} -PlaybackInfoDto *PlaybackInfoDto::fromJSON(QJsonObject source, QObject *parent) { - PlaybackInfoDto *instance = new PlaybackInfoDto(parent); - instance->updateFromJSON(source); +PlaybackInfoDto PlaybackInfoDto::fromJson(QJsonObject source) {PlaybackInfoDto instance; + instance->setFromJson(source, false); return instance; } -void PlaybackInfoDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlaybackInfoDto::setFromJson(QJsonObject source) { + m_userId = fromJsonValue(source["UserId"]); + m_maxStreamingBitrate = fromJsonValue(source["MaxStreamingBitrate"]); + m_startTimeTicks = fromJsonValue(source["StartTimeTicks"]); + m_audioStreamIndex = fromJsonValue(source["AudioStreamIndex"]); + m_subtitleStreamIndex = fromJsonValue(source["SubtitleStreamIndex"]); + m_maxAudioChannels = fromJsonValue(source["MaxAudioChannels"]); + m_mediaSourceId = fromJsonValue(source["MediaSourceId"]); + m_liveStreamId = fromJsonValue(source["LiveStreamId"]); + m_deviceProfile = fromJsonValue>(source["DeviceProfile"]); + m_enableDirectPlay = fromJsonValue(source["EnableDirectPlay"]); + m_enableDirectStream = fromJsonValue(source["EnableDirectStream"]); + m_enableTranscoding = fromJsonValue(source["EnableTranscoding"]); + m_allowVideoStreamCopy = fromJsonValue(source["AllowVideoStreamCopy"]); + m_allowAudioStreamCopy = fromJsonValue(source["AllowAudioStreamCopy"]); + m_autoOpenLiveStream = fromJsonValue(source["AutoOpenLiveStream"]); + } -QJsonObject PlaybackInfoDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlaybackInfoDto::toJson() { QJsonObject result; + result["UserId"] = toJsonValue(m_userId); + result["MaxStreamingBitrate"] = toJsonValue(m_maxStreamingBitrate); + result["StartTimeTicks"] = toJsonValue(m_startTimeTicks); + result["AudioStreamIndex"] = toJsonValue(m_audioStreamIndex); + result["SubtitleStreamIndex"] = toJsonValue(m_subtitleStreamIndex); + result["MaxAudioChannels"] = toJsonValue(m_maxAudioChannels); + result["MediaSourceId"] = toJsonValue(m_mediaSourceId); + result["LiveStreamId"] = toJsonValue(m_liveStreamId); + result["DeviceProfile"] = toJsonValue>(m_deviceProfile); + result["EnableDirectPlay"] = toJsonValue(m_enableDirectPlay); + result["EnableDirectStream"] = toJsonValue(m_enableDirectStream); + result["EnableTranscoding"] = toJsonValue(m_enableTranscoding); + result["AllowVideoStreamCopy"] = toJsonValue(m_allowVideoStreamCopy); + result["AllowAudioStreamCopy"] = toJsonValue(m_allowAudioStreamCopy); + result["AutoOpenLiveStream"] = toJsonValue(m_autoOpenLiveStream); + return result; } -QString PlaybackInfoDto::userId() const { return m_userId; } -void PlaybackInfoDto::setUserId(QString newUserId) { - m_userId = newUserId; - emit userIdChanged(newUserId); -} +QUuid PlaybackInfoDto::userId() const { return m_userId; } + +void PlaybackInfoDto::setUserId(QUuid newUserId) { + m_userId = newUserId; +} qint32 PlaybackInfoDto::maxStreamingBitrate() const { return m_maxStreamingBitrate; } + void PlaybackInfoDto::setMaxStreamingBitrate(qint32 newMaxStreamingBitrate) { m_maxStreamingBitrate = newMaxStreamingBitrate; - emit maxStreamingBitrateChanged(newMaxStreamingBitrate); } - qint64 PlaybackInfoDto::startTimeTicks() const { return m_startTimeTicks; } + void PlaybackInfoDto::setStartTimeTicks(qint64 newStartTimeTicks) { m_startTimeTicks = newStartTimeTicks; - emit startTimeTicksChanged(newStartTimeTicks); } - qint32 PlaybackInfoDto::audioStreamIndex() const { return m_audioStreamIndex; } + void PlaybackInfoDto::setAudioStreamIndex(qint32 newAudioStreamIndex) { m_audioStreamIndex = newAudioStreamIndex; - emit audioStreamIndexChanged(newAudioStreamIndex); } - qint32 PlaybackInfoDto::subtitleStreamIndex() const { return m_subtitleStreamIndex; } + void PlaybackInfoDto::setSubtitleStreamIndex(qint32 newSubtitleStreamIndex) { m_subtitleStreamIndex = newSubtitleStreamIndex; - emit subtitleStreamIndexChanged(newSubtitleStreamIndex); } - qint32 PlaybackInfoDto::maxAudioChannels() const { return m_maxAudioChannels; } + void PlaybackInfoDto::setMaxAudioChannels(qint32 newMaxAudioChannels) { m_maxAudioChannels = newMaxAudioChannels; - emit maxAudioChannelsChanged(newMaxAudioChannels); } - QString PlaybackInfoDto::mediaSourceId() const { return m_mediaSourceId; } + void PlaybackInfoDto::setMediaSourceId(QString newMediaSourceId) { m_mediaSourceId = newMediaSourceId; - emit mediaSourceIdChanged(newMediaSourceId); } - QString PlaybackInfoDto::liveStreamId() const { return m_liveStreamId; } + void PlaybackInfoDto::setLiveStreamId(QString newLiveStreamId) { m_liveStreamId = newLiveStreamId; - emit liveStreamIdChanged(newLiveStreamId); } +QSharedPointer PlaybackInfoDto::deviceProfile() const { return m_deviceProfile; } -DeviceProfile * PlaybackInfoDto::deviceProfile() const { return m_deviceProfile; } -void PlaybackInfoDto::setDeviceProfile(DeviceProfile * newDeviceProfile) { +void PlaybackInfoDto::setDeviceProfile(QSharedPointer newDeviceProfile) { m_deviceProfile = newDeviceProfile; - emit deviceProfileChanged(newDeviceProfile); } - bool PlaybackInfoDto::enableDirectPlay() const { return m_enableDirectPlay; } + void PlaybackInfoDto::setEnableDirectPlay(bool newEnableDirectPlay) { m_enableDirectPlay = newEnableDirectPlay; - emit enableDirectPlayChanged(newEnableDirectPlay); } - bool PlaybackInfoDto::enableDirectStream() const { return m_enableDirectStream; } + void PlaybackInfoDto::setEnableDirectStream(bool newEnableDirectStream) { m_enableDirectStream = newEnableDirectStream; - emit enableDirectStreamChanged(newEnableDirectStream); } - bool PlaybackInfoDto::enableTranscoding() const { return m_enableTranscoding; } + void PlaybackInfoDto::setEnableTranscoding(bool newEnableTranscoding) { m_enableTranscoding = newEnableTranscoding; - emit enableTranscodingChanged(newEnableTranscoding); } - bool PlaybackInfoDto::allowVideoStreamCopy() const { return m_allowVideoStreamCopy; } + void PlaybackInfoDto::setAllowVideoStreamCopy(bool newAllowVideoStreamCopy) { m_allowVideoStreamCopy = newAllowVideoStreamCopy; - emit allowVideoStreamCopyChanged(newAllowVideoStreamCopy); } - bool PlaybackInfoDto::allowAudioStreamCopy() const { return m_allowAudioStreamCopy; } + void PlaybackInfoDto::setAllowAudioStreamCopy(bool newAllowAudioStreamCopy) { m_allowAudioStreamCopy = newAllowAudioStreamCopy; - emit allowAudioStreamCopyChanged(newAllowAudioStreamCopy); } - bool PlaybackInfoDto::autoOpenLiveStream() const { return m_autoOpenLiveStream; } + void PlaybackInfoDto::setAutoOpenLiveStream(bool newAutoOpenLiveStream) { m_autoOpenLiveStream = newAutoOpenLiveStream; - emit autoOpenLiveStreamChanged(newAutoOpenLiveStream); } diff --git a/core/src/DTO/playbackinforesponse.cpp b/core/src/DTO/playbackinforesponse.cpp index f8f4249..2253c40 100644 --- a/core/src/DTO/playbackinforesponse.cpp +++ b/core/src/DTO/playbackinforesponse.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -PlaybackInfoResponse::PlaybackInfoResponse(QObject *parent) : QObject(parent) {} +PlaybackInfoResponse::PlaybackInfoResponse(QObject *parent) {} -PlaybackInfoResponse *PlaybackInfoResponse::fromJSON(QJsonObject source, QObject *parent) { - PlaybackInfoResponse *instance = new PlaybackInfoResponse(parent); - instance->updateFromJSON(source); +PlaybackInfoResponse PlaybackInfoResponse::fromJson(QJsonObject source) {PlaybackInfoResponse instance; + instance->setFromJson(source, false); return instance; } -void PlaybackInfoResponse::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlaybackInfoResponse::setFromJson(QJsonObject source) { + m_mediaSources = fromJsonValue>>(source["MediaSources"]); + m_playSessionId = fromJsonValue(source["PlaySessionId"]); + m_errorCode = fromJsonValue(source["ErrorCode"]); + } -QJsonObject PlaybackInfoResponse::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlaybackInfoResponse::toJson() { QJsonObject result; + result["MediaSources"] = toJsonValue>>(m_mediaSources); + result["PlaySessionId"] = toJsonValue(m_playSessionId); + result["ErrorCode"] = toJsonValue(m_errorCode); + return result; } -QList PlaybackInfoResponse::mediaSources() const { return m_mediaSources; } -void PlaybackInfoResponse::setMediaSources(QList newMediaSources) { - m_mediaSources = newMediaSources; - emit mediaSourcesChanged(newMediaSources); -} +QList> PlaybackInfoResponse::mediaSources() const { return m_mediaSources; } + +void PlaybackInfoResponse::setMediaSources(QList> newMediaSources) { + m_mediaSources = newMediaSources; +} QString PlaybackInfoResponse::playSessionId() const { return m_playSessionId; } + void PlaybackInfoResponse::setPlaySessionId(QString newPlaySessionId) { m_playSessionId = newPlaySessionId; - emit playSessionIdChanged(newPlaySessionId); } - PlaybackErrorCode PlaybackInfoResponse::errorCode() const { return m_errorCode; } + void PlaybackInfoResponse::setErrorCode(PlaybackErrorCode newErrorCode) { m_errorCode = newErrorCode; - emit errorCodeChanged(newErrorCode); } diff --git a/core/src/DTO/playbackprogressinfo.cpp b/core/src/DTO/playbackprogressinfo.cpp index 8954f47..908b93c 100644 --- a/core/src/DTO/playbackprogressinfo.cpp +++ b/core/src/DTO/playbackprogressinfo.cpp @@ -29,146 +29,166 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -PlaybackProgressInfo::PlaybackProgressInfo(QObject *parent) : QObject(parent) {} +PlaybackProgressInfo::PlaybackProgressInfo(QObject *parent) {} -PlaybackProgressInfo *PlaybackProgressInfo::fromJSON(QJsonObject source, QObject *parent) { - PlaybackProgressInfo *instance = new PlaybackProgressInfo(parent); - instance->updateFromJSON(source); +PlaybackProgressInfo PlaybackProgressInfo::fromJson(QJsonObject source) {PlaybackProgressInfo instance; + instance->setFromJson(source, false); return instance; } -void PlaybackProgressInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlaybackProgressInfo::setFromJson(QJsonObject source) { + m_canSeek = fromJsonValue(source["CanSeek"]); + m_item = fromJsonValue>(source["Item"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_sessionId = fromJsonValue(source["SessionId"]); + m_mediaSourceId = fromJsonValue(source["MediaSourceId"]); + m_audioStreamIndex = fromJsonValue(source["AudioStreamIndex"]); + m_subtitleStreamIndex = fromJsonValue(source["SubtitleStreamIndex"]); + m_isPaused = fromJsonValue(source["IsPaused"]); + m_isMuted = fromJsonValue(source["IsMuted"]); + m_positionTicks = fromJsonValue(source["PositionTicks"]); + m_playbackStartTimeTicks = fromJsonValue(source["PlaybackStartTimeTicks"]); + m_volumeLevel = fromJsonValue(source["VolumeLevel"]); + m_brightness = fromJsonValue(source["Brightness"]); + m_aspectRatio = fromJsonValue(source["AspectRatio"]); + m_playMethod = fromJsonValue(source["PlayMethod"]); + m_liveStreamId = fromJsonValue(source["LiveStreamId"]); + m_playSessionId = fromJsonValue(source["PlaySessionId"]); + m_repeatMode = fromJsonValue(source["RepeatMode"]); + m_nowPlayingQueue = fromJsonValue>>(source["NowPlayingQueue"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject PlaybackProgressInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlaybackProgressInfo::toJson() { QJsonObject result; + result["CanSeek"] = toJsonValue(m_canSeek); + result["Item"] = toJsonValue>(m_item); + result["ItemId"] = toJsonValue(m_itemId); + result["SessionId"] = toJsonValue(m_sessionId); + result["MediaSourceId"] = toJsonValue(m_mediaSourceId); + result["AudioStreamIndex"] = toJsonValue(m_audioStreamIndex); + result["SubtitleStreamIndex"] = toJsonValue(m_subtitleStreamIndex); + result["IsPaused"] = toJsonValue(m_isPaused); + result["IsMuted"] = toJsonValue(m_isMuted); + result["PositionTicks"] = toJsonValue(m_positionTicks); + result["PlaybackStartTimeTicks"] = toJsonValue(m_playbackStartTimeTicks); + result["VolumeLevel"] = toJsonValue(m_volumeLevel); + result["Brightness"] = toJsonValue(m_brightness); + result["AspectRatio"] = toJsonValue(m_aspectRatio); + result["PlayMethod"] = toJsonValue(m_playMethod); + result["LiveStreamId"] = toJsonValue(m_liveStreamId); + result["PlaySessionId"] = toJsonValue(m_playSessionId); + result["RepeatMode"] = toJsonValue(m_repeatMode); + result["NowPlayingQueue"] = toJsonValue>>(m_nowPlayingQueue); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } + bool PlaybackProgressInfo::canSeek() const { return m_canSeek; } + void PlaybackProgressInfo::setCanSeek(bool newCanSeek) { m_canSeek = newCanSeek; - emit canSeekChanged(newCanSeek); } +QSharedPointer PlaybackProgressInfo::item() const { return m_item; } -BaseItemDto * PlaybackProgressInfo::item() const { return m_item; } -void PlaybackProgressInfo::setItem(BaseItemDto * newItem) { +void PlaybackProgressInfo::setItem(QSharedPointer newItem) { m_item = newItem; - emit itemChanged(newItem); } +QUuid PlaybackProgressInfo::itemId() const { return m_itemId; } -QString PlaybackProgressInfo::itemId() const { return m_itemId; } -void PlaybackProgressInfo::setItemId(QString newItemId) { +void PlaybackProgressInfo::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString PlaybackProgressInfo::sessionId() const { return m_sessionId; } + void PlaybackProgressInfo::setSessionId(QString newSessionId) { m_sessionId = newSessionId; - emit sessionIdChanged(newSessionId); } - QString PlaybackProgressInfo::mediaSourceId() const { return m_mediaSourceId; } + void PlaybackProgressInfo::setMediaSourceId(QString newMediaSourceId) { m_mediaSourceId = newMediaSourceId; - emit mediaSourceIdChanged(newMediaSourceId); } - qint32 PlaybackProgressInfo::audioStreamIndex() const { return m_audioStreamIndex; } + void PlaybackProgressInfo::setAudioStreamIndex(qint32 newAudioStreamIndex) { m_audioStreamIndex = newAudioStreamIndex; - emit audioStreamIndexChanged(newAudioStreamIndex); } - qint32 PlaybackProgressInfo::subtitleStreamIndex() const { return m_subtitleStreamIndex; } + void PlaybackProgressInfo::setSubtitleStreamIndex(qint32 newSubtitleStreamIndex) { m_subtitleStreamIndex = newSubtitleStreamIndex; - emit subtitleStreamIndexChanged(newSubtitleStreamIndex); } - bool PlaybackProgressInfo::isPaused() const { return m_isPaused; } + void PlaybackProgressInfo::setIsPaused(bool newIsPaused) { m_isPaused = newIsPaused; - emit isPausedChanged(newIsPaused); } - bool PlaybackProgressInfo::isMuted() const { return m_isMuted; } + void PlaybackProgressInfo::setIsMuted(bool newIsMuted) { m_isMuted = newIsMuted; - emit isMutedChanged(newIsMuted); } - qint64 PlaybackProgressInfo::positionTicks() const { return m_positionTicks; } + void PlaybackProgressInfo::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } - qint64 PlaybackProgressInfo::playbackStartTimeTicks() const { return m_playbackStartTimeTicks; } + void PlaybackProgressInfo::setPlaybackStartTimeTicks(qint64 newPlaybackStartTimeTicks) { m_playbackStartTimeTicks = newPlaybackStartTimeTicks; - emit playbackStartTimeTicksChanged(newPlaybackStartTimeTicks); } - qint32 PlaybackProgressInfo::volumeLevel() const { return m_volumeLevel; } + void PlaybackProgressInfo::setVolumeLevel(qint32 newVolumeLevel) { m_volumeLevel = newVolumeLevel; - emit volumeLevelChanged(newVolumeLevel); } - qint32 PlaybackProgressInfo::brightness() const { return m_brightness; } + void PlaybackProgressInfo::setBrightness(qint32 newBrightness) { m_brightness = newBrightness; - emit brightnessChanged(newBrightness); } - QString PlaybackProgressInfo::aspectRatio() const { return m_aspectRatio; } + void PlaybackProgressInfo::setAspectRatio(QString newAspectRatio) { m_aspectRatio = newAspectRatio; - emit aspectRatioChanged(newAspectRatio); } - PlayMethod PlaybackProgressInfo::playMethod() const { return m_playMethod; } + void PlaybackProgressInfo::setPlayMethod(PlayMethod newPlayMethod) { m_playMethod = newPlayMethod; - emit playMethodChanged(newPlayMethod); } - QString PlaybackProgressInfo::liveStreamId() const { return m_liveStreamId; } + void PlaybackProgressInfo::setLiveStreamId(QString newLiveStreamId) { m_liveStreamId = newLiveStreamId; - emit liveStreamIdChanged(newLiveStreamId); } - QString PlaybackProgressInfo::playSessionId() const { return m_playSessionId; } + void PlaybackProgressInfo::setPlaySessionId(QString newPlaySessionId) { m_playSessionId = newPlaySessionId; - emit playSessionIdChanged(newPlaySessionId); } - RepeatMode PlaybackProgressInfo::repeatMode() const { return m_repeatMode; } + void PlaybackProgressInfo::setRepeatMode(RepeatMode newRepeatMode) { m_repeatMode = newRepeatMode; - emit repeatModeChanged(newRepeatMode); } +QList> PlaybackProgressInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -QList PlaybackProgressInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -void PlaybackProgressInfo::setNowPlayingQueue(QList newNowPlayingQueue) { +void PlaybackProgressInfo::setNowPlayingQueue(QList> newNowPlayingQueue) { m_nowPlayingQueue = newNowPlayingQueue; - emit nowPlayingQueueChanged(newNowPlayingQueue); } - QString PlaybackProgressInfo::playlistItemId() const { return m_playlistItemId; } + void PlaybackProgressInfo::setPlaylistItemId(QString newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/playbackstartinfo.cpp b/core/src/DTO/playbackstartinfo.cpp index 1c43af4..6784f0a 100644 --- a/core/src/DTO/playbackstartinfo.cpp +++ b/core/src/DTO/playbackstartinfo.cpp @@ -29,146 +29,166 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -PlaybackStartInfo::PlaybackStartInfo(QObject *parent) : QObject(parent) {} +PlaybackStartInfo::PlaybackStartInfo(QObject *parent) {} -PlaybackStartInfo *PlaybackStartInfo::fromJSON(QJsonObject source, QObject *parent) { - PlaybackStartInfo *instance = new PlaybackStartInfo(parent); - instance->updateFromJSON(source); +PlaybackStartInfo PlaybackStartInfo::fromJson(QJsonObject source) {PlaybackStartInfo instance; + instance->setFromJson(source, false); return instance; } -void PlaybackStartInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlaybackStartInfo::setFromJson(QJsonObject source) { + m_canSeek = fromJsonValue(source["CanSeek"]); + m_item = fromJsonValue>(source["Item"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_sessionId = fromJsonValue(source["SessionId"]); + m_mediaSourceId = fromJsonValue(source["MediaSourceId"]); + m_audioStreamIndex = fromJsonValue(source["AudioStreamIndex"]); + m_subtitleStreamIndex = fromJsonValue(source["SubtitleStreamIndex"]); + m_isPaused = fromJsonValue(source["IsPaused"]); + m_isMuted = fromJsonValue(source["IsMuted"]); + m_positionTicks = fromJsonValue(source["PositionTicks"]); + m_playbackStartTimeTicks = fromJsonValue(source["PlaybackStartTimeTicks"]); + m_volumeLevel = fromJsonValue(source["VolumeLevel"]); + m_brightness = fromJsonValue(source["Brightness"]); + m_aspectRatio = fromJsonValue(source["AspectRatio"]); + m_playMethod = fromJsonValue(source["PlayMethod"]); + m_liveStreamId = fromJsonValue(source["LiveStreamId"]); + m_playSessionId = fromJsonValue(source["PlaySessionId"]); + m_repeatMode = fromJsonValue(source["RepeatMode"]); + m_nowPlayingQueue = fromJsonValue>>(source["NowPlayingQueue"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject PlaybackStartInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlaybackStartInfo::toJson() { QJsonObject result; + result["CanSeek"] = toJsonValue(m_canSeek); + result["Item"] = toJsonValue>(m_item); + result["ItemId"] = toJsonValue(m_itemId); + result["SessionId"] = toJsonValue(m_sessionId); + result["MediaSourceId"] = toJsonValue(m_mediaSourceId); + result["AudioStreamIndex"] = toJsonValue(m_audioStreamIndex); + result["SubtitleStreamIndex"] = toJsonValue(m_subtitleStreamIndex); + result["IsPaused"] = toJsonValue(m_isPaused); + result["IsMuted"] = toJsonValue(m_isMuted); + result["PositionTicks"] = toJsonValue(m_positionTicks); + result["PlaybackStartTimeTicks"] = toJsonValue(m_playbackStartTimeTicks); + result["VolumeLevel"] = toJsonValue(m_volumeLevel); + result["Brightness"] = toJsonValue(m_brightness); + result["AspectRatio"] = toJsonValue(m_aspectRatio); + result["PlayMethod"] = toJsonValue(m_playMethod); + result["LiveStreamId"] = toJsonValue(m_liveStreamId); + result["PlaySessionId"] = toJsonValue(m_playSessionId); + result["RepeatMode"] = toJsonValue(m_repeatMode); + result["NowPlayingQueue"] = toJsonValue>>(m_nowPlayingQueue); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } + bool PlaybackStartInfo::canSeek() const { return m_canSeek; } + void PlaybackStartInfo::setCanSeek(bool newCanSeek) { m_canSeek = newCanSeek; - emit canSeekChanged(newCanSeek); } +QSharedPointer PlaybackStartInfo::item() const { return m_item; } -BaseItemDto * PlaybackStartInfo::item() const { return m_item; } -void PlaybackStartInfo::setItem(BaseItemDto * newItem) { +void PlaybackStartInfo::setItem(QSharedPointer newItem) { m_item = newItem; - emit itemChanged(newItem); } +QUuid PlaybackStartInfo::itemId() const { return m_itemId; } -QString PlaybackStartInfo::itemId() const { return m_itemId; } -void PlaybackStartInfo::setItemId(QString newItemId) { +void PlaybackStartInfo::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString PlaybackStartInfo::sessionId() const { return m_sessionId; } + void PlaybackStartInfo::setSessionId(QString newSessionId) { m_sessionId = newSessionId; - emit sessionIdChanged(newSessionId); } - QString PlaybackStartInfo::mediaSourceId() const { return m_mediaSourceId; } + void PlaybackStartInfo::setMediaSourceId(QString newMediaSourceId) { m_mediaSourceId = newMediaSourceId; - emit mediaSourceIdChanged(newMediaSourceId); } - qint32 PlaybackStartInfo::audioStreamIndex() const { return m_audioStreamIndex; } + void PlaybackStartInfo::setAudioStreamIndex(qint32 newAudioStreamIndex) { m_audioStreamIndex = newAudioStreamIndex; - emit audioStreamIndexChanged(newAudioStreamIndex); } - qint32 PlaybackStartInfo::subtitleStreamIndex() const { return m_subtitleStreamIndex; } + void PlaybackStartInfo::setSubtitleStreamIndex(qint32 newSubtitleStreamIndex) { m_subtitleStreamIndex = newSubtitleStreamIndex; - emit subtitleStreamIndexChanged(newSubtitleStreamIndex); } - bool PlaybackStartInfo::isPaused() const { return m_isPaused; } + void PlaybackStartInfo::setIsPaused(bool newIsPaused) { m_isPaused = newIsPaused; - emit isPausedChanged(newIsPaused); } - bool PlaybackStartInfo::isMuted() const { return m_isMuted; } + void PlaybackStartInfo::setIsMuted(bool newIsMuted) { m_isMuted = newIsMuted; - emit isMutedChanged(newIsMuted); } - qint64 PlaybackStartInfo::positionTicks() const { return m_positionTicks; } + void PlaybackStartInfo::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } - qint64 PlaybackStartInfo::playbackStartTimeTicks() const { return m_playbackStartTimeTicks; } + void PlaybackStartInfo::setPlaybackStartTimeTicks(qint64 newPlaybackStartTimeTicks) { m_playbackStartTimeTicks = newPlaybackStartTimeTicks; - emit playbackStartTimeTicksChanged(newPlaybackStartTimeTicks); } - qint32 PlaybackStartInfo::volumeLevel() const { return m_volumeLevel; } + void PlaybackStartInfo::setVolumeLevel(qint32 newVolumeLevel) { m_volumeLevel = newVolumeLevel; - emit volumeLevelChanged(newVolumeLevel); } - qint32 PlaybackStartInfo::brightness() const { return m_brightness; } + void PlaybackStartInfo::setBrightness(qint32 newBrightness) { m_brightness = newBrightness; - emit brightnessChanged(newBrightness); } - QString PlaybackStartInfo::aspectRatio() const { return m_aspectRatio; } + void PlaybackStartInfo::setAspectRatio(QString newAspectRatio) { m_aspectRatio = newAspectRatio; - emit aspectRatioChanged(newAspectRatio); } - PlayMethod PlaybackStartInfo::playMethod() const { return m_playMethod; } + void PlaybackStartInfo::setPlayMethod(PlayMethod newPlayMethod) { m_playMethod = newPlayMethod; - emit playMethodChanged(newPlayMethod); } - QString PlaybackStartInfo::liveStreamId() const { return m_liveStreamId; } + void PlaybackStartInfo::setLiveStreamId(QString newLiveStreamId) { m_liveStreamId = newLiveStreamId; - emit liveStreamIdChanged(newLiveStreamId); } - QString PlaybackStartInfo::playSessionId() const { return m_playSessionId; } + void PlaybackStartInfo::setPlaySessionId(QString newPlaySessionId) { m_playSessionId = newPlaySessionId; - emit playSessionIdChanged(newPlaySessionId); } - RepeatMode PlaybackStartInfo::repeatMode() const { return m_repeatMode; } + void PlaybackStartInfo::setRepeatMode(RepeatMode newRepeatMode) { m_repeatMode = newRepeatMode; - emit repeatModeChanged(newRepeatMode); } +QList> PlaybackStartInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -QList PlaybackStartInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -void PlaybackStartInfo::setNowPlayingQueue(QList newNowPlayingQueue) { +void PlaybackStartInfo::setNowPlayingQueue(QList> newNowPlayingQueue) { m_nowPlayingQueue = newNowPlayingQueue; - emit nowPlayingQueueChanged(newNowPlayingQueue); } - QString PlaybackStartInfo::playlistItemId() const { return m_playlistItemId; } + void PlaybackStartInfo::setPlaylistItemId(QString newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/playbackstopinfo.cpp b/core/src/DTO/playbackstopinfo.cpp index 5c2f5c9..33a0adf 100644 --- a/core/src/DTO/playbackstopinfo.cpp +++ b/core/src/DTO/playbackstopinfo.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -PlaybackStopInfo::PlaybackStopInfo(QObject *parent) : QObject(parent) {} +PlaybackStopInfo::PlaybackStopInfo(QObject *parent) {} -PlaybackStopInfo *PlaybackStopInfo::fromJSON(QJsonObject source, QObject *parent) { - PlaybackStopInfo *instance = new PlaybackStopInfo(parent); - instance->updateFromJSON(source); +PlaybackStopInfo PlaybackStopInfo::fromJson(QJsonObject source) {PlaybackStopInfo instance; + instance->setFromJson(source, false); return instance; } -void PlaybackStopInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlaybackStopInfo::setFromJson(QJsonObject source) { + m_item = fromJsonValue>(source["Item"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_sessionId = fromJsonValue(source["SessionId"]); + m_mediaSourceId = fromJsonValue(source["MediaSourceId"]); + m_positionTicks = fromJsonValue(source["PositionTicks"]); + m_liveStreamId = fromJsonValue(source["LiveStreamId"]); + m_playSessionId = fromJsonValue(source["PlaySessionId"]); + m_failed = fromJsonValue(source["Failed"]); + m_nextMediaType = fromJsonValue(source["NextMediaType"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + m_nowPlayingQueue = fromJsonValue>>(source["NowPlayingQueue"]); + } -QJsonObject PlaybackStopInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlaybackStopInfo::toJson() { QJsonObject result; + result["Item"] = toJsonValue>(m_item); + result["ItemId"] = toJsonValue(m_itemId); + result["SessionId"] = toJsonValue(m_sessionId); + result["MediaSourceId"] = toJsonValue(m_mediaSourceId); + result["PositionTicks"] = toJsonValue(m_positionTicks); + result["LiveStreamId"] = toJsonValue(m_liveStreamId); + result["PlaySessionId"] = toJsonValue(m_playSessionId); + result["Failed"] = toJsonValue(m_failed); + result["NextMediaType"] = toJsonValue(m_nextMediaType); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + result["NowPlayingQueue"] = toJsonValue>>(m_nowPlayingQueue); + return result; } -BaseItemDto * PlaybackStopInfo::item() const { return m_item; } -void PlaybackStopInfo::setItem(BaseItemDto * newItem) { + +QSharedPointer PlaybackStopInfo::item() const { return m_item; } + +void PlaybackStopInfo::setItem(QSharedPointer newItem) { m_item = newItem; - emit itemChanged(newItem); } +QUuid PlaybackStopInfo::itemId() const { return m_itemId; } -QString PlaybackStopInfo::itemId() const { return m_itemId; } -void PlaybackStopInfo::setItemId(QString newItemId) { +void PlaybackStopInfo::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString PlaybackStopInfo::sessionId() const { return m_sessionId; } + void PlaybackStopInfo::setSessionId(QString newSessionId) { m_sessionId = newSessionId; - emit sessionIdChanged(newSessionId); } - QString PlaybackStopInfo::mediaSourceId() const { return m_mediaSourceId; } + void PlaybackStopInfo::setMediaSourceId(QString newMediaSourceId) { m_mediaSourceId = newMediaSourceId; - emit mediaSourceIdChanged(newMediaSourceId); } - qint64 PlaybackStopInfo::positionTicks() const { return m_positionTicks; } + void PlaybackStopInfo::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } - QString PlaybackStopInfo::liveStreamId() const { return m_liveStreamId; } + void PlaybackStopInfo::setLiveStreamId(QString newLiveStreamId) { m_liveStreamId = newLiveStreamId; - emit liveStreamIdChanged(newLiveStreamId); } - QString PlaybackStopInfo::playSessionId() const { return m_playSessionId; } + void PlaybackStopInfo::setPlaySessionId(QString newPlaySessionId) { m_playSessionId = newPlaySessionId; - emit playSessionIdChanged(newPlaySessionId); } - bool PlaybackStopInfo::failed() const { return m_failed; } + void PlaybackStopInfo::setFailed(bool newFailed) { m_failed = newFailed; - emit failedChanged(newFailed); } - QString PlaybackStopInfo::nextMediaType() const { return m_nextMediaType; } + void PlaybackStopInfo::setNextMediaType(QString newNextMediaType) { m_nextMediaType = newNextMediaType; - emit nextMediaTypeChanged(newNextMediaType); } - QString PlaybackStopInfo::playlistItemId() const { return m_playlistItemId; } + void PlaybackStopInfo::setPlaylistItemId(QString newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } +QList> PlaybackStopInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -QList PlaybackStopInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -void PlaybackStopInfo::setNowPlayingQueue(QList newNowPlayingQueue) { +void PlaybackStopInfo::setNowPlayingQueue(QList> newNowPlayingQueue) { m_nowPlayingQueue = newNowPlayingQueue; - emit nowPlayingQueueChanged(newNowPlayingQueue); } diff --git a/core/src/DTO/playerstateinfo.cpp b/core/src/DTO/playerstateinfo.cpp index 28cab92..a70863a 100644 --- a/core/src/DTO/playerstateinfo.cpp +++ b/core/src/DTO/playerstateinfo.cpp @@ -29,86 +29,96 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -PlayerStateInfo::PlayerStateInfo(QObject *parent) : QObject(parent) {} +PlayerStateInfo::PlayerStateInfo(QObject *parent) {} -PlayerStateInfo *PlayerStateInfo::fromJSON(QJsonObject source, QObject *parent) { - PlayerStateInfo *instance = new PlayerStateInfo(parent); - instance->updateFromJSON(source); +PlayerStateInfo PlayerStateInfo::fromJson(QJsonObject source) {PlayerStateInfo instance; + instance->setFromJson(source, false); return instance; } -void PlayerStateInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlayerStateInfo::setFromJson(QJsonObject source) { + m_positionTicks = fromJsonValue(source["PositionTicks"]); + m_canSeek = fromJsonValue(source["CanSeek"]); + m_isPaused = fromJsonValue(source["IsPaused"]); + m_isMuted = fromJsonValue(source["IsMuted"]); + m_volumeLevel = fromJsonValue(source["VolumeLevel"]); + m_audioStreamIndex = fromJsonValue(source["AudioStreamIndex"]); + m_subtitleStreamIndex = fromJsonValue(source["SubtitleStreamIndex"]); + m_mediaSourceId = fromJsonValue(source["MediaSourceId"]); + m_playMethod = fromJsonValue(source["PlayMethod"]); + m_repeatMode = fromJsonValue(source["RepeatMode"]); + } -QJsonObject PlayerStateInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlayerStateInfo::toJson() { QJsonObject result; + result["PositionTicks"] = toJsonValue(m_positionTicks); + result["CanSeek"] = toJsonValue(m_canSeek); + result["IsPaused"] = toJsonValue(m_isPaused); + result["IsMuted"] = toJsonValue(m_isMuted); + result["VolumeLevel"] = toJsonValue(m_volumeLevel); + result["AudioStreamIndex"] = toJsonValue(m_audioStreamIndex); + result["SubtitleStreamIndex"] = toJsonValue(m_subtitleStreamIndex); + result["MediaSourceId"] = toJsonValue(m_mediaSourceId); + result["PlayMethod"] = toJsonValue(m_playMethod); + result["RepeatMode"] = toJsonValue(m_repeatMode); + return result; } + qint64 PlayerStateInfo::positionTicks() const { return m_positionTicks; } + void PlayerStateInfo::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } - bool PlayerStateInfo::canSeek() const { return m_canSeek; } + void PlayerStateInfo::setCanSeek(bool newCanSeek) { m_canSeek = newCanSeek; - emit canSeekChanged(newCanSeek); } - bool PlayerStateInfo::isPaused() const { return m_isPaused; } + void PlayerStateInfo::setIsPaused(bool newIsPaused) { m_isPaused = newIsPaused; - emit isPausedChanged(newIsPaused); } - bool PlayerStateInfo::isMuted() const { return m_isMuted; } + void PlayerStateInfo::setIsMuted(bool newIsMuted) { m_isMuted = newIsMuted; - emit isMutedChanged(newIsMuted); } - qint32 PlayerStateInfo::volumeLevel() const { return m_volumeLevel; } + void PlayerStateInfo::setVolumeLevel(qint32 newVolumeLevel) { m_volumeLevel = newVolumeLevel; - emit volumeLevelChanged(newVolumeLevel); } - qint32 PlayerStateInfo::audioStreamIndex() const { return m_audioStreamIndex; } + void PlayerStateInfo::setAudioStreamIndex(qint32 newAudioStreamIndex) { m_audioStreamIndex = newAudioStreamIndex; - emit audioStreamIndexChanged(newAudioStreamIndex); } - qint32 PlayerStateInfo::subtitleStreamIndex() const { return m_subtitleStreamIndex; } + void PlayerStateInfo::setSubtitleStreamIndex(qint32 newSubtitleStreamIndex) { m_subtitleStreamIndex = newSubtitleStreamIndex; - emit subtitleStreamIndexChanged(newSubtitleStreamIndex); } - QString PlayerStateInfo::mediaSourceId() const { return m_mediaSourceId; } + void PlayerStateInfo::setMediaSourceId(QString newMediaSourceId) { m_mediaSourceId = newMediaSourceId; - emit mediaSourceIdChanged(newMediaSourceId); } - PlayMethod PlayerStateInfo::playMethod() const { return m_playMethod; } + void PlayerStateInfo::setPlayMethod(PlayMethod newPlayMethod) { m_playMethod = newPlayMethod; - emit playMethodChanged(newPlayMethod); } - RepeatMode PlayerStateInfo::repeatMode() const { return m_repeatMode; } + void PlayerStateInfo::setRepeatMode(RepeatMode newRepeatMode) { m_repeatMode = newRepeatMode; - emit repeatModeChanged(newRepeatMode); } diff --git a/core/src/DTO/playlistcreationresult.cpp b/core/src/DTO/playlistcreationresult.cpp index d803300..a715040 100644 --- a/core/src/DTO/playlistcreationresult.cpp +++ b/core/src/DTO/playlistcreationresult.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -PlaylistCreationResult::PlaylistCreationResult(QObject *parent) : QObject(parent) {} +PlaylistCreationResult::PlaylistCreationResult(QObject *parent) {} -PlaylistCreationResult *PlaylistCreationResult::fromJSON(QJsonObject source, QObject *parent) { - PlaylistCreationResult *instance = new PlaylistCreationResult(parent); - instance->updateFromJSON(source); +PlaylistCreationResult PlaylistCreationResult::fromJson(QJsonObject source) {PlaylistCreationResult instance; + instance->setFromJson(source, false); return instance; } -void PlaylistCreationResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlaylistCreationResult::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + } -QJsonObject PlaylistCreationResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlaylistCreationResult::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + return result; } + QString PlaylistCreationResult::jellyfinId() const { return m_jellyfinId; } + void PlaylistCreationResult::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } diff --git a/core/src/DTO/playrequest.cpp b/core/src/DTO/playrequest.cpp index 98fa754..788b801 100644 --- a/core/src/DTO/playrequest.cpp +++ b/core/src/DTO/playrequest.cpp @@ -29,73 +29,82 @@ #include -#include - namespace Jellyfin { namespace DTO { -PlayRequest::PlayRequest(QObject *parent) : QObject(parent) {} +PlayRequest::PlayRequest(QObject *parent) {} -PlayRequest *PlayRequest::fromJSON(QJsonObject source, QObject *parent) { - PlayRequest *instance = new PlayRequest(parent); - instance->updateFromJSON(source); +PlayRequest PlayRequest::fromJson(QJsonObject source) {PlayRequest instance; + instance->setFromJson(source, false); return instance; } -void PlayRequest::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlayRequest::setFromJson(QJsonObject source) { + m_itemIds = fromJsonValue>(source["ItemIds"]); + m_startPositionTicks = fromJsonValue(source["StartPositionTicks"]); + m_playCommand = fromJsonValue(source["PlayCommand"]); + m_controllingUserId = fromJsonValue(source["ControllingUserId"]); + m_subtitleStreamIndex = fromJsonValue(source["SubtitleStreamIndex"]); + m_audioStreamIndex = fromJsonValue(source["AudioStreamIndex"]); + m_mediaSourceId = fromJsonValue(source["MediaSourceId"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + } -QJsonObject PlayRequest::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlayRequest::toJson() { QJsonObject result; + result["ItemIds"] = toJsonValue>(m_itemIds); + result["StartPositionTicks"] = toJsonValue(m_startPositionTicks); + result["PlayCommand"] = toJsonValue(m_playCommand); + result["ControllingUserId"] = toJsonValue(m_controllingUserId); + result["SubtitleStreamIndex"] = toJsonValue(m_subtitleStreamIndex); + result["AudioStreamIndex"] = toJsonValue(m_audioStreamIndex); + result["MediaSourceId"] = toJsonValue(m_mediaSourceId); + result["StartIndex"] = toJsonValue(m_startIndex); + return result; } -QStringList PlayRequest::itemIds() const { return m_itemIds; } -void PlayRequest::setItemIds(QStringList newItemIds) { - m_itemIds = newItemIds; - emit itemIdsChanged(newItemIds); -} +QList PlayRequest::itemIds() const { return m_itemIds; } + +void PlayRequest::setItemIds(QList newItemIds) { + m_itemIds = newItemIds; +} qint64 PlayRequest::startPositionTicks() const { return m_startPositionTicks; } + void PlayRequest::setStartPositionTicks(qint64 newStartPositionTicks) { m_startPositionTicks = newStartPositionTicks; - emit startPositionTicksChanged(newStartPositionTicks); } - PlayCommand PlayRequest::playCommand() const { return m_playCommand; } + void PlayRequest::setPlayCommand(PlayCommand newPlayCommand) { m_playCommand = newPlayCommand; - emit playCommandChanged(newPlayCommand); } +QUuid PlayRequest::controllingUserId() const { return m_controllingUserId; } -QString PlayRequest::controllingUserId() const { return m_controllingUserId; } -void PlayRequest::setControllingUserId(QString newControllingUserId) { +void PlayRequest::setControllingUserId(QUuid newControllingUserId) { m_controllingUserId = newControllingUserId; - emit controllingUserIdChanged(newControllingUserId); } - qint32 PlayRequest::subtitleStreamIndex() const { return m_subtitleStreamIndex; } + void PlayRequest::setSubtitleStreamIndex(qint32 newSubtitleStreamIndex) { m_subtitleStreamIndex = newSubtitleStreamIndex; - emit subtitleStreamIndexChanged(newSubtitleStreamIndex); } - qint32 PlayRequest::audioStreamIndex() const { return m_audioStreamIndex; } + void PlayRequest::setAudioStreamIndex(qint32 newAudioStreamIndex) { m_audioStreamIndex = newAudioStreamIndex; - emit audioStreamIndexChanged(newAudioStreamIndex); } - QString PlayRequest::mediaSourceId() const { return m_mediaSourceId; } + void PlayRequest::setMediaSourceId(QString newMediaSourceId) { m_mediaSourceId = newMediaSourceId; - emit mediaSourceIdChanged(newMediaSourceId); } - qint32 PlayRequest::startIndex() const { return m_startIndex; } + void PlayRequest::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } diff --git a/core/src/DTO/playrequestdto.cpp b/core/src/DTO/playrequestdto.cpp index 61f911a..153f161 100644 --- a/core/src/DTO/playrequestdto.cpp +++ b/core/src/DTO/playrequestdto.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -PlayRequestDto::PlayRequestDto(QObject *parent) : QObject(parent) {} +PlayRequestDto::PlayRequestDto(QObject *parent) {} -PlayRequestDto *PlayRequestDto::fromJSON(QJsonObject source, QObject *parent) { - PlayRequestDto *instance = new PlayRequestDto(parent); - instance->updateFromJSON(source); +PlayRequestDto PlayRequestDto::fromJson(QJsonObject source) {PlayRequestDto instance; + instance->setFromJson(source, false); return instance; } -void PlayRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlayRequestDto::setFromJson(QJsonObject source) { + m_playingQueue = fromJsonValue>(source["PlayingQueue"]); + m_playingItemPosition = fromJsonValue(source["PlayingItemPosition"]); + m_startPositionTicks = fromJsonValue(source["StartPositionTicks"]); + } -QJsonObject PlayRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlayRequestDto::toJson() { QJsonObject result; + result["PlayingQueue"] = toJsonValue>(m_playingQueue); + result["PlayingItemPosition"] = toJsonValue(m_playingItemPosition); + result["StartPositionTicks"] = toJsonValue(m_startPositionTicks); + return result; } -QStringList PlayRequestDto::playingQueue() const { return m_playingQueue; } -void PlayRequestDto::setPlayingQueue(QStringList newPlayingQueue) { - m_playingQueue = newPlayingQueue; - emit playingQueueChanged(newPlayingQueue); -} +QList PlayRequestDto::playingQueue() const { return m_playingQueue; } + +void PlayRequestDto::setPlayingQueue(QList newPlayingQueue) { + m_playingQueue = newPlayingQueue; +} qint32 PlayRequestDto::playingItemPosition() const { return m_playingItemPosition; } + void PlayRequestDto::setPlayingItemPosition(qint32 newPlayingItemPosition) { m_playingItemPosition = newPlayingItemPosition; - emit playingItemPositionChanged(newPlayingItemPosition); } - qint64 PlayRequestDto::startPositionTicks() const { return m_startPositionTicks; } + void PlayRequestDto::setStartPositionTicks(qint64 newStartPositionTicks) { m_startPositionTicks = newStartPositionTicks; - emit startPositionTicksChanged(newStartPositionTicks); } diff --git a/core/src/DTO/playstaterequest.cpp b/core/src/DTO/playstaterequest.cpp index c339bb5..92c5af7 100644 --- a/core/src/DTO/playstaterequest.cpp +++ b/core/src/DTO/playstaterequest.cpp @@ -29,43 +29,47 @@ #include -#include - namespace Jellyfin { namespace DTO { -PlaystateRequest::PlaystateRequest(QObject *parent) : QObject(parent) {} +PlaystateRequest::PlaystateRequest(QObject *parent) {} -PlaystateRequest *PlaystateRequest::fromJSON(QJsonObject source, QObject *parent) { - PlaystateRequest *instance = new PlaystateRequest(parent); - instance->updateFromJSON(source); +PlaystateRequest PlaystateRequest::fromJson(QJsonObject source) {PlaystateRequest instance; + instance->setFromJson(source, false); return instance; } -void PlaystateRequest::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PlaystateRequest::setFromJson(QJsonObject source) { + m_command = fromJsonValue(source["Command"]); + m_seekPositionTicks = fromJsonValue(source["SeekPositionTicks"]); + m_controllingUserId = fromJsonValue(source["ControllingUserId"]); + } -QJsonObject PlaystateRequest::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PlaystateRequest::toJson() { QJsonObject result; + result["Command"] = toJsonValue(m_command); + result["SeekPositionTicks"] = toJsonValue(m_seekPositionTicks); + result["ControllingUserId"] = toJsonValue(m_controllingUserId); + return result; } + PlaystateCommand PlaystateRequest::command() const { return m_command; } + void PlaystateRequest::setCommand(PlaystateCommand newCommand) { m_command = newCommand; - emit commandChanged(newCommand); } - qint64 PlaystateRequest::seekPositionTicks() const { return m_seekPositionTicks; } + void PlaystateRequest::setSeekPositionTicks(qint64 newSeekPositionTicks) { m_seekPositionTicks = newSeekPositionTicks; - emit seekPositionTicksChanged(newSeekPositionTicks); } - QString PlaystateRequest::controllingUserId() const { return m_controllingUserId; } + void PlaystateRequest::setControllingUserId(QString newControllingUserId) { m_controllingUserId = newControllingUserId; - emit controllingUserIdChanged(newControllingUserId); } diff --git a/core/src/DTO/plugininfo.cpp b/core/src/DTO/plugininfo.cpp index f2fc039..ec9fa03 100644 --- a/core/src/DTO/plugininfo.cpp +++ b/core/src/DTO/plugininfo.cpp @@ -29,73 +29,82 @@ #include -#include - namespace Jellyfin { namespace DTO { -PluginInfo::PluginInfo(QObject *parent) : QObject(parent) {} +PluginInfo::PluginInfo(QObject *parent) {} -PluginInfo *PluginInfo::fromJSON(QJsonObject source, QObject *parent) { - PluginInfo *instance = new PluginInfo(parent); - instance->updateFromJSON(source); +PluginInfo PluginInfo::fromJson(QJsonObject source) {PluginInfo instance; + instance->setFromJson(source, false); return instance; } -void PluginInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PluginInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_version = fromJsonValue>(source["Version"]); + m_configurationFileName = fromJsonValue(source["ConfigurationFileName"]); + m_description = fromJsonValue(source["Description"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_canUninstall = fromJsonValue(source["CanUninstall"]); + m_hasImage = fromJsonValue(source["HasImage"]); + m_status = fromJsonValue(source["Status"]); + } -QJsonObject PluginInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PluginInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Version"] = toJsonValue>(m_version); + result["ConfigurationFileName"] = toJsonValue(m_configurationFileName); + result["Description"] = toJsonValue(m_description); + result["Id"] = toJsonValue(m_jellyfinId); + result["CanUninstall"] = toJsonValue(m_canUninstall); + result["HasImage"] = toJsonValue(m_hasImage); + result["Status"] = toJsonValue(m_status); + return result; } + QString PluginInfo::name() const { return m_name; } + void PluginInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } +QSharedPointer PluginInfo::version() const { return m_version; } -Version * PluginInfo::version() const { return m_version; } -void PluginInfo::setVersion(Version * newVersion) { +void PluginInfo::setVersion(QSharedPointer newVersion) { m_version = newVersion; - emit versionChanged(newVersion); } - QString PluginInfo::configurationFileName() const { return m_configurationFileName; } + void PluginInfo::setConfigurationFileName(QString newConfigurationFileName) { m_configurationFileName = newConfigurationFileName; - emit configurationFileNameChanged(newConfigurationFileName); } - QString PluginInfo::description() const { return m_description; } + void PluginInfo::setDescription(QString newDescription) { m_description = newDescription; - emit descriptionChanged(newDescription); } +QUuid PluginInfo::jellyfinId() const { return m_jellyfinId; } -QString PluginInfo::jellyfinId() const { return m_jellyfinId; } -void PluginInfo::setJellyfinId(QString newJellyfinId) { +void PluginInfo::setJellyfinId(QUuid newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - bool PluginInfo::canUninstall() const { return m_canUninstall; } + void PluginInfo::setCanUninstall(bool newCanUninstall) { m_canUninstall = newCanUninstall; - emit canUninstallChanged(newCanUninstall); } - bool PluginInfo::hasImage() const { return m_hasImage; } + void PluginInfo::setHasImage(bool newHasImage) { m_hasImage = newHasImage; - emit hasImageChanged(newHasImage); } - PluginStatus PluginInfo::status() const { return m_status; } + void PluginInfo::setStatus(PluginStatus newStatus) { m_status = newStatus; - emit statusChanged(newStatus); } diff --git a/core/src/DTO/pluginsecurityinfo.cpp b/core/src/DTO/pluginsecurityinfo.cpp index ead5e73..6afed1e 100644 --- a/core/src/DTO/pluginsecurityinfo.cpp +++ b/core/src/DTO/pluginsecurityinfo.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -PluginSecurityInfo::PluginSecurityInfo(QObject *parent) : QObject(parent) {} +PluginSecurityInfo::PluginSecurityInfo(QObject *parent) {} -PluginSecurityInfo *PluginSecurityInfo::fromJSON(QJsonObject source, QObject *parent) { - PluginSecurityInfo *instance = new PluginSecurityInfo(parent); - instance->updateFromJSON(source); +PluginSecurityInfo PluginSecurityInfo::fromJson(QJsonObject source) {PluginSecurityInfo instance; + instance->setFromJson(source, false); return instance; } -void PluginSecurityInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PluginSecurityInfo::setFromJson(QJsonObject source) { + m_supporterKey = fromJsonValue(source["SupporterKey"]); + m_isMbSupporter = fromJsonValue(source["IsMbSupporter"]); + } -QJsonObject PluginSecurityInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PluginSecurityInfo::toJson() { QJsonObject result; + result["SupporterKey"] = toJsonValue(m_supporterKey); + result["IsMbSupporter"] = toJsonValue(m_isMbSupporter); + return result; } + QString PluginSecurityInfo::supporterKey() const { return m_supporterKey; } + void PluginSecurityInfo::setSupporterKey(QString newSupporterKey) { m_supporterKey = newSupporterKey; - emit supporterKeyChanged(newSupporterKey); } - bool PluginSecurityInfo::isMbSupporter() const { return m_isMbSupporter; } + void PluginSecurityInfo::setIsMbSupporter(bool newIsMbSupporter) { m_isMbSupporter = newIsMbSupporter; - emit isMbSupporterChanged(newIsMbSupporter); } diff --git a/core/src/DTO/previousitemrequestdto.cpp b/core/src/DTO/previousitemrequestdto.cpp index 1c86d28..c04eb61 100644 --- a/core/src/DTO/previousitemrequestdto.cpp +++ b/core/src/DTO/previousitemrequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -PreviousItemRequestDto::PreviousItemRequestDto(QObject *parent) : QObject(parent) {} +PreviousItemRequestDto::PreviousItemRequestDto(QObject *parent) {} -PreviousItemRequestDto *PreviousItemRequestDto::fromJSON(QJsonObject source, QObject *parent) { - PreviousItemRequestDto *instance = new PreviousItemRequestDto(parent); - instance->updateFromJSON(source); +PreviousItemRequestDto PreviousItemRequestDto::fromJson(QJsonObject source) {PreviousItemRequestDto instance; + instance->setFromJson(source, false); return instance; } -void PreviousItemRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PreviousItemRequestDto::setFromJson(QJsonObject source) { + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject PreviousItemRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PreviousItemRequestDto::toJson() { QJsonObject result; + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } -QString PreviousItemRequestDto::playlistItemId() const { return m_playlistItemId; } -void PreviousItemRequestDto::setPlaylistItemId(QString newPlaylistItemId) { + +QUuid PreviousItemRequestDto::playlistItemId() const { return m_playlistItemId; } + +void PreviousItemRequestDto::setPlaylistItemId(QUuid newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/problemdetails.cpp b/core/src/DTO/problemdetails.cpp index e8f0ce3..4011693 100644 --- a/core/src/DTO/problemdetails.cpp +++ b/core/src/DTO/problemdetails.cpp @@ -32,50 +32,58 @@ namespace Jellyfin { namespace DTO { -ProblemDetails::ProblemDetails(QObject *parent) : QObject(parent) {} +ProblemDetails::ProblemDetails(QObject *parent) {} -ProblemDetails *ProblemDetails::fromJSON(QJsonObject source, QObject *parent) { - ProblemDetails *instance = new ProblemDetails(parent); - instance->updateFromJSON(source); +ProblemDetails ProblemDetails::fromJson(QJsonObject source) {ProblemDetails instance; + instance->setFromJson(source, false); return instance; } -void ProblemDetails::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ProblemDetails::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["type"]); + m_title = fromJsonValue(source["title"]); + m_status = fromJsonValue(source["status"]); + m_detail = fromJsonValue(source["detail"]); + m_instance = fromJsonValue(source["instance"]); + } -QJsonObject ProblemDetails::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ProblemDetails::toJson() { QJsonObject result; + result["type"] = toJsonValue(m_type); + result["title"] = toJsonValue(m_title); + result["status"] = toJsonValue(m_status); + result["detail"] = toJsonValue(m_detail); + result["instance"] = toJsonValue(m_instance); + return result; } + QString ProblemDetails::type() const { return m_type; } + void ProblemDetails::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString ProblemDetails::title() const { return m_title; } + void ProblemDetails::setTitle(QString newTitle) { m_title = newTitle; - emit titleChanged(newTitle); } - qint32 ProblemDetails::status() const { return m_status; } + void ProblemDetails::setStatus(qint32 newStatus) { m_status = newStatus; - emit statusChanged(newStatus); } - QString ProblemDetails::detail() const { return m_detail; } + void ProblemDetails::setDetail(QString newDetail) { m_detail = newDetail; - emit detailChanged(newDetail); } - QString ProblemDetails::instance() const { return m_instance; } + void ProblemDetails::setInstance(QString newInstance) { m_instance = newInstance; - emit instanceChanged(newInstance); } diff --git a/core/src/DTO/profilecondition.cpp b/core/src/DTO/profilecondition.cpp index d51cb29..d245cdc 100644 --- a/core/src/DTO/profilecondition.cpp +++ b/core/src/DTO/profilecondition.cpp @@ -29,50 +29,54 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -ProfileCondition::ProfileCondition(QObject *parent) : QObject(parent) {} +ProfileCondition::ProfileCondition(QObject *parent) {} -ProfileCondition *ProfileCondition::fromJSON(QJsonObject source, QObject *parent) { - ProfileCondition *instance = new ProfileCondition(parent); - instance->updateFromJSON(source); +ProfileCondition ProfileCondition::fromJson(QJsonObject source) {ProfileCondition instance; + instance->setFromJson(source, false); return instance; } -void ProfileCondition::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ProfileCondition::setFromJson(QJsonObject source) { + m_condition = fromJsonValue(source["Condition"]); + m_property = fromJsonValue(source["Property"]); + m_value = fromJsonValue(source["Value"]); + m_isRequired = fromJsonValue(source["IsRequired"]); + } -QJsonObject ProfileCondition::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ProfileCondition::toJson() { QJsonObject result; + result["Condition"] = toJsonValue(m_condition); + result["Property"] = toJsonValue(m_property); + result["Value"] = toJsonValue(m_value); + result["IsRequired"] = toJsonValue(m_isRequired); + return result; } + ProfileConditionType ProfileCondition::condition() const { return m_condition; } + void ProfileCondition::setCondition(ProfileConditionType newCondition) { m_condition = newCondition; - emit conditionChanged(newCondition); } - ProfileConditionValue ProfileCondition::property() const { return m_property; } + void ProfileCondition::setProperty(ProfileConditionValue newProperty) { m_property = newProperty; - emit propertyChanged(newProperty); } - QString ProfileCondition::value() const { return m_value; } + void ProfileCondition::setValue(QString newValue) { m_value = newValue; - emit valueChanged(newValue); } - bool ProfileCondition::isRequired() const { return m_isRequired; } + void ProfileCondition::setIsRequired(bool newIsRequired) { m_isRequired = newIsRequired; - emit isRequiredChanged(newIsRequired); } diff --git a/core/src/DTO/publicsysteminfo.cpp b/core/src/DTO/publicsysteminfo.cpp index 2fe5a25..43f9a96 100644 --- a/core/src/DTO/publicsysteminfo.cpp +++ b/core/src/DTO/publicsysteminfo.cpp @@ -32,62 +32,72 @@ namespace Jellyfin { namespace DTO { -PublicSystemInfo::PublicSystemInfo(QObject *parent) : QObject(parent) {} +PublicSystemInfo::PublicSystemInfo(QObject *parent) {} -PublicSystemInfo *PublicSystemInfo::fromJSON(QJsonObject source, QObject *parent) { - PublicSystemInfo *instance = new PublicSystemInfo(parent); - instance->updateFromJSON(source); +PublicSystemInfo PublicSystemInfo::fromJson(QJsonObject source) {PublicSystemInfo instance; + instance->setFromJson(source, false); return instance; } -void PublicSystemInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void PublicSystemInfo::setFromJson(QJsonObject source) { + m_localAddress = fromJsonValue(source["LocalAddress"]); + m_serverName = fromJsonValue(source["ServerName"]); + m_version = fromJsonValue(source["Version"]); + m_productName = fromJsonValue(source["ProductName"]); + m_operatingSystem = fromJsonValue(source["OperatingSystem"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_startupWizardCompleted = fromJsonValue(source["StartupWizardCompleted"]); + } -QJsonObject PublicSystemInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject PublicSystemInfo::toJson() { QJsonObject result; + result["LocalAddress"] = toJsonValue(m_localAddress); + result["ServerName"] = toJsonValue(m_serverName); + result["Version"] = toJsonValue(m_version); + result["ProductName"] = toJsonValue(m_productName); + result["OperatingSystem"] = toJsonValue(m_operatingSystem); + result["Id"] = toJsonValue(m_jellyfinId); + result["StartupWizardCompleted"] = toJsonValue(m_startupWizardCompleted); + return result; } + QString PublicSystemInfo::localAddress() const { return m_localAddress; } + void PublicSystemInfo::setLocalAddress(QString newLocalAddress) { m_localAddress = newLocalAddress; - emit localAddressChanged(newLocalAddress); } - QString PublicSystemInfo::serverName() const { return m_serverName; } + void PublicSystemInfo::setServerName(QString newServerName) { m_serverName = newServerName; - emit serverNameChanged(newServerName); } - QString PublicSystemInfo::version() const { return m_version; } + void PublicSystemInfo::setVersion(QString newVersion) { m_version = newVersion; - emit versionChanged(newVersion); } - QString PublicSystemInfo::productName() const { return m_productName; } + void PublicSystemInfo::setProductName(QString newProductName) { m_productName = newProductName; - emit productNameChanged(newProductName); } - QString PublicSystemInfo::operatingSystem() const { return m_operatingSystem; } + void PublicSystemInfo::setOperatingSystem(QString newOperatingSystem) { m_operatingSystem = newOperatingSystem; - emit operatingSystemChanged(newOperatingSystem); } - QString PublicSystemInfo::jellyfinId() const { return m_jellyfinId; } + void PublicSystemInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - bool PublicSystemInfo::startupWizardCompleted() const { return m_startupWizardCompleted; } + void PublicSystemInfo::setStartupWizardCompleted(bool newStartupWizardCompleted) { m_startupWizardCompleted = newStartupWizardCompleted; - emit startupWizardCompletedChanged(newStartupWizardCompleted); } diff --git a/core/src/DTO/queryfilters.cpp b/core/src/DTO/queryfilters.cpp index bf048c1..4d8d48f 100644 --- a/core/src/DTO/queryfilters.cpp +++ b/core/src/DTO/queryfilters.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -QueryFilters::QueryFilters(QObject *parent) : QObject(parent) {} +QueryFilters::QueryFilters(QObject *parent) {} -QueryFilters *QueryFilters::fromJSON(QJsonObject source, QObject *parent) { - QueryFilters *instance = new QueryFilters(parent); - instance->updateFromJSON(source); +QueryFilters QueryFilters::fromJson(QJsonObject source) {QueryFilters instance; + instance->setFromJson(source, false); return instance; } -void QueryFilters::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void QueryFilters::setFromJson(QJsonObject source) { + m_genres = fromJsonValue>>(source["Genres"]); + m_tags = fromJsonValue(source["Tags"]); + } -QJsonObject QueryFilters::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject QueryFilters::toJson() { QJsonObject result; + result["Genres"] = toJsonValue>>(m_genres); + result["Tags"] = toJsonValue(m_tags); + return result; } -QList QueryFilters::genres() const { return m_genres; } -void QueryFilters::setGenres(QList newGenres) { - m_genres = newGenres; - emit genresChanged(newGenres); -} +QList> QueryFilters::genres() const { return m_genres; } + +void QueryFilters::setGenres(QList> newGenres) { + m_genres = newGenres; +} QStringList QueryFilters::tags() const { return m_tags; } + void QueryFilters::setTags(QStringList newTags) { m_tags = newTags; - emit tagsChanged(newTags); } diff --git a/core/src/DTO/queryfilterslegacy.cpp b/core/src/DTO/queryfilterslegacy.cpp index be96b3c..db93d6d 100644 --- a/core/src/DTO/queryfilterslegacy.cpp +++ b/core/src/DTO/queryfilterslegacy.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -QueryFiltersLegacy::QueryFiltersLegacy(QObject *parent) : QObject(parent) {} +QueryFiltersLegacy::QueryFiltersLegacy(QObject *parent) {} -QueryFiltersLegacy *QueryFiltersLegacy::fromJSON(QJsonObject source, QObject *parent) { - QueryFiltersLegacy *instance = new QueryFiltersLegacy(parent); - instance->updateFromJSON(source); +QueryFiltersLegacy QueryFiltersLegacy::fromJson(QJsonObject source) {QueryFiltersLegacy instance; + instance->setFromJson(source, false); return instance; } -void QueryFiltersLegacy::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void QueryFiltersLegacy::setFromJson(QJsonObject source) { + m_genres = fromJsonValue(source["Genres"]); + m_tags = fromJsonValue(source["Tags"]); + m_officialRatings = fromJsonValue(source["OfficialRatings"]); + m_years = fromJsonValue>(source["Years"]); + } -QJsonObject QueryFiltersLegacy::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject QueryFiltersLegacy::toJson() { QJsonObject result; + result["Genres"] = toJsonValue(m_genres); + result["Tags"] = toJsonValue(m_tags); + result["OfficialRatings"] = toJsonValue(m_officialRatings); + result["Years"] = toJsonValue>(m_years); + return result; } + QStringList QueryFiltersLegacy::genres() const { return m_genres; } + void QueryFiltersLegacy::setGenres(QStringList newGenres) { m_genres = newGenres; - emit genresChanged(newGenres); } - QStringList QueryFiltersLegacy::tags() const { return m_tags; } + void QueryFiltersLegacy::setTags(QStringList newTags) { m_tags = newTags; - emit tagsChanged(newTags); } - QStringList QueryFiltersLegacy::officialRatings() const { return m_officialRatings; } + void QueryFiltersLegacy::setOfficialRatings(QStringList newOfficialRatings) { m_officialRatings = newOfficialRatings; - emit officialRatingsChanged(newOfficialRatings); } - QList QueryFiltersLegacy::years() const { return m_years; } + void QueryFiltersLegacy::setYears(QList newYears) { m_years = newYears; - emit yearsChanged(newYears); } diff --git a/core/src/DTO/queueitem.cpp b/core/src/DTO/queueitem.cpp index 97f37ef..9392826 100644 --- a/core/src/DTO/queueitem.cpp +++ b/core/src/DTO/queueitem.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -QueueItem::QueueItem(QObject *parent) : QObject(parent) {} +QueueItem::QueueItem(QObject *parent) {} -QueueItem *QueueItem::fromJSON(QJsonObject source, QObject *parent) { - QueueItem *instance = new QueueItem(parent); - instance->updateFromJSON(source); +QueueItem QueueItem::fromJson(QJsonObject source) {QueueItem instance; + instance->setFromJson(source, false); return instance; } -void QueueItem::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void QueueItem::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject QueueItem::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject QueueItem::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } -QString QueueItem::jellyfinId() const { return m_jellyfinId; } -void QueueItem::setJellyfinId(QString newJellyfinId) { - m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); -} +QUuid QueueItem::jellyfinId() const { return m_jellyfinId; } + +void QueueItem::setJellyfinId(QUuid newJellyfinId) { + m_jellyfinId = newJellyfinId; +} QString QueueItem::playlistItemId() const { return m_playlistItemId; } + void QueueItem::setPlaylistItemId(QString newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/queuerequestdto.cpp b/core/src/DTO/queuerequestdto.cpp index d33dd24..34b4668 100644 --- a/core/src/DTO/queuerequestdto.cpp +++ b/core/src/DTO/queuerequestdto.cpp @@ -29,37 +29,40 @@ #include -#include - namespace Jellyfin { namespace DTO { -QueueRequestDto::QueueRequestDto(QObject *parent) : QObject(parent) {} +QueueRequestDto::QueueRequestDto(QObject *parent) {} -QueueRequestDto *QueueRequestDto::fromJSON(QJsonObject source, QObject *parent) { - QueueRequestDto *instance = new QueueRequestDto(parent); - instance->updateFromJSON(source); +QueueRequestDto QueueRequestDto::fromJson(QJsonObject source) {QueueRequestDto instance; + instance->setFromJson(source, false); return instance; } -void QueueRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void QueueRequestDto::setFromJson(QJsonObject source) { + m_itemIds = fromJsonValue>(source["ItemIds"]); + m_mode = fromJsonValue(source["Mode"]); + } -QJsonObject QueueRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject QueueRequestDto::toJson() { QJsonObject result; + result["ItemIds"] = toJsonValue>(m_itemIds); + result["Mode"] = toJsonValue(m_mode); + return result; } -QStringList QueueRequestDto::itemIds() const { return m_itemIds; } -void QueueRequestDto::setItemIds(QStringList newItemIds) { - m_itemIds = newItemIds; - emit itemIdsChanged(newItemIds); -} +QList QueueRequestDto::itemIds() const { return m_itemIds; } + +void QueueRequestDto::setItemIds(QList newItemIds) { + m_itemIds = newItemIds; +} GroupQueueMode QueueRequestDto::mode() const { return m_mode; } + void QueueRequestDto::setMode(GroupQueueMode newMode) { m_mode = newMode; - emit modeChanged(newMode); } diff --git a/core/src/DTO/quickconnectdto.cpp b/core/src/DTO/quickconnectdto.cpp index 4fcf75b..305259b 100644 --- a/core/src/DTO/quickconnectdto.cpp +++ b/core/src/DTO/quickconnectdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -QuickConnectDto::QuickConnectDto(QObject *parent) : QObject(parent) {} +QuickConnectDto::QuickConnectDto(QObject *parent) {} -QuickConnectDto *QuickConnectDto::fromJSON(QJsonObject source, QObject *parent) { - QuickConnectDto *instance = new QuickConnectDto(parent); - instance->updateFromJSON(source); +QuickConnectDto QuickConnectDto::fromJson(QJsonObject source) {QuickConnectDto instance; + instance->setFromJson(source, false); return instance; } -void QuickConnectDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void QuickConnectDto::setFromJson(QJsonObject source) { + m_token = fromJsonValue(source["Token"]); + } -QJsonObject QuickConnectDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject QuickConnectDto::toJson() { QJsonObject result; + result["Token"] = toJsonValue(m_token); + return result; } + QString QuickConnectDto::token() const { return m_token; } + void QuickConnectDto::setToken(QString newToken) { m_token = newToken; - emit tokenChanged(newToken); } diff --git a/core/src/DTO/quickconnectresult.cpp b/core/src/DTO/quickconnectresult.cpp index 8ec3a1f..83dc0d0 100644 --- a/core/src/DTO/quickconnectresult.cpp +++ b/core/src/DTO/quickconnectresult.cpp @@ -32,56 +32,65 @@ namespace Jellyfin { namespace DTO { -QuickConnectResult::QuickConnectResult(QObject *parent) : QObject(parent) {} +QuickConnectResult::QuickConnectResult(QObject *parent) {} -QuickConnectResult *QuickConnectResult::fromJSON(QJsonObject source, QObject *parent) { - QuickConnectResult *instance = new QuickConnectResult(parent); - instance->updateFromJSON(source); +QuickConnectResult QuickConnectResult::fromJson(QJsonObject source) {QuickConnectResult instance; + instance->setFromJson(source, false); return instance; } -void QuickConnectResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void QuickConnectResult::setFromJson(QJsonObject source) { + m_authenticated = fromJsonValue(source["Authenticated"]); + m_secret = fromJsonValue(source["Secret"]); + m_code = fromJsonValue(source["Code"]); + m_authentication = fromJsonValue(source["Authentication"]); + m_error = fromJsonValue(source["Error"]); + m_dateAdded = fromJsonValue(source["DateAdded"]); + } -QJsonObject QuickConnectResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject QuickConnectResult::toJson() { QJsonObject result; + result["Authenticated"] = toJsonValue(m_authenticated); + result["Secret"] = toJsonValue(m_secret); + result["Code"] = toJsonValue(m_code); + result["Authentication"] = toJsonValue(m_authentication); + result["Error"] = toJsonValue(m_error); + result["DateAdded"] = toJsonValue(m_dateAdded); + return result; } + bool QuickConnectResult::authenticated() const { return m_authenticated; } + void QuickConnectResult::setAuthenticated(bool newAuthenticated) { m_authenticated = newAuthenticated; - emit authenticatedChanged(newAuthenticated); } - QString QuickConnectResult::secret() const { return m_secret; } + void QuickConnectResult::setSecret(QString newSecret) { m_secret = newSecret; - emit secretChanged(newSecret); } - QString QuickConnectResult::code() const { return m_code; } + void QuickConnectResult::setCode(QString newCode) { m_code = newCode; - emit codeChanged(newCode); } - QString QuickConnectResult::authentication() const { return m_authentication; } + void QuickConnectResult::setAuthentication(QString newAuthentication) { m_authentication = newAuthentication; - emit authenticationChanged(newAuthentication); } - QString QuickConnectResult::error() const { return m_error; } + void QuickConnectResult::setError(QString newError) { m_error = newError; - emit errorChanged(newError); } - QDateTime QuickConnectResult::dateAdded() const { return m_dateAdded; } + void QuickConnectResult::setDateAdded(QDateTime newDateAdded) { m_dateAdded = newDateAdded; - emit dateAddedChanged(newDateAdded); } diff --git a/core/src/DTO/readyrequestdto.cpp b/core/src/DTO/readyrequestdto.cpp index 16137e1..3e77102 100644 --- a/core/src/DTO/readyrequestdto.cpp +++ b/core/src/DTO/readyrequestdto.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -ReadyRequestDto::ReadyRequestDto(QObject *parent) : QObject(parent) {} +ReadyRequestDto::ReadyRequestDto(QObject *parent) {} -ReadyRequestDto *ReadyRequestDto::fromJSON(QJsonObject source, QObject *parent) { - ReadyRequestDto *instance = new ReadyRequestDto(parent); - instance->updateFromJSON(source); +ReadyRequestDto ReadyRequestDto::fromJson(QJsonObject source) {ReadyRequestDto instance; + instance->setFromJson(source, false); return instance; } -void ReadyRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ReadyRequestDto::setFromJson(QJsonObject source) { + m_when = fromJsonValue(source["When"]); + m_positionTicks = fromJsonValue(source["PositionTicks"]); + m_isPlaying = fromJsonValue(source["IsPlaying"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject ReadyRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ReadyRequestDto::toJson() { QJsonObject result; + result["When"] = toJsonValue(m_when); + result["PositionTicks"] = toJsonValue(m_positionTicks); + result["IsPlaying"] = toJsonValue(m_isPlaying); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } + QDateTime ReadyRequestDto::when() const { return m_when; } + void ReadyRequestDto::setWhen(QDateTime newWhen) { m_when = newWhen; - emit whenChanged(newWhen); } - qint64 ReadyRequestDto::positionTicks() const { return m_positionTicks; } + void ReadyRequestDto::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } - bool ReadyRequestDto::isPlaying() const { return m_isPlaying; } + void ReadyRequestDto::setIsPlaying(bool newIsPlaying) { m_isPlaying = newIsPlaying; - emit isPlayingChanged(newIsPlaying); } +QUuid ReadyRequestDto::playlistItemId() const { return m_playlistItemId; } -QString ReadyRequestDto::playlistItemId() const { return m_playlistItemId; } -void ReadyRequestDto::setPlaylistItemId(QString newPlaylistItemId) { +void ReadyRequestDto::setPlaylistItemId(QUuid newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/recommendationdto.cpp b/core/src/DTO/recommendationdto.cpp index 7dd560f..a0b68c3 100644 --- a/core/src/DTO/recommendationdto.cpp +++ b/core/src/DTO/recommendationdto.cpp @@ -29,49 +29,54 @@ #include -#include - namespace Jellyfin { namespace DTO { -RecommendationDto::RecommendationDto(QObject *parent) : QObject(parent) {} +RecommendationDto::RecommendationDto(QObject *parent) {} -RecommendationDto *RecommendationDto::fromJSON(QJsonObject source, QObject *parent) { - RecommendationDto *instance = new RecommendationDto(parent); - instance->updateFromJSON(source); +RecommendationDto RecommendationDto::fromJson(QJsonObject source) {RecommendationDto instance; + instance->setFromJson(source, false); return instance; } -void RecommendationDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void RecommendationDto::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_recommendationType = fromJsonValue(source["RecommendationType"]); + m_baselineItemName = fromJsonValue(source["BaselineItemName"]); + m_categoryId = fromJsonValue(source["CategoryId"]); + } -QJsonObject RecommendationDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject RecommendationDto::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["RecommendationType"] = toJsonValue(m_recommendationType); + result["BaselineItemName"] = toJsonValue(m_baselineItemName); + result["CategoryId"] = toJsonValue(m_categoryId); + return result; } -QList RecommendationDto::items() const { return m_items; } -void RecommendationDto::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> RecommendationDto::items() const { return m_items; } + +void RecommendationDto::setItems(QList> newItems) { + m_items = newItems; +} RecommendationType RecommendationDto::recommendationType() const { return m_recommendationType; } + void RecommendationDto::setRecommendationType(RecommendationType newRecommendationType) { m_recommendationType = newRecommendationType; - emit recommendationTypeChanged(newRecommendationType); } - QString RecommendationDto::baselineItemName() const { return m_baselineItemName; } + void RecommendationDto::setBaselineItemName(QString newBaselineItemName) { m_baselineItemName = newBaselineItemName; - emit baselineItemNameChanged(newBaselineItemName); } +QUuid RecommendationDto::categoryId() const { return m_categoryId; } -QString RecommendationDto::categoryId() const { return m_categoryId; } -void RecommendationDto::setCategoryId(QString newCategoryId) { +void RecommendationDto::setCategoryId(QUuid newCategoryId) { m_categoryId = newCategoryId; - emit categoryIdChanged(newCategoryId); } diff --git a/core/src/DTO/remoteimageinfo.cpp b/core/src/DTO/remoteimageinfo.cpp index 6086bd8..519360a 100644 --- a/core/src/DTO/remoteimageinfo.cpp +++ b/core/src/DTO/remoteimageinfo.cpp @@ -29,86 +29,96 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -RemoteImageInfo::RemoteImageInfo(QObject *parent) : QObject(parent) {} +RemoteImageInfo::RemoteImageInfo(QObject *parent) {} -RemoteImageInfo *RemoteImageInfo::fromJSON(QJsonObject source, QObject *parent) { - RemoteImageInfo *instance = new RemoteImageInfo(parent); - instance->updateFromJSON(source); +RemoteImageInfo RemoteImageInfo::fromJson(QJsonObject source) {RemoteImageInfo instance; + instance->setFromJson(source, false); return instance; } -void RemoteImageInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void RemoteImageInfo::setFromJson(QJsonObject source) { + m_providerName = fromJsonValue(source["ProviderName"]); + m_url = fromJsonValue(source["Url"]); + m_thumbnailUrl = fromJsonValue(source["ThumbnailUrl"]); + m_height = fromJsonValue(source["Height"]); + m_width = fromJsonValue(source["Width"]); + m_communityRating = fromJsonValue(source["CommunityRating"]); + m_voteCount = fromJsonValue(source["VoteCount"]); + m_language = fromJsonValue(source["Language"]); + m_type = fromJsonValue(source["Type"]); + m_ratingType = fromJsonValue(source["RatingType"]); + } -QJsonObject RemoteImageInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject RemoteImageInfo::toJson() { QJsonObject result; + result["ProviderName"] = toJsonValue(m_providerName); + result["Url"] = toJsonValue(m_url); + result["ThumbnailUrl"] = toJsonValue(m_thumbnailUrl); + result["Height"] = toJsonValue(m_height); + result["Width"] = toJsonValue(m_width); + result["CommunityRating"] = toJsonValue(m_communityRating); + result["VoteCount"] = toJsonValue(m_voteCount); + result["Language"] = toJsonValue(m_language); + result["Type"] = toJsonValue(m_type); + result["RatingType"] = toJsonValue(m_ratingType); + return result; } + QString RemoteImageInfo::providerName() const { return m_providerName; } + void RemoteImageInfo::setProviderName(QString newProviderName) { m_providerName = newProviderName; - emit providerNameChanged(newProviderName); } - QString RemoteImageInfo::url() const { return m_url; } + void RemoteImageInfo::setUrl(QString newUrl) { m_url = newUrl; - emit urlChanged(newUrl); } - QString RemoteImageInfo::thumbnailUrl() const { return m_thumbnailUrl; } + void RemoteImageInfo::setThumbnailUrl(QString newThumbnailUrl) { m_thumbnailUrl = newThumbnailUrl; - emit thumbnailUrlChanged(newThumbnailUrl); } - qint32 RemoteImageInfo::height() const { return m_height; } + void RemoteImageInfo::setHeight(qint32 newHeight) { m_height = newHeight; - emit heightChanged(newHeight); } - qint32 RemoteImageInfo::width() const { return m_width; } + void RemoteImageInfo::setWidth(qint32 newWidth) { m_width = newWidth; - emit widthChanged(newWidth); } - double RemoteImageInfo::communityRating() const { return m_communityRating; } + void RemoteImageInfo::setCommunityRating(double newCommunityRating) { m_communityRating = newCommunityRating; - emit communityRatingChanged(newCommunityRating); } - qint32 RemoteImageInfo::voteCount() const { return m_voteCount; } + void RemoteImageInfo::setVoteCount(qint32 newVoteCount) { m_voteCount = newVoteCount; - emit voteCountChanged(newVoteCount); } - QString RemoteImageInfo::language() const { return m_language; } + void RemoteImageInfo::setLanguage(QString newLanguage) { m_language = newLanguage; - emit languageChanged(newLanguage); } - ImageType RemoteImageInfo::type() const { return m_type; } + void RemoteImageInfo::setType(ImageType newType) { m_type = newType; - emit typeChanged(newType); } - RatingType RemoteImageInfo::ratingType() const { return m_ratingType; } + void RemoteImageInfo::setRatingType(RatingType newRatingType) { m_ratingType = newRatingType; - emit ratingTypeChanged(newRatingType); } diff --git a/core/src/DTO/remoteimageresult.cpp b/core/src/DTO/remoteimageresult.cpp index acab310..dee7a6f 100644 --- a/core/src/DTO/remoteimageresult.cpp +++ b/core/src/DTO/remoteimageresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -RemoteImageResult::RemoteImageResult(QObject *parent) : QObject(parent) {} +RemoteImageResult::RemoteImageResult(QObject *parent) {} -RemoteImageResult *RemoteImageResult::fromJSON(QJsonObject source, QObject *parent) { - RemoteImageResult *instance = new RemoteImageResult(parent); - instance->updateFromJSON(source); +RemoteImageResult RemoteImageResult::fromJson(QJsonObject source) {RemoteImageResult instance; + instance->setFromJson(source, false); return instance; } -void RemoteImageResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void RemoteImageResult::setFromJson(QJsonObject source) { + m_images = fromJsonValue>>(source["Images"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_providers = fromJsonValue(source["Providers"]); + } -QJsonObject RemoteImageResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject RemoteImageResult::toJson() { QJsonObject result; + result["Images"] = toJsonValue>>(m_images); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["Providers"] = toJsonValue(m_providers); + return result; } -QList RemoteImageResult::images() const { return m_images; } -void RemoteImageResult::setImages(QList newImages) { - m_images = newImages; - emit imagesChanged(newImages); -} +QList> RemoteImageResult::images() const { return m_images; } + +void RemoteImageResult::setImages(QList> newImages) { + m_images = newImages; +} qint32 RemoteImageResult::totalRecordCount() const { return m_totalRecordCount; } + void RemoteImageResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - QStringList RemoteImageResult::providers() const { return m_providers; } + void RemoteImageResult::setProviders(QStringList newProviders) { m_providers = newProviders; - emit providersChanged(newProviders); } diff --git a/core/src/DTO/remotesearchresult.cpp b/core/src/DTO/remotesearchresult.cpp index 7325bbd..3f6f3a5 100644 --- a/core/src/DTO/remotesearchresult.cpp +++ b/core/src/DTO/remotesearchresult.cpp @@ -32,92 +32,107 @@ namespace Jellyfin { namespace DTO { -RemoteSearchResult::RemoteSearchResult(QObject *parent) : QObject(parent) {} +RemoteSearchResult::RemoteSearchResult(QObject *parent) {} -RemoteSearchResult *RemoteSearchResult::fromJSON(QJsonObject source, QObject *parent) { - RemoteSearchResult *instance = new RemoteSearchResult(parent); - instance->updateFromJSON(source); +RemoteSearchResult RemoteSearchResult::fromJson(QJsonObject source) {RemoteSearchResult instance; + instance->setFromJson(source, false); return instance; } -void RemoteSearchResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void RemoteSearchResult::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_productionYear = fromJsonValue(source["ProductionYear"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_indexNumberEnd = fromJsonValue(source["IndexNumberEnd"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_imageUrl = fromJsonValue(source["ImageUrl"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_overview = fromJsonValue(source["Overview"]); + m_albumArtist = fromJsonValue>(source["AlbumArtist"]); + m_artists = fromJsonValue>>(source["Artists"]); + } -QJsonObject RemoteSearchResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject RemoteSearchResult::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["ProductionYear"] = toJsonValue(m_productionYear); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["IndexNumberEnd"] = toJsonValue(m_indexNumberEnd); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["ImageUrl"] = toJsonValue(m_imageUrl); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["Overview"] = toJsonValue(m_overview); + result["AlbumArtist"] = toJsonValue>(m_albumArtist); + result["Artists"] = toJsonValue>>(m_artists); + return result; } + QString RemoteSearchResult::name() const { return m_name; } + void RemoteSearchResult::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QJsonObject RemoteSearchResult::providerIds() const { return m_providerIds; } + void RemoteSearchResult::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 RemoteSearchResult::productionYear() const { return m_productionYear; } + void RemoteSearchResult::setProductionYear(qint32 newProductionYear) { m_productionYear = newProductionYear; - emit productionYearChanged(newProductionYear); } - qint32 RemoteSearchResult::indexNumber() const { return m_indexNumber; } + void RemoteSearchResult::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 RemoteSearchResult::indexNumberEnd() const { return m_indexNumberEnd; } + void RemoteSearchResult::setIndexNumberEnd(qint32 newIndexNumberEnd) { m_indexNumberEnd = newIndexNumberEnd; - emit indexNumberEndChanged(newIndexNumberEnd); } - qint32 RemoteSearchResult::parentIndexNumber() const { return m_parentIndexNumber; } + void RemoteSearchResult::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime RemoteSearchResult::premiereDate() const { return m_premiereDate; } + void RemoteSearchResult::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - QString RemoteSearchResult::imageUrl() const { return m_imageUrl; } + void RemoteSearchResult::setImageUrl(QString newImageUrl) { m_imageUrl = newImageUrl; - emit imageUrlChanged(newImageUrl); } - QString RemoteSearchResult::searchProviderName() const { return m_searchProviderName; } + void RemoteSearchResult::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - QString RemoteSearchResult::overview() const { return m_overview; } + void RemoteSearchResult::setOverview(QString newOverview) { m_overview = newOverview; - emit overviewChanged(newOverview); } +QSharedPointer RemoteSearchResult::albumArtist() const { return m_albumArtist; } -RemoteSearchResult * RemoteSearchResult::albumArtist() const { return m_albumArtist; } -void RemoteSearchResult::setAlbumArtist(RemoteSearchResult * newAlbumArtist) { +void RemoteSearchResult::setAlbumArtist(QSharedPointer newAlbumArtist) { m_albumArtist = newAlbumArtist; - emit albumArtistChanged(newAlbumArtist); } +QList> RemoteSearchResult::artists() const { return m_artists; } -QList RemoteSearchResult::artists() const { return m_artists; } -void RemoteSearchResult::setArtists(QList newArtists) { +void RemoteSearchResult::setArtists(QList> newArtists) { m_artists = newArtists; - emit artistsChanged(newArtists); } diff --git a/core/src/DTO/remotesubtitleinfo.cpp b/core/src/DTO/remotesubtitleinfo.cpp index bd98639..3e341c4 100644 --- a/core/src/DTO/remotesubtitleinfo.cpp +++ b/core/src/DTO/remotesubtitleinfo.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -RemoteSubtitleInfo::RemoteSubtitleInfo(QObject *parent) : QObject(parent) {} +RemoteSubtitleInfo::RemoteSubtitleInfo(QObject *parent) {} -RemoteSubtitleInfo *RemoteSubtitleInfo::fromJSON(QJsonObject source, QObject *parent) { - RemoteSubtitleInfo *instance = new RemoteSubtitleInfo(parent); - instance->updateFromJSON(source); +RemoteSubtitleInfo RemoteSubtitleInfo::fromJson(QJsonObject source) {RemoteSubtitleInfo instance; + instance->setFromJson(source, false); return instance; } -void RemoteSubtitleInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void RemoteSubtitleInfo::setFromJson(QJsonObject source) { + m_threeLetterISOLanguageName = fromJsonValue(source["ThreeLetterISOLanguageName"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_providerName = fromJsonValue(source["ProviderName"]); + m_name = fromJsonValue(source["Name"]); + m_format = fromJsonValue(source["Format"]); + m_author = fromJsonValue(source["Author"]); + m_comment = fromJsonValue(source["Comment"]); + m_dateCreated = fromJsonValue(source["DateCreated"]); + m_communityRating = fromJsonValue(source["CommunityRating"]); + m_downloadCount = fromJsonValue(source["DownloadCount"]); + m_isHashMatch = fromJsonValue(source["IsHashMatch"]); + } -QJsonObject RemoteSubtitleInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject RemoteSubtitleInfo::toJson() { QJsonObject result; + result["ThreeLetterISOLanguageName"] = toJsonValue(m_threeLetterISOLanguageName); + result["Id"] = toJsonValue(m_jellyfinId); + result["ProviderName"] = toJsonValue(m_providerName); + result["Name"] = toJsonValue(m_name); + result["Format"] = toJsonValue(m_format); + result["Author"] = toJsonValue(m_author); + result["Comment"] = toJsonValue(m_comment); + result["DateCreated"] = toJsonValue(m_dateCreated); + result["CommunityRating"] = toJsonValue(m_communityRating); + result["DownloadCount"] = toJsonValue(m_downloadCount); + result["IsHashMatch"] = toJsonValue(m_isHashMatch); + return result; } + QString RemoteSubtitleInfo::threeLetterISOLanguageName() const { return m_threeLetterISOLanguageName; } + void RemoteSubtitleInfo::setThreeLetterISOLanguageName(QString newThreeLetterISOLanguageName) { m_threeLetterISOLanguageName = newThreeLetterISOLanguageName; - emit threeLetterISOLanguageNameChanged(newThreeLetterISOLanguageName); } - QString RemoteSubtitleInfo::jellyfinId() const { return m_jellyfinId; } + void RemoteSubtitleInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString RemoteSubtitleInfo::providerName() const { return m_providerName; } + void RemoteSubtitleInfo::setProviderName(QString newProviderName) { m_providerName = newProviderName; - emit providerNameChanged(newProviderName); } - QString RemoteSubtitleInfo::name() const { return m_name; } + void RemoteSubtitleInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString RemoteSubtitleInfo::format() const { return m_format; } + void RemoteSubtitleInfo::setFormat(QString newFormat) { m_format = newFormat; - emit formatChanged(newFormat); } - QString RemoteSubtitleInfo::author() const { return m_author; } + void RemoteSubtitleInfo::setAuthor(QString newAuthor) { m_author = newAuthor; - emit authorChanged(newAuthor); } - QString RemoteSubtitleInfo::comment() const { return m_comment; } + void RemoteSubtitleInfo::setComment(QString newComment) { m_comment = newComment; - emit commentChanged(newComment); } - QDateTime RemoteSubtitleInfo::dateCreated() const { return m_dateCreated; } + void RemoteSubtitleInfo::setDateCreated(QDateTime newDateCreated) { m_dateCreated = newDateCreated; - emit dateCreatedChanged(newDateCreated); } - float RemoteSubtitleInfo::communityRating() const { return m_communityRating; } + void RemoteSubtitleInfo::setCommunityRating(float newCommunityRating) { m_communityRating = newCommunityRating; - emit communityRatingChanged(newCommunityRating); } - qint32 RemoteSubtitleInfo::downloadCount() const { return m_downloadCount; } + void RemoteSubtitleInfo::setDownloadCount(qint32 newDownloadCount) { m_downloadCount = newDownloadCount; - emit downloadCountChanged(newDownloadCount); } - bool RemoteSubtitleInfo::isHashMatch() const { return m_isHashMatch; } + void RemoteSubtitleInfo::setIsHashMatch(bool newIsHashMatch) { m_isHashMatch = newIsHashMatch; - emit isHashMatchChanged(newIsHashMatch); } diff --git a/core/src/DTO/removefromplaylistrequestdto.cpp b/core/src/DTO/removefromplaylistrequestdto.cpp index 54cfc71..6719b45 100644 --- a/core/src/DTO/removefromplaylistrequestdto.cpp +++ b/core/src/DTO/removefromplaylistrequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -RemoveFromPlaylistRequestDto::RemoveFromPlaylistRequestDto(QObject *parent) : QObject(parent) {} +RemoveFromPlaylistRequestDto::RemoveFromPlaylistRequestDto(QObject *parent) {} -RemoveFromPlaylistRequestDto *RemoveFromPlaylistRequestDto::fromJSON(QJsonObject source, QObject *parent) { - RemoveFromPlaylistRequestDto *instance = new RemoveFromPlaylistRequestDto(parent); - instance->updateFromJSON(source); +RemoveFromPlaylistRequestDto RemoveFromPlaylistRequestDto::fromJson(QJsonObject source) {RemoveFromPlaylistRequestDto instance; + instance->setFromJson(source, false); return instance; } -void RemoveFromPlaylistRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void RemoveFromPlaylistRequestDto::setFromJson(QJsonObject source) { + m_playlistItemIds = fromJsonValue>(source["PlaylistItemIds"]); + } -QJsonObject RemoveFromPlaylistRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject RemoveFromPlaylistRequestDto::toJson() { QJsonObject result; + result["PlaylistItemIds"] = toJsonValue>(m_playlistItemIds); + return result; } -QStringList RemoveFromPlaylistRequestDto::playlistItemIds() const { return m_playlistItemIds; } -void RemoveFromPlaylistRequestDto::setPlaylistItemIds(QStringList newPlaylistItemIds) { + +QList RemoveFromPlaylistRequestDto::playlistItemIds() const { return m_playlistItemIds; } + +void RemoveFromPlaylistRequestDto::setPlaylistItemIds(QList newPlaylistItemIds) { m_playlistItemIds = newPlaylistItemIds; - emit playlistItemIdsChanged(newPlaylistItemIds); } diff --git a/core/src/DTO/repositoryinfo.cpp b/core/src/DTO/repositoryinfo.cpp index 8fe5d2f..01ed9ae 100644 --- a/core/src/DTO/repositoryinfo.cpp +++ b/core/src/DTO/repositoryinfo.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -RepositoryInfo::RepositoryInfo(QObject *parent) : QObject(parent) {} +RepositoryInfo::RepositoryInfo(QObject *parent) {} -RepositoryInfo *RepositoryInfo::fromJSON(QJsonObject source, QObject *parent) { - RepositoryInfo *instance = new RepositoryInfo(parent); - instance->updateFromJSON(source); +RepositoryInfo RepositoryInfo::fromJson(QJsonObject source) {RepositoryInfo instance; + instance->setFromJson(source, false); return instance; } -void RepositoryInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void RepositoryInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_url = fromJsonValue(source["Url"]); + m_enabled = fromJsonValue(source["Enabled"]); + } -QJsonObject RepositoryInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject RepositoryInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Url"] = toJsonValue(m_url); + result["Enabled"] = toJsonValue(m_enabled); + return result; } + QString RepositoryInfo::name() const { return m_name; } + void RepositoryInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString RepositoryInfo::url() const { return m_url; } + void RepositoryInfo::setUrl(QString newUrl) { m_url = newUrl; - emit urlChanged(newUrl); } - bool RepositoryInfo::enabled() const { return m_enabled; } + void RepositoryInfo::setEnabled(bool newEnabled) { m_enabled = newEnabled; - emit enabledChanged(newEnabled); } diff --git a/core/src/DTO/responseprofile.cpp b/core/src/DTO/responseprofile.cpp index a6cfe69..dd761db 100644 --- a/core/src/DTO/responseprofile.cpp +++ b/core/src/DTO/responseprofile.cpp @@ -29,67 +29,75 @@ #include -#include - namespace Jellyfin { namespace DTO { -ResponseProfile::ResponseProfile(QObject *parent) : QObject(parent) {} +ResponseProfile::ResponseProfile(QObject *parent) {} -ResponseProfile *ResponseProfile::fromJSON(QJsonObject source, QObject *parent) { - ResponseProfile *instance = new ResponseProfile(parent); - instance->updateFromJSON(source); +ResponseProfile ResponseProfile::fromJson(QJsonObject source) {ResponseProfile instance; + instance->setFromJson(source, false); return instance; } -void ResponseProfile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ResponseProfile::setFromJson(QJsonObject source) { + m_container = fromJsonValue(source["Container"]); + m_audioCodec = fromJsonValue(source["AudioCodec"]); + m_videoCodec = fromJsonValue(source["VideoCodec"]); + m_type = fromJsonValue(source["Type"]); + m_orgPn = fromJsonValue(source["OrgPn"]); + m_mimeType = fromJsonValue(source["MimeType"]); + m_conditions = fromJsonValue>>(source["Conditions"]); + } -QJsonObject ResponseProfile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ResponseProfile::toJson() { QJsonObject result; + result["Container"] = toJsonValue(m_container); + result["AudioCodec"] = toJsonValue(m_audioCodec); + result["VideoCodec"] = toJsonValue(m_videoCodec); + result["Type"] = toJsonValue(m_type); + result["OrgPn"] = toJsonValue(m_orgPn); + result["MimeType"] = toJsonValue(m_mimeType); + result["Conditions"] = toJsonValue>>(m_conditions); + return result; } + QString ResponseProfile::container() const { return m_container; } + void ResponseProfile::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } - QString ResponseProfile::audioCodec() const { return m_audioCodec; } + void ResponseProfile::setAudioCodec(QString newAudioCodec) { m_audioCodec = newAudioCodec; - emit audioCodecChanged(newAudioCodec); } - QString ResponseProfile::videoCodec() const { return m_videoCodec; } + void ResponseProfile::setVideoCodec(QString newVideoCodec) { m_videoCodec = newVideoCodec; - emit videoCodecChanged(newVideoCodec); } - DlnaProfileType ResponseProfile::type() const { return m_type; } + void ResponseProfile::setType(DlnaProfileType newType) { m_type = newType; - emit typeChanged(newType); } - QString ResponseProfile::orgPn() const { return m_orgPn; } + void ResponseProfile::setOrgPn(QString newOrgPn) { m_orgPn = newOrgPn; - emit orgPnChanged(newOrgPn); } - QString ResponseProfile::mimeType() const { return m_mimeType; } + void ResponseProfile::setMimeType(QString newMimeType) { m_mimeType = newMimeType; - emit mimeTypeChanged(newMimeType); } +QList> ResponseProfile::conditions() const { return m_conditions; } -QList ResponseProfile::conditions() const { return m_conditions; } -void ResponseProfile::setConditions(QList newConditions) { +void ResponseProfile::setConditions(QList> newConditions) { m_conditions = newConditions; - emit conditionsChanged(newConditions); } diff --git a/core/src/DTO/searchhint.cpp b/core/src/DTO/searchhint.cpp index d494678..e414c5c 100644 --- a/core/src/DTO/searchhint.cpp +++ b/core/src/DTO/searchhint.cpp @@ -32,194 +32,226 @@ namespace Jellyfin { namespace DTO { -SearchHint::SearchHint(QObject *parent) : QObject(parent) {} +SearchHint::SearchHint(QObject *parent) {} -SearchHint *SearchHint::fromJSON(QJsonObject source, QObject *parent) { - SearchHint *instance = new SearchHint(parent); - instance->updateFromJSON(source); +SearchHint SearchHint::fromJson(QJsonObject source) {SearchHint instance; + instance->setFromJson(source, false); return instance; } -void SearchHint::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SearchHint::setFromJson(QJsonObject source) { + m_itemId = fromJsonValue(source["ItemId"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_name = fromJsonValue(source["Name"]); + m_matchedTerm = fromJsonValue(source["MatchedTerm"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_productionYear = fromJsonValue(source["ProductionYear"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_primaryImageTag = fromJsonValue(source["PrimaryImageTag"]); + m_thumbImageTag = fromJsonValue(source["ThumbImageTag"]); + m_thumbImageItemId = fromJsonValue(source["ThumbImageItemId"]); + m_backdropImageTag = fromJsonValue(source["BackdropImageTag"]); + m_backdropImageItemId = fromJsonValue(source["BackdropImageItemId"]); + m_type = fromJsonValue(source["Type"]); + m_isFolder = fromJsonValue(source["IsFolder"]); + m_runTimeTicks = fromJsonValue(source["RunTimeTicks"]); + m_mediaType = fromJsonValue(source["MediaType"]); + m_startDate = fromJsonValue(source["StartDate"]); + m_endDate = fromJsonValue(source["EndDate"]); + m_series = fromJsonValue(source["Series"]); + m_status = fromJsonValue(source["Status"]); + m_album = fromJsonValue(source["Album"]); + m_albumId = fromJsonValue(source["AlbumId"]); + m_albumArtist = fromJsonValue(source["AlbumArtist"]); + m_artists = fromJsonValue(source["Artists"]); + m_songCount = fromJsonValue(source["SongCount"]); + m_episodeCount = fromJsonValue(source["EpisodeCount"]); + m_channelId = fromJsonValue(source["ChannelId"]); + m_channelName = fromJsonValue(source["ChannelName"]); + m_primaryImageAspectRatio = fromJsonValue(source["PrimaryImageAspectRatio"]); + } -QJsonObject SearchHint::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SearchHint::toJson() { QJsonObject result; + result["ItemId"] = toJsonValue(m_itemId); + result["Id"] = toJsonValue(m_jellyfinId); + result["Name"] = toJsonValue(m_name); + result["MatchedTerm"] = toJsonValue(m_matchedTerm); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ProductionYear"] = toJsonValue(m_productionYear); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PrimaryImageTag"] = toJsonValue(m_primaryImageTag); + result["ThumbImageTag"] = toJsonValue(m_thumbImageTag); + result["ThumbImageItemId"] = toJsonValue(m_thumbImageItemId); + result["BackdropImageTag"] = toJsonValue(m_backdropImageTag); + result["BackdropImageItemId"] = toJsonValue(m_backdropImageItemId); + result["Type"] = toJsonValue(m_type); + result["IsFolder"] = toJsonValue(m_isFolder); + result["RunTimeTicks"] = toJsonValue(m_runTimeTicks); + result["MediaType"] = toJsonValue(m_mediaType); + result["StartDate"] = toJsonValue(m_startDate); + result["EndDate"] = toJsonValue(m_endDate); + result["Series"] = toJsonValue(m_series); + result["Status"] = toJsonValue(m_status); + result["Album"] = toJsonValue(m_album); + result["AlbumId"] = toJsonValue(m_albumId); + result["AlbumArtist"] = toJsonValue(m_albumArtist); + result["Artists"] = toJsonValue(m_artists); + result["SongCount"] = toJsonValue(m_songCount); + result["EpisodeCount"] = toJsonValue(m_episodeCount); + result["ChannelId"] = toJsonValue(m_channelId); + result["ChannelName"] = toJsonValue(m_channelName); + result["PrimaryImageAspectRatio"] = toJsonValue(m_primaryImageAspectRatio); + return result; } -QString SearchHint::itemId() const { return m_itemId; } -void SearchHint::setItemId(QString newItemId) { + +QUuid SearchHint::itemId() const { return m_itemId; } + +void SearchHint::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } +QUuid SearchHint::jellyfinId() const { return m_jellyfinId; } -QString SearchHint::jellyfinId() const { return m_jellyfinId; } -void SearchHint::setJellyfinId(QString newJellyfinId) { +void SearchHint::setJellyfinId(QUuid newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString SearchHint::name() const { return m_name; } + void SearchHint::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString SearchHint::matchedTerm() const { return m_matchedTerm; } + void SearchHint::setMatchedTerm(QString newMatchedTerm) { m_matchedTerm = newMatchedTerm; - emit matchedTermChanged(newMatchedTerm); } - qint32 SearchHint::indexNumber() const { return m_indexNumber; } + void SearchHint::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 SearchHint::productionYear() const { return m_productionYear; } + void SearchHint::setProductionYear(qint32 newProductionYear) { m_productionYear = newProductionYear; - emit productionYearChanged(newProductionYear); } - qint32 SearchHint::parentIndexNumber() const { return m_parentIndexNumber; } + void SearchHint::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QString SearchHint::primaryImageTag() const { return m_primaryImageTag; } + void SearchHint::setPrimaryImageTag(QString newPrimaryImageTag) { m_primaryImageTag = newPrimaryImageTag; - emit primaryImageTagChanged(newPrimaryImageTag); } - QString SearchHint::thumbImageTag() const { return m_thumbImageTag; } + void SearchHint::setThumbImageTag(QString newThumbImageTag) { m_thumbImageTag = newThumbImageTag; - emit thumbImageTagChanged(newThumbImageTag); } - QString SearchHint::thumbImageItemId() const { return m_thumbImageItemId; } + void SearchHint::setThumbImageItemId(QString newThumbImageItemId) { m_thumbImageItemId = newThumbImageItemId; - emit thumbImageItemIdChanged(newThumbImageItemId); } - QString SearchHint::backdropImageTag() const { return m_backdropImageTag; } + void SearchHint::setBackdropImageTag(QString newBackdropImageTag) { m_backdropImageTag = newBackdropImageTag; - emit backdropImageTagChanged(newBackdropImageTag); } - QString SearchHint::backdropImageItemId() const { return m_backdropImageItemId; } + void SearchHint::setBackdropImageItemId(QString newBackdropImageItemId) { m_backdropImageItemId = newBackdropImageItemId; - emit backdropImageItemIdChanged(newBackdropImageItemId); } - QString SearchHint::type() const { return m_type; } + void SearchHint::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - bool SearchHint::isFolder() const { return m_isFolder; } + void SearchHint::setIsFolder(bool newIsFolder) { m_isFolder = newIsFolder; - emit isFolderChanged(newIsFolder); } - qint64 SearchHint::runTimeTicks() const { return m_runTimeTicks; } + void SearchHint::setRunTimeTicks(qint64 newRunTimeTicks) { m_runTimeTicks = newRunTimeTicks; - emit runTimeTicksChanged(newRunTimeTicks); } - QString SearchHint::mediaType() const { return m_mediaType; } + void SearchHint::setMediaType(QString newMediaType) { m_mediaType = newMediaType; - emit mediaTypeChanged(newMediaType); } - QDateTime SearchHint::startDate() const { return m_startDate; } + void SearchHint::setStartDate(QDateTime newStartDate) { m_startDate = newStartDate; - emit startDateChanged(newStartDate); } - QDateTime SearchHint::endDate() const { return m_endDate; } + void SearchHint::setEndDate(QDateTime newEndDate) { m_endDate = newEndDate; - emit endDateChanged(newEndDate); } - QString SearchHint::series() const { return m_series; } + void SearchHint::setSeries(QString newSeries) { m_series = newSeries; - emit seriesChanged(newSeries); } - QString SearchHint::status() const { return m_status; } + void SearchHint::setStatus(QString newStatus) { m_status = newStatus; - emit statusChanged(newStatus); } - QString SearchHint::album() const { return m_album; } + void SearchHint::setAlbum(QString newAlbum) { m_album = newAlbum; - emit albumChanged(newAlbum); } +QUuid SearchHint::albumId() const { return m_albumId; } -QString SearchHint::albumId() const { return m_albumId; } -void SearchHint::setAlbumId(QString newAlbumId) { +void SearchHint::setAlbumId(QUuid newAlbumId) { m_albumId = newAlbumId; - emit albumIdChanged(newAlbumId); } - QString SearchHint::albumArtist() const { return m_albumArtist; } + void SearchHint::setAlbumArtist(QString newAlbumArtist) { m_albumArtist = newAlbumArtist; - emit albumArtistChanged(newAlbumArtist); } - QStringList SearchHint::artists() const { return m_artists; } + void SearchHint::setArtists(QStringList newArtists) { m_artists = newArtists; - emit artistsChanged(newArtists); } - qint32 SearchHint::songCount() const { return m_songCount; } + void SearchHint::setSongCount(qint32 newSongCount) { m_songCount = newSongCount; - emit songCountChanged(newSongCount); } - qint32 SearchHint::episodeCount() const { return m_episodeCount; } + void SearchHint::setEpisodeCount(qint32 newEpisodeCount) { m_episodeCount = newEpisodeCount; - emit episodeCountChanged(newEpisodeCount); } +QUuid SearchHint::channelId() const { return m_channelId; } -QString SearchHint::channelId() const { return m_channelId; } -void SearchHint::setChannelId(QString newChannelId) { +void SearchHint::setChannelId(QUuid newChannelId) { m_channelId = newChannelId; - emit channelIdChanged(newChannelId); } - QString SearchHint::channelName() const { return m_channelName; } + void SearchHint::setChannelName(QString newChannelName) { m_channelName = newChannelName; - emit channelNameChanged(newChannelName); } - double SearchHint::primaryImageAspectRatio() const { return m_primaryImageAspectRatio; } + void SearchHint::setPrimaryImageAspectRatio(double newPrimaryImageAspectRatio) { m_primaryImageAspectRatio = newPrimaryImageAspectRatio; - emit primaryImageAspectRatioChanged(newPrimaryImageAspectRatio); } diff --git a/core/src/DTO/searchhintresult.cpp b/core/src/DTO/searchhintresult.cpp index 20704ae..5c0efaf 100644 --- a/core/src/DTO/searchhintresult.cpp +++ b/core/src/DTO/searchhintresult.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -SearchHintResult::SearchHintResult(QObject *parent) : QObject(parent) {} +SearchHintResult::SearchHintResult(QObject *parent) {} -SearchHintResult *SearchHintResult::fromJSON(QJsonObject source, QObject *parent) { - SearchHintResult *instance = new SearchHintResult(parent); - instance->updateFromJSON(source); +SearchHintResult SearchHintResult::fromJson(QJsonObject source) {SearchHintResult instance; + instance->setFromJson(source, false); return instance; } -void SearchHintResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SearchHintResult::setFromJson(QJsonObject source) { + m_searchHints = fromJsonValue>>(source["SearchHints"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + } -QJsonObject SearchHintResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SearchHintResult::toJson() { QJsonObject result; + result["SearchHints"] = toJsonValue>>(m_searchHints); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + return result; } -QList SearchHintResult::searchHints() const { return m_searchHints; } -void SearchHintResult::setSearchHints(QList newSearchHints) { - m_searchHints = newSearchHints; - emit searchHintsChanged(newSearchHints); -} +QList> SearchHintResult::searchHints() const { return m_searchHints; } + +void SearchHintResult::setSearchHints(QList> newSearchHints) { + m_searchHints = newSearchHints; +} qint32 SearchHintResult::totalRecordCount() const { return m_totalRecordCount; } + void SearchHintResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } diff --git a/core/src/DTO/seekrequestdto.cpp b/core/src/DTO/seekrequestdto.cpp index 9a61353..12d1fd3 100644 --- a/core/src/DTO/seekrequestdto.cpp +++ b/core/src/DTO/seekrequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -SeekRequestDto::SeekRequestDto(QObject *parent) : QObject(parent) {} +SeekRequestDto::SeekRequestDto(QObject *parent) {} -SeekRequestDto *SeekRequestDto::fromJSON(QJsonObject source, QObject *parent) { - SeekRequestDto *instance = new SeekRequestDto(parent); - instance->updateFromJSON(source); +SeekRequestDto SeekRequestDto::fromJson(QJsonObject source) {SeekRequestDto instance; + instance->setFromJson(source, false); return instance; } -void SeekRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SeekRequestDto::setFromJson(QJsonObject source) { + m_positionTicks = fromJsonValue(source["PositionTicks"]); + } -QJsonObject SeekRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SeekRequestDto::toJson() { QJsonObject result; + result["PositionTicks"] = toJsonValue(m_positionTicks); + return result; } + qint64 SeekRequestDto::positionTicks() const { return m_positionTicks; } + void SeekRequestDto::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } diff --git a/core/src/DTO/sendcommand.cpp b/core/src/DTO/sendcommand.cpp index fb7a981..591166e 100644 --- a/core/src/DTO/sendcommand.cpp +++ b/core/src/DTO/sendcommand.cpp @@ -29,61 +29,68 @@ #include -#include - namespace Jellyfin { namespace DTO { -SendCommand::SendCommand(QObject *parent) : QObject(parent) {} +SendCommand::SendCommand(QObject *parent) {} -SendCommand *SendCommand::fromJSON(QJsonObject source, QObject *parent) { - SendCommand *instance = new SendCommand(parent); - instance->updateFromJSON(source); +SendCommand SendCommand::fromJson(QJsonObject source) {SendCommand instance; + instance->setFromJson(source, false); return instance; } -void SendCommand::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SendCommand::setFromJson(QJsonObject source) { + m_groupId = fromJsonValue(source["GroupId"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + m_when = fromJsonValue(source["When"]); + m_positionTicks = fromJsonValue(source["PositionTicks"]); + m_command = fromJsonValue(source["Command"]); + m_emittedAt = fromJsonValue(source["EmittedAt"]); + } -QJsonObject SendCommand::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SendCommand::toJson() { QJsonObject result; + result["GroupId"] = toJsonValue(m_groupId); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + result["When"] = toJsonValue(m_when); + result["PositionTicks"] = toJsonValue(m_positionTicks); + result["Command"] = toJsonValue(m_command); + result["EmittedAt"] = toJsonValue(m_emittedAt); + return result; } -QString SendCommand::groupId() const { return m_groupId; } -void SendCommand::setGroupId(QString newGroupId) { + +QUuid SendCommand::groupId() const { return m_groupId; } + +void SendCommand::setGroupId(QUuid newGroupId) { m_groupId = newGroupId; - emit groupIdChanged(newGroupId); } +QUuid SendCommand::playlistItemId() const { return m_playlistItemId; } -QString SendCommand::playlistItemId() const { return m_playlistItemId; } -void SendCommand::setPlaylistItemId(QString newPlaylistItemId) { +void SendCommand::setPlaylistItemId(QUuid newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } - QDateTime SendCommand::when() const { return m_when; } + void SendCommand::setWhen(QDateTime newWhen) { m_when = newWhen; - emit whenChanged(newWhen); } - qint64 SendCommand::positionTicks() const { return m_positionTicks; } + void SendCommand::setPositionTicks(qint64 newPositionTicks) { m_positionTicks = newPositionTicks; - emit positionTicksChanged(newPositionTicks); } - SendCommandType SendCommand::command() const { return m_command; } + void SendCommand::setCommand(SendCommandType newCommand) { m_command = newCommand; - emit commandChanged(newCommand); } - QDateTime SendCommand::emittedAt() const { return m_emittedAt; } + void SendCommand::setEmittedAt(QDateTime newEmittedAt) { m_emittedAt = newEmittedAt; - emit emittedAtChanged(newEmittedAt); } diff --git a/core/src/DTO/seriesinfo.cpp b/core/src/DTO/seriesinfo.cpp index 17dbca8..5943496 100644 --- a/core/src/DTO/seriesinfo.cpp +++ b/core/src/DTO/seriesinfo.cpp @@ -32,80 +32,93 @@ namespace Jellyfin { namespace DTO { -SeriesInfo::SeriesInfo(QObject *parent) : QObject(parent) {} +SeriesInfo::SeriesInfo(QObject *parent) {} -SeriesInfo *SeriesInfo::fromJSON(QJsonObject source, QObject *parent) { - SeriesInfo *instance = new SeriesInfo(parent); - instance->updateFromJSON(source); +SeriesInfo SeriesInfo::fromJson(QJsonObject source) {SeriesInfo instance; + instance->setFromJson(source, false); return instance; } -void SeriesInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SeriesInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + } -QJsonObject SeriesInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SeriesInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + return result; } + QString SeriesInfo::name() const { return m_name; } + void SeriesInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString SeriesInfo::path() const { return m_path; } + void SeriesInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString SeriesInfo::metadataLanguage() const { return m_metadataLanguage; } + void SeriesInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString SeriesInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void SeriesInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject SeriesInfo::providerIds() const { return m_providerIds; } + void SeriesInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 SeriesInfo::year() const { return m_year; } + void SeriesInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 SeriesInfo::indexNumber() const { return m_indexNumber; } + void SeriesInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 SeriesInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void SeriesInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime SeriesInfo::premiereDate() const { return m_premiereDate; } + void SeriesInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool SeriesInfo::isAutomated() const { return m_isAutomated; } + void SeriesInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } diff --git a/core/src/DTO/seriesinforemotesearchquery.cpp b/core/src/DTO/seriesinforemotesearchquery.cpp index 8f4e74f..fe17845 100644 --- a/core/src/DTO/seriesinforemotesearchquery.cpp +++ b/core/src/DTO/seriesinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -SeriesInfoRemoteSearchQuery::SeriesInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +SeriesInfoRemoteSearchQuery::SeriesInfoRemoteSearchQuery(QObject *parent) {} -SeriesInfoRemoteSearchQuery *SeriesInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - SeriesInfoRemoteSearchQuery *instance = new SeriesInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +SeriesInfoRemoteSearchQuery SeriesInfoRemoteSearchQuery::fromJson(QJsonObject source) {SeriesInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void SeriesInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SeriesInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject SeriesInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SeriesInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -SeriesInfo * SeriesInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void SeriesInfoRemoteSearchQuery::setSearchInfo(SeriesInfo * newSearchInfo) { + +QSharedPointer SeriesInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void SeriesInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid SeriesInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString SeriesInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void SeriesInfoRemoteSearchQuery::setItemId(QString newItemId) { +void SeriesInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString SeriesInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void SeriesInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool SeriesInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void SeriesInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/seriestimerinfodto.cpp b/core/src/DTO/seriestimerinfodto.cpp index 3b259a1..acc78f0 100644 --- a/core/src/DTO/seriestimerinfodto.cpp +++ b/core/src/DTO/seriestimerinfodto.cpp @@ -29,237 +29,271 @@ #include -#include -#include -#include - namespace Jellyfin { namespace DTO { -SeriesTimerInfoDto::SeriesTimerInfoDto(QObject *parent) : QObject(parent) {} +SeriesTimerInfoDto::SeriesTimerInfoDto(QObject *parent) {} -SeriesTimerInfoDto *SeriesTimerInfoDto::fromJSON(QJsonObject source, QObject *parent) { - SeriesTimerInfoDto *instance = new SeriesTimerInfoDto(parent); - instance->updateFromJSON(source); +SeriesTimerInfoDto SeriesTimerInfoDto::fromJson(QJsonObject source) {SeriesTimerInfoDto instance; + instance->setFromJson(source, false); return instance; } -void SeriesTimerInfoDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SeriesTimerInfoDto::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_type = fromJsonValue(source["Type"]); + m_serverId = fromJsonValue(source["ServerId"]); + m_externalId = fromJsonValue(source["ExternalId"]); + m_channelId = fromJsonValue(source["ChannelId"]); + m_externalChannelId = fromJsonValue(source["ExternalChannelId"]); + m_channelName = fromJsonValue(source["ChannelName"]); + m_channelPrimaryImageTag = fromJsonValue(source["ChannelPrimaryImageTag"]); + m_programId = fromJsonValue(source["ProgramId"]); + m_externalProgramId = fromJsonValue(source["ExternalProgramId"]); + m_name = fromJsonValue(source["Name"]); + m_overview = fromJsonValue(source["Overview"]); + m_startDate = fromJsonValue(source["StartDate"]); + m_endDate = fromJsonValue(source["EndDate"]); + m_serviceName = fromJsonValue(source["ServiceName"]); + m_priority = fromJsonValue(source["Priority"]); + m_prePaddingSeconds = fromJsonValue(source["PrePaddingSeconds"]); + m_postPaddingSeconds = fromJsonValue(source["PostPaddingSeconds"]); + m_isPrePaddingRequired = fromJsonValue(source["IsPrePaddingRequired"]); + m_parentBackdropItemId = fromJsonValue(source["ParentBackdropItemId"]); + m_parentBackdropImageTags = fromJsonValue(source["ParentBackdropImageTags"]); + m_isPostPaddingRequired = fromJsonValue(source["IsPostPaddingRequired"]); + m_keepUntil = fromJsonValue(source["KeepUntil"]); + m_recordAnyTime = fromJsonValue(source["RecordAnyTime"]); + m_skipEpisodesInLibrary = fromJsonValue(source["SkipEpisodesInLibrary"]); + m_recordAnyChannel = fromJsonValue(source["RecordAnyChannel"]); + m_keepUpTo = fromJsonValue(source["KeepUpTo"]); + m_recordNewOnly = fromJsonValue(source["RecordNewOnly"]); + m_days = fromJsonValue>(source["Days"]); + m_dayPattern = fromJsonValue(source["DayPattern"]); + m_imageTags = fromJsonValue(source["ImageTags"]); + m_parentThumbItemId = fromJsonValue(source["ParentThumbItemId"]); + m_parentThumbImageTag = fromJsonValue(source["ParentThumbImageTag"]); + m_parentPrimaryImageItemId = fromJsonValue(source["ParentPrimaryImageItemId"]); + m_parentPrimaryImageTag = fromJsonValue(source["ParentPrimaryImageTag"]); + } -QJsonObject SeriesTimerInfoDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SeriesTimerInfoDto::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["Type"] = toJsonValue(m_type); + result["ServerId"] = toJsonValue(m_serverId); + result["ExternalId"] = toJsonValue(m_externalId); + result["ChannelId"] = toJsonValue(m_channelId); + result["ExternalChannelId"] = toJsonValue(m_externalChannelId); + result["ChannelName"] = toJsonValue(m_channelName); + result["ChannelPrimaryImageTag"] = toJsonValue(m_channelPrimaryImageTag); + result["ProgramId"] = toJsonValue(m_programId); + result["ExternalProgramId"] = toJsonValue(m_externalProgramId); + result["Name"] = toJsonValue(m_name); + result["Overview"] = toJsonValue(m_overview); + result["StartDate"] = toJsonValue(m_startDate); + result["EndDate"] = toJsonValue(m_endDate); + result["ServiceName"] = toJsonValue(m_serviceName); + result["Priority"] = toJsonValue(m_priority); + result["PrePaddingSeconds"] = toJsonValue(m_prePaddingSeconds); + result["PostPaddingSeconds"] = toJsonValue(m_postPaddingSeconds); + result["IsPrePaddingRequired"] = toJsonValue(m_isPrePaddingRequired); + result["ParentBackdropItemId"] = toJsonValue(m_parentBackdropItemId); + result["ParentBackdropImageTags"] = toJsonValue(m_parentBackdropImageTags); + result["IsPostPaddingRequired"] = toJsonValue(m_isPostPaddingRequired); + result["KeepUntil"] = toJsonValue(m_keepUntil); + result["RecordAnyTime"] = toJsonValue(m_recordAnyTime); + result["SkipEpisodesInLibrary"] = toJsonValue(m_skipEpisodesInLibrary); + result["RecordAnyChannel"] = toJsonValue(m_recordAnyChannel); + result["KeepUpTo"] = toJsonValue(m_keepUpTo); + result["RecordNewOnly"] = toJsonValue(m_recordNewOnly); + result["Days"] = toJsonValue>(m_days); + result["DayPattern"] = toJsonValue(m_dayPattern); + result["ImageTags"] = toJsonValue(m_imageTags); + result["ParentThumbItemId"] = toJsonValue(m_parentThumbItemId); + result["ParentThumbImageTag"] = toJsonValue(m_parentThumbImageTag); + result["ParentPrimaryImageItemId"] = toJsonValue(m_parentPrimaryImageItemId); + result["ParentPrimaryImageTag"] = toJsonValue(m_parentPrimaryImageTag); + return result; } + QString SeriesTimerInfoDto::jellyfinId() const { return m_jellyfinId; } + void SeriesTimerInfoDto::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString SeriesTimerInfoDto::type() const { return m_type; } + void SeriesTimerInfoDto::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString SeriesTimerInfoDto::serverId() const { return m_serverId; } + void SeriesTimerInfoDto::setServerId(QString newServerId) { m_serverId = newServerId; - emit serverIdChanged(newServerId); } - QString SeriesTimerInfoDto::externalId() const { return m_externalId; } + void SeriesTimerInfoDto::setExternalId(QString newExternalId) { m_externalId = newExternalId; - emit externalIdChanged(newExternalId); } +QUuid SeriesTimerInfoDto::channelId() const { return m_channelId; } -QString SeriesTimerInfoDto::channelId() const { return m_channelId; } -void SeriesTimerInfoDto::setChannelId(QString newChannelId) { +void SeriesTimerInfoDto::setChannelId(QUuid newChannelId) { m_channelId = newChannelId; - emit channelIdChanged(newChannelId); } - QString SeriesTimerInfoDto::externalChannelId() const { return m_externalChannelId; } + void SeriesTimerInfoDto::setExternalChannelId(QString newExternalChannelId) { m_externalChannelId = newExternalChannelId; - emit externalChannelIdChanged(newExternalChannelId); } - QString SeriesTimerInfoDto::channelName() const { return m_channelName; } + void SeriesTimerInfoDto::setChannelName(QString newChannelName) { m_channelName = newChannelName; - emit channelNameChanged(newChannelName); } - QString SeriesTimerInfoDto::channelPrimaryImageTag() const { return m_channelPrimaryImageTag; } + void SeriesTimerInfoDto::setChannelPrimaryImageTag(QString newChannelPrimaryImageTag) { m_channelPrimaryImageTag = newChannelPrimaryImageTag; - emit channelPrimaryImageTagChanged(newChannelPrimaryImageTag); } - QString SeriesTimerInfoDto::programId() const { return m_programId; } + void SeriesTimerInfoDto::setProgramId(QString newProgramId) { m_programId = newProgramId; - emit programIdChanged(newProgramId); } - QString SeriesTimerInfoDto::externalProgramId() const { return m_externalProgramId; } + void SeriesTimerInfoDto::setExternalProgramId(QString newExternalProgramId) { m_externalProgramId = newExternalProgramId; - emit externalProgramIdChanged(newExternalProgramId); } - QString SeriesTimerInfoDto::name() const { return m_name; } + void SeriesTimerInfoDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString SeriesTimerInfoDto::overview() const { return m_overview; } + void SeriesTimerInfoDto::setOverview(QString newOverview) { m_overview = newOverview; - emit overviewChanged(newOverview); } - QDateTime SeriesTimerInfoDto::startDate() const { return m_startDate; } + void SeriesTimerInfoDto::setStartDate(QDateTime newStartDate) { m_startDate = newStartDate; - emit startDateChanged(newStartDate); } - QDateTime SeriesTimerInfoDto::endDate() const { return m_endDate; } + void SeriesTimerInfoDto::setEndDate(QDateTime newEndDate) { m_endDate = newEndDate; - emit endDateChanged(newEndDate); } - QString SeriesTimerInfoDto::serviceName() const { return m_serviceName; } + void SeriesTimerInfoDto::setServiceName(QString newServiceName) { m_serviceName = newServiceName; - emit serviceNameChanged(newServiceName); } - qint32 SeriesTimerInfoDto::priority() const { return m_priority; } + void SeriesTimerInfoDto::setPriority(qint32 newPriority) { m_priority = newPriority; - emit priorityChanged(newPriority); } - qint32 SeriesTimerInfoDto::prePaddingSeconds() const { return m_prePaddingSeconds; } + void SeriesTimerInfoDto::setPrePaddingSeconds(qint32 newPrePaddingSeconds) { m_prePaddingSeconds = newPrePaddingSeconds; - emit prePaddingSecondsChanged(newPrePaddingSeconds); } - qint32 SeriesTimerInfoDto::postPaddingSeconds() const { return m_postPaddingSeconds; } + void SeriesTimerInfoDto::setPostPaddingSeconds(qint32 newPostPaddingSeconds) { m_postPaddingSeconds = newPostPaddingSeconds; - emit postPaddingSecondsChanged(newPostPaddingSeconds); } - bool SeriesTimerInfoDto::isPrePaddingRequired() const { return m_isPrePaddingRequired; } + void SeriesTimerInfoDto::setIsPrePaddingRequired(bool newIsPrePaddingRequired) { m_isPrePaddingRequired = newIsPrePaddingRequired; - emit isPrePaddingRequiredChanged(newIsPrePaddingRequired); } - QString SeriesTimerInfoDto::parentBackdropItemId() const { return m_parentBackdropItemId; } + void SeriesTimerInfoDto::setParentBackdropItemId(QString newParentBackdropItemId) { m_parentBackdropItemId = newParentBackdropItemId; - emit parentBackdropItemIdChanged(newParentBackdropItemId); } - QStringList SeriesTimerInfoDto::parentBackdropImageTags() const { return m_parentBackdropImageTags; } + void SeriesTimerInfoDto::setParentBackdropImageTags(QStringList newParentBackdropImageTags) { m_parentBackdropImageTags = newParentBackdropImageTags; - emit parentBackdropImageTagsChanged(newParentBackdropImageTags); } - bool SeriesTimerInfoDto::isPostPaddingRequired() const { return m_isPostPaddingRequired; } + void SeriesTimerInfoDto::setIsPostPaddingRequired(bool newIsPostPaddingRequired) { m_isPostPaddingRequired = newIsPostPaddingRequired; - emit isPostPaddingRequiredChanged(newIsPostPaddingRequired); } - KeepUntil SeriesTimerInfoDto::keepUntil() const { return m_keepUntil; } + void SeriesTimerInfoDto::setKeepUntil(KeepUntil newKeepUntil) { m_keepUntil = newKeepUntil; - emit keepUntilChanged(newKeepUntil); } - bool SeriesTimerInfoDto::recordAnyTime() const { return m_recordAnyTime; } + void SeriesTimerInfoDto::setRecordAnyTime(bool newRecordAnyTime) { m_recordAnyTime = newRecordAnyTime; - emit recordAnyTimeChanged(newRecordAnyTime); } - bool SeriesTimerInfoDto::skipEpisodesInLibrary() const { return m_skipEpisodesInLibrary; } + void SeriesTimerInfoDto::setSkipEpisodesInLibrary(bool newSkipEpisodesInLibrary) { m_skipEpisodesInLibrary = newSkipEpisodesInLibrary; - emit skipEpisodesInLibraryChanged(newSkipEpisodesInLibrary); } - bool SeriesTimerInfoDto::recordAnyChannel() const { return m_recordAnyChannel; } + void SeriesTimerInfoDto::setRecordAnyChannel(bool newRecordAnyChannel) { m_recordAnyChannel = newRecordAnyChannel; - emit recordAnyChannelChanged(newRecordAnyChannel); } - qint32 SeriesTimerInfoDto::keepUpTo() const { return m_keepUpTo; } + void SeriesTimerInfoDto::setKeepUpTo(qint32 newKeepUpTo) { m_keepUpTo = newKeepUpTo; - emit keepUpToChanged(newKeepUpTo); } - bool SeriesTimerInfoDto::recordNewOnly() const { return m_recordNewOnly; } + void SeriesTimerInfoDto::setRecordNewOnly(bool newRecordNewOnly) { m_recordNewOnly = newRecordNewOnly; - emit recordNewOnlyChanged(newRecordNewOnly); } - QList SeriesTimerInfoDto::days() const { return m_days; } + void SeriesTimerInfoDto::setDays(QList newDays) { m_days = newDays; - emit daysChanged(newDays); } - DayPattern SeriesTimerInfoDto::dayPattern() const { return m_dayPattern; } + void SeriesTimerInfoDto::setDayPattern(DayPattern newDayPattern) { m_dayPattern = newDayPattern; - emit dayPatternChanged(newDayPattern); } - QJsonObject SeriesTimerInfoDto::imageTags() const { return m_imageTags; } + void SeriesTimerInfoDto::setImageTags(QJsonObject newImageTags) { m_imageTags = newImageTags; - emit imageTagsChanged(newImageTags); } - QString SeriesTimerInfoDto::parentThumbItemId() const { return m_parentThumbItemId; } + void SeriesTimerInfoDto::setParentThumbItemId(QString newParentThumbItemId) { m_parentThumbItemId = newParentThumbItemId; - emit parentThumbItemIdChanged(newParentThumbItemId); } - QString SeriesTimerInfoDto::parentThumbImageTag() const { return m_parentThumbImageTag; } + void SeriesTimerInfoDto::setParentThumbImageTag(QString newParentThumbImageTag) { m_parentThumbImageTag = newParentThumbImageTag; - emit parentThumbImageTagChanged(newParentThumbImageTag); } - QString SeriesTimerInfoDto::parentPrimaryImageItemId() const { return m_parentPrimaryImageItemId; } + void SeriesTimerInfoDto::setParentPrimaryImageItemId(QString newParentPrimaryImageItemId) { m_parentPrimaryImageItemId = newParentPrimaryImageItemId; - emit parentPrimaryImageItemIdChanged(newParentPrimaryImageItemId); } - QString SeriesTimerInfoDto::parentPrimaryImageTag() const { return m_parentPrimaryImageTag; } + void SeriesTimerInfoDto::setParentPrimaryImageTag(QString newParentPrimaryImageTag) { m_parentPrimaryImageTag = newParentPrimaryImageTag; - emit parentPrimaryImageTagChanged(newParentPrimaryImageTag); } diff --git a/core/src/DTO/seriestimerinfodtoqueryresult.cpp b/core/src/DTO/seriestimerinfodtoqueryresult.cpp index a9d8388..a33d8b3 100644 --- a/core/src/DTO/seriestimerinfodtoqueryresult.cpp +++ b/core/src/DTO/seriestimerinfodtoqueryresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -SeriesTimerInfoDtoQueryResult::SeriesTimerInfoDtoQueryResult(QObject *parent) : QObject(parent) {} +SeriesTimerInfoDtoQueryResult::SeriesTimerInfoDtoQueryResult(QObject *parent) {} -SeriesTimerInfoDtoQueryResult *SeriesTimerInfoDtoQueryResult::fromJSON(QJsonObject source, QObject *parent) { - SeriesTimerInfoDtoQueryResult *instance = new SeriesTimerInfoDtoQueryResult(parent); - instance->updateFromJSON(source); +SeriesTimerInfoDtoQueryResult SeriesTimerInfoDtoQueryResult::fromJson(QJsonObject source) {SeriesTimerInfoDtoQueryResult instance; + instance->setFromJson(source, false); return instance; } -void SeriesTimerInfoDtoQueryResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SeriesTimerInfoDtoQueryResult::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + } -QJsonObject SeriesTimerInfoDtoQueryResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SeriesTimerInfoDtoQueryResult::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["StartIndex"] = toJsonValue(m_startIndex); + return result; } -QList SeriesTimerInfoDtoQueryResult::items() const { return m_items; } -void SeriesTimerInfoDtoQueryResult::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> SeriesTimerInfoDtoQueryResult::items() const { return m_items; } + +void SeriesTimerInfoDtoQueryResult::setItems(QList> newItems) { + m_items = newItems; +} qint32 SeriesTimerInfoDtoQueryResult::totalRecordCount() const { return m_totalRecordCount; } + void SeriesTimerInfoDtoQueryResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - qint32 SeriesTimerInfoDtoQueryResult::startIndex() const { return m_startIndex; } + void SeriesTimerInfoDtoQueryResult::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } diff --git a/core/src/DTO/serverconfiguration.cpp b/core/src/DTO/serverconfiguration.cpp index 621d0a7..8ad2477 100644 --- a/core/src/DTO/serverconfiguration.cpp +++ b/core/src/DTO/serverconfiguration.cpp @@ -29,535 +29,621 @@ #include -#include - namespace Jellyfin { namespace DTO { -ServerConfiguration::ServerConfiguration(QObject *parent) : QObject(parent) {} +ServerConfiguration::ServerConfiguration(QObject *parent) {} -ServerConfiguration *ServerConfiguration::fromJSON(QJsonObject source, QObject *parent) { - ServerConfiguration *instance = new ServerConfiguration(parent); - instance->updateFromJSON(source); +ServerConfiguration ServerConfiguration::fromJson(QJsonObject source) {ServerConfiguration instance; + instance->setFromJson(source, false); return instance; } -void ServerConfiguration::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ServerConfiguration::setFromJson(QJsonObject source) { + m_logFileRetentionDays = fromJsonValue(source["LogFileRetentionDays"]); + m_isStartupWizardCompleted = fromJsonValue(source["IsStartupWizardCompleted"]); + m_cachePath = fromJsonValue(source["CachePath"]); + m_previousVersion = fromJsonValue>(source["PreviousVersion"]); + m_previousVersionStr = fromJsonValue(source["PreviousVersionStr"]); + m_enableUPnP = fromJsonValue(source["EnableUPnP"]); + m_enableMetrics = fromJsonValue(source["EnableMetrics"]); + m_publicPort = fromJsonValue(source["PublicPort"]); + m_uPnPCreateHttpPortMap = fromJsonValue(source["UPnPCreateHttpPortMap"]); + m_uDPPortRange = fromJsonValue(source["UDPPortRange"]); + m_enableIPV6 = fromJsonValue(source["EnableIPV6"]); + m_enableIPV4 = fromJsonValue(source["EnableIPV4"]); + m_enableSSDPTracing = fromJsonValue(source["EnableSSDPTracing"]); + m_sSDPTracingFilter = fromJsonValue(source["SSDPTracingFilter"]); + m_uDPSendCount = fromJsonValue(source["UDPSendCount"]); + m_uDPSendDelay = fromJsonValue(source["UDPSendDelay"]); + m_ignoreVirtualInterfaces = fromJsonValue(source["IgnoreVirtualInterfaces"]); + m_virtualInterfaceNames = fromJsonValue(source["VirtualInterfaceNames"]); + m_gatewayMonitorPeriod = fromJsonValue(source["GatewayMonitorPeriod"]); + m_enableMultiSocketBinding = fromJsonValue(source["EnableMultiSocketBinding"]); + m_trustAllIP6Interfaces = fromJsonValue(source["TrustAllIP6Interfaces"]); + m_hDHomerunPortRange = fromJsonValue(source["HDHomerunPortRange"]); + m_publishedServerUriBySubnet = fromJsonValue(source["PublishedServerUriBySubnet"]); + m_autoDiscoveryTracing = fromJsonValue(source["AutoDiscoveryTracing"]); + m_autoDiscovery = fromJsonValue(source["AutoDiscovery"]); + m_publicHttpsPort = fromJsonValue(source["PublicHttpsPort"]); + m_httpServerPortNumber = fromJsonValue(source["HttpServerPortNumber"]); + m_httpsPortNumber = fromJsonValue(source["HttpsPortNumber"]); + m_enableHttps = fromJsonValue(source["EnableHttps"]); + m_enableNormalizedItemByNameIds = fromJsonValue(source["EnableNormalizedItemByNameIds"]); + m_certificatePath = fromJsonValue(source["CertificatePath"]); + m_certificatePassword = fromJsonValue(source["CertificatePassword"]); + m_isPortAuthorized = fromJsonValue(source["IsPortAuthorized"]); + m_quickConnectAvailable = fromJsonValue(source["QuickConnectAvailable"]); + m_enableRemoteAccess = fromJsonValue(source["EnableRemoteAccess"]); + m_enableCaseSensitiveItemIds = fromJsonValue(source["EnableCaseSensitiveItemIds"]); + m_disableLiveTvChannelUserDataName = fromJsonValue(source["DisableLiveTvChannelUserDataName"]); + m_metadataPath = fromJsonValue(source["MetadataPath"]); + m_metadataNetworkPath = fromJsonValue(source["MetadataNetworkPath"]); + m_preferredMetadataLanguage = fromJsonValue(source["PreferredMetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_sortReplaceCharacters = fromJsonValue(source["SortReplaceCharacters"]); + m_sortRemoveCharacters = fromJsonValue(source["SortRemoveCharacters"]); + m_sortRemoveWords = fromJsonValue(source["SortRemoveWords"]); + m_minResumePct = fromJsonValue(source["MinResumePct"]); + m_maxResumePct = fromJsonValue(source["MaxResumePct"]); + m_minResumeDurationSeconds = fromJsonValue(source["MinResumeDurationSeconds"]); + m_minAudiobookResume = fromJsonValue(source["MinAudiobookResume"]); + m_maxAudiobookResume = fromJsonValue(source["MaxAudiobookResume"]); + m_libraryMonitorDelay = fromJsonValue(source["LibraryMonitorDelay"]); + m_enableDashboardResponseCaching = fromJsonValue(source["EnableDashboardResponseCaching"]); + m_imageSavingConvention = fromJsonValue(source["ImageSavingConvention"]); + m_metadataOptions = fromJsonValue>>(source["MetadataOptions"]); + m_skipDeserializationForBasicTypes = fromJsonValue(source["SkipDeserializationForBasicTypes"]); + m_serverName = fromJsonValue(source["ServerName"]); + m_baseUrl = fromJsonValue(source["BaseUrl"]); + m_uICulture = fromJsonValue(source["UICulture"]); + m_saveMetadataHidden = fromJsonValue(source["SaveMetadataHidden"]); + m_contentTypes = fromJsonValue>>(source["ContentTypes"]); + m_remoteClientBitrateLimit = fromJsonValue(source["RemoteClientBitrateLimit"]); + m_enableFolderView = fromJsonValue(source["EnableFolderView"]); + m_enableGroupingIntoCollections = fromJsonValue(source["EnableGroupingIntoCollections"]); + m_displaySpecialsWithinSeasons = fromJsonValue(source["DisplaySpecialsWithinSeasons"]); + m_localNetworkSubnets = fromJsonValue(source["LocalNetworkSubnets"]); + m_localNetworkAddresses = fromJsonValue(source["LocalNetworkAddresses"]); + m_codecsUsed = fromJsonValue(source["CodecsUsed"]); + m_pluginRepositories = fromJsonValue>>(source["PluginRepositories"]); + m_enableExternalContentInSuggestions = fromJsonValue(source["EnableExternalContentInSuggestions"]); + m_requireHttps = fromJsonValue(source["RequireHttps"]); + m_enableNewOmdbSupport = fromJsonValue(source["EnableNewOmdbSupport"]); + m_remoteIPFilter = fromJsonValue(source["RemoteIPFilter"]); + m_isRemoteIPFilterBlacklist = fromJsonValue(source["IsRemoteIPFilterBlacklist"]); + m_imageExtractionTimeoutMs = fromJsonValue(source["ImageExtractionTimeoutMs"]); + m_pathSubstitutions = fromJsonValue>>(source["PathSubstitutions"]); + m_enableSimpleArtistDetection = fromJsonValue(source["EnableSimpleArtistDetection"]); + m_uninstalledPlugins = fromJsonValue(source["UninstalledPlugins"]); + m_enableSlowResponseWarning = fromJsonValue(source["EnableSlowResponseWarning"]); + m_slowResponseThresholdMs = fromJsonValue(source["SlowResponseThresholdMs"]); + m_corsHosts = fromJsonValue(source["CorsHosts"]); + m_knownProxies = fromJsonValue(source["KnownProxies"]); + m_activityLogRetentionDays = fromJsonValue(source["ActivityLogRetentionDays"]); + m_libraryScanFanoutConcurrency = fromJsonValue(source["LibraryScanFanoutConcurrency"]); + m_libraryMetadataRefreshConcurrency = fromJsonValue(source["LibraryMetadataRefreshConcurrency"]); + m_removeOldPlugins = fromJsonValue(source["RemoveOldPlugins"]); + m_disablePluginImages = fromJsonValue(source["DisablePluginImages"]); + } -QJsonObject ServerConfiguration::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ServerConfiguration::toJson() { QJsonObject result; + result["LogFileRetentionDays"] = toJsonValue(m_logFileRetentionDays); + result["IsStartupWizardCompleted"] = toJsonValue(m_isStartupWizardCompleted); + result["CachePath"] = toJsonValue(m_cachePath); + result["PreviousVersion"] = toJsonValue>(m_previousVersion); + result["PreviousVersionStr"] = toJsonValue(m_previousVersionStr); + result["EnableUPnP"] = toJsonValue(m_enableUPnP); + result["EnableMetrics"] = toJsonValue(m_enableMetrics); + result["PublicPort"] = toJsonValue(m_publicPort); + result["UPnPCreateHttpPortMap"] = toJsonValue(m_uPnPCreateHttpPortMap); + result["UDPPortRange"] = toJsonValue(m_uDPPortRange); + result["EnableIPV6"] = toJsonValue(m_enableIPV6); + result["EnableIPV4"] = toJsonValue(m_enableIPV4); + result["EnableSSDPTracing"] = toJsonValue(m_enableSSDPTracing); + result["SSDPTracingFilter"] = toJsonValue(m_sSDPTracingFilter); + result["UDPSendCount"] = toJsonValue(m_uDPSendCount); + result["UDPSendDelay"] = toJsonValue(m_uDPSendDelay); + result["IgnoreVirtualInterfaces"] = toJsonValue(m_ignoreVirtualInterfaces); + result["VirtualInterfaceNames"] = toJsonValue(m_virtualInterfaceNames); + result["GatewayMonitorPeriod"] = toJsonValue(m_gatewayMonitorPeriod); + result["EnableMultiSocketBinding"] = toJsonValue(m_enableMultiSocketBinding); + result["TrustAllIP6Interfaces"] = toJsonValue(m_trustAllIP6Interfaces); + result["HDHomerunPortRange"] = toJsonValue(m_hDHomerunPortRange); + result["PublishedServerUriBySubnet"] = toJsonValue(m_publishedServerUriBySubnet); + result["AutoDiscoveryTracing"] = toJsonValue(m_autoDiscoveryTracing); + result["AutoDiscovery"] = toJsonValue(m_autoDiscovery); + result["PublicHttpsPort"] = toJsonValue(m_publicHttpsPort); + result["HttpServerPortNumber"] = toJsonValue(m_httpServerPortNumber); + result["HttpsPortNumber"] = toJsonValue(m_httpsPortNumber); + result["EnableHttps"] = toJsonValue(m_enableHttps); + result["EnableNormalizedItemByNameIds"] = toJsonValue(m_enableNormalizedItemByNameIds); + result["CertificatePath"] = toJsonValue(m_certificatePath); + result["CertificatePassword"] = toJsonValue(m_certificatePassword); + result["IsPortAuthorized"] = toJsonValue(m_isPortAuthorized); + result["QuickConnectAvailable"] = toJsonValue(m_quickConnectAvailable); + result["EnableRemoteAccess"] = toJsonValue(m_enableRemoteAccess); + result["EnableCaseSensitiveItemIds"] = toJsonValue(m_enableCaseSensitiveItemIds); + result["DisableLiveTvChannelUserDataName"] = toJsonValue(m_disableLiveTvChannelUserDataName); + result["MetadataPath"] = toJsonValue(m_metadataPath); + result["MetadataNetworkPath"] = toJsonValue(m_metadataNetworkPath); + result["PreferredMetadataLanguage"] = toJsonValue(m_preferredMetadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["SortReplaceCharacters"] = toJsonValue(m_sortReplaceCharacters); + result["SortRemoveCharacters"] = toJsonValue(m_sortRemoveCharacters); + result["SortRemoveWords"] = toJsonValue(m_sortRemoveWords); + result["MinResumePct"] = toJsonValue(m_minResumePct); + result["MaxResumePct"] = toJsonValue(m_maxResumePct); + result["MinResumeDurationSeconds"] = toJsonValue(m_minResumeDurationSeconds); + result["MinAudiobookResume"] = toJsonValue(m_minAudiobookResume); + result["MaxAudiobookResume"] = toJsonValue(m_maxAudiobookResume); + result["LibraryMonitorDelay"] = toJsonValue(m_libraryMonitorDelay); + result["EnableDashboardResponseCaching"] = toJsonValue(m_enableDashboardResponseCaching); + result["ImageSavingConvention"] = toJsonValue(m_imageSavingConvention); + result["MetadataOptions"] = toJsonValue>>(m_metadataOptions); + result["SkipDeserializationForBasicTypes"] = toJsonValue(m_skipDeserializationForBasicTypes); + result["ServerName"] = toJsonValue(m_serverName); + result["BaseUrl"] = toJsonValue(m_baseUrl); + result["UICulture"] = toJsonValue(m_uICulture); + result["SaveMetadataHidden"] = toJsonValue(m_saveMetadataHidden); + result["ContentTypes"] = toJsonValue>>(m_contentTypes); + result["RemoteClientBitrateLimit"] = toJsonValue(m_remoteClientBitrateLimit); + result["EnableFolderView"] = toJsonValue(m_enableFolderView); + result["EnableGroupingIntoCollections"] = toJsonValue(m_enableGroupingIntoCollections); + result["DisplaySpecialsWithinSeasons"] = toJsonValue(m_displaySpecialsWithinSeasons); + result["LocalNetworkSubnets"] = toJsonValue(m_localNetworkSubnets); + result["LocalNetworkAddresses"] = toJsonValue(m_localNetworkAddresses); + result["CodecsUsed"] = toJsonValue(m_codecsUsed); + result["PluginRepositories"] = toJsonValue>>(m_pluginRepositories); + result["EnableExternalContentInSuggestions"] = toJsonValue(m_enableExternalContentInSuggestions); + result["RequireHttps"] = toJsonValue(m_requireHttps); + result["EnableNewOmdbSupport"] = toJsonValue(m_enableNewOmdbSupport); + result["RemoteIPFilter"] = toJsonValue(m_remoteIPFilter); + result["IsRemoteIPFilterBlacklist"] = toJsonValue(m_isRemoteIPFilterBlacklist); + result["ImageExtractionTimeoutMs"] = toJsonValue(m_imageExtractionTimeoutMs); + result["PathSubstitutions"] = toJsonValue>>(m_pathSubstitutions); + result["EnableSimpleArtistDetection"] = toJsonValue(m_enableSimpleArtistDetection); + result["UninstalledPlugins"] = toJsonValue(m_uninstalledPlugins); + result["EnableSlowResponseWarning"] = toJsonValue(m_enableSlowResponseWarning); + result["SlowResponseThresholdMs"] = toJsonValue(m_slowResponseThresholdMs); + result["CorsHosts"] = toJsonValue(m_corsHosts); + result["KnownProxies"] = toJsonValue(m_knownProxies); + result["ActivityLogRetentionDays"] = toJsonValue(m_activityLogRetentionDays); + result["LibraryScanFanoutConcurrency"] = toJsonValue(m_libraryScanFanoutConcurrency); + result["LibraryMetadataRefreshConcurrency"] = toJsonValue(m_libraryMetadataRefreshConcurrency); + result["RemoveOldPlugins"] = toJsonValue(m_removeOldPlugins); + result["DisablePluginImages"] = toJsonValue(m_disablePluginImages); + return result; } + qint32 ServerConfiguration::logFileRetentionDays() const { return m_logFileRetentionDays; } + void ServerConfiguration::setLogFileRetentionDays(qint32 newLogFileRetentionDays) { m_logFileRetentionDays = newLogFileRetentionDays; - emit logFileRetentionDaysChanged(newLogFileRetentionDays); } - bool ServerConfiguration::isStartupWizardCompleted() const { return m_isStartupWizardCompleted; } + void ServerConfiguration::setIsStartupWizardCompleted(bool newIsStartupWizardCompleted) { m_isStartupWizardCompleted = newIsStartupWizardCompleted; - emit isStartupWizardCompletedChanged(newIsStartupWizardCompleted); } - QString ServerConfiguration::cachePath() const { return m_cachePath; } + void ServerConfiguration::setCachePath(QString newCachePath) { m_cachePath = newCachePath; - emit cachePathChanged(newCachePath); } +QSharedPointer ServerConfiguration::previousVersion() const { return m_previousVersion; } -Version * ServerConfiguration::previousVersion() const { return m_previousVersion; } -void ServerConfiguration::setPreviousVersion(Version * newPreviousVersion) { +void ServerConfiguration::setPreviousVersion(QSharedPointer newPreviousVersion) { m_previousVersion = newPreviousVersion; - emit previousVersionChanged(newPreviousVersion); } - QString ServerConfiguration::previousVersionStr() const { return m_previousVersionStr; } + void ServerConfiguration::setPreviousVersionStr(QString newPreviousVersionStr) { m_previousVersionStr = newPreviousVersionStr; - emit previousVersionStrChanged(newPreviousVersionStr); } - bool ServerConfiguration::enableUPnP() const { return m_enableUPnP; } + void ServerConfiguration::setEnableUPnP(bool newEnableUPnP) { m_enableUPnP = newEnableUPnP; - emit enableUPnPChanged(newEnableUPnP); } - bool ServerConfiguration::enableMetrics() const { return m_enableMetrics; } + void ServerConfiguration::setEnableMetrics(bool newEnableMetrics) { m_enableMetrics = newEnableMetrics; - emit enableMetricsChanged(newEnableMetrics); } - qint32 ServerConfiguration::publicPort() const { return m_publicPort; } + void ServerConfiguration::setPublicPort(qint32 newPublicPort) { m_publicPort = newPublicPort; - emit publicPortChanged(newPublicPort); } - bool ServerConfiguration::uPnPCreateHttpPortMap() const { return m_uPnPCreateHttpPortMap; } + void ServerConfiguration::setUPnPCreateHttpPortMap(bool newUPnPCreateHttpPortMap) { m_uPnPCreateHttpPortMap = newUPnPCreateHttpPortMap; - emit uPnPCreateHttpPortMapChanged(newUPnPCreateHttpPortMap); } - QString ServerConfiguration::uDPPortRange() const { return m_uDPPortRange; } + void ServerConfiguration::setUDPPortRange(QString newUDPPortRange) { m_uDPPortRange = newUDPPortRange; - emit uDPPortRangeChanged(newUDPPortRange); } - bool ServerConfiguration::enableIPV6() const { return m_enableIPV6; } + void ServerConfiguration::setEnableIPV6(bool newEnableIPV6) { m_enableIPV6 = newEnableIPV6; - emit enableIPV6Changed(newEnableIPV6); } - bool ServerConfiguration::enableIPV4() const { return m_enableIPV4; } + void ServerConfiguration::setEnableIPV4(bool newEnableIPV4) { m_enableIPV4 = newEnableIPV4; - emit enableIPV4Changed(newEnableIPV4); } - bool ServerConfiguration::enableSSDPTracing() const { return m_enableSSDPTracing; } + void ServerConfiguration::setEnableSSDPTracing(bool newEnableSSDPTracing) { m_enableSSDPTracing = newEnableSSDPTracing; - emit enableSSDPTracingChanged(newEnableSSDPTracing); } - QString ServerConfiguration::sSDPTracingFilter() const { return m_sSDPTracingFilter; } + void ServerConfiguration::setSSDPTracingFilter(QString newSSDPTracingFilter) { m_sSDPTracingFilter = newSSDPTracingFilter; - emit sSDPTracingFilterChanged(newSSDPTracingFilter); } - qint32 ServerConfiguration::uDPSendCount() const { return m_uDPSendCount; } + void ServerConfiguration::setUDPSendCount(qint32 newUDPSendCount) { m_uDPSendCount = newUDPSendCount; - emit uDPSendCountChanged(newUDPSendCount); } - qint32 ServerConfiguration::uDPSendDelay() const { return m_uDPSendDelay; } + void ServerConfiguration::setUDPSendDelay(qint32 newUDPSendDelay) { m_uDPSendDelay = newUDPSendDelay; - emit uDPSendDelayChanged(newUDPSendDelay); } - bool ServerConfiguration::ignoreVirtualInterfaces() const { return m_ignoreVirtualInterfaces; } + void ServerConfiguration::setIgnoreVirtualInterfaces(bool newIgnoreVirtualInterfaces) { m_ignoreVirtualInterfaces = newIgnoreVirtualInterfaces; - emit ignoreVirtualInterfacesChanged(newIgnoreVirtualInterfaces); } - QString ServerConfiguration::virtualInterfaceNames() const { return m_virtualInterfaceNames; } + void ServerConfiguration::setVirtualInterfaceNames(QString newVirtualInterfaceNames) { m_virtualInterfaceNames = newVirtualInterfaceNames; - emit virtualInterfaceNamesChanged(newVirtualInterfaceNames); } - qint32 ServerConfiguration::gatewayMonitorPeriod() const { return m_gatewayMonitorPeriod; } + void ServerConfiguration::setGatewayMonitorPeriod(qint32 newGatewayMonitorPeriod) { m_gatewayMonitorPeriod = newGatewayMonitorPeriod; - emit gatewayMonitorPeriodChanged(newGatewayMonitorPeriod); } - bool ServerConfiguration::enableMultiSocketBinding() const { return m_enableMultiSocketBinding; } + void ServerConfiguration::setEnableMultiSocketBinding(bool newEnableMultiSocketBinding) { m_enableMultiSocketBinding = newEnableMultiSocketBinding; - emit enableMultiSocketBindingChanged(newEnableMultiSocketBinding); } - bool ServerConfiguration::trustAllIP6Interfaces() const { return m_trustAllIP6Interfaces; } + void ServerConfiguration::setTrustAllIP6Interfaces(bool newTrustAllIP6Interfaces) { m_trustAllIP6Interfaces = newTrustAllIP6Interfaces; - emit trustAllIP6InterfacesChanged(newTrustAllIP6Interfaces); } - QString ServerConfiguration::hDHomerunPortRange() const { return m_hDHomerunPortRange; } + void ServerConfiguration::setHDHomerunPortRange(QString newHDHomerunPortRange) { m_hDHomerunPortRange = newHDHomerunPortRange; - emit hDHomerunPortRangeChanged(newHDHomerunPortRange); } - QStringList ServerConfiguration::publishedServerUriBySubnet() const { return m_publishedServerUriBySubnet; } + void ServerConfiguration::setPublishedServerUriBySubnet(QStringList newPublishedServerUriBySubnet) { m_publishedServerUriBySubnet = newPublishedServerUriBySubnet; - emit publishedServerUriBySubnetChanged(newPublishedServerUriBySubnet); } - bool ServerConfiguration::autoDiscoveryTracing() const { return m_autoDiscoveryTracing; } + void ServerConfiguration::setAutoDiscoveryTracing(bool newAutoDiscoveryTracing) { m_autoDiscoveryTracing = newAutoDiscoveryTracing; - emit autoDiscoveryTracingChanged(newAutoDiscoveryTracing); } - bool ServerConfiguration::autoDiscovery() const { return m_autoDiscovery; } + void ServerConfiguration::setAutoDiscovery(bool newAutoDiscovery) { m_autoDiscovery = newAutoDiscovery; - emit autoDiscoveryChanged(newAutoDiscovery); } - qint32 ServerConfiguration::publicHttpsPort() const { return m_publicHttpsPort; } + void ServerConfiguration::setPublicHttpsPort(qint32 newPublicHttpsPort) { m_publicHttpsPort = newPublicHttpsPort; - emit publicHttpsPortChanged(newPublicHttpsPort); } - qint32 ServerConfiguration::httpServerPortNumber() const { return m_httpServerPortNumber; } + void ServerConfiguration::setHttpServerPortNumber(qint32 newHttpServerPortNumber) { m_httpServerPortNumber = newHttpServerPortNumber; - emit httpServerPortNumberChanged(newHttpServerPortNumber); } - qint32 ServerConfiguration::httpsPortNumber() const { return m_httpsPortNumber; } + void ServerConfiguration::setHttpsPortNumber(qint32 newHttpsPortNumber) { m_httpsPortNumber = newHttpsPortNumber; - emit httpsPortNumberChanged(newHttpsPortNumber); } - bool ServerConfiguration::enableHttps() const { return m_enableHttps; } + void ServerConfiguration::setEnableHttps(bool newEnableHttps) { m_enableHttps = newEnableHttps; - emit enableHttpsChanged(newEnableHttps); } - bool ServerConfiguration::enableNormalizedItemByNameIds() const { return m_enableNormalizedItemByNameIds; } + void ServerConfiguration::setEnableNormalizedItemByNameIds(bool newEnableNormalizedItemByNameIds) { m_enableNormalizedItemByNameIds = newEnableNormalizedItemByNameIds; - emit enableNormalizedItemByNameIdsChanged(newEnableNormalizedItemByNameIds); } - QString ServerConfiguration::certificatePath() const { return m_certificatePath; } + void ServerConfiguration::setCertificatePath(QString newCertificatePath) { m_certificatePath = newCertificatePath; - emit certificatePathChanged(newCertificatePath); } - QString ServerConfiguration::certificatePassword() const { return m_certificatePassword; } + void ServerConfiguration::setCertificatePassword(QString newCertificatePassword) { m_certificatePassword = newCertificatePassword; - emit certificatePasswordChanged(newCertificatePassword); } - bool ServerConfiguration::isPortAuthorized() const { return m_isPortAuthorized; } + void ServerConfiguration::setIsPortAuthorized(bool newIsPortAuthorized) { m_isPortAuthorized = newIsPortAuthorized; - emit isPortAuthorizedChanged(newIsPortAuthorized); } - bool ServerConfiguration::quickConnectAvailable() const { return m_quickConnectAvailable; } + void ServerConfiguration::setQuickConnectAvailable(bool newQuickConnectAvailable) { m_quickConnectAvailable = newQuickConnectAvailable; - emit quickConnectAvailableChanged(newQuickConnectAvailable); } - bool ServerConfiguration::enableRemoteAccess() const { return m_enableRemoteAccess; } + void ServerConfiguration::setEnableRemoteAccess(bool newEnableRemoteAccess) { m_enableRemoteAccess = newEnableRemoteAccess; - emit enableRemoteAccessChanged(newEnableRemoteAccess); } - bool ServerConfiguration::enableCaseSensitiveItemIds() const { return m_enableCaseSensitiveItemIds; } + void ServerConfiguration::setEnableCaseSensitiveItemIds(bool newEnableCaseSensitiveItemIds) { m_enableCaseSensitiveItemIds = newEnableCaseSensitiveItemIds; - emit enableCaseSensitiveItemIdsChanged(newEnableCaseSensitiveItemIds); } - bool ServerConfiguration::disableLiveTvChannelUserDataName() const { return m_disableLiveTvChannelUserDataName; } + void ServerConfiguration::setDisableLiveTvChannelUserDataName(bool newDisableLiveTvChannelUserDataName) { m_disableLiveTvChannelUserDataName = newDisableLiveTvChannelUserDataName; - emit disableLiveTvChannelUserDataNameChanged(newDisableLiveTvChannelUserDataName); } - QString ServerConfiguration::metadataPath() const { return m_metadataPath; } + void ServerConfiguration::setMetadataPath(QString newMetadataPath) { m_metadataPath = newMetadataPath; - emit metadataPathChanged(newMetadataPath); } - QString ServerConfiguration::metadataNetworkPath() const { return m_metadataNetworkPath; } + void ServerConfiguration::setMetadataNetworkPath(QString newMetadataNetworkPath) { m_metadataNetworkPath = newMetadataNetworkPath; - emit metadataNetworkPathChanged(newMetadataNetworkPath); } - QString ServerConfiguration::preferredMetadataLanguage() const { return m_preferredMetadataLanguage; } + void ServerConfiguration::setPreferredMetadataLanguage(QString newPreferredMetadataLanguage) { m_preferredMetadataLanguage = newPreferredMetadataLanguage; - emit preferredMetadataLanguageChanged(newPreferredMetadataLanguage); } - QString ServerConfiguration::metadataCountryCode() const { return m_metadataCountryCode; } + void ServerConfiguration::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QStringList ServerConfiguration::sortReplaceCharacters() const { return m_sortReplaceCharacters; } + void ServerConfiguration::setSortReplaceCharacters(QStringList newSortReplaceCharacters) { m_sortReplaceCharacters = newSortReplaceCharacters; - emit sortReplaceCharactersChanged(newSortReplaceCharacters); } - QStringList ServerConfiguration::sortRemoveCharacters() const { return m_sortRemoveCharacters; } + void ServerConfiguration::setSortRemoveCharacters(QStringList newSortRemoveCharacters) { m_sortRemoveCharacters = newSortRemoveCharacters; - emit sortRemoveCharactersChanged(newSortRemoveCharacters); } - QStringList ServerConfiguration::sortRemoveWords() const { return m_sortRemoveWords; } + void ServerConfiguration::setSortRemoveWords(QStringList newSortRemoveWords) { m_sortRemoveWords = newSortRemoveWords; - emit sortRemoveWordsChanged(newSortRemoveWords); } - qint32 ServerConfiguration::minResumePct() const { return m_minResumePct; } + void ServerConfiguration::setMinResumePct(qint32 newMinResumePct) { m_minResumePct = newMinResumePct; - emit minResumePctChanged(newMinResumePct); } - qint32 ServerConfiguration::maxResumePct() const { return m_maxResumePct; } + void ServerConfiguration::setMaxResumePct(qint32 newMaxResumePct) { m_maxResumePct = newMaxResumePct; - emit maxResumePctChanged(newMaxResumePct); } - qint32 ServerConfiguration::minResumeDurationSeconds() const { return m_minResumeDurationSeconds; } + void ServerConfiguration::setMinResumeDurationSeconds(qint32 newMinResumeDurationSeconds) { m_minResumeDurationSeconds = newMinResumeDurationSeconds; - emit minResumeDurationSecondsChanged(newMinResumeDurationSeconds); } - qint32 ServerConfiguration::minAudiobookResume() const { return m_minAudiobookResume; } + void ServerConfiguration::setMinAudiobookResume(qint32 newMinAudiobookResume) { m_minAudiobookResume = newMinAudiobookResume; - emit minAudiobookResumeChanged(newMinAudiobookResume); } - qint32 ServerConfiguration::maxAudiobookResume() const { return m_maxAudiobookResume; } + void ServerConfiguration::setMaxAudiobookResume(qint32 newMaxAudiobookResume) { m_maxAudiobookResume = newMaxAudiobookResume; - emit maxAudiobookResumeChanged(newMaxAudiobookResume); } - qint32 ServerConfiguration::libraryMonitorDelay() const { return m_libraryMonitorDelay; } + void ServerConfiguration::setLibraryMonitorDelay(qint32 newLibraryMonitorDelay) { m_libraryMonitorDelay = newLibraryMonitorDelay; - emit libraryMonitorDelayChanged(newLibraryMonitorDelay); } - bool ServerConfiguration::enableDashboardResponseCaching() const { return m_enableDashboardResponseCaching; } + void ServerConfiguration::setEnableDashboardResponseCaching(bool newEnableDashboardResponseCaching) { m_enableDashboardResponseCaching = newEnableDashboardResponseCaching; - emit enableDashboardResponseCachingChanged(newEnableDashboardResponseCaching); } - ImageSavingConvention ServerConfiguration::imageSavingConvention() const { return m_imageSavingConvention; } + void ServerConfiguration::setImageSavingConvention(ImageSavingConvention newImageSavingConvention) { m_imageSavingConvention = newImageSavingConvention; - emit imageSavingConventionChanged(newImageSavingConvention); } +QList> ServerConfiguration::metadataOptions() const { return m_metadataOptions; } -QList ServerConfiguration::metadataOptions() const { return m_metadataOptions; } -void ServerConfiguration::setMetadataOptions(QList newMetadataOptions) { +void ServerConfiguration::setMetadataOptions(QList> newMetadataOptions) { m_metadataOptions = newMetadataOptions; - emit metadataOptionsChanged(newMetadataOptions); } - bool ServerConfiguration::skipDeserializationForBasicTypes() const { return m_skipDeserializationForBasicTypes; } + void ServerConfiguration::setSkipDeserializationForBasicTypes(bool newSkipDeserializationForBasicTypes) { m_skipDeserializationForBasicTypes = newSkipDeserializationForBasicTypes; - emit skipDeserializationForBasicTypesChanged(newSkipDeserializationForBasicTypes); } - QString ServerConfiguration::serverName() const { return m_serverName; } + void ServerConfiguration::setServerName(QString newServerName) { m_serverName = newServerName; - emit serverNameChanged(newServerName); } - QString ServerConfiguration::baseUrl() const { return m_baseUrl; } + void ServerConfiguration::setBaseUrl(QString newBaseUrl) { m_baseUrl = newBaseUrl; - emit baseUrlChanged(newBaseUrl); } - QString ServerConfiguration::uICulture() const { return m_uICulture; } + void ServerConfiguration::setUICulture(QString newUICulture) { m_uICulture = newUICulture; - emit uICultureChanged(newUICulture); } - bool ServerConfiguration::saveMetadataHidden() const { return m_saveMetadataHidden; } + void ServerConfiguration::setSaveMetadataHidden(bool newSaveMetadataHidden) { m_saveMetadataHidden = newSaveMetadataHidden; - emit saveMetadataHiddenChanged(newSaveMetadataHidden); } +QList> ServerConfiguration::contentTypes() const { return m_contentTypes; } -QList ServerConfiguration::contentTypes() const { return m_contentTypes; } -void ServerConfiguration::setContentTypes(QList newContentTypes) { +void ServerConfiguration::setContentTypes(QList> newContentTypes) { m_contentTypes = newContentTypes; - emit contentTypesChanged(newContentTypes); } - qint32 ServerConfiguration::remoteClientBitrateLimit() const { return m_remoteClientBitrateLimit; } + void ServerConfiguration::setRemoteClientBitrateLimit(qint32 newRemoteClientBitrateLimit) { m_remoteClientBitrateLimit = newRemoteClientBitrateLimit; - emit remoteClientBitrateLimitChanged(newRemoteClientBitrateLimit); } - bool ServerConfiguration::enableFolderView() const { return m_enableFolderView; } + void ServerConfiguration::setEnableFolderView(bool newEnableFolderView) { m_enableFolderView = newEnableFolderView; - emit enableFolderViewChanged(newEnableFolderView); } - bool ServerConfiguration::enableGroupingIntoCollections() const { return m_enableGroupingIntoCollections; } + void ServerConfiguration::setEnableGroupingIntoCollections(bool newEnableGroupingIntoCollections) { m_enableGroupingIntoCollections = newEnableGroupingIntoCollections; - emit enableGroupingIntoCollectionsChanged(newEnableGroupingIntoCollections); } - bool ServerConfiguration::displaySpecialsWithinSeasons() const { return m_displaySpecialsWithinSeasons; } + void ServerConfiguration::setDisplaySpecialsWithinSeasons(bool newDisplaySpecialsWithinSeasons) { m_displaySpecialsWithinSeasons = newDisplaySpecialsWithinSeasons; - emit displaySpecialsWithinSeasonsChanged(newDisplaySpecialsWithinSeasons); } - QStringList ServerConfiguration::localNetworkSubnets() const { return m_localNetworkSubnets; } + void ServerConfiguration::setLocalNetworkSubnets(QStringList newLocalNetworkSubnets) { m_localNetworkSubnets = newLocalNetworkSubnets; - emit localNetworkSubnetsChanged(newLocalNetworkSubnets); } - QStringList ServerConfiguration::localNetworkAddresses() const { return m_localNetworkAddresses; } + void ServerConfiguration::setLocalNetworkAddresses(QStringList newLocalNetworkAddresses) { m_localNetworkAddresses = newLocalNetworkAddresses; - emit localNetworkAddressesChanged(newLocalNetworkAddresses); } - QStringList ServerConfiguration::codecsUsed() const { return m_codecsUsed; } + void ServerConfiguration::setCodecsUsed(QStringList newCodecsUsed) { m_codecsUsed = newCodecsUsed; - emit codecsUsedChanged(newCodecsUsed); } +QList> ServerConfiguration::pluginRepositories() const { return m_pluginRepositories; } -QList ServerConfiguration::pluginRepositories() const { return m_pluginRepositories; } -void ServerConfiguration::setPluginRepositories(QList newPluginRepositories) { +void ServerConfiguration::setPluginRepositories(QList> newPluginRepositories) { m_pluginRepositories = newPluginRepositories; - emit pluginRepositoriesChanged(newPluginRepositories); } - bool ServerConfiguration::enableExternalContentInSuggestions() const { return m_enableExternalContentInSuggestions; } + void ServerConfiguration::setEnableExternalContentInSuggestions(bool newEnableExternalContentInSuggestions) { m_enableExternalContentInSuggestions = newEnableExternalContentInSuggestions; - emit enableExternalContentInSuggestionsChanged(newEnableExternalContentInSuggestions); } - bool ServerConfiguration::requireHttps() const { return m_requireHttps; } + void ServerConfiguration::setRequireHttps(bool newRequireHttps) { m_requireHttps = newRequireHttps; - emit requireHttpsChanged(newRequireHttps); } - bool ServerConfiguration::enableNewOmdbSupport() const { return m_enableNewOmdbSupport; } + void ServerConfiguration::setEnableNewOmdbSupport(bool newEnableNewOmdbSupport) { m_enableNewOmdbSupport = newEnableNewOmdbSupport; - emit enableNewOmdbSupportChanged(newEnableNewOmdbSupport); } - QStringList ServerConfiguration::remoteIPFilter() const { return m_remoteIPFilter; } + void ServerConfiguration::setRemoteIPFilter(QStringList newRemoteIPFilter) { m_remoteIPFilter = newRemoteIPFilter; - emit remoteIPFilterChanged(newRemoteIPFilter); } - bool ServerConfiguration::isRemoteIPFilterBlacklist() const { return m_isRemoteIPFilterBlacklist; } + void ServerConfiguration::setIsRemoteIPFilterBlacklist(bool newIsRemoteIPFilterBlacklist) { m_isRemoteIPFilterBlacklist = newIsRemoteIPFilterBlacklist; - emit isRemoteIPFilterBlacklistChanged(newIsRemoteIPFilterBlacklist); } - qint32 ServerConfiguration::imageExtractionTimeoutMs() const { return m_imageExtractionTimeoutMs; } + void ServerConfiguration::setImageExtractionTimeoutMs(qint32 newImageExtractionTimeoutMs) { m_imageExtractionTimeoutMs = newImageExtractionTimeoutMs; - emit imageExtractionTimeoutMsChanged(newImageExtractionTimeoutMs); } +QList> ServerConfiguration::pathSubstitutions() const { return m_pathSubstitutions; } -QList ServerConfiguration::pathSubstitutions() const { return m_pathSubstitutions; } -void ServerConfiguration::setPathSubstitutions(QList newPathSubstitutions) { +void ServerConfiguration::setPathSubstitutions(QList> newPathSubstitutions) { m_pathSubstitutions = newPathSubstitutions; - emit pathSubstitutionsChanged(newPathSubstitutions); } - bool ServerConfiguration::enableSimpleArtistDetection() const { return m_enableSimpleArtistDetection; } + void ServerConfiguration::setEnableSimpleArtistDetection(bool newEnableSimpleArtistDetection) { m_enableSimpleArtistDetection = newEnableSimpleArtistDetection; - emit enableSimpleArtistDetectionChanged(newEnableSimpleArtistDetection); } - QStringList ServerConfiguration::uninstalledPlugins() const { return m_uninstalledPlugins; } + void ServerConfiguration::setUninstalledPlugins(QStringList newUninstalledPlugins) { m_uninstalledPlugins = newUninstalledPlugins; - emit uninstalledPluginsChanged(newUninstalledPlugins); } - bool ServerConfiguration::enableSlowResponseWarning() const { return m_enableSlowResponseWarning; } + void ServerConfiguration::setEnableSlowResponseWarning(bool newEnableSlowResponseWarning) { m_enableSlowResponseWarning = newEnableSlowResponseWarning; - emit enableSlowResponseWarningChanged(newEnableSlowResponseWarning); } - qint64 ServerConfiguration::slowResponseThresholdMs() const { return m_slowResponseThresholdMs; } + void ServerConfiguration::setSlowResponseThresholdMs(qint64 newSlowResponseThresholdMs) { m_slowResponseThresholdMs = newSlowResponseThresholdMs; - emit slowResponseThresholdMsChanged(newSlowResponseThresholdMs); } - QStringList ServerConfiguration::corsHosts() const { return m_corsHosts; } + void ServerConfiguration::setCorsHosts(QStringList newCorsHosts) { m_corsHosts = newCorsHosts; - emit corsHostsChanged(newCorsHosts); } - QStringList ServerConfiguration::knownProxies() const { return m_knownProxies; } + void ServerConfiguration::setKnownProxies(QStringList newKnownProxies) { m_knownProxies = newKnownProxies; - emit knownProxiesChanged(newKnownProxies); } - qint32 ServerConfiguration::activityLogRetentionDays() const { return m_activityLogRetentionDays; } + void ServerConfiguration::setActivityLogRetentionDays(qint32 newActivityLogRetentionDays) { m_activityLogRetentionDays = newActivityLogRetentionDays; - emit activityLogRetentionDaysChanged(newActivityLogRetentionDays); } - qint32 ServerConfiguration::libraryScanFanoutConcurrency() const { return m_libraryScanFanoutConcurrency; } + void ServerConfiguration::setLibraryScanFanoutConcurrency(qint32 newLibraryScanFanoutConcurrency) { m_libraryScanFanoutConcurrency = newLibraryScanFanoutConcurrency; - emit libraryScanFanoutConcurrencyChanged(newLibraryScanFanoutConcurrency); } - qint32 ServerConfiguration::libraryMetadataRefreshConcurrency() const { return m_libraryMetadataRefreshConcurrency; } + void ServerConfiguration::setLibraryMetadataRefreshConcurrency(qint32 newLibraryMetadataRefreshConcurrency) { m_libraryMetadataRefreshConcurrency = newLibraryMetadataRefreshConcurrency; - emit libraryMetadataRefreshConcurrencyChanged(newLibraryMetadataRefreshConcurrency); } - bool ServerConfiguration::removeOldPlugins() const { return m_removeOldPlugins; } + void ServerConfiguration::setRemoveOldPlugins(bool newRemoveOldPlugins) { m_removeOldPlugins = newRemoveOldPlugins; - emit removeOldPluginsChanged(newRemoveOldPlugins); } - bool ServerConfiguration::disablePluginImages() const { return m_disablePluginImages; } + void ServerConfiguration::setDisablePluginImages(bool newDisablePluginImages) { m_disablePluginImages = newDisablePluginImages; - emit disablePluginImagesChanged(newDisablePluginImages); } diff --git a/core/src/DTO/sessioninfo.cpp b/core/src/DTO/sessioninfo.cpp index fda4dab..66a740b 100644 --- a/core/src/DTO/sessioninfo.cpp +++ b/core/src/DTO/sessioninfo.cpp @@ -29,193 +29,222 @@ #include -#include - namespace Jellyfin { namespace DTO { -SessionInfo::SessionInfo(QObject *parent) : QObject(parent) {} +SessionInfo::SessionInfo(QObject *parent) {} -SessionInfo *SessionInfo::fromJSON(QJsonObject source, QObject *parent) { - SessionInfo *instance = new SessionInfo(parent); - instance->updateFromJSON(source); +SessionInfo SessionInfo::fromJson(QJsonObject source) {SessionInfo instance; + instance->setFromJson(source, false); return instance; } -void SessionInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SessionInfo::setFromJson(QJsonObject source) { + m_playState = fromJsonValue>(source["PlayState"]); + m_additionalUsers = fromJsonValue>>(source["AdditionalUsers"]); + m_capabilities = fromJsonValue>(source["Capabilities"]); + m_remoteEndPoint = fromJsonValue(source["RemoteEndPoint"]); + m_playableMediaTypes = fromJsonValue(source["PlayableMediaTypes"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_userId = fromJsonValue(source["UserId"]); + m_userName = fromJsonValue(source["UserName"]); + m_client = fromJsonValue(source["Client"]); + m_lastActivityDate = fromJsonValue(source["LastActivityDate"]); + m_lastPlaybackCheckIn = fromJsonValue(source["LastPlaybackCheckIn"]); + m_deviceName = fromJsonValue(source["DeviceName"]); + m_deviceType = fromJsonValue(source["DeviceType"]); + m_nowPlayingItem = fromJsonValue>(source["NowPlayingItem"]); + m_fullNowPlayingItem = fromJsonValue>(source["FullNowPlayingItem"]); + m_nowViewingItem = fromJsonValue>(source["NowViewingItem"]); + m_deviceId = fromJsonValue(source["DeviceId"]); + m_applicationVersion = fromJsonValue(source["ApplicationVersion"]); + m_transcodingInfo = fromJsonValue>(source["TranscodingInfo"]); + m_isActive = fromJsonValue(source["IsActive"]); + m_supportsMediaControl = fromJsonValue(source["SupportsMediaControl"]); + m_supportsRemoteControl = fromJsonValue(source["SupportsRemoteControl"]); + m_nowPlayingQueue = fromJsonValue>>(source["NowPlayingQueue"]); + m_hasCustomDeviceName = fromJsonValue(source["HasCustomDeviceName"]); + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + m_serverId = fromJsonValue(source["ServerId"]); + m_userPrimaryImageTag = fromJsonValue(source["UserPrimaryImageTag"]); + m_supportedCommands = fromJsonValue>(source["SupportedCommands"]); + } -QJsonObject SessionInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SessionInfo::toJson() { QJsonObject result; + result["PlayState"] = toJsonValue>(m_playState); + result["AdditionalUsers"] = toJsonValue>>(m_additionalUsers); + result["Capabilities"] = toJsonValue>(m_capabilities); + result["RemoteEndPoint"] = toJsonValue(m_remoteEndPoint); + result["PlayableMediaTypes"] = toJsonValue(m_playableMediaTypes); + result["Id"] = toJsonValue(m_jellyfinId); + result["UserId"] = toJsonValue(m_userId); + result["UserName"] = toJsonValue(m_userName); + result["Client"] = toJsonValue(m_client); + result["LastActivityDate"] = toJsonValue(m_lastActivityDate); + result["LastPlaybackCheckIn"] = toJsonValue(m_lastPlaybackCheckIn); + result["DeviceName"] = toJsonValue(m_deviceName); + result["DeviceType"] = toJsonValue(m_deviceType); + result["NowPlayingItem"] = toJsonValue>(m_nowPlayingItem); + result["FullNowPlayingItem"] = toJsonValue>(m_fullNowPlayingItem); + result["NowViewingItem"] = toJsonValue>(m_nowViewingItem); + result["DeviceId"] = toJsonValue(m_deviceId); + result["ApplicationVersion"] = toJsonValue(m_applicationVersion); + result["TranscodingInfo"] = toJsonValue>(m_transcodingInfo); + result["IsActive"] = toJsonValue(m_isActive); + result["SupportsMediaControl"] = toJsonValue(m_supportsMediaControl); + result["SupportsRemoteControl"] = toJsonValue(m_supportsRemoteControl); + result["NowPlayingQueue"] = toJsonValue>>(m_nowPlayingQueue); + result["HasCustomDeviceName"] = toJsonValue(m_hasCustomDeviceName); + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + result["ServerId"] = toJsonValue(m_serverId); + result["UserPrimaryImageTag"] = toJsonValue(m_userPrimaryImageTag); + result["SupportedCommands"] = toJsonValue>(m_supportedCommands); + return result; } -PlayerStateInfo * SessionInfo::playState() const { return m_playState; } -void SessionInfo::setPlayState(PlayerStateInfo * newPlayState) { + +QSharedPointer SessionInfo::playState() const { return m_playState; } + +void SessionInfo::setPlayState(QSharedPointer newPlayState) { m_playState = newPlayState; - emit playStateChanged(newPlayState); } +QList> SessionInfo::additionalUsers() const { return m_additionalUsers; } -QList SessionInfo::additionalUsers() const { return m_additionalUsers; } -void SessionInfo::setAdditionalUsers(QList newAdditionalUsers) { +void SessionInfo::setAdditionalUsers(QList> newAdditionalUsers) { m_additionalUsers = newAdditionalUsers; - emit additionalUsersChanged(newAdditionalUsers); } +QSharedPointer SessionInfo::capabilities() const { return m_capabilities; } -ClientCapabilities * SessionInfo::capabilities() const { return m_capabilities; } -void SessionInfo::setCapabilities(ClientCapabilities * newCapabilities) { +void SessionInfo::setCapabilities(QSharedPointer newCapabilities) { m_capabilities = newCapabilities; - emit capabilitiesChanged(newCapabilities); } - QString SessionInfo::remoteEndPoint() const { return m_remoteEndPoint; } + void SessionInfo::setRemoteEndPoint(QString newRemoteEndPoint) { m_remoteEndPoint = newRemoteEndPoint; - emit remoteEndPointChanged(newRemoteEndPoint); } - QStringList SessionInfo::playableMediaTypes() const { return m_playableMediaTypes; } + void SessionInfo::setPlayableMediaTypes(QStringList newPlayableMediaTypes) { m_playableMediaTypes = newPlayableMediaTypes; - emit playableMediaTypesChanged(newPlayableMediaTypes); } - QString SessionInfo::jellyfinId() const { return m_jellyfinId; } + void SessionInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } +QUuid SessionInfo::userId() const { return m_userId; } -QString SessionInfo::userId() const { return m_userId; } -void SessionInfo::setUserId(QString newUserId) { +void SessionInfo::setUserId(QUuid newUserId) { m_userId = newUserId; - emit userIdChanged(newUserId); } - QString SessionInfo::userName() const { return m_userName; } + void SessionInfo::setUserName(QString newUserName) { m_userName = newUserName; - emit userNameChanged(newUserName); } - QString SessionInfo::client() const { return m_client; } + void SessionInfo::setClient(QString newClient) { m_client = newClient; - emit clientChanged(newClient); } - QDateTime SessionInfo::lastActivityDate() const { return m_lastActivityDate; } + void SessionInfo::setLastActivityDate(QDateTime newLastActivityDate) { m_lastActivityDate = newLastActivityDate; - emit lastActivityDateChanged(newLastActivityDate); } - QDateTime SessionInfo::lastPlaybackCheckIn() const { return m_lastPlaybackCheckIn; } + void SessionInfo::setLastPlaybackCheckIn(QDateTime newLastPlaybackCheckIn) { m_lastPlaybackCheckIn = newLastPlaybackCheckIn; - emit lastPlaybackCheckInChanged(newLastPlaybackCheckIn); } - QString SessionInfo::deviceName() const { return m_deviceName; } + void SessionInfo::setDeviceName(QString newDeviceName) { m_deviceName = newDeviceName; - emit deviceNameChanged(newDeviceName); } - QString SessionInfo::deviceType() const { return m_deviceType; } + void SessionInfo::setDeviceType(QString newDeviceType) { m_deviceType = newDeviceType; - emit deviceTypeChanged(newDeviceType); } +QSharedPointer SessionInfo::nowPlayingItem() const { return m_nowPlayingItem; } -BaseItemDto * SessionInfo::nowPlayingItem() const { return m_nowPlayingItem; } -void SessionInfo::setNowPlayingItem(BaseItemDto * newNowPlayingItem) { +void SessionInfo::setNowPlayingItem(QSharedPointer newNowPlayingItem) { m_nowPlayingItem = newNowPlayingItem; - emit nowPlayingItemChanged(newNowPlayingItem); } +QSharedPointer SessionInfo::fullNowPlayingItem() const { return m_fullNowPlayingItem; } -BaseItem * SessionInfo::fullNowPlayingItem() const { return m_fullNowPlayingItem; } -void SessionInfo::setFullNowPlayingItem(BaseItem * newFullNowPlayingItem) { +void SessionInfo::setFullNowPlayingItem(QSharedPointer newFullNowPlayingItem) { m_fullNowPlayingItem = newFullNowPlayingItem; - emit fullNowPlayingItemChanged(newFullNowPlayingItem); } +QSharedPointer SessionInfo::nowViewingItem() const { return m_nowViewingItem; } -BaseItemDto * SessionInfo::nowViewingItem() const { return m_nowViewingItem; } -void SessionInfo::setNowViewingItem(BaseItemDto * newNowViewingItem) { +void SessionInfo::setNowViewingItem(QSharedPointer newNowViewingItem) { m_nowViewingItem = newNowViewingItem; - emit nowViewingItemChanged(newNowViewingItem); } - QString SessionInfo::deviceId() const { return m_deviceId; } + void SessionInfo::setDeviceId(QString newDeviceId) { m_deviceId = newDeviceId; - emit deviceIdChanged(newDeviceId); } - QString SessionInfo::applicationVersion() const { return m_applicationVersion; } + void SessionInfo::setApplicationVersion(QString newApplicationVersion) { m_applicationVersion = newApplicationVersion; - emit applicationVersionChanged(newApplicationVersion); } +QSharedPointer SessionInfo::transcodingInfo() const { return m_transcodingInfo; } -TranscodingInfo * SessionInfo::transcodingInfo() const { return m_transcodingInfo; } -void SessionInfo::setTranscodingInfo(TranscodingInfo * newTranscodingInfo) { +void SessionInfo::setTranscodingInfo(QSharedPointer newTranscodingInfo) { m_transcodingInfo = newTranscodingInfo; - emit transcodingInfoChanged(newTranscodingInfo); } - bool SessionInfo::isActive() const { return m_isActive; } + void SessionInfo::setIsActive(bool newIsActive) { m_isActive = newIsActive; - emit isActiveChanged(newIsActive); } - bool SessionInfo::supportsMediaControl() const { return m_supportsMediaControl; } + void SessionInfo::setSupportsMediaControl(bool newSupportsMediaControl) { m_supportsMediaControl = newSupportsMediaControl; - emit supportsMediaControlChanged(newSupportsMediaControl); } - bool SessionInfo::supportsRemoteControl() const { return m_supportsRemoteControl; } + void SessionInfo::setSupportsRemoteControl(bool newSupportsRemoteControl) { m_supportsRemoteControl = newSupportsRemoteControl; - emit supportsRemoteControlChanged(newSupportsRemoteControl); } +QList> SessionInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -QList SessionInfo::nowPlayingQueue() const { return m_nowPlayingQueue; } -void SessionInfo::setNowPlayingQueue(QList newNowPlayingQueue) { +void SessionInfo::setNowPlayingQueue(QList> newNowPlayingQueue) { m_nowPlayingQueue = newNowPlayingQueue; - emit nowPlayingQueueChanged(newNowPlayingQueue); } - bool SessionInfo::hasCustomDeviceName() const { return m_hasCustomDeviceName; } + void SessionInfo::setHasCustomDeviceName(bool newHasCustomDeviceName) { m_hasCustomDeviceName = newHasCustomDeviceName; - emit hasCustomDeviceNameChanged(newHasCustomDeviceName); } - QString SessionInfo::playlistItemId() const { return m_playlistItemId; } + void SessionInfo::setPlaylistItemId(QString newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } - QString SessionInfo::serverId() const { return m_serverId; } + void SessionInfo::setServerId(QString newServerId) { m_serverId = newServerId; - emit serverIdChanged(newServerId); } - QString SessionInfo::userPrimaryImageTag() const { return m_userPrimaryImageTag; } + void SessionInfo::setUserPrimaryImageTag(QString newUserPrimaryImageTag) { m_userPrimaryImageTag = newUserPrimaryImageTag; - emit userPrimaryImageTagChanged(newUserPrimaryImageTag); } - QList SessionInfo::supportedCommands() const { return m_supportedCommands; } + void SessionInfo::setSupportedCommands(QList newSupportedCommands) { m_supportedCommands = newSupportedCommands; - emit supportedCommandsChanged(newSupportedCommands); } diff --git a/core/src/DTO/sessionuserinfo.cpp b/core/src/DTO/sessionuserinfo.cpp index 6a4ab12..81f6474 100644 --- a/core/src/DTO/sessionuserinfo.cpp +++ b/core/src/DTO/sessionuserinfo.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -SessionUserInfo::SessionUserInfo(QObject *parent) : QObject(parent) {} +SessionUserInfo::SessionUserInfo(QObject *parent) {} -SessionUserInfo *SessionUserInfo::fromJSON(QJsonObject source, QObject *parent) { - SessionUserInfo *instance = new SessionUserInfo(parent); - instance->updateFromJSON(source); +SessionUserInfo SessionUserInfo::fromJson(QJsonObject source) {SessionUserInfo instance; + instance->setFromJson(source, false); return instance; } -void SessionUserInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SessionUserInfo::setFromJson(QJsonObject source) { + m_userId = fromJsonValue(source["UserId"]); + m_userName = fromJsonValue(source["UserName"]); + } -QJsonObject SessionUserInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SessionUserInfo::toJson() { QJsonObject result; + result["UserId"] = toJsonValue(m_userId); + result["UserName"] = toJsonValue(m_userName); + return result; } -QString SessionUserInfo::userId() const { return m_userId; } -void SessionUserInfo::setUserId(QString newUserId) { - m_userId = newUserId; - emit userIdChanged(newUserId); -} +QUuid SessionUserInfo::userId() const { return m_userId; } + +void SessionUserInfo::setUserId(QUuid newUserId) { + m_userId = newUserId; +} QString SessionUserInfo::userName() const { return m_userName; } + void SessionUserInfo::setUserName(QString newUserName) { m_userName = newUserName; - emit userNameChanged(newUserName); } diff --git a/core/src/DTO/setchannelmappingdto.cpp b/core/src/DTO/setchannelmappingdto.cpp index b919b52..8dfbe3f 100644 --- a/core/src/DTO/setchannelmappingdto.cpp +++ b/core/src/DTO/setchannelmappingdto.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -SetChannelMappingDto::SetChannelMappingDto(QObject *parent) : QObject(parent) {} +SetChannelMappingDto::SetChannelMappingDto(QObject *parent) {} -SetChannelMappingDto *SetChannelMappingDto::fromJSON(QJsonObject source, QObject *parent) { - SetChannelMappingDto *instance = new SetChannelMappingDto(parent); - instance->updateFromJSON(source); +SetChannelMappingDto SetChannelMappingDto::fromJson(QJsonObject source) {SetChannelMappingDto instance; + instance->setFromJson(source, false); return instance; } -void SetChannelMappingDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SetChannelMappingDto::setFromJson(QJsonObject source) { + m_providerId = fromJsonValue(source["ProviderId"]); + m_tunerChannelId = fromJsonValue(source["TunerChannelId"]); + m_providerChannelId = fromJsonValue(source["ProviderChannelId"]); + } -QJsonObject SetChannelMappingDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SetChannelMappingDto::toJson() { QJsonObject result; + result["ProviderId"] = toJsonValue(m_providerId); + result["TunerChannelId"] = toJsonValue(m_tunerChannelId); + result["ProviderChannelId"] = toJsonValue(m_providerChannelId); + return result; } + QString SetChannelMappingDto::providerId() const { return m_providerId; } + void SetChannelMappingDto::setProviderId(QString newProviderId) { m_providerId = newProviderId; - emit providerIdChanged(newProviderId); } - QString SetChannelMappingDto::tunerChannelId() const { return m_tunerChannelId; } + void SetChannelMappingDto::setTunerChannelId(QString newTunerChannelId) { m_tunerChannelId = newTunerChannelId; - emit tunerChannelIdChanged(newTunerChannelId); } - QString SetChannelMappingDto::providerChannelId() const { return m_providerChannelId; } + void SetChannelMappingDto::setProviderChannelId(QString newProviderChannelId) { m_providerChannelId = newProviderChannelId; - emit providerChannelIdChanged(newProviderChannelId); } diff --git a/core/src/DTO/setplaylistitemrequestdto.cpp b/core/src/DTO/setplaylistitemrequestdto.cpp index a20eb9d..d48ec1b 100644 --- a/core/src/DTO/setplaylistitemrequestdto.cpp +++ b/core/src/DTO/setplaylistitemrequestdto.cpp @@ -32,26 +32,30 @@ namespace Jellyfin { namespace DTO { -SetPlaylistItemRequestDto::SetPlaylistItemRequestDto(QObject *parent) : QObject(parent) {} +SetPlaylistItemRequestDto::SetPlaylistItemRequestDto(QObject *parent) {} -SetPlaylistItemRequestDto *SetPlaylistItemRequestDto::fromJSON(QJsonObject source, QObject *parent) { - SetPlaylistItemRequestDto *instance = new SetPlaylistItemRequestDto(parent); - instance->updateFromJSON(source); +SetPlaylistItemRequestDto SetPlaylistItemRequestDto::fromJson(QJsonObject source) {SetPlaylistItemRequestDto instance; + instance->setFromJson(source, false); return instance; } -void SetPlaylistItemRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SetPlaylistItemRequestDto::setFromJson(QJsonObject source) { + m_playlistItemId = fromJsonValue(source["PlaylistItemId"]); + } -QJsonObject SetPlaylistItemRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SetPlaylistItemRequestDto::toJson() { QJsonObject result; + result["PlaylistItemId"] = toJsonValue(m_playlistItemId); + return result; } -QString SetPlaylistItemRequestDto::playlistItemId() const { return m_playlistItemId; } -void SetPlaylistItemRequestDto::setPlaylistItemId(QString newPlaylistItemId) { + +QUuid SetPlaylistItemRequestDto::playlistItemId() const { return m_playlistItemId; } + +void SetPlaylistItemRequestDto::setPlaylistItemId(QUuid newPlaylistItemId) { m_playlistItemId = newPlaylistItemId; - emit playlistItemIdChanged(newPlaylistItemId); } diff --git a/core/src/DTO/setrepeatmoderequestdto.cpp b/core/src/DTO/setrepeatmoderequestdto.cpp index 6ae2022..3de03c8 100644 --- a/core/src/DTO/setrepeatmoderequestdto.cpp +++ b/core/src/DTO/setrepeatmoderequestdto.cpp @@ -29,31 +29,33 @@ #include -#include - namespace Jellyfin { namespace DTO { -SetRepeatModeRequestDto::SetRepeatModeRequestDto(QObject *parent) : QObject(parent) {} +SetRepeatModeRequestDto::SetRepeatModeRequestDto(QObject *parent) {} -SetRepeatModeRequestDto *SetRepeatModeRequestDto::fromJSON(QJsonObject source, QObject *parent) { - SetRepeatModeRequestDto *instance = new SetRepeatModeRequestDto(parent); - instance->updateFromJSON(source); +SetRepeatModeRequestDto SetRepeatModeRequestDto::fromJson(QJsonObject source) {SetRepeatModeRequestDto instance; + instance->setFromJson(source, false); return instance; } -void SetRepeatModeRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SetRepeatModeRequestDto::setFromJson(QJsonObject source) { + m_mode = fromJsonValue(source["Mode"]); + } -QJsonObject SetRepeatModeRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SetRepeatModeRequestDto::toJson() { QJsonObject result; + result["Mode"] = toJsonValue(m_mode); + return result; } + GroupRepeatMode SetRepeatModeRequestDto::mode() const { return m_mode; } + void SetRepeatModeRequestDto::setMode(GroupRepeatMode newMode) { m_mode = newMode; - emit modeChanged(newMode); } diff --git a/core/src/DTO/setshufflemoderequestdto.cpp b/core/src/DTO/setshufflemoderequestdto.cpp index 0b7d990..5285bfe 100644 --- a/core/src/DTO/setshufflemoderequestdto.cpp +++ b/core/src/DTO/setshufflemoderequestdto.cpp @@ -29,31 +29,33 @@ #include -#include - namespace Jellyfin { namespace DTO { -SetShuffleModeRequestDto::SetShuffleModeRequestDto(QObject *parent) : QObject(parent) {} +SetShuffleModeRequestDto::SetShuffleModeRequestDto(QObject *parent) {} -SetShuffleModeRequestDto *SetShuffleModeRequestDto::fromJSON(QJsonObject source, QObject *parent) { - SetShuffleModeRequestDto *instance = new SetShuffleModeRequestDto(parent); - instance->updateFromJSON(source); +SetShuffleModeRequestDto SetShuffleModeRequestDto::fromJson(QJsonObject source) {SetShuffleModeRequestDto instance; + instance->setFromJson(source, false); return instance; } -void SetShuffleModeRequestDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SetShuffleModeRequestDto::setFromJson(QJsonObject source) { + m_mode = fromJsonValue(source["Mode"]); + } -QJsonObject SetShuffleModeRequestDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SetShuffleModeRequestDto::toJson() { QJsonObject result; + result["Mode"] = toJsonValue(m_mode); + return result; } + GroupShuffleMode SetShuffleModeRequestDto::mode() const { return m_mode; } + void SetShuffleModeRequestDto::setMode(GroupShuffleMode newMode) { m_mode = newMode; - emit modeChanged(newMode); } diff --git a/core/src/DTO/songinfo.cpp b/core/src/DTO/songinfo.cpp index 1522b9a..d28ffa9 100644 --- a/core/src/DTO/songinfo.cpp +++ b/core/src/DTO/songinfo.cpp @@ -32,98 +32,114 @@ namespace Jellyfin { namespace DTO { -SongInfo::SongInfo(QObject *parent) : QObject(parent) {} +SongInfo::SongInfo(QObject *parent) {} -SongInfo *SongInfo::fromJSON(QJsonObject source, QObject *parent) { - SongInfo *instance = new SongInfo(parent); - instance->updateFromJSON(source); +SongInfo SongInfo::fromJson(QJsonObject source) {SongInfo instance; + instance->setFromJson(source, false); return instance; } -void SongInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SongInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + m_albumArtists = fromJsonValue(source["AlbumArtists"]); + m_album = fromJsonValue(source["Album"]); + m_artists = fromJsonValue(source["Artists"]); + } -QJsonObject SongInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SongInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + result["AlbumArtists"] = toJsonValue(m_albumArtists); + result["Album"] = toJsonValue(m_album); + result["Artists"] = toJsonValue(m_artists); + return result; } + QString SongInfo::name() const { return m_name; } + void SongInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString SongInfo::path() const { return m_path; } + void SongInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString SongInfo::metadataLanguage() const { return m_metadataLanguage; } + void SongInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString SongInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void SongInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject SongInfo::providerIds() const { return m_providerIds; } + void SongInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 SongInfo::year() const { return m_year; } + void SongInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 SongInfo::indexNumber() const { return m_indexNumber; } + void SongInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 SongInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void SongInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime SongInfo::premiereDate() const { return m_premiereDate; } + void SongInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool SongInfo::isAutomated() const { return m_isAutomated; } + void SongInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } - QStringList SongInfo::albumArtists() const { return m_albumArtists; } + void SongInfo::setAlbumArtists(QStringList newAlbumArtists) { m_albumArtists = newAlbumArtists; - emit albumArtistsChanged(newAlbumArtists); } - QString SongInfo::album() const { return m_album; } + void SongInfo::setAlbum(QString newAlbum) { m_album = newAlbum; - emit albumChanged(newAlbum); } - QStringList SongInfo::artists() const { return m_artists; } + void SongInfo::setArtists(QStringList newArtists) { m_artists = newArtists; - emit artistsChanged(newArtists); } diff --git a/core/src/DTO/specialviewoptiondto.cpp b/core/src/DTO/specialviewoptiondto.cpp index 9098c19..bb39a0f 100644 --- a/core/src/DTO/specialviewoptiondto.cpp +++ b/core/src/DTO/specialviewoptiondto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -SpecialViewOptionDto::SpecialViewOptionDto(QObject *parent) : QObject(parent) {} +SpecialViewOptionDto::SpecialViewOptionDto(QObject *parent) {} -SpecialViewOptionDto *SpecialViewOptionDto::fromJSON(QJsonObject source, QObject *parent) { - SpecialViewOptionDto *instance = new SpecialViewOptionDto(parent); - instance->updateFromJSON(source); +SpecialViewOptionDto SpecialViewOptionDto::fromJson(QJsonObject source) {SpecialViewOptionDto instance; + instance->setFromJson(source, false); return instance; } -void SpecialViewOptionDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SpecialViewOptionDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_jellyfinId = fromJsonValue(source["Id"]); + } -QJsonObject SpecialViewOptionDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SpecialViewOptionDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Id"] = toJsonValue(m_jellyfinId); + return result; } + QString SpecialViewOptionDto::name() const { return m_name; } + void SpecialViewOptionDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString SpecialViewOptionDto::jellyfinId() const { return m_jellyfinId; } + void SpecialViewOptionDto::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } diff --git a/core/src/DTO/startupconfigurationdto.cpp b/core/src/DTO/startupconfigurationdto.cpp index 368ee6d..2f4d0f3 100644 --- a/core/src/DTO/startupconfigurationdto.cpp +++ b/core/src/DTO/startupconfigurationdto.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -StartupConfigurationDto::StartupConfigurationDto(QObject *parent) : QObject(parent) {} +StartupConfigurationDto::StartupConfigurationDto(QObject *parent) {} -StartupConfigurationDto *StartupConfigurationDto::fromJSON(QJsonObject source, QObject *parent) { - StartupConfigurationDto *instance = new StartupConfigurationDto(parent); - instance->updateFromJSON(source); +StartupConfigurationDto StartupConfigurationDto::fromJson(QJsonObject source) {StartupConfigurationDto instance; + instance->setFromJson(source, false); return instance; } -void StartupConfigurationDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void StartupConfigurationDto::setFromJson(QJsonObject source) { + m_uICulture = fromJsonValue(source["UICulture"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_preferredMetadataLanguage = fromJsonValue(source["PreferredMetadataLanguage"]); + } -QJsonObject StartupConfigurationDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject StartupConfigurationDto::toJson() { QJsonObject result; + result["UICulture"] = toJsonValue(m_uICulture); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["PreferredMetadataLanguage"] = toJsonValue(m_preferredMetadataLanguage); + return result; } + QString StartupConfigurationDto::uICulture() const { return m_uICulture; } + void StartupConfigurationDto::setUICulture(QString newUICulture) { m_uICulture = newUICulture; - emit uICultureChanged(newUICulture); } - QString StartupConfigurationDto::metadataCountryCode() const { return m_metadataCountryCode; } + void StartupConfigurationDto::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QString StartupConfigurationDto::preferredMetadataLanguage() const { return m_preferredMetadataLanguage; } + void StartupConfigurationDto::setPreferredMetadataLanguage(QString newPreferredMetadataLanguage) { m_preferredMetadataLanguage = newPreferredMetadataLanguage; - emit preferredMetadataLanguageChanged(newPreferredMetadataLanguage); } diff --git a/core/src/DTO/startupremoteaccessdto.cpp b/core/src/DTO/startupremoteaccessdto.cpp index cbb78da..614d9da 100644 --- a/core/src/DTO/startupremoteaccessdto.cpp +++ b/core/src/DTO/startupremoteaccessdto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -StartupRemoteAccessDto::StartupRemoteAccessDto(QObject *parent) : QObject(parent) {} +StartupRemoteAccessDto::StartupRemoteAccessDto(QObject *parent) {} -StartupRemoteAccessDto *StartupRemoteAccessDto::fromJSON(QJsonObject source, QObject *parent) { - StartupRemoteAccessDto *instance = new StartupRemoteAccessDto(parent); - instance->updateFromJSON(source); +StartupRemoteAccessDto StartupRemoteAccessDto::fromJson(QJsonObject source) {StartupRemoteAccessDto instance; + instance->setFromJson(source, false); return instance; } -void StartupRemoteAccessDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void StartupRemoteAccessDto::setFromJson(QJsonObject source) { + m_enableRemoteAccess = fromJsonValue(source["EnableRemoteAccess"]); + m_enableAutomaticPortMapping = fromJsonValue(source["EnableAutomaticPortMapping"]); + } -QJsonObject StartupRemoteAccessDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject StartupRemoteAccessDto::toJson() { QJsonObject result; + result["EnableRemoteAccess"] = toJsonValue(m_enableRemoteAccess); + result["EnableAutomaticPortMapping"] = toJsonValue(m_enableAutomaticPortMapping); + return result; } + bool StartupRemoteAccessDto::enableRemoteAccess() const { return m_enableRemoteAccess; } + void StartupRemoteAccessDto::setEnableRemoteAccess(bool newEnableRemoteAccess) { m_enableRemoteAccess = newEnableRemoteAccess; - emit enableRemoteAccessChanged(newEnableRemoteAccess); } - bool StartupRemoteAccessDto::enableAutomaticPortMapping() const { return m_enableAutomaticPortMapping; } + void StartupRemoteAccessDto::setEnableAutomaticPortMapping(bool newEnableAutomaticPortMapping) { m_enableAutomaticPortMapping = newEnableAutomaticPortMapping; - emit enableAutomaticPortMappingChanged(newEnableAutomaticPortMapping); } diff --git a/core/src/DTO/startupuserdto.cpp b/core/src/DTO/startupuserdto.cpp index dcc6933..3fbcd19 100644 --- a/core/src/DTO/startupuserdto.cpp +++ b/core/src/DTO/startupuserdto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -StartupUserDto::StartupUserDto(QObject *parent) : QObject(parent) {} +StartupUserDto::StartupUserDto(QObject *parent) {} -StartupUserDto *StartupUserDto::fromJSON(QJsonObject source, QObject *parent) { - StartupUserDto *instance = new StartupUserDto(parent); - instance->updateFromJSON(source); +StartupUserDto StartupUserDto::fromJson(QJsonObject source) {StartupUserDto instance; + instance->setFromJson(source, false); return instance; } -void StartupUserDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void StartupUserDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_password = fromJsonValue(source["Password"]); + } -QJsonObject StartupUserDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject StartupUserDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Password"] = toJsonValue(m_password); + return result; } + QString StartupUserDto::name() const { return m_name; } + void StartupUserDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString StartupUserDto::password() const { return m_password; } + void StartupUserDto::setPassword(QString newPassword) { m_password = newPassword; - emit passwordChanged(newPassword); } diff --git a/core/src/DTO/subtitleprofile.cpp b/core/src/DTO/subtitleprofile.cpp index 70e895f..7eb43fb 100644 --- a/core/src/DTO/subtitleprofile.cpp +++ b/core/src/DTO/subtitleprofile.cpp @@ -29,55 +29,61 @@ #include -#include - namespace Jellyfin { namespace DTO { -SubtitleProfile::SubtitleProfile(QObject *parent) : QObject(parent) {} +SubtitleProfile::SubtitleProfile(QObject *parent) {} -SubtitleProfile *SubtitleProfile::fromJSON(QJsonObject source, QObject *parent) { - SubtitleProfile *instance = new SubtitleProfile(parent); - instance->updateFromJSON(source); +SubtitleProfile SubtitleProfile::fromJson(QJsonObject source) {SubtitleProfile instance; + instance->setFromJson(source, false); return instance; } -void SubtitleProfile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SubtitleProfile::setFromJson(QJsonObject source) { + m_format = fromJsonValue(source["Format"]); + m_method = fromJsonValue(source["Method"]); + m_didlMode = fromJsonValue(source["DidlMode"]); + m_language = fromJsonValue(source["Language"]); + m_container = fromJsonValue(source["Container"]); + } -QJsonObject SubtitleProfile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SubtitleProfile::toJson() { QJsonObject result; + result["Format"] = toJsonValue(m_format); + result["Method"] = toJsonValue(m_method); + result["DidlMode"] = toJsonValue(m_didlMode); + result["Language"] = toJsonValue(m_language); + result["Container"] = toJsonValue(m_container); + return result; } + QString SubtitleProfile::format() const { return m_format; } + void SubtitleProfile::setFormat(QString newFormat) { m_format = newFormat; - emit formatChanged(newFormat); } - SubtitleDeliveryMethod SubtitleProfile::method() const { return m_method; } + void SubtitleProfile::setMethod(SubtitleDeliveryMethod newMethod) { m_method = newMethod; - emit methodChanged(newMethod); } - QString SubtitleProfile::didlMode() const { return m_didlMode; } + void SubtitleProfile::setDidlMode(QString newDidlMode) { m_didlMode = newDidlMode; - emit didlModeChanged(newDidlMode); } - QString SubtitleProfile::language() const { return m_language; } + void SubtitleProfile::setLanguage(QString newLanguage) { m_language = newLanguage; - emit languageChanged(newLanguage); } - QString SubtitleProfile::container() const { return m_container; } + void SubtitleProfile::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } diff --git a/core/src/DTO/systeminfo.cpp b/core/src/DTO/systeminfo.cpp index c814c36..de8f45e 100644 --- a/core/src/DTO/systeminfo.cpp +++ b/core/src/DTO/systeminfo.cpp @@ -29,182 +29,208 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -SystemInfo::SystemInfo(QObject *parent) : QObject(parent) {} +SystemInfo::SystemInfo(QObject *parent) {} -SystemInfo *SystemInfo::fromJSON(QJsonObject source, QObject *parent) { - SystemInfo *instance = new SystemInfo(parent); - instance->updateFromJSON(source); +SystemInfo SystemInfo::fromJson(QJsonObject source) {SystemInfo instance; + instance->setFromJson(source, false); return instance; } -void SystemInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void SystemInfo::setFromJson(QJsonObject source) { + m_localAddress = fromJsonValue(source["LocalAddress"]); + m_serverName = fromJsonValue(source["ServerName"]); + m_version = fromJsonValue(source["Version"]); + m_productName = fromJsonValue(source["ProductName"]); + m_operatingSystem = fromJsonValue(source["OperatingSystem"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_startupWizardCompleted = fromJsonValue(source["StartupWizardCompleted"]); + m_operatingSystemDisplayName = fromJsonValue(source["OperatingSystemDisplayName"]); + m_packageName = fromJsonValue(source["PackageName"]); + m_hasPendingRestart = fromJsonValue(source["HasPendingRestart"]); + m_isShuttingDown = fromJsonValue(source["IsShuttingDown"]); + m_supportsLibraryMonitor = fromJsonValue(source["SupportsLibraryMonitor"]); + m_webSocketPortNumber = fromJsonValue(source["WebSocketPortNumber"]); + m_completedInstallations = fromJsonValue>>(source["CompletedInstallations"]); + m_canSelfRestart = fromJsonValue(source["CanSelfRestart"]); + m_canLaunchWebBrowser = fromJsonValue(source["CanLaunchWebBrowser"]); + m_programDataPath = fromJsonValue(source["ProgramDataPath"]); + m_webPath = fromJsonValue(source["WebPath"]); + m_itemsByNamePath = fromJsonValue(source["ItemsByNamePath"]); + m_cachePath = fromJsonValue(source["CachePath"]); + m_logPath = fromJsonValue(source["LogPath"]); + m_internalMetadataPath = fromJsonValue(source["InternalMetadataPath"]); + m_transcodingTempPath = fromJsonValue(source["TranscodingTempPath"]); + m_hasUpdateAvailable = fromJsonValue(source["HasUpdateAvailable"]); + m_encoderLocation = fromJsonValue(source["EncoderLocation"]); + m_systemArchitecture = fromJsonValue(source["SystemArchitecture"]); + } -QJsonObject SystemInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject SystemInfo::toJson() { QJsonObject result; + result["LocalAddress"] = toJsonValue(m_localAddress); + result["ServerName"] = toJsonValue(m_serverName); + result["Version"] = toJsonValue(m_version); + result["ProductName"] = toJsonValue(m_productName); + result["OperatingSystem"] = toJsonValue(m_operatingSystem); + result["Id"] = toJsonValue(m_jellyfinId); + result["StartupWizardCompleted"] = toJsonValue(m_startupWizardCompleted); + result["OperatingSystemDisplayName"] = toJsonValue(m_operatingSystemDisplayName); + result["PackageName"] = toJsonValue(m_packageName); + result["HasPendingRestart"] = toJsonValue(m_hasPendingRestart); + result["IsShuttingDown"] = toJsonValue(m_isShuttingDown); + result["SupportsLibraryMonitor"] = toJsonValue(m_supportsLibraryMonitor); + result["WebSocketPortNumber"] = toJsonValue(m_webSocketPortNumber); + result["CompletedInstallations"] = toJsonValue>>(m_completedInstallations); + result["CanSelfRestart"] = toJsonValue(m_canSelfRestart); + result["CanLaunchWebBrowser"] = toJsonValue(m_canLaunchWebBrowser); + result["ProgramDataPath"] = toJsonValue(m_programDataPath); + result["WebPath"] = toJsonValue(m_webPath); + result["ItemsByNamePath"] = toJsonValue(m_itemsByNamePath); + result["CachePath"] = toJsonValue(m_cachePath); + result["LogPath"] = toJsonValue(m_logPath); + result["InternalMetadataPath"] = toJsonValue(m_internalMetadataPath); + result["TranscodingTempPath"] = toJsonValue(m_transcodingTempPath); + result["HasUpdateAvailable"] = toJsonValue(m_hasUpdateAvailable); + result["EncoderLocation"] = toJsonValue(m_encoderLocation); + result["SystemArchitecture"] = toJsonValue(m_systemArchitecture); + return result; } + QString SystemInfo::localAddress() const { return m_localAddress; } + void SystemInfo::setLocalAddress(QString newLocalAddress) { m_localAddress = newLocalAddress; - emit localAddressChanged(newLocalAddress); } - QString SystemInfo::serverName() const { return m_serverName; } + void SystemInfo::setServerName(QString newServerName) { m_serverName = newServerName; - emit serverNameChanged(newServerName); } - QString SystemInfo::version() const { return m_version; } + void SystemInfo::setVersion(QString newVersion) { m_version = newVersion; - emit versionChanged(newVersion); } - QString SystemInfo::productName() const { return m_productName; } + void SystemInfo::setProductName(QString newProductName) { m_productName = newProductName; - emit productNameChanged(newProductName); } - QString SystemInfo::operatingSystem() const { return m_operatingSystem; } + void SystemInfo::setOperatingSystem(QString newOperatingSystem) { m_operatingSystem = newOperatingSystem; - emit operatingSystemChanged(newOperatingSystem); } - QString SystemInfo::jellyfinId() const { return m_jellyfinId; } + void SystemInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - bool SystemInfo::startupWizardCompleted() const { return m_startupWizardCompleted; } + void SystemInfo::setStartupWizardCompleted(bool newStartupWizardCompleted) { m_startupWizardCompleted = newStartupWizardCompleted; - emit startupWizardCompletedChanged(newStartupWizardCompleted); } - QString SystemInfo::operatingSystemDisplayName() const { return m_operatingSystemDisplayName; } + void SystemInfo::setOperatingSystemDisplayName(QString newOperatingSystemDisplayName) { m_operatingSystemDisplayName = newOperatingSystemDisplayName; - emit operatingSystemDisplayNameChanged(newOperatingSystemDisplayName); } - QString SystemInfo::packageName() const { return m_packageName; } + void SystemInfo::setPackageName(QString newPackageName) { m_packageName = newPackageName; - emit packageNameChanged(newPackageName); } - bool SystemInfo::hasPendingRestart() const { return m_hasPendingRestart; } + void SystemInfo::setHasPendingRestart(bool newHasPendingRestart) { m_hasPendingRestart = newHasPendingRestart; - emit hasPendingRestartChanged(newHasPendingRestart); } - bool SystemInfo::isShuttingDown() const { return m_isShuttingDown; } + void SystemInfo::setIsShuttingDown(bool newIsShuttingDown) { m_isShuttingDown = newIsShuttingDown; - emit isShuttingDownChanged(newIsShuttingDown); } - bool SystemInfo::supportsLibraryMonitor() const { return m_supportsLibraryMonitor; } + void SystemInfo::setSupportsLibraryMonitor(bool newSupportsLibraryMonitor) { m_supportsLibraryMonitor = newSupportsLibraryMonitor; - emit supportsLibraryMonitorChanged(newSupportsLibraryMonitor); } - qint32 SystemInfo::webSocketPortNumber() const { return m_webSocketPortNumber; } + void SystemInfo::setWebSocketPortNumber(qint32 newWebSocketPortNumber) { m_webSocketPortNumber = newWebSocketPortNumber; - emit webSocketPortNumberChanged(newWebSocketPortNumber); } +QList> SystemInfo::completedInstallations() const { return m_completedInstallations; } -QList SystemInfo::completedInstallations() const { return m_completedInstallations; } -void SystemInfo::setCompletedInstallations(QList newCompletedInstallations) { +void SystemInfo::setCompletedInstallations(QList> newCompletedInstallations) { m_completedInstallations = newCompletedInstallations; - emit completedInstallationsChanged(newCompletedInstallations); } - bool SystemInfo::canSelfRestart() const { return m_canSelfRestart; } + void SystemInfo::setCanSelfRestart(bool newCanSelfRestart) { m_canSelfRestart = newCanSelfRestart; - emit canSelfRestartChanged(newCanSelfRestart); } - bool SystemInfo::canLaunchWebBrowser() const { return m_canLaunchWebBrowser; } + void SystemInfo::setCanLaunchWebBrowser(bool newCanLaunchWebBrowser) { m_canLaunchWebBrowser = newCanLaunchWebBrowser; - emit canLaunchWebBrowserChanged(newCanLaunchWebBrowser); } - QString SystemInfo::programDataPath() const { return m_programDataPath; } + void SystemInfo::setProgramDataPath(QString newProgramDataPath) { m_programDataPath = newProgramDataPath; - emit programDataPathChanged(newProgramDataPath); } - QString SystemInfo::webPath() const { return m_webPath; } + void SystemInfo::setWebPath(QString newWebPath) { m_webPath = newWebPath; - emit webPathChanged(newWebPath); } - QString SystemInfo::itemsByNamePath() const { return m_itemsByNamePath; } + void SystemInfo::setItemsByNamePath(QString newItemsByNamePath) { m_itemsByNamePath = newItemsByNamePath; - emit itemsByNamePathChanged(newItemsByNamePath); } - QString SystemInfo::cachePath() const { return m_cachePath; } + void SystemInfo::setCachePath(QString newCachePath) { m_cachePath = newCachePath; - emit cachePathChanged(newCachePath); } - QString SystemInfo::logPath() const { return m_logPath; } + void SystemInfo::setLogPath(QString newLogPath) { m_logPath = newLogPath; - emit logPathChanged(newLogPath); } - QString SystemInfo::internalMetadataPath() const { return m_internalMetadataPath; } + void SystemInfo::setInternalMetadataPath(QString newInternalMetadataPath) { m_internalMetadataPath = newInternalMetadataPath; - emit internalMetadataPathChanged(newInternalMetadataPath); } - QString SystemInfo::transcodingTempPath() const { return m_transcodingTempPath; } + void SystemInfo::setTranscodingTempPath(QString newTranscodingTempPath) { m_transcodingTempPath = newTranscodingTempPath; - emit transcodingTempPathChanged(newTranscodingTempPath); } - bool SystemInfo::hasUpdateAvailable() const { return m_hasUpdateAvailable; } + void SystemInfo::setHasUpdateAvailable(bool newHasUpdateAvailable) { m_hasUpdateAvailable = newHasUpdateAvailable; - emit hasUpdateAvailableChanged(newHasUpdateAvailable); } - FFmpegLocation SystemInfo::encoderLocation() const { return m_encoderLocation; } + void SystemInfo::setEncoderLocation(FFmpegLocation newEncoderLocation) { m_encoderLocation = newEncoderLocation; - emit encoderLocationChanged(newEncoderLocation); } - Architecture SystemInfo::systemArchitecture() const { return m_systemArchitecture; } + void SystemInfo::setSystemArchitecture(Architecture newSystemArchitecture) { m_systemArchitecture = newSystemArchitecture; - emit systemArchitectureChanged(newSystemArchitecture); } diff --git a/core/src/DTO/taskinfo.cpp b/core/src/DTO/taskinfo.cpp index d402d29..e3e4267 100644 --- a/core/src/DTO/taskinfo.cpp +++ b/core/src/DTO/taskinfo.cpp @@ -29,85 +29,96 @@ #include -#include - namespace Jellyfin { namespace DTO { -TaskInfo::TaskInfo(QObject *parent) : QObject(parent) {} +TaskInfo::TaskInfo(QObject *parent) {} -TaskInfo *TaskInfo::fromJSON(QJsonObject source, QObject *parent) { - TaskInfo *instance = new TaskInfo(parent); - instance->updateFromJSON(source); +TaskInfo TaskInfo::fromJson(QJsonObject source) {TaskInfo instance; + instance->setFromJson(source, false); return instance; } -void TaskInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TaskInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_state = fromJsonValue(source["State"]); + m_currentProgressPercentage = fromJsonValue(source["CurrentProgressPercentage"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_lastExecutionResult = fromJsonValue>(source["LastExecutionResult"]); + m_triggers = fromJsonValue>>(source["Triggers"]); + m_description = fromJsonValue(source["Description"]); + m_category = fromJsonValue(source["Category"]); + m_isHidden = fromJsonValue(source["IsHidden"]); + m_key = fromJsonValue(source["Key"]); + } -QJsonObject TaskInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TaskInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["State"] = toJsonValue(m_state); + result["CurrentProgressPercentage"] = toJsonValue(m_currentProgressPercentage); + result["Id"] = toJsonValue(m_jellyfinId); + result["LastExecutionResult"] = toJsonValue>(m_lastExecutionResult); + result["Triggers"] = toJsonValue>>(m_triggers); + result["Description"] = toJsonValue(m_description); + result["Category"] = toJsonValue(m_category); + result["IsHidden"] = toJsonValue(m_isHidden); + result["Key"] = toJsonValue(m_key); + return result; } + QString TaskInfo::name() const { return m_name; } + void TaskInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - TaskState TaskInfo::state() const { return m_state; } + void TaskInfo::setState(TaskState newState) { m_state = newState; - emit stateChanged(newState); } - double TaskInfo::currentProgressPercentage() const { return m_currentProgressPercentage; } + void TaskInfo::setCurrentProgressPercentage(double newCurrentProgressPercentage) { m_currentProgressPercentage = newCurrentProgressPercentage; - emit currentProgressPercentageChanged(newCurrentProgressPercentage); } - QString TaskInfo::jellyfinId() const { return m_jellyfinId; } + void TaskInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } +QSharedPointer TaskInfo::lastExecutionResult() const { return m_lastExecutionResult; } -TaskResult * TaskInfo::lastExecutionResult() const { return m_lastExecutionResult; } -void TaskInfo::setLastExecutionResult(TaskResult * newLastExecutionResult) { +void TaskInfo::setLastExecutionResult(QSharedPointer newLastExecutionResult) { m_lastExecutionResult = newLastExecutionResult; - emit lastExecutionResultChanged(newLastExecutionResult); } +QList> TaskInfo::triggers() const { return m_triggers; } -QList TaskInfo::triggers() const { return m_triggers; } -void TaskInfo::setTriggers(QList newTriggers) { +void TaskInfo::setTriggers(QList> newTriggers) { m_triggers = newTriggers; - emit triggersChanged(newTriggers); } - QString TaskInfo::description() const { return m_description; } + void TaskInfo::setDescription(QString newDescription) { m_description = newDescription; - emit descriptionChanged(newDescription); } - QString TaskInfo::category() const { return m_category; } + void TaskInfo::setCategory(QString newCategory) { m_category = newCategory; - emit categoryChanged(newCategory); } - bool TaskInfo::isHidden() const { return m_isHidden; } + void TaskInfo::setIsHidden(bool newIsHidden) { m_isHidden = newIsHidden; - emit isHiddenChanged(newIsHidden); } - QString TaskInfo::key() const { return m_key; } + void TaskInfo::setKey(QString newKey) { m_key = newKey; - emit keyChanged(newKey); } diff --git a/core/src/DTO/taskresult.cpp b/core/src/DTO/taskresult.cpp index be25f93..d9ffc0d 100644 --- a/core/src/DTO/taskresult.cpp +++ b/core/src/DTO/taskresult.cpp @@ -29,73 +29,82 @@ #include -#include - namespace Jellyfin { namespace DTO { -TaskResult::TaskResult(QObject *parent) : QObject(parent) {} +TaskResult::TaskResult(QObject *parent) {} -TaskResult *TaskResult::fromJSON(QJsonObject source, QObject *parent) { - TaskResult *instance = new TaskResult(parent); - instance->updateFromJSON(source); +TaskResult TaskResult::fromJson(QJsonObject source) {TaskResult instance; + instance->setFromJson(source, false); return instance; } -void TaskResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TaskResult::setFromJson(QJsonObject source) { + m_startTimeUtc = fromJsonValue(source["StartTimeUtc"]); + m_endTimeUtc = fromJsonValue(source["EndTimeUtc"]); + m_status = fromJsonValue(source["Status"]); + m_name = fromJsonValue(source["Name"]); + m_key = fromJsonValue(source["Key"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_errorMessage = fromJsonValue(source["ErrorMessage"]); + m_longErrorMessage = fromJsonValue(source["LongErrorMessage"]); + } -QJsonObject TaskResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TaskResult::toJson() { QJsonObject result; + result["StartTimeUtc"] = toJsonValue(m_startTimeUtc); + result["EndTimeUtc"] = toJsonValue(m_endTimeUtc); + result["Status"] = toJsonValue(m_status); + result["Name"] = toJsonValue(m_name); + result["Key"] = toJsonValue(m_key); + result["Id"] = toJsonValue(m_jellyfinId); + result["ErrorMessage"] = toJsonValue(m_errorMessage); + result["LongErrorMessage"] = toJsonValue(m_longErrorMessage); + return result; } + QDateTime TaskResult::startTimeUtc() const { return m_startTimeUtc; } + void TaskResult::setStartTimeUtc(QDateTime newStartTimeUtc) { m_startTimeUtc = newStartTimeUtc; - emit startTimeUtcChanged(newStartTimeUtc); } - QDateTime TaskResult::endTimeUtc() const { return m_endTimeUtc; } + void TaskResult::setEndTimeUtc(QDateTime newEndTimeUtc) { m_endTimeUtc = newEndTimeUtc; - emit endTimeUtcChanged(newEndTimeUtc); } - TaskCompletionStatus TaskResult::status() const { return m_status; } + void TaskResult::setStatus(TaskCompletionStatus newStatus) { m_status = newStatus; - emit statusChanged(newStatus); } - QString TaskResult::name() const { return m_name; } + void TaskResult::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString TaskResult::key() const { return m_key; } + void TaskResult::setKey(QString newKey) { m_key = newKey; - emit keyChanged(newKey); } - QString TaskResult::jellyfinId() const { return m_jellyfinId; } + void TaskResult::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString TaskResult::errorMessage() const { return m_errorMessage; } + void TaskResult::setErrorMessage(QString newErrorMessage) { m_errorMessage = newErrorMessage; - emit errorMessageChanged(newErrorMessage); } - QString TaskResult::longErrorMessage() const { return m_longErrorMessage; } + void TaskResult::setLongErrorMessage(QString newLongErrorMessage) { m_longErrorMessage = newLongErrorMessage; - emit longErrorMessageChanged(newLongErrorMessage); } diff --git a/core/src/DTO/tasktriggerinfo.cpp b/core/src/DTO/tasktriggerinfo.cpp index 03756f5..bb122dc 100644 --- a/core/src/DTO/tasktriggerinfo.cpp +++ b/core/src/DTO/tasktriggerinfo.cpp @@ -29,55 +29,61 @@ #include -#include - namespace Jellyfin { namespace DTO { -TaskTriggerInfo::TaskTriggerInfo(QObject *parent) : QObject(parent) {} +TaskTriggerInfo::TaskTriggerInfo(QObject *parent) {} -TaskTriggerInfo *TaskTriggerInfo::fromJSON(QJsonObject source, QObject *parent) { - TaskTriggerInfo *instance = new TaskTriggerInfo(parent); - instance->updateFromJSON(source); +TaskTriggerInfo TaskTriggerInfo::fromJson(QJsonObject source) {TaskTriggerInfo instance; + instance->setFromJson(source, false); return instance; } -void TaskTriggerInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TaskTriggerInfo::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["Type"]); + m_timeOfDayTicks = fromJsonValue(source["TimeOfDayTicks"]); + m_intervalTicks = fromJsonValue(source["IntervalTicks"]); + m_dayOfWeek = fromJsonValue(source["DayOfWeek"]); + m_maxRuntimeTicks = fromJsonValue(source["MaxRuntimeTicks"]); + } -QJsonObject TaskTriggerInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TaskTriggerInfo::toJson() { QJsonObject result; + result["Type"] = toJsonValue(m_type); + result["TimeOfDayTicks"] = toJsonValue(m_timeOfDayTicks); + result["IntervalTicks"] = toJsonValue(m_intervalTicks); + result["DayOfWeek"] = toJsonValue(m_dayOfWeek); + result["MaxRuntimeTicks"] = toJsonValue(m_maxRuntimeTicks); + return result; } + QString TaskTriggerInfo::type() const { return m_type; } + void TaskTriggerInfo::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - qint64 TaskTriggerInfo::timeOfDayTicks() const { return m_timeOfDayTicks; } + void TaskTriggerInfo::setTimeOfDayTicks(qint64 newTimeOfDayTicks) { m_timeOfDayTicks = newTimeOfDayTicks; - emit timeOfDayTicksChanged(newTimeOfDayTicks); } - qint64 TaskTriggerInfo::intervalTicks() const { return m_intervalTicks; } + void TaskTriggerInfo::setIntervalTicks(qint64 newIntervalTicks) { m_intervalTicks = newIntervalTicks; - emit intervalTicksChanged(newIntervalTicks); } - DayOfWeek TaskTriggerInfo::dayOfWeek() const { return m_dayOfWeek; } + void TaskTriggerInfo::setDayOfWeek(DayOfWeek newDayOfWeek) { m_dayOfWeek = newDayOfWeek; - emit dayOfWeekChanged(newDayOfWeek); } - qint64 TaskTriggerInfo::maxRuntimeTicks() const { return m_maxRuntimeTicks; } + void TaskTriggerInfo::setMaxRuntimeTicks(qint64 newMaxRuntimeTicks) { m_maxRuntimeTicks = newMaxRuntimeTicks; - emit maxRuntimeTicksChanged(newMaxRuntimeTicks); } diff --git a/core/src/DTO/thememediaresult.cpp b/core/src/DTO/thememediaresult.cpp index ddc16b4..222c07c 100644 --- a/core/src/DTO/thememediaresult.cpp +++ b/core/src/DTO/thememediaresult.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -ThemeMediaResult::ThemeMediaResult(QObject *parent) : QObject(parent) {} +ThemeMediaResult::ThemeMediaResult(QObject *parent) {} -ThemeMediaResult *ThemeMediaResult::fromJSON(QJsonObject source, QObject *parent) { - ThemeMediaResult *instance = new ThemeMediaResult(parent); - instance->updateFromJSON(source); +ThemeMediaResult ThemeMediaResult::fromJson(QJsonObject source) {ThemeMediaResult instance; + instance->setFromJson(source, false); return instance; } -void ThemeMediaResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ThemeMediaResult::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + m_ownerId = fromJsonValue(source["OwnerId"]); + } -QJsonObject ThemeMediaResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ThemeMediaResult::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["StartIndex"] = toJsonValue(m_startIndex); + result["OwnerId"] = toJsonValue(m_ownerId); + return result; } -QList ThemeMediaResult::items() const { return m_items; } -void ThemeMediaResult::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> ThemeMediaResult::items() const { return m_items; } + +void ThemeMediaResult::setItems(QList> newItems) { + m_items = newItems; +} qint32 ThemeMediaResult::totalRecordCount() const { return m_totalRecordCount; } + void ThemeMediaResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - qint32 ThemeMediaResult::startIndex() const { return m_startIndex; } + void ThemeMediaResult::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } +QUuid ThemeMediaResult::ownerId() const { return m_ownerId; } -QString ThemeMediaResult::ownerId() const { return m_ownerId; } -void ThemeMediaResult::setOwnerId(QString newOwnerId) { +void ThemeMediaResult::setOwnerId(QUuid newOwnerId) { m_ownerId = newOwnerId; - emit ownerIdChanged(newOwnerId); } diff --git a/core/src/DTO/timereventinfo.cpp b/core/src/DTO/timereventinfo.cpp index bbe86de..3477444 100644 --- a/core/src/DTO/timereventinfo.cpp +++ b/core/src/DTO/timereventinfo.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -TimerEventInfo::TimerEventInfo(QObject *parent) : QObject(parent) {} +TimerEventInfo::TimerEventInfo(QObject *parent) {} -TimerEventInfo *TimerEventInfo::fromJSON(QJsonObject source, QObject *parent) { - TimerEventInfo *instance = new TimerEventInfo(parent); - instance->updateFromJSON(source); +TimerEventInfo TimerEventInfo::fromJson(QJsonObject source) {TimerEventInfo instance; + instance->setFromJson(source, false); return instance; } -void TimerEventInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TimerEventInfo::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_programId = fromJsonValue(source["ProgramId"]); + } -QJsonObject TimerEventInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TimerEventInfo::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["ProgramId"] = toJsonValue(m_programId); + return result; } + QString TimerEventInfo::jellyfinId() const { return m_jellyfinId; } + void TimerEventInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } +QUuid TimerEventInfo::programId() const { return m_programId; } -QString TimerEventInfo::programId() const { return m_programId; } -void TimerEventInfo::setProgramId(QString newProgramId) { +void TimerEventInfo::setProgramId(QUuid newProgramId) { m_programId = newProgramId; - emit programIdChanged(newProgramId); } diff --git a/core/src/DTO/timerinfodto.cpp b/core/src/DTO/timerinfodto.cpp index 566e0be..824098b 100644 --- a/core/src/DTO/timerinfodto.cpp +++ b/core/src/DTO/timerinfodto.cpp @@ -29,194 +29,222 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -TimerInfoDto::TimerInfoDto(QObject *parent) : QObject(parent) {} +TimerInfoDto::TimerInfoDto(QObject *parent) {} -TimerInfoDto *TimerInfoDto::fromJSON(QJsonObject source, QObject *parent) { - TimerInfoDto *instance = new TimerInfoDto(parent); - instance->updateFromJSON(source); +TimerInfoDto TimerInfoDto::fromJson(QJsonObject source) {TimerInfoDto instance; + instance->setFromJson(source, false); return instance; } -void TimerInfoDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TimerInfoDto::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_type = fromJsonValue(source["Type"]); + m_serverId = fromJsonValue(source["ServerId"]); + m_externalId = fromJsonValue(source["ExternalId"]); + m_channelId = fromJsonValue(source["ChannelId"]); + m_externalChannelId = fromJsonValue(source["ExternalChannelId"]); + m_channelName = fromJsonValue(source["ChannelName"]); + m_channelPrimaryImageTag = fromJsonValue(source["ChannelPrimaryImageTag"]); + m_programId = fromJsonValue(source["ProgramId"]); + m_externalProgramId = fromJsonValue(source["ExternalProgramId"]); + m_name = fromJsonValue(source["Name"]); + m_overview = fromJsonValue(source["Overview"]); + m_startDate = fromJsonValue(source["StartDate"]); + m_endDate = fromJsonValue(source["EndDate"]); + m_serviceName = fromJsonValue(source["ServiceName"]); + m_priority = fromJsonValue(source["Priority"]); + m_prePaddingSeconds = fromJsonValue(source["PrePaddingSeconds"]); + m_postPaddingSeconds = fromJsonValue(source["PostPaddingSeconds"]); + m_isPrePaddingRequired = fromJsonValue(source["IsPrePaddingRequired"]); + m_parentBackdropItemId = fromJsonValue(source["ParentBackdropItemId"]); + m_parentBackdropImageTags = fromJsonValue(source["ParentBackdropImageTags"]); + m_isPostPaddingRequired = fromJsonValue(source["IsPostPaddingRequired"]); + m_keepUntil = fromJsonValue(source["KeepUntil"]); + m_status = fromJsonValue(source["Status"]); + m_seriesTimerId = fromJsonValue(source["SeriesTimerId"]); + m_externalSeriesTimerId = fromJsonValue(source["ExternalSeriesTimerId"]); + m_runTimeTicks = fromJsonValue(source["RunTimeTicks"]); + m_programInfo = fromJsonValue>(source["ProgramInfo"]); + } -QJsonObject TimerInfoDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TimerInfoDto::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["Type"] = toJsonValue(m_type); + result["ServerId"] = toJsonValue(m_serverId); + result["ExternalId"] = toJsonValue(m_externalId); + result["ChannelId"] = toJsonValue(m_channelId); + result["ExternalChannelId"] = toJsonValue(m_externalChannelId); + result["ChannelName"] = toJsonValue(m_channelName); + result["ChannelPrimaryImageTag"] = toJsonValue(m_channelPrimaryImageTag); + result["ProgramId"] = toJsonValue(m_programId); + result["ExternalProgramId"] = toJsonValue(m_externalProgramId); + result["Name"] = toJsonValue(m_name); + result["Overview"] = toJsonValue(m_overview); + result["StartDate"] = toJsonValue(m_startDate); + result["EndDate"] = toJsonValue(m_endDate); + result["ServiceName"] = toJsonValue(m_serviceName); + result["Priority"] = toJsonValue(m_priority); + result["PrePaddingSeconds"] = toJsonValue(m_prePaddingSeconds); + result["PostPaddingSeconds"] = toJsonValue(m_postPaddingSeconds); + result["IsPrePaddingRequired"] = toJsonValue(m_isPrePaddingRequired); + result["ParentBackdropItemId"] = toJsonValue(m_parentBackdropItemId); + result["ParentBackdropImageTags"] = toJsonValue(m_parentBackdropImageTags); + result["IsPostPaddingRequired"] = toJsonValue(m_isPostPaddingRequired); + result["KeepUntil"] = toJsonValue(m_keepUntil); + result["Status"] = toJsonValue(m_status); + result["SeriesTimerId"] = toJsonValue(m_seriesTimerId); + result["ExternalSeriesTimerId"] = toJsonValue(m_externalSeriesTimerId); + result["RunTimeTicks"] = toJsonValue(m_runTimeTicks); + result["ProgramInfo"] = toJsonValue>(m_programInfo); + return result; } + QString TimerInfoDto::jellyfinId() const { return m_jellyfinId; } + void TimerInfoDto::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString TimerInfoDto::type() const { return m_type; } + void TimerInfoDto::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString TimerInfoDto::serverId() const { return m_serverId; } + void TimerInfoDto::setServerId(QString newServerId) { m_serverId = newServerId; - emit serverIdChanged(newServerId); } - QString TimerInfoDto::externalId() const { return m_externalId; } + void TimerInfoDto::setExternalId(QString newExternalId) { m_externalId = newExternalId; - emit externalIdChanged(newExternalId); } +QUuid TimerInfoDto::channelId() const { return m_channelId; } -QString TimerInfoDto::channelId() const { return m_channelId; } -void TimerInfoDto::setChannelId(QString newChannelId) { +void TimerInfoDto::setChannelId(QUuid newChannelId) { m_channelId = newChannelId; - emit channelIdChanged(newChannelId); } - QString TimerInfoDto::externalChannelId() const { return m_externalChannelId; } + void TimerInfoDto::setExternalChannelId(QString newExternalChannelId) { m_externalChannelId = newExternalChannelId; - emit externalChannelIdChanged(newExternalChannelId); } - QString TimerInfoDto::channelName() const { return m_channelName; } + void TimerInfoDto::setChannelName(QString newChannelName) { m_channelName = newChannelName; - emit channelNameChanged(newChannelName); } - QString TimerInfoDto::channelPrimaryImageTag() const { return m_channelPrimaryImageTag; } + void TimerInfoDto::setChannelPrimaryImageTag(QString newChannelPrimaryImageTag) { m_channelPrimaryImageTag = newChannelPrimaryImageTag; - emit channelPrimaryImageTagChanged(newChannelPrimaryImageTag); } - QString TimerInfoDto::programId() const { return m_programId; } + void TimerInfoDto::setProgramId(QString newProgramId) { m_programId = newProgramId; - emit programIdChanged(newProgramId); } - QString TimerInfoDto::externalProgramId() const { return m_externalProgramId; } + void TimerInfoDto::setExternalProgramId(QString newExternalProgramId) { m_externalProgramId = newExternalProgramId; - emit externalProgramIdChanged(newExternalProgramId); } - QString TimerInfoDto::name() const { return m_name; } + void TimerInfoDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString TimerInfoDto::overview() const { return m_overview; } + void TimerInfoDto::setOverview(QString newOverview) { m_overview = newOverview; - emit overviewChanged(newOverview); } - QDateTime TimerInfoDto::startDate() const { return m_startDate; } + void TimerInfoDto::setStartDate(QDateTime newStartDate) { m_startDate = newStartDate; - emit startDateChanged(newStartDate); } - QDateTime TimerInfoDto::endDate() const { return m_endDate; } + void TimerInfoDto::setEndDate(QDateTime newEndDate) { m_endDate = newEndDate; - emit endDateChanged(newEndDate); } - QString TimerInfoDto::serviceName() const { return m_serviceName; } + void TimerInfoDto::setServiceName(QString newServiceName) { m_serviceName = newServiceName; - emit serviceNameChanged(newServiceName); } - qint32 TimerInfoDto::priority() const { return m_priority; } + void TimerInfoDto::setPriority(qint32 newPriority) { m_priority = newPriority; - emit priorityChanged(newPriority); } - qint32 TimerInfoDto::prePaddingSeconds() const { return m_prePaddingSeconds; } + void TimerInfoDto::setPrePaddingSeconds(qint32 newPrePaddingSeconds) { m_prePaddingSeconds = newPrePaddingSeconds; - emit prePaddingSecondsChanged(newPrePaddingSeconds); } - qint32 TimerInfoDto::postPaddingSeconds() const { return m_postPaddingSeconds; } + void TimerInfoDto::setPostPaddingSeconds(qint32 newPostPaddingSeconds) { m_postPaddingSeconds = newPostPaddingSeconds; - emit postPaddingSecondsChanged(newPostPaddingSeconds); } - bool TimerInfoDto::isPrePaddingRequired() const { return m_isPrePaddingRequired; } + void TimerInfoDto::setIsPrePaddingRequired(bool newIsPrePaddingRequired) { m_isPrePaddingRequired = newIsPrePaddingRequired; - emit isPrePaddingRequiredChanged(newIsPrePaddingRequired); } - QString TimerInfoDto::parentBackdropItemId() const { return m_parentBackdropItemId; } + void TimerInfoDto::setParentBackdropItemId(QString newParentBackdropItemId) { m_parentBackdropItemId = newParentBackdropItemId; - emit parentBackdropItemIdChanged(newParentBackdropItemId); } - QStringList TimerInfoDto::parentBackdropImageTags() const { return m_parentBackdropImageTags; } + void TimerInfoDto::setParentBackdropImageTags(QStringList newParentBackdropImageTags) { m_parentBackdropImageTags = newParentBackdropImageTags; - emit parentBackdropImageTagsChanged(newParentBackdropImageTags); } - bool TimerInfoDto::isPostPaddingRequired() const { return m_isPostPaddingRequired; } + void TimerInfoDto::setIsPostPaddingRequired(bool newIsPostPaddingRequired) { m_isPostPaddingRequired = newIsPostPaddingRequired; - emit isPostPaddingRequiredChanged(newIsPostPaddingRequired); } - KeepUntil TimerInfoDto::keepUntil() const { return m_keepUntil; } + void TimerInfoDto::setKeepUntil(KeepUntil newKeepUntil) { m_keepUntil = newKeepUntil; - emit keepUntilChanged(newKeepUntil); } - RecordingStatus TimerInfoDto::status() const { return m_status; } + void TimerInfoDto::setStatus(RecordingStatus newStatus) { m_status = newStatus; - emit statusChanged(newStatus); } - QString TimerInfoDto::seriesTimerId() const { return m_seriesTimerId; } + void TimerInfoDto::setSeriesTimerId(QString newSeriesTimerId) { m_seriesTimerId = newSeriesTimerId; - emit seriesTimerIdChanged(newSeriesTimerId); } - QString TimerInfoDto::externalSeriesTimerId() const { return m_externalSeriesTimerId; } + void TimerInfoDto::setExternalSeriesTimerId(QString newExternalSeriesTimerId) { m_externalSeriesTimerId = newExternalSeriesTimerId; - emit externalSeriesTimerIdChanged(newExternalSeriesTimerId); } - qint64 TimerInfoDto::runTimeTicks() const { return m_runTimeTicks; } + void TimerInfoDto::setRunTimeTicks(qint64 newRunTimeTicks) { m_runTimeTicks = newRunTimeTicks; - emit runTimeTicksChanged(newRunTimeTicks); } +QSharedPointer TimerInfoDto::programInfo() const { return m_programInfo; } -BaseItemDto * TimerInfoDto::programInfo() const { return m_programInfo; } -void TimerInfoDto::setProgramInfo(BaseItemDto * newProgramInfo) { +void TimerInfoDto::setProgramInfo(QSharedPointer newProgramInfo) { m_programInfo = newProgramInfo; - emit programInfoChanged(newProgramInfo); } diff --git a/core/src/DTO/timerinfodtoqueryresult.cpp b/core/src/DTO/timerinfodtoqueryresult.cpp index 90c7482..ab7c1a2 100644 --- a/core/src/DTO/timerinfodtoqueryresult.cpp +++ b/core/src/DTO/timerinfodtoqueryresult.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -TimerInfoDtoQueryResult::TimerInfoDtoQueryResult(QObject *parent) : QObject(parent) {} +TimerInfoDtoQueryResult::TimerInfoDtoQueryResult(QObject *parent) {} -TimerInfoDtoQueryResult *TimerInfoDtoQueryResult::fromJSON(QJsonObject source, QObject *parent) { - TimerInfoDtoQueryResult *instance = new TimerInfoDtoQueryResult(parent); - instance->updateFromJSON(source); +TimerInfoDtoQueryResult TimerInfoDtoQueryResult::fromJson(QJsonObject source) {TimerInfoDtoQueryResult instance; + instance->setFromJson(source, false); return instance; } -void TimerInfoDtoQueryResult::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TimerInfoDtoQueryResult::setFromJson(QJsonObject source) { + m_items = fromJsonValue>>(source["Items"]); + m_totalRecordCount = fromJsonValue(source["TotalRecordCount"]); + m_startIndex = fromJsonValue(source["StartIndex"]); + } -QJsonObject TimerInfoDtoQueryResult::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TimerInfoDtoQueryResult::toJson() { QJsonObject result; + result["Items"] = toJsonValue>>(m_items); + result["TotalRecordCount"] = toJsonValue(m_totalRecordCount); + result["StartIndex"] = toJsonValue(m_startIndex); + return result; } -QList TimerInfoDtoQueryResult::items() const { return m_items; } -void TimerInfoDtoQueryResult::setItems(QList newItems) { - m_items = newItems; - emit itemsChanged(newItems); -} +QList> TimerInfoDtoQueryResult::items() const { return m_items; } + +void TimerInfoDtoQueryResult::setItems(QList> newItems) { + m_items = newItems; +} qint32 TimerInfoDtoQueryResult::totalRecordCount() const { return m_totalRecordCount; } + void TimerInfoDtoQueryResult::setTotalRecordCount(qint32 newTotalRecordCount) { m_totalRecordCount = newTotalRecordCount; - emit totalRecordCountChanged(newTotalRecordCount); } - qint32 TimerInfoDtoQueryResult::startIndex() const { return m_startIndex; } + void TimerInfoDtoQueryResult::setStartIndex(qint32 newStartIndex) { m_startIndex = newStartIndex; - emit startIndexChanged(newStartIndex); } diff --git a/core/src/DTO/trailerinfo.cpp b/core/src/DTO/trailerinfo.cpp index 2a3d77f..a4816f7 100644 --- a/core/src/DTO/trailerinfo.cpp +++ b/core/src/DTO/trailerinfo.cpp @@ -32,80 +32,93 @@ namespace Jellyfin { namespace DTO { -TrailerInfo::TrailerInfo(QObject *parent) : QObject(parent) {} +TrailerInfo::TrailerInfo(QObject *parent) {} -TrailerInfo *TrailerInfo::fromJSON(QJsonObject source, QObject *parent) { - TrailerInfo *instance = new TrailerInfo(parent); - instance->updateFromJSON(source); +TrailerInfo TrailerInfo::fromJson(QJsonObject source) {TrailerInfo instance; + instance->setFromJson(source, false); return instance; } -void TrailerInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TrailerInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_path = fromJsonValue(source["Path"]); + m_metadataLanguage = fromJsonValue(source["MetadataLanguage"]); + m_metadataCountryCode = fromJsonValue(source["MetadataCountryCode"]); + m_providerIds = fromJsonValue(source["ProviderIds"]); + m_year = fromJsonValue(source["Year"]); + m_indexNumber = fromJsonValue(source["IndexNumber"]); + m_parentIndexNumber = fromJsonValue(source["ParentIndexNumber"]); + m_premiereDate = fromJsonValue(source["PremiereDate"]); + m_isAutomated = fromJsonValue(source["IsAutomated"]); + } -QJsonObject TrailerInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TrailerInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Path"] = toJsonValue(m_path); + result["MetadataLanguage"] = toJsonValue(m_metadataLanguage); + result["MetadataCountryCode"] = toJsonValue(m_metadataCountryCode); + result["ProviderIds"] = toJsonValue(m_providerIds); + result["Year"] = toJsonValue(m_year); + result["IndexNumber"] = toJsonValue(m_indexNumber); + result["ParentIndexNumber"] = toJsonValue(m_parentIndexNumber); + result["PremiereDate"] = toJsonValue(m_premiereDate); + result["IsAutomated"] = toJsonValue(m_isAutomated); + return result; } + QString TrailerInfo::name() const { return m_name; } + void TrailerInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString TrailerInfo::path() const { return m_path; } + void TrailerInfo::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - QString TrailerInfo::metadataLanguage() const { return m_metadataLanguage; } + void TrailerInfo::setMetadataLanguage(QString newMetadataLanguage) { m_metadataLanguage = newMetadataLanguage; - emit metadataLanguageChanged(newMetadataLanguage); } - QString TrailerInfo::metadataCountryCode() const { return m_metadataCountryCode; } + void TrailerInfo::setMetadataCountryCode(QString newMetadataCountryCode) { m_metadataCountryCode = newMetadataCountryCode; - emit metadataCountryCodeChanged(newMetadataCountryCode); } - QJsonObject TrailerInfo::providerIds() const { return m_providerIds; } + void TrailerInfo::setProviderIds(QJsonObject newProviderIds) { m_providerIds = newProviderIds; - emit providerIdsChanged(newProviderIds); } - qint32 TrailerInfo::year() const { return m_year; } + void TrailerInfo::setYear(qint32 newYear) { m_year = newYear; - emit yearChanged(newYear); } - qint32 TrailerInfo::indexNumber() const { return m_indexNumber; } + void TrailerInfo::setIndexNumber(qint32 newIndexNumber) { m_indexNumber = newIndexNumber; - emit indexNumberChanged(newIndexNumber); } - qint32 TrailerInfo::parentIndexNumber() const { return m_parentIndexNumber; } + void TrailerInfo::setParentIndexNumber(qint32 newParentIndexNumber) { m_parentIndexNumber = newParentIndexNumber; - emit parentIndexNumberChanged(newParentIndexNumber); } - QDateTime TrailerInfo::premiereDate() const { return m_premiereDate; } + void TrailerInfo::setPremiereDate(QDateTime newPremiereDate) { m_premiereDate = newPremiereDate; - emit premiereDateChanged(newPremiereDate); } - bool TrailerInfo::isAutomated() const { return m_isAutomated; } + void TrailerInfo::setIsAutomated(bool newIsAutomated) { m_isAutomated = newIsAutomated; - emit isAutomatedChanged(newIsAutomated); } diff --git a/core/src/DTO/trailerinforemotesearchquery.cpp b/core/src/DTO/trailerinforemotesearchquery.cpp index 2992930..eaff722 100644 --- a/core/src/DTO/trailerinforemotesearchquery.cpp +++ b/core/src/DTO/trailerinforemotesearchquery.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -TrailerInfoRemoteSearchQuery::TrailerInfoRemoteSearchQuery(QObject *parent) : QObject(parent) {} +TrailerInfoRemoteSearchQuery::TrailerInfoRemoteSearchQuery(QObject *parent) {} -TrailerInfoRemoteSearchQuery *TrailerInfoRemoteSearchQuery::fromJSON(QJsonObject source, QObject *parent) { - TrailerInfoRemoteSearchQuery *instance = new TrailerInfoRemoteSearchQuery(parent); - instance->updateFromJSON(source); +TrailerInfoRemoteSearchQuery TrailerInfoRemoteSearchQuery::fromJson(QJsonObject source) {TrailerInfoRemoteSearchQuery instance; + instance->setFromJson(source, false); return instance; } -void TrailerInfoRemoteSearchQuery::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TrailerInfoRemoteSearchQuery::setFromJson(QJsonObject source) { + m_searchInfo = fromJsonValue>(source["SearchInfo"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_searchProviderName = fromJsonValue(source["SearchProviderName"]); + m_includeDisabledProviders = fromJsonValue(source["IncludeDisabledProviders"]); + } -QJsonObject TrailerInfoRemoteSearchQuery::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TrailerInfoRemoteSearchQuery::toJson() { QJsonObject result; + result["SearchInfo"] = toJsonValue>(m_searchInfo); + result["ItemId"] = toJsonValue(m_itemId); + result["SearchProviderName"] = toJsonValue(m_searchProviderName); + result["IncludeDisabledProviders"] = toJsonValue(m_includeDisabledProviders); + return result; } -TrailerInfo * TrailerInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } -void TrailerInfoRemoteSearchQuery::setSearchInfo(TrailerInfo * newSearchInfo) { + +QSharedPointer TrailerInfoRemoteSearchQuery::searchInfo() const { return m_searchInfo; } + +void TrailerInfoRemoteSearchQuery::setSearchInfo(QSharedPointer newSearchInfo) { m_searchInfo = newSearchInfo; - emit searchInfoChanged(newSearchInfo); } +QUuid TrailerInfoRemoteSearchQuery::itemId() const { return m_itemId; } -QString TrailerInfoRemoteSearchQuery::itemId() const { return m_itemId; } -void TrailerInfoRemoteSearchQuery::setItemId(QString newItemId) { +void TrailerInfoRemoteSearchQuery::setItemId(QUuid newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString TrailerInfoRemoteSearchQuery::searchProviderName() const { return m_searchProviderName; } + void TrailerInfoRemoteSearchQuery::setSearchProviderName(QString newSearchProviderName) { m_searchProviderName = newSearchProviderName; - emit searchProviderNameChanged(newSearchProviderName); } - bool TrailerInfoRemoteSearchQuery::includeDisabledProviders() const { return m_includeDisabledProviders; } + void TrailerInfoRemoteSearchQuery::setIncludeDisabledProviders(bool newIncludeDisabledProviders) { m_includeDisabledProviders = newIncludeDisabledProviders; - emit includeDisabledProvidersChanged(newIncludeDisabledProviders); } diff --git a/core/src/DTO/transcodinginfo.cpp b/core/src/DTO/transcodinginfo.cpp index 8c64040..191eb72 100644 --- a/core/src/DTO/transcodinginfo.cpp +++ b/core/src/DTO/transcodinginfo.cpp @@ -29,97 +29,110 @@ #include -#include - namespace Jellyfin { namespace DTO { -TranscodingInfo::TranscodingInfo(QObject *parent) : QObject(parent) {} +TranscodingInfo::TranscodingInfo(QObject *parent) {} -TranscodingInfo *TranscodingInfo::fromJSON(QJsonObject source, QObject *parent) { - TranscodingInfo *instance = new TranscodingInfo(parent); - instance->updateFromJSON(source); +TranscodingInfo TranscodingInfo::fromJson(QJsonObject source) {TranscodingInfo instance; + instance->setFromJson(source, false); return instance; } -void TranscodingInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TranscodingInfo::setFromJson(QJsonObject source) { + m_audioCodec = fromJsonValue(source["AudioCodec"]); + m_videoCodec = fromJsonValue(source["VideoCodec"]); + m_container = fromJsonValue(source["Container"]); + m_isVideoDirect = fromJsonValue(source["IsVideoDirect"]); + m_isAudioDirect = fromJsonValue(source["IsAudioDirect"]); + m_bitrate = fromJsonValue(source["Bitrate"]); + m_framerate = fromJsonValue(source["Framerate"]); + m_completionPercentage = fromJsonValue(source["CompletionPercentage"]); + m_width = fromJsonValue(source["Width"]); + m_height = fromJsonValue(source["Height"]); + m_audioChannels = fromJsonValue(source["AudioChannels"]); + m_transcodeReasons = fromJsonValue>(source["TranscodeReasons"]); + } -QJsonObject TranscodingInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TranscodingInfo::toJson() { QJsonObject result; + result["AudioCodec"] = toJsonValue(m_audioCodec); + result["VideoCodec"] = toJsonValue(m_videoCodec); + result["Container"] = toJsonValue(m_container); + result["IsVideoDirect"] = toJsonValue(m_isVideoDirect); + result["IsAudioDirect"] = toJsonValue(m_isAudioDirect); + result["Bitrate"] = toJsonValue(m_bitrate); + result["Framerate"] = toJsonValue(m_framerate); + result["CompletionPercentage"] = toJsonValue(m_completionPercentage); + result["Width"] = toJsonValue(m_width); + result["Height"] = toJsonValue(m_height); + result["AudioChannels"] = toJsonValue(m_audioChannels); + result["TranscodeReasons"] = toJsonValue>(m_transcodeReasons); + return result; } + QString TranscodingInfo::audioCodec() const { return m_audioCodec; } + void TranscodingInfo::setAudioCodec(QString newAudioCodec) { m_audioCodec = newAudioCodec; - emit audioCodecChanged(newAudioCodec); } - QString TranscodingInfo::videoCodec() const { return m_videoCodec; } + void TranscodingInfo::setVideoCodec(QString newVideoCodec) { m_videoCodec = newVideoCodec; - emit videoCodecChanged(newVideoCodec); } - QString TranscodingInfo::container() const { return m_container; } + void TranscodingInfo::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } - bool TranscodingInfo::isVideoDirect() const { return m_isVideoDirect; } + void TranscodingInfo::setIsVideoDirect(bool newIsVideoDirect) { m_isVideoDirect = newIsVideoDirect; - emit isVideoDirectChanged(newIsVideoDirect); } - bool TranscodingInfo::isAudioDirect() const { return m_isAudioDirect; } + void TranscodingInfo::setIsAudioDirect(bool newIsAudioDirect) { m_isAudioDirect = newIsAudioDirect; - emit isAudioDirectChanged(newIsAudioDirect); } - qint32 TranscodingInfo::bitrate() const { return m_bitrate; } + void TranscodingInfo::setBitrate(qint32 newBitrate) { m_bitrate = newBitrate; - emit bitrateChanged(newBitrate); } - float TranscodingInfo::framerate() const { return m_framerate; } + void TranscodingInfo::setFramerate(float newFramerate) { m_framerate = newFramerate; - emit framerateChanged(newFramerate); } - double TranscodingInfo::completionPercentage() const { return m_completionPercentage; } + void TranscodingInfo::setCompletionPercentage(double newCompletionPercentage) { m_completionPercentage = newCompletionPercentage; - emit completionPercentageChanged(newCompletionPercentage); } - qint32 TranscodingInfo::width() const { return m_width; } + void TranscodingInfo::setWidth(qint32 newWidth) { m_width = newWidth; - emit widthChanged(newWidth); } - qint32 TranscodingInfo::height() const { return m_height; } + void TranscodingInfo::setHeight(qint32 newHeight) { m_height = newHeight; - emit heightChanged(newHeight); } - qint32 TranscodingInfo::audioChannels() const { return m_audioChannels; } + void TranscodingInfo::setAudioChannels(qint32 newAudioChannels) { m_audioChannels = newAudioChannels; - emit audioChannelsChanged(newAudioChannels); } - QList TranscodingInfo::transcodeReasons() const { return m_transcodeReasons; } + void TranscodingInfo::setTranscodeReasons(QList newTranscodeReasons) { m_transcodeReasons = newTranscodeReasons; - emit transcodeReasonsChanged(newTranscodeReasons); } diff --git a/core/src/DTO/transcodingprofile.cpp b/core/src/DTO/transcodingprofile.cpp index f54a6cd..642262d 100644 --- a/core/src/DTO/transcodingprofile.cpp +++ b/core/src/DTO/transcodingprofile.cpp @@ -29,117 +29,131 @@ #include -#include -#include -#include - namespace Jellyfin { namespace DTO { -TranscodingProfile::TranscodingProfile(QObject *parent) : QObject(parent) {} +TranscodingProfile::TranscodingProfile(QObject *parent) {} -TranscodingProfile *TranscodingProfile::fromJSON(QJsonObject source, QObject *parent) { - TranscodingProfile *instance = new TranscodingProfile(parent); - instance->updateFromJSON(source); +TranscodingProfile TranscodingProfile::fromJson(QJsonObject source) {TranscodingProfile instance; + instance->setFromJson(source, false); return instance; } -void TranscodingProfile::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TranscodingProfile::setFromJson(QJsonObject source) { + m_container = fromJsonValue(source["Container"]); + m_type = fromJsonValue(source["Type"]); + m_videoCodec = fromJsonValue(source["VideoCodec"]); + m_audioCodec = fromJsonValue(source["AudioCodec"]); + m_protocol = fromJsonValue(source["Protocol"]); + m_estimateContentLength = fromJsonValue(source["EstimateContentLength"]); + m_enableMpegtsM2TsMode = fromJsonValue(source["EnableMpegtsM2TsMode"]); + m_transcodeSeekInfo = fromJsonValue(source["TranscodeSeekInfo"]); + m_copyTimestamps = fromJsonValue(source["CopyTimestamps"]); + m_context = fromJsonValue(source["Context"]); + m_enableSubtitlesInManifest = fromJsonValue(source["EnableSubtitlesInManifest"]); + m_maxAudioChannels = fromJsonValue(source["MaxAudioChannels"]); + m_minSegments = fromJsonValue(source["MinSegments"]); + m_segmentLength = fromJsonValue(source["SegmentLength"]); + m_breakOnNonKeyFrames = fromJsonValue(source["BreakOnNonKeyFrames"]); + } -QJsonObject TranscodingProfile::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TranscodingProfile::toJson() { QJsonObject result; + result["Container"] = toJsonValue(m_container); + result["Type"] = toJsonValue(m_type); + result["VideoCodec"] = toJsonValue(m_videoCodec); + result["AudioCodec"] = toJsonValue(m_audioCodec); + result["Protocol"] = toJsonValue(m_protocol); + result["EstimateContentLength"] = toJsonValue(m_estimateContentLength); + result["EnableMpegtsM2TsMode"] = toJsonValue(m_enableMpegtsM2TsMode); + result["TranscodeSeekInfo"] = toJsonValue(m_transcodeSeekInfo); + result["CopyTimestamps"] = toJsonValue(m_copyTimestamps); + result["Context"] = toJsonValue(m_context); + result["EnableSubtitlesInManifest"] = toJsonValue(m_enableSubtitlesInManifest); + result["MaxAudioChannels"] = toJsonValue(m_maxAudioChannels); + result["MinSegments"] = toJsonValue(m_minSegments); + result["SegmentLength"] = toJsonValue(m_segmentLength); + result["BreakOnNonKeyFrames"] = toJsonValue(m_breakOnNonKeyFrames); + return result; } + QString TranscodingProfile::container() const { return m_container; } + void TranscodingProfile::setContainer(QString newContainer) { m_container = newContainer; - emit containerChanged(newContainer); } - DlnaProfileType TranscodingProfile::type() const { return m_type; } + void TranscodingProfile::setType(DlnaProfileType newType) { m_type = newType; - emit typeChanged(newType); } - QString TranscodingProfile::videoCodec() const { return m_videoCodec; } + void TranscodingProfile::setVideoCodec(QString newVideoCodec) { m_videoCodec = newVideoCodec; - emit videoCodecChanged(newVideoCodec); } - QString TranscodingProfile::audioCodec() const { return m_audioCodec; } + void TranscodingProfile::setAudioCodec(QString newAudioCodec) { m_audioCodec = newAudioCodec; - emit audioCodecChanged(newAudioCodec); } - QString TranscodingProfile::protocol() const { return m_protocol; } + void TranscodingProfile::setProtocol(QString newProtocol) { m_protocol = newProtocol; - emit protocolChanged(newProtocol); } - bool TranscodingProfile::estimateContentLength() const { return m_estimateContentLength; } + void TranscodingProfile::setEstimateContentLength(bool newEstimateContentLength) { m_estimateContentLength = newEstimateContentLength; - emit estimateContentLengthChanged(newEstimateContentLength); } - bool TranscodingProfile::enableMpegtsM2TsMode() const { return m_enableMpegtsM2TsMode; } + void TranscodingProfile::setEnableMpegtsM2TsMode(bool newEnableMpegtsM2TsMode) { m_enableMpegtsM2TsMode = newEnableMpegtsM2TsMode; - emit enableMpegtsM2TsModeChanged(newEnableMpegtsM2TsMode); } - TranscodeSeekInfo TranscodingProfile::transcodeSeekInfo() const { return m_transcodeSeekInfo; } + void TranscodingProfile::setTranscodeSeekInfo(TranscodeSeekInfo newTranscodeSeekInfo) { m_transcodeSeekInfo = newTranscodeSeekInfo; - emit transcodeSeekInfoChanged(newTranscodeSeekInfo); } - bool TranscodingProfile::copyTimestamps() const { return m_copyTimestamps; } + void TranscodingProfile::setCopyTimestamps(bool newCopyTimestamps) { m_copyTimestamps = newCopyTimestamps; - emit copyTimestampsChanged(newCopyTimestamps); } - EncodingContext TranscodingProfile::context() const { return m_context; } + void TranscodingProfile::setContext(EncodingContext newContext) { m_context = newContext; - emit contextChanged(newContext); } - bool TranscodingProfile::enableSubtitlesInManifest() const { return m_enableSubtitlesInManifest; } + void TranscodingProfile::setEnableSubtitlesInManifest(bool newEnableSubtitlesInManifest) { m_enableSubtitlesInManifest = newEnableSubtitlesInManifest; - emit enableSubtitlesInManifestChanged(newEnableSubtitlesInManifest); } - QString TranscodingProfile::maxAudioChannels() const { return m_maxAudioChannels; } + void TranscodingProfile::setMaxAudioChannels(QString newMaxAudioChannels) { m_maxAudioChannels = newMaxAudioChannels; - emit maxAudioChannelsChanged(newMaxAudioChannels); } - qint32 TranscodingProfile::minSegments() const { return m_minSegments; } + void TranscodingProfile::setMinSegments(qint32 newMinSegments) { m_minSegments = newMinSegments; - emit minSegmentsChanged(newMinSegments); } - qint32 TranscodingProfile::segmentLength() const { return m_segmentLength; } + void TranscodingProfile::setSegmentLength(qint32 newSegmentLength) { m_segmentLength = newSegmentLength; - emit segmentLengthChanged(newSegmentLength); } - bool TranscodingProfile::breakOnNonKeyFrames() const { return m_breakOnNonKeyFrames; } + void TranscodingProfile::setBreakOnNonKeyFrames(bool newBreakOnNonKeyFrames) { m_breakOnNonKeyFrames = newBreakOnNonKeyFrames; - emit breakOnNonKeyFramesChanged(newBreakOnNonKeyFrames); } diff --git a/core/src/DTO/tunerchannelmapping.cpp b/core/src/DTO/tunerchannelmapping.cpp index 90548cc..24c5aeb 100644 --- a/core/src/DTO/tunerchannelmapping.cpp +++ b/core/src/DTO/tunerchannelmapping.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -TunerChannelMapping::TunerChannelMapping(QObject *parent) : QObject(parent) {} +TunerChannelMapping::TunerChannelMapping(QObject *parent) {} -TunerChannelMapping *TunerChannelMapping::fromJSON(QJsonObject source, QObject *parent) { - TunerChannelMapping *instance = new TunerChannelMapping(parent); - instance->updateFromJSON(source); +TunerChannelMapping TunerChannelMapping::fromJson(QJsonObject source) {TunerChannelMapping instance; + instance->setFromJson(source, false); return instance; } -void TunerChannelMapping::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TunerChannelMapping::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_providerChannelName = fromJsonValue(source["ProviderChannelName"]); + m_providerChannelId = fromJsonValue(source["ProviderChannelId"]); + m_jellyfinId = fromJsonValue(source["Id"]); + } -QJsonObject TunerChannelMapping::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TunerChannelMapping::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["ProviderChannelName"] = toJsonValue(m_providerChannelName); + result["ProviderChannelId"] = toJsonValue(m_providerChannelId); + result["Id"] = toJsonValue(m_jellyfinId); + return result; } + QString TunerChannelMapping::name() const { return m_name; } + void TunerChannelMapping::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString TunerChannelMapping::providerChannelName() const { return m_providerChannelName; } + void TunerChannelMapping::setProviderChannelName(QString newProviderChannelName) { m_providerChannelName = newProviderChannelName; - emit providerChannelNameChanged(newProviderChannelName); } - QString TunerChannelMapping::providerChannelId() const { return m_providerChannelId; } + void TunerChannelMapping::setProviderChannelId(QString newProviderChannelId) { m_providerChannelId = newProviderChannelId; - emit providerChannelIdChanged(newProviderChannelId); } - QString TunerChannelMapping::jellyfinId() const { return m_jellyfinId; } + void TunerChannelMapping::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } diff --git a/core/src/DTO/tunerhostinfo.cpp b/core/src/DTO/tunerhostinfo.cpp index 3a478c9..d08029d 100644 --- a/core/src/DTO/tunerhostinfo.cpp +++ b/core/src/DTO/tunerhostinfo.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -TunerHostInfo::TunerHostInfo(QObject *parent) : QObject(parent) {} +TunerHostInfo::TunerHostInfo(QObject *parent) {} -TunerHostInfo *TunerHostInfo::fromJSON(QJsonObject source, QObject *parent) { - TunerHostInfo *instance = new TunerHostInfo(parent); - instance->updateFromJSON(source); +TunerHostInfo TunerHostInfo::fromJson(QJsonObject source) {TunerHostInfo instance; + instance->setFromJson(source, false); return instance; } -void TunerHostInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TunerHostInfo::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_url = fromJsonValue(source["Url"]); + m_type = fromJsonValue(source["Type"]); + m_deviceId = fromJsonValue(source["DeviceId"]); + m_friendlyName = fromJsonValue(source["FriendlyName"]); + m_importFavoritesOnly = fromJsonValue(source["ImportFavoritesOnly"]); + m_allowHWTranscoding = fromJsonValue(source["AllowHWTranscoding"]); + m_enableStreamLooping = fromJsonValue(source["EnableStreamLooping"]); + m_source = fromJsonValue(source["Source"]); + m_tunerCount = fromJsonValue(source["TunerCount"]); + m_userAgent = fromJsonValue(source["UserAgent"]); + } -QJsonObject TunerHostInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TunerHostInfo::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["Url"] = toJsonValue(m_url); + result["Type"] = toJsonValue(m_type); + result["DeviceId"] = toJsonValue(m_deviceId); + result["FriendlyName"] = toJsonValue(m_friendlyName); + result["ImportFavoritesOnly"] = toJsonValue(m_importFavoritesOnly); + result["AllowHWTranscoding"] = toJsonValue(m_allowHWTranscoding); + result["EnableStreamLooping"] = toJsonValue(m_enableStreamLooping); + result["Source"] = toJsonValue(m_source); + result["TunerCount"] = toJsonValue(m_tunerCount); + result["UserAgent"] = toJsonValue(m_userAgent); + return result; } + QString TunerHostInfo::jellyfinId() const { return m_jellyfinId; } + void TunerHostInfo::setJellyfinId(QString newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString TunerHostInfo::url() const { return m_url; } + void TunerHostInfo::setUrl(QString newUrl) { m_url = newUrl; - emit urlChanged(newUrl); } - QString TunerHostInfo::type() const { return m_type; } + void TunerHostInfo::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QString TunerHostInfo::deviceId() const { return m_deviceId; } + void TunerHostInfo::setDeviceId(QString newDeviceId) { m_deviceId = newDeviceId; - emit deviceIdChanged(newDeviceId); } - QString TunerHostInfo::friendlyName() const { return m_friendlyName; } + void TunerHostInfo::setFriendlyName(QString newFriendlyName) { m_friendlyName = newFriendlyName; - emit friendlyNameChanged(newFriendlyName); } - bool TunerHostInfo::importFavoritesOnly() const { return m_importFavoritesOnly; } + void TunerHostInfo::setImportFavoritesOnly(bool newImportFavoritesOnly) { m_importFavoritesOnly = newImportFavoritesOnly; - emit importFavoritesOnlyChanged(newImportFavoritesOnly); } - bool TunerHostInfo::allowHWTranscoding() const { return m_allowHWTranscoding; } + void TunerHostInfo::setAllowHWTranscoding(bool newAllowHWTranscoding) { m_allowHWTranscoding = newAllowHWTranscoding; - emit allowHWTranscodingChanged(newAllowHWTranscoding); } - bool TunerHostInfo::enableStreamLooping() const { return m_enableStreamLooping; } + void TunerHostInfo::setEnableStreamLooping(bool newEnableStreamLooping) { m_enableStreamLooping = newEnableStreamLooping; - emit enableStreamLoopingChanged(newEnableStreamLooping); } - QString TunerHostInfo::source() const { return m_source; } + void TunerHostInfo::setSource(QString newSource) { m_source = newSource; - emit sourceChanged(newSource); } - qint32 TunerHostInfo::tunerCount() const { return m_tunerCount; } + void TunerHostInfo::setTunerCount(qint32 newTunerCount) { m_tunerCount = newTunerCount; - emit tunerCountChanged(newTunerCount); } - QString TunerHostInfo::userAgent() const { return m_userAgent; } + void TunerHostInfo::setUserAgent(QString newUserAgent) { m_userAgent = newUserAgent; - emit userAgentChanged(newUserAgent); } diff --git a/core/src/DTO/typeoptions.cpp b/core/src/DTO/typeoptions.cpp index 418f8c9..2d7b2e2 100644 --- a/core/src/DTO/typeoptions.cpp +++ b/core/src/DTO/typeoptions.cpp @@ -32,56 +32,65 @@ namespace Jellyfin { namespace DTO { -TypeOptions::TypeOptions(QObject *parent) : QObject(parent) {} +TypeOptions::TypeOptions(QObject *parent) {} -TypeOptions *TypeOptions::fromJSON(QJsonObject source, QObject *parent) { - TypeOptions *instance = new TypeOptions(parent); - instance->updateFromJSON(source); +TypeOptions TypeOptions::fromJson(QJsonObject source) {TypeOptions instance; + instance->setFromJson(source, false); return instance; } -void TypeOptions::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void TypeOptions::setFromJson(QJsonObject source) { + m_type = fromJsonValue(source["Type"]); + m_metadataFetchers = fromJsonValue(source["MetadataFetchers"]); + m_metadataFetcherOrder = fromJsonValue(source["MetadataFetcherOrder"]); + m_imageFetchers = fromJsonValue(source["ImageFetchers"]); + m_imageFetcherOrder = fromJsonValue(source["ImageFetcherOrder"]); + m_imageOptions = fromJsonValue>>(source["ImageOptions"]); + } -QJsonObject TypeOptions::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject TypeOptions::toJson() { QJsonObject result; + result["Type"] = toJsonValue(m_type); + result["MetadataFetchers"] = toJsonValue(m_metadataFetchers); + result["MetadataFetcherOrder"] = toJsonValue(m_metadataFetcherOrder); + result["ImageFetchers"] = toJsonValue(m_imageFetchers); + result["ImageFetcherOrder"] = toJsonValue(m_imageFetcherOrder); + result["ImageOptions"] = toJsonValue>>(m_imageOptions); + return result; } + QString TypeOptions::type() const { return m_type; } + void TypeOptions::setType(QString newType) { m_type = newType; - emit typeChanged(newType); } - QStringList TypeOptions::metadataFetchers() const { return m_metadataFetchers; } + void TypeOptions::setMetadataFetchers(QStringList newMetadataFetchers) { m_metadataFetchers = newMetadataFetchers; - emit metadataFetchersChanged(newMetadataFetchers); } - QStringList TypeOptions::metadataFetcherOrder() const { return m_metadataFetcherOrder; } + void TypeOptions::setMetadataFetcherOrder(QStringList newMetadataFetcherOrder) { m_metadataFetcherOrder = newMetadataFetcherOrder; - emit metadataFetcherOrderChanged(newMetadataFetcherOrder); } - QStringList TypeOptions::imageFetchers() const { return m_imageFetchers; } + void TypeOptions::setImageFetchers(QStringList newImageFetchers) { m_imageFetchers = newImageFetchers; - emit imageFetchersChanged(newImageFetchers); } - QStringList TypeOptions::imageFetcherOrder() const { return m_imageFetcherOrder; } + void TypeOptions::setImageFetcherOrder(QStringList newImageFetcherOrder) { m_imageFetcherOrder = newImageFetcherOrder; - emit imageFetcherOrderChanged(newImageFetcherOrder); } +QList> TypeOptions::imageOptions() const { return m_imageOptions; } -QList TypeOptions::imageOptions() const { return m_imageOptions; } -void TypeOptions::setImageOptions(QList newImageOptions) { +void TypeOptions::setImageOptions(QList> newImageOptions) { m_imageOptions = newImageOptions; - emit imageOptionsChanged(newImageOptions); } diff --git a/core/src/DTO/updatelibraryoptionsdto.cpp b/core/src/DTO/updatelibraryoptionsdto.cpp index 2fbe1b8..a31fb02 100644 --- a/core/src/DTO/updatelibraryoptionsdto.cpp +++ b/core/src/DTO/updatelibraryoptionsdto.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -UpdateLibraryOptionsDto::UpdateLibraryOptionsDto(QObject *parent) : QObject(parent) {} +UpdateLibraryOptionsDto::UpdateLibraryOptionsDto(QObject *parent) {} -UpdateLibraryOptionsDto *UpdateLibraryOptionsDto::fromJSON(QJsonObject source, QObject *parent) { - UpdateLibraryOptionsDto *instance = new UpdateLibraryOptionsDto(parent); - instance->updateFromJSON(source); +UpdateLibraryOptionsDto UpdateLibraryOptionsDto::fromJson(QJsonObject source) {UpdateLibraryOptionsDto instance; + instance->setFromJson(source, false); return instance; } -void UpdateLibraryOptionsDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UpdateLibraryOptionsDto::setFromJson(QJsonObject source) { + m_jellyfinId = fromJsonValue(source["Id"]); + m_libraryOptions = fromJsonValue>(source["LibraryOptions"]); + } -QJsonObject UpdateLibraryOptionsDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UpdateLibraryOptionsDto::toJson() { QJsonObject result; + result["Id"] = toJsonValue(m_jellyfinId); + result["LibraryOptions"] = toJsonValue>(m_libraryOptions); + return result; } -QString UpdateLibraryOptionsDto::jellyfinId() const { return m_jellyfinId; } -void UpdateLibraryOptionsDto::setJellyfinId(QString newJellyfinId) { - m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); -} -LibraryOptions * UpdateLibraryOptionsDto::libraryOptions() const { return m_libraryOptions; } -void UpdateLibraryOptionsDto::setLibraryOptions(LibraryOptions * newLibraryOptions) { +QUuid UpdateLibraryOptionsDto::jellyfinId() const { return m_jellyfinId; } + +void UpdateLibraryOptionsDto::setJellyfinId(QUuid newJellyfinId) { + m_jellyfinId = newJellyfinId; +} +QSharedPointer UpdateLibraryOptionsDto::libraryOptions() const { return m_libraryOptions; } + +void UpdateLibraryOptionsDto::setLibraryOptions(QSharedPointer newLibraryOptions) { m_libraryOptions = newLibraryOptions; - emit libraryOptionsChanged(newLibraryOptions); } diff --git a/core/src/DTO/updateusereasypassword.cpp b/core/src/DTO/updateusereasypassword.cpp index 8ceebc8..f287e68 100644 --- a/core/src/DTO/updateusereasypassword.cpp +++ b/core/src/DTO/updateusereasypassword.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -UpdateUserEasyPassword::UpdateUserEasyPassword(QObject *parent) : QObject(parent) {} +UpdateUserEasyPassword::UpdateUserEasyPassword(QObject *parent) {} -UpdateUserEasyPassword *UpdateUserEasyPassword::fromJSON(QJsonObject source, QObject *parent) { - UpdateUserEasyPassword *instance = new UpdateUserEasyPassword(parent); - instance->updateFromJSON(source); +UpdateUserEasyPassword UpdateUserEasyPassword::fromJson(QJsonObject source) {UpdateUserEasyPassword instance; + instance->setFromJson(source, false); return instance; } -void UpdateUserEasyPassword::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UpdateUserEasyPassword::setFromJson(QJsonObject source) { + m_newPassword = fromJsonValue(source["NewPassword"]); + m_newPw = fromJsonValue(source["NewPw"]); + m_resetPassword = fromJsonValue(source["ResetPassword"]); + } -QJsonObject UpdateUserEasyPassword::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UpdateUserEasyPassword::toJson() { QJsonObject result; + result["NewPassword"] = toJsonValue(m_newPassword); + result["NewPw"] = toJsonValue(m_newPw); + result["ResetPassword"] = toJsonValue(m_resetPassword); + return result; } + QString UpdateUserEasyPassword::newPassword() const { return m_newPassword; } + void UpdateUserEasyPassword::setNewPassword(QString newNewPassword) { m_newPassword = newNewPassword; - emit newPasswordChanged(newNewPassword); } - QString UpdateUserEasyPassword::newPw() const { return m_newPw; } + void UpdateUserEasyPassword::setNewPw(QString newNewPw) { m_newPw = newNewPw; - emit newPwChanged(newNewPw); } - bool UpdateUserEasyPassword::resetPassword() const { return m_resetPassword; } + void UpdateUserEasyPassword::setResetPassword(bool newResetPassword) { m_resetPassword = newResetPassword; - emit resetPasswordChanged(newResetPassword); } diff --git a/core/src/DTO/updateuserpassword.cpp b/core/src/DTO/updateuserpassword.cpp index cc32f6d..479542d 100644 --- a/core/src/DTO/updateuserpassword.cpp +++ b/core/src/DTO/updateuserpassword.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -UpdateUserPassword::UpdateUserPassword(QObject *parent) : QObject(parent) {} +UpdateUserPassword::UpdateUserPassword(QObject *parent) {} -UpdateUserPassword *UpdateUserPassword::fromJSON(QJsonObject source, QObject *parent) { - UpdateUserPassword *instance = new UpdateUserPassword(parent); - instance->updateFromJSON(source); +UpdateUserPassword UpdateUserPassword::fromJson(QJsonObject source) {UpdateUserPassword instance; + instance->setFromJson(source, false); return instance; } -void UpdateUserPassword::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UpdateUserPassword::setFromJson(QJsonObject source) { + m_currentPassword = fromJsonValue(source["CurrentPassword"]); + m_currentPw = fromJsonValue(source["CurrentPw"]); + m_newPw = fromJsonValue(source["NewPw"]); + m_resetPassword = fromJsonValue(source["ResetPassword"]); + } -QJsonObject UpdateUserPassword::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UpdateUserPassword::toJson() { QJsonObject result; + result["CurrentPassword"] = toJsonValue(m_currentPassword); + result["CurrentPw"] = toJsonValue(m_currentPw); + result["NewPw"] = toJsonValue(m_newPw); + result["ResetPassword"] = toJsonValue(m_resetPassword); + return result; } + QString UpdateUserPassword::currentPassword() const { return m_currentPassword; } + void UpdateUserPassword::setCurrentPassword(QString newCurrentPassword) { m_currentPassword = newCurrentPassword; - emit currentPasswordChanged(newCurrentPassword); } - QString UpdateUserPassword::currentPw() const { return m_currentPw; } + void UpdateUserPassword::setCurrentPw(QString newCurrentPw) { m_currentPw = newCurrentPw; - emit currentPwChanged(newCurrentPw); } - QString UpdateUserPassword::newPw() const { return m_newPw; } + void UpdateUserPassword::setNewPw(QString newNewPw) { m_newPw = newNewPw; - emit newPwChanged(newNewPw); } - bool UpdateUserPassword::resetPassword() const { return m_resetPassword; } + void UpdateUserPassword::setResetPassword(bool newResetPassword) { m_resetPassword = newResetPassword; - emit resetPasswordChanged(newResetPassword); } diff --git a/core/src/DTO/uploadsubtitledto.cpp b/core/src/DTO/uploadsubtitledto.cpp index eb66d04..c4a365b 100644 --- a/core/src/DTO/uploadsubtitledto.cpp +++ b/core/src/DTO/uploadsubtitledto.cpp @@ -32,44 +32,51 @@ namespace Jellyfin { namespace DTO { -UploadSubtitleDto::UploadSubtitleDto(QObject *parent) : QObject(parent) {} +UploadSubtitleDto::UploadSubtitleDto(QObject *parent) {} -UploadSubtitleDto *UploadSubtitleDto::fromJSON(QJsonObject source, QObject *parent) { - UploadSubtitleDto *instance = new UploadSubtitleDto(parent); - instance->updateFromJSON(source); +UploadSubtitleDto UploadSubtitleDto::fromJson(QJsonObject source) {UploadSubtitleDto instance; + instance->setFromJson(source, false); return instance; } -void UploadSubtitleDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UploadSubtitleDto::setFromJson(QJsonObject source) { + m_language = fromJsonValue(source["Language"]); + m_format = fromJsonValue(source["Format"]); + m_isForced = fromJsonValue(source["IsForced"]); + m_data = fromJsonValue(source["Data"]); + } -QJsonObject UploadSubtitleDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UploadSubtitleDto::toJson() { QJsonObject result; + result["Language"] = toJsonValue(m_language); + result["Format"] = toJsonValue(m_format); + result["IsForced"] = toJsonValue(m_isForced); + result["Data"] = toJsonValue(m_data); + return result; } + QString UploadSubtitleDto::language() const { return m_language; } + void UploadSubtitleDto::setLanguage(QString newLanguage) { m_language = newLanguage; - emit languageChanged(newLanguage); } - QString UploadSubtitleDto::format() const { return m_format; } + void UploadSubtitleDto::setFormat(QString newFormat) { m_format = newFormat; - emit formatChanged(newFormat); } - bool UploadSubtitleDto::isForced() const { return m_isForced; } + void UploadSubtitleDto::setIsForced(bool newIsForced) { m_isForced = newIsForced; - emit isForcedChanged(newIsForced); } - QString UploadSubtitleDto::data() const { return m_data; } + void UploadSubtitleDto::setData(QString newData) { m_data = newData; - emit dataChanged(newData); } diff --git a/core/src/DTO/userconfiguration.cpp b/core/src/DTO/userconfiguration.cpp index deeea58..61addd8 100644 --- a/core/src/DTO/userconfiguration.cpp +++ b/core/src/DTO/userconfiguration.cpp @@ -29,115 +29,131 @@ #include -#include - namespace Jellyfin { namespace DTO { -UserConfiguration::UserConfiguration(QObject *parent) : QObject(parent) {} +UserConfiguration::UserConfiguration(QObject *parent) {} -UserConfiguration *UserConfiguration::fromJSON(QJsonObject source, QObject *parent) { - UserConfiguration *instance = new UserConfiguration(parent); - instance->updateFromJSON(source); +UserConfiguration UserConfiguration::fromJson(QJsonObject source) {UserConfiguration instance; + instance->setFromJson(source, false); return instance; } -void UserConfiguration::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UserConfiguration::setFromJson(QJsonObject source) { + m_audioLanguagePreference = fromJsonValue(source["AudioLanguagePreference"]); + m_playDefaultAudioTrack = fromJsonValue(source["PlayDefaultAudioTrack"]); + m_subtitleLanguagePreference = fromJsonValue(source["SubtitleLanguagePreference"]); + m_displayMissingEpisodes = fromJsonValue(source["DisplayMissingEpisodes"]); + m_groupedFolders = fromJsonValue(source["GroupedFolders"]); + m_subtitleMode = fromJsonValue(source["SubtitleMode"]); + m_displayCollectionsView = fromJsonValue(source["DisplayCollectionsView"]); + m_enableLocalPassword = fromJsonValue(source["EnableLocalPassword"]); + m_orderedViews = fromJsonValue(source["OrderedViews"]); + m_latestItemsExcludes = fromJsonValue(source["LatestItemsExcludes"]); + m_myMediaExcludes = fromJsonValue(source["MyMediaExcludes"]); + m_hidePlayedInLatest = fromJsonValue(source["HidePlayedInLatest"]); + m_rememberAudioSelections = fromJsonValue(source["RememberAudioSelections"]); + m_rememberSubtitleSelections = fromJsonValue(source["RememberSubtitleSelections"]); + m_enableNextEpisodeAutoPlay = fromJsonValue(source["EnableNextEpisodeAutoPlay"]); + } -QJsonObject UserConfiguration::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UserConfiguration::toJson() { QJsonObject result; + result["AudioLanguagePreference"] = toJsonValue(m_audioLanguagePreference); + result["PlayDefaultAudioTrack"] = toJsonValue(m_playDefaultAudioTrack); + result["SubtitleLanguagePreference"] = toJsonValue(m_subtitleLanguagePreference); + result["DisplayMissingEpisodes"] = toJsonValue(m_displayMissingEpisodes); + result["GroupedFolders"] = toJsonValue(m_groupedFolders); + result["SubtitleMode"] = toJsonValue(m_subtitleMode); + result["DisplayCollectionsView"] = toJsonValue(m_displayCollectionsView); + result["EnableLocalPassword"] = toJsonValue(m_enableLocalPassword); + result["OrderedViews"] = toJsonValue(m_orderedViews); + result["LatestItemsExcludes"] = toJsonValue(m_latestItemsExcludes); + result["MyMediaExcludes"] = toJsonValue(m_myMediaExcludes); + result["HidePlayedInLatest"] = toJsonValue(m_hidePlayedInLatest); + result["RememberAudioSelections"] = toJsonValue(m_rememberAudioSelections); + result["RememberSubtitleSelections"] = toJsonValue(m_rememberSubtitleSelections); + result["EnableNextEpisodeAutoPlay"] = toJsonValue(m_enableNextEpisodeAutoPlay); + return result; } + QString UserConfiguration::audioLanguagePreference() const { return m_audioLanguagePreference; } + void UserConfiguration::setAudioLanguagePreference(QString newAudioLanguagePreference) { m_audioLanguagePreference = newAudioLanguagePreference; - emit audioLanguagePreferenceChanged(newAudioLanguagePreference); } - bool UserConfiguration::playDefaultAudioTrack() const { return m_playDefaultAudioTrack; } + void UserConfiguration::setPlayDefaultAudioTrack(bool newPlayDefaultAudioTrack) { m_playDefaultAudioTrack = newPlayDefaultAudioTrack; - emit playDefaultAudioTrackChanged(newPlayDefaultAudioTrack); } - QString UserConfiguration::subtitleLanguagePreference() const { return m_subtitleLanguagePreference; } + void UserConfiguration::setSubtitleLanguagePreference(QString newSubtitleLanguagePreference) { m_subtitleLanguagePreference = newSubtitleLanguagePreference; - emit subtitleLanguagePreferenceChanged(newSubtitleLanguagePreference); } - bool UserConfiguration::displayMissingEpisodes() const { return m_displayMissingEpisodes; } + void UserConfiguration::setDisplayMissingEpisodes(bool newDisplayMissingEpisodes) { m_displayMissingEpisodes = newDisplayMissingEpisodes; - emit displayMissingEpisodesChanged(newDisplayMissingEpisodes); } - QStringList UserConfiguration::groupedFolders() const { return m_groupedFolders; } + void UserConfiguration::setGroupedFolders(QStringList newGroupedFolders) { m_groupedFolders = newGroupedFolders; - emit groupedFoldersChanged(newGroupedFolders); } - SubtitlePlaybackMode UserConfiguration::subtitleMode() const { return m_subtitleMode; } + void UserConfiguration::setSubtitleMode(SubtitlePlaybackMode newSubtitleMode) { m_subtitleMode = newSubtitleMode; - emit subtitleModeChanged(newSubtitleMode); } - bool UserConfiguration::displayCollectionsView() const { return m_displayCollectionsView; } + void UserConfiguration::setDisplayCollectionsView(bool newDisplayCollectionsView) { m_displayCollectionsView = newDisplayCollectionsView; - emit displayCollectionsViewChanged(newDisplayCollectionsView); } - bool UserConfiguration::enableLocalPassword() const { return m_enableLocalPassword; } + void UserConfiguration::setEnableLocalPassword(bool newEnableLocalPassword) { m_enableLocalPassword = newEnableLocalPassword; - emit enableLocalPasswordChanged(newEnableLocalPassword); } - QStringList UserConfiguration::orderedViews() const { return m_orderedViews; } + void UserConfiguration::setOrderedViews(QStringList newOrderedViews) { m_orderedViews = newOrderedViews; - emit orderedViewsChanged(newOrderedViews); } - QStringList UserConfiguration::latestItemsExcludes() const { return m_latestItemsExcludes; } + void UserConfiguration::setLatestItemsExcludes(QStringList newLatestItemsExcludes) { m_latestItemsExcludes = newLatestItemsExcludes; - emit latestItemsExcludesChanged(newLatestItemsExcludes); } - QStringList UserConfiguration::myMediaExcludes() const { return m_myMediaExcludes; } + void UserConfiguration::setMyMediaExcludes(QStringList newMyMediaExcludes) { m_myMediaExcludes = newMyMediaExcludes; - emit myMediaExcludesChanged(newMyMediaExcludes); } - bool UserConfiguration::hidePlayedInLatest() const { return m_hidePlayedInLatest; } + void UserConfiguration::setHidePlayedInLatest(bool newHidePlayedInLatest) { m_hidePlayedInLatest = newHidePlayedInLatest; - emit hidePlayedInLatestChanged(newHidePlayedInLatest); } - bool UserConfiguration::rememberAudioSelections() const { return m_rememberAudioSelections; } + void UserConfiguration::setRememberAudioSelections(bool newRememberAudioSelections) { m_rememberAudioSelections = newRememberAudioSelections; - emit rememberAudioSelectionsChanged(newRememberAudioSelections); } - bool UserConfiguration::rememberSubtitleSelections() const { return m_rememberSubtitleSelections; } + void UserConfiguration::setRememberSubtitleSelections(bool newRememberSubtitleSelections) { m_rememberSubtitleSelections = newRememberSubtitleSelections; - emit rememberSubtitleSelectionsChanged(newRememberSubtitleSelections); } - bool UserConfiguration::enableNextEpisodeAutoPlay() const { return m_enableNextEpisodeAutoPlay; } + void UserConfiguration::setEnableNextEpisodeAutoPlay(bool newEnableNextEpisodeAutoPlay) { m_enableNextEpisodeAutoPlay = newEnableNextEpisodeAutoPlay; - emit enableNextEpisodeAutoPlayChanged(newEnableNextEpisodeAutoPlay); } diff --git a/core/src/DTO/userdto.cpp b/core/src/DTO/userdto.cpp index 43957d6..27f6131 100644 --- a/core/src/DTO/userdto.cpp +++ b/core/src/DTO/userdto.cpp @@ -32,104 +32,121 @@ namespace Jellyfin { namespace DTO { -UserDto::UserDto(QObject *parent) : QObject(parent) {} +UserDto::UserDto(QObject *parent) {} -UserDto *UserDto::fromJSON(QJsonObject source, QObject *parent) { - UserDto *instance = new UserDto(parent); - instance->updateFromJSON(source); +UserDto UserDto::fromJson(QJsonObject source) {UserDto instance; + instance->setFromJson(source, false); return instance; } -void UserDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UserDto::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_serverId = fromJsonValue(source["ServerId"]); + m_serverName = fromJsonValue(source["ServerName"]); + m_jellyfinId = fromJsonValue(source["Id"]); + m_primaryImageTag = fromJsonValue(source["PrimaryImageTag"]); + m_hasPassword = fromJsonValue(source["HasPassword"]); + m_hasConfiguredPassword = fromJsonValue(source["HasConfiguredPassword"]); + m_hasConfiguredEasyPassword = fromJsonValue(source["HasConfiguredEasyPassword"]); + m_enableAutoLogin = fromJsonValue(source["EnableAutoLogin"]); + m_lastLoginDate = fromJsonValue(source["LastLoginDate"]); + m_lastActivityDate = fromJsonValue(source["LastActivityDate"]); + m_configuration = fromJsonValue>(source["Configuration"]); + m_policy = fromJsonValue>(source["Policy"]); + m_primaryImageAspectRatio = fromJsonValue(source["PrimaryImageAspectRatio"]); + } -QJsonObject UserDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UserDto::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["ServerId"] = toJsonValue(m_serverId); + result["ServerName"] = toJsonValue(m_serverName); + result["Id"] = toJsonValue(m_jellyfinId); + result["PrimaryImageTag"] = toJsonValue(m_primaryImageTag); + result["HasPassword"] = toJsonValue(m_hasPassword); + result["HasConfiguredPassword"] = toJsonValue(m_hasConfiguredPassword); + result["HasConfiguredEasyPassword"] = toJsonValue(m_hasConfiguredEasyPassword); + result["EnableAutoLogin"] = toJsonValue(m_enableAutoLogin); + result["LastLoginDate"] = toJsonValue(m_lastLoginDate); + result["LastActivityDate"] = toJsonValue(m_lastActivityDate); + result["Configuration"] = toJsonValue>(m_configuration); + result["Policy"] = toJsonValue>(m_policy); + result["PrimaryImageAspectRatio"] = toJsonValue(m_primaryImageAspectRatio); + return result; } + QString UserDto::name() const { return m_name; } + void UserDto::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString UserDto::serverId() const { return m_serverId; } + void UserDto::setServerId(QString newServerId) { m_serverId = newServerId; - emit serverIdChanged(newServerId); } - QString UserDto::serverName() const { return m_serverName; } + void UserDto::setServerName(QString newServerName) { m_serverName = newServerName; - emit serverNameChanged(newServerName); } +QUuid UserDto::jellyfinId() const { return m_jellyfinId; } -QString UserDto::jellyfinId() const { return m_jellyfinId; } -void UserDto::setJellyfinId(QString newJellyfinId) { +void UserDto::setJellyfinId(QUuid newJellyfinId) { m_jellyfinId = newJellyfinId; - emit jellyfinIdChanged(newJellyfinId); } - QString UserDto::primaryImageTag() const { return m_primaryImageTag; } + void UserDto::setPrimaryImageTag(QString newPrimaryImageTag) { m_primaryImageTag = newPrimaryImageTag; - emit primaryImageTagChanged(newPrimaryImageTag); } - bool UserDto::hasPassword() const { return m_hasPassword; } + void UserDto::setHasPassword(bool newHasPassword) { m_hasPassword = newHasPassword; - emit hasPasswordChanged(newHasPassword); } - bool UserDto::hasConfiguredPassword() const { return m_hasConfiguredPassword; } + void UserDto::setHasConfiguredPassword(bool newHasConfiguredPassword) { m_hasConfiguredPassword = newHasConfiguredPassword; - emit hasConfiguredPasswordChanged(newHasConfiguredPassword); } - bool UserDto::hasConfiguredEasyPassword() const { return m_hasConfiguredEasyPassword; } + void UserDto::setHasConfiguredEasyPassword(bool newHasConfiguredEasyPassword) { m_hasConfiguredEasyPassword = newHasConfiguredEasyPassword; - emit hasConfiguredEasyPasswordChanged(newHasConfiguredEasyPassword); } - bool UserDto::enableAutoLogin() const { return m_enableAutoLogin; } + void UserDto::setEnableAutoLogin(bool newEnableAutoLogin) { m_enableAutoLogin = newEnableAutoLogin; - emit enableAutoLoginChanged(newEnableAutoLogin); } - QDateTime UserDto::lastLoginDate() const { return m_lastLoginDate; } + void UserDto::setLastLoginDate(QDateTime newLastLoginDate) { m_lastLoginDate = newLastLoginDate; - emit lastLoginDateChanged(newLastLoginDate); } - QDateTime UserDto::lastActivityDate() const { return m_lastActivityDate; } + void UserDto::setLastActivityDate(QDateTime newLastActivityDate) { m_lastActivityDate = newLastActivityDate; - emit lastActivityDateChanged(newLastActivityDate); } +QSharedPointer UserDto::configuration() const { return m_configuration; } -UserConfiguration * UserDto::configuration() const { return m_configuration; } -void UserDto::setConfiguration(UserConfiguration * newConfiguration) { +void UserDto::setConfiguration(QSharedPointer newConfiguration) { m_configuration = newConfiguration; - emit configurationChanged(newConfiguration); } +QSharedPointer UserDto::policy() const { return m_policy; } -UserPolicy * UserDto::policy() const { return m_policy; } -void UserDto::setPolicy(UserPolicy * newPolicy) { +void UserDto::setPolicy(QSharedPointer newPolicy) { m_policy = newPolicy; - emit policyChanged(newPolicy); } - double UserDto::primaryImageAspectRatio() const { return m_primaryImageAspectRatio; } + void UserDto::setPrimaryImageAspectRatio(double newPrimaryImageAspectRatio) { m_primaryImageAspectRatio = newPrimaryImageAspectRatio; - emit primaryImageAspectRatioChanged(newPrimaryImageAspectRatio); } diff --git a/core/src/DTO/useritemdatadto.cpp b/core/src/DTO/useritemdatadto.cpp index ac0369f..a0e1630 100644 --- a/core/src/DTO/useritemdatadto.cpp +++ b/core/src/DTO/useritemdatadto.cpp @@ -32,86 +32,100 @@ namespace Jellyfin { namespace DTO { -UserItemDataDto::UserItemDataDto(QObject *parent) : QObject(parent) {} +UserItemDataDto::UserItemDataDto(QObject *parent) {} -UserItemDataDto *UserItemDataDto::fromJSON(QJsonObject source, QObject *parent) { - UserItemDataDto *instance = new UserItemDataDto(parent); - instance->updateFromJSON(source); +UserItemDataDto UserItemDataDto::fromJson(QJsonObject source) {UserItemDataDto instance; + instance->setFromJson(source, false); return instance; } -void UserItemDataDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UserItemDataDto::setFromJson(QJsonObject source) { + m_rating = fromJsonValue(source["Rating"]); + m_playedPercentage = fromJsonValue(source["PlayedPercentage"]); + m_unplayedItemCount = fromJsonValue(source["UnplayedItemCount"]); + m_playbackPositionTicks = fromJsonValue(source["PlaybackPositionTicks"]); + m_playCount = fromJsonValue(source["PlayCount"]); + m_isFavorite = fromJsonValue(source["IsFavorite"]); + m_likes = fromJsonValue(source["Likes"]); + m_lastPlayedDate = fromJsonValue(source["LastPlayedDate"]); + m_played = fromJsonValue(source["Played"]); + m_key = fromJsonValue(source["Key"]); + m_itemId = fromJsonValue(source["ItemId"]); + } -QJsonObject UserItemDataDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UserItemDataDto::toJson() { QJsonObject result; + result["Rating"] = toJsonValue(m_rating); + result["PlayedPercentage"] = toJsonValue(m_playedPercentage); + result["UnplayedItemCount"] = toJsonValue(m_unplayedItemCount); + result["PlaybackPositionTicks"] = toJsonValue(m_playbackPositionTicks); + result["PlayCount"] = toJsonValue(m_playCount); + result["IsFavorite"] = toJsonValue(m_isFavorite); + result["Likes"] = toJsonValue(m_likes); + result["LastPlayedDate"] = toJsonValue(m_lastPlayedDate); + result["Played"] = toJsonValue(m_played); + result["Key"] = toJsonValue(m_key); + result["ItemId"] = toJsonValue(m_itemId); + return result; } + double UserItemDataDto::rating() const { return m_rating; } + void UserItemDataDto::setRating(double newRating) { m_rating = newRating; - emit ratingChanged(newRating); } - double UserItemDataDto::playedPercentage() const { return m_playedPercentage; } + void UserItemDataDto::setPlayedPercentage(double newPlayedPercentage) { m_playedPercentage = newPlayedPercentage; - emit playedPercentageChanged(newPlayedPercentage); } - qint32 UserItemDataDto::unplayedItemCount() const { return m_unplayedItemCount; } + void UserItemDataDto::setUnplayedItemCount(qint32 newUnplayedItemCount) { m_unplayedItemCount = newUnplayedItemCount; - emit unplayedItemCountChanged(newUnplayedItemCount); } - qint64 UserItemDataDto::playbackPositionTicks() const { return m_playbackPositionTicks; } + void UserItemDataDto::setPlaybackPositionTicks(qint64 newPlaybackPositionTicks) { m_playbackPositionTicks = newPlaybackPositionTicks; - emit playbackPositionTicksChanged(newPlaybackPositionTicks); } - qint32 UserItemDataDto::playCount() const { return m_playCount; } + void UserItemDataDto::setPlayCount(qint32 newPlayCount) { m_playCount = newPlayCount; - emit playCountChanged(newPlayCount); } - bool UserItemDataDto::isFavorite() const { return m_isFavorite; } + void UserItemDataDto::setIsFavorite(bool newIsFavorite) { m_isFavorite = newIsFavorite; - emit isFavoriteChanged(newIsFavorite); } - bool UserItemDataDto::likes() const { return m_likes; } + void UserItemDataDto::setLikes(bool newLikes) { m_likes = newLikes; - emit likesChanged(newLikes); } - QDateTime UserItemDataDto::lastPlayedDate() const { return m_lastPlayedDate; } + void UserItemDataDto::setLastPlayedDate(QDateTime newLastPlayedDate) { m_lastPlayedDate = newLastPlayedDate; - emit lastPlayedDateChanged(newLastPlayedDate); } - bool UserItemDataDto::played() const { return m_played; } + void UserItemDataDto::setPlayed(bool newPlayed) { m_played = newPlayed; - emit playedChanged(newPlayed); } - QString UserItemDataDto::key() const { return m_key; } + void UserItemDataDto::setKey(QString newKey) { m_key = newKey; - emit keyChanged(newKey); } - QString UserItemDataDto::itemId() const { return m_itemId; } + void UserItemDataDto::setItemId(QString newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } diff --git a/core/src/DTO/userpolicy.cpp b/core/src/DTO/userpolicy.cpp index 901ae81..8071bdc 100644 --- a/core/src/DTO/userpolicy.cpp +++ b/core/src/DTO/userpolicy.cpp @@ -29,260 +29,299 @@ #include -#include -#include - namespace Jellyfin { namespace DTO { -UserPolicy::UserPolicy(QObject *parent) : QObject(parent) {} +UserPolicy::UserPolicy(QObject *parent) {} -UserPolicy *UserPolicy::fromJSON(QJsonObject source, QObject *parent) { - UserPolicy *instance = new UserPolicy(parent); - instance->updateFromJSON(source); +UserPolicy UserPolicy::fromJson(QJsonObject source) {UserPolicy instance; + instance->setFromJson(source, false); return instance; } -void UserPolicy::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UserPolicy::setFromJson(QJsonObject source) { + m_isAdministrator = fromJsonValue(source["IsAdministrator"]); + m_isHidden = fromJsonValue(source["IsHidden"]); + m_isDisabled = fromJsonValue(source["IsDisabled"]); + m_maxParentalRating = fromJsonValue(source["MaxParentalRating"]); + m_blockedTags = fromJsonValue(source["BlockedTags"]); + m_enableUserPreferenceAccess = fromJsonValue(source["EnableUserPreferenceAccess"]); + m_accessSchedules = fromJsonValue>>(source["AccessSchedules"]); + m_blockUnratedItems = fromJsonValue>(source["BlockUnratedItems"]); + m_enableRemoteControlOfOtherUsers = fromJsonValue(source["EnableRemoteControlOfOtherUsers"]); + m_enableSharedDeviceControl = fromJsonValue(source["EnableSharedDeviceControl"]); + m_enableRemoteAccess = fromJsonValue(source["EnableRemoteAccess"]); + m_enableLiveTvManagement = fromJsonValue(source["EnableLiveTvManagement"]); + m_enableLiveTvAccess = fromJsonValue(source["EnableLiveTvAccess"]); + m_enableMediaPlayback = fromJsonValue(source["EnableMediaPlayback"]); + m_enableAudioPlaybackTranscoding = fromJsonValue(source["EnableAudioPlaybackTranscoding"]); + m_enableVideoPlaybackTranscoding = fromJsonValue(source["EnableVideoPlaybackTranscoding"]); + m_enablePlaybackRemuxing = fromJsonValue(source["EnablePlaybackRemuxing"]); + m_forceRemoteSourceTranscoding = fromJsonValue(source["ForceRemoteSourceTranscoding"]); + m_enableContentDeletion = fromJsonValue(source["EnableContentDeletion"]); + m_enableContentDeletionFromFolders = fromJsonValue(source["EnableContentDeletionFromFolders"]); + m_enableContentDownloading = fromJsonValue(source["EnableContentDownloading"]); + m_enableSyncTranscoding = fromJsonValue(source["EnableSyncTranscoding"]); + m_enableMediaConversion = fromJsonValue(source["EnableMediaConversion"]); + m_enabledDevices = fromJsonValue(source["EnabledDevices"]); + m_enableAllDevices = fromJsonValue(source["EnableAllDevices"]); + m_enabledChannels = fromJsonValue>(source["EnabledChannels"]); + m_enableAllChannels = fromJsonValue(source["EnableAllChannels"]); + m_enabledFolders = fromJsonValue>(source["EnabledFolders"]); + m_enableAllFolders = fromJsonValue(source["EnableAllFolders"]); + m_invalidLoginAttemptCount = fromJsonValue(source["InvalidLoginAttemptCount"]); + m_loginAttemptsBeforeLockout = fromJsonValue(source["LoginAttemptsBeforeLockout"]); + m_maxActiveSessions = fromJsonValue(source["MaxActiveSessions"]); + m_enablePublicSharing = fromJsonValue(source["EnablePublicSharing"]); + m_blockedMediaFolders = fromJsonValue>(source["BlockedMediaFolders"]); + m_blockedChannels = fromJsonValue>(source["BlockedChannels"]); + m_remoteClientBitrateLimit = fromJsonValue(source["RemoteClientBitrateLimit"]); + m_authenticationProviderId = fromJsonValue(source["AuthenticationProviderId"]); + m_passwordResetProviderId = fromJsonValue(source["PasswordResetProviderId"]); + m_syncPlayAccess = fromJsonValue(source["SyncPlayAccess"]); + } -QJsonObject UserPolicy::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UserPolicy::toJson() { QJsonObject result; + result["IsAdministrator"] = toJsonValue(m_isAdministrator); + result["IsHidden"] = toJsonValue(m_isHidden); + result["IsDisabled"] = toJsonValue(m_isDisabled); + result["MaxParentalRating"] = toJsonValue(m_maxParentalRating); + result["BlockedTags"] = toJsonValue(m_blockedTags); + result["EnableUserPreferenceAccess"] = toJsonValue(m_enableUserPreferenceAccess); + result["AccessSchedules"] = toJsonValue>>(m_accessSchedules); + result["BlockUnratedItems"] = toJsonValue>(m_blockUnratedItems); + result["EnableRemoteControlOfOtherUsers"] = toJsonValue(m_enableRemoteControlOfOtherUsers); + result["EnableSharedDeviceControl"] = toJsonValue(m_enableSharedDeviceControl); + result["EnableRemoteAccess"] = toJsonValue(m_enableRemoteAccess); + result["EnableLiveTvManagement"] = toJsonValue(m_enableLiveTvManagement); + result["EnableLiveTvAccess"] = toJsonValue(m_enableLiveTvAccess); + result["EnableMediaPlayback"] = toJsonValue(m_enableMediaPlayback); + result["EnableAudioPlaybackTranscoding"] = toJsonValue(m_enableAudioPlaybackTranscoding); + result["EnableVideoPlaybackTranscoding"] = toJsonValue(m_enableVideoPlaybackTranscoding); + result["EnablePlaybackRemuxing"] = toJsonValue(m_enablePlaybackRemuxing); + result["ForceRemoteSourceTranscoding"] = toJsonValue(m_forceRemoteSourceTranscoding); + result["EnableContentDeletion"] = toJsonValue(m_enableContentDeletion); + result["EnableContentDeletionFromFolders"] = toJsonValue(m_enableContentDeletionFromFolders); + result["EnableContentDownloading"] = toJsonValue(m_enableContentDownloading); + result["EnableSyncTranscoding"] = toJsonValue(m_enableSyncTranscoding); + result["EnableMediaConversion"] = toJsonValue(m_enableMediaConversion); + result["EnabledDevices"] = toJsonValue(m_enabledDevices); + result["EnableAllDevices"] = toJsonValue(m_enableAllDevices); + result["EnabledChannels"] = toJsonValue>(m_enabledChannels); + result["EnableAllChannels"] = toJsonValue(m_enableAllChannels); + result["EnabledFolders"] = toJsonValue>(m_enabledFolders); + result["EnableAllFolders"] = toJsonValue(m_enableAllFolders); + result["InvalidLoginAttemptCount"] = toJsonValue(m_invalidLoginAttemptCount); + result["LoginAttemptsBeforeLockout"] = toJsonValue(m_loginAttemptsBeforeLockout); + result["MaxActiveSessions"] = toJsonValue(m_maxActiveSessions); + result["EnablePublicSharing"] = toJsonValue(m_enablePublicSharing); + result["BlockedMediaFolders"] = toJsonValue>(m_blockedMediaFolders); + result["BlockedChannels"] = toJsonValue>(m_blockedChannels); + result["RemoteClientBitrateLimit"] = toJsonValue(m_remoteClientBitrateLimit); + result["AuthenticationProviderId"] = toJsonValue(m_authenticationProviderId); + result["PasswordResetProviderId"] = toJsonValue(m_passwordResetProviderId); + result["SyncPlayAccess"] = toJsonValue(m_syncPlayAccess); + return result; } + bool UserPolicy::isAdministrator() const { return m_isAdministrator; } + void UserPolicy::setIsAdministrator(bool newIsAdministrator) { m_isAdministrator = newIsAdministrator; - emit isAdministratorChanged(newIsAdministrator); } - bool UserPolicy::isHidden() const { return m_isHidden; } + void UserPolicy::setIsHidden(bool newIsHidden) { m_isHidden = newIsHidden; - emit isHiddenChanged(newIsHidden); } - bool UserPolicy::isDisabled() const { return m_isDisabled; } + void UserPolicy::setIsDisabled(bool newIsDisabled) { m_isDisabled = newIsDisabled; - emit isDisabledChanged(newIsDisabled); } - qint32 UserPolicy::maxParentalRating() const { return m_maxParentalRating; } + void UserPolicy::setMaxParentalRating(qint32 newMaxParentalRating) { m_maxParentalRating = newMaxParentalRating; - emit maxParentalRatingChanged(newMaxParentalRating); } - QStringList UserPolicy::blockedTags() const { return m_blockedTags; } + void UserPolicy::setBlockedTags(QStringList newBlockedTags) { m_blockedTags = newBlockedTags; - emit blockedTagsChanged(newBlockedTags); } - bool UserPolicy::enableUserPreferenceAccess() const { return m_enableUserPreferenceAccess; } + void UserPolicy::setEnableUserPreferenceAccess(bool newEnableUserPreferenceAccess) { m_enableUserPreferenceAccess = newEnableUserPreferenceAccess; - emit enableUserPreferenceAccessChanged(newEnableUserPreferenceAccess); } +QList> UserPolicy::accessSchedules() const { return m_accessSchedules; } -QList UserPolicy::accessSchedules() const { return m_accessSchedules; } -void UserPolicy::setAccessSchedules(QList newAccessSchedules) { +void UserPolicy::setAccessSchedules(QList> newAccessSchedules) { m_accessSchedules = newAccessSchedules; - emit accessSchedulesChanged(newAccessSchedules); } - QList UserPolicy::blockUnratedItems() const { return m_blockUnratedItems; } + void UserPolicy::setBlockUnratedItems(QList newBlockUnratedItems) { m_blockUnratedItems = newBlockUnratedItems; - emit blockUnratedItemsChanged(newBlockUnratedItems); } - bool UserPolicy::enableRemoteControlOfOtherUsers() const { return m_enableRemoteControlOfOtherUsers; } + void UserPolicy::setEnableRemoteControlOfOtherUsers(bool newEnableRemoteControlOfOtherUsers) { m_enableRemoteControlOfOtherUsers = newEnableRemoteControlOfOtherUsers; - emit enableRemoteControlOfOtherUsersChanged(newEnableRemoteControlOfOtherUsers); } - bool UserPolicy::enableSharedDeviceControl() const { return m_enableSharedDeviceControl; } + void UserPolicy::setEnableSharedDeviceControl(bool newEnableSharedDeviceControl) { m_enableSharedDeviceControl = newEnableSharedDeviceControl; - emit enableSharedDeviceControlChanged(newEnableSharedDeviceControl); } - bool UserPolicy::enableRemoteAccess() const { return m_enableRemoteAccess; } + void UserPolicy::setEnableRemoteAccess(bool newEnableRemoteAccess) { m_enableRemoteAccess = newEnableRemoteAccess; - emit enableRemoteAccessChanged(newEnableRemoteAccess); } - bool UserPolicy::enableLiveTvManagement() const { return m_enableLiveTvManagement; } + void UserPolicy::setEnableLiveTvManagement(bool newEnableLiveTvManagement) { m_enableLiveTvManagement = newEnableLiveTvManagement; - emit enableLiveTvManagementChanged(newEnableLiveTvManagement); } - bool UserPolicy::enableLiveTvAccess() const { return m_enableLiveTvAccess; } + void UserPolicy::setEnableLiveTvAccess(bool newEnableLiveTvAccess) { m_enableLiveTvAccess = newEnableLiveTvAccess; - emit enableLiveTvAccessChanged(newEnableLiveTvAccess); } - bool UserPolicy::enableMediaPlayback() const { return m_enableMediaPlayback; } + void UserPolicy::setEnableMediaPlayback(bool newEnableMediaPlayback) { m_enableMediaPlayback = newEnableMediaPlayback; - emit enableMediaPlaybackChanged(newEnableMediaPlayback); } - bool UserPolicy::enableAudioPlaybackTranscoding() const { return m_enableAudioPlaybackTranscoding; } + void UserPolicy::setEnableAudioPlaybackTranscoding(bool newEnableAudioPlaybackTranscoding) { m_enableAudioPlaybackTranscoding = newEnableAudioPlaybackTranscoding; - emit enableAudioPlaybackTranscodingChanged(newEnableAudioPlaybackTranscoding); } - bool UserPolicy::enableVideoPlaybackTranscoding() const { return m_enableVideoPlaybackTranscoding; } + void UserPolicy::setEnableVideoPlaybackTranscoding(bool newEnableVideoPlaybackTranscoding) { m_enableVideoPlaybackTranscoding = newEnableVideoPlaybackTranscoding; - emit enableVideoPlaybackTranscodingChanged(newEnableVideoPlaybackTranscoding); } - bool UserPolicy::enablePlaybackRemuxing() const { return m_enablePlaybackRemuxing; } + void UserPolicy::setEnablePlaybackRemuxing(bool newEnablePlaybackRemuxing) { m_enablePlaybackRemuxing = newEnablePlaybackRemuxing; - emit enablePlaybackRemuxingChanged(newEnablePlaybackRemuxing); } - bool UserPolicy::forceRemoteSourceTranscoding() const { return m_forceRemoteSourceTranscoding; } + void UserPolicy::setForceRemoteSourceTranscoding(bool newForceRemoteSourceTranscoding) { m_forceRemoteSourceTranscoding = newForceRemoteSourceTranscoding; - emit forceRemoteSourceTranscodingChanged(newForceRemoteSourceTranscoding); } - bool UserPolicy::enableContentDeletion() const { return m_enableContentDeletion; } + void UserPolicy::setEnableContentDeletion(bool newEnableContentDeletion) { m_enableContentDeletion = newEnableContentDeletion; - emit enableContentDeletionChanged(newEnableContentDeletion); } - QStringList UserPolicy::enableContentDeletionFromFolders() const { return m_enableContentDeletionFromFolders; } + void UserPolicy::setEnableContentDeletionFromFolders(QStringList newEnableContentDeletionFromFolders) { m_enableContentDeletionFromFolders = newEnableContentDeletionFromFolders; - emit enableContentDeletionFromFoldersChanged(newEnableContentDeletionFromFolders); } - bool UserPolicy::enableContentDownloading() const { return m_enableContentDownloading; } + void UserPolicy::setEnableContentDownloading(bool newEnableContentDownloading) { m_enableContentDownloading = newEnableContentDownloading; - emit enableContentDownloadingChanged(newEnableContentDownloading); } - bool UserPolicy::enableSyncTranscoding() const { return m_enableSyncTranscoding; } + void UserPolicy::setEnableSyncTranscoding(bool newEnableSyncTranscoding) { m_enableSyncTranscoding = newEnableSyncTranscoding; - emit enableSyncTranscodingChanged(newEnableSyncTranscoding); } - bool UserPolicy::enableMediaConversion() const { return m_enableMediaConversion; } + void UserPolicy::setEnableMediaConversion(bool newEnableMediaConversion) { m_enableMediaConversion = newEnableMediaConversion; - emit enableMediaConversionChanged(newEnableMediaConversion); } - QStringList UserPolicy::enabledDevices() const { return m_enabledDevices; } + void UserPolicy::setEnabledDevices(QStringList newEnabledDevices) { m_enabledDevices = newEnabledDevices; - emit enabledDevicesChanged(newEnabledDevices); } - bool UserPolicy::enableAllDevices() const { return m_enableAllDevices; } + void UserPolicy::setEnableAllDevices(bool newEnableAllDevices) { m_enableAllDevices = newEnableAllDevices; - emit enableAllDevicesChanged(newEnableAllDevices); } +QList UserPolicy::enabledChannels() const { return m_enabledChannels; } -QStringList UserPolicy::enabledChannels() const { return m_enabledChannels; } -void UserPolicy::setEnabledChannels(QStringList newEnabledChannels) { +void UserPolicy::setEnabledChannels(QList newEnabledChannels) { m_enabledChannels = newEnabledChannels; - emit enabledChannelsChanged(newEnabledChannels); } - bool UserPolicy::enableAllChannels() const { return m_enableAllChannels; } + void UserPolicy::setEnableAllChannels(bool newEnableAllChannels) { m_enableAllChannels = newEnableAllChannels; - emit enableAllChannelsChanged(newEnableAllChannels); } +QList UserPolicy::enabledFolders() const { return m_enabledFolders; } -QStringList UserPolicy::enabledFolders() const { return m_enabledFolders; } -void UserPolicy::setEnabledFolders(QStringList newEnabledFolders) { +void UserPolicy::setEnabledFolders(QList newEnabledFolders) { m_enabledFolders = newEnabledFolders; - emit enabledFoldersChanged(newEnabledFolders); } - bool UserPolicy::enableAllFolders() const { return m_enableAllFolders; } + void UserPolicy::setEnableAllFolders(bool newEnableAllFolders) { m_enableAllFolders = newEnableAllFolders; - emit enableAllFoldersChanged(newEnableAllFolders); } - qint32 UserPolicy::invalidLoginAttemptCount() const { return m_invalidLoginAttemptCount; } + void UserPolicy::setInvalidLoginAttemptCount(qint32 newInvalidLoginAttemptCount) { m_invalidLoginAttemptCount = newInvalidLoginAttemptCount; - emit invalidLoginAttemptCountChanged(newInvalidLoginAttemptCount); } - qint32 UserPolicy::loginAttemptsBeforeLockout() const { return m_loginAttemptsBeforeLockout; } + void UserPolicy::setLoginAttemptsBeforeLockout(qint32 newLoginAttemptsBeforeLockout) { m_loginAttemptsBeforeLockout = newLoginAttemptsBeforeLockout; - emit loginAttemptsBeforeLockoutChanged(newLoginAttemptsBeforeLockout); } - qint32 UserPolicy::maxActiveSessions() const { return m_maxActiveSessions; } + void UserPolicy::setMaxActiveSessions(qint32 newMaxActiveSessions) { m_maxActiveSessions = newMaxActiveSessions; - emit maxActiveSessionsChanged(newMaxActiveSessions); } - bool UserPolicy::enablePublicSharing() const { return m_enablePublicSharing; } + void UserPolicy::setEnablePublicSharing(bool newEnablePublicSharing) { m_enablePublicSharing = newEnablePublicSharing; - emit enablePublicSharingChanged(newEnablePublicSharing); } +QList UserPolicy::blockedMediaFolders() const { return m_blockedMediaFolders; } -QStringList UserPolicy::blockedMediaFolders() const { return m_blockedMediaFolders; } -void UserPolicy::setBlockedMediaFolders(QStringList newBlockedMediaFolders) { +void UserPolicy::setBlockedMediaFolders(QList newBlockedMediaFolders) { m_blockedMediaFolders = newBlockedMediaFolders; - emit blockedMediaFoldersChanged(newBlockedMediaFolders); } +QList UserPolicy::blockedChannels() const { return m_blockedChannels; } -QStringList UserPolicy::blockedChannels() const { return m_blockedChannels; } -void UserPolicy::setBlockedChannels(QStringList newBlockedChannels) { +void UserPolicy::setBlockedChannels(QList newBlockedChannels) { m_blockedChannels = newBlockedChannels; - emit blockedChannelsChanged(newBlockedChannels); } - qint32 UserPolicy::remoteClientBitrateLimit() const { return m_remoteClientBitrateLimit; } + void UserPolicy::setRemoteClientBitrateLimit(qint32 newRemoteClientBitrateLimit) { m_remoteClientBitrateLimit = newRemoteClientBitrateLimit; - emit remoteClientBitrateLimitChanged(newRemoteClientBitrateLimit); } - QString UserPolicy::authenticationProviderId() const { return m_authenticationProviderId; } + void UserPolicy::setAuthenticationProviderId(QString newAuthenticationProviderId) { m_authenticationProviderId = newAuthenticationProviderId; - emit authenticationProviderIdChanged(newAuthenticationProviderId); } - QString UserPolicy::passwordResetProviderId() const { return m_passwordResetProviderId; } + void UserPolicy::setPasswordResetProviderId(QString newPasswordResetProviderId) { m_passwordResetProviderId = newPasswordResetProviderId; - emit passwordResetProviderIdChanged(newPasswordResetProviderId); } - SyncPlayUserAccessType UserPolicy::syncPlayAccess() const { return m_syncPlayAccess; } + void UserPolicy::setSyncPlayAccess(SyncPlayUserAccessType newSyncPlayAccess) { m_syncPlayAccess = newSyncPlayAccess; - emit syncPlayAccessChanged(newSyncPlayAccess); } diff --git a/core/src/DTO/utctimeresponse.cpp b/core/src/DTO/utctimeresponse.cpp index e67586e..7906509 100644 --- a/core/src/DTO/utctimeresponse.cpp +++ b/core/src/DTO/utctimeresponse.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -UtcTimeResponse::UtcTimeResponse(QObject *parent) : QObject(parent) {} +UtcTimeResponse::UtcTimeResponse(QObject *parent) {} -UtcTimeResponse *UtcTimeResponse::fromJSON(QJsonObject source, QObject *parent) { - UtcTimeResponse *instance = new UtcTimeResponse(parent); - instance->updateFromJSON(source); +UtcTimeResponse UtcTimeResponse::fromJson(QJsonObject source) {UtcTimeResponse instance; + instance->setFromJson(source, false); return instance; } -void UtcTimeResponse::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void UtcTimeResponse::setFromJson(QJsonObject source) { + m_requestReceptionTime = fromJsonValue(source["RequestReceptionTime"]); + m_responseTransmissionTime = fromJsonValue(source["ResponseTransmissionTime"]); + } -QJsonObject UtcTimeResponse::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject UtcTimeResponse::toJson() { QJsonObject result; + result["RequestReceptionTime"] = toJsonValue(m_requestReceptionTime); + result["ResponseTransmissionTime"] = toJsonValue(m_responseTransmissionTime); + return result; } + QDateTime UtcTimeResponse::requestReceptionTime() const { return m_requestReceptionTime; } + void UtcTimeResponse::setRequestReceptionTime(QDateTime newRequestReceptionTime) { m_requestReceptionTime = newRequestReceptionTime; - emit requestReceptionTimeChanged(newRequestReceptionTime); } - QDateTime UtcTimeResponse::responseTransmissionTime() const { return m_responseTransmissionTime; } + void UtcTimeResponse::setResponseTransmissionTime(QDateTime newResponseTransmissionTime) { m_responseTransmissionTime = newResponseTransmissionTime; - emit responseTransmissionTimeChanged(newResponseTransmissionTime); } diff --git a/core/src/DTO/validatepathdto.cpp b/core/src/DTO/validatepathdto.cpp index 884b200..68f6faa 100644 --- a/core/src/DTO/validatepathdto.cpp +++ b/core/src/DTO/validatepathdto.cpp @@ -32,38 +32,44 @@ namespace Jellyfin { namespace DTO { -ValidatePathDto::ValidatePathDto(QObject *parent) : QObject(parent) {} +ValidatePathDto::ValidatePathDto(QObject *parent) {} -ValidatePathDto *ValidatePathDto::fromJSON(QJsonObject source, QObject *parent) { - ValidatePathDto *instance = new ValidatePathDto(parent); - instance->updateFromJSON(source); +ValidatePathDto ValidatePathDto::fromJson(QJsonObject source) {ValidatePathDto instance; + instance->setFromJson(source, false); return instance; } -void ValidatePathDto::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void ValidatePathDto::setFromJson(QJsonObject source) { + m_validateWritable = fromJsonValue(source["ValidateWritable"]); + m_path = fromJsonValue(source["Path"]); + m_isFile = fromJsonValue(source["IsFile"]); + } -QJsonObject ValidatePathDto::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject ValidatePathDto::toJson() { QJsonObject result; + result["ValidateWritable"] = toJsonValue(m_validateWritable); + result["Path"] = toJsonValue(m_path); + result["IsFile"] = toJsonValue(m_isFile); + return result; } + bool ValidatePathDto::validateWritable() const { return m_validateWritable; } + void ValidatePathDto::setValidateWritable(bool newValidateWritable) { m_validateWritable = newValidateWritable; - emit validateWritableChanged(newValidateWritable); } - QString ValidatePathDto::path() const { return m_path; } + void ValidatePathDto::setPath(QString newPath) { m_path = newPath; - emit pathChanged(newPath); } - bool ValidatePathDto::isFile() const { return m_isFile; } + void ValidatePathDto::setIsFile(bool newIsFile) { m_isFile = newIsFile; - emit isFileChanged(newIsFile); } diff --git a/core/src/DTO/version.cpp b/core/src/DTO/version.cpp index 963d4e1..6c6833a 100644 --- a/core/src/DTO/version.cpp +++ b/core/src/DTO/version.cpp @@ -32,56 +32,65 @@ namespace Jellyfin { namespace DTO { -Version::Version(QObject *parent) : QObject(parent) {} +Version::Version(QObject *parent) {} -Version *Version::fromJSON(QJsonObject source, QObject *parent) { - Version *instance = new Version(parent); - instance->updateFromJSON(source); +Version Version::fromJson(QJsonObject source) {Version instance; + instance->setFromJson(source, false); return instance; } -void Version::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void Version::setFromJson(QJsonObject source) { + m_major = fromJsonValue(source["Major"]); + m_minor = fromJsonValue(source["Minor"]); + m_build = fromJsonValue(source["Build"]); + m_revision = fromJsonValue(source["Revision"]); + m_majorRevision = fromJsonValue(source["MajorRevision"]); + m_minorRevision = fromJsonValue(source["MinorRevision"]); + } -QJsonObject Version::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject Version::toJson() { QJsonObject result; + result["Major"] = toJsonValue(m_major); + result["Minor"] = toJsonValue(m_minor); + result["Build"] = toJsonValue(m_build); + result["Revision"] = toJsonValue(m_revision); + result["MajorRevision"] = toJsonValue(m_majorRevision); + result["MinorRevision"] = toJsonValue(m_minorRevision); + return result; } + qint32 Version::major() const { return m_major; } + void Version::setMajor(qint32 newMajor) { m_major = newMajor; - emit majorChanged(newMajor); } - qint32 Version::minor() const { return m_minor; } + void Version::setMinor(qint32 newMinor) { m_minor = newMinor; - emit minorChanged(newMinor); } - qint32 Version::build() const { return m_build; } + void Version::setBuild(qint32 newBuild) { m_build = newBuild; - emit buildChanged(newBuild); } - qint32 Version::revision() const { return m_revision; } + void Version::setRevision(qint32 newRevision) { m_revision = newRevision; - emit revisionChanged(newRevision); } - qint32 Version::majorRevision() const { return m_majorRevision; } + void Version::setMajorRevision(qint32 newMajorRevision) { m_majorRevision = newMajorRevision; - emit majorRevisionChanged(newMajorRevision); } - qint32 Version::minorRevision() const { return m_minorRevision; } + void Version::setMinorRevision(qint32 newMinorRevision) { m_minorRevision = newMinorRevision; - emit minorRevisionChanged(newMinorRevision); } diff --git a/core/src/DTO/versioninfo.cpp b/core/src/DTO/versioninfo.cpp index 123bc4e..7662ab0 100644 --- a/core/src/DTO/versioninfo.cpp +++ b/core/src/DTO/versioninfo.cpp @@ -32,74 +32,86 @@ namespace Jellyfin { namespace DTO { -VersionInfo::VersionInfo(QObject *parent) : QObject(parent) {} +VersionInfo::VersionInfo(QObject *parent) {} -VersionInfo *VersionInfo::fromJSON(QJsonObject source, QObject *parent) { - VersionInfo *instance = new VersionInfo(parent); - instance->updateFromJSON(source); +VersionInfo VersionInfo::fromJson(QJsonObject source) {VersionInfo instance; + instance->setFromJson(source, false); return instance; } -void VersionInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void VersionInfo::setFromJson(QJsonObject source) { + m_version = fromJsonValue(source["version"]); + m_versionNumber = fromJsonValue>(source["VersionNumber"]); + m_changelog = fromJsonValue(source["changelog"]); + m_targetAbi = fromJsonValue(source["targetAbi"]); + m_sourceUrl = fromJsonValue(source["sourceUrl"]); + m_checksum = fromJsonValue(source["checksum"]); + m_timestamp = fromJsonValue(source["timestamp"]); + m_repositoryName = fromJsonValue(source["repositoryName"]); + m_repositoryUrl = fromJsonValue(source["repositoryUrl"]); + } -QJsonObject VersionInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject VersionInfo::toJson() { QJsonObject result; + result["version"] = toJsonValue(m_version); + result["VersionNumber"] = toJsonValue>(m_versionNumber); + result["changelog"] = toJsonValue(m_changelog); + result["targetAbi"] = toJsonValue(m_targetAbi); + result["sourceUrl"] = toJsonValue(m_sourceUrl); + result["checksum"] = toJsonValue(m_checksum); + result["timestamp"] = toJsonValue(m_timestamp); + result["repositoryName"] = toJsonValue(m_repositoryName); + result["repositoryUrl"] = toJsonValue(m_repositoryUrl); + return result; } + QString VersionInfo::version() const { return m_version; } + void VersionInfo::setVersion(QString newVersion) { m_version = newVersion; - emit versionChanged(newVersion); } +QSharedPointer VersionInfo::versionNumber() const { return m_versionNumber; } -Version * VersionInfo::versionNumber() const { return m_versionNumber; } -void VersionInfo::setVersionNumber(Version * newVersionNumber) { +void VersionInfo::setVersionNumber(QSharedPointer newVersionNumber) { m_versionNumber = newVersionNumber; - emit versionNumberChanged(newVersionNumber); } - QString VersionInfo::changelog() const { return m_changelog; } + void VersionInfo::setChangelog(QString newChangelog) { m_changelog = newChangelog; - emit changelogChanged(newChangelog); } - QString VersionInfo::targetAbi() const { return m_targetAbi; } + void VersionInfo::setTargetAbi(QString newTargetAbi) { m_targetAbi = newTargetAbi; - emit targetAbiChanged(newTargetAbi); } - QString VersionInfo::sourceUrl() const { return m_sourceUrl; } + void VersionInfo::setSourceUrl(QString newSourceUrl) { m_sourceUrl = newSourceUrl; - emit sourceUrlChanged(newSourceUrl); } - QString VersionInfo::checksum() const { return m_checksum; } + void VersionInfo::setChecksum(QString newChecksum) { m_checksum = newChecksum; - emit checksumChanged(newChecksum); } - QString VersionInfo::timestamp() const { return m_timestamp; } + void VersionInfo::setTimestamp(QString newTimestamp) { m_timestamp = newTimestamp; - emit timestampChanged(newTimestamp); } - QString VersionInfo::repositoryName() const { return m_repositoryName; } + void VersionInfo::setRepositoryName(QString newRepositoryName) { m_repositoryName = newRepositoryName; - emit repositoryNameChanged(newRepositoryName); } - QString VersionInfo::repositoryUrl() const { return m_repositoryUrl; } + void VersionInfo::setRepositoryUrl(QString newRepositoryUrl) { m_repositoryUrl = newRepositoryUrl; - emit repositoryUrlChanged(newRepositoryUrl); } diff --git a/core/src/DTO/virtualfolderinfo.cpp b/core/src/DTO/virtualfolderinfo.cpp index 239cfa6..d83c644 100644 --- a/core/src/DTO/virtualfolderinfo.cpp +++ b/core/src/DTO/virtualfolderinfo.cpp @@ -32,68 +32,79 @@ namespace Jellyfin { namespace DTO { -VirtualFolderInfo::VirtualFolderInfo(QObject *parent) : QObject(parent) {} +VirtualFolderInfo::VirtualFolderInfo(QObject *parent) {} -VirtualFolderInfo *VirtualFolderInfo::fromJSON(QJsonObject source, QObject *parent) { - VirtualFolderInfo *instance = new VirtualFolderInfo(parent); - instance->updateFromJSON(source); +VirtualFolderInfo VirtualFolderInfo::fromJson(QJsonObject source) {VirtualFolderInfo instance; + instance->setFromJson(source, false); return instance; } -void VirtualFolderInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void VirtualFolderInfo::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_locations = fromJsonValue(source["Locations"]); + m_collectionType = fromJsonValue(source["CollectionType"]); + m_libraryOptions = fromJsonValue>(source["LibraryOptions"]); + m_itemId = fromJsonValue(source["ItemId"]); + m_primaryImageItemId = fromJsonValue(source["PrimaryImageItemId"]); + m_refreshProgress = fromJsonValue(source["RefreshProgress"]); + m_refreshStatus = fromJsonValue(source["RefreshStatus"]); + } -QJsonObject VirtualFolderInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject VirtualFolderInfo::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Locations"] = toJsonValue(m_locations); + result["CollectionType"] = toJsonValue(m_collectionType); + result["LibraryOptions"] = toJsonValue>(m_libraryOptions); + result["ItemId"] = toJsonValue(m_itemId); + result["PrimaryImageItemId"] = toJsonValue(m_primaryImageItemId); + result["RefreshProgress"] = toJsonValue(m_refreshProgress); + result["RefreshStatus"] = toJsonValue(m_refreshStatus); + return result; } + QString VirtualFolderInfo::name() const { return m_name; } + void VirtualFolderInfo::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QStringList VirtualFolderInfo::locations() const { return m_locations; } + void VirtualFolderInfo::setLocations(QStringList newLocations) { m_locations = newLocations; - emit locationsChanged(newLocations); } - QString VirtualFolderInfo::collectionType() const { return m_collectionType; } + void VirtualFolderInfo::setCollectionType(QString newCollectionType) { m_collectionType = newCollectionType; - emit collectionTypeChanged(newCollectionType); } +QSharedPointer VirtualFolderInfo::libraryOptions() const { return m_libraryOptions; } -LibraryOptions * VirtualFolderInfo::libraryOptions() const { return m_libraryOptions; } -void VirtualFolderInfo::setLibraryOptions(LibraryOptions * newLibraryOptions) { +void VirtualFolderInfo::setLibraryOptions(QSharedPointer newLibraryOptions) { m_libraryOptions = newLibraryOptions; - emit libraryOptionsChanged(newLibraryOptions); } - QString VirtualFolderInfo::itemId() const { return m_itemId; } + void VirtualFolderInfo::setItemId(QString newItemId) { m_itemId = newItemId; - emit itemIdChanged(newItemId); } - QString VirtualFolderInfo::primaryImageItemId() const { return m_primaryImageItemId; } + void VirtualFolderInfo::setPrimaryImageItemId(QString newPrimaryImageItemId) { m_primaryImageItemId = newPrimaryImageItemId; - emit primaryImageItemIdChanged(newPrimaryImageItemId); } - double VirtualFolderInfo::refreshProgress() const { return m_refreshProgress; } + void VirtualFolderInfo::setRefreshProgress(double newRefreshProgress) { m_refreshProgress = newRefreshProgress; - emit refreshProgressChanged(newRefreshProgress); } - QString VirtualFolderInfo::refreshStatus() const { return m_refreshStatus; } + void VirtualFolderInfo::setRefreshStatus(QString newRefreshStatus) { m_refreshStatus = newRefreshStatus; - emit refreshStatusChanged(newRefreshStatus); } diff --git a/core/src/DTO/wakeonlaninfo.cpp b/core/src/DTO/wakeonlaninfo.cpp index c84803b..25cd8bd 100644 --- a/core/src/DTO/wakeonlaninfo.cpp +++ b/core/src/DTO/wakeonlaninfo.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -WakeOnLanInfo::WakeOnLanInfo(QObject *parent) : QObject(parent) {} +WakeOnLanInfo::WakeOnLanInfo(QObject *parent) {} -WakeOnLanInfo *WakeOnLanInfo::fromJSON(QJsonObject source, QObject *parent) { - WakeOnLanInfo *instance = new WakeOnLanInfo(parent); - instance->updateFromJSON(source); +WakeOnLanInfo WakeOnLanInfo::fromJson(QJsonObject source) {WakeOnLanInfo instance; + instance->setFromJson(source, false); return instance; } -void WakeOnLanInfo::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void WakeOnLanInfo::setFromJson(QJsonObject source) { + m_macAddress = fromJsonValue(source["MacAddress"]); + m_port = fromJsonValue(source["Port"]); + } -QJsonObject WakeOnLanInfo::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject WakeOnLanInfo::toJson() { QJsonObject result; + result["MacAddress"] = toJsonValue(m_macAddress); + result["Port"] = toJsonValue(m_port); + return result; } + QString WakeOnLanInfo::macAddress() const { return m_macAddress; } + void WakeOnLanInfo::setMacAddress(QString newMacAddress) { m_macAddress = newMacAddress; - emit macAddressChanged(newMacAddress); } - qint32 WakeOnLanInfo::port() const { return m_port; } + void WakeOnLanInfo::setPort(qint32 newPort) { m_port = newPort; - emit portChanged(newPort); } diff --git a/core/src/DTO/xmlattribute.cpp b/core/src/DTO/xmlattribute.cpp index 5148053..b086577 100644 --- a/core/src/DTO/xmlattribute.cpp +++ b/core/src/DTO/xmlattribute.cpp @@ -32,32 +32,37 @@ namespace Jellyfin { namespace DTO { -XmlAttribute::XmlAttribute(QObject *parent) : QObject(parent) {} +XmlAttribute::XmlAttribute(QObject *parent) {} -XmlAttribute *XmlAttribute::fromJSON(QJsonObject source, QObject *parent) { - XmlAttribute *instance = new XmlAttribute(parent); - instance->updateFromJSON(source); +XmlAttribute XmlAttribute::fromJson(QJsonObject source) {XmlAttribute instance; + instance->setFromJson(source, false); return instance; } -void XmlAttribute::updateFromJSON(QJsonObject source) { - Q_UNIMPLEMENTED(); + +void XmlAttribute::setFromJson(QJsonObject source) { + m_name = fromJsonValue(source["Name"]); + m_value = fromJsonValue(source["Value"]); + } -QJsonObject XmlAttribute::toJSON() { - Q_UNIMPLEMENTED(); + +QJsonObject XmlAttribute::toJson() { QJsonObject result; + result["Name"] = toJsonValue(m_name); + result["Value"] = toJsonValue(m_value); + return result; } + QString XmlAttribute::name() const { return m_name; } + void XmlAttribute::setName(QString newName) { m_name = newName; - emit nameChanged(newName); } - QString XmlAttribute::value() const { return m_value; } + void XmlAttribute::setValue(QString newValue) { m_value = newValue; - emit valueChanged(newValue); } diff --git a/core/src/support/loader.cpp b/core/src/support/loader.cpp index 127fa1a..85354cf 100644 --- a/core/src/support/loader.cpp +++ b/core/src/support/loader.cpp @@ -1,6 +1 @@ #include - -Loader::Loader() -{ - -}