Adjustable download timeout + some tweaking.
This commit is contained in:
parent
3e719069ad
commit
ee5953d6ea
@ -129,16 +129,13 @@ QVariant FeedsModelStandardFeed::data(int column, int role) const {
|
||||
|
||||
void FeedsModelStandardFeed::update() {
|
||||
QByteArray feed_contents;
|
||||
int download_timeout = Settings::instance()->value(APP_CFG_FEEDS,
|
||||
"download_timeout",
|
||||
DOWNLOAD_TIMEOUT).toInt();
|
||||
|
||||
// TODO: Provide download time-measures debugging
|
||||
// outputs here.
|
||||
int download_timeout = Settings::instance()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt();
|
||||
QNetworkReply::NetworkError download_result = NetworkFactory::downloadFeedFile(url(),
|
||||
download_timeout,
|
||||
feed_contents,
|
||||
this);
|
||||
passwordProtected(),
|
||||
username(),
|
||||
password());
|
||||
|
||||
if (download_result != QNetworkReply::NoError) {
|
||||
qWarning("Error during fetching of new messages for feed '%s' (id %d).",
|
||||
|
@ -13,7 +13,9 @@ NetworkFactory::NetworkFactory() {
|
||||
QNetworkReply::NetworkError NetworkFactory::downloadFeedFile(const QString &url,
|
||||
int timeout,
|
||||
QByteArray &output,
|
||||
FeedsModelStandardFeed *feed) {
|
||||
bool protected_contents,
|
||||
const QString &username,
|
||||
const QString &password) {
|
||||
// Original asynchronous behavior of QNetworkAccessManager
|
||||
// is replaced by synchronous behavior in order to make
|
||||
// process of downloading of a file easier to understand.
|
||||
@ -27,9 +29,9 @@ QNetworkReply::NetworkError NetworkFactory::downloadFeedFile(const QString &url,
|
||||
QObject originatingObject;
|
||||
|
||||
// Set credential information as originating object.
|
||||
originatingObject.setProperty("protected", feed->passwordProtected());
|
||||
originatingObject.setProperty("username", feed->username());
|
||||
originatingObject.setProperty("password", feed->password());
|
||||
originatingObject.setProperty("protected", protected_contents);
|
||||
originatingObject.setProperty("username", username);
|
||||
originatingObject.setProperty("password", password);
|
||||
request.setOriginatingObject(&originatingObject);
|
||||
|
||||
// Set url for this reques.
|
||||
|
@ -17,7 +17,9 @@ class NetworkFactory {
|
||||
static QNetworkReply::NetworkError downloadFeedFile(const QString &url,
|
||||
int timeout,
|
||||
QByteArray &output,
|
||||
FeedsModelStandardFeed *feed);
|
||||
bool protected_contents = false,
|
||||
const QString &username = QString(),
|
||||
const QString &password = QString());
|
||||
};
|
||||
|
||||
#endif // NETWORKFACTORY_H
|
||||
|
@ -156,12 +156,14 @@ void FormSettings::loadFeedsMessages() {
|
||||
m_ui->m_checkRemoveReadMessagesOnExit->setChecked(Settings::instance()->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool());
|
||||
m_ui->m_checkAutoUpdate->setChecked(Settings::instance()->value(APP_CFG_FEEDS, "auto_update_enabled", false).toBool());
|
||||
m_ui->m_spinAutoUpdateInterval->setValue(Settings::instance()->value(APP_CFG_FEEDS, "auto_update_interval", DEFAULT_AUTO_UPDATE_INTERVAL).toInt());
|
||||
m_ui->m_spinFeedUpdateTimeout->setValue(Settings::instance()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt());
|
||||
}
|
||||
|
||||
void FormSettings::saveFeedsMessages() {
|
||||
Settings::instance()->setValue(APP_CFG_MESSAGES, "clear_read_on_exit", m_ui->m_checkRemoveReadMessagesOnExit->isChecked());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "auto_update_enabled", m_ui->m_checkAutoUpdate->isChecked());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "auto_update_interval", m_ui->m_spinAutoUpdateInterval->value());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "feed_update_timeout", m_ui->m_spinFeedUpdateTimeout->value());
|
||||
|
||||
FormMain::instance()->tabWidget()->feedMessageViewer()->feedsView()->updateAutoUpdateStatus();
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>564</width>
|
||||
<height>363</height>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
@ -180,8 +180,8 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>558</width>
|
||||
<height>337</height>
|
||||
<width>167</width>
|
||||
<height>219</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
@ -781,6 +781,32 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Feed connection timeout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_spinFeedUpdateTimeout">
|
||||
<property name="toolTip">
|
||||
<string>Connection timeout is time interval which is reserved for downloading new messages for the feed. If this time interval elapses, then download process is aborted.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>15000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_tabMessages">
|
||||
|
Loading…
x
Reference in New Issue
Block a user