diff --git a/syncthingconnector/syncthingconnection.cpp b/syncthingconnector/syncthingconnection.cpp index 7909f39..f8e68c1 100644 --- a/syncthingconnector/syncthingconnection.cpp +++ b/syncthingconnector/syncthingconnection.cpp @@ -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(); diff --git a/syncthingconnector/syncthingconnectionstatus.h b/syncthingconnector/syncthingconnectionstatus.h index fd0ee8e..4f258b7 100644 --- a/syncthingconnector/syncthingconnectionstatus.h +++ b/syncthingconnector/syncthingconnectionstatus.h @@ -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)