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 &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent)
36 : SyncableObject(parent),
38 _direction(direction),
43 _uuid(QUuid::createUuid())
45 renameObject(QString("Transfer/%1").arg(_uuid.toString()));
49 QUuid Transfer::uuid() const
55 Transfer::State Transfer::state() const
61 void Transfer::setState(Transfer::State state)
63 if (_state != state) {
66 emit stateChanged(state);
72 Transfer::Direction Transfer::direction() const
78 void Transfer::setDirection(Transfer::Direction direction)
80 if (_direction != direction) {
81 _direction = direction;
83 emit directionChanged(direction);
88 QHostAddress Transfer::address() const
94 void Transfer::setAddress(const QHostAddress &address)
96 if (_address != address) {
99 emit addressChanged(address);
104 quint16 Transfer::port() const
110 void Transfer::setPort(quint16 port)
115 emit portChanged(port);
120 QString Transfer::fileName() const
126 void Transfer::setFileName(const QString &fileName)
128 if (_fileName != fileName) {
129 _fileName = fileName;
131 emit fileNameChanged(fileName);
136 quint64 Transfer::fileSize() const
142 void Transfer::setFileSize(quint64 fileSize)
144 if (_fileSize != fileSize) {
145 _fileSize = fileSize;
147 emit fileSizeChanged(fileSize);