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

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/extra/hupnp_av/src/contentdirectory/htransferprogressinfo.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 "htransferprogressinfo.h"
 
23
 
 
24
#include <QtCore/QString>
 
25
 
 
26
namespace Herqq
 
27
{
 
28
 
 
29
namespace Upnp
 
30
{
 
31
 
 
32
namespace Av
 
33
{
 
34
 
 
35
class HTransferProgressInfoPrivate :
 
36
    public QSharedData
 
37
{
 
38
H_DISABLE_ASSIGN(HTransferProgressInfoPrivate)
 
39
 
 
40
public:
 
41
    quint32 m_length;
 
42
    HTransferProgressInfo::Status m_status;
 
43
    quint32 m_total;
 
44
 
 
45
    HTransferProgressInfoPrivate() :
 
46
        m_length(0), m_status(HTransferProgressInfo::Error), m_total(0)
 
47
    {
 
48
    }
 
49
 
 
50
    HTransferProgressInfoPrivate(
 
51
        quint32 length, HTransferProgressInfo::Status status, quint32 total) :
 
52
            m_length(length), m_status(status), m_total(total)
 
53
    {
 
54
    }
 
55
};
 
56
 
 
57
HTransferProgressInfo::HTransferProgressInfo() :
 
58
    h_ptr(new HTransferProgressInfoPrivate())
 
59
{
 
60
}
 
61
 
 
62
HTransferProgressInfo::HTransferProgressInfo(
 
63
    quint32 length, Status status, quint32 total) :
 
64
        h_ptr(new HTransferProgressInfoPrivate(length, status, total))
 
65
{
 
66
}
 
67
 
 
68
HTransferProgressInfo::HTransferProgressInfo(const HTransferProgressInfo& other) :
 
69
    h_ptr(other.h_ptr)
 
70
{
 
71
    Q_ASSERT(this != &other);
 
72
}
 
73
 
 
74
HTransferProgressInfo& HTransferProgressInfo::operator=(const HTransferProgressInfo& other)
 
75
{
 
76
    Q_ASSERT(this != &other);
 
77
    h_ptr = other.h_ptr;
 
78
    return *this;
 
79
}
 
80
 
 
81
HTransferProgressInfo::~HTransferProgressInfo()
 
82
{
 
83
}
 
84
 
 
85
HTransferProgressInfo::Status HTransferProgressInfo::fromString(const QString& arg)
 
86
{
 
87
    Status retVal = Error;
 
88
    if (arg.compare("IN_PROGRESS", Qt::CaseInsensitive) == 0)
 
89
    {
 
90
        retVal = InProgress;
 
91
    }
 
92
    else if (arg.compare("STOPPED", Qt::CaseInsensitive) == 0)
 
93
    {
 
94
        retVal = Stopped;
 
95
    }
 
96
    else if (arg.compare("COMPLETED", Qt::CaseInsensitive) == 0)
 
97
    {
 
98
        retVal = Completed;
 
99
    }
 
100
    return retVal;
 
101
}
 
102
 
 
103
bool HTransferProgressInfo::isEmpty() const
 
104
{
 
105
    return !h_ptr->m_length && !h_ptr->m_status && !h_ptr->m_total;
 
106
}
 
107
 
 
108
quint32 HTransferProgressInfo::length() const
 
109
{
 
110
    return h_ptr->m_length;
 
111
}
 
112
 
 
113
HTransferProgressInfo::Status HTransferProgressInfo::status() const
 
114
{
 
115
    return h_ptr->m_status;
 
116
}
 
117
 
 
118
quint32 HTransferProgressInfo::total() const
 
119
{
 
120
    return h_ptr->m_total;
 
121
}
 
122
 
 
123
bool operator==(
 
124
    const HTransferProgressInfo& obj1, const HTransferProgressInfo& obj2)
 
125
{
 
126
    return obj1.length() == obj2.length() &&
 
127
           obj1.status() == obj2.status() &&
 
128
           obj1.total() == obj2.total();
 
129
}
 
130
 
 
131
}
 
132
}
 
133
}