WIP: Introduce SyncthingStatus::Connecting to show loading indication

This commit is contained in:
Martchus 2023-06-20 22:48:16 +02:00
parent b8b7986086
commit a5a41a0a49
2 changed files with 9 additions and 3 deletions

View File

@ -160,6 +160,8 @@ QString SyncthingConnection::statusText(SyncthingStatus status)
switch (status) {
case SyncthingStatus::Disconnected:
return tr("disconnected");
case SyncthingStatus::Connecting:
return tr("connecting");
case SyncthingStatus::Reconnecting:
return tr("reconnecting");
case SyncthingStatus::Idle:
@ -279,6 +281,7 @@ void SyncthingConnection::connect()
requestConfig();
requestStatus();
m_keepPolling = true;
setStatus(SyncthingStatus::Connecting);
}
/*!
@ -859,9 +862,10 @@ bool SyncthingConnection::applySettings(SyncthingConnectionSettings &connectionS
/*!
* \brief Sets the connection status. Ensures statusChanged() is emitted if the status has actually changed.
* \param status Specifies the status; should be either SyncthingStatus::Disconnected, SyncthingStatus::Reconnecting, or
* SyncthingStatus::Idle. There is no use in specifying other values such as SyncthingStatus::Synchronizing as
* these are determined automatically within the method according to SyncthingConnection::statusComputionFlags().
* \param status Specifies the status; should be either SyncthingStatus::Disconnected, SyncthingStatus::Connecting,
* SyncthingStatus::Reconnecting, or SyncthingStatus::Idle. There is no use in specifying other values such as
* SyncthingStatus::Synchronizing as these are determined automatically within the method according to
* SyncthingConnection::statusComputionFlags().
*
* The precedence of the "connected" states from highest to lowest is:
* 1. SyncthingStatus::Synchronizing
@ -887,6 +891,7 @@ void SyncthingConnection::setStatus(SyncthingStatus status)
m_keepPolling = false;
m_connectionAborted = true;
[[fallthrough]];
case SyncthingStatus::Connecting:
case SyncthingStatus::Reconnecting:
m_devStatsPollTimer.stop();
m_trafficPollTimer.stop();

View File

@ -30,6 +30,7 @@ enum class SyncthingStatus {
Paused = 4, /**< connected, at least one device is paused */
Synchronizing = 5, /**< connected, at least one local directory is waiting to sync, preparing to sync or synchronizing */
RemoteNotInSync = 8, /**< connected, at least one directory of a connected remote device is not in sync (still synchronizing, error, …) */
Connecting = 9, /**< disconnected, currently connecting */
};
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_ENUM_NS(SyncthingStatus)