Skip to content

Commit 5577482

Browse files
authored
Merge pull request #3 from secondYearProjects/dev
Finish work with global settings
2 parents 336585d + 3135900 commit 5577482

27 files changed

+1325
-1078
lines changed

SmartTimer/addalarmdialog.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,14 @@ addAlarmDialog::~addAlarmDialog()
3131
delete ui;
3232
}
3333

34+
void addAlarmDialog::updateWidget(GlobalSettings _globalSettings)
35+
{
36+
globalSettings = _globalSettings;
37+
ui->alarmTime->setDisplayFormat(globalSettings.alarmTimeFormat);
38+
}
39+
3440
void addAlarmDialog::sendData()
3541
{
36-
emit sendAlarmData(getMsecs(ui->alarmTime->time()),ui->alarmName->text(),true);
42+
emit sendAlarmData(WidgetSettings(getMsecs(ui->alarmTime->time()),ui->alarmName->text(),true));
3743
this->close();
3844
}

SmartTimer/addalarmdialog.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef ADDALARMDIALOG_H
22
#define ADDALARMDIALOG_H
33

4+
#include "widgetsettings.h"
5+
46
#include <QDialog>
57

68
namespace Ui {
@@ -14,12 +16,15 @@ class addAlarmDialog : public QDialog
1416
public:
1517
explicit addAlarmDialog(QWidget *parent = nullptr);
1618
~addAlarmDialog();
19+
20+
void updateWidget(GlobalSettings _globalSettings);
1721
public slots:
1822
void sendData();
1923
signals:
20-
void sendAlarmData(int,const QString&,bool);
24+
void sendAlarmData(WidgetSettings);
2125
private:
2226
Ui::addAlarmDialog *ui;
27+
GlobalSettings globalSettings;
2328
};
2429

2530
#endif // ADDALARMDIALOG_H

SmartTimer/addalarmdialog.ui

Lines changed: 147 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,22 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>400</width>
10-
<height>250</height>
9+
<width>420</width>
10+
<height>300</height>
1111
</rect>
1212
</property>
13+
<property name="minimumSize">
14+
<size>
15+
<width>420</width>
16+
<height>300</height>
17+
</size>
18+
</property>
19+
<property name="maximumSize">
20+
<size>
21+
<width>420</width>
22+
<height>300</height>
23+
</size>
24+
</property>
1325
<property name="font">
1426
<font>
1527
<pointsize>15</pointsize>
@@ -22,164 +34,167 @@
2234
<iconset resource="resources.qrc">
2335
<normaloff>:/icons/add-icon.png</normaloff>:/icons/add-icon.png</iconset>
2436
</property>
25-
<widget class="QWidget" name="widget" native="true">
26-
<property name="geometry">
27-
<rect>
28-
<x>0</x>
29-
<y>0</y>
30-
<width>400</width>
31-
<height>250</height>
32-
</rect>
33-
</property>
34-
<property name="styleSheet">
35-
<string notr="true"/>
36-
</property>
37-
<layout class="QVBoxLayout" name="verticalLayout_2">
38-
<item>
39-
<layout class="QVBoxLayout" name="verticalLayout">
37+
<layout class="QGridLayout" name="gridLayout">
38+
<item row="0" column="0">
39+
<widget class="QWidget" name="widget" native="true">
40+
<property name="styleSheet">
41+
<string notr="true"/>
42+
</property>
43+
<layout class="QVBoxLayout" name="verticalLayout_2">
4044
<item>
41-
<layout class="QHBoxLayout" name="horizontalLayout_2">
45+
<layout class="QVBoxLayout" name="verticalLayout">
4246
<item>
43-
<widget class="QLabel" name="label">
44-
<property name="font">
45-
<font>
46-
<pointsize>16</pointsize>
47-
<weight>75</weight>
48-
<italic>false</italic>
49-
<bold>true</bold>
50-
</font>
51-
</property>
52-
<property name="text">
53-
<string>Time:</string>
54-
</property>
55-
</widget>
47+
<layout class="QHBoxLayout" name="horizontalLayout_2">
48+
<item>
49+
<widget class="QLabel" name="label">
50+
<property name="font">
51+
<font>
52+
<pointsize>16</pointsize>
53+
<weight>75</weight>
54+
<italic>false</italic>
55+
<bold>true</bold>
56+
</font>
57+
</property>
58+
<property name="text">
59+
<string>Time:</string>
60+
</property>
61+
</widget>
62+
</item>
63+
<item>
64+
<spacer name="horizontalSpacer_2">
65+
<property name="orientation">
66+
<enum>Qt::Horizontal</enum>
67+
</property>
68+
<property name="sizeHint" stdset="0">
69+
<size>
70+
<width>40</width>
71+
<height>20</height>
72+
</size>
73+
</property>
74+
</spacer>
75+
</item>
76+
<item>
77+
<widget class="QTimeEdit" name="alarmTime">
78+
<property name="minimumSize">
79+
<size>
80+
<width>259</width>
81+
<height>55</height>
82+
</size>
83+
</property>
84+
<property name="maximumSize">
85+
<size>
86+
<width>16777215</width>
87+
<height>55</height>
88+
</size>
89+
</property>
90+
<property name="alignment">
91+
<set>Qt::AlignCenter</set>
92+
</property>
93+
<property name="displayFormat">
94+
<string>HH:mm</string>
95+
</property>
96+
<property name="time">
97+
<time>
98+
<hour>0</hour>
99+
<minute>0</minute>
100+
<second>0</second>
101+
</time>
102+
</property>
103+
</widget>
104+
</item>
105+
</layout>
56106
</item>
57107
<item>
58-
<spacer name="horizontalSpacer_2">
59-
<property name="orientation">
60-
<enum>Qt::Horizontal</enum>
61-
</property>
62-
<property name="sizeHint" stdset="0">
63-
<size>
64-
<width>40</width>
65-
<height>20</height>
66-
</size>
67-
</property>
68-
</spacer>
108+
<layout class="QHBoxLayout" name="horizontalLayout_3">
109+
<item>
110+
<widget class="QLabel" name="label_2">
111+
<property name="font">
112+
<font>
113+
<pointsize>16</pointsize>
114+
<weight>75</weight>
115+
<italic>false</italic>
116+
<bold>true</bold>
117+
</font>
118+
</property>
119+
<property name="text">
120+
<string>Name:</string>
121+
</property>
122+
</widget>
123+
</item>
124+
<item>
125+
<spacer name="horizontalSpacer">
126+
<property name="orientation">
127+
<enum>Qt::Horizontal</enum>
128+
</property>
129+
<property name="sizeHint" stdset="0">
130+
<size>
131+
<width>40</width>
132+
<height>20</height>
133+
</size>
134+
</property>
135+
</spacer>
136+
</item>
137+
<item>
138+
<widget class="QLineEdit" name="alarmName">
139+
<property name="minimumSize">
140+
<size>
141+
<width>260</width>
142+
<height>50</height>
143+
</size>
144+
</property>
145+
<property name="font">
146+
<font>
147+
<pointsize>16</pointsize>
148+
<weight>75</weight>
149+
<bold>true</bold>
150+
</font>
151+
</property>
152+
<property name="text">
153+
<string>Alarm</string>
154+
</property>
155+
<property name="alignment">
156+
<set>Qt::AlignCenter</set>
157+
</property>
158+
</widget>
159+
</item>
160+
</layout>
69161
</item>
162+
</layout>
163+
</item>
164+
<item>
165+
<layout class="QHBoxLayout" name="horizontalLayout">
70166
<item>
71-
<widget class="QTimeEdit" name="alarmTime">
167+
<widget class="QPushButton" name="createButton">
72168
<property name="minimumSize">
73169
<size>
74-
<width>259</width>
170+
<width>0</width>
75171
<height>50</height>
76172
</size>
77173
</property>
78-
<property name="alignment">
79-
<set>Qt::AlignCenter</set>
80-
</property>
81-
<property name="displayFormat">
82-
<string>HH:mm</string>
83-
</property>
84-
<property name="time">
85-
<time>
86-
<hour>0</hour>
87-
<minute>0</minute>
88-
<second>0</second>
89-
</time>
90-
</property>
91-
</widget>
92-
</item>
93-
</layout>
94-
</item>
95-
<item>
96-
<layout class="QHBoxLayout" name="horizontalLayout_3">
97-
<item>
98-
<widget class="QLabel" name="label_2">
99-
<property name="font">
100-
<font>
101-
<pointsize>16</pointsize>
102-
<weight>75</weight>
103-
<italic>false</italic>
104-
<bold>true</bold>
105-
</font>
106-
</property>
107174
<property name="text">
108-
<string>Name:</string>
175+
<string>Create</string>
109176
</property>
110177
</widget>
111178
</item>
112179
<item>
113-
<spacer name="horizontalSpacer">
114-
<property name="orientation">
115-
<enum>Qt::Horizontal</enum>
116-
</property>
117-
<property name="sizeHint" stdset="0">
118-
<size>
119-
<width>40</width>
120-
<height>20</height>
121-
</size>
122-
</property>
123-
</spacer>
124-
</item>
125-
<item>
126-
<widget class="QLineEdit" name="alarmName">
180+
<widget class="QPushButton" name="cancelButton">
127181
<property name="minimumSize">
128182
<size>
129-
<width>260</width>
183+
<width>0</width>
130184
<height>50</height>
131185
</size>
132186
</property>
133-
<property name="font">
134-
<font>
135-
<weight>75</weight>
136-
<bold>true</bold>
137-
</font>
138-
</property>
139187
<property name="text">
140-
<string>Alarm</string>
141-
</property>
142-
<property name="alignment">
143-
<set>Qt::AlignCenter</set>
188+
<string>Cancel</string>
144189
</property>
145190
</widget>
146191
</item>
147192
</layout>
148193
</item>
149194
</layout>
150-
</item>
151-
<item>
152-
<layout class="QHBoxLayout" name="horizontalLayout">
153-
<item>
154-
<widget class="QPushButton" name="createButton">
155-
<property name="minimumSize">
156-
<size>
157-
<width>0</width>
158-
<height>50</height>
159-
</size>
160-
</property>
161-
<property name="text">
162-
<string>Create</string>
163-
</property>
164-
</widget>
165-
</item>
166-
<item>
167-
<widget class="QPushButton" name="cancelButton">
168-
<property name="minimumSize">
169-
<size>
170-
<width>0</width>
171-
<height>50</height>
172-
</size>
173-
</property>
174-
<property name="text">
175-
<string>Cancel</string>
176-
</property>
177-
</widget>
178-
</item>
179-
</layout>
180-
</item>
181-
</layout>
182-
</widget>
195+
</widget>
196+
</item>
197+
</layout>
183198
</widget>
184199
<resources>
185200
<include location="resources.qrc"/>

SmartTimer/addtimerdialog.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ addTimerDialog::~addTimerDialog()
3636
delete ui;
3737
}
3838

39+
void addTimerDialog::updateWidget(GlobalSettings _globalSettings)
40+
{
41+
globalSettings = _globalSettings;
42+
43+
ui->interval->setDisplayFormat(globalSettings.timerTimeFormat);
44+
}
45+
3946
void addTimerDialog::returnAndClose()
4047
{
4148
int elpasedTime = ui->interval->time().hour()*3600*1000+
@@ -44,7 +51,7 @@ void addTimerDialog::returnAndClose()
4451

4552
QString timerName = ui->timerName->text();
4653

47-
emit this->sendTimerData(elpasedTime, timerName);
54+
emit this->sendTimerData(WidgetSettings(elpasedTime, timerName));
4855

4956
this->close();
5057
}

0 commit comments

Comments
 (0)