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 "htransferprogressinfo.h"
24
#include <QtCore/QString>
35
class HTransferProgressInfoPrivate :
38
H_DISABLE_ASSIGN(HTransferProgressInfoPrivate)
42
HTransferProgressInfo::Status m_status;
45
HTransferProgressInfoPrivate() :
46
m_length(0), m_status(HTransferProgressInfo::Error), m_total(0)
50
HTransferProgressInfoPrivate(
51
quint32 length, HTransferProgressInfo::Status status, quint32 total) :
52
m_length(length), m_status(status), m_total(total)
57
HTransferProgressInfo::HTransferProgressInfo() :
58
h_ptr(new HTransferProgressInfoPrivate())
62
HTransferProgressInfo::HTransferProgressInfo(
63
quint32 length, Status status, quint32 total) :
64
h_ptr(new HTransferProgressInfoPrivate(length, status, total))
68
HTransferProgressInfo::HTransferProgressInfo(const HTransferProgressInfo& other) :
71
Q_ASSERT(this != &other);
74
HTransferProgressInfo& HTransferProgressInfo::operator=(const HTransferProgressInfo& other)
76
Q_ASSERT(this != &other);
81
HTransferProgressInfo::~HTransferProgressInfo()
85
HTransferProgressInfo::Status HTransferProgressInfo::fromString(const QString& arg)
87
Status retVal = Error;
88
if (arg.compare("IN_PROGRESS", Qt::CaseInsensitive) == 0)
92
else if (arg.compare("STOPPED", Qt::CaseInsensitive) == 0)
96
else if (arg.compare("COMPLETED", Qt::CaseInsensitive) == 0)
103
bool HTransferProgressInfo::isEmpty() const
105
return !h_ptr->m_length && !h_ptr->m_status && !h_ptr->m_total;
108
quint32 HTransferProgressInfo::length() const
110
return h_ptr->m_length;
113
HTransferProgressInfo::Status HTransferProgressInfo::status() const
115
return h_ptr->m_status;
118
quint32 HTransferProgressInfo::total() const
120
return h_ptr->m_total;
124
const HTransferProgressInfo& obj1, const HTransferProgressInfo& obj2)
126
return obj1.length() == obj2.length() &&
127
obj1.status() == obj2.status() &&
128
obj1.total() == obj2.total();