Skip to content

Commit fc86ca8

Browse files
authored
Merge pull request #4 from secondYearProjects/dev
Finish all main functions
2 parents 5577482 + ba3afe7 commit fc86ca8

29 files changed

+724
-136
lines changed

SmartTimer/SmartTimer.pro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ SOURCES += \
3737
alertwidget.cpp \
3838
addalarmdialog.cpp \
3939
changealarmdialog.cpp \
40-
globalsettingsdialog.cpp
40+
globalsettingsdialog.cpp \
41+
widgetsettings.cpp
4142

4243
HEADERS += \
4344
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: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@
7777
<widget class="QTimeEdit" name="alarmTime">
7878
<property name="minimumSize">
7979
<size>
80-
<width>259</width>
80+
<width>260</width>
8181
<height>55</height>
8282
</size>
8383
</property>
8484
<property name="maximumSize">
8585
<size>
86-
<width>16777215</width>
86+
<width>260</width>
8787
<height>55</height>
8888
</size>
8989
</property>
@@ -142,6 +142,12 @@
142142
<height>50</height>
143143
</size>
144144
</property>
145+
<property name="maximumSize">
146+
<size>
147+
<width>260</width>
148+
<height>16777215</height>
149+
</size>
150+
</property>
145151
<property name="font">
146152
<font>
147153
<pointsize>16</pointsize>
@@ -161,6 +167,52 @@
161167
</item>
162168
</layout>
163169
</item>
170+
<item>
171+
<layout class="QHBoxLayout" name="horizontalLayout_4">
172+
<item>
173+
<widget class="QLabel" name="label_3">
174+
<property name="text">
175+
<string>Sound</string>
176+
</property>
177+
</widget>
178+
</item>
179+
<item>
180+
<spacer name="horizontalSpacer_3">
181+
<property name="orientation">
182+
<enum>Qt::Horizontal</enum>
183+
</property>
184+
<property name="sizeHint" stdset="0">
185+
<size>
186+
<width>40</width>
187+
<height>20</height>
188+
</size>
189+
</property>
190+
</spacer>
191+
</item>
192+
<item>
193+
<widget class="QComboBox" name="SoundBox">
194+
<property name="minimumSize">
195+
<size>
196+
<width>260</width>
197+
<height>50</height>
198+
</size>
199+
</property>
200+
<property name="maximumSize">
201+
<size>
202+
<width>260</width>
203+
<height>16777215</height>
204+
</size>
205+
</property>
206+
<property name="cursor">
207+
<cursorShape>ArrowCursor</cursorShape>
208+
</property>
209+
<property name="currentText">
210+
<string/>
211+
</property>
212+
</widget>
213+
</item>
214+
</layout>
215+
</item>
164216
<item>
165217
<layout class="QHBoxLayout" name="horizontalLayout">
166218
<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: 101 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -42,60 +42,43 @@
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">
49-
<property name="font">
50-
<font>
51-
<pointsize>15</pointsize>
52-
<weight>75</weight>
53-
<italic>false</italic>
54-
<bold>true</bold>
55-
</font>
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>
5660
</property>
5761
<property name="text">
58-
<string>Interval:</string>
62+
<string>Create</string>
5963
</property>
6064
</widget>
6165
</item>
6266
<item>
63-
<widget class="QTimeEdit" name="interval">
67+
<widget class="QPushButton" name="cancelButton">
6468
<property name="minimumSize">
6569
<size>
66-
<width>250</width>
67-
<height>55</height>
70+
<width>0</width>
71+
<height>50</height>
6872
</size>
6973
</property>
7074
<property name="maximumSize">
7175
<size>
72-
<width>250</width>
73-
<height>55</height>
76+
<width>16777215</width>
77+
<height>50</height>
7478
</size>
7579
</property>
76-
<property name="font">
77-
<font>
78-
<family>12</family>
79-
<pointsize>19</pointsize>
80-
<weight>50</weight>
81-
<italic>false</italic>
82-
<bold>false</bold>
83-
</font>
84-
</property>
85-
<property name="focusPolicy">
86-
<enum>Qt::StrongFocus</enum>
87-
</property>
88-
<property name="wrapping">
89-
<bool>false</bool>
90-
</property>
91-
<property name="alignment">
92-
<set>Qt::AlignCenter</set>
93-
</property>
94-
<property name="accelerated">
95-
<bool>false</bool>
96-
</property>
97-
<property name="displayFormat">
98-
<string>HH:mm:ss</string>
80+
<property name="text">
81+
<string>Cancel</string>
9982
</property>
10083
</widget>
10184
</item>
@@ -122,13 +105,13 @@
122105
<widget class="QLineEdit" name="timerName">
123106
<property name="minimumSize">
124107
<size>
125-
<width>250</width>
108+
<width>260</width>
126109
<height>55</height>
127110
</size>
128111
</property>
129112
<property name="maximumSize">
130113
<size>
131-
<width>250</width>
114+
<width>260</width>
132115
<height>55</height>
133116
</size>
134117
</property>
@@ -149,43 +132,106 @@
149132
</item>
150133
</layout>
151134
</item>
152-
<item row="2" column="0">
153-
<layout class="QHBoxLayout" name="horizontalLayout">
135+
<item row="0" column="0">
136+
<layout class="QHBoxLayout" name="horizontalLayout_2">
154137
<item>
155-
<widget class="QPushButton" name="createButton">
138+
<widget class="QLabel" name="label">
139+
<property name="font">
140+
<font>
141+
<pointsize>15</pointsize>
142+
<weight>75</weight>
143+
<italic>false</italic>
144+
<bold>true</bold>
145+
</font>
146+
</property>
147+
<property name="text">
148+
<string>Interval:</string>
149+
</property>
150+
</widget>
151+
</item>
152+
<item>
153+
<widget class="QTimeEdit" name="interval">
156154
<property name="minimumSize">
157155
<size>
158-
<width>0</width>
159-
<height>50</height>
156+
<width>260</width>
157+
<height>55</height>
160158
</size>
161159
</property>
162160
<property name="maximumSize">
163161
<size>
164-
<width>16777215</width>
165-
<height>50</height>
162+
<width>260</width>
163+
<height>55</height>
166164
</size>
167165
</property>
166+
<property name="font">
167+
<font>
168+
<family>12</family>
169+
<pointsize>19</pointsize>
170+
<weight>50</weight>
171+
<italic>false</italic>
172+
<bold>false</bold>
173+
</font>
174+
</property>
175+
<property name="focusPolicy">
176+
<enum>Qt::StrongFocus</enum>
177+
</property>
178+
<property name="wrapping">
179+
<bool>false</bool>
180+
</property>
181+
<property name="alignment">
182+
<set>Qt::AlignCenter</set>
183+
</property>
184+
<property name="accelerated">
185+
<bool>false</bool>
186+
</property>
187+
<property name="displayFormat">
188+
<string>HH:mm:ss</string>
189+
</property>
190+
</widget>
191+
</item>
192+
</layout>
193+
</item>
194+
<item row="2" column="0">
195+
<layout class="QHBoxLayout" name="horizontalLayout_4">
196+
<item>
197+
<widget class="QLabel" name="label_3">
168198
<property name="text">
169-
<string>Create</string>
199+
<string>Sound</string>
170200
</property>
171201
</widget>
172202
</item>
173203
<item>
174-
<widget class="QPushButton" name="cancelButton">
204+
<spacer name="horizontalSpacer_3">
205+
<property name="orientation">
206+
<enum>Qt::Horizontal</enum>
207+
</property>
208+
<property name="sizeHint" stdset="0">
209+
<size>
210+
<width>40</width>
211+
<height>20</height>
212+
</size>
213+
</property>
214+
</spacer>
215+
</item>
216+
<item>
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>

0 commit comments

Comments
 (0)