mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 11:19:18 +01:00
Record the time of the last successful podcast update
This commit is contained in:
parent
034da1717c
commit
71fe57b3ae
@ -56,10 +56,21 @@ void PodcastUpdater::ReloadSettings() {
|
||||
RestartTimer();
|
||||
}
|
||||
|
||||
void PodcastUpdater::SaveSettings() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("last_full_update", last_full_update_);
|
||||
}
|
||||
|
||||
void PodcastUpdater::RestartTimer() {
|
||||
// Stop any existing timer
|
||||
update_timer_->stop();
|
||||
|
||||
if (pending_replies_ > 0) {
|
||||
// We're still waiting for replies from the last update - don't do anything.
|
||||
return;
|
||||
}
|
||||
|
||||
if (update_interval_secs_ > 0) {
|
||||
if (!last_full_update_.isValid()) {
|
||||
// Updates are enabled and we've never updated before. Do it now.
|
||||
@ -113,6 +124,10 @@ void PodcastUpdater::PodcastLoaded(PodcastUrlLoaderReply* reply, const Podcast&
|
||||
|
||||
if (one_of_many) {
|
||||
if (--pending_replies_ == 0) {
|
||||
// This was the last reply we were waiting for. Save this time as being
|
||||
// the last sucessful update and restart the timer.
|
||||
last_full_update_ = QDateTime::currentDateTime();
|
||||
SaveSettings();
|
||||
RestartTimer();
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void RestartTimer();
|
||||
void SaveSettings();
|
||||
|
||||
private:
|
||||
Application* app_;
|
||||
|
Loading…
Reference in New Issue
Block a user