Debian Codegraph @

src/librssguard/gui/notifications/basetoastnotification.cpp

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/notifications/basetoastnotification.cpp`/
2
3 #include "gui/notifications/basetoastnotification.h"cxx . . $ `<file>/src/librssguard/gui/notifications/basetoastnotification.h`/
4
5 #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/
6 #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/
7
8 #include <chrono>
9
10 #include <QAbstractButton>
11 #include <QCloseEvent>
12 #include <QLabel>
13 #include <QTimerEvent>
14
15 using namespace stdcxx . . $ std/::chrono_literals;
16
17 BaseToastNotificationcxx . . $ BaseToastNotification#::BaseToastNotificationcxx . . $ BaseToastNotification#BaseToastNotification(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) : QDialogcxx . . $ QDialog#QDialog(872e7b0c281abd8d).(parent), m_timerIdcxx . . $ BaseToastNotification#m_timerId.(-1) {
18 setAttributecxx . . $ QWidget#setAttribute(52fc7bf162518f7f).(Qtcxx . . $ Qt/::WidgetAttributecxx . . $ Qt/WidgetAttribute#::WA_ShowWithoutActivatingcxx . . $ Qt/WA_ShowWithoutActivating.);
19 setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::FocusPolicycxx . . $ Qt/FocusPolicy#::NoFocuscxx . . $ Qt/NoFocus.);
20 setAttributecxx . . $ QWidget#setAttribute(52fc7bf162518f7f).(Qtcxx . . $ Qt/::WidgetAttributecxx . . $ Qt/WidgetAttribute#::WA_DeleteOnClosecxx . . $ Qt/WA_DeleteOnClose., false);
21
22 setWindowFlagscxx . . $ QWidget#setWindowFlags(f800b5e9bc59e42e).(
23 #if defined(Q_OS_MAC)
24 Qt::WindowType::SubWindow |
25 #else
26 Qtcxx . . $ Qt/::WindowTypecxx . . $ Qt/WindowType#::Toolcxx . . $ Qt/Tool. |cxx . . $ Qt/`operator|`(5a3fd7a290f7a57d).
27 #endif
28 Qtcxx . . $ Qt/::WindowTypecxx . . $ Qt/WindowType#::FramelessWindowHintcxx . . $ Qt/FramelessWindowHint. |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). Qtcxx . . $ Qt/::WindowTypecxx . . $ Qt/WindowType#::WindowStaysOnTopHintcxx . . $ Qt/WindowStaysOnTopHint. |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). Qtcxx . . $ Qt/::WindowTypecxx . . $ Qt/WindowType#::WindowSystemMenuHintcxx . . $ Qt/WindowSystemMenuHint.);
29
30 setStyleSheetcxx . . $ QWidget#setStyleSheet(3520e46b33348bf6).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("BaseToastNotification { border: 1px solid %1; }").argcxx . . $ QString#arg(ad0bca07273edcc2).(palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().windowTextcxx . . $ QPalette#windowText(e14a554c07951b96).().colorcxx . . $ QBrush#color(a1044652a6e0ddd).().namecxx . . $ QColor#name(f2bb36c0a1d70d89).()));
31 installEventFiltercxx . . $ QObject#installEventFilter(749de1b6ae65bddd).(this);
32
33 m_timerClosingClickcxx . . $ BaseToastNotification#m_timerClosingClick..setIntervalcxx . . $ QTimer#setInterval(d4f767463ce0a6b3).(200);
34 m_timerClosingClickcxx . . $ BaseToastNotification#m_timerClosingClick..setSingleShotcxx . . $ QTimer#setSingleShot(b45ddcbc8423892c).(true);
35
36 connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&m_timerClosingClickcxx . . $ BaseToastNotification#m_timerClosingClick., &QTimercxx . . $ QTimer#::timeoutcxx . . $ QTimer#timeout(32604d697c0ceadc)., this, &BaseToastNotificationcxx . . $ BaseToastNotification#::closecxx . . $ QWidget#close(c9857a73d68e59ba).);
37 }
38
39 BaseToastNotificationcxx . . $ BaseToastNotification#::~cxx . . $ BaseToastNotification#`~BaseToastNotification`(ced63f7c635d850d).BaseToastNotificationcxx . . $ BaseToastNotification#() {}
40
41 void BaseToastNotificationcxx . . $ BaseToastNotification#::rejectcxx . . $ BaseToastNotification#reject(49f6e7a06ebc5aa8).() {
42 closecxx . . $ QWidget#close(c9857a73d68e59ba).();
43 }
44
45 void BaseToastNotificationcxx . . $ BaseToastNotification#::setupCloseButtoncxx . . $ BaseToastNotification#setupCloseButton(6f406f547f7da55f).(QAbstractButtoncxx . . $ QAbstractButton#* btn) {
46 btn->setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(trcxx . . $ BaseToastNotification#tr(75d9f1c324b4579d).("Close this notification"));
47 btn->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("dialog-close"), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("gtk-close")));
48
49 connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(btn, &QAbstractButtoncxx . . $ QAbstractButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &BaseToastNotificationcxx . . $ BaseToastNotification#::closecxx . . $ QWidget#close(c9857a73d68e59ba).);
50 }
51
52 void BaseToastNotificationcxx . . $ BaseToastNotification#::setupHeadingcxx . . $ BaseToastNotification#setupHeading(d3201a35e6c48b56).(QLabelcxx . . $ QLabel#* lbl) {
53 auto fon = lblcxx . . $ QFont#QFont(d0a4bd0c8524b912).->fontcxx . . $ QWidget#font(c5040538afc47120).();
54
55 fon.setBoldcxx . . $ QFont#setBold(b45ddcbc8423892c).(true);
56 fon.setPointSizecxx . . $ QFont#setPointSize(d4f767463ce0a6b3).(fon.pointSizecxx . . $ QFont#pointSize(455f465bc33b4cdf).() * 1.2);
57
58 lbl->setFontcxx . . $ QWidget#setFont(d0a4bd0c8524b912).(fon);
59 }
60
61 void BaseToastNotificationcxx . . $ BaseToastNotification#::stopTimedClosingcxx . . $ BaseToastNotification#stopTimedClosing(49f6e7a06ebc5aa8).() {
62 if (m_timerIdcxx . . $ BaseToastNotification#m_timerId. >= 0) {
63 killTimercxx . . $ QObject#killTimer(d4f767463ce0a6b3).(m_timerIdcxx . . $ BaseToastNotification#m_timerId.);
64 m_timerIdcxx . . $ BaseToastNotification#m_timerId. = -1;
65
66 qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NOTIFICATIONScxx . . $ `src/librssguard/definitions/definitions.h:177:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Stopping timed closing for notification.";
67 }
68 }
69
70 void BaseToastNotificationcxx . . $ BaseToastNotification#::setupTimedClosingcxx . . $ BaseToastNotification#setupTimedClosing(b45ddcbc8423892c).(bool want_shorter_timeout) {
71 if (m_timerIdcxx . . $ BaseToastNotification#m_timerId. < 0) {
72 m_timerIdcxx . . $ BaseToastNotification#m_timerId. = startTimercxx . . $ QObject#startTimer(e0024414f6681a3e).(want_shorter_timeoutcxx . . $ std/chrono/duration#duration(a833b3f73e1ac0ab). ? NOTIFICATION_SHORT_TIMEOUTcxx . . $ `src/librssguard/definitions/definitions.h:108:9`! : NOTIFICATIONS_TIMEOUTcxx . . $ `src/librssguard/definitions/definitions.h:107:9`!);
73
74 qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NOTIFICATIONScxx . . $ `src/librssguard/definitions/definitions.h:177:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Starting timed closing for notification.";
75 }
76 }
77
78 bool BaseToastNotificationcxx . . $ BaseToastNotification#::eventFiltercxx . . $ BaseToastNotification#eventFilter(978aa4af1d030efa).(QObjectcxx . . $ QObject#* watched, QEventcxx . . $ QEvent#* event) {
79 if (watched == this && event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::Entercxx . . $ QEvent#Enter.) {
80 qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NOTIFICATIONScxx . . $ `src/librssguard/definitions/definitions.h:177:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Notification got ENTER event.";
81 stopTimedClosingcxx . . $ BaseToastNotification#stopTimedClosing(49f6e7a06ebc5aa8).();
82 }
83
84 if (watched == this && event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::Leavecxx . . $ QEvent#Leave.) {
85 qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NOTIFICATIONScxx . . $ `src/librssguard/definitions/definitions.h:177:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Notification got LEAVE event.";
86 setupTimedClosingcxx . . $ BaseToastNotification#setupTimedClosing(b45ddcbc8423892c).(true);
87 }
88
89 if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::MouseButtonPresscxx . . $ QEvent#MouseButtonPress. || event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::MouseButtonReleasecxx . . $ QEvent#MouseButtonRelease.) {
90 if (dynamic_cast<QMouseEventcxx . . $ QMouseEvent#*>(event)->buttoncxx . . $ QSinglePointEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::MouseButtoncxx . . $ Qt/MouseButton#::RightButtoncxx . . $ Qt/RightButton.) {
91 event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).();
92 QCoreApplicationcxx . . $ QCoreApplication#::processEventscxx . . $ QCoreApplication#processEvents(5ce75b802d22674c).();
93 m_timerClosingClickcxx . . $ BaseToastNotification#m_timerClosingClick..startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).();
94 return true;
95 }
96 }
97
98 return QDialogcxx . . $ QDialog#::eventFiltercxx . . $ QDialog#eventFilter(978aa4af1d030efa).(watched, event);
99 }
100
101 void BaseToastNotificationcxx . . $ BaseToastNotification#::closeEventcxx . . $ BaseToastNotification#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent#* event) {
102 Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(event)
103
104 qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NOTIFICATIONScxx . . $ `src/librssguard/definitions/definitions.h:177:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Notification got CLOSE event.";
105 stopTimedClosingcxx . . $ BaseToastNotification#stopTimedClosing(49f6e7a06ebc5aa8).();
106 emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! closeRequestedcxx . . $ BaseToastNotification#closeRequested(8310c1ebbd6d7163).(this);
107 }
108
109 void BaseToastNotificationcxx . . $ BaseToastNotification#::timerEventcxx . . $ BaseToastNotification#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent#* event) {
110 if (event->timerIdcxx . . $ QTimerEvent#timerId(455f465bc33b4cdf).() == m_timerIdcxx . . $ BaseToastNotification#m_timerId.) {
111 qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NOTIFICATIONScxx . . $ `src/librssguard/definitions/definitions.h:177:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Notification got TIMER event.";
112 stopTimedClosingcxx . . $ BaseToastNotification#stopTimedClosing(49f6e7a06ebc5aa8).();
113 emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! closeRequestedcxx . . $ BaseToastNotification#closeRequested(8310c1ebbd6d7163).(this);
114 }
115 }