File indexing completed on 2024-06-02 05:00:30
0001 // SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im> 0002 // SPDX-License-Identifier: GPL-3.0-or-later 0003 0004 #pragma once 0005 0006 #include "channel.h" 0007 #include "playlist.h" 0008 #include "qinvidiousglobal.h" 0009 #include "videobasicinfo.h" 0010 #include "videothumbnail.h" 0011 0012 #include <QDateTime> 0013 #include <QUrl> 0014 0015 namespace QInvidious 0016 { 0017 0018 class SearchResult 0019 { 0020 public: 0021 FROM_JSON_OVERLOADS(SearchResult) 0022 static SearchResult fromJson(const QJsonObject &, SearchResult &); 0023 0024 // TODO: maybe remove this and expose the std::optional, which might look cleaner? 0025 enum class Type { Video, Channel, Playlist }; 0026 0027 Type type() const; 0028 0029 VideoBasicInfo const &video() const; 0030 void setVideo(const VideoBasicInfo &video); 0031 0032 Channel const &channel() const; 0033 0034 Playlist const &playlist() const; 0035 0036 private: 0037 std::optional<VideoBasicInfo> m_videoBasicInfo; 0038 std::optional<Channel> m_channel; 0039 std::optional<Playlist> m_playlist; 0040 Type m_type = Type::Video; 0041 }; 0042 0043 }