This commit is contained in:
Martin Rotter 2014-02-19 20:46:54 +01:00
parent a2a8501ca9
commit ce8d020415
13 changed files with 228 additions and 48 deletions

View file

@ -300,6 +300,7 @@ set(APP_SOURCES
src/gui/labelwithstatus.cpp src/gui/labelwithstatus.cpp
src/gui/messagebox.cpp src/gui/messagebox.cpp
src/gui/formupdate.cpp src/gui/formupdate.cpp
src/gui/comboboxwithstatus.cpp
# CORE sources. # CORE sources.
src/core/debugging.cpp src/core/debugging.cpp
@ -369,6 +370,7 @@ set(APP_HEADERS
src/gui/labelwithstatus.h src/gui/labelwithstatus.h
src/gui/messagebox.h src/gui/messagebox.h
src/gui/formupdate.h src/gui/formupdate.h
src/gui/comboboxwithstatus.h
# CORE headers. # CORE headers.
src/core/settings.h src/core/settings.h

View file

@ -1,5 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<releases> <releases>
<release version="1.9.9.5" type="maintenance">
<url platform="x86" os="OS2">https://bitbucket.org/skunkos/rssguard/downloads/rssguard-1.9.9.5-os2.7z</url>
<changes>
<![CDATA[
<ul>
<li>[#] Mac OS X support missing.</li>
<li>[#] Virtual desktop change hides main window.</li>
<li>[#] Misleding external browser settings.</li>
<li>[#] Non-functional external browser shortcuts.</li>
<li>[#] Saving of webbrowser progressbar color.</li>
<li>[~] Usability of some GUI elements.</li>
<li>[@] Completely switched to new website.</li>
<li>[+] Some missing shortcuts.</li>
</ul>
]]>
</changes>
</release>
<release version="1.9.9.5" type="maintenance"> <release version="1.9.9.5" type="maintenance">
<url platform="x86" os="Windows">https://bitbucket.org/skunkos/rssguard/downloads/rssguard-1.9.9.5-win32.7z</url> <url platform="x86" os="Windows">https://bitbucket.org/skunkos/rssguard/downloads/rssguard-1.9.9.5-win32.7z</url>
<changes> <changes>

View file

@ -144,3 +144,10 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
return false; return false;
#endif #endif
} }
QList<UpdateInfo> SystemFactory::parseUpdatesFile(const QByteArray &updates_file) {
QList<UpdateInfo> updates;
return updates;
}

View file

@ -4,8 +4,28 @@
#include <QObject> #include <QObject>
#include <QPointer> #include <QPointer>
#include <QMutex> #include <QMutex>
#include <QMetaType>
class UpdateInfo {
public:
enum UpdateType {
// Corresponding enum to "maintenace" from UPDATES file.
Maintenance,
// Corresponding enum to "evolution" from UPDATES file.
Evolution
};
QString m_availableVersion;
QString m_fileUrl;
QString m_platform;
QString m_os;
UpdateType m_type;
QString m_changes;
};
Q_DECLARE_METATYPE(UpdateInfo);
class SystemFactory : public QObject { class SystemFactory : public QObject {
Q_OBJECT Q_OBJECT
@ -38,6 +58,7 @@ class SystemFactory : public QObject {
QString getAutostartDesktopFileLocation(); QString getAutostartDesktopFileLocation();
#endif #endif
QList<UpdateInfo> parseUpdatesFile(const QByteArray &updates_file);
// Access to application-wide close lock. // Access to application-wide close lock.
inline QMutex *applicationCloseLock() const { inline QMutex *applicationCloseLock() const {

View file

@ -0,0 +1,23 @@
#include "gui/comboboxwithstatus.h"
#include "gui/plaintoolbutton.h"
#include <QHBoxLayout>
ComboBoxWithStatus::ComboBoxWithStatus(QWidget *parent)
: WidgetWithStatus(parent) {
m_wdgInput = new QComboBox(this);
// Set correct size for the tool button.
int txt_input_height = m_wdgInput->sizeHint().height();
m_btnStatus->setFixedSize(txt_input_height, txt_input_height);
// Compose the layout.
m_layout->addWidget(m_wdgInput);
m_layout->addWidget(m_btnStatus);
}
ComboBoxWithStatus::~ComboBoxWithStatus() {
}

View file

@ -0,0 +1,21 @@
#ifndef COMBOBOXWITHSTATUS_H
#define COMBOBOXWITHSTATUS_H
#include "gui/widgetwithstatus.h"
#include <QComboBox>
class ComboBoxWithStatus : public WidgetWithStatus {
Q_OBJECT
public:
// Constructors and destructors.
explicit ComboBoxWithStatus(QWidget *parent = 0);
virtual ~ComboBoxWithStatus();
inline QComboBox *comboBox() const {
return static_cast<QComboBox*>(m_wdgInput);
}
};
#endif // COMBOBOXWITHSTATUS_H

View file

@ -2,6 +2,7 @@
#include "core/textfactory.h" #include "core/textfactory.h"
#include "gui/iconthemefactory.h" #include "gui/iconthemefactory.h"
#if !defined(Q_OS_WIN) #if !defined(Q_OS_WIN)
#include "gui/messagebox.h" #include "gui/messagebox.h"
#endif #endif

View file

@ -15,10 +15,7 @@
#include "gui/statusbar.h" #include "gui/statusbar.h"
#include "gui/feedmessageviewer.h" #include "gui/feedmessageviewer.h"
#include "qtsingleapplication/qtsingleapplication.h" #include "qtsingleapplication/qtsingleapplication.h"
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
#include "gui/formupdate.h" #include "gui/formupdate.h"
#endif
#include <QCloseEvent> #include <QCloseEvent>
#include <QSessionManager> #include <QSessionManager>
@ -110,13 +107,9 @@ void FormMain::prepareMenus() {
m_trayMenu = new QMenu(APP_NAME, this); m_trayMenu = new QMenu(APP_NAME, this);
#endif #endif
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
// Add "check for updates" item on some platforms. // Add "check for updates" item on some platforms.
m_actionCheckForUpdates = new QAction(tr("Check for updates"), this); m_ui->m_actionCheckForUpdates->setIcon(IconThemeFactory::instance()->fromTheme("check-for-updates"));
m_actionCheckForUpdates->setIcon(IconThemeFactory::instance()->fromTheme("check-for-updates")); m_ui->m_actionCheckForUpdates->setToolTip(tr("Check if new update for the application is available for download."));
m_actionCheckForUpdates->setToolTip(tr("Check if new update for the application is available for download."));
m_ui->m_menuHelp->insertAction(m_ui->m_actionAboutGuard, m_actionCheckForUpdates);
#endif
// Add needed items to the menu. // Add needed items to the menu.
m_trayMenu->addAction(m_ui->m_actionSwitchMainWindow); m_trayMenu->addAction(m_ui->m_actionSwitchMainWindow);
@ -340,10 +333,7 @@ void FormMain::createConnections() {
// Menu "Help" connections. // Menu "Help" connections.
connect(m_ui->m_actionAboutGuard, SIGNAL(triggered()), this, SLOT(showAbout())); connect(m_ui->m_actionAboutGuard, SIGNAL(triggered()), this, SLOT(showAbout()));
connect(m_ui->m_actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(showUpdates()));
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
connect(m_actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(showUpdates()));
#endif
// General connections. // General connections.
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
@ -401,7 +391,6 @@ void FormMain::showAbout() {
delete form_pointer.data(); delete form_pointer.data();
} }
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
void FormMain::showUpdates() { void FormMain::showUpdates() {
if (!SystemFactory::instance()->applicationCloseLock()->tryLock()) { if (!SystemFactory::instance()->applicationCloseLock()->tryLock()) {
if (SystemTrayIcon::isSystemTrayActivated()) { if (SystemTrayIcon::isSystemTrayActivated()) {
@ -423,7 +412,6 @@ void FormMain::showUpdates() {
form_update.data()->exec(); form_update.data()->exec();
delete form_update.data(); delete form_update.data();
} }
#endif
void FormMain::showSettings() { void FormMain::showSettings() {
QPointer<FormSettings> form_pointer = new FormSettings(this); QPointer<FormSettings> form_pointer = new FormSettings(this);

View file

@ -92,15 +92,9 @@ class FormMain : public QMainWindow {
// Displays various dialogs. // Displays various dialogs.
void showSettings(); void showSettings();
void showAbout(); void showAbout();
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
void showUpdates(); void showUpdates();
#endif
private: private:
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
QAction *m_actionCheckForUpdates;
#endif
Ui::FormMain *m_ui; Ui::FormMain *m_ui;
QMenu *m_trayMenu; QMenu *m_trayMenu;

View file

@ -61,6 +61,7 @@
<property name="title"> <property name="title">
<string>&amp;Help</string> <string>&amp;Help</string>
</property> </property>
<addaction name="m_actionCheckForUpdates"/>
<addaction name="m_actionAboutGuard"/> <addaction name="m_actionAboutGuard"/>
</widget> </widget>
<widget class="QMenu" name="m_menuView"> <widget class="QMenu" name="m_menuView">
@ -519,6 +520,14 @@
<string>Select previous message</string> <string>Select previous message</string>
</property> </property>
</action> </action>
<action name="m_actionCheckForUpdates">
<property name="text">
<string>Check for updates</string>
</property>
<property name="toolTip">
<string>Check if new application updates are available.</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View file

@ -1,12 +1,49 @@
#include "formupdate.h" #include "gui/formupdate.h"
#include "core/defs.h"
#include "core/systemfactory.h"
#include "core/networkfactory.h"
#include "gui/iconthemefactory.h"
#if !defined(Q_OS_WIN)
#include "gui/messagebox.h"
#endif
#include <QNetworkReply>
FormUpdate::FormUpdate(QWidget *parent) FormUpdate::FormUpdate(QWidget *parent)
: QDialog(parent), m_ui(new Ui::FormUpdate) { : QDialog(parent), m_ui(new Ui::FormUpdate) {
m_ui->setupUi(this); m_ui->setupUi(this);
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("application-about"));
#if !defined(Q_OS_WIN)
MessageBox::iconify(m_ui->m_buttonBox);
#endif
m_ui->m_lblCurrentRelease->setText(APP_VERSION);
checkForUpdates();
} }
FormUpdate::~FormUpdate() FormUpdate::~FormUpdate() {
{
delete m_ui; delete m_ui;
} }
void FormUpdate::checkForUpdates() {
QByteArray releases_xml;
QNetworkReply::NetworkError download_result = NetworkFactory::downloadFeedFile(RELEASES_LIST,
5000,
releases_xml);
QList<UpdateInfo> releases_list = SystemFactory::instance()->parseUpdatesFile(releases_xml);
foreach (const UpdateInfo &release, releases_list) {
m_ui->m_cmbAvailableRelease->comboBox()->addItem(release.m_availableVersion,
release);
}
}

View file

@ -14,9 +14,13 @@ class FormUpdate : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
// Constructors and destructors.
explicit FormUpdate(QWidget *parent = 0); explicit FormUpdate(QWidget *parent = 0);
virtual ~FormUpdate(); virtual ~FormUpdate();
protected:
void checkForUpdates();
private: private:
Ui::FormUpdate *m_ui; Ui::FormUpdate *m_ui;
}; };

View file

@ -1,42 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>FormUpdate</class> <class>FormUpdate</class>
<widget name="FormUpdate" class="QDialog"> <widget class="QDialog" name="FormUpdate">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>300</height> <height>226</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<widget name="buttonBox" class="QDialogButtonBox"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="geometry"> <item>
<rect> <layout class="QFormLayout" name="formLayout">
<x>30</x> <property name="fieldGrowthPolicy">
<y>240</y> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<width>341</width> </property>
<height>32</height> <item row="0" column="0">
</rect> <widget class="QLabel" name="label">
</property> <property name="text">
<property name="orientation"> <string>Current release</string>
<enum>Qt::Horizontal</enum> </property>
</property> </widget>
<property name="standardButtons"> </item>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <item row="0" column="1">
</property> <widget class="QLabel" name="m_lblCurrentRelease">
</widget> <property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Available releases</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="ComboBoxWithStatus" name="m_cmbAvailableRelease" native="true"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Changes</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QTextEdit" name="m_txtChanges">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="m_buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget> </widget>
<pixmapfunction/> <customwidgets>
<customwidget>
<class>ComboBoxWithStatus</class>
<extends>QWidget</extends>
<header>comboboxwithstatus.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>m_buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>FormUpdate</receiver> <receiver>FormUpdate</receiver>
<slot>accept()</slot> <slot>accept()</slot>
@ -52,7 +108,7 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>buttonBox</sender> <sender>m_buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>FormUpdate</receiver> <receiver>FormUpdate</receiver>
<slot>reject()</slot> <slot>reject()</slot>