From 7b15e568aa0ec6510eb60892a468e684c2f9958f Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Mon, 29 Jun 2015 19:13:06 +0200 Subject: [PATCH] Even better API. --- .../graphics/icons/mini-kfaenza/rssguard.png | Bin 0 -> 5111 bytes src/definitions/definitions.h.in | 2 +- src/gui/feedmessageviewer.cpp | 2 -- src/gui/notifications/notification.cpp | 21 +++++++++++++++--- src/gui/notifications/notification.h | 4 ++++ src/gui/systemtrayicon.cpp | 6 ++--- 6 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 resources/graphics/icons/mini-kfaenza/rssguard.png diff --git a/resources/graphics/icons/mini-kfaenza/rssguard.png b/resources/graphics/icons/mini-kfaenza/rssguard.png new file mode 100644 index 0000000000000000000000000000000000000000..99e3bab2b5640b5d9bf4f5db9f48f5bf0d449a50 GIT binary patch literal 5111 zcmV(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRa4eMv+?RCwCtn`w|8)pf^zx4YjuyG9adB&-p#5L&SW!3ePljIb-%i5ChC0pr9r zc3h50m18@V#3?7KN{Ew+D=s@u74bqDn;@GQZ19FLU_izK1PEDxkc5PmnbBxwG~3(y z-jfgA{rYylMFaLXPt}|Ey8HI+KIi<;de2oN!te8+_vNpA_43ztKl~R93R8=er3Nc}i@I>qqBu~>tf+${FF^m9|=MdI@+JTHO*{8}|XmVMJx|MHbPKk6Mgcxds8 zo)Z`R+2tLl)r`ZO0bvgmNxr=Oq5=|KkH!dqslQbHJGyS{`6N7!#!8a7aBOh9J*Rz- zsn4qr&=tP?ocI8q=Xy2Q%hqr_5GUYP!=GxDijqc25I$H%M`DX4CQ5}brX&TOaEv4I zGmL;^F{nP)1a~O=*p0`ikRkTGDnf+8^)dki?DrN)!8MI-NkLSs?~vn?ka9{|>2tQ! zqu(ZdpC#4snn;uDCOwyRK0Q{OIvw8J)m&P9#|#o_#*}c74db~GZBp}y1$ARmDnTQ` zG#eMagQ@@a=B(?|TI#V>NIo!aj3j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zvpU?3uzq$7or$FH1Y>dr_o4sd(DrYKyAxDmUDr3l>e-X%OumKhR|zBN)kWiLL{xn- zq3*klwaldB#S-HvR2B-=84Bf@z*;NtGpV|q*!w#yX(}lAGZe;W>Z+7TR8)YHno1HO z%A;7FK+0pOBuCZn!^z?+H}zZQ3F5WN+UzJUbN#9-~lUNPvdfluE zyA|A9prCP_Y9e{nz<^l7wo$X^jHTbK6s{T&5LJ25R(D6#+z`W^CWftHr^_5ZG%!P@ z2x}(wqy?9Rlw*S9xmCk6n=a-?OW5$EEgaoK;g|=SsW+d{xa?PdoeBu>0-zd;9$V Z4*)u2PPb-Ab}Ik?002ovPDHLkV1hCX09XJ3 literal 0 HcmV?d00001 diff --git a/src/definitions/definitions.h.in b/src/definitions/definitions.h.in index b5acf1709..aebd05a72 100755 --- a/src/definitions/definitions.h.in +++ b/src/definitions/definitions.h.in @@ -68,7 +68,7 @@ #define INTERNAL_URL_BLANK "about:blank" #define DEFAULT_AUTO_UPDATE_INTERVAL 15 #define AUTO_UPDATE_INTERVAL 60000 -#define STARTUP_UPDATE_DELAY 1500 +#define STARTUP_UPDATE_DELAY 15000 #define TIMEZONE_OFFSET_LIMIT 6 #define CHANGE_EVENT_DELAY 250 #define FLAG_ICON_SUBFOLDER "flags" diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index 8ffb92e9a..41f40369f 100755 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -277,8 +277,6 @@ void FeedMessageViewer::updateMessageButtonsAvailability() { form_main->m_ui->m_actionSwitchImportanceOfSelectedMessages->setEnabled(atleast_one_message_selected); form_main->m_ui->m_actionRestoreSelectedMessagesFromRecycleBin->setEnabled(recycle_bin_selected && atleast_one_message_selected); - - // TODO: To samo udělat s feedy, řešit pouze buttony, které se týkají výběru, ale také vzít v potaz, zda zrovna běží update. } void FeedMessageViewer::updateFeedButtonsAvailability() { diff --git a/src/gui/notifications/notification.cpp b/src/gui/notifications/notification.cpp index a0067e8fb..d51075b19 100644 --- a/src/gui/notifications/notification.cpp +++ b/src/gui/notifications/notification.cpp @@ -35,7 +35,7 @@ Notification::Notification() : QWidget(0), m_title(QString()), m_text(QString()), m_icon(QPixmap()), m_screen(-1), - m_width(-1), m_height(-1), m_padding(5), m_widgetMargin(2 * m_padding) { + m_width(-1), m_height(-1), m_padding(5), m_widgetMargin(2 * m_padding), m_timerId(0) { setupWidget(); loadSettings(); } @@ -49,7 +49,7 @@ bool Notification::areNotificationsActivated() { } void Notification::notify(const QString &text, const QString &title, const QIcon &icon) { - hide(); + cancel(); // Set new values. m_text = text; @@ -60,12 +60,22 @@ void Notification::notify(const QString &text, const QString &title, const QIcon updateGeometries(); repaint(); show(); + + m_timerId = startTimer(10000); } void Notification::notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon) { notify(text, title, MessageBox::iconForStatus((QMessageBox::Icon) icon)); } +void Notification::cancel() { + hide(); + + if (m_timerId != 0) { + killTimer(m_timerId); + } +} + void Notification::updateGeometries() { // Calculate width and height of notification with given icon and text. m_width = m_padding + @@ -159,7 +169,7 @@ void Notification::paintEvent(QPaintEvent *event) { void Notification::mousePressEvent(QMouseEvent *event) { QWidget::mousePressEvent(event); - QTimer::singleShot(0, this, SLOT(hide())); + cancel(); } void Notification::enterEvent(QEvent *event) { @@ -172,6 +182,11 @@ void Notification::leaveEvent(QEvent *event) { repaint(); } +void Notification::timerEvent(QTimerEvent *event) { + QWidget::timerEvent(event); + cancel(); +} + void Notification::loadSettings() { m_position = static_cast(qApp->settings()->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt()); } diff --git a/src/gui/notifications/notification.h b/src/gui/notifications/notification.h index 0390d57c4..2473b99bf 100644 --- a/src/gui/notifications/notification.h +++ b/src/gui/notifications/notification.h @@ -37,11 +37,14 @@ class Notification : public QWidget { void notify(const QString &text, const QString &title, const QIcon &icon); void notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information); + void cancel(); + protected: void paintEvent(QPaintEvent *event); void mousePressEvent(QMouseEvent *event); void enterEvent(QEvent *event); void leaveEvent(QEvent *event); + void timerEvent(QTimerEvent *event); private: void loadSettings(); @@ -61,6 +64,7 @@ class Notification : public QWidget { int m_height; int m_padding; int m_widgetMargin; + int m_timerId; }; #endif // NOTIFICATION_H diff --git a/src/gui/systemtrayicon.cpp b/src/gui/systemtrayicon.cpp index 4bbadd712..63bfc9ea9 100755 --- a/src/gui/systemtrayicon.cpp +++ b/src/gui/systemtrayicon.cpp @@ -37,9 +37,9 @@ TrayIconMenu::~TrayIconMenu() { bool TrayIconMenu::event(QEvent *event) { if (Application::activeModalWidget() != NULL && event->type() == QEvent::Show) { QTimer::singleShot(0, this, SLOT(hide())); - qApp->trayIcon()->showMessage(QSL(APP_LONG_NAME), - tr("Close opened modal dialogs first."), - QSystemTrayIcon::Warning); + qApp->showGuiMessage(QSL(APP_LONG_NAME), + tr("Close opened modal dialogs first."), + QSystemTrayIcon::Warning, qApp->mainForm(), true); } return QMenu::event(event); }