2016-08-25 00:45:32 +02:00
|
|
|
#ifndef SYNCTHINGCONNECTION_H
|
|
|
|
#define SYNCTHINGCONNECTION_H
|
|
|
|
|
2016-10-04 23:55:20 +02:00
|
|
|
#include "./syncthingdir.h"
|
|
|
|
#include "./syncthingdev.h"
|
2016-08-30 20:01:07 +02:00
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
#include <QObject>
|
2016-09-01 16:34:30 +02:00
|
|
|
#include <QList>
|
|
|
|
#include <QSslError>
|
2016-10-07 15:11:25 +02:00
|
|
|
#include <QTimer>
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QNetworkAccessManager)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QNetworkReply)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QNetworkRequest)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QUrlQuery)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QJsonObject)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QJsonArray)
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
|
2016-09-29 21:19:54 +02:00
|
|
|
struct SyncthingConnectionSettings;
|
|
|
|
|
2016-10-03 00:41:38 +02:00
|
|
|
QNetworkAccessManager LIB_SYNCTHING_CONNECTOR_EXPORT &networkAccessManager();
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
enum class SyncthingStatus
|
|
|
|
{
|
|
|
|
Disconnected,
|
2016-09-06 22:55:49 +02:00
|
|
|
Reconnecting,
|
2016-09-03 19:39:43 +02:00
|
|
|
Idle,
|
|
|
|
Scanning,
|
2016-08-25 00:45:32 +02:00
|
|
|
Paused,
|
2016-10-03 01:16:04 +02:00
|
|
|
Synchronizing,
|
2016-10-04 23:42:17 +02:00
|
|
|
OutOfSync,
|
2016-10-03 01:16:04 +02:00
|
|
|
BeingDestroyed
|
2016-08-25 00:45:32 +02:00
|
|
|
};
|
|
|
|
|
2016-09-30 23:55:25 +02:00
|
|
|
struct LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingLogEntry
|
2016-08-25 00:45:32 +02:00
|
|
|
{
|
2016-09-08 23:35:15 +02:00
|
|
|
SyncthingLogEntry(const QString &when, const QString &message) :
|
|
|
|
when(when),
|
|
|
|
message(message)
|
|
|
|
{}
|
2016-08-25 00:45:32 +02:00
|
|
|
QString when;
|
|
|
|
QString message;
|
|
|
|
};
|
|
|
|
|
2016-09-30 23:55:25 +02:00
|
|
|
class LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingConnection : public QObject
|
2016-08-25 00:45:32 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString syncthingUrl READ syncthingUrl WRITE setSyncthingUrl)
|
|
|
|
Q_PROPERTY(QByteArray apiKey READ apiKey WRITE setApiKey)
|
|
|
|
Q_PROPERTY(SyncthingStatus status READ status NOTIFY statusChanged)
|
2016-10-04 23:42:17 +02:00
|
|
|
Q_PROPERTY(bool hasUnreadNotifications READ hasUnreadNotifications)
|
|
|
|
Q_PROPERTY(bool hasOutOfSyncDirs READ hasOutOfSyncDirs)
|
2016-09-25 20:54:09 +02:00
|
|
|
Q_PROPERTY(int trafficPollInterval READ trafficPollInterval WRITE setTrafficPollInterval)
|
|
|
|
Q_PROPERTY(int devStatsPollInterval READ devStatsPollInterval WRITE setDevStatsPollInterval)
|
2016-08-25 00:45:32 +02:00
|
|
|
Q_PROPERTY(QString configDir READ configDir NOTIFY configDirChanged)
|
|
|
|
Q_PROPERTY(QString myId READ myId NOTIFY myIdChanged)
|
2016-08-29 20:51:30 +02:00
|
|
|
Q_PROPERTY(int totalIncomingTraffic READ totalIncomingTraffic NOTIFY trafficChanged)
|
|
|
|
Q_PROPERTY(int totalOutgoingTraffic READ totalOutgoingTraffic NOTIFY trafficChanged)
|
2016-09-25 20:54:09 +02:00
|
|
|
Q_PROPERTY(double totalIncomingRate READ totalIncomingRate NOTIFY trafficChanged)
|
|
|
|
Q_PROPERTY(double totalOutgoingRate READ totalOutgoingRate NOTIFY trafficChanged)
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit SyncthingConnection(const QString &syncthingUrl = QStringLiteral("http://localhost:8080"), const QByteArray &apiKey = QByteArray(), QObject *parent = nullptr);
|
|
|
|
~SyncthingConnection();
|
|
|
|
|
|
|
|
const QString &syncthingUrl() const;
|
|
|
|
void setSyncthingUrl(const QString &url);
|
|
|
|
const QByteArray &apiKey() const;
|
|
|
|
void setApiKey(const QByteArray &apiKey);
|
|
|
|
const QString &user() const;
|
|
|
|
const QString &password() const;
|
|
|
|
void setCredentials(const QString &user, const QString &password);
|
|
|
|
SyncthingStatus status() const;
|
|
|
|
QString statusText() const;
|
|
|
|
bool isConnected() const;
|
2016-10-04 23:42:17 +02:00
|
|
|
bool hasUnreadNotifications() const;
|
|
|
|
bool hasOutOfSyncDirs() const;
|
2016-09-25 20:54:09 +02:00
|
|
|
int trafficPollInterval() const;
|
|
|
|
void setTrafficPollInterval(int trafficPollInterval);
|
|
|
|
int devStatsPollInterval() const;
|
|
|
|
void setDevStatsPollInterval(int devStatsPollInterval);
|
2016-10-07 15:11:25 +02:00
|
|
|
int reconnectInterval() const;
|
|
|
|
void setReconnectInterval(int reconnectInterval);
|
2016-08-25 00:45:32 +02:00
|
|
|
const QString &configDir() const;
|
|
|
|
const QString &myId() const;
|
2016-10-20 23:14:47 +02:00
|
|
|
uint64 totalIncomingTraffic() const;
|
|
|
|
uint64 totalOutgoingTraffic() const;
|
2016-08-30 20:01:07 +02:00
|
|
|
double totalIncomingRate() const;
|
|
|
|
double totalOutgoingRate() const;
|
2016-08-25 00:45:32 +02:00
|
|
|
const std::vector<SyncthingDir> &dirInfo() const;
|
|
|
|
const std::vector<SyncthingDev> &devInfo() const;
|
2016-09-30 23:55:25 +02:00
|
|
|
QMetaObject::Connection requestQrCode(const QString &text, std::function<void (const QByteArray &)> callback);
|
2016-09-03 19:39:43 +02:00
|
|
|
QMetaObject::Connection requestLog(std::function<void (const std::vector<SyncthingLogEntry> &)> callback);
|
2016-09-03 20:14:52 +02:00
|
|
|
const QList<QSslError> &expectedSslErrors();
|
2016-10-02 21:59:28 +02:00
|
|
|
SyncthingDir *findDirInfo(const QString &dirId, int &row);
|
|
|
|
SyncthingDev *findDevInfo(const QString &devId, int &row);
|
|
|
|
SyncthingDev *findDevInfoByName(const QString &devName, int &row);
|
2016-11-08 19:44:45 +01:00
|
|
|
const std::vector<SyncthingDir *> &completedDirs() const;
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
2016-09-01 16:34:30 +02:00
|
|
|
void loadSelfSignedCertificate();
|
2016-10-02 21:59:28 +02:00
|
|
|
void applySettings(SyncthingConnectionSettings &connectionSettings);
|
2016-08-25 00:45:32 +02:00
|
|
|
void connect();
|
|
|
|
void disconnect();
|
|
|
|
void reconnect();
|
2016-09-29 21:19:54 +02:00
|
|
|
void reconnect(SyncthingConnectionSettings &connectionSettings);
|
2016-09-27 21:20:17 +02:00
|
|
|
void pause(const QString &devId);
|
2016-08-25 00:45:32 +02:00
|
|
|
void pauseAllDevs();
|
2016-09-27 21:20:17 +02:00
|
|
|
void resume(const QString &devId);
|
2016-08-25 00:45:32 +02:00
|
|
|
void resumeAllDevs();
|
2016-09-27 21:20:17 +02:00
|
|
|
void rescan(const QString &dirId);
|
2016-08-25 00:45:32 +02:00
|
|
|
void rescanAllDirs();
|
2016-09-03 19:39:43 +02:00
|
|
|
void restart();
|
2016-10-02 22:16:43 +02:00
|
|
|
void shutdown();
|
2016-09-27 21:20:17 +02:00
|
|
|
void considerAllNotificationsRead();
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void newConfig(const QJsonObject &config);
|
|
|
|
void newDirs(const std::vector<SyncthingDir> &dirs);
|
|
|
|
void newDevices(const std::vector<SyncthingDev> &devs);
|
|
|
|
void newEvents(const QJsonArray &events);
|
|
|
|
void dirStatusChanged(const SyncthingDir &dir, int index);
|
2016-08-26 16:43:53 +02:00
|
|
|
void devStatusChanged(const SyncthingDev &dev, int index);
|
2016-09-21 21:09:12 +02:00
|
|
|
void downloadProgressChanged();
|
2016-09-08 23:35:15 +02:00
|
|
|
void newNotification(ChronoUtilities::DateTime when, const QString &message);
|
2016-08-25 00:45:32 +02:00
|
|
|
void error(const QString &errorMessage);
|
|
|
|
void statusChanged(SyncthingStatus newStatus);
|
|
|
|
void configDirChanged(const QString &newConfigDir);
|
|
|
|
void myIdChanged(const QString &myNewId);
|
2016-10-20 23:14:47 +02:00
|
|
|
void trafficChanged(uint64 totalIncomingTraffic, uint64 totalOutgoingTraffic);
|
2016-10-02 21:59:28 +02:00
|
|
|
void rescanTriggered(const QString &dirId);
|
|
|
|
void pauseTriggered(const QString &devId);
|
|
|
|
void resumeTriggered(const QString &devId);
|
|
|
|
void restartTriggered();
|
2016-10-02 22:16:43 +02:00
|
|
|
void shutdownTriggered();
|
2016-08-29 20:51:30 +02:00
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
private Q_SLOTS:
|
|
|
|
void requestConfig();
|
|
|
|
void requestStatus();
|
2016-08-26 16:43:53 +02:00
|
|
|
void requestConnections();
|
2016-09-08 23:35:15 +02:00
|
|
|
void requestErrors();
|
2016-09-01 16:34:30 +02:00
|
|
|
void requestDirStatistics();
|
|
|
|
void requestDeviceStatistics();
|
2016-08-25 00:45:32 +02:00
|
|
|
void requestEvents();
|
2016-08-26 16:43:53 +02:00
|
|
|
void abortAllRequests();
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
void readConfig();
|
|
|
|
void readDirs(const QJsonArray &dirs);
|
|
|
|
void readDevs(const QJsonArray &devs);
|
|
|
|
void readStatus();
|
2016-08-26 16:43:53 +02:00
|
|
|
void readConnections();
|
2016-09-01 16:34:30 +02:00
|
|
|
void readDirStatistics();
|
|
|
|
void readDeviceStatistics();
|
2016-09-08 23:35:15 +02:00
|
|
|
void readErrors();
|
2016-08-25 00:45:32 +02:00
|
|
|
void readEvents();
|
2016-08-26 16:43:53 +02:00
|
|
|
void readStartingEvent(const QJsonObject &eventData);
|
2016-09-03 19:39:43 +02:00
|
|
|
void readStatusChangedEvent(ChronoUtilities::DateTime eventTime, const QJsonObject &eventData);
|
2016-09-21 21:09:12 +02:00
|
|
|
void readDownloadProgressEvent(ChronoUtilities::DateTime eventTime, const QJsonObject &eventData);
|
2016-09-03 19:39:43 +02:00
|
|
|
void readDirEvent(ChronoUtilities::DateTime eventTime, const QString &eventType, const QJsonObject &eventData);
|
2016-08-30 20:01:07 +02:00
|
|
|
void readDeviceEvent(ChronoUtilities::DateTime eventTime, const QString &eventType, const QJsonObject &eventData);
|
2016-09-01 16:34:30 +02:00
|
|
|
void readItemStarted(ChronoUtilities::DateTime eventTime, const QJsonObject &eventData);
|
|
|
|
void readItemFinished(ChronoUtilities::DateTime eventTime, const QJsonObject &eventData);
|
2016-08-25 00:45:32 +02:00
|
|
|
void readRescan();
|
|
|
|
void readPauseResume();
|
2016-09-03 19:39:43 +02:00
|
|
|
void readRestart();
|
2016-10-02 22:16:43 +02:00
|
|
|
void readShutdown();
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2016-09-08 23:35:15 +02:00
|
|
|
void continueConnecting();
|
|
|
|
void continueReconnecting();
|
2016-08-25 00:45:32 +02:00
|
|
|
void setStatus(SyncthingStatus status);
|
2016-09-08 23:35:15 +02:00
|
|
|
void emitNotification(ChronoUtilities::DateTime when, const QString &message);
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
QNetworkRequest prepareRequest(const QString &path, const QUrlQuery &query, bool rest = true);
|
|
|
|
QNetworkReply *requestData(const QString &path, const QUrlQuery &query, bool rest = true);
|
|
|
|
QNetworkReply *postData(const QString &path, const QUrlQuery &query, const QByteArray &data = QByteArray());
|
2016-11-01 17:06:31 +01:00
|
|
|
SyncthingDir *addDirInfo(std::vector<SyncthingDir> &dirs, const QString &dirId);
|
|
|
|
SyncthingDev *addDevInfo(std::vector<SyncthingDev> &devs, const QString &devId);
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
QString m_syncthingUrl;
|
|
|
|
QByteArray m_apiKey;
|
|
|
|
QString m_user;
|
|
|
|
QString m_password;
|
|
|
|
SyncthingStatus m_status;
|
|
|
|
bool m_keepPolling;
|
|
|
|
bool m_reconnecting;
|
|
|
|
int m_lastEventId;
|
2016-09-25 20:54:09 +02:00
|
|
|
int m_trafficPollInterval;
|
|
|
|
int m_devStatsPollInterval;
|
2016-10-07 15:11:25 +02:00
|
|
|
QTimer m_reconnectTimer;
|
2016-08-25 00:45:32 +02:00
|
|
|
QString m_configDir;
|
|
|
|
QString m_myId;
|
2016-10-20 23:14:47 +02:00
|
|
|
uint64 m_totalIncomingTraffic;
|
|
|
|
uint64 m_totalOutgoingTraffic;
|
2016-08-30 20:01:07 +02:00
|
|
|
double m_totalIncomingRate;
|
|
|
|
double m_totalOutgoingRate;
|
2016-08-25 00:45:32 +02:00
|
|
|
QNetworkReply *m_configReply;
|
|
|
|
QNetworkReply *m_statusReply;
|
2016-08-26 16:43:53 +02:00
|
|
|
QNetworkReply *m_connectionsReply;
|
2016-09-08 23:35:15 +02:00
|
|
|
QNetworkReply *m_errorsReply;
|
2016-08-25 00:45:32 +02:00
|
|
|
QNetworkReply *m_eventsReply;
|
|
|
|
bool m_unreadNotifications;
|
2016-08-26 16:43:53 +02:00
|
|
|
bool m_hasConfig;
|
|
|
|
bool m_hasStatus;
|
2016-08-25 00:45:32 +02:00
|
|
|
std::vector<SyncthingDir> m_dirs;
|
2016-11-08 19:44:45 +01:00
|
|
|
std::vector<SyncthingDir *> m_syncedDirs;
|
|
|
|
std::vector<SyncthingDir *> m_completedDirs;
|
2016-08-25 00:45:32 +02:00
|
|
|
std::vector<SyncthingDev> m_devs;
|
2016-08-30 20:01:07 +02:00
|
|
|
ChronoUtilities::DateTime m_lastConnectionsUpdate;
|
2016-09-01 16:34:30 +02:00
|
|
|
ChronoUtilities::DateTime m_lastFileTime;
|
2016-09-08 23:35:15 +02:00
|
|
|
ChronoUtilities::DateTime m_lastErrorTime;
|
2016-09-01 16:34:30 +02:00
|
|
|
QString m_lastFileName;
|
|
|
|
bool m_lastFileDeleted;
|
2016-09-03 20:14:52 +02:00
|
|
|
QList<QSslError> m_expectedSslErrors;
|
2016-08-25 00:45:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the URL used to connect to Syncthing.
|
|
|
|
*/
|
|
|
|
inline const QString &SyncthingConnection::syncthingUrl() const
|
|
|
|
{
|
|
|
|
return m_syncthingUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Sets the URL used to connect to Syncthing.
|
|
|
|
*/
|
|
|
|
inline void SyncthingConnection::setSyncthingUrl(const QString &url)
|
|
|
|
{
|
|
|
|
m_syncthingUrl = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the API key used to connect to Syncthing.
|
|
|
|
*/
|
|
|
|
inline const QByteArray &SyncthingConnection::apiKey() const
|
|
|
|
{
|
|
|
|
return m_apiKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Sets the API key used to connect to Syncthing.
|
|
|
|
*/
|
|
|
|
inline void SyncthingConnection::setApiKey(const QByteArray &apiKey)
|
|
|
|
{
|
|
|
|
m_apiKey = apiKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the user name which has been set using setCredentials().
|
|
|
|
*/
|
|
|
|
inline const QString &SyncthingConnection::user() const
|
|
|
|
{
|
|
|
|
return m_user;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the password which has been set using setCredentials().
|
|
|
|
*/
|
|
|
|
inline const QString &SyncthingConnection::password() const
|
|
|
|
{
|
|
|
|
return m_password;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Provides credentials used for HTTP authentication.
|
|
|
|
*/
|
|
|
|
inline void SyncthingConnection::setCredentials(const QString &user, const QString &password)
|
|
|
|
{
|
|
|
|
m_user = user, m_password = password;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the connection status.
|
|
|
|
*/
|
|
|
|
inline SyncthingStatus SyncthingConnection::status() const
|
|
|
|
{
|
|
|
|
return m_status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns whether the connection has been established.
|
|
|
|
*/
|
|
|
|
inline bool SyncthingConnection::isConnected() const
|
|
|
|
{
|
2016-09-06 22:55:49 +02:00
|
|
|
return m_status != SyncthingStatus::Disconnected && m_status != SyncthingStatus::Reconnecting;
|
2016-08-25 00:45:32 +02:00
|
|
|
}
|
|
|
|
|
2016-10-04 23:42:17 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns whether there are unread notifications available.
|
|
|
|
* \remarks This flag is set to true when new notifications become available. It can be unset again by calling considerAllNotificationsRead().
|
|
|
|
*/
|
|
|
|
inline bool SyncthingConnection::hasUnreadNotifications() const
|
|
|
|
{
|
|
|
|
return m_unreadNotifications;
|
|
|
|
}
|
|
|
|
|
2016-09-25 20:54:09 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the interval for polling traffic status (which currently can not be received via event API) in milliseconds.
|
|
|
|
* \remarks Default value is 2000 milliseconds.
|
|
|
|
*/
|
|
|
|
inline int SyncthingConnection::trafficPollInterval() const
|
|
|
|
{
|
|
|
|
return m_trafficPollInterval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Sets the interval for polling traffic status (which currently can not be received via event API) in milliseconds.
|
|
|
|
* \remarks Default value is 2000 milliseconds.
|
|
|
|
*/
|
|
|
|
inline void SyncthingConnection::setTrafficPollInterval(int trafficPollInterval)
|
|
|
|
{
|
|
|
|
m_trafficPollInterval = trafficPollInterval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the interval for polling device statistics (which currently can not be received via event API) in milliseconds.
|
|
|
|
* \remarks Default value is 60000 milliseconds.
|
|
|
|
*/
|
|
|
|
inline int SyncthingConnection::devStatsPollInterval() const
|
|
|
|
{
|
|
|
|
return m_devStatsPollInterval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Sets the interval for polling device statistics (which currently can not be received via event API) in milliseconds.
|
|
|
|
* \remarks Default value is 60000 milliseconds.
|
|
|
|
*/
|
|
|
|
inline void SyncthingConnection::setDevStatsPollInterval(int devStatsPollInterval)
|
|
|
|
{
|
|
|
|
m_devStatsPollInterval = devStatsPollInterval;
|
|
|
|
}
|
|
|
|
|
2016-10-07 15:11:25 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the reconnect interval in milliseconds.
|
|
|
|
* \remarks Default value is 0 which indicates disabled auto-reconnect.
|
|
|
|
*/
|
|
|
|
inline int SyncthingConnection::reconnectInterval() const
|
|
|
|
{
|
|
|
|
return m_reconnectTimer.interval();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Sets the reconnect interval in milliseconds.
|
|
|
|
* \remarks Default value is 0 which indicates disabled auto-reconnect.
|
|
|
|
*/
|
|
|
|
inline void SyncthingConnection::setReconnectInterval(int reconnectInterval)
|
|
|
|
{
|
|
|
|
if(!reconnectInterval) {
|
|
|
|
m_reconnectTimer.stop();
|
|
|
|
}
|
|
|
|
m_reconnectTimer.setInterval(reconnectInterval);
|
|
|
|
}
|
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the Syncthing home/configuration directory.
|
|
|
|
*/
|
|
|
|
inline const QString &SyncthingConnection::configDir() const
|
|
|
|
{
|
|
|
|
return m_configDir;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the ID of the own Syncthing device.
|
|
|
|
*/
|
|
|
|
inline const QString &SyncthingConnection::myId() const
|
|
|
|
{
|
|
|
|
return m_myId;
|
|
|
|
}
|
|
|
|
|
2016-08-29 20:51:30 +02:00
|
|
|
/*!
|
2016-08-30 20:01:07 +02:00
|
|
|
* \brief Returns the total incoming traffic in byte.
|
2016-08-29 20:51:30 +02:00
|
|
|
*/
|
2016-10-20 23:14:47 +02:00
|
|
|
inline uint64 SyncthingConnection::totalIncomingTraffic() const
|
2016-08-29 20:51:30 +02:00
|
|
|
{
|
|
|
|
return m_totalIncomingTraffic;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2016-08-30 20:01:07 +02:00
|
|
|
* \brief Returns the total outgoing traffic in byte.
|
2016-08-29 20:51:30 +02:00
|
|
|
*/
|
2016-10-20 23:14:47 +02:00
|
|
|
inline uint64 SyncthingConnection::totalOutgoingTraffic() const
|
2016-08-29 20:51:30 +02:00
|
|
|
{
|
|
|
|
return m_totalOutgoingTraffic;
|
|
|
|
}
|
|
|
|
|
2016-08-30 20:01:07 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the total incoming transfer rate in kbit/s.
|
|
|
|
*/
|
|
|
|
inline double SyncthingConnection::totalIncomingRate() const
|
|
|
|
{
|
|
|
|
return m_totalIncomingRate;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the total outgoing transfer rate in kbit/s.
|
|
|
|
*/
|
|
|
|
inline double SyncthingConnection::totalOutgoingRate() const
|
|
|
|
{
|
|
|
|
return m_totalOutgoingRate;
|
|
|
|
}
|
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
/*!
|
2016-09-27 21:20:17 +02:00
|
|
|
* \brief Returns all available directory information.
|
2016-08-25 00:45:32 +02:00
|
|
|
* \remarks The returned object container object is persistent. However, the contained
|
|
|
|
* info objects are invalidated when the newConfig() signal is emitted.
|
|
|
|
*/
|
|
|
|
inline const std::vector<SyncthingDir> &SyncthingConnection::dirInfo() const
|
|
|
|
{
|
|
|
|
return m_dirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2016-09-27 21:20:17 +02:00
|
|
|
* \brief Returns all available device information.
|
2016-08-25 00:45:32 +02:00
|
|
|
* \remarks The returned object container object is persistent. However, the contained
|
|
|
|
* info objects are invalidated when the newConfig() signal is emitted.
|
|
|
|
*/
|
|
|
|
inline const std::vector<SyncthingDev> &SyncthingConnection::devInfo() const
|
|
|
|
{
|
|
|
|
return m_devs;
|
|
|
|
}
|
|
|
|
|
2016-09-01 16:34:30 +02:00
|
|
|
/*!
|
2016-10-02 21:59:28 +02:00
|
|
|
* \brief Returns a list of all expected certificate errors. This is meant to allow self-signed certificates.
|
|
|
|
* \remarks This list is updated via loadSelfSignedCertificate().
|
2016-09-01 16:34:30 +02:00
|
|
|
*/
|
2016-09-03 20:14:52 +02:00
|
|
|
inline const QList<QSslError> &SyncthingConnection::expectedSslErrors()
|
2016-09-01 16:34:30 +02:00
|
|
|
{
|
2016-09-03 20:14:52 +02:00
|
|
|
return m_expectedSslErrors;
|
2016-09-01 16:34:30 +02:00
|
|
|
}
|
|
|
|
|
2016-11-08 19:44:45 +01:00
|
|
|
/*!
|
|
|
|
* \brief Returns the directories which have been synchronized during the last synchronizing status().
|
|
|
|
*/
|
|
|
|
inline const std::vector<SyncthingDir *> &SyncthingConnection::completedDirs() const
|
|
|
|
{
|
|
|
|
return m_completedDirs;
|
|
|
|
}
|
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SYNCTHINGCONNECTION_H
|