Skip to content

Commit bbc1081

Browse files
committed
Add default settings, fix padding, get rid of double slider
1 parent 1b8d833 commit bbc1081

11 files changed

+88
-349
lines changed

SmartTimer/SmartTimer.pro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ SOURCES += \
3838
addalarmdialog.cpp \
3939
changealarmdialog.cpp \
4040
globalsettingsdialog.cpp \
41-
rangewidget.cpp \
4241
widgetsettings.cpp
4342

4443
HEADERS += \
@@ -52,8 +51,7 @@ HEADERS += \
5251
addalarmdialog.h \
5352
changealarmdialog.h \
5453
widgetsettings.h \
55-
globalsettingsdialog.h \
56-
rangewidget.h
54+
globalsettingsdialog.h
5755

5856
FORMS += \
5957
mainwindow.ui \

SmartTimer/addalarmdialog.ui

Lines changed: 8 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>

SmartTimer/addtimerdialog.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
</property>
112112
<property name="maximumSize">
113113
<size>
114-
<width>250</width>
114+
<width>260</width>
115115
<height>55</height>
116116
</size>
117117
</property>
@@ -159,7 +159,7 @@
159159
</property>
160160
<property name="maximumSize">
161161
<size>
162-
<width>250</width>
162+
<width>260</width>
163163
<height>55</height>
164164
</size>
165165
</property>

SmartTimer/alertwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
int getMsecs(const QTime& t)
88
{
9-
return (t.hour()*3600+t.minute()*60+t.second())*1000;
9+
return (t.hour()*3600+t.minute()*60+t.second())*1000+t.msec();
1010
}
1111

1212
int calculateDuration(const QTime &t)

SmartTimer/globalsettingsdialog.cpp

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "globalsettingsdialog.h"
22
#include "ui_globalsettingsdialog.h"
3-
#include "rangewidget.h"
3+
44
#include "widgetsettings.h"
55

66
#include <QFile>
@@ -52,6 +52,7 @@ GlobalSettingsDialog::GlobalSettingsDialog(GlobalSettings old, QWidget *parent)
5252
connect(ui->cancelButton,SIGNAL(clicked()),this,SLOT(canceled()));
5353
connect(ui->confirmButton,SIGNAL(clicked()),this, SLOT(confirmed()));
5454
connect( ui->opacitySlider,SIGNAL(valueChanged(int)),this,SLOT(opacityChanged()));
55+
connect(ui->defaultButton,SIGNAL(clicked()),this, SLOT(restoreDefault()));
5556

5657
}
5758

@@ -91,10 +92,7 @@ void GlobalSettingsDialog::opacityChanged()
9192
emit changeSettings(newSettings);
9293
}
9394

94-
void GlobalSettingsDialog::rangeChanged(int min, int max)
95-
{
96-
ui->RangeValue->setText(QString::number(min)+" : "+QString::number(max));
97-
}
95+
9896

9997
void GlobalSettingsDialog::DDenableState(bool state)
10098
{
@@ -103,4 +101,29 @@ void GlobalSettingsDialog::DDenableState(bool state)
103101

104102
}
105103

104+
void GlobalSettingsDialog::restoreDefault()
105+
{
106+
ui->DDenable->setChecked(false);
107+
108+
ui->DDmin->setEnabled(false);
109+
ui->DDmax->setEnabled(false);
110+
111+
ui->DDmin->setTime(QTime::fromMSecsSinceStartOfDay(0));
112+
ui->DDmax->setTime(QTime::fromMSecsSinceStartOfDay(0));
113+
114+
ui->TimerFormat->setText("HH:mm:ss");
115+
ui->alarmFormat->setText("HH:mm");
116+
117+
ui->opacitySlider->setValue(100);
118+
ui->SliderValue->setText("100%");
119+
120+
int elpasedTimeMin = elpasedTime(ui->DDmin->time());
121+
int elpasedTimeMax = elpasedTime(ui->DDmax->time());
122+
GlobalSettings newSettings(ui->opacitySlider->value()/100.0,ui->alarmFormat->text(), ui->TimerFormat->text(),static_cast<bool>(ui->DDenable->isChecked()),elpasedTimeMin, elpasedTimeMax);
123+
124+
ui->SliderValue->setText(QString::number(static_cast<int>(newSettings.windowOpacity*100))+"%");
125+
126+
emit changeSettings(newSettings);
127+
}
128+
106129

SmartTimer/globalsettingsdialog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ public slots:
2020
void confirmed();
2121
void canceled();
2222
void opacityChanged();
23-
void rangeChanged(int min,int max);
23+
//void rangeChanged(int min,int max);
2424
void DDenableState(bool state);
25+
void restoreDefault();
2526
signals:
2627
void changeSettings(GlobalSettings settings);
2728

SmartTimer/globalsettingsdialog.ui

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>600</width>
10-
<height>600</height>
9+
<width>700</width>
10+
<height>700</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -18,14 +18,14 @@
1818
</property>
1919
<property name="minimumSize">
2020
<size>
21-
<width>600</width>
22-
<height>600</height>
21+
<width>700</width>
22+
<height>700</height>
2323
</size>
2424
</property>
2525
<property name="maximumSize">
2626
<size>
27-
<width>1000</width>
28-
<height>1000</height>
27+
<width>700</width>
28+
<height>700</height>
2929
</size>
3030
</property>
3131
<property name="windowTitle">
@@ -39,10 +39,10 @@
3939
<property name="sizeConstraint">
4040
<enum>QLayout::SetMinimumSize</enum>
4141
</property>
42-
<item row="0" column="0">
42+
<item row="1" column="0">
4343
<layout class="QVBoxLayout" name="verticalLayout">
4444
<property name="sizeConstraint">
45-
<enum>QLayout::SetNoConstraint</enum>
45+
<enum>QLayout::SetFixedSize</enum>
4646
</property>
4747
<item>
4848
<layout class="QHBoxLayout" name="horizontalLayout_2">
@@ -100,7 +100,7 @@
100100
<item>
101101
<layout class="QHBoxLayout" name="RangeLayout">
102102
<item>
103-
<widget class="QLabel" name="RangeValue">
103+
<widget class="QLabel" name="DDLabel">
104104
<property name="minimumSize">
105105
<size>
106106
<width>100</width>
@@ -138,6 +138,24 @@
138138
</property>
139139
</widget>
140140
</item>
141+
<item>
142+
<layout class="QVBoxLayout" name="verticalLayout_3">
143+
<item>
144+
<widget class="QLabel" name="label_4">
145+
<property name="text">
146+
<string>from:</string>
147+
</property>
148+
</widget>
149+
</item>
150+
<item>
151+
<widget class="QLabel" name="label_5">
152+
<property name="text">
153+
<string>to:</string>
154+
</property>
155+
</widget>
156+
</item>
157+
</layout>
158+
</item>
141159
<item>
142160
<layout class="QVBoxLayout" name="verticalLayout_2">
143161
<item>
@@ -282,6 +300,19 @@
282300
</item>
283301
</layout>
284302
</item>
303+
<item row="0" column="0">
304+
<widget class="QPushButton" name="defaultButton">
305+
<property name="minimumSize">
306+
<size>
307+
<width>0</width>
308+
<height>50</height>
309+
</size>
310+
</property>
311+
<property name="text">
312+
<string>Set to default</string>
313+
</property>
314+
</widget>
315+
</item>
285316
</layout>
286317
</widget>
287318
<resources>

0 commit comments

Comments
 (0)