28
28
#include " avcall/avcall.h"
29
29
#include " common.h"
30
30
#include " desktoputil.h"
31
+ #include " eventnotifier.h"
31
32
#include " geolocationdlg.h"
32
33
#include " globalstatusmenu.h"
33
34
#include " mainwin_p.h"
@@ -104,7 +105,7 @@ class MainWin::Private {
104
105
~Private ();
105
106
106
107
bool onTop, asTool;
107
- QMenu * mainMenu, *optionsMenu, *toolsMenu;
108
+ QMenu * mainMenu, *optionsMenu, *toolsMenu;
108
109
GlobalStatusMenu *statusMenu;
109
110
#ifdef Q_OS_LINUX
110
111
// Status menu for MenuBar.
@@ -114,31 +115,31 @@ class MainWin::Private {
114
115
int sbState;
115
116
QString nickname;
116
117
PsiTrayIcon *tray;
117
- QMenu * trayMenu;
118
+ QMenu * trayMenu;
118
119
#ifdef Q_OS_MAC
119
120
QMenu *dockMenu;
120
121
#endif
121
122
QVBoxLayout *vb_roster;
122
- QSplitter * splitter;
123
- TabDlg * mainTabs;
123
+ QSplitter * splitter;
124
+ TabDlg * mainTabs;
124
125
QString statusTip;
125
- PsiToolBar * viewToolBar;
126
+ PsiToolBar * viewToolBar;
126
127
int tabsSize;
127
128
int rosterSize;
128
129
bool isLeftRoster;
129
130
130
- PopupAction * optionsButton, *statusButton;
131
- IconActionGroup * statusGroup, *viewGroups;
132
- IconAction * statusSmallerAlt;
133
- EventNotifierAction *eventNotifier;
134
- PsiCon * psi;
135
- MainWin * mainWin;
136
- RosterAvatarFrame * rosterAvatar;
131
+ PopupAction * optionsButton, *statusButton;
132
+ IconActionGroup * statusGroup, *viewGroups;
133
+ IconAction * statusSmallerAlt;
134
+ EventNotifier *eventNotifier;
135
+ PsiCon * psi;
136
+ MainWin * mainWin;
137
+ RosterAvatarFrame * rosterAvatar;
137
138
QPointer<PsiAccount> defaultAccount;
138
139
139
- QLineEdit * searchText;
140
+ QLineEdit * searchText;
140
141
QToolButton *searchPb;
141
- QWidget * searchWidget;
142
+ QWidget * searchWidget;
142
143
143
144
QTimer *hideTimer;
144
145
@@ -182,7 +183,7 @@ MainWin::Private::Private(PsiCon *_psi, MainWin *_mainWin) :
182
183
183
184
statusGroup = static_cast <IconActionGroup *>(getAction (" status_group" ));
184
185
viewGroups = static_cast <IconActionGroup *>(getAction (" view_groups" ));
185
- eventNotifier = static_cast <EventNotifierAction *>( getAction ( " event_notifier " )) ;
186
+ eventNotifier = nullptr ;
186
187
187
188
optionsButton = static_cast <PopupAction *>(getAction (" button_options" ));
188
189
statusButton = static_cast <PopupAction *>(getAction (" button_status" ));
@@ -514,6 +515,16 @@ MainWin::MainWin(bool _onTop, bool _asTool, PsiCon *psi) :
514
515
buildToolbars ();
515
516
// setUnifiedTitleAndToolBarOnMac(true);
516
517
518
+ d->eventNotifier = new EventNotifier (this , " EventNotifier" );
519
+ d->eventNotifier ->setText (" " );
520
+ d->vb_roster ->addWidget (d->eventNotifier );
521
+ connect (d->eventNotifier , &EventNotifier::clicked, this , [this ](int btn) {
522
+ if (btn == Qt::MiddleButton)
523
+ emit recvNextEvent ();
524
+ if (btn == Qt::LeftButton)
525
+ doRecvNextEvent ();
526
+ });
527
+
517
528
#ifdef Q_OS_WIN
518
529
updateWinTaskbar (_asTool);
519
530
#endif
@@ -578,7 +589,7 @@ void MainWin::registerAction(IconAction *action)
578
589
struct MenuAction {
579
590
const char *name;
580
591
const char *signal;
581
- QObject * receiver;
592
+ QObject * receiver;
582
593
const char *slot;
583
594
};
584
595
std::vector<MenuAction> actionlist = {
@@ -617,9 +628,6 @@ void MainWin::registerAction(IconAction *action)
617
628
{ " set_geoloc" , activated, this , SLOT (actSetGeolocActivated ()) },
618
629
#endif
619
630
620
- { " event_notifier" , SIGNAL (clicked (int )), this , SLOT (statusClicked (int )) },
621
- { " event_notifier" , activated, this , SLOT (doRecvNextEvent ()) },
622
-
623
631
{ " help_readme" , activated, this , SLOT (actReadmeActivated ()) },
624
632
{ " help_online_wiki" , activated, this , SLOT (actOnlineWikiActivated ()) },
625
633
{ " help_online_home" , activated, this , SLOT (actOnlineHomeActivated ()) },
@@ -663,7 +671,7 @@ void MainWin::registerAction(IconAction *action)
663
671
664
672
struct {
665
673
const char *name;
666
- QObject * sender;
674
+ QObject * sender;
667
675
const char *signal;
668
676
const char *slot;
669
677
bool checked;
@@ -873,7 +881,6 @@ void MainWin::buildToolbars()
873
881
tb->updateVisibility ();
874
882
}
875
883
876
- // d->eventNotifier->updateVisibility();
877
884
setUpdatesEnabled (true );
878
885
879
886
// in case we have floating toolbars, they have inherited the 'no updates enabled'
@@ -1057,7 +1064,7 @@ void MainWin::actDiagQCAKeyStoreActivated()
1057
1064
1058
1065
void MainWin::actChooseStatusActivated ()
1059
1066
{
1060
- PsiOptions * o = PsiOptions::instance ();
1067
+ PsiOptions * o = PsiOptions::instance ();
1061
1068
XMPP::Status::Type lastStatus
1062
1069
= XMPP::Status::txt2type (PsiOptions::instance ()->getOption (" options.status.last-status" ).toString ());
1063
1070
StatusSetDlg *w = new StatusSetDlg (d->psi , makeLastStatus (lastStatus), lastPriorityNotEmpty ());
@@ -1649,9 +1656,11 @@ void MainWin::updateReadNext(PsiIcon *anim, int amount)
1649
1656
1650
1657
if (d->nextAmount <= 0 ) {
1651
1658
d->eventNotifier ->hide ();
1652
- d->eventNotifier ->setMessage (" " );
1659
+ d->eventNotifier ->setText (" " );
1660
+ d->eventNotifier ->setPsiIcon (" " );
1653
1661
} else {
1654
- d->eventNotifier ->setMessage (QString (" <b>" ) + numEventsString (d->nextAmount ) + " </b>" );
1662
+ d->eventNotifier ->setPsiIcon (anim);
1663
+ d->eventNotifier ->setText (QString (" <b>" ) + numEventsString (d->nextAmount ) + " </b>" );
1655
1664
d->eventNotifier ->show ();
1656
1665
// make sure it shows
1657
1666
// qApp->processEvents();
@@ -1704,13 +1713,6 @@ void MainWin::updateTray()
1704
1713
1705
1714
void MainWin::doRecvNextEvent () { emit recvNextEvent (); }
1706
1715
1707
- void MainWin::statusClicked (int x)
1708
- {
1709
- if (x == Qt::MiddleButton) {
1710
- emit recvNextEvent ();
1711
- }
1712
- }
1713
-
1714
1716
PsiTrayIcon *MainWin::psiTrayIcon () { return d->tray ; }
1715
1717
1716
1718
void MainWin::numAccountsChanged ()
0 commit comments