Improve tracking of whether Syncthing has been stopped manually

* Don't consider the proccess manually stopped by default; otherwise that's
  considered to be the case even though the launcher isn't used at all
* Unset the service being manually stopped only when there's an actual
  state transition to running; otherwise we'd immediately unset the flag
  after manually stopping the service
This commit is contained in:
Martchus 2022-10-22 12:06:18 +02:00
parent ba0f60c6a8
commit 525b2c2f94
2 changed files with 4 additions and 4 deletions

View File

@ -106,7 +106,7 @@ SyncthingProcess *SyncthingProcess::s_mainInstance = nullptr;
*/
SyncthingProcess::SyncthingProcess(QObject *parent)
: SyncthingProcessBase(parent)
, m_manuallyStopped(true)
, m_manuallyStopped(false)
{
m_killTimer.setInterval(3000);
m_killTimer.setSingleShot(true);

View File

@ -492,10 +492,10 @@ void SyncthingService::handlePropertiesChanged(
emit stateChanged(m_activeState, m_subState, m_activeSince);
}
const bool currentlyRunning = isRunning();
if (currentlyRunning) {
m_manuallyStopped = false;
}
if (wasRunningBefore != currentlyRunning) {
if (currentlyRunning) {
m_manuallyStopped = false;
}
emit runningChanged(currentlyRunning);
}