| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/notifications/toastnotificationsmanager.cpp`/ |
| 2 | |
| 3 | #include "gui/notifications/toastnotificationsmanager.h"cxx . . $ `<file>/src/librssguard/gui/notifications/toastnotificationsmanager.h`/ |
| 4 | |
| 5 | #include "3rd-party/boolinq/boolinq.h"cxx . . $ `<file>/src/librssguard/3rd-party/boolinq/boolinq.h`/ |
| 6 | #include "gui/notifications/articlelistnotification.h"cxx . . $ `<file>/src/librssguard/gui/notifications/articlelistnotification.h`/ |
| 7 | #include "gui/notifications/basetoastnotification.h"cxx . . $ `<file>/src/librssguard/gui/notifications/basetoastnotification.h`/ |
| 8 | #include "gui/notifications/toastnotification.h"cxx . . $ `<file>/src/librssguard/gui/notifications/toastnotification.h`/ |
| 9 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 10 | |
| 11 | #include <QRect> |
| 12 | #include <QScreen> |
| 13 | #include <QWindow> |
| 14 | |
| 15 | QStringcxx . . $ QString# ToastNotificationsManagercxx . . $ ToastNotificationsManager#::textForPositioncxx . . $ ToastNotificationsManager#textForPosition(fae50dc48360ca53).(ToastNotificationsManagercxx . . $ ToastNotificationsManager#::NotificationPositioncxx . . $ ToastNotificationsManager#NotificationPosition# pos) { |
| 16 | switch (pos) { |
| 17 | case TopLeftcxx . . $ ToastNotificationsManager#TopLeft.: |
| 18 | return QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("top-left"); |
| 19 | |
| 20 | case TopRightcxx . . $ ToastNotificationsManager#TopRight.: |
| 21 | return QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("top-right"); |
| 22 | |
| 23 | case BottomLeftcxx . . $ ToastNotificationsManager#BottomLeft.: |
| 24 | return QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("bottom-left"); |
| 25 | |
| 26 | case BottomRightcxx . . $ ToastNotificationsManager#BottomRight.: |
| 27 | default: |
| 28 | return QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("bottom-right"); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | ToastNotificationsManagercxx . . $ ToastNotificationsManager#::ToastNotificationsManagercxx . . $ ToastNotificationsManager#ToastNotificationsManager(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent) |
| 33 | : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent), m_positioncxx . . $ ToastNotificationsManager#m_position.(ToastNotificationsManagercxx . . $ ToastNotificationsManager#::NotificationPositioncxx . . $ ToastNotificationsManager#NotificationPosition#::TopRightcxx . . $ ToastNotificationsManager#TopRight.), m_screencxx . . $ ToastNotificationsManager#m_screen.(0), m_marginscxx . . $ ToastNotificationsManager#m_margins.(0), |
| 34 | m_widthcxx . . $ ToastNotificationsManager#m_width.(0), m_opacitycxx . . $ ToastNotificationsManager#m_opacity.(0.0), m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification.(nullptr) { |
| 35 | resetNotificationscxx . . $ ToastNotificationsManager#resetNotifications(b45ddcbc8423892c).(false); |
| 36 | } |
| 37 | |
| 38 | ToastNotificationsManagercxx . . $ ToastNotificationsManager#::~cxx . . $ ToastNotificationsManager#`~ToastNotificationsManager`(ced63f7c635d850d).ToastNotificationsManagercxx . . $ ToastNotificationsManager#() { |
| 39 | clearcxx . . $ ToastNotificationsManager#clear(b45ddcbc8423892c).(true); |
| 40 | } |
| 41 | |
| 42 | QListcxx . . $ QList#<BaseToastNotificationcxx . . $ BaseToastNotification#*> ToastNotificationsManagercxx . . $ ToastNotificationsManager#::activeNotificationscxx . . $ ToastNotificationsManager#activeNotifications(d4d68b9c133d1334).() const { |
| 43 | return m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications.; |
| 44 | } |
| 45 | |
| 46 | int ToastNotificationsManagercxx . . $ ToastNotificationsManager#::screencxx . . $ ToastNotificationsManager#screen(455f465bc33b4cdf).() const { |
| 47 | return m_screencxx . . $ ToastNotificationsManager#m_screen.; |
| 48 | } |
| 49 | |
| 50 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::setScreencxx . . $ ToastNotificationsManager#setScreen(d4f767463ce0a6b3).(int screen) { |
| 51 | m_screencxx . . $ ToastNotificationsManager#m_screen. = screen; |
| 52 | } |
| 53 | |
| 54 | ToastNotificationsManagercxx . . $ ToastNotificationsManager#::NotificationPositioncxx . . $ ToastNotificationsManager#NotificationPosition# ToastNotificationsManagercxx . . $ ToastNotificationsManager#::positioncxx . . $ ToastNotificationsManager#position(1161e5568e155ec1).() const { |
| 55 | return m_positioncxx . . $ ToastNotificationsManager#m_position.; |
| 56 | } |
| 57 | |
| 58 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::setPositioncxx . . $ ToastNotificationsManager#setPosition(9616ea535f20de44).(NotificationPositioncxx . . $ ToastNotificationsManager#NotificationPosition# position) { |
| 59 | m_positioncxx . . $ ToastNotificationsManager#m_position. = position; |
| 60 | } |
| 61 | |
| 62 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::resetNotificationscxx . . $ ToastNotificationsManager#resetNotifications(b45ddcbc8423892c).(bool reload_existing_notifications) { |
| 63 | m_positioncxx . . $ ToastNotificationsManager#m_position. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).() |
| 64 | ->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(GUI), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(GUI::ToastNotificationsPosition)) |
| 65 | .valuecxx . . $ QVariant#value(1e6269539e51e84a).<ToastNotificationsManagercxx . . $ ToastNotificationsManager#::NotificationPositioncxx . . $ ToastNotificationsManager#NotificationPosition#>(); |
| 66 | m_screencxx . . $ ToastNotificationsManager#m_screen. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(GUI), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(GUI::ToastNotificationsScreen)).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 67 | m_marginscxx . . $ ToastNotificationsManager#m_margins. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(GUI), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(GUI::ToastNotificationsMargin)).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 68 | m_opacitycxx . . $ ToastNotificationsManager#m_opacity. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(GUI), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(GUI::ToastNotificationsOpacity)).toDoublecxx . . $ QVariant#toDouble(1bd8e57dd4a29c14).(); |
| 69 | m_widthcxx . . $ ToastNotificationsManager#m_width. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(GUI), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(GUI::ToastNotificationsWidth)).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 70 | |
| 71 | if (reload_existing_notifications) { |
| 72 | auto notif = m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications.; |
| 73 | |
| 74 | clearcxx . . $ ToastNotificationsManager#clear(b45ddcbc8423892c).(false); |
| 75 | |
| 76 | while (!notif.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 77 | BaseToastNotificationcxx . . $ BaseToastNotification#* one_notif = notif.takeLastcxx . . $ QList#takeLast(5f357b03ed472e5e).(); |
| 78 | |
| 79 | processNotificationcxx . . $ ToastNotificationsManager#processNotification(8310c1ebbd6d7163).(one_notif); |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::clearcxx . . $ ToastNotificationsManager#clear(b45ddcbc8423892c).(bool delete_from_memory) { |
| 85 | for (BaseToastNotificationcxx . . $ BaseToastNotification#* notif : m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications.) { |
| 86 | closeNotificationcxx . . $ ToastNotificationsManager#closeNotification(2a2e788c3715e41f).(notif, delete_from_memory); |
| 87 | } |
| 88 | |
| 89 | m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 90 | } |
| 91 | |
| 92 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::processNotificationcxx . . $ ToastNotificationsManager#processNotification(8310c1ebbd6d7163).(BaseToastNotificationcxx . . $ BaseToastNotification#* notif) { |
| 93 | notif->setWindowOpacitycxx . . $ QWidget#setWindowOpacity(ba8836b59fb42830).(m_opacitycxx . . $ ToastNotificationsManager#m_opacity.); |
| 94 | notif->setFixedWidthcxx . . $ QWidget#setFixedWidth(d4f767463ce0a6b3).(m_widthcxx . . $ ToastNotificationsManager#m_width.); |
| 95 | |
| 96 | notif->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).(); |
| 97 | |
| 98 | auto* screen = moveToProperScreencxx . . $ ToastNotificationsManager#moveToProperScreen(e95988cba52200bb).(notif); |
| 99 | auto notif_new_pos = cornerForNewNotificationcxx . . $ ToastNotificationsManager#cornerForNewNotification(d23603d339d02b93).(screen->availableGeometrycxx . . $ QScreen#availableGeometry(d857385bac04cbf7).()); |
| 100 | |
| 101 | // Make sure notification is finally resized. |
| 102 | notif->adjustSizecxx . . $ QWidget#adjustSize(49f6e7a06ebc5aa8).(); |
| 103 | QCoreApplicationcxx . . $ QCoreApplication#::processEventscxx . . $ QCoreApplication#processEvents(5ce75b802d22674c).(); |
| 104 | |
| 105 | // Move notification, at this point we already need to know its precise size. |
| 106 | moveNotificationToCornercxx . . $ ToastNotificationsManager#moveNotificationToCorner(cebefd8d352d5235).(notif, notif_new_pos); |
| 107 | |
| 108 | // Remove out-of-bounds old notifications and shift existing |
| 109 | // ones to make space for new notifications. |
| 110 | removeOutOfBoundsNotificationscxx . . $ ToastNotificationsManager#removeOutOfBoundsNotifications(d4f767463ce0a6b3).(notif->heightcxx . . $ QWidget#height(455f465bc33b4cdf).()); |
| 111 | makeSpaceForNotificationcxx . . $ ToastNotificationsManager#makeSpaceForNotification(46dd98b1bd92177a).(notif->heightcxx . . $ QWidget#height(455f465bc33b4cdf).()); |
| 112 | |
| 113 | m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..prependcxx . . $ QList#prepend(200d2dc08238a4ed).(notif); |
| 114 | } |
| 115 | |
| 116 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::showNotificationcxx . . $ ToastNotificationsManager#showNotification(db35c252f9762c99).(Notificationcxx . . $ Notification#::Eventcxx . . $ Notification#Event# event, |
| 117 | const GuiMessagecxx . . $ GuiMessage#& msg, |
| 118 | const GuiActioncxx . . $ GuiAction#& action) { |
| 119 | BaseToastNotificationcxx . . $ BaseToastNotification#* notif; |
| 120 | |
| 121 | if (!msg.m_feedFetchResultscxx . . $ GuiMessage#m_feedFetchResults..updatedFeedscxx . . $ FeedDownloadResults#updatedFeeds(d6158a28bfdf01c).().isEmptycxx . . $ QHash#isEmpty(3482b152b9333168).()) { |
| 122 | if (m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification. == nullptr) { |
| 123 | initializeArticleListNotificationcxx . . $ ToastNotificationsManager#initializeArticleListNotification(49f6e7a06ebc5aa8).(); |
| 124 | } |
| 125 | else if (m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..containscxx . . $ QListSpecialMethodsBase#contains(7349e39e0b02d05c).(m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification.)) { |
| 126 | // Article notification is somewhere in list, clear first to move it to first positon. |
| 127 | closeNotificationcxx . . $ ToastNotificationsManager#closeNotification(2a2e788c3715e41f).(m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification., false); |
| 128 | } |
| 129 | |
| 130 | m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification.->loadResultscxx . . $ ArticleListNotification#loadResults(71ebfcbf8d5f12fc).(msg.m_feedFetchResultscxx . . $ GuiMessage#m_feedFetchResults..updatedFeedscxx . . $ FeedDownloadResults#updatedFeeds(d6158a28bfdf01c).()); |
| 131 | |
| 132 | notif = m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification.; |
| 133 | } |
| 134 | else { |
| 135 | notif = new ToastNotificationcxx . . $ ToastNotification#ToastNotification(4f7b9e7a38e48cf0).(event, msg, action, qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->mainFormWidgetcxx . . $ Application#mainFormWidget(9b769eeb00a33a04).()); |
| 136 | hookNotificationcxx . . $ ToastNotificationsManager#hookNotification(8310c1ebbd6d7163).(notif); |
| 137 | } |
| 138 | |
| 139 | processNotificationcxx . . $ ToastNotificationsManager#processNotification(8310c1ebbd6d7163).(notif); |
| 140 | } |
| 141 | |
| 142 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::closeNotificationcxx . . $ ToastNotificationsManager#closeNotification(2a2e788c3715e41f).(BaseToastNotificationcxx . . $ BaseToastNotification#* notif, bool delete_from_memory) { |
| 143 | auto notif_idx = m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..indexOfcxx . . $ QListSpecialMethodsBase#indexOf(284c58bbf0d07092).(notif); |
| 144 | |
| 145 | if (delete_from_memory) { |
| 146 | notif->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 147 | } |
| 148 | else { |
| 149 | notif->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 150 | } |
| 151 | |
| 152 | m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..removeAllcxx . . $ QList#removeAll(5aa96cff9a2299b8).(notif); |
| 153 | |
| 154 | // Shift all notifications. |
| 155 | if (notif_idx < 0) { |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | makeSpaceForNotificationcxx . . $ ToastNotificationsManager#makeSpaceForNotification(46dd98b1bd92177a).(notif->heightcxx . . $ QWidget#height(455f465bc33b4cdf).(), true, notif_idx); |
| 160 | } |
| 161 | |
| 162 | QScreencxx . . $ QScreen#* ToastNotificationsManagercxx . . $ ToastNotificationsManager#::activeScreencxx . . $ ToastNotificationsManager#activeScreen(4337f1790dda8b68).() const { |
| 163 | if (m_screencxx . . $ ToastNotificationsManager#m_screen. >= 0) { |
| 164 | auto all_screens = QGuiApplicationcxx . . $ QGuiApplication#::screenscxx . . $ QGuiApplication#screens(bb28352928341db7).(); |
| 165 | |
| 166 | if (m_screencxx . . $ ToastNotificationsManager#m_screen. < all_screens.sizecxx . . $ QList#size(6b0412d51016192f).()) { |
| 167 | return all_screens.atcxx . . $ QList#at(c7965f769b39929).(m_screencxx . . $ ToastNotificationsManager#m_screen.); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | return QGuiApplicationcxx . . $ QGuiApplication#::primaryScreencxx . . $ QGuiApplication#primaryScreen(ef9790f12f08a894).(); |
| 172 | } |
| 173 | |
| 174 | QPointcxx . . $ QPoint# ToastNotificationsManagercxx . . $ ToastNotificationsManager#::cornerForNewNotificationcxx . . $ ToastNotificationsManager#cornerForNewNotification(d23603d339d02b93).(QRectcxx . . $ QRect# screen_rect) { |
| 175 | switch (m_positioncxx . . $ ToastNotificationsManager#m_position.) { |
| 176 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::TopLeftcxx . . $ ToastNotificationsManager#TopLeft.: |
| 177 | return screen_rect.topLeftcxx . . $ QRect#topLeft(d9aead42ba53cd9b).() +cxx . . $ operator+(c3fbc7b37c9aba6c). QPointcxx . . $ QPoint#QPoint(c0d38f4800714fae).(m_marginscxx . . $ ToastNotificationsManager#m_margins., m_marginscxx . . $ ToastNotificationsManager#m_margins.); |
| 178 | |
| 179 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::TopRightcxx . . $ ToastNotificationsManager#TopRight.: |
| 180 | return screen_rect.topRightcxx . . $ QRect#topRight(d9aead42ba53cd9b).() -cxx . . $ operator-(c3fbc7b37c9aba6c). QPointcxx . . $ QPoint#QPoint(c0d38f4800714fae).(m_marginscxx . . $ ToastNotificationsManager#m_margins., -m_marginscxx . . $ ToastNotificationsManager#m_margins.); |
| 181 | |
| 182 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::BottomLeftcxx . . $ ToastNotificationsManager#BottomLeft.: |
| 183 | return screen_rect.bottomLeftcxx . . $ QRect#bottomLeft(d9aead42ba53cd9b).() -cxx . . $ operator-(c3fbc7b37c9aba6c). QPointcxx . . $ QPoint#QPoint(c0d38f4800714fae).(-m_marginscxx . . $ ToastNotificationsManager#m_margins., m_marginscxx . . $ ToastNotificationsManager#m_margins.); |
| 184 | |
| 185 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::BottomRightcxx . . $ ToastNotificationsManager#BottomRight.: |
| 186 | default: |
| 187 | return screen_rect.bottomRightcxx . . $ QRect#bottomRight(d9aead42ba53cd9b).() -cxx . . $ operator-(c3fbc7b37c9aba6c). QPointcxx . . $ QPoint#QPoint(c0d38f4800714fae).(m_marginscxx . . $ ToastNotificationsManager#m_margins., m_marginscxx . . $ ToastNotificationsManager#m_margins.); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::initializeArticleListNotificationcxx . . $ ToastNotificationsManager#initializeArticleListNotification(49f6e7a06ebc5aa8).() { |
| 192 | m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification. = new ArticleListNotificationcxx . . $ ArticleListNotification#ArticleListNotification(108f35f7aa7f3cf9).(); |
| 193 | hookNotificationcxx . . $ ToastNotificationsManager#hookNotification(8310c1ebbd6d7163).(m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification.); |
| 194 | |
| 195 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification., |
| 196 | &ArticleListNotificationcxx . . $ ArticleListNotification#::openingArticleInArticleListRequestedcxx . . $ ArticleListNotification#openingArticleInArticleListRequested(12e982556975822d)., |
| 197 | this, |
| 198 | &ToastNotificationsManagercxx . . $ ToastNotificationsManager#::openingArticleInArticleListRequestedcxx . . $ ToastNotificationsManager#openingArticleInArticleListRequested(12e982556975822d).); |
| 199 | |
| 200 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification., |
| 201 | &ArticleListNotificationcxx . . $ ArticleListNotification#::reloadMessageListRequestedcxx . . $ ArticleListNotification#reloadMessageListRequested(b45ddcbc8423892c)., |
| 202 | this, |
| 203 | &ToastNotificationsManagercxx . . $ ToastNotificationsManager#::reloadMessageListRequestedcxx . . $ ToastNotificationsManager#reloadMessageListRequested(b45ddcbc8423892c).); |
| 204 | } |
| 205 | |
| 206 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::hookNotificationcxx . . $ ToastNotificationsManager#hookNotification(8310c1ebbd6d7163).(BaseToastNotificationcxx . . $ BaseToastNotification#* notif) { |
| 207 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(notif, &BaseToastNotificationcxx . . $ BaseToastNotification#::closeRequestedcxx . . $ BaseToastNotification#closeRequested(8310c1ebbd6d7163)., this, [this](BaseToastNotificationcxx . . $ BaseToastNotification#* notif) { |
| 208 | closeNotificationcxx . . $ ToastNotificationsManager#closeNotification(2a2e788c3715e41f).(notif, notif != m_articleListNotificationcxx . . $ ToastNotificationsManager#m_articleListNotification.); |
| 209 | }); |
| 210 | } |
| 211 | |
| 212 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::moveNotificationToCornercxx . . $ ToastNotificationsManager#moveNotificationToCorner(cebefd8d352d5235).(BaseToastNotificationcxx . . $ BaseToastNotification#* notif, QPointcxx . . $ QPoint# corner) { |
| 213 | switch (m_positioncxx . . $ ToastNotificationsManager#m_position.) { |
| 214 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::TopLeftcxx . . $ ToastNotificationsManager#TopLeft.: |
| 215 | notif->movecxx . . $ QWidget#move(4f9e9534be445c03).(corner); |
| 216 | break; |
| 217 | |
| 218 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::TopRightcxx . . $ ToastNotificationsManager#TopRight.: |
| 219 | notif->movecxx . . $ QWidget#move(3e454b8ccf442868).(corner.xcxx . . $ QPoint#x(ea6fe5115c70a13f).() - notif->frameGeometrycxx . . $ QWidget#frameGeometry(d857385bac04cbf7).().widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), corner.ycxx . . $ QPoint#y(ea6fe5115c70a13f).()); |
| 220 | break; |
| 221 | |
| 222 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::BottomLeftcxx . . $ ToastNotificationsManager#BottomLeft.: |
| 223 | notif->movecxx . . $ QWidget#move(3e454b8ccf442868).(corner.xcxx . . $ QPoint#x(ea6fe5115c70a13f).(), corner.ycxx . . $ QPoint#y(ea6fe5115c70a13f).() - notif->frameGeometrycxx . . $ QWidget#frameGeometry(d857385bac04cbf7).().heightcxx . . $ QRect#height(ea6fe5115c70a13f).()); |
| 224 | break; |
| 225 | |
| 226 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::BottomRightcxx . . $ ToastNotificationsManager#BottomRight.: |
| 227 | notif->movecxx . . $ QWidget#move(3e454b8ccf442868).(corner.xcxx . . $ QPoint#x(ea6fe5115c70a13f).() - notif->frameGeometrycxx . . $ QWidget#frameGeometry(d857385bac04cbf7).().widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), corner.ycxx . . $ QPoint#y(ea6fe5115c70a13f).() - notif->frameGeometrycxx . . $ QWidget#frameGeometry(d857385bac04cbf7).().heightcxx . . $ QRect#height(ea6fe5115c70a13f).()); |
| 228 | break; |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::makeSpaceForNotificationcxx . . $ ToastNotificationsManager#makeSpaceForNotification(46dd98b1bd92177a).(int height_to_make_space, bool reverse, int stard_idx) { |
| 233 | for (int i = stard_idx; i < m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..sizecxx . . $ QList#size(6b0412d51016192f).(); i++) { |
| 234 | BaseToastNotificationcxx . . $ BaseToastNotification#* notif = m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..atcxx . . $ QList#at(c7965f769b39929).(i); |
| 235 | |
| 236 | switch (m_positioncxx . . $ ToastNotificationsManager#m_position.) { |
| 237 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::TopLeftcxx . . $ ToastNotificationsManager#TopLeft.: |
| 238 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::TopRightcxx . . $ ToastNotificationsManager#TopRight.: { |
| 239 | stdcxx . . $ std/::functioncxx . . $ std/function#<int(int, int)> shift_downcxx . . $ std/function#function(ced63f7c635d850d).; |
| 240 | |
| 241 | if (reverse) { |
| 242 | shift_down =cxx . . $ std/function#`operator=`(842f3727de83eb28). [](int x, int y) { |
| 243 | return x - y; |
| 244 | }; |
| 245 | } |
| 246 | else { |
| 247 | shift_down =cxx . . $ std/function#`operator=`(842f3727de83eb28). [](int x, int y) { |
| 248 | return x + y; |
| 249 | }; |
| 250 | } |
| 251 | |
| 252 | // Move it all down. |
| 253 | notif->movecxx . . $ QWidget#move(3e454b8ccf442868).(notif->poscxx . . $ QWidget#pos(75d69cfbd3c4b2dd).().xcxx . . $ QPoint#x(ea6fe5115c70a13f).(), shift_down(cxx . . $ std/function#`operator()`(39e0826ffb540481).notif->poscxx . . $ QWidget#pos(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(ea6fe5115c70a13f).(), (height_to_make_space + m_marginscxx . . $ ToastNotificationsManager#m_margins.))); |
| 254 | break; |
| 255 | } |
| 256 | |
| 257 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::BottomLeftcxx . . $ ToastNotificationsManager#BottomLeft.: |
| 258 | case ToastNotificationsManagercxx . . $ ToastNotificationsManager#::BottomRightcxx . . $ ToastNotificationsManager#BottomRight.: { |
| 259 | stdcxx . . $ std/::functioncxx . . $ std/function#<int(int, int)> shift_upcxx . . $ std/function#function(ced63f7c635d850d).; |
| 260 | |
| 261 | if (reverse) { |
| 262 | shift_up =cxx . . $ std/function#`operator=`(842f3727de83eb28). [](int x, int y) { |
| 263 | return x + y; |
| 264 | }; |
| 265 | } |
| 266 | else { |
| 267 | shift_up =cxx . . $ std/function#`operator=`(842f3727de83eb28). [](int x, int y) { |
| 268 | return x - y; |
| 269 | }; |
| 270 | } |
| 271 | |
| 272 | // Move it all up. |
| 273 | notif->movecxx . . $ QWidget#move(3e454b8ccf442868).(notif->poscxx . . $ QWidget#pos(75d69cfbd3c4b2dd).().xcxx . . $ QPoint#x(ea6fe5115c70a13f).(), shift_up(cxx . . $ std/function#`operator()`(39e0826ffb540481).notif->poscxx . . $ QWidget#pos(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(ea6fe5115c70a13f).(), height_to_make_space + m_marginscxx . . $ ToastNotificationsManager#m_margins.)); |
| 274 | break; |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | void ToastNotificationsManagercxx . . $ ToastNotificationsManager#::removeOutOfBoundsNotificationscxx . . $ ToastNotificationsManager#removeOutOfBoundsNotifications(d4f767463ce0a6b3).(int height_to_reserve) { |
| 281 | auto* screen = activeScreencxx . . $ ToastNotificationsManager#activeScreen(4337f1790dda8b68).(); |
| 282 | |
| 283 | int available_height = screen->availableSizecxx . . $ QScreen#availableSize(4b3b776e5ee2b367).().heightcxx . . $ QSize#height(ea6fe5115c70a13f).(); |
| 284 | |
| 285 | while (boolinqcxx . . $ boolinq/::fromcxx . . $ boolinq/from(1a44d082b2747720).(m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications.).sumcxx . . $ boolinq/Linq#sum(5f5339430a5d2cc6).([this](BaseToastNotificationcxx . . $ BaseToastNotification#* notif) { |
| 286 | return notif->heightcxx . . $ QWidget#height(455f465bc33b4cdf).() + m_marginscxx . . $ ToastNotificationsManager#m_margins.; |
| 287 | }) + height_to_reserve > |
| 288 | available_height) { |
| 289 | if (!m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 290 | m_activeNotificationscxx . . $ ToastNotificationsManager#m_activeNotifications..takeLastcxx . . $ QList#takeLast(5f357b03ed472e5e).()->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 291 | } |
| 292 | else { |
| 293 | break; |
| 294 | } |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | QScreencxx . . $ QScreen#* ToastNotificationsManagercxx . . $ ToastNotificationsManager#::moveToProperScreencxx . . $ ToastNotificationsManager#moveToProperScreen(e95988cba52200bb).(BaseToastNotificationcxx . . $ BaseToastNotification#* notif) { |
| 299 | if (m_screencxx . . $ ToastNotificationsManager#m_screen. >= 0) { |
| 300 | auto all_screens = QGuiApplicationcxx . . $ QGuiApplication#::screenscxx . . $ QGuiApplication#screens(bb28352928341db7).(); |
| 301 | |
| 302 | if (m_screencxx . . $ ToastNotificationsManager#m_screen. < all_screens.sizecxx . . $ QList#size(6b0412d51016192f).()) { |
| 303 | notif->windowHandlecxx . . $ QWidget#windowHandle(d520c9a5ccf200dd).()->setScreencxx . . $ QWindow#setScreen(484cbc3bdb260bbf).(all_screens.atcxx . . $ QList#at(c7965f769b39929).(m_screencxx . . $ ToastNotificationsManager#m_screen.)); |
| 304 | |
| 305 | return all_screens.atcxx . . $ QList#at(c7965f769b39929).(m_screencxx . . $ ToastNotificationsManager#m_screen.); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | return QGuiApplicationcxx . . $ QGuiApplication#::primaryScreencxx . . $ QGuiApplication#primaryScreen(ef9790f12f08a894).(); |
| 310 | } |