From 10a0a0ea6c571b4455be8632a6aaf5493c8d9474 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 8 Jul 2019 14:07:06 +0200 Subject: [PATCH] Add missing files, copyright headers --- libnymea/types/browseritem.cpp | 22 ++++++++++ libnymea/types/browseritem.h | 22 ++++++++++ libnymea/types/mediabrowseritem.cpp | 53 +++++++++++++++++++++++ libnymea/types/mediabrowseritem.h | 67 +++++++++++++++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 libnymea/types/mediabrowseritem.cpp create mode 100644 libnymea/types/mediabrowseritem.h diff --git a/libnymea/types/browseritem.cpp b/libnymea/types/browseritem.cpp index 5a3f1c7b..58c745c4 100644 --- a/libnymea/types/browseritem.cpp +++ b/libnymea/types/browseritem.cpp @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Michael Zanetti * + * * + * This file is part of nymea. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #include "browseritem.h" diff --git a/libnymea/types/browseritem.h b/libnymea/types/browseritem.h index c0d516a1..047eeea3 100644 --- a/libnymea/types/browseritem.h +++ b/libnymea/types/browseritem.h @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Michael Zanetti * + * * + * This file is part of nymea. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #ifndef BROWSERITEM_H #define BROWSERITEM_H diff --git a/libnymea/types/mediabrowseritem.cpp b/libnymea/types/mediabrowseritem.cpp new file mode 100644 index 00000000..f0ea0264 --- /dev/null +++ b/libnymea/types/mediabrowseritem.cpp @@ -0,0 +1,53 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Michael Zanetti * + * * + * This file is part of nymea. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "mediabrowseritem.h" + +MediaBrowserItem::MediaBrowserItem(const QString &id, const QString &displayName, bool browsable): + BrowserItem(id, displayName, browsable) +{ + // Init defaults + m_extendedProperties["mediaIcon"] = static_cast(MediaBrowserIconNone); + m_extendedProperties["playCount"] = 0; + + m_extendedPropertiesFlags.setFlag(BrowserItem::ExtendedPropertiesMedia); +} + +MediaBrowserItem::MediaBrowserIcon MediaBrowserItem::mediaIcon() const +{ + return static_cast(m_extendedProperties.value("mediaIcon").toInt()); +} + +void MediaBrowserItem::setMediaIcon(MediaBrowserIcon mediaIcon) +{ + m_extendedProperties["mediaIcon"] = static_cast(mediaIcon); +} + +int MediaBrowserItem::playCount() const +{ + return m_extendedProperties.value("playCount").toInt(); +} + +void MediaBrowserItem::setPlayCount(int playCount) +{ + m_extendedProperties["playCount"] = playCount; +} diff --git a/libnymea/types/mediabrowseritem.h b/libnymea/types/mediabrowseritem.h new file mode 100644 index 00000000..69ba0f5b --- /dev/null +++ b/libnymea/types/mediabrowseritem.h @@ -0,0 +1,67 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Michael Zanetti * + * * + * This file is part of nymea. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef MEDIABROWSERITEM_H +#define MEDIABROWSERITEM_H + +#include + +#include "browseritem.h" + +class MediaBrowserItem: public BrowserItem +{ + Q_GADGET +public: + enum MediaBrowserIcon { + MediaBrowserIconNone = 1, + MediaBrowserIconPlaylist = 2, + MediaBrowserIconRecentlyPlayed = 3, + MediaBrowserIconLibrary = 4, + MediaBrowserIconMusicLibrary = 5, + MediaBrowserIconVideoLibrary = 6, + MediaBrowserIconPictureLibrary = 7, + + MediaBrowserIconDisk = 100, + MediaBrowserIconUSB = 101, + MediaBrowserIconNetwork = 102, + MediaBrowserIconAux = 103, + + MediaBrowserIconSpotify = 200, + MediaBrowserIconAmazon = 201, + MediaBrowserIconTuneIn = 202, + MediaBrowserIconSiriusXM = 203, + MediaBrowserIconVTuner = 204, + MediaBrowserIconTidal = 205, + MediaBrowserIconAirable = 206, + }; + Q_ENUM(MediaBrowserIcon) + + MediaBrowserItem(const QString &id = QString(), const QString &displayName = QString(), bool browsable = false); + + MediaBrowserIcon mediaIcon() const; + void setMediaIcon(MediaBrowserIcon mediaIcon); + + int playCount() const; + void setPlayCount(int playCount); +}; + +#endif // MEDIABROWSERITEM_H