diff --git a/CMakeLists.txt b/CMakeLists.txt index 8359f2706..ec3a5db8a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,8 +65,8 @@ project(rssguard) set(APP_NAME "RSS Guard") set(APP_LOW_NAME "rssguard") -set(APP_VERSION "2.4.1") -set(FILE_VERSION "2,4,1,0") +set(APP_VERSION "2.5.0") +set(FILE_VERSION "2,5,0,0") set(APP_AUTHOR "Martin Rotter") set(APP_URL "http://bitbucket.org/skunkos/rssguard") set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues") diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG index 9d8bcbb1d..7db11c3fc 100644 --- a/resources/text/CHANGELOG +++ b/resources/text/CHANGELOG @@ -1,382 +1,397 @@ -

2.4.1

-Added: - +

2.5.0

+ Added: + -
-

2.4.0

-Added: - +
+

2.4.2

+ Fixed: + -Fixed: - +
+

2.4.1

+ Added: + -
-

2.3.1

-Added: - + Fixed: + -Fixed: - +
+

2.4.0

+ Added: + -
-

2.3.0

+ Fixed: + -Fixed: - +
+

2.3.1

+ Added: + -Added: - + Fixed: + -Changed: - +
+

2.3.0

-
-

2.2.0

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

2.2.0

-
-

2.1.0

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -
-

2.0.0.4

+
+

2.1.0

-Fixed: - + Fixed: + -Added: - + Added: + -Changed: - +
+

2.0.0.4

-
-

2.0.0.3

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

2.0.0.3

-
-

2.0.0.2

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

2.0.0.2

-
-

2.0.0.1

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

2.0.0.1

-
-

2.0.0.0

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

2.0.0.0

-
-

1.9.9.9

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

1.9.9.9

-
-

1.9.9.8

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

1.9.9.8

-
-

1.9.9.7

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

1.9.9.7

-
-

1.9.9.6

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

1.9.9.6

-
-

1.9.9.5

+ Fixed: + -Fixed: - + Added: + -Added: - + Changed: + -Changed: - +
+

1.9.9.5

-
-

1.9.9.4

+ Fixed: + -Added: - + Added: + -Changed: - + Changed: + - +
+

1.9.9.4

+ + Added: + + + Changed: + + + diff --git a/src/gui/dialogs/formmain.cpp b/src/gui/dialogs/formmain.cpp index d6e0761fd..d4d5f21d4 100755 --- a/src/gui/dialogs/formmain.cpp +++ b/src/gui/dialogs/formmain.cpp @@ -80,7 +80,7 @@ FormMain::FormMain(QWidget *parent, Qt::WindowFlags f) // Initialize the web factory. WebFactory::instance()->loadState(); - (new Notification())->notify("abcd abcd abcd abcd abcd abcd \naaa\n\n\nabcd abcd abcd abcd abcd", "def def def def def"); + (new Notification())->notify("abcd abcd abcd abcd abcd abcd \naaa\n\n\nabcd abcd abcd abcd abcd", "def def def def def", qApp->icons()->fromTheme("item-update-all")); } FormMain::~FormMain() { diff --git a/src/gui/dialogs/formmain.ui b/src/gui/dialogs/formmain.ui index bc556eb73..93016d524 100755 --- a/src/gui/dialogs/formmain.ui +++ b/src/gui/dialogs/formmain.ui @@ -6,8 +6,8 @@ 0 0 - 979 - 600 + 1296 + 677 @@ -47,7 +47,7 @@ 0 0 - 979 + 1296 21 diff --git a/src/gui/dialogs/formsettings.cpp b/src/gui/dialogs/formsettings.cpp index 25fe344e0..c125410b4 100755 --- a/src/gui/dialogs/formsettings.cpp +++ b/src/gui/dialogs/formsettings.cpp @@ -706,18 +706,25 @@ void FormSettings::loadInterface() { // Load settings of tray icon. if (SystemTrayIcon::isSystemTrayAvailable()) { - m_ui->m_radioTrayOff->setChecked(!settings->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool()); + m_ui->m_grpTray->setChecked(settings->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool()); } // Tray icon is not supported on this machine. else { - m_ui->m_radioTrayOff->setText(tr("Disable (Tray icon is not available.)")); - m_ui->m_radioTrayOff->setChecked(true); - m_ui->m_grpTray->setDisabled(true); + m_ui->m_grpTray->setTitle(m_ui->m_grpTray->title() + QL1C(' ') + tr("(Tray icon is not available.)")); + m_ui->m_grpTray->setChecked(false); } m_ui->m_checkHidden->setChecked(settings->value(GROUP(GUI), SETTING(GUI::MainWindowStartsHidden)).toBool()); m_ui->m_checkHideWhenMinimized->setChecked(settings->value(GROUP(GUI), SETTING(GUI::HideMainWindowWhenMinimized)).toBool()); + // Load fancy notification settings. + m_ui->m_grpNotifications->setChecked(settings->value(GROUP(GUI), SETTING(GUI::UseFancyNotifications)).toBool()); + m_ui->m_cmbNotificationPosition->addItem(tr("Bottom-left corner"), Qt::BottomLeftCorner); + m_ui->m_cmbNotificationPosition->addItem(tr("Top-left corner"), Qt::TopLeftCorner); + m_ui->m_cmbNotificationPosition->addItem(tr("Bottom-right corner"), Qt::BottomRightCorner); + m_ui->m_cmbNotificationPosition->addItem(tr("Top-right corner"), Qt::TopRightCorner); + m_ui->m_cmbNotificationPosition->setCurrentIndex(m_ui->m_cmbNotificationPosition->findData(static_cast(settings->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt()))); + // Load settings of icon theme. QString current_theme = qApp->icons()->currentIconTheme(); @@ -804,9 +811,9 @@ void FormSettings::saveInterface() { // Save tray icon. if (SystemTrayIcon::isSystemTrayAvailable()) { - settings->setValue(GROUP(GUI), GUI::UseTrayIcon, m_ui->m_radioTrayOn->isChecked()); + settings->setValue(GROUP(GUI), GUI::UseTrayIcon, m_ui->m_grpTray->isChecked()); - if (m_ui->m_radioTrayOn->isChecked()) { + if (m_ui->m_grpTray->isChecked()) { qApp->showTrayIcon(); } else { @@ -817,6 +824,10 @@ void FormSettings::saveInterface() { settings->setValue(GROUP(GUI), GUI::MainWindowStartsHidden, m_ui->m_checkHidden->isChecked()); settings->setValue(GROUP(GUI), GUI::HideMainWindowWhenMinimized, m_ui->m_checkHideWhenMinimized->isChecked()); + // Save notifications. + settings->setValue(GROUP(GUI), GUI::UseFancyNotifications, m_ui->m_grpNotifications->isChecked()); + settings->setValue(GROUP(GUI), GUI::FancyNotificationsPosition, static_cast(m_ui->m_cmbNotificationPosition->itemData(m_ui->m_cmbNotificationPosition->currentIndex()).toInt())); + // Save selected icon theme. QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString(); QString original_icon_theme = qApp->icons()->currentIconTheme(); diff --git a/src/gui/dialogs/formsettings.ui b/src/gui/dialogs/formsettings.ui index a523793da..80a2afef6 100755 --- a/src/gui/dialogs/formsettings.ui +++ b/src/gui/dialogs/formsettings.ui @@ -6,7 +6,7 @@ 0 0 - 990 + 1032 498 @@ -88,7 +88,7 @@ - 0 + 3 @@ -419,8 +419,8 @@ MySQL backend will automatically use database with name "rssguard". Do 0 0 - 740 - 451 + 100 + 30 @@ -465,7 +465,7 @@ MySQL backend will automatically use database with name "rssguard". Do QTabWidget::North - 0 + 1 @@ -497,8 +497,8 @@ MySQL backend will automatically use database with name "rssguard". Do 0 0 - 734 - 425 + 208 + 238 @@ -608,46 +608,54 @@ MySQL backend will automatically use database with name "rssguard". Do Tray area && notifications - + Tray icon + + true + QFormLayout::ExpandingFieldsGrow - - - - Disable - - - - + Hide main window when it is minimized - + Start application hidden - - + + + + + + + Fancy && modern popup notifications + + + true + + + + - Enable - - - true + Notification position + + + @@ -1564,10 +1572,8 @@ MySQL backend will automatically use database with name "rssguard". Do m_scrollIconSkins m_cmbIconTheme m_treeSkins - m_radioTrayOff m_checkHideWhenMinimized m_checkHidden - m_radioTrayOn m_checkNewTabDoubleClick m_hideTabBarIfOneTabVisible m_checkCloseTabsDoubleClick @@ -1642,22 +1648,6 @@ MySQL backend will automatically use database with name "rssguard". Do - - m_radioTrayOn - toggled(bool) - m_checkHidden - setEnabled(bool) - - - 508 - 102 - - - 508 - 151 - - - m_checkAutoUpdate toggled(bool) @@ -1674,22 +1664,6 @@ MySQL backend will automatically use database with name "rssguard". Do - - m_radioTrayOn - toggled(bool) - m_checkHideWhenMinimized - setEnabled(bool) - - - 515 - 94 - - - 357 - 117 - - - m_checkMessagesDateTimeFormat toggled(bool) @@ -1722,5 +1696,37 @@ MySQL backend will automatically use database with name "rssguard". Do + + m_grpNotifications + toggled(bool) + m_lblNotificationPosition + setEnabled(bool) + + + 625 + 77 + + + 326 + 84 + + + + + m_grpNotifications + toggled(bool) + m_cmbNotificationPosition + setEnabled(bool) + + + 625 + 77 + + + 696 + 84 + + + diff --git a/src/gui/notifications/notification.cpp b/src/gui/notifications/notification.cpp index 9684f9813..e130e501d 100644 --- a/src/gui/notifications/notification.cpp +++ b/src/gui/notifications/notification.cpp @@ -19,6 +19,9 @@ #include "gui/messagebox.h" #include "definitions/definitions.h" +#include "miscellaneous/application.h" +#include "miscellaneous/settings.h" +#include "miscellaneous/textfactory.h" #include #include @@ -40,6 +43,10 @@ Notification::Notification() : QWidget(0), m_title(QString()), m_text(QString()) Notification::~Notification() { } +bool Notification::areNotificationsActivated() { + return qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseFancyNotifications)).toBool(); +} + void Notification::notify(const QString &text, const QString &title, const QIcon &icon) { hide(); @@ -61,12 +68,13 @@ void Notification::notify(const QString &text, const QString &title, QSystemTray void Notification::updateGeometries() { // Calculate width and height of notification with given icon and text. m_width = m_padding + - m_icon.width() + m_padding + /* contents */ qMax(stringWidth(m_title), stringWidth(m_text)) + + m_icon.width() + m_padding + /* contents */ qMax(TextFactory::stringWidth(m_title, fontMetrics()), + TextFactory::stringWidth(m_text, fontMetrics())) + m_padding; m_height = m_padding + /* contents */ qMax(m_icon.height(), - stringHeight(m_title) + m_padding + stringHeight(m_text)) + + TextFactory::stringHeight(m_title, fontMetrics()) + m_padding + TextFactory::stringHeight(m_text, fontMetrics())) + m_padding; // Calculate real position. @@ -130,7 +138,7 @@ void Notification::paintEvent(QPaintEvent *event) { painter.setPen(Qt::black); // Needed heighs/widths. - int title_height = stringHeight(m_title); + int title_height = TextFactory::stringHeight(m_title, fontMetrics()); int remaining_width = width() - m_padding - m_icon.width() - m_padding /* - here comes contents */ - m_padding; int remaining_height = height() - m_padding - title_height - m_padding /* - here comes contents */ - m_padding; @@ -163,29 +171,8 @@ void Notification::leaveEvent(QEvent *event) { repaint(); } -int Notification::stringHeight(const QString &string) { - int count_lines = string.split(QL1C('\n')).size(); - return fontMetrics().height() * count_lines; -} - -int Notification::stringWidth(const QString &string) { - QStringList lines = string.split(QL1C('\n')); - int width = 0; - - foreach (const QString &line, lines) { - int line_width = fontMetrics().width(line); - - if (line_width > width) { - width = line_width; - } - } - - return width; -} - void Notification::loadSettings() { - // TODO: načist z nastaveni. - m_position = Qt::BottomRightCorner; + m_position = static_cast(qApp->settings()->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt()); } void Notification::setupWidget() { @@ -220,11 +207,4 @@ void Notification::setupWidget() { // Window will be meant to be on top, but should not steal focus. setFocusPolicy(Qt::NoFocus); - - // TODO: pokracovat - // https://github.com/binaryking/QNotify/blob/master/QNotify.cpp - // http://stackoverflow.com/questions/5823700/notification-window-in-mac-with-or-without-qt - // quiterss - // a odkazy z issue - // promyslet esli tam dat jen ciste label a ikonu, nebo i seznam nejnovesich zprav atp. } diff --git a/src/gui/notifications/notification.h b/src/gui/notifications/notification.h index ae01b2215..c10adf196 100644 --- a/src/gui/notifications/notification.h +++ b/src/gui/notifications/notification.h @@ -31,6 +31,8 @@ class Notification : public QWidget { explicit Notification(); virtual ~Notification(); + inline static bool areNotificationsActivated(); + public slots: void notify(const QString &text, const QString &title, const QIcon &icon); void notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information); @@ -42,9 +44,6 @@ class Notification : public QWidget { void leaveEvent(QEvent *event); private: - int stringHeight(const QString &string); - int stringWidth(const QString &string); - void loadSettings(); void setupWidget(); void updateGeometries(); diff --git a/src/miscellaneous/settings.cpp b/src/miscellaneous/settings.cpp index 0a3fbeb3f..b9ae4c484 100755 --- a/src/miscellaneous/settings.cpp +++ b/src/miscellaneous/settings.cpp @@ -105,6 +105,12 @@ DVALUE(bool) GUI::HideMainWindowWhenMinimizedDef = false; DKEY GUI::UseTrayIcon = "use_tray_icon"; DVALUE(bool) GUI::UseTrayIconDef = true; +DKEY GUI::UseFancyNotifications = "use_fancy_notifications"; +DVALUE(bool) GUI::UseFancyNotificationsDef = true; + +DKEY GUI::FancyNotificationsPosition = "fancy_notifications_position"; +DVALUE(Qt::Corner) GUI::FancyNotificationsPositionDef = Qt::BottomRightCorner; + DKEY GUI::TabCloseMiddleClick = "tab_close_mid_button"; DVALUE(bool) GUI::TabCloseMiddleClickDef = true; diff --git a/src/miscellaneous/settings.h b/src/miscellaneous/settings.h index f2a7ec6b9..021f0ab13 100755 --- a/src/miscellaneous/settings.h +++ b/src/miscellaneous/settings.h @@ -117,6 +117,12 @@ namespace GUI { KEY UseTrayIcon; VALUE(bool) UseTrayIconDef; + KEY UseFancyNotifications; + VALUE(bool) UseFancyNotificationsDef; + + KEY FancyNotificationsPosition; + VALUE(Qt::Corner) FancyNotificationsPositionDef; + KEY TabCloseMiddleClick; VALUE(bool) TabCloseMiddleClickDef; diff --git a/src/miscellaneous/textfactory.cpp b/src/miscellaneous/textfactory.cpp index a6289e7ae..02fdcfc3f 100755 --- a/src/miscellaneous/textfactory.cpp +++ b/src/miscellaneous/textfactory.cpp @@ -27,6 +27,26 @@ TextFactory::TextFactory() { } +int TextFactory::stringHeight(const QString &string, const QFontMetrics &metrics) { + int count_lines = string.split(QL1C('\n')).size(); + return metrics.height() * count_lines; +} + +int TextFactory::stringWidth(const QString &string, const QFontMetrics &metrics) { + QStringList lines = string.split(QL1C('\n')); + int width = 0; + + foreach (const QString &line, lines) { + int line_width = metrics.width(line); + + if (line_width > width) { + width = line_width; + } + } + + return width; +} + QDateTime TextFactory::parseDateTime(const QString &date_time) { QString input_date = date_time.simplified(); QDateTime dt; diff --git a/src/miscellaneous/textfactory.h b/src/miscellaneous/textfactory.h index 6458d53ae..47b231aa6 100644 --- a/src/miscellaneous/textfactory.h +++ b/src/miscellaneous/textfactory.h @@ -21,6 +21,7 @@ #include "definitions/definitions.h" #include +#include class TextFactory { @@ -34,6 +35,9 @@ class TextFactory { return lhs.toLower() < rhs.toLower(); } + static int stringHeight(const QString &string, const QFontMetrics &metrics); + static int stringWidth(const QString &string, const QFontMetrics &metrics); + // Tries to parse input textual date/time representation. // Returns invalid date/time if processing fails. // NOTE: This method tries to always return time in UTC+00:00.