mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-19 04:12:01 +01:00
Even better API.
This commit is contained in:
parent
598a83b7cb
commit
7b15e568aa
BIN
resources/graphics/icons/mini-kfaenza/rssguard.png
Normal file
BIN
resources/graphics/icons/mini-kfaenza/rssguard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
@ -68,7 +68,7 @@
|
|||||||
#define INTERNAL_URL_BLANK "about:blank"
|
#define INTERNAL_URL_BLANK "about:blank"
|
||||||
#define DEFAULT_AUTO_UPDATE_INTERVAL 15
|
#define DEFAULT_AUTO_UPDATE_INTERVAL 15
|
||||||
#define AUTO_UPDATE_INTERVAL 60000
|
#define AUTO_UPDATE_INTERVAL 60000
|
||||||
#define STARTUP_UPDATE_DELAY 1500
|
#define STARTUP_UPDATE_DELAY 15000
|
||||||
#define TIMEZONE_OFFSET_LIMIT 6
|
#define TIMEZONE_OFFSET_LIMIT 6
|
||||||
#define CHANGE_EVENT_DELAY 250
|
#define CHANGE_EVENT_DELAY 250
|
||||||
#define FLAG_ICON_SUBFOLDER "flags"
|
#define FLAG_ICON_SUBFOLDER "flags"
|
||||||
|
@ -277,8 +277,6 @@ void FeedMessageViewer::updateMessageButtonsAvailability() {
|
|||||||
form_main->m_ui->m_actionSwitchImportanceOfSelectedMessages->setEnabled(atleast_one_message_selected);
|
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);
|
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() {
|
void FeedMessageViewer::updateFeedButtonsAvailability() {
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Notification::Notification() : QWidget(0), m_title(QString()), m_text(QString()), m_icon(QPixmap()), m_screen(-1),
|
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();
|
setupWidget();
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ bool Notification::areNotificationsActivated() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Notification::notify(const QString &text, const QString &title, const QIcon &icon) {
|
void Notification::notify(const QString &text, const QString &title, const QIcon &icon) {
|
||||||
hide();
|
cancel();
|
||||||
|
|
||||||
// Set new values.
|
// Set new values.
|
||||||
m_text = text;
|
m_text = text;
|
||||||
@ -60,12 +60,22 @@ void Notification::notify(const QString &text, const QString &title, const QIcon
|
|||||||
updateGeometries();
|
updateGeometries();
|
||||||
repaint();
|
repaint();
|
||||||
show();
|
show();
|
||||||
|
|
||||||
|
m_timerId = startTimer(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notification::notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon) {
|
void Notification::notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon) {
|
||||||
notify(text, title, MessageBox::iconForStatus((QMessageBox::Icon) icon));
|
notify(text, title, MessageBox::iconForStatus((QMessageBox::Icon) icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Notification::cancel() {
|
||||||
|
hide();
|
||||||
|
|
||||||
|
if (m_timerId != 0) {
|
||||||
|
killTimer(m_timerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Notification::updateGeometries() {
|
void Notification::updateGeometries() {
|
||||||
// Calculate width and height of notification with given icon and text.
|
// Calculate width and height of notification with given icon and text.
|
||||||
m_width = m_padding +
|
m_width = m_padding +
|
||||||
@ -159,7 +169,7 @@ void Notification::paintEvent(QPaintEvent *event) {
|
|||||||
|
|
||||||
void Notification::mousePressEvent(QMouseEvent *event) {
|
void Notification::mousePressEvent(QMouseEvent *event) {
|
||||||
QWidget::mousePressEvent(event);
|
QWidget::mousePressEvent(event);
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notification::enterEvent(QEvent *event) {
|
void Notification::enterEvent(QEvent *event) {
|
||||||
@ -172,6 +182,11 @@ void Notification::leaveEvent(QEvent *event) {
|
|||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Notification::timerEvent(QTimerEvent *event) {
|
||||||
|
QWidget::timerEvent(event);
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
|
||||||
void Notification::loadSettings() {
|
void Notification::loadSettings() {
|
||||||
m_position = static_cast<Qt::Corner>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt());
|
m_position = static_cast<Qt::Corner>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt());
|
||||||
}
|
}
|
||||||
|
@ -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, const QIcon &icon);
|
||||||
void notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information);
|
void notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information);
|
||||||
|
|
||||||
|
void cancel();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void enterEvent(QEvent *event);
|
void enterEvent(QEvent *event);
|
||||||
void leaveEvent(QEvent *event);
|
void leaveEvent(QEvent *event);
|
||||||
|
void timerEvent(QTimerEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
@ -61,6 +64,7 @@ class Notification : public QWidget {
|
|||||||
int m_height;
|
int m_height;
|
||||||
int m_padding;
|
int m_padding;
|
||||||
int m_widgetMargin;
|
int m_widgetMargin;
|
||||||
|
int m_timerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NOTIFICATION_H
|
#endif // NOTIFICATION_H
|
||||||
|
@ -37,9 +37,9 @@ TrayIconMenu::~TrayIconMenu() {
|
|||||||
bool TrayIconMenu::event(QEvent *event) {
|
bool TrayIconMenu::event(QEvent *event) {
|
||||||
if (Application::activeModalWidget() != NULL && event->type() == QEvent::Show) {
|
if (Application::activeModalWidget() != NULL && event->type() == QEvent::Show) {
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
qApp->trayIcon()->showMessage(QSL(APP_LONG_NAME),
|
qApp->showGuiMessage(QSL(APP_LONG_NAME),
|
||||||
tr("Close opened modal dialogs first."),
|
tr("Close opened modal dialogs first."),
|
||||||
QSystemTrayIcon::Warning);
|
QSystemTrayIcon::Warning, qApp->mainForm(), true);
|
||||||
}
|
}
|
||||||
return QMenu::event(event);
|
return QMenu::event(event);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user