clientignorelistmanager.cpp
clientirclisthelper.cpp
clientsettings.cpp
+ clienttransfer.cpp
clienttransfermanager.cpp
clientuserinputhandler.cpp
coreaccount.cpp
clientidentity.h
clientignorelistmanager.h
clientirclisthelper.h
+ clienttransfer.h
clienttransfermanager.h
clientuserinputhandler.h
coreaccountmodel.h
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2013 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "clienttransfer.h"
+
+INIT_SYNCABLE_OBJECT(ClientTransfer)
+ClientTransfer::ClientTransfer(const QUuid &uuid, QObject *parent)
+ : Transfer(uuid, parent)
+{
+
+}
+
+
+QString ClientTransfer::savePath() const
+{
+ return _savePath;
+}
+
+
+void ClientTransfer::accept(const QString &savePath) const
+{
+ _savePath = savePath;
+ PeerPtr ptr = 0;
+ REQUEST_OTHER(requestAccepted, ARG(ptr));
+ emit accepted();
+}
+
+
+void ClientTransfer::reject() const
+{
+ PeerPtr ptr = 0;
+ REQUEST_OTHER(requestRejected, ARG(ptr));
+ emit rejected();
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2013 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef CLIENTTRANSFER_H
+#define CLIENTTRANSFER_H
+
+#include <QUuid>
+
+#include "transfer.h"
+
+class ClientTransfer : public Transfer
+{
+ Q_OBJECT
+ SYNCABLE_OBJECT
+
+public:
+ ClientTransfer(const QUuid &uuid, QObject *parent = 0);
+
+ QString savePath() const;
+
+public slots:
+ // called on the client side
+ void accept(const QString &savePath) const;
+ void reject() const;
+
+private:
+ // non-synced attributes
+ mutable QString _savePath;
+};
+
+#endif
#include "clienttransfermanager.h"
#include "client.h"
-#include "transfer.h"
+#include "clienttransfer.h"
INIT_SYNCABLE_OBJECT(ClientTransferManager)
}
+const ClientTransfer *ClientTransferManager::transfer(const QUuid &uuid) const
+{
+ return qobject_cast<const ClientTransfer *>(transfer_(uuid));
+}
+
+
void ClientTransferManager::onCoreTransferAdded(const QUuid &uuid)
{
if (uuid.isNull()) {
return;
}
- Transfer *transfer = new Transfer(uuid, this);
+ ClientTransfer *transfer = new ClientTransfer(uuid, this);
connect(transfer, SIGNAL(initDone()), SLOT(onTransferInitDone())); // we only want to add initialized transfers
Client::signalProxy()->synchronize(transfer);
}
void ClientTransferManager::onTransferAdded(const Transfer *transfer)
{
- // FIXME just a temporary solution
- emit newTransfer(transfer);
+ const ClientTransfer *t = qobject_cast<const ClientTransfer *>(transfer);
+ if (!t) {
+ qWarning() << "Invalid Transfer added to ClientTransferManager!";
+ return;
+ }
+
+ emit transferAdded(t);
}
#include <QUuid>
-class Transfer;
+class ClientTransfer;
class ClientTransferManager : public TransferManager
{
public:
ClientTransferManager(QObject *parent = 0);
+ const ClientTransfer *transfer(const QUuid &uuid) const;
+
public slots:
void onCoreTransferAdded(const QUuid &uuid);
void onTransferInitDone();
signals:
- void newTransfer(const Transfer *transfer);
+ void transferAdded(const ClientTransfer *transfer);
private slots:
void onTransferAdded(const Transfer *transfer);
emit nickChanged(nick);
}
}
-
-
-QString Transfer::savePath() const
-{
- return _savePath;
-}
-
-
-void Transfer::accept(const QString &savePath) const
-{
- _savePath = savePath;
- PeerPtr ptr = 0;
- REQUEST_OTHER(requestAccepted, ARG(ptr));
- emit accepted();
-}
-
-
-void Transfer::reject() const
-{
- REQUEST_OTHER(requestRejected, NO_ARG);
- emit rejected();
-}
-
-
-void Transfer::requestAccepted(PeerPtr peer)
-{
- emit accepted(peer);
-}
-
-
-void Transfer::requestRejected()
-{
- emit rejected();
-}
Transfer(const QUuid &uuid, QObject *parent = 0); // for creating a syncable object client-side
Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0);
+ inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
QUuid uuid() const;
State state() const;
quint64 fileSize() const;
QString nick() const;
- QString savePath() const;
-
public slots:
// called on the client side
- void accept(const QString &savePath) const;
- void reject() const;
+ virtual void accept(const QString &savePath) const { Q_UNUSED(savePath); }
+ virtual void reject() const {}
// called on the core side through sync calls
- void requestAccepted(PeerPtr peer = 0);
- void requestRejected();
+ virtual void requestAccepted(PeerPtr peer) { Q_UNUSED(peer); }
+ virtual void requestRejected(PeerPtr peer) { Q_UNUSED(peer); }
signals:
void stateChanged(State state);
void nickChanged(const QString &nick);
void accepted(PeerPtr peer = 0) const;
- void rejected() const;
+ void rejected(PeerPtr peer = 0) const;
protected:
void setState(State state);
quint64 _fileSize;
QString _nick;
QUuid _uuid;
-
- // non-synced attributes
- mutable QString _savePath;
};
#endif
}
-const Transfer *TransferManager::transfer(const QUuid &uuid) const
+Transfer *TransferManager::transfer_(const QUuid &uuid) const
{
return _transfers.value(uuid, 0);
}
TransferManager(QObject *parent = 0);
inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
- const Transfer *transfer(const QUuid &uuid) const;
QList<QUuid> transferIds() const;
-public slots:
- void addTransfer(Transfer *transfer);
-
signals:
void transferAdded(const Transfer *transfer);
+protected:
+ Transfer *transfer_(const QUuid &uuid) const;
+ void addTransfer(Transfer *transfer);
+
protected slots:
virtual void onCoreTransferAdded(const QUuid &uuid) { Q_UNUSED(uuid) };
coresession.cpp
coresessioneventprocessor.cpp
coresettings.cpp
+ coretransfer.cpp
coretransfermanager.cpp
coreuserinputhandler.cpp
coreusersettings.cpp
corenetworkconfig.h
coresession.h
coresessioneventprocessor.h
+ coretransfer.h
coretransfermanager.h
coreuserinputhandler.h
ctcpparser.h
#include "coreirclisthelper.h"
#include "corenetwork.h"
#include "coresession.h"
+#include "coretransfer.h"
#include "coretransfermanager.h"
#include "ctcpevent.h"
#include "ircevent.h"
#include "messageevent.h"
#include "netsplit.h"
#include "quassel.h"
-#include "transfer.h"
#ifdef HAVE_QCA2
# include "keyevent.h"
}
// TODO: check if target is the right thing to use for the partner
- Transfer *transfer = new Transfer(Transfer::Receive, e->target(), filename, address, port, size, this);
+ CoreTransfer *transfer = new CoreTransfer(Transfer::Receive, e->target(), filename, address, port, size, this);
coreSession()->signalProxy()->synchronize(transfer);
coreSession()->transferManager()->addTransfer(transfer);
}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2013 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "coretransfer.h"
+
+INIT_SYNCABLE_OBJECT(CoreTransfer)
+
+CoreTransfer::CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent)
+ : Transfer(direction, nick, fileName, address, port, fileSize, parent)
+{
+
+}
+
+
+void CoreTransfer::requestAccepted(PeerPtr peer)
+{
+ emit accepted(peer);
+}
+
+
+void CoreTransfer::requestRejected(PeerPtr peer)
+{
+ emit rejected(peer);
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2013 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef CORETRANSFER_H
+#define CORETRANSFER_H
+
+#include "transfer.h"
+
+class CoreTransfer : public Transfer
+{
+ Q_OBJECT
+ SYNCABLE_OBJECT
+
+public:
+ CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0);
+
+public slots:
+ // called through sync calls
+ void requestAccepted(PeerPtr peer);
+ void requestRejected(PeerPtr peer);
+
+};
+
+#endif
#include "coretransfermanager.h"
-#include "transfer.h"
-
+#include "coretransfer.h"
INIT_SYNCABLE_OBJECT(CoreTransferManager)
CoreTransferManager::CoreTransferManager(QObject *parent)
}
+CoreTransfer *CoreTransferManager::transfer(const QUuid &uuid) const
+{
+ return qobject_cast<CoreTransfer *>(transfer_(uuid));
+}
+
+
+void CoreTransferManager::addTransfer(CoreTransfer *transfer)
+{
+ TransferManager::addTransfer(transfer);
+}
+
+
void CoreTransferManager::onTransferAdded(const Transfer *transfer)
{
+ // for core-side use, publishing a non-const pointer is ok
+ CoreTransfer *t = const_cast<CoreTransfer *>(qobject_cast<const CoreTransfer *>(transfer));
+ if (!t) {
+ qWarning() << "Invalid Transfer added to CoreTransferManager!";
+ return;
+ }
+
connect(transfer, SIGNAL(accepted(PeerPtr)), SLOT(onTransferAccepted(PeerPtr)));
connect(transfer, SIGNAL(rejected(PeerPtr)), SLOT(onTransferRejected(PeerPtr)));
+
+ emit transferAdded(t);
}
#include "transfermanager.h"
#include "types.h"
+class CoreTransfer;
+
class CoreTransferManager : public TransferManager
{
Q_OBJECT
public:
CoreTransferManager(QObject *parent = 0);
+ CoreTransfer *transfer(const QUuid &uuid) const;
+
+public slots:
+ void addTransfer(CoreTransfer *transfer);
+
+signals:
+ void transferAdded(CoreTransfer *transfer);
+
private slots:
void onTransferAdded(const Transfer *transfer);
void onTransferAccepted(PeerPtr peer);
connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
- connect(Client::transferManager(), SIGNAL(newTransfer(const Transfer*)), SLOT(showNewTransferDlg(const Transfer*)));
+ connect(Client::transferManager(), SIGNAL(transferAdded(const Transfer*)), SLOT(showNewTransferDlg(const Transfer*)));
setConnectedState();
}