This commit is contained in:
Martin Rotter 2016-04-03 09:42:09 +02:00
parent 9e7f6ed5dc
commit fc9add9be6
6 changed files with 149 additions and 80 deletions

View File

@ -8,6 +8,7 @@ Main:
Added:
▪ Global auto-update feed interval spinbox now has better format. (issue #176)
▪ Message preview's font is now fully adjustable in settings. (issue #177)
▪ RSS Guard now automatically switches to SQLite backend if MySQL is not available on program startup.
▪ Newspaper view now allows marking individual messages read/unread/starred/unstarred.

View File

@ -1251,7 +1251,7 @@ Authors of this application are NOT responsible for lost data.</string>
<item>
<widget class="QTabWidget" name="m_tabFeedsMessages">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_tabFeeds">
<attribute name="title">
@ -1275,25 +1275,6 @@ Authors of this application are NOT responsible for lost data.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="m_spinAutoUpdateInterval">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> minutes</string>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>240</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
@ -1355,6 +1336,19 @@ Authors of this application are NOT responsible for lost data.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="TimeSpinBox" name="m_spinAutoUpdateInterval">
<property name="enabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_tabMessages">
@ -1549,6 +1543,11 @@ Authors of this application are NOT responsible for lost data.</string>
<header>toolbareditor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TimeSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>timespinbox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_cmbDatabaseDriver</tabstop>
@ -1635,22 +1634,6 @@ Authors of this application are NOT responsible for lost data.</string>
</hint>
</hints>
</connection>
<connection>
<sender>m_checkAutoUpdate</sender>
<signal>toggled(bool)</signal>
<receiver>m_spinAutoUpdateInterval</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>324</x>
<y>48</y>
</hint>
<hint type="destinationlabel">
<x>597</x>
<y>49</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_checkMessagesDateTimeFormat</sender>
<signal>toggled(bool)</signal>
@ -1699,5 +1682,21 @@ Authors of this application are NOT responsible for lost data.</string>
</hint>
</hints>
</connection>
<connection>
<sender>m_checkAutoUpdate</sender>
<signal>toggled(bool)</signal>
<receiver>m_spinAutoUpdateInterval</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>324</x>
<y>71</y>
</hint>
<hint type="destinationlabel">
<x>707</x>
<y>72</y>
</hint>
</hints>
</connection>
</connections>
</ui>

61
src/gui/timespinbox.cpp Normal file
View File

@ -0,0 +1,61 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "gui/timespinbox.h"
TimeSpinBox::TimeSpinBox(QWidget *parent) : QDoubleSpinBox(parent) {
setMinimum(5.0);
setAccelerated(true);
setDecimals(0);
setMaximum(10000000.0);
}
TimeSpinBox::~TimeSpinBox() {
}
double TimeSpinBox::valueFromText(const QString &text) const {
bool ok;
double value = text.toDouble(&ok);
if (ok) {
return value;
}
else {
return 0.0;
}
}
QString TimeSpinBox::textFromValue(double val) const {
int minutes_total = (int)val;
int minutes_val = minutes_total % 60;
int hours_val = (minutes_total - minutes_val) / 60;
QString hours = tr("%n hour(s)", "", hours_val);
QString minutes = tr("%n minute(s)", "", minutes_val);
return hours + tr(" and ") + minutes;
}
void TimeSpinBox::fixup(QString &input) const {
bool ok;
double value = input.toDouble(&ok);
if (ok) {
input = textFromValue(value);
}
}

34
src/gui/timespinbox.h Normal file
View File

@ -0,0 +1,34 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef TIMESPINBOX_H
#define TIMESPINBOX_H
#include <QDoubleSpinBox>
class TimeSpinBox : public QDoubleSpinBox {
public:
explicit TimeSpinBox(QWidget *parent = 0);
virtual ~TimeSpinBox();
double valueFromText(const QString &text) const;
QString textFromValue(double val) const;
void fixup(QString &input) const;
};
#endif // TIMESPINBOX_H

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>517</width>
<width>622</width>
<height>442</height>
</rect>
</property>
@ -96,28 +96,10 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_spinAutoUpdateInterval">
<widget class="TimeSpinBox" name="m_spinAutoUpdateInterval">
<property name="enabled">
<bool>false</bool>
</property>
<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>240</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
</item>
</layout>
@ -307,6 +289,12 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LabelWithStatus</class>
<extends>QWidget</extends>
<header>labelwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LineEditWithStatus</class>
<extends>QWidget</extends>
@ -314,10 +302,9 @@
<container>1</container>
</customwidget>
<customwidget>
<class>LabelWithStatus</class>
<extends>QWidget</extends>
<header>labelwithstatus.h</header>
<container>1</container>
<class>TimeSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>timespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<width>598</width>
<height>235</height>
</rect>
</property>
@ -75,28 +75,10 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_spinAutoUpdateInterval">
<widget class="TimeSpinBox" name="m_spinAutoUpdateInterval">
<property name="enabled">
<bool>false</bool>
</property>
<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>240</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
</item>
</layout>
@ -169,6 +151,11 @@
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TimeSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>timespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>