Select Git revision
currentcall.cpp
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
currentcall.cpp 14.29 KiB
/****************************************************************************
* Copyright (C) 2018-2020 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
// LRC
#include "typedefs.h"
// std
#include <ctime>
#include <QString>
namespace lrc {
namespace api {
namespace datatransfer {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
enum class Status {
on_connection, // outgoing tx: wait for connection/acceptance, incoming tx: wait for local acceptance
on_progress, // connected, data transfer progress reporting
success, // transfer finished with success, all data sent
stop_by_peer, // error: transfer terminated by peer
stop_by_host, // eror: transfer terminated by local host
unjoinable_peer, // error: (outgoing only) peer connection failed
timeout_expired, // error: (outgoing only) peer awaiting too long, close turn socket
invalid_pathname, // error: (file transfer only) given file is not a valid
unsupported, // error: unable to do the transfer (generic error)
INVALID
};
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Status)
#endif
static inline const QString
to_string(const Status& status)
{
switch (status) {
case Status::on_connection:
return "on_connection";
case Status::on_progress:
return "on_progress";
case Status::success:
return "success";
case Status::stop_by_peer:
return "stop_by_peer";
case Status::stop_by_host:
return "stop_by_host";
case Status::unjoinable_peer:
return "unjoinable_peer";
case Status::timeout_expired:
return "timeout_expired";