Initial work on auto-updates.

This commit is contained in:
Martin Rotter 2014-02-03 14:20:52 +01:00
parent 22909150ac
commit d42f7b2490
3 changed files with 70 additions and 43 deletions

View file

@ -15,7 +15,7 @@
FeedsModelStandardFeed::FeedsModelStandardFeed(FeedsModelRootItem *parent_item)
: FeedsModelFeed(parent_item) {
: FeedsModelFeed(parent_item), m_autoUpdateInterval(-1) {
}
FeedsModelStandardFeed::~FeedsModelStandardFeed() {
@ -280,3 +280,7 @@ void FeedsModelStandardFeed::updateMessages(const QList<Message> &messages) {
qDebug("Transaction commit for message downloader failed.");
}
}

View file

@ -45,6 +45,14 @@ class FeedsModelStandardFeed : public FeedsModelFeed {
m_url = url;
}
inline int autoUpdateInterval() const {
return m_autoUpdateInterval;
}
inline void setAutoUpdateInterval(int auto_update_interval) {
m_autoUpdateInterval = auto_update_interval;
}
// Loads standard feed object from given SQL record.
static FeedsModelStandardFeed *loadFromRecord(const QSqlRecord &record);
@ -55,6 +63,11 @@ class FeedsModelStandardFeed : public FeedsModelFeed {
void updateMessages(const QList<Message> &messages);
private:
// NOTE: Number -1 means "do not auto-update", number
// 0 means "auto-update with global interval" and number
// > 0 means "auto-update with specific interval".
int m_autoUpdateInterval;
QString m_encoding;
QString m_url;
};

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>373</height>
<width>440</width>
<height>391</height>
</rect>
</property>
<property name="windowTitle">
@ -106,31 +106,50 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="m_checkAutoUpdate">
<property name="text">
<string>Update each</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="m_spinAutoUpdate">
<property name="suffix">
<string> minutes</string>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="m_cmbAutoUpdateType">
<item>
<property name="text">
<string>Do not auto-update at all</string>
</property>
</item>
<item>
<property name="text">
<string>Auto-update using global interval</string>
</property>
</item>
<item>
<property name="text">
<string>Auto-update every</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_spinAutoUpdateInterval">
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string> minutes</string>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QLabel" name="m_lblIcon">
@ -226,6 +245,13 @@
</layout>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Auto-update</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -269,21 +295,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>m_checkAutoUpdate</sender>
<signal>toggled(bool)</signal>
<receiver>m_spinAutoUpdate</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>51</x>
<y>153</y>
</hint>
<hint type="destinationlabel">
<x>232</x>
<y>154</y>
</hint>
</hints>
</connection>
</connections>
</ui>