1 /***************************************************************************
2 * Copyright (C) 2005-2014 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 INIT_SYNCABLE_OBJECT(Transfer)
24 Transfer::Transfer(const QUuid &uuid, QObject *parent)
25 : SyncableObject(parent),
35 Transfer::Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent)
36 : SyncableObject(parent),
38 _direction(direction),
44 _uuid(QUuid::createUuid())
52 renameObject(QString("Transfer/%1").arg(_uuid.toString()));
53 setAllowClientUpdates(true);
57 QUuid Transfer::uuid() const
63 Transfer::State Transfer::state() const
69 void Transfer::setState(Transfer::State state)
71 if (_state != state) {
74 emit stateChanged(state);
80 Transfer::Direction Transfer::direction() const
86 void Transfer::setDirection(Transfer::Direction direction)
88 if (_direction != direction) {
89 _direction = direction;
91 emit directionChanged(direction);
96 QHostAddress Transfer::address() const
102 void Transfer::setAddress(const QHostAddress &address)
104 if (_address != address) {
107 emit addressChanged(address);
112 quint16 Transfer::port() const
118 void Transfer::setPort(quint16 port)
123 emit portChanged(port);
128 QString Transfer::fileName() const
134 void Transfer::setFileName(const QString &fileName)
136 if (_fileName != fileName) {
137 _fileName = fileName;
139 emit fileNameChanged(fileName);
144 quint64 Transfer::fileSize() const
150 void Transfer::setFileSize(quint64 fileSize)
152 if (_fileSize != fileSize) {
153 _fileSize = fileSize;
155 emit fileSizeChanged(fileSize);
160 QString Transfer::nick() const
166 void Transfer::setNick(const QString &nick)
171 emit nickChanged(nick);
176 void Transfer::setError(const QString &errorString)
178 qWarning() << Q_FUNC_INFO << errorString;
179 emit error(errorString);