1 /***************************************************************************
2 * Copyright (C) 2005-2013 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),
32 renameObject(QString("Transfer/%1").arg(_uuid.toString()));
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())
46 renameObject(QString("Transfer/%1").arg(_uuid.toString()));
50 QUuid Transfer::uuid() const
56 Transfer::State Transfer::state() const
62 void Transfer::setState(Transfer::State state)
64 if (_state != state) {
67 emit stateChanged(state);
73 Transfer::Direction Transfer::direction() const
79 void Transfer::setDirection(Transfer::Direction direction)
81 if (_direction != direction) {
82 _direction = direction;
84 emit directionChanged(direction);
89 QHostAddress Transfer::address() const
95 void Transfer::setAddress(const QHostAddress &address)
97 if (_address != address) {
100 emit addressChanged(address);
105 quint16 Transfer::port() const
111 void Transfer::setPort(quint16 port)
116 emit portChanged(port);
121 QString Transfer::fileName() const
127 void Transfer::setFileName(const QString &fileName)
129 if (_fileName != fileName) {
130 _fileName = fileName;
132 emit fileNameChanged(fileName);
137 quint64 Transfer::fileSize() const
143 void Transfer::setFileSize(quint64 fileSize)
145 if (_fileSize != fileSize) {
146 _fileSize = fileSize;
148 emit fileSizeChanged(fileSize);
153 QString Transfer::nick() const
159 void Transfer::setNick(const QString &nick)
164 emit nickChanged(nick);