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 "hplaymode.h"
33
/*******************************************************************************
35
******************************************************************************/
36
HPlayMode::HPlayMode() :
37
m_type(Undefined), m_typeAsString()
41
HPlayMode::HPlayMode(HPlayMode::Type type) :
42
m_type(type), m_typeAsString(HPlayMode::toString(type))
46
HPlayMode::HPlayMode(const QString& arg) :
47
m_type(), m_typeAsString()
49
QString trimmed = arg.trimmed();
50
m_type = fromString(trimmed);
51
m_typeAsString = trimmed;
54
QString HPlayMode::toString(HPlayMode::Type type)
69
retVal = "REPEAT_ONE";
72
retVal = "REPEAT_ALL";
87
HPlayMode::Type HPlayMode::fromString(const QString& type)
89
Type retVal = Undefined;
90
if (type.compare("NORMAL", Qt::CaseInsensitive) == 0)
94
else if (type.compare("SHUFFLE", Qt::CaseInsensitive) == 0)
98
else if (type.compare("REPEAT_ONE", Qt::CaseInsensitive) == 0)
102
else if (type.compare("REPEAT_ALL", Qt::CaseInsensitive) == 0)
106
else if (type.compare("RANDOM", Qt::CaseInsensitive) == 0)
110
else if (type.compare("DIRECT_1", Qt::CaseInsensitive) == 0)
114
else if (type.compare("INTRO", Qt::CaseInsensitive) == 0)
118
else if (!type.isEmpty())
120
retVal = VendorDefined;
125
bool operator==(const HPlayMode& obj1, const HPlayMode& obj2)
127
return obj1.toString() == obj2.toString();