This commit is contained in:
Martin Rotter 2021-04-09 13:49:42 +02:00
parent b1d394b6e5
commit 642690c844
8 changed files with 186 additions and 128 deletions

View File

@ -46,10 +46,6 @@ InoreaderAccountDetails::InoreaderAccountDetails(QWidget* parent)
connect(m_ui.m_btnTestSetup, &QPushButton::clicked, this, &InoreaderAccountDetails::testSetup); connect(m_ui.m_btnTestSetup, &QPushButton::clicked, this, &InoreaderAccountDetails::testSetup);
connect(m_ui.m_btnRegisterApi, &QPushButton::clicked, this, &InoreaderAccountDetails::registerApi); connect(m_ui.m_btnRegisterApi, &QPushButton::clicked, this, &InoreaderAccountDetails::registerApi);
m_ui.m_spinLimitMessages->setValue(INOREADER_DEFAULT_BATCH_SIZE);
m_ui.m_spinLimitMessages->setMinimum(INOREADER_MIN_BATCH_SIZE);
m_ui.m_spinLimitMessages->setMaximum(INOREADER_MAX_BATCH_SIZE);
emit m_ui.m_txtUsername->lineEdit()->textChanged(m_ui.m_txtUsername->lineEdit()->text()); emit m_ui.m_txtUsername->lineEdit()->textChanged(m_ui.m_txtUsername->lineEdit()->text());
emit m_ui.m_txtAppId->lineEdit()->textChanged(m_ui.m_txtAppId->lineEdit()->text()); emit m_ui.m_txtAppId->lineEdit()->textChanged(m_ui.m_txtAppId->lineEdit()->text());
emit m_ui.m_txtAppKey->lineEdit()->textChanged(m_ui.m_txtAppKey->lineEdit()->text()); emit m_ui.m_txtAppKey->lineEdit()->textChanged(m_ui.m_txtAppKey->lineEdit()->text());

View File

@ -116,21 +116,8 @@
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<layout class="QFormLayout" name="formLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item row="0" column="1"> <item>
<widget class="QSpinBox" name="m_spinLimitMessages">
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string> message(s)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Only download newest X messages per feed</string> <string>Only download newest X messages per feed</string>
@ -140,6 +127,29 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="MessageCountSpinBox" name="m_spinLimitMessages">
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="4" column="0" colspan="2">
@ -195,6 +205,11 @@
<header>labelwithstatus.h</header> <header>labelwithstatus.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>MessageCountSpinBox</class>
<extends>QSpinBox</extends>
<header>messagecountspinbox.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -183,7 +183,9 @@ QList<Message> InoreaderNetworkFactory::messages(ServiceRoot* root, const QStrin
return QList<Message>(); return QList<Message>();
} }
target_url += QSL("/") + QUrl::toPercentEncoding(stream_id) + QString("?n=%1").arg(batchSize()); target_url += QSL("/") + QUrl::toPercentEncoding(stream_id) + QString("?n=%1").arg(batchSize() <= 0
? INOREADER_MAX_BATCH_SIZE
: batchSize());
if (downloadOnlyUnreadMessages()) { if (downloadOnlyUnreadMessages()) {
target_url += QSL("&xt=%1").arg(INOREADER_FULL_STATE_READ); target_url += QSL("&xt=%1").arg(INOREADER_FULL_STATE_READ);

View File

@ -20,9 +20,6 @@ OwnCloudAccountDetails::OwnCloudAccountDetails(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 number of downloaded messages per feed makes updating of feeds faster but if your feed contains "
"bigger number of messages than specified limit, then some messages might not be downloaded during feed update."));
connect(m_ui.m_spinLimitMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [=](int value) { connect(m_ui.m_spinLimitMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [=](int value) {
if (value <= 0) { if (value <= 0) {
@ -33,7 +30,6 @@ OwnCloudAccountDetails::OwnCloudAccountDetails(QWidget* parent) : QWidget(parent
} }
}); });
GuiUtilities::setLabelAsNotice(*m_ui.m_lblLimitMessages, true);
GuiUtilities::setLabelAsNotice(*m_ui.m_lblServerSideUpdateInformation, true); GuiUtilities::setLabelAsNotice(*m_ui.m_lblServerSideUpdateInformation, true);
connect(m_ui.m_checkShowPassword, &QCheckBox::toggled, this, &OwnCloudAccountDetails::displayPassword); connect(m_ui.m_checkShowPassword, &QCheckBox::toggled, this, &OwnCloudAccountDetails::displayPassword);
@ -42,9 +38,9 @@ OwnCloudAccountDetails::OwnCloudAccountDetails(QWidget* parent) : QWidget(parent
connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &OwnCloudAccountDetails::onUrlChanged); connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &OwnCloudAccountDetails::onUrlChanged);
setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_checkDownloadOnlyUnreadMessages); setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_checkDownloadOnlyUnreadMessages);
setTabOrder(m_ui.m_checkDownloadOnlyUnreadMessages, m_ui.m_checkServerSideUpdate); setTabOrder(m_ui.m_checkDownloadOnlyUnreadMessages, m_ui.m_spinLimitMessages);
setTabOrder(m_ui.m_checkServerSideUpdate, m_ui.m_spinLimitMessages); setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_checkServerSideUpdate);
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_txtUsername->lineEdit()); setTabOrder(m_ui.m_checkServerSideUpdate, 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);
setTabOrder(m_ui.m_checkShowPassword, m_ui.m_btnTestSetup); setTabOrder(m_ui.m_checkShowPassword, m_ui.m_btnTestSetup);

View File

@ -6,57 +6,11 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>430</width> <width>433</width>
<height>312</height> <height>363</height>
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="1" column="0">
<widget class="QCheckBox" name="m_checkDownloadOnlyUnreadMessages">
<property name="text">
<string>Download only unread messages</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkServerSideUpdate">
<property name="text">
<string>Force execution of server-side update when updating feeds from RSS Guard</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Only download newest X messages per feed</string>
</property>
<property name="buddy">
<cstring>m_spinLimitMessages</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="m_spinLimitMessages">
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string> = unlimited</string>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -74,6 +28,60 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkDownloadOnlyUnreadMessages">
<property name="text">
<string>Download only unread messages</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Only download newest X messages per feed</string>
</property>
<property name="buddy">
<cstring>m_spinLimitMessages</cstring>
</property>
</widget>
</item>
<item>
<widget class="MessageCountSpinBox" name="m_spinLimitMessages">
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="m_lblServerSideUpdateInformation">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QGroupBox" name="m_gbAuthentication"> <widget class="QGroupBox" name="m_gbAuthentication">
<property name="toolTip"> <property name="toolTip">
@ -149,7 +157,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="8" column="0" colspan="2"> <item row="8" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -162,23 +170,10 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="m_lblLimitMessages">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QLabel" name="m_lblServerSideUpdateInformation"> <widget class="QCheckBox" name="m_checkServerSideUpdate">
<property name="text"> <property name="text">
<string/> <string>Force execution of server-side update when updating feeds from RSS Guard</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -197,6 +192,11 @@
<header>labelwithstatus.h</header> <header>labelwithstatus.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>MessageCountSpinBox</class>
<extends>QSpinBox</extends>
<header>messagecountspinbox.h</header>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>m_checkDownloadOnlyUnreadMessages</tabstop> <tabstop>m_checkDownloadOnlyUnreadMessages</tabstop>

View File

@ -25,7 +25,8 @@ TtRssAccountDetails::TtRssAccountDetails(QWidget* parent) : QWidget(parent) {
GuiUtilities::setLabelAsNotice(*m_ui.m_lblServerSideUpdateInformation, true); GuiUtilities::setLabelAsNotice(*m_ui.m_lblServerSideUpdateInformation, true);
setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_checkDownloadOnlyUnreadMessages); setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_checkDownloadOnlyUnreadMessages);
setTabOrder(m_ui.m_checkDownloadOnlyUnreadMessages, m_ui.m_checkServerSideUpdate); setTabOrder(m_ui.m_checkDownloadOnlyUnreadMessages, m_ui.m_spinLimitMessages);
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_checkServerSideUpdate);
setTabOrder(m_ui.m_checkServerSideUpdate, m_ui.m_txtUsername->lineEdit()); setTabOrder(m_ui.m_checkServerSideUpdate, 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);

View File

@ -6,11 +6,24 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>429</width> <width>432</width>
<height>373</height> <height>480</height>
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="8" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>408</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -36,13 +49,50 @@
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Only download newest X messages per feed</string>
</property>
<property name="buddy">
<cstring>m_spinLimitMessages</cstring>
</property>
</widget>
</item>
<item>
<widget class="MessageCountSpinBox" name="m_spinLimitMessages">
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkServerSideUpdate"> <widget class="QCheckBox" name="m_checkServerSideUpdate">
<property name="text"> <property name="text">
<string>Force execution of server-side update when updating feeds from RSS Guard</string> <string>Force execution of server-side update when updating feeds from RSS Guard</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QLabel" name="m_lblServerSideUpdateInformation"> <widget class="QLabel" name="m_lblServerSideUpdateInformation">
<property name="text"> <property name="text">
<string/> <string/>
@ -52,7 +102,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="5" 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>
@ -103,7 +153,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QGroupBox" name="m_gbHttpAuthentication"> <widget class="QGroupBox" name="m_gbHttpAuthentication">
<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>
@ -157,14 +207,16 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="7" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="m_btnTestSetup"> <widget class="QPushButton" name="m_btnTestSetup">
<property name="text"> <property name="text">
<string>&amp;Test setup</string> <string>&amp;Test setup</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item>
<widget class="LabelWithStatus" name="m_lblTestResult" native="true"> <widget class="LabelWithStatus" name="m_lblTestResult" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -177,18 +229,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2"> </layout>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>408</width>
<height>30</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -205,6 +246,11 @@
<header>labelwithstatus.h</header> <header>labelwithstatus.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>MessageCountSpinBox</class>
<extends>QSpinBox</extends>
<header>messagecountspinbox.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -216,6 +216,8 @@ QList<Message> TtRssServiceRoot::obtainNewMessages(const QList<Feed*>& feeds, bo
for (Feed* feed : feeds) { for (Feed* feed : feeds) {
int newly_added_messages = 0; int newly_added_messages = 0;
// TODO: pokračovat, přidat batchSize() a řešit misto limit.
int limit = TTRSS_MAX_MESSAGES; int limit = TTRSS_MAX_MESSAGES;
int skip = 0; int skip = 0;