File tree Expand file tree Collapse file tree 5 files changed +27
-8
lines changed Expand file tree Collapse file tree 5 files changed +27
-8
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ int calculateDuration(const QTime &t)
27
27
return 0 ;
28
28
}
29
29
30
+
30
31
alertwidget::alertwidget (WidgetSettings settings, QWidget *parent) :
31
32
QWidget(parent),
32
33
ui(new Ui::alertwidget)
@@ -123,11 +124,13 @@ void alertwidget::statusChanged(bool stat)
123
124
124
125
void alertwidget::onTickCheck ()
125
126
{
127
+ if (DDCheck (globalSettings))
128
+ player->play ();
126
129
std::cout << " !alert!" << std::endl;
127
130
alertTick.stop ();
128
131
blinkTimer.start (300 );
129
132
blinking = true ;
130
- player-> play ();
133
+
131
134
ui->stopButton ->show ();
132
135
ui->stopButton ->setEnabled (true );
133
136
Original file line number Diff line number Diff line change 1
1
#include " globalsettingsdialog.h"
2
2
#include " ui_globalsettingsdialog.h"
3
3
#include " rangewidget.h"
4
+ #include " widgetsettings.h"
4
5
5
6
#include < QFile>
6
7
#include < QSlider>
7
8
#include < QHBoxLayout>
8
9
9
10
10
- int elpasedTime (QTime time)
11
- {
12
- return time.hour ()*3600 *1000 +
13
- time.minute ()*60 *1000 +
14
- time.second ()*1000 ;
15
- }
16
11
17
12
GlobalSettingsDialog::GlobalSettingsDialog (GlobalSettings old, QWidget *parent) :
18
13
QDialog(parent),
Original file line number Diff line number Diff line change @@ -135,7 +135,8 @@ void TimerWidget::resetTimer()
135
135
136
136
void TimerWidget::timerExecuted ()
137
137
{
138
- player->play ();
138
+ if (DDCheck (globalSettings))
139
+ player->play ();
139
140
blinkTimer->start (350 );
140
141
141
142
timer->stop ();
Original file line number Diff line number Diff line change 1
1
#include " widgetsettings.h"
2
2
#include < QLineEdit>
3
+ #include < QTime>
3
4
4
5
void addSounds (QComboBox *soundsCombo)
5
6
{
6
7
soundsCombo->addItem (" Standard signal" , " qrc:/sounds/sound1.wav" );
7
8
soundsCombo->addItem (" Bird" , " qrc:/sounds/Bird.mp3" );
8
9
soundsCombo->addItem (" Light" , " qrc:/sounds/Light.mp3" );
9
10
}
11
+
12
+ int elpasedTime (QTime time)
13
+ {
14
+ return time.hour ()*3600 *1000 +
15
+ time.minute ()*60 *1000 +
16
+ time.second ()*1000 ;
17
+ }
18
+
19
+ bool DDCheck (GlobalSettings globalSettings)
20
+ {
21
+ int currTime = elpasedTime (QTime::currentTime ());
22
+ if (currTime>=globalSettings.DDstart && currTime <= globalSettings.DDend )
23
+ return false ;
24
+ else
25
+ return true ;
26
+ }
Original file line number Diff line number Diff line change @@ -41,4 +41,7 @@ struct GlobalSettings
41
41
42
42
};
43
43
44
+ bool DDCheck (GlobalSettings globalSettings);
45
+ int elpasedTime (QTime time);
46
+
44
47
#endif // WIDGETSETTINGS_H
You can’t perform that action at this time.
0 commit comments