|
1 | 1 | #include "alertwidget.h"
|
2 | 2 | #include "ui_alertwidget.h"
|
3 | 3 | #include "changealarmdialog.h"
|
4 |
| - |
| 4 | +#include "widgetsettings.h" |
5 | 5 | #include <iostream>
|
6 | 6 |
|
7 |
| -int getMsecs(const QTime& t) |
8 |
| -{ |
9 |
| - return (t.hour()*3600+t.minute()*60+t.second())*1000+t.msec(); |
10 |
| -} |
11 |
| - |
12 |
| -int calculateDuration(const QTime &t) |
13 |
| -{ |
14 |
| - int alertMsecs = getMsecs(t); |
15 |
| - int currMsecs = getMsecs(QTime::currentTime()); |
16 |
| - |
17 |
| - if (currMsecs > alertMsecs) |
18 |
| - { |
19 |
| - int wholeDay = 3600*24*1000; |
20 |
| - return (wholeDay+alertMsecs-currMsecs); |
21 |
| - } |
22 |
| - if (currMsecs < alertMsecs) |
23 |
| - { |
24 |
| - return (alertMsecs-currMsecs); |
25 |
| - } |
26 |
| - return 0; |
27 |
| -} |
28 | 7 |
|
29 | 8 |
|
30 | 9 | alertwidget::alertwidget(WidgetSettings settings, QWidget *parent) :
|
@@ -70,8 +49,8 @@ alertwidget::alertwidget(WidgetSettings settings, QWidget *parent) :
|
70 | 49 |
|
71 | 50 | if (Settings.enabled)
|
72 | 51 | {
|
73 |
| - std::cout << calculateDuration(alertTime) << " " |
74 |
| - << QTime::currentTime().hour() <<":" << QTime::currentTime().minute() << std::endl; |
| 52 | + //std::cout << calculateDuration(alertTime) << " " |
| 53 | + // << QTime::currentTime().hour() <<":" << QTime::currentTime().minute() << std::endl; |
75 | 54 | alertTick.start(calculateDuration(alertTime));
|
76 | 55 | }
|
77 | 56 |
|
@@ -102,8 +81,8 @@ void alertwidget::statusChanged(bool stat)
|
102 | 81 | if (stat)
|
103 | 82 | {
|
104 | 83 |
|
105 |
| - std::cout << calculateDuration(alertTime) << " " |
106 |
| - << QTime::currentTime().hour() <<":" << QTime::currentTime().minute() << std::endl; |
| 84 | + //std::cout << calculateDuration(alertTime) << " " |
| 85 | + // << QTime::currentTime().hour() <<":" << QTime::currentTime().minute() << std::endl; |
107 | 86 | alertTick.start(calculateDuration(alertTime));
|
108 | 87 | }
|
109 | 88 | else
|
@@ -170,8 +149,8 @@ void alertwidget::stopBlinking()
|
170 | 149 | ui->stopButton->hide();
|
171 | 150 | if (Settings.enabled)
|
172 | 151 | {
|
173 |
| - std::cout << calculateDuration(alertTime) << " " |
174 |
| - << QTime::currentTime().hour() <<":" << QTime::currentTime().minute() << std::endl; |
| 152 | + //std::cout << calculateDuration(alertTime) << " " |
| 153 | + // << QTime::currentTime().hour() <<":" << QTime::currentTime().minute() << std::endl; |
175 | 154 | alertTick.start(calculateDuration(alertTime));
|
176 | 155 | }
|
177 | 156 | }
|
|
0 commit comments