diff --git a/CMakeLists.txt b/CMakeLists.txt index 23b83f13b..2dae7d9b2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/resources/text/UPDATES b/resources/text/UPDATES index 5fbcc6079..0c61e723a 100644 --- a/resources/text/UPDATES +++ b/resources/text/UPDATES @@ -1,5 +1,22 @@ + + https://bitbucket.org/skunkos/rssguard/downloads/rssguard-1.9.9.5-os2.7z + + +
  • [#] Mac OS X support missing.
  • +
  • [#] Virtual desktop change hides main window.
  • +
  • [#] Misleding external browser settings.
  • +
  • [#] Non-functional external browser shortcuts.
  • +
  • [#] Saving of webbrowser progressbar color.
  • +
  • [~] Usability of some GUI elements.
  • +
  • [@] Completely switched to new website.
  • +
  • [+] Some missing shortcuts.
  • + + ]]> +
    +
    https://bitbucket.org/skunkos/rssguard/downloads/rssguard-1.9.9.5-win32.7z diff --git a/src/core/systemfactory.cpp b/src/core/systemfactory.cpp index 96b34438a..429faeafd 100644 --- a/src/core/systemfactory.cpp +++ b/src/core/systemfactory.cpp @@ -144,3 +144,10 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) { return false; #endif } + +QList SystemFactory::parseUpdatesFile(const QByteArray &updates_file) { + QList updates; + + + return updates; +} diff --git a/src/core/systemfactory.h b/src/core/systemfactory.h index 00e134f7e..a3922683e 100644 --- a/src/core/systemfactory.h +++ b/src/core/systemfactory.h @@ -4,8 +4,28 @@ #include #include #include +#include +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 parseUpdatesFile(const QByteArray &updates_file); // Access to application-wide close lock. inline QMutex *applicationCloseLock() const { diff --git a/src/gui/comboboxwithstatus.cpp b/src/gui/comboboxwithstatus.cpp new file mode 100644 index 000000000..d7bc7243d --- /dev/null +++ b/src/gui/comboboxwithstatus.cpp @@ -0,0 +1,23 @@ +#include "gui/comboboxwithstatus.h" + +#include "gui/plaintoolbutton.h" + +#include + + +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() { + +} diff --git a/src/gui/comboboxwithstatus.h b/src/gui/comboboxwithstatus.h new file mode 100644 index 000000000..7e5363dba --- /dev/null +++ b/src/gui/comboboxwithstatus.h @@ -0,0 +1,21 @@ +#ifndef COMBOBOXWITHSTATUS_H +#define COMBOBOXWITHSTATUS_H + +#include "gui/widgetwithstatus.h" + +#include + +class ComboBoxWithStatus : public WidgetWithStatus { + Q_OBJECT + + public: + // Constructors and destructors. + explicit ComboBoxWithStatus(QWidget *parent = 0); + virtual ~ComboBoxWithStatus(); + + inline QComboBox *comboBox() const { + return static_cast(m_wdgInput); + } +}; + +#endif // COMBOBOXWITHSTATUS_H diff --git a/src/gui/formabout.cpp b/src/gui/formabout.cpp index 68905b0a0..4f61a419b 100644 --- a/src/gui/formabout.cpp +++ b/src/gui/formabout.cpp @@ -2,6 +2,7 @@ #include "core/textfactory.h" #include "gui/iconthemefactory.h" + #if !defined(Q_OS_WIN) #include "gui/messagebox.h" #endif diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index d6c989fca..75323379e 100755 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -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 #include @@ -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 form_pointer = new FormSettings(this); diff --git a/src/gui/formmain.h b/src/gui/formmain.h index 227d5ebd4..29a8f550e 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -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; diff --git a/src/gui/formmain.ui b/src/gui/formmain.ui index d3a2ce037..b475b2e54 100644 --- a/src/gui/formmain.ui +++ b/src/gui/formmain.ui @@ -61,6 +61,7 @@ &Help + @@ -519,6 +520,14 @@ Select previous message + + + Check for updates + + + Check if new application updates are available. + + diff --git a/src/gui/formupdate.cpp b/src/gui/formupdate.cpp index 2233e8e7e..d401fdd5e 100644 --- a/src/gui/formupdate.cpp +++ b/src/gui/formupdate.cpp @@ -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 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 releases_list = SystemFactory::instance()->parseUpdatesFile(releases_xml); + + foreach (const UpdateInfo &release, releases_list) { + m_ui->m_cmbAvailableRelease->comboBox()->addItem(release.m_availableVersion, + release); + } + +} diff --git a/src/gui/formupdate.h b/src/gui/formupdate.h index b8975775c..904d427d6 100644 --- a/src/gui/formupdate.h +++ b/src/gui/formupdate.h @@ -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; }; diff --git a/src/gui/formupdate.ui b/src/gui/formupdate.ui index e1d2cd53e..d809df47f 100644 --- a/src/gui/formupdate.ui +++ b/src/gui/formupdate.ui @@ -1,42 +1,98 @@ + - - - FormUpdate - + 0 0 400 - 300 + 226 Dialog - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Current release + + + + + + + + + + + + + + Available releases + + + + + + + + + + Changes + + + + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style="-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;"><br /></p></body></html> + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + - + + + ComboBoxWithStatus + QWidget +
    comboboxwithstatus.h
    + 1 +
    +
    - buttonBox + m_buttonBox accepted() FormUpdate accept() @@ -52,7 +108,7 @@ - buttonBox + m_buttonBox rejected() FormUpdate reject()