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/messagebox.cpp
src/gui/formupdate.cpp
src/gui/comboboxwithstatus.cpp
# CORE sources.
src/core/debugging.cpp
@ -369,6 +370,7 @@ set(APP_HEADERS
src/gui/labelwithstatus.h
src/gui/messagebox.h
src/gui/formupdate.h
src/gui/comboboxwithstatus.h
# CORE headers.
src/core/settings.h

View File

@ -1,5 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<url platform="x86" os="Windows">https://bitbucket.org/skunkos/rssguard/downloads/rssguard-1.9.9.5-win32.7z</url>
<changes>

View File

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

View File

@ -4,8 +4,28 @@
#include <QObject>
#include <QPointer>
#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 {
Q_OBJECT
@ -38,6 +58,7 @@ class SystemFactory : public QObject {
QString getAutostartDesktopFileLocation();
#endif
QList<UpdateInfo> parseUpdatesFile(const QByteArray &updates_file);
// Access to application-wide close lock.
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 "gui/iconthemefactory.h"
#if !defined(Q_OS_WIN)
#include "gui/messagebox.h"
#endif

View File

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

View File

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

View File

@ -61,6 +61,7 @@
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="m_actionCheckForUpdates"/>
<addaction name="m_actionAboutGuard"/>
</widget>
<widget class="QMenu" name="m_menuView">
@ -519,6 +520,14 @@
<string>Select previous message</string>
</property>
</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>
<customwidgets>
<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)
: QDialog(parent), m_ui(new Ui::FormUpdate) {
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;
}
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
public:
// Constructors and destructors.
explicit FormUpdate(QWidget *parent = 0);
virtual ~FormUpdate();
protected:
void checkForUpdates();
private:
Ui::FormUpdate *m_ui;
};

View File

@ -1,42 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>FormUpdate</class>
<widget name="FormUpdate" class="QDialog">
<widget class="QDialog" name="FormUpdate">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>226</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget name="buttonBox" class="QDialogButtonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Current release</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_lblCurrentRelease">
<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>
<pixmapfunction/>
<customwidgets>
<customwidget>
<class>ComboBoxWithStatus</class>
<extends>QWidget</extends>
<header>comboboxwithstatus.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<sender>m_buttonBox</sender>
<signal>accepted()</signal>
<receiver>FormUpdate</receiver>
<slot>accept()</slot>
@ -52,7 +108,7 @@
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<sender>m_buttonBox</sender>
<signal>rejected()</signal>
<receiver>FormUpdate</receiver>
<slot>reject()</slot>