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

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/extra/hupnp_av/src/transport/htransportinfo.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) 2011 Tuomo Penttinen, all rights reserved.
 
3
 *
 
4
 *  Author: Tuomo Penttinen <tp@herqq.org>
 
5
 *
 
6
 *  This file is part of Herqq UPnP Av (HUPnPAv) library.
 
7
 *
 
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.
 
12
 *
 
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.
 
17
 *
 
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/>.
 
20
 */
 
21
 
 
22
#include "htransportinfo.h"
 
23
 
 
24
namespace Herqq
 
25
{
 
26
 
 
27
namespace Upnp
 
28
{
 
29
 
 
30
namespace Av
 
31
{
 
32
 
 
33
/*******************************************************************************
 
34
 * HTransportStatus
 
35
 ******************************************************************************/
 
36
HTransportStatus::HTransportStatus() :
 
37
    m_type(Undefined), m_typeAsString()
 
38
{
 
39
}
 
40
 
 
41
HTransportStatus::HTransportStatus(Type type) :
 
42
    m_type(type), m_typeAsString(toString(type))
 
43
{
 
44
}
 
45
 
 
46
HTransportStatus::HTransportStatus(const QString& arg) :
 
47
    m_type(), m_typeAsString()
 
48
{
 
49
    QString trimmed = arg.trimmed();
 
50
    m_type = fromString(trimmed);
 
51
    m_typeAsString = trimmed;
 
52
}
 
53
 
 
54
QString HTransportStatus::toString(HTransportStatus::Type type)
 
55
{
 
56
    QString retVal;
 
57
    switch(type)
 
58
    {
 
59
    case HTransportStatus::OK:
 
60
        retVal = "OK";
 
61
        break;
 
62
    case HTransportStatus::ErrorOccurred:
 
63
        retVal = "ERROR_OCCURRED";
 
64
        break;
 
65
    default:
 
66
        break;
 
67
    }
 
68
    return retVal;
 
69
}
 
70
 
 
71
HTransportStatus::Type HTransportStatus::fromString(const QString& type)
 
72
{
 
73
    Type retVal = Undefined;
 
74
    if (type.compare("OK", Qt::CaseInsensitive) == 0)
 
75
    {
 
76
        retVal = OK;
 
77
    }
 
78
    else if (type.compare("ERROR_OCCURRED", Qt::CaseInsensitive) == 0)
 
79
    {
 
80
        retVal = ErrorOccurred;
 
81
    }
 
82
    else if (!type.isEmpty())
 
83
    {
 
84
        retVal = VendorDefined;
 
85
    }
 
86
    return retVal;
 
87
}
 
88
 
 
89
bool operator==(const HTransportStatus& obj1, const HTransportStatus& obj2)
 
90
{
 
91
    return obj1.toString() == obj2.toString();
 
92
}
 
93
 
 
94
/*******************************************************************************
 
95
 * HTransportInfoPrivate
 
96
 ******************************************************************************/
 
97
class HTransportInfoPrivate :
 
98
    public QSharedData
 
99
{
 
100
H_DISABLE_ASSIGN(HTransportInfoPrivate)
 
101
 
 
102
public:
 
103
 
 
104
    HTransportState m_transportState;
 
105
    HTransportStatus m_transportStatus;
 
106
    QString m_transportPlaySpeed;
 
107
 
 
108
    HTransportInfoPrivate() :
 
109
        m_transportState(), m_transportStatus(), m_transportPlaySpeed()
 
110
    {
 
111
    }
 
112
};
 
113
 
 
114
/*******************************************************************************
 
115
 * HTransportInfo
 
116
 ******************************************************************************/
 
117
HTransportInfo::HTransportInfo() :
 
118
    h_ptr(new HTransportInfoPrivate())
 
119
{
 
120
}
 
121
 
 
122
HTransportInfo::HTransportInfo(
 
123
    const HTransportState& state, const HTransportStatus& status,
 
124
    const QString& speed) :
 
125
        h_ptr(new HTransportInfoPrivate())
 
126
{
 
127
    h_ptr->m_transportState = state;
 
128
    h_ptr->m_transportStatus = status;
 
129
    h_ptr->m_transportPlaySpeed = speed;
 
130
}
 
131
 
 
132
HTransportInfo::HTransportInfo(const HTransportInfo& other) :
 
133
    h_ptr(other.h_ptr)
 
134
{
 
135
    Q_ASSERT(&other != this);
 
136
}
 
137
 
 
138
HTransportInfo& HTransportInfo::operator =(const HTransportInfo& other)
 
139
{
 
140
    Q_ASSERT(&other != this);
 
141
    h_ptr = other.h_ptr;
 
142
    return *this;
 
143
}
 
144
 
 
145
HTransportInfo::~HTransportInfo()
 
146
{
 
147
}
 
148
 
 
149
const HTransportState& HTransportInfo::state() const
 
150
{
 
151
    return h_ptr->m_transportState;
 
152
}
 
153
 
 
154
const HTransportStatus& HTransportInfo::status() const
 
155
{
 
156
    return h_ptr->m_transportStatus;
 
157
}
 
158
 
 
159
QString HTransportInfo::speed() const
 
160
{
 
161
    return h_ptr->m_transportPlaySpeed;
 
162
}
 
163
 
 
164
bool HTransportInfo::isValid()
 
165
{
 
166
    return h_ptr->m_transportState.isValid() && h_ptr->m_transportStatus.isValid();
 
167
}
 
168
 
 
169
void HTransportInfo::setState(const HTransportState& arg)
 
170
{
 
171
    h_ptr->m_transportState = arg;
 
172
}
 
173
 
 
174
void HTransportInfo::setStatus(const HTransportStatus& arg)
 
175
{
 
176
    h_ptr->m_transportStatus = arg;
 
177
}
 
178
 
 
179
void HTransportInfo::setSpeed(const QString& arg)
 
180
{
 
181
    h_ptr->m_transportPlaySpeed = arg;
 
182
}
 
183
 
 
184
bool operator==(const HTransportInfo& obj1, const HTransportInfo& obj2)
 
185
{
 
186
    return obj1.speed() == obj2.speed() &&
 
187
           obj1.state() == obj2.state() &&
 
188
           obj1.status() == obj2.status();
 
189
}
 
190
 
 
191
}
 
192
}
 
193
}