~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/extra/hupnp/src/devicemodel/server/hserverdevice.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2010, 2011 Tuomo Penttinen, all rights reserved.
 
3
 *
 
4
 *  Author: Tuomo Penttinen <tp@herqq.org>
 
5
 *
 
6
 *  This file is part of Herqq UPnP (HUPnP) library.
 
7
 *
 
8
 *  Herqq UPnP is free software: you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU Lesser 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.
 
12
 *
 
13
 *  Herqq UPnP 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 Lesser General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU Lesser General Public License
 
19
 *  along with Herqq UPnP. If not, see <http://www.gnu.org/licenses/>.
 
20
 */
 
21
 
 
22
#include "hserverdevice.h"
 
23
#include "hserverdevice_p.h"
 
24
#include "hserverservice.h"
 
25
#include "hdefault_serverdevice_p.h"
 
26
 
 
27
#include "../../dataelements/hserviceid.h"
 
28
#include "../../dataelements/hdeviceinfo.h"
 
29
#include "../../dataelements/hserviceinfo.h"
 
30
 
 
31
#include "../../general/hupnp_global_p.h"
 
32
 
 
33
#include <QtCore/QString>
 
34
 
 
35
namespace Herqq
 
36
{
 
37
 
 
38
namespace Upnp
 
39
{
 
40
 
 
41
/*******************************************************************************
 
42
 * HServerDevicePrivate
 
43
 ******************************************************************************/
 
44
 
 
45
/*******************************************************************************
 
46
 * HServerDevice
 
47
 ******************************************************************************/
 
48
HServerDevice::HServerDevice() :
 
49
    QObject(),
 
50
        h_ptr(new HServerDevicePrivate())
 
51
{
 
52
}
 
53
 
 
54
HServerDevice::HServerDevice(HServerDevicePrivate& dd) :
 
55
    QObject(),
 
56
        h_ptr(&dd)
 
57
{
 
58
}
 
59
 
 
60
HServerDevice::~HServerDevice()
 
61
{
 
62
    delete h_ptr;
 
63
}
 
64
 
 
65
bool HServerDevice::finalizeInit(QString*)
 
66
{
 
67
    // intentionally empty
 
68
    Q_ASSERT(h_ptr->q_ptr);
 
69
    return true;
 
70
}
 
71
 
 
72
bool HServerDevice::init(const HDeviceInfo& info, HServerDevice* parentDevice)
 
73
{
 
74
    if (h_ptr->q_ptr)
 
75
    {
 
76
        return false;
 
77
    }
 
78
 
 
79
    if (parentDevice) { setParent(parentDevice); }
 
80
    h_ptr->m_parentDevice = parentDevice;
 
81
    h_ptr->m_deviceInfo.reset(new HDeviceInfo(info));
 
82
    h_ptr->q_ptr = this;
 
83
 
 
84
    return true;
 
85
}
 
86
 
 
87
HServerDevice* HServerDevice::parentDevice() const
 
88
{
 
89
    return h_ptr->m_parentDevice;
 
90
}
 
91
 
 
92
HServerDevice* HServerDevice::rootDevice() const
 
93
{
 
94
    return h_ptr->rootDevice();
 
95
}
 
96
 
 
97
HServerService* HServerDevice::serviceById(const HServiceId& serviceId) const
 
98
{
 
99
    return h_ptr->serviceById(serviceId);
 
100
}
 
101
 
 
102
const HServerServices& HServerDevice::services() const
 
103
{
 
104
    return h_ptr->m_services;
 
105
}
 
106
 
 
107
HServerServices HServerDevice::servicesByType(
 
108
    const HResourceType& type, HResourceType::VersionMatch versionMatch) const
 
109
{
 
110
    return h_ptr->servicesByType(type, versionMatch);
 
111
}
 
112
 
 
113
const HServerDevices& HServerDevice::embeddedDevices() const
 
114
{
 
115
    return h_ptr->m_embeddedDevices;
 
116
}
 
117
 
 
118
HServerDevices HServerDevice::embeddedDevicesByType(
 
119
    const HResourceType& type, HResourceType::VersionMatch versionMatch) const
 
120
{
 
121
    return h_ptr->embeddedDevicesByType(type, versionMatch);
 
122
}
 
123
 
 
124
const HDeviceInfo& HServerDevice::info() const
 
125
{
 
126
    return *h_ptr->m_deviceInfo;
 
127
}
 
128
 
 
129
QString HServerDevice::description() const
 
130
{
 
131
    return h_ptr->m_deviceDescription;
 
132
}
 
133
 
 
134
QList<QUrl> HServerDevice::locations(LocationUrlType urlType) const
 
135
{
 
136
    if (h_ptr->m_parentDevice)
 
137
    {
 
138
        // the root device "defines" the locations and they are the same for each
 
139
        // embedded device.
 
140
        return h_ptr->m_parentDevice->locations(urlType);
 
141
    }
 
142
 
 
143
    QList<QUrl> retVal;
 
144
    QList<QUrl>::const_iterator ci;
 
145
    for(ci = h_ptr->m_locations.begin(); ci != h_ptr->m_locations.end(); ++ci)
 
146
    {
 
147
        retVal.push_back(urlType == AbsoluteUrl ? *ci : extractBaseUrl(*ci));
 
148
    }
 
149
 
 
150
    return retVal;
 
151
}
 
152
 
 
153
const HDeviceStatus& HServerDevice::deviceStatus() const
 
154
{
 
155
    const HServerDevice* rootDev = rootDevice();
 
156
    return *rootDev->h_ptr->m_deviceStatus;
 
157
}
 
158
 
 
159
/*******************************************************************************
 
160
 * HDefaultServerDevice
 
161
 ******************************************************************************/
 
162
HDefaultServerDevice::HDefaultServerDevice() :
 
163
    HServerDevice()
 
164
{
 
165
}
 
166
 
 
167
}
 
168
}