From 24f6d41b78982eec918e7384e374c03cd6204a00 Mon Sep 17 00:00:00 2001 From: Francesc Martinez Date: Mon, 27 Jun 2022 21:17:49 +0200 Subject: [PATCH] #253 Make it possible to disable autofetch --- src/big_widgets/ConfigWidget.ui | 2 +- src/big_widgets/GitQlientRepo.cpp | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/big_widgets/ConfigWidget.ui b/src/big_widgets/ConfigWidget.ui index 56c74a09..bc5ba886 100644 --- a/src/big_widgets/ConfigWidget.ui +++ b/src/big_widgets/ConfigWidget.ui @@ -540,7 +540,7 @@ minutes - 1 + 0 60 diff --git a/src/big_widgets/GitQlientRepo.cpp b/src/big_widgets/GitQlientRepo.cpp index 57396d16..2f687d51 100644 --- a/src/big_widgets/GitQlientRepo.cpp +++ b/src/big_widgets/GitQlientRepo.cpp @@ -91,9 +91,9 @@ GitQlientRepo::GitQlientRepo(const QSharedPointer &git, const QSharedPo showHistoryView(); - const auto fetchInterval = mSettings->localValue("AutoFetch", 5).toInt(); + if (const auto fetchInterval = mSettings->localValue("AutoFetch", 5).toInt(); fetchInterval > 0) + mAutoFetch->setInterval(fetchInterval * 60 * 1000); - mAutoFetch->setInterval(fetchInterval * 60 * 1000); mAutoFilesUpdate->setInterval(15000); connect(mAutoFetch, &QTimer::timeout, mControls, &Controls::fetchAll); @@ -348,7 +348,9 @@ void GitQlientRepo::onRepoLoadFinished(bool fullReload) mControls->enableButtons(true); mAutoFilesUpdate->start(); - mAutoFetch->start(); + + if (const auto fetchInterval = mSettings->localValue("AutoFetch", 5).toInt(); fetchInterval > 0) + mAutoFetch->start(); QScopedPointer git(new GitConfig(mGitBase)); @@ -653,7 +655,10 @@ void GitQlientRepo::focusHistoryOnPr(int prNumber) void GitQlientRepo::reconfigureAutoFetch(int newInterval) { - mAutoFetch->start(newInterval * 60 * 1000); + if (newInterval > 0) + mAutoFetch->start(newInterval * 60 * 1000); + else + mAutoFetch->stop(); } void GitQlientRepo::onChangesCommitted()