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)
2727 return 0 ;
2828}
2929
30+
3031alertwidget::alertwidget (WidgetSettings settings, QWidget *parent) :
3132 QWidget(parent),
3233 ui(new Ui::alertwidget)
@@ -123,11 +124,13 @@ void alertwidget::statusChanged(bool stat)
123124
124125void alertwidget::onTickCheck ()
125126{
127+ if (DDCheck (globalSettings))
128+ player->play ();
126129 std::cout << " !alert!" << std::endl;
127130 alertTick.stop ();
128131 blinkTimer.start (300 );
129132 blinking = true ;
130- player-> play ();
133+
131134 ui->stopButton ->show ();
132135 ui->stopButton ->setEnabled (true );
133136
Original file line number Diff line number Diff line change 11#include " globalsettingsdialog.h"
22#include " ui_globalsettingsdialog.h"
33#include " rangewidget.h"
4+ #include " widgetsettings.h"
45
56#include < QFile>
67#include < QSlider>
78#include < QHBoxLayout>
89
910
10- int elpasedTime (QTime time)
11- {
12- return time.hour ()*3600 *1000 +
13- time.minute ()*60 *1000 +
14- time.second ()*1000 ;
15- }
1611
1712GlobalSettingsDialog::GlobalSettingsDialog (GlobalSettings old, QWidget *parent) :
1813 QDialog(parent),
Original file line number Diff line number Diff line change @@ -135,7 +135,8 @@ void TimerWidget::resetTimer()
135135
136136void TimerWidget::timerExecuted ()
137137{
138- player->play ();
138+ if (DDCheck (globalSettings))
139+ player->play ();
139140 blinkTimer->start (350 );
140141
141142 timer->stop ();
Original file line number Diff line number Diff line change 11#include " widgetsettings.h"
22#include < QLineEdit>
3+ #include < QTime>
34
45void addSounds (QComboBox *soundsCombo)
56{
67 soundsCombo->addItem (" Standard signal" , " qrc:/sounds/sound1.wav" );
78 soundsCombo->addItem (" Bird" , " qrc:/sounds/Bird.mp3" );
89 soundsCombo->addItem (" Light" , " qrc:/sounds/Light.mp3" );
910}
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
4141
4242};
4343
44+ bool DDCheck (GlobalSettings globalSettings);
45+ int elpasedTime (QTime time);
46+
4447#endif // WIDGETSETTINGS_H
You can’t perform that action at this time.
0 commit comments