@@ -27,14 +27,21 @@ MainWindow::MainWindow(QWidget *parent) :
2727
2828
2929 logger = new smartTimerLog (this );
30+ alarmsBlinkTimer = new QTimer (this );
31+ timersBlinkTimer = new QTimer (this );
3032
3133 connect (ui->addTimerButton ,SIGNAL (clicked ()),this ,SLOT (addTimer ()));
3234 connect (ui->addAlarmButton ,SIGNAL (clicked ()),this ,SLOT (addAlarm ()));
33- // TODO : here
35+
3436 connect (logger, SIGNAL (createTimer (int ,QString)), this , SLOT (onTimeRecieved (int ,QString)));
3537 connect (logger, SIGNAL (createAlarm (int ,QString,bool )), this , SLOT (onAlarmTimeRecieved (int ,QString,bool )));
3638
3739
40+ connect (alarmsBlinkTimer,SIGNAL (timeout ()),this ,SLOT (alarmsTabBlink ()));
41+ connect (timersBlinkTimer,SIGNAL (timeout ()),this ,SLOT (timersTabBlink ()));
42+
43+
44+
3845 timerScrollWidget = new QWidget;
3946 timerScrollWidget->setLayout (new QVBoxLayout);
4047 timerScrollWidget->setMaximumWidth (400 );
@@ -63,6 +70,7 @@ void MainWindow::addTimer()
6370 auto *addDial = new addTimerDialog ();
6471 connect (addDial,SIGNAL (sendTimerData (int ,QString)),this , SLOT (onTimeRecieved (int ,QString)));
6572
73+
6674 addDial->exec ();
6775}
6876
@@ -82,6 +90,8 @@ void MainWindow::onTimeRecieved(int msecs, const QString& _name)
8290
8391 connect (newTimer, SIGNAL (del (const TimerWidget*)), this , SLOT (remove (const TimerWidget*)));
8492 connect (newTimer, SIGNAL (timerFinished ()), this , SLOT (onTimerFinished ()));
93+ connect (newTimer, SIGNAL (blikInfo (const QString&, bool )), this , SLOT (tabBlinking (const QString&,bool )));
94+
8595
8696 timersList.append (newTimer);
8797}
@@ -118,6 +128,81 @@ void MainWindow::onAlarmTimeRecieved(int msecs, const QString& _name, bool turne
118128 alarmScrollWidget->layout ()->addWidget (newAlarm);
119129
120130 connect (newAlarm, SIGNAL (del (const alertwidget*)), this , SLOT (remove (const alertwidget*)));
131+ connect (newAlarm, SIGNAL (blikInfo (QString, bool )), this , SLOT (tabBlinking (QString,bool )));
132+
121133
122134 alarmsList.append (newAlarm);
123135}
136+
137+ void MainWindow::tabBlinking (const QString &tabName, bool enable)
138+ {
139+ if (enable)
140+ {
141+ if (tabName==" Timers" )
142+ {
143+ timersBlink++;
144+ }
145+ if (tabName==" Alarms" )
146+ {
147+ alarmsBlink++;
148+ }
149+ }
150+ else
151+ {
152+ if (tabName==" Timers" )
153+ {
154+ timersBlink--;
155+ }
156+ if (tabName==" Alarms" )
157+ {
158+ alarmsBlink--;
159+ }
160+ }
161+ if (timersBlink && !timersBlinking)
162+ {
163+ timersBlinkTimer->start (400 );
164+ }
165+ if (alarmsBlink && !alarmsBlinking)
166+ {
167+ alarmsBlinkTimer->start (400 );
168+ }
169+
170+ if (!timersBlink)
171+ {
172+ timersBlinkTimer->stop ();
173+
174+ ui->Timers ->setProperty (" blinky" , false );
175+ this ->style ()->unpolish (ui->Timers );
176+ this ->style ()->polish (ui->Timers );
177+ }
178+
179+ if (!alarmsBlink)
180+ {
181+ alarmsBlinkTimer->stop ();
182+
183+ ui->Alarms ->setProperty (" blinky" , !alarmsBlinky);
184+ this ->style ()->unpolish (ui->Alarms );
185+ this ->style ()->polish (ui->Alarms );
186+
187+ alarmsBlinky = !alarmsBlinky;
188+ }
189+
190+ }
191+
192+ void MainWindow::alarmsTabBlink ()
193+ {
194+ ui->Alarms ->setProperty (" blinky" , !alarmsBlinky);
195+ this ->style ()->unpolish (ui->Alarms );
196+ this ->style ()->polish (ui->Alarms );
197+
198+ alarmsBlinky = !alarmsBlinky;
199+ }
200+
201+ void MainWindow::timersTabBlink ()
202+ {
203+ ui->Timers ->setProperty (" blinky" , !timersBlinky);
204+ this ->style ()->unpolish (ui->Timers );
205+ this ->style ()->polish (ui->Timers );
206+
207+ timersBlinky = !timersBlinky;
208+ }
0 commit comments