Skip to content

Commit

Permalink
#253 Make it possible to disable autofetch
Browse files Browse the repository at this point in the history
  • Loading branch information
francescmm committed Jun 27, 2022
1 parent 4e4b74d commit 24f6d41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/big_widgets/ConfigWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
<string> minutes</string>
</property>
<property name="minimum">
<number>1</number>
<number>0</number>
</property>
<property name="maximum">
<number>60</number>
Expand Down
13 changes: 9 additions & 4 deletions src/big_widgets/GitQlientRepo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ GitQlientRepo::GitQlientRepo(const QSharedPointer<GitBase> &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);
Expand Down Expand Up @@ -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<GitConfig> git(new GitConfig(mGitBase));

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 24f6d41

Please # to comment.