~ubuntu-branches/ubuntu/vivid/digikam/vivid

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/extra/hupnp_av/src/renderingcontrol/hchannel.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 "hchannel.h"
 
23
#include <HUpnpCore/private/hmisc_utils_p.h>
 
24
 
 
25
#include <QtCore/QSet>
 
26
 
 
27
namespace Herqq
 
28
{
 
29
 
 
30
namespace Upnp
 
31
{
 
32
 
 
33
namespace Av
 
34
{
 
35
 
 
36
/*******************************************************************************
 
37
 * HChannel
 
38
 ******************************************************************************/
 
39
HChannel::HChannel() :
 
40
    m_type(), m_typeAsString()
 
41
{
 
42
}
 
43
 
 
44
HChannel::HChannel(Type type) :
 
45
    m_type(type), m_typeAsString(toString(type))
 
46
{
 
47
}
 
48
 
 
49
HChannel::HChannel(const QString& arg) :
 
50
    m_type(), m_typeAsString()
 
51
{
 
52
    QString trimmed = arg.trimmed();
 
53
    m_type = fromString(trimmed);
 
54
    m_typeAsString = trimmed;
 
55
}
 
56
 
 
57
QString HChannel::toString(Type type)
 
58
{
 
59
    QString retVal;
 
60
    switch(type)
 
61
    {
 
62
    case Master:
 
63
        retVal = "Master";
 
64
        break;
 
65
    case LeftFront:
 
66
        retVal = "LF";
 
67
        break;
 
68
    case RightFront:
 
69
        retVal = "RF";
 
70
        break;
 
71
    case CenterFront:
 
72
        retVal = "CF";
 
73
        break;
 
74
    case LFE:
 
75
        retVal = "LFE";
 
76
        break;
 
77
    case LeftSurround:
 
78
        retVal = "LS";
 
79
        break;
 
80
    case RightSurround:
 
81
        retVal = "RS";
 
82
        break;
 
83
    case LeftOfCenter:
 
84
        retVal = "LFC";
 
85
        break;
 
86
    case RightOfCenter:
 
87
        retVal = "RFC";
 
88
        break;
 
89
    case Surround:
 
90
        retVal = "SD";
 
91
        break;
 
92
    case SideLeft:
 
93
        retVal = "SL";
 
94
        break;
 
95
    case SideRight:
 
96
        retVal = "SR";
 
97
        break;
 
98
    case Top:
 
99
        retVal = "T";
 
100
        break;
 
101
    case Bottom:
 
102
        retVal = "B";
 
103
        break;
 
104
    default:
 
105
        break;
 
106
    }
 
107
    return retVal;
 
108
}
 
109
 
 
110
HChannel::Type HChannel::fromString(const QString& type)
 
111
{
 
112
    Type retVal = Undefined;
 
113
    if (type.compare("MASTER", Qt::CaseInsensitive) == 0)
 
114
    {
 
115
        retVal = Master;
 
116
    }
 
117
    else if (type.compare("LF", Qt::CaseInsensitive) == 0)
 
118
    {
 
119
        retVal = LeftFront;
 
120
    }
 
121
    else if (type.compare("RF", Qt::CaseInsensitive) == 0)
 
122
    {
 
123
        retVal = RightFront;
 
124
    }
 
125
    else if (type.compare("CF", Qt::CaseInsensitive) == 0)
 
126
    {
 
127
        retVal = CenterFront;
 
128
    }
 
129
    else if (type.compare("LFE", Qt::CaseInsensitive) == 0)
 
130
    {
 
131
        retVal = LFE;
 
132
    }
 
133
    else if (type.compare("LS", Qt::CaseInsensitive) == 0)
 
134
    {
 
135
        retVal = LeftSurround;
 
136
    }
 
137
    else if (type.compare("RS", Qt::CaseInsensitive) == 0)
 
138
    {
 
139
        retVal = RightSurround;
 
140
    }
 
141
    else if (type.compare("LFC", Qt::CaseInsensitive) == 0)
 
142
    {
 
143
        retVal = LeftOfCenter;
 
144
    }
 
145
    else if (type.compare("RFC", Qt::CaseInsensitive) == 0)
 
146
    {
 
147
        retVal = RightOfCenter;
 
148
    }
 
149
    else if (type.compare("SD", Qt::CaseInsensitive) == 0)
 
150
    {
 
151
        retVal = Surround;
 
152
    }
 
153
    else if (type.compare("SL", Qt::CaseInsensitive) == 0)
 
154
    {
 
155
        retVal = SideLeft;
 
156
    }
 
157
    else if (type.compare("SR", Qt::CaseInsensitive) == 0)
 
158
    {
 
159
        retVal = SideRight;
 
160
    }
 
161
    else if (type.compare("T", Qt::CaseInsensitive) == 0)
 
162
    {
 
163
        retVal = Top;
 
164
    }
 
165
    else if (type.compare("B", Qt::CaseInsensitive) == 0)
 
166
    {
 
167
        retVal = Bottom;
 
168
    }
 
169
    else if (!type.isEmpty())
 
170
    {
 
171
        retVal = VendorDefined;
 
172
    }
 
173
    return retVal;
 
174
}
 
175
 
 
176
QSet<HChannel> HChannel::allChannels()
 
177
{
 
178
    QSet<HChannel> retVal;
 
179
    retVal.insert(Master);
 
180
    retVal.insert(LeftFront);
 
181
    retVal.insert(RightFront);
 
182
    retVal.insert(CenterFront);
 
183
    retVal.insert(LFE);
 
184
    retVal.insert(LeftSurround);
 
185
    retVal.insert(RightSurround);
 
186
    retVal.insert(LeftOfCenter);
 
187
    retVal.insert(RightOfCenter);
 
188
    retVal.insert(Surround);
 
189
    retVal.insert(SideLeft);
 
190
    retVal.insert(SideRight);
 
191
    retVal.insert(Top);
 
192
    retVal.insert(Bottom);
 
193
    return retVal;
 
194
}
 
195
 
 
196
bool operator==(const HChannel& obj1, const HChannel& obj2)
 
197
{
 
198
    return obj1.toString() == obj2.toString();
 
199
}
 
200
 
 
201
quint32 qHash(const HChannel& key)
 
202
{
 
203
    QByteArray data = key.toString().toLocal8Bit();
 
204
    return hash(data.constData(), data.size());
 
205
}
 
206
 
 
207
}
 
208
}
 
209
}