WIP: Introduce SyncthingStatus::Connecting to show loading indication
This commit is contained in:
parent
b8b7986086
commit
a5a41a0a49
|
@ -160,6 +160,8 @@ QString SyncthingConnection::statusText(SyncthingStatus status)
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SyncthingStatus::Disconnected:
|
case SyncthingStatus::Disconnected:
|
||||||
return tr("disconnected");
|
return tr("disconnected");
|
||||||
|
case SyncthingStatus::Connecting:
|
||||||
|
return tr("connecting");
|
||||||
case SyncthingStatus::Reconnecting:
|
case SyncthingStatus::Reconnecting:
|
||||||
return tr("reconnecting");
|
return tr("reconnecting");
|
||||||
case SyncthingStatus::Idle:
|
case SyncthingStatus::Idle:
|
||||||
|
@ -279,6 +281,7 @@ void SyncthingConnection::connect()
|
||||||
requestConfig();
|
requestConfig();
|
||||||
requestStatus();
|
requestStatus();
|
||||||
m_keepPolling = true;
|
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.
|
* \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
|
* \param status Specifies the status; should be either SyncthingStatus::Disconnected, SyncthingStatus::Connecting,
|
||||||
* SyncthingStatus::Idle. There is no use in specifying other values such as SyncthingStatus::Synchronizing as
|
* SyncthingStatus::Reconnecting, or SyncthingStatus::Idle. There is no use in specifying other values such as
|
||||||
* these are determined automatically within the method according to SyncthingConnection::statusComputionFlags().
|
* 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:
|
* The precedence of the "connected" states from highest to lowest is:
|
||||||
* 1. SyncthingStatus::Synchronizing
|
* 1. SyncthingStatus::Synchronizing
|
||||||
|
@ -887,6 +891,7 @@ void SyncthingConnection::setStatus(SyncthingStatus status)
|
||||||
m_keepPolling = false;
|
m_keepPolling = false;
|
||||||
m_connectionAborted = true;
|
m_connectionAborted = true;
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
case SyncthingStatus::Connecting:
|
||||||
case SyncthingStatus::Reconnecting:
|
case SyncthingStatus::Reconnecting:
|
||||||
m_devStatsPollTimer.stop();
|
m_devStatsPollTimer.stop();
|
||||||
m_trafficPollTimer.stop();
|
m_trafficPollTimer.stop();
|
||||||
|
|
|
@ -30,6 +30,7 @@ enum class SyncthingStatus {
|
||||||
Paused = 4, /**< connected, at least one device is paused */
|
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 */
|
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, …) */
|
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))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||||
Q_ENUM_NS(SyncthingStatus)
|
Q_ENUM_NS(SyncthingStatus)
|
||||||
|
|
Loading…
Reference in New Issue