Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Intervals to be at least "1s" by default for "image", "page", and "details". #3221

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

ProtagNeptune
Copy link

@ProtagNeptune ProtagNeptune changed the title Changed Intervals to be at least "1s" by default Changed Intervals to be at least "1s" by default for "image", "page", and "details" Jun 22, 2024
@ProtagNeptune ProtagNeptune changed the title Changed Intervals to be at least "1s" by default for "image", "page", and "details" Changed Intervals to be at least "1s" by default for "image", "page", and "details". Jun 22, 2024
@ProtagNeptune
Copy link
Author

😅

Copy link
Owner

@Bionus Bionus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but wouldn't it be easier to set the defaults when no values are found in the INI file? This way all sources would get this automatically, without having to remember to set it explicitly in the INI.

i.e. here for actual usage:

// Setup throttling
m_manager->setMaxConcurrency(setting("download/simultaneous", 10).toInt());
m_manager->setInterval(QueryType::List, setting("download/throttle_page", 0).toInt() * 1000);
m_manager->setInterval(QueryType::Img, setting("download/throttle_image", 0).toInt() * 1000);
m_manager->setInterval(QueryType::Thumbnail, setting("download/throttle_thumbnail", 0).toInt() * 1000);
m_manager->setInterval(QueryType::Details, setting("download/throttle_details", 0).toInt() * 1000);
m_manager->setInterval(QueryType::Retry, setting("download/throttle_retry", 60).toInt() * 1000);

Here for the settings window:

// Download settings
ui->spinSimultaneousDownloads->setValue(site->setting("download/simultaneous", 10).toInt());
ui->spinThrottleDetails->setValue(site->setting("download/throttle_details", 0).toInt());
ui->spinThrottleImage->setValue(site->setting("download/throttle_image", 0).toInt());
ui->spinThrottlePage->setValue(site->setting("download/throttle_page", 0).toInt());
ui->spinThrottleRetry->setValue(site->setting("download/throttle_retry", 60).toInt());
ui->spinThrottleThumbnail->setValue(site->setting("download/throttle_thumbnail", 0).toInt());

And here on Android settings screen:

SpinBoxSetting {
name: qsTr("Interval (image)")
max: 60 * 60
setting: Setting {
key: "download/throttle_image"
def: 0
obj: root.site.settings
}
Layout.fillWidth: true
}
SpinBoxSetting {
name: qsTr("Interval (page)")
max: 60 * 60
setting: Setting {
key: "download/throttle_page"
def: 0
obj: root.site.settings
}
Layout.fillWidth: true
}
SpinBoxSetting {
name: qsTr("Interval (details)")
max: 60 * 60
setting: Setting {
key: "download/throttle_details"
def: 0
obj: root.site.settings
}
Layout.fillWidth: true
}

@Bionus Bionus self-assigned this Jun 25, 2024
Copy link
Owner

@Bionus Bionus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! 👍

@Bionus Bionus merged commit 722e9c8 into Bionus:develop Jul 1, 2024
6 of 10 checks passed
@ProtagNeptune ProtagNeptune deleted the develop branch July 2, 2024 12:07
@ProtagNeptune ProtagNeptune restored the develop branch July 2, 2024 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants