2
* Copyright (C) 2011 Tuomo Penttinen, all rights reserved.
4
* Author: Tuomo Penttinen <tp@herqq.org>
6
* This file is part of Herqq UPnP Av (HUPnPAv) library.
8
* Herqq UPnP Av is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Herqq UPnP Av is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Herqq UPnP Av. If not, see <http://www.gnu.org/licenses/>.
22
#include "himageitem.h"
23
#include "himageitem_p.h"
24
#include "../../common/hrating.h"
25
#include "../../common/hstoragemedium.h"
26
#include "../model_mgmt/hcdsproperties.h"
28
#include <QtCore/QDateTime>
29
#include <QtCore/QStringList>
40
/*******************************************************************************
42
******************************************************************************/
43
HImageItemPrivate::HImageItemPrivate(
44
const QString& clazz, HObject::CdsType cdsType) :
45
HItemPrivate(clazz, cdsType)
47
const HCdsProperties& inst = HCdsProperties::instance();
48
insert(inst.get(HCdsProperties::upnp_longDescription));
49
insert(inst.get(HCdsProperties::upnp_storageMedium));
50
insert(inst.get(HCdsProperties::upnp_rating));
51
insert(inst.get(HCdsProperties::dc_description));
52
insert(inst.get(HCdsProperties::dc_publisher));
53
insert(inst.get(HCdsProperties::dc_date));
54
insert(inst.get(HCdsProperties::dc_rights));
57
/*******************************************************************************
59
******************************************************************************/
60
HImageItem::HImageItem(const QString& clazz, HObject::CdsType cdsType) :
61
HItem(*new HImageItemPrivate(clazz, cdsType))
65
HImageItem::HImageItem(HImageItemPrivate& dd) :
70
HImageItem::HImageItem(
71
const QString& title, const QString& parentId, const QString& id) :
72
HItem(*new HImageItemPrivate(sClass(), sType()))
74
init(title, parentId, id);
77
HImageItem::~HImageItem()
81
HImageItem* HImageItem::newInstance() const
83
return new HImageItem();
86
QString HImageItem::longDescription() const
89
getCdsProperty(HCdsProperties::upnp_longDescription, &value);
90
return value.toString();
93
HStorageMedium HImageItem::storageMedium() const
96
getCdsProperty(HCdsProperties::upnp_storageMedium, &value);
97
return value.value<HStorageMedium>();
100
QList<HRating> HImageItem::ratings() const
103
getCdsProperty(HCdsProperties::upnp_rating, &value);
104
return toList<HRating>(value.toList());
107
QString HImageItem::description() const
110
getCdsProperty(HCdsProperties::dc_description, &value);
111
return value.toString();
114
QStringList HImageItem::publishers() const
117
getCdsProperty(HCdsProperties::dc_publisher, &value);
118
return value.toStringList();
121
QDateTime HImageItem::date() const
124
getCdsProperty(HCdsProperties::dc_date, &value);
125
return value.toDateTime();
128
QStringList HImageItem::rights() const
131
getCdsProperty(HCdsProperties::dc_rights, &value);
132
return value.toStringList();
135
void HImageItem::setLongDescription(const QString& arg)
137
setCdsProperty(HCdsProperties::upnp_longDescription, QVariant::fromValue(arg));
140
void HImageItem::setStorageMedium(const HStorageMedium& arg)
142
setCdsProperty(HCdsProperties::upnp_storageMedium, QVariant::fromValue(arg));
145
void HImageItem::setRatings(const QList<HRating>& arg)
147
setCdsProperty(HCdsProperties::upnp_rating, toList(arg));
150
void HImageItem::setDescription(const QString& arg)
152
setCdsProperty(HCdsProperties::dc_description, QVariant::fromValue(arg));
155
void HImageItem::setPublishers(const QStringList& arg)
157
setCdsProperty(HCdsProperties::dc_publisher, QVariant::fromValue(arg));
160
void HImageItem::setDate(const QDateTime& arg)
162
setCdsProperty(HCdsProperties::dc_date, QVariant::fromValue(arg));
165
void HImageItem::setRights(const QStringList& arg)
167
setCdsProperty(HCdsProperties::dc_rights, QVariant::fromValue(arg));