1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-24 01:15:32 +02:00
jami-client-qt/src/libclient/api/datatransfermodel.h
Sébastien Blin 0de8f019b2 conversation: add the possibility to answer with a file
Also remove retryInteraction as useless in new versions.

Change-Id: I79a016c9fa7b8bc4d5fcdb0aeff51d78aea2f314
GitLab: #1017
2023-03-06 14:46:07 -05:00

113 lines
3.8 KiB
C++

/****************************************************************************
* Copyright (C) 2018-2023 Savoir-faire Linux Inc. *
* Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#pragma once
#include "api/datatransfer.h"
#include "api/account.h"
#include "typedefs.h"
#include <QObject>
#include <string>
#include <memory>
#include <ios>
namespace lrc {
class CallbacksHandler;
class Database;
namespace api {
class BehaviorController;
namespace datatransfer {
class Info;
} // namespace datatransfer
/**
* @brief Class that manages data transfer.
*/
class LIB_EXPORT DataTransferModel : public QObject
{
Q_OBJECT
public:
DataTransferModel();
~DataTransferModel();
void sendFile(const QString& account_id,
const QString& conversationId,
const QString& file_path,
const QString& display_name,
const QString& parent);
void fileTransferInfo(const QString& accountId,
const QString& conversationId,
const QString& fileId,
QString& path,
qlonglong& total,
qlonglong& progress);
QString accept(const QString& accountId, const QString& fileId, const QString& filePath = {});
void download(const QString& accountId,
const QString& convId,
const QString& interactionId,
const QString& fileId,
const QString& filePath = {});
void copyTo(const QString& accountId,
const QString& convId,
const QString& interactionId,
const QString& destPath,
const QString& displayName);
void cancel(const QString& accountId, const QString& conversationId, const QString& fileId);
void registerTransferId(const QString& fileId, const QString& interactionId);
QString getInteractionIdFromFileId(const QString& fileId);
QString getFileIdFromInteractionId(const QString& fileId);
/**
* Creates APPDATA/received and return the path
*/
static QString createDefaultDirectory();
Q_SIGNALS:
/**
* Connect this signal to know when a data transfer is incoming.
*/
void incomingTransfer(api::datatransfer::Info dataTransferInfo);
/**
* Connect this signal to know when an existing data transfer has changed of status.
* @param transfer_id unique identification of incoming data transfer.
* @param status reported status.
*/
void transferStatusChanged(const QString& uid, datatransfer::Status status);
private:
class Impl;
std::unique_ptr<Impl> pimpl_;
};
} // namespace api
} // namespace lrc
Q_DECLARE_METATYPE(lrc::api::DataTransferModel*)