Skip to content

Commit d26cec1

Browse files
committed
Finish with signal settings, Fix GUI for alarms on finish
1 parent 16b61e3 commit d26cec1

22 files changed

+374
-101
lines changed

SmartTimer/SmartTimer.pro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ SOURCES += \
3838
addalarmdialog.cpp \
3939
changealarmdialog.cpp \
4040
globalsettingsdialog.cpp \
41-
rangewidget.cpp
41+
rangewidget.cpp \
42+
widgetsettings.cpp
4243

4344
HEADERS += \
4445
mainwindow.h \

SmartTimer/addalarmdialog.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "addalarmdialog.h"
22
#include "ui_addalarmdialog.h"
3+
#include "widgetsettings.h"
34

45
#include <QFile>
56

@@ -15,6 +16,8 @@ addAlarmDialog::addAlarmDialog(QWidget *parent) :
1516
{
1617
ui->setupUi(this);
1718

19+
addSounds(ui->SoundBox);
20+
1821
QFile file(":/stylesheet.qss");
1922
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
2023
{
@@ -39,6 +42,6 @@ void addAlarmDialog::updateWidget(GlobalSettings _globalSettings)
3942

4043
void addAlarmDialog::sendData()
4144
{
42-
emit sendAlarmData(WidgetSettings(getMsecs(ui->alarmTime->time()),ui->alarmName->text(),true));
45+
emit sendAlarmData(WidgetSettings(getMsecs(ui->alarmTime->time()),ui->alarmName->text(),true,ui->SoundBox->itemData(ui->SoundBox->currentIndex()).toString()));
4346
this->close();
4447
}

SmartTimer/addalarmdialog.ui

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,67 @@
161161
</item>
162162
</layout>
163163
</item>
164+
<item>
165+
<layout class="QHBoxLayout" name="horizontalLayout_4">
166+
<item>
167+
<widget class="QLabel" name="label_3">
168+
<property name="text">
169+
<string>Sound</string>
170+
</property>
171+
</widget>
172+
</item>
173+
<item>
174+
<spacer name="horizontalSpacer_3">
175+
<property name="orientation">
176+
<enum>Qt::Horizontal</enum>
177+
</property>
178+
<property name="sizeHint" stdset="0">
179+
<size>
180+
<width>40</width>
181+
<height>20</height>
182+
</size>
183+
</property>
184+
</spacer>
185+
</item>
186+
<item>
187+
<widget class="QComboBox" name="SoundBox">
188+
<property name="minimumSize">
189+
<size>
190+
<width>260</width>
191+
<height>50</height>
192+
</size>
193+
</property>
194+
<property name="maximumSize">
195+
<size>
196+
<width>260</width>
197+
<height>16777215</height>
198+
</size>
199+
</property>
200+
<property name="cursor">
201+
<cursorShape>ArrowCursor</cursorShape>
202+
</property>
203+
<property name="currentText">
204+
<string>Standard alarm</string>
205+
</property>
206+
<item>
207+
<property name="text">
208+
<string>Standard alarm</string>
209+
</property>
210+
</item>
211+
<item>
212+
<property name="text">
213+
<string>Sound2</string>
214+
</property>
215+
</item>
216+
<item>
217+
<property name="text">
218+
<string>Sound3</string>
219+
</property>
220+
</item>
221+
</widget>
222+
</item>
223+
</layout>
224+
</item>
164225
<item>
165226
<layout class="QHBoxLayout" name="horizontalLayout">
166227
<item>

SmartTimer/addtimerdialog.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "addtimerdialog.h"
22
#include "ui_addtimerdialog.h"
3+
#include "widgetsettings.h"
34

45
#include <QFile>
56

@@ -17,6 +18,8 @@ addTimerDialog::addTimerDialog(QWidget *parent) :
1718
}
1819

1920

21+
addSounds(ui->SoundBox);
22+
2023

2124
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(close()));
2225
connect(ui->createButton, SIGNAL(clicked()), this, SLOT(returnAndClose()));
@@ -51,7 +54,7 @@ void addTimerDialog::returnAndClose()
5154

5255
QString timerName = ui->timerName->text();
5356

54-
emit this->sendTimerData(WidgetSettings(elpasedTime, timerName));
57+
emit this->sendTimerData(WidgetSettings(elpasedTime, timerName,true, ui->SoundBox->itemData(ui->SoundBox->currentIndex()).toString()));
5558

5659
this->close();
5760
}

SmartTimer/addtimerdialog.ui

Lines changed: 99 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,52 @@
4242
<property name="rightMargin">
4343
<number>4</number>
4444
</property>
45-
<item row="0" column="0">
46-
<layout class="QHBoxLayout" name="horizontalLayout_2">
45+
<item row="3" column="0">
46+
<layout class="QHBoxLayout" name="horizontalLayout">
4747
<item>
48-
<widget class="QLabel" name="label">
48+
<widget class="QPushButton" name="createButton">
49+
<property name="minimumSize">
50+
<size>
51+
<width>0</width>
52+
<height>50</height>
53+
</size>
54+
</property>
55+
<property name="maximumSize">
56+
<size>
57+
<width>16777215</width>
58+
<height>50</height>
59+
</size>
60+
</property>
61+
<property name="text">
62+
<string>Create</string>
63+
</property>
64+
</widget>
65+
</item>
66+
<item>
67+
<widget class="QPushButton" name="cancelButton">
68+
<property name="minimumSize">
69+
<size>
70+
<width>0</width>
71+
<height>50</height>
72+
</size>
73+
</property>
74+
<property name="maximumSize">
75+
<size>
76+
<width>16777215</width>
77+
<height>50</height>
78+
</size>
79+
</property>
80+
<property name="text">
81+
<string>Cancel</string>
82+
</property>
83+
</widget>
84+
</item>
85+
</layout>
86+
</item>
87+
<item row="1" column="0">
88+
<layout class="QHBoxLayout" name="horizontalLayout_3">
89+
<item>
90+
<widget class="QLabel" name="label_2">
4991
<property name="font">
5092
<font>
5193
<pointsize>15</pointsize>
@@ -55,15 +97,15 @@
5597
</font>
5698
</property>
5799
<property name="text">
58-
<string>Interval:</string>
100+
<string>Name:</string>
59101
</property>
60102
</widget>
61103
</item>
62104
<item>
63-
<widget class="QTimeEdit" name="interval">
105+
<widget class="QLineEdit" name="timerName">
64106
<property name="minimumSize">
65107
<size>
66-
<width>250</width>
108+
<width>260</width>
67109
<height>55</height>
68110
</size>
69111
</property>
@@ -75,36 +117,25 @@
75117
</property>
76118
<property name="font">
77119
<font>
78-
<family>12</family>
79-
<pointsize>19</pointsize>
80-
<weight>50</weight>
81-
<italic>false</italic>
82-
<bold>false</bold>
120+
<pointsize>16</pointsize>
121+
<weight>75</weight>
122+
<bold>true</bold>
83123
</font>
84124
</property>
85-
<property name="focusPolicy">
86-
<enum>Qt::StrongFocus</enum>
87-
</property>
88-
<property name="wrapping">
89-
<bool>false</bool>
125+
<property name="maxLength">
126+
<number>25</number>
90127
</property>
91128
<property name="alignment">
92129
<set>Qt::AlignCenter</set>
93130
</property>
94-
<property name="accelerated">
95-
<bool>false</bool>
96-
</property>
97-
<property name="displayFormat">
98-
<string>HH:mm:ss</string>
99-
</property>
100131
</widget>
101132
</item>
102133
</layout>
103134
</item>
104-
<item row="1" column="0">
105-
<layout class="QHBoxLayout" name="horizontalLayout_3">
135+
<item row="0" column="0">
136+
<layout class="QHBoxLayout" name="horizontalLayout_2">
106137
<item>
107-
<widget class="QLabel" name="label_2">
138+
<widget class="QLabel" name="label">
108139
<property name="font">
109140
<font>
110141
<pointsize>15</pointsize>
@@ -114,15 +145,15 @@
114145
</font>
115146
</property>
116147
<property name="text">
117-
<string>Name:</string>
148+
<string>Interval:</string>
118149
</property>
119150
</widget>
120151
</item>
121152
<item>
122-
<widget class="QLineEdit" name="timerName">
153+
<widget class="QTimeEdit" name="interval">
123154
<property name="minimumSize">
124155
<size>
125-
<width>250</width>
156+
<width>260</width>
126157
<height>55</height>
127158
</size>
128159
</property>
@@ -134,58 +165,73 @@
134165
</property>
135166
<property name="font">
136167
<font>
137-
<pointsize>16</pointsize>
138-
<weight>75</weight>
139-
<bold>true</bold>
168+
<family>12</family>
169+
<pointsize>19</pointsize>
170+
<weight>50</weight>
171+
<italic>false</italic>
172+
<bold>false</bold>
140173
</font>
141174
</property>
142-
<property name="maxLength">
143-
<number>25</number>
175+
<property name="focusPolicy">
176+
<enum>Qt::StrongFocus</enum>
177+
</property>
178+
<property name="wrapping">
179+
<bool>false</bool>
144180
</property>
145181
<property name="alignment">
146182
<set>Qt::AlignCenter</set>
147183
</property>
184+
<property name="accelerated">
185+
<bool>false</bool>
186+
</property>
187+
<property name="displayFormat">
188+
<string>HH:mm:ss</string>
189+
</property>
148190
</widget>
149191
</item>
150192
</layout>
151193
</item>
152194
<item row="2" column="0">
153-
<layout class="QHBoxLayout" name="horizontalLayout">
195+
<layout class="QHBoxLayout" name="horizontalLayout_4">
154196
<item>
155-
<widget class="QPushButton" name="createButton">
156-
<property name="minimumSize">
157-
<size>
158-
<width>0</width>
159-
<height>50</height>
160-
</size>
197+
<widget class="QLabel" name="label_3">
198+
<property name="text">
199+
<string>Sound</string>
161200
</property>
162-
<property name="maximumSize">
201+
</widget>
202+
</item>
203+
<item>
204+
<spacer name="horizontalSpacer_3">
205+
<property name="orientation">
206+
<enum>Qt::Horizontal</enum>
207+
</property>
208+
<property name="sizeHint" stdset="0">
163209
<size>
164-
<width>16777215</width>
165-
<height>50</height>
210+
<width>40</width>
211+
<height>20</height>
166212
</size>
167213
</property>
168-
<property name="text">
169-
<string>Create</string>
170-
</property>
171-
</widget>
214+
</spacer>
172215
</item>
173216
<item>
174-
<widget class="QPushButton" name="cancelButton">
217+
<widget class="QComboBox" name="SoundBox">
175218
<property name="minimumSize">
176219
<size>
177-
<width>0</width>
220+
<width>260</width>
178221
<height>50</height>
179222
</size>
180223
</property>
181224
<property name="maximumSize">
182225
<size>
183-
<width>16777215</width>
184-
<height>50</height>
226+
<width>260</width>
227+
<height>16777215</height>
185228
</size>
186229
</property>
187-
<property name="text">
188-
<string>Cancel</string>
230+
<property name="cursor">
231+
<cursorShape>ArrowCursor</cursorShape>
232+
</property>
233+
<property name="currentText">
234+
<string/>
189235
</property>
190236
</widget>
191237
</item>

SmartTimer/alertwidget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ void alertwidget::setAlarm(WidgetSettings settings)
225225

226226
alertTime = QTime::fromMSecsSinceStartOfDay(Settings.msecs);
227227

228+
playlist->clear();
229+
playlist->addMedia(QUrl(Settings.signalPath));
228230

229231
statusChanged(true);
230232

0 commit comments

Comments
 (0)