new sync algorithm now switchable, by default is off
This commit is contained in:
parent
7c7c991fab
commit
fd91a2d738
@ -20,7 +20,7 @@
|
|||||||
GreaderNetwork::GreaderNetwork(QObject* parent)
|
GreaderNetwork::GreaderNetwork(QObject* parent)
|
||||||
: QObject(parent), m_service(GreaderServiceRoot::Service::FreshRss), m_username(QString()), m_password(QString()),
|
: QObject(parent), m_service(GreaderServiceRoot::Service::FreshRss), m_username(QString()), m_password(QString()),
|
||||||
m_baseUrl(QString()), m_batchSize(GREADER_DEFAULT_BATCH_SIZE), m_downloadOnlyUnreadMessages(false),
|
m_baseUrl(QString()), m_batchSize(GREADER_DEFAULT_BATCH_SIZE), m_downloadOnlyUnreadMessages(false),
|
||||||
m_prefetchedMessages({}), m_performGlobalFetching(false) {
|
m_prefetchedMessages({}), m_performGlobalFetching(false), m_intelligentSynchronization(false) {
|
||||||
clearCredentials();
|
clearCredentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1053,6 +1053,14 @@ QString GreaderNetwork::generateFullUrl(GreaderNetwork::Operations operation) co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GreaderNetwork::intelligentSynchronization() const {
|
||||||
|
return m_intelligentSynchronization;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GreaderNetwork::setIntelligentSynchronization(bool intelligent_synchronization) {
|
||||||
|
m_intelligentSynchronization = intelligent_synchronization;
|
||||||
|
}
|
||||||
|
|
||||||
bool GreaderNetwork::downloadOnlyUnreadMessages() const {
|
bool GreaderNetwork::downloadOnlyUnreadMessages() const {
|
||||||
return m_downloadOnlyUnreadMessages;
|
return m_downloadOnlyUnreadMessages;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,9 @@ class GreaderNetwork : public QObject {
|
|||||||
bool downloadOnlyUnreadMessages() const;
|
bool downloadOnlyUnreadMessages() const;
|
||||||
void setDownloadOnlyUnreadMessages(bool download_only_unread);
|
void setDownloadOnlyUnreadMessages(bool download_only_unread);
|
||||||
|
|
||||||
|
bool intelligentSynchronization() const;
|
||||||
|
void setIntelligentSynchronization(bool intelligent_synchronization);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPair<QByteArray, QByteArray> authHeader() const;
|
QPair<QByteArray, QByteArray> authHeader() const;
|
||||||
|
|
||||||
@ -120,6 +123,7 @@ class GreaderNetwork : public QObject {
|
|||||||
QString m_authToken;
|
QString m_authToken;
|
||||||
QList<Message> m_prefetchedMessages;
|
QList<Message> m_prefetchedMessages;
|
||||||
bool m_performGlobalFetching;
|
bool m_performGlobalFetching;
|
||||||
|
bool m_intelligentSynchronization;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GREADERNETWORK_H
|
#endif // GREADERNETWORK_H
|
||||||
|
@ -44,6 +44,7 @@ QVariantHash GreaderServiceRoot::customDatabaseData() const {
|
|||||||
data["url"] = m_network->baseUrl();
|
data["url"] = m_network->baseUrl();
|
||||||
data["batch_size"] = m_network->batchSize();
|
data["batch_size"] = m_network->batchSize();
|
||||||
data["download_only_unread"] = m_network->downloadOnlyUnreadMessages();
|
data["download_only_unread"] = m_network->downloadOnlyUnreadMessages();
|
||||||
|
data["intelligent_synchronization"] = m_network->intelligentSynchronization();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -55,13 +56,13 @@ void GreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
|||||||
m_network->setBaseUrl(data["url"].toString());
|
m_network->setBaseUrl(data["url"].toString());
|
||||||
m_network->setBatchSize(data["batch_size"].toInt());
|
m_network->setBatchSize(data["batch_size"].toInt());
|
||||||
m_network->setDownloadOnlyUnreadMessages(data["download_only_unread"].toBool());
|
m_network->setDownloadOnlyUnreadMessages(data["download_only_unread"].toBool());
|
||||||
|
m_network->setIntelligentSynchronization(data["intelligent_synchronization"].toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GreaderServiceRoot::aboutToBeginFeedFetching(const QList<Feed*>& feeds,
|
void GreaderServiceRoot::aboutToBeginFeedFetching(const QList<Feed*>& feeds,
|
||||||
const QHash<QString, QHash<BagOfMessages, QStringList>>& stated_messages,
|
const QHash<QString, QHash<BagOfMessages, QStringList>>& stated_messages,
|
||||||
const QHash<QString, QStringList>& tagged_messages) {
|
const QHash<QString, QStringList>& tagged_messages) {
|
||||||
// Prefetch starred messages.
|
if (m_network->intelligentSynchronization()) {
|
||||||
if (true /* intelligent downloading */) {
|
|
||||||
m_network->prepareFeedFetching(this, feeds, stated_messages, tagged_messages, networkProxy());
|
m_network->prepareFeedFetching(this, feeds, stated_messages, tagged_messages, networkProxy());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -72,13 +73,10 @@ void GreaderServiceRoot::aboutToBeginFeedFetching(const QList<Feed*>& feeds,
|
|||||||
QList<Message> GreaderServiceRoot::obtainNewMessages(Feed* feed,
|
QList<Message> GreaderServiceRoot::obtainNewMessages(Feed* feed,
|
||||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||||
const QHash<QString, QStringList>& tagged_messages) {
|
const QHash<QString, QStringList>& tagged_messages) {
|
||||||
Q_UNUSED(stated_messages)
|
|
||||||
Q_UNUSED(tagged_messages)
|
|
||||||
|
|
||||||
Feed::Status error = Feed::Status::Normal;
|
Feed::Status error = Feed::Status::Normal;
|
||||||
|
|
||||||
if (true /* intelligent downloading */ ) {
|
if (m_network->intelligentSynchronization()) {
|
||||||
return network()->getMessagesIntelligently(this,
|
return m_network->getMessagesIntelligently(this,
|
||||||
feed->customId(),
|
feed->customId(),
|
||||||
stated_messages,
|
stated_messages,
|
||||||
tagged_messages,
|
tagged_messages,
|
||||||
@ -86,7 +84,7 @@ QList<Message> GreaderServiceRoot::obtainNewMessages(Feed* feed,
|
|||||||
networkProxy());
|
networkProxy());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return network()->streamContents(this, feed->customId(), error, networkProxy());
|
return m_network->streamContents(this, feed->customId(), error, networkProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error != Feed::Status::NewMessages && error != Feed::Status::Normal) {
|
if (error != Feed::Status::NewMessages && error != Feed::Status::Normal) {
|
||||||
|
@ -29,6 +29,7 @@ void FormEditGreaderAccount::apply() {
|
|||||||
account<GreaderServiceRoot>()->network()->setBatchSize(m_details->m_ui.m_spinLimitMessages->value());
|
account<GreaderServiceRoot>()->network()->setBatchSize(m_details->m_ui.m_spinLimitMessages->value());
|
||||||
account<GreaderServiceRoot>()->network()->setDownloadOnlyUnreadMessages(m_details->m_ui.m_cbDownloadOnlyUnreadMessages->isChecked());
|
account<GreaderServiceRoot>()->network()->setDownloadOnlyUnreadMessages(m_details->m_ui.m_cbDownloadOnlyUnreadMessages->isChecked());
|
||||||
account<GreaderServiceRoot>()->network()->setService(m_details->service());
|
account<GreaderServiceRoot>()->network()->setService(m_details->service());
|
||||||
|
account<GreaderServiceRoot>()->network()->setIntelligentSynchronization(m_details->m_ui.m_cbNewAlgorithm->isChecked());
|
||||||
|
|
||||||
account<GreaderServiceRoot>()->saveAccountDataToDatabase();
|
account<GreaderServiceRoot>()->saveAccountDataToDatabase();
|
||||||
accept();
|
accept();
|
||||||
@ -50,6 +51,7 @@ void FormEditGreaderAccount::loadAccountData() {
|
|||||||
m_details->m_ui.m_txtUrl->lineEdit()->setText(existing_root->network()->baseUrl());
|
m_details->m_ui.m_txtUrl->lineEdit()->setText(existing_root->network()->baseUrl());
|
||||||
m_details->m_ui.m_spinLimitMessages->setValue(existing_root->network()->batchSize());
|
m_details->m_ui.m_spinLimitMessages->setValue(existing_root->network()->batchSize());
|
||||||
m_details->m_ui.m_cbDownloadOnlyUnreadMessages->setChecked(existing_root->network()->downloadOnlyUnreadMessages());
|
m_details->m_ui.m_cbDownloadOnlyUnreadMessages->setChecked(existing_root->network()->downloadOnlyUnreadMessages());
|
||||||
|
m_details->m_ui.m_cbNewAlgorithm->setChecked(existing_root->network()->intelligentSynchronization());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditGreaderAccount::performTest() {
|
void FormEditGreaderAccount::performTest() {
|
||||||
|
@ -29,22 +29,29 @@ GreaderAccountDetails::GreaderAccountDetails(QWidget* parent) : QWidget(parent)
|
|||||||
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information,
|
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information,
|
||||||
tr("No test done yet."),
|
tr("No test done yet."),
|
||||||
tr("Here, results of connection test are shown."));
|
tr("Here, results of connection test are shown."));
|
||||||
|
|
||||||
m_ui.m_lblLimitMessages->setText(tr("Limiting the number of fetched articles per feed makes fetching of "
|
m_ui.m_lblLimitMessages->setText(tr("Limiting the number of fetched articles per feed makes fetching of "
|
||||||
"articles faster, but if your feed contains more articles "
|
"articles faster, but if your feed contains more articles "
|
||||||
"than specified limit, then some older articles might not be "
|
"than specified limit, then some older articles might not be "
|
||||||
"fetched at all."));
|
"fetched at all."));
|
||||||
|
|
||||||
GuiUtilities::setLabelAsNotice(*m_ui.m_lblLimitMessages, true);
|
GuiUtilities::setLabelAsNotice(*m_ui.m_lblLimitMessages, true);
|
||||||
|
|
||||||
|
m_ui.m_lblNewAlgorithm->setText(tr("If you select intelligent synchronization, then only not-yet-fetched "
|
||||||
|
"or updated articles are downloaded. Network usage is greatly reduced and "
|
||||||
|
"overall synchronization speed is greatly improved."));
|
||||||
|
GuiUtilities::setLabelAsNotice(*m_ui.m_lblNewAlgorithm, false);
|
||||||
|
|
||||||
connect(m_ui.m_checkShowPassword, &QCheckBox::toggled, this, &GreaderAccountDetails::displayPassword);
|
connect(m_ui.m_checkShowPassword, &QCheckBox::toggled, this, &GreaderAccountDetails::displayPassword);
|
||||||
connect(m_ui.m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onPasswordChanged);
|
connect(m_ui.m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onPasswordChanged);
|
||||||
connect(m_ui.m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUsernameChanged);
|
connect(m_ui.m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUsernameChanged);
|
||||||
connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUrlChanged);
|
connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUrlChanged);
|
||||||
connect(m_ui.m_cmbService, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GreaderAccountDetails::fillPredefinedUrl);
|
connect(m_ui.m_cmbService, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GreaderAccountDetails::fillPredefinedUrl);
|
||||||
|
connect(m_ui.m_cbNewAlgorithm, &QCheckBox::toggled, m_ui.m_spinLimitMessages, &MessageCountSpinBox::setDisabled);
|
||||||
|
|
||||||
setTabOrder(m_ui.m_cmbService, m_ui.m_txtUrl->lineEdit());
|
setTabOrder(m_ui.m_cmbService, m_ui.m_txtUrl->lineEdit());
|
||||||
setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_cbDownloadOnlyUnreadMessages);
|
setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_cbDownloadOnlyUnreadMessages);
|
||||||
setTabOrder(m_ui.m_cbDownloadOnlyUnreadMessages, m_ui.m_spinLimitMessages);
|
setTabOrder(m_ui.m_cbDownloadOnlyUnreadMessages, m_ui.m_cbNewAlgorithm);
|
||||||
|
setTabOrder(m_ui.m_cbNewAlgorithm, m_ui.m_spinLimitMessages);
|
||||||
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_txtUsername->lineEdit());
|
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_txtUsername->lineEdit());
|
||||||
setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtPassword->lineEdit());
|
setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtPassword->lineEdit());
|
||||||
setTabOrder(m_ui.m_txtPassword->lineEdit(), m_ui.m_checkShowPassword);
|
setTabOrder(m_ui.m_txtPassword->lineEdit(), m_ui.m_checkShowPassword);
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="LineEditWithStatus" name="m_txtUrl" native="true"/>
|
<widget class="LineEditWithStatus" name="m_txtUrl" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="7" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
@ -51,17 +51,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="9" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="m_lblLimitMessages">
|
<widget class="QLabel" name="m_lblLimitMessages">
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" colspan="2">
|
<item row="10" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="m_gbAuthentication">
|
<widget class="QGroupBox" name="m_gbAuthentication">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string>
|
<string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string>
|
||||||
@ -112,7 +109,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0" colspan="2">
|
<item row="11" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_btnTestSetup">
|
<widget class="QPushButton" name="m_btnTestSetup">
|
||||||
@ -136,7 +133,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0" colspan="2">
|
<item row="12" column="0" colspan="2">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -156,6 +153,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="m_cbNewAlgorithm">
|
||||||
|
<property name="text">
|
||||||
|
<string>Intelligent synchronization algorithm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="m_lblNewAlgorithm">
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
@ -178,11 +189,12 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>m_cmbService</tabstop>
|
||||||
<tabstop>m_cbDownloadOnlyUnreadMessages</tabstop>
|
<tabstop>m_cbDownloadOnlyUnreadMessages</tabstop>
|
||||||
|
<tabstop>m_cbNewAlgorithm</tabstop>
|
||||||
<tabstop>m_spinLimitMessages</tabstop>
|
<tabstop>m_spinLimitMessages</tabstop>
|
||||||
<tabstop>m_checkShowPassword</tabstop>
|
<tabstop>m_checkShowPassword</tabstop>
|
||||||
<tabstop>m_btnTestSetup</tabstop>
|
<tabstop>m_btnTestSetup</tabstop>
|
||||||
<tabstop>m_cmbService</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user