2016-09-29 21:19:54 +02:00
# ifndef SYNCTHINGCONNECTIONSETTINGS_H
# define SYNCTHINGCONNECTIONSETTINGS_H
2016-09-30 23:55:25 +02:00
# include "./global.h"
2020-12-31 02:48:18 +01:00
# include <c++utilities/misc/flagenumclass.h>
2016-09-29 21:19:54 +02:00
# include <QByteArray>
2024-01-15 21:28:43 +01:00
# include <QDateTime>
2020-04-27 23:08:41 +02:00
# include <QList>
2016-09-29 21:19:54 +02:00
# include <QSslError>
2017-05-01 03:34:43 +02:00
# include <QString>
2016-09-29 21:19:54 +02:00
2023-12-30 20:38:15 +01:00
QT_FORWARD_DECLARE_CLASS ( QSslCertificate )
2016-09-29 21:19:54 +02:00
namespace Data {
2020-12-31 02:48:18 +01:00
/*!
* \ brief The SyncthingStatusComputionFlags enum specifies what information is considered to compute the overall state .
* \ remarks The enum is supposed to be used as flag - enum .
*/
enum class SyncthingStatusComputionFlags : quint64 {
None = 0 , /**< no further information is considered leaving SyncthingStatus::Disconnected, SyncthingStatus::Reconnecting,
SyncthingStatus : : BeingDestroyed and SyncthingStatus : : Idle the only possible states */
Scanning = ( 1 < < 0 ) , /**< the status SyncthingStatus::Scanning might be set (in addition) */
Synchronizing = ( 1 < < 1 ) , /**< the status SyncthingStatus::Synchronizing might be set (in addition) */
RemoteSynchronizing = ( 1 < < 2 ) , /**< the status SyncthingStatus::RemoteNotInSync might be set (in addition) */
DevicePaused = ( 1 < < 3 ) , /**< the status SyncthingStatus::Paused might be set if there's at least one paused device (in addition) */
2022-06-07 10:15:28 +02:00
OutOfSync = ( 1
< < 4 ) , /**< the return value of SyncthingConnection::hasOutOfSyncDirs() is considered by further displaying-related computations such as StatusInfo::updateConnectionStatus() */
UnreadNotifications = ( 1
< < 5 ) , /**< the return value of SyncthingConnection::hasUnreadNotifications() is considered by further displaying-related computations such as StatusInfo::updateConnectionStatus() */
Default = SyncthingStatusComputionFlags : : Scanning | SyncthingStatusComputionFlags : : Synchronizing | SyncthingStatusComputionFlags : : DevicePaused
| SyncthingStatusComputionFlags : : OutOfSync | SyncthingStatusComputionFlags : : UnreadNotifications ,
2020-12-31 02:48:18 +01:00
/**< the default flags used all over the place */
} ;
2016-09-30 23:55:25 +02:00
struct LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingConnectionSettings {
2016-09-29 21:19:54 +02:00
QString label ;
QString syncthingUrl ;
bool authEnabled = false ;
QString userName ;
QString password ;
QByteArray apiKey ;
2018-10-25 18:22:07 +02:00
int trafficPollInterval = defaultTrafficPollInterval ;
int devStatsPollInterval = defaultDevStatusPollInterval ;
int errorsPollInterval = defaultErrorsPollInterval ;
int reconnectInterval = defaultReconnectInterval ;
2023-07-04 19:01:08 +02:00
int requestTimeout = defaultRequestTimeout ;
2023-11-06 15:06:40 +01:00
int longPollingTimeout = defaultLongPollingTimeout ;
2016-09-29 21:19:54 +02:00
QString httpsCertPath ;
2024-01-15 21:28:43 +01:00
QDateTime httpCertLastModified ;
2016-09-29 21:19:54 +02:00
QList < QSslError > expectedSslErrors ;
2020-12-31 02:48:18 +01:00
SyncthingStatusComputionFlags statusComputionFlags = SyncthingStatusComputionFlags : : Default ;
2020-01-23 19:09:51 +01:00
bool autoConnect = false ;
2024-02-15 18:53:54 +01:00
bool pauseOnMeteredConnection = false ;
2023-12-30 20:38:15 +01:00
static QList < QSslError > compileSslErrors ( const QSslCertificate & trustedCert ) ;
2016-09-29 21:19:54 +02:00
bool loadHttpsCert ( ) ;
2018-10-25 18:22:07 +02:00
static constexpr int defaultTrafficPollInterval = 5000 ;
static constexpr int defaultDevStatusPollInterval = 60000 ;
static constexpr int defaultErrorsPollInterval = 30000 ;
2021-10-03 23:05:49 +02:00
static constexpr int defaultReconnectInterval = 30000 ;
2023-07-04 19:33:30 +02:00
static constexpr int defaultRequestTimeout = 0 ;
2024-01-02 18:16:23 +01:00
static constexpr int defaultLongPollingTimeout = 0 ;
2016-09-29 21:19:54 +02:00
} ;
2017-09-17 21:48:15 +02:00
} // namespace Data
2016-09-29 21:19:54 +02:00
2020-12-31 02:48:18 +01:00
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS ( Data , Data : : SyncthingStatusComputionFlags )
2016-09-29 21:19:54 +02:00
# endif // SYNCTHINGCONNECTIONSETTINGS_H