-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoolsclass.cpp
More file actions
121 lines (99 loc) · 2.97 KB
/
toolsclass.cpp
File metadata and controls
121 lines (99 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "toolsclass.h"
ToolsClass::ToolsClass(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(ui.ok_pb , SIGNAL(clicked ()) , this, SLOT(ok ()));
connect(ui.cancel_pb , SIGNAL(clicked ()) , this, SLOT(cancel ()));
connect(ui.close_pb , SIGNAL(clicked ()) , this, SLOT(closeApp ()));
connect(ui.credits_pb , SIGNAL(clicked ()) , this, SLOT(show_credits ()));
connect(ui.motifications_cb , SIGNAL(currentIndexChanged(int)) , this, SLOT(set_notifi_stat(int)));
connect(ui.add_person_pb , SIGNAL(clicked ()) , this, SLOT(addPerson ()));
connect(&add_pers_form , SIGNAL(send_Person ()) , this, SLOT(cancel ()));
}
//_____________________________________
void ToolsClass::set_form_params()
{
ui.day_of_week_cb ->setCurrentIndex(day_notif );
ui.motifications_cb ->setCurrentIndex(type_notif);
ui.timeEdit ->setTime (time_notif);
ui.checkBox ->setChecked (sayHallo_flag);
ui.days_warn_le ->setText (QString::number(day_warning));
set_notifi_stat(type_notif);
this->exec();
}
//_____________________________________
ToolsClass::~ToolsClass()
{
}
//_____________________________________
// Exit
//_____________________________________
void ToolsClass::closeApp()
{
QApplication::quit();
}
//_____________________________________
// Apply settings
//_____________________________________
void ToolsClass::ok ()
{
time_notif = ui.timeEdit ->time();
type_notif = ui.motifications_cb ->currentIndex();
day_notif = ui.day_of_week_cb ->currentIndex();
sayHallo_flag = ui.checkBox ->isChecked();
day_warning = ui.days_warn_le ->text().toInt() + 1;
emit apply_settings(ui.days_warn_le->text().toInt());
accept();
}
//_____________________________________
// Cancel
//_____________________________________
void ToolsClass::cancel ()
{
reject();
}
//_____________________________________
void ToolsClass::show_credits ()
{
QMessageBox::warning(this, "Ñîçäàòåëè",
"Ýòó ïðîãðàììó ñîçäàë Íèêèòà Áàøàðîâ, ñîòðóäíèê ÑÏÏ Ôèëèàëà ÏÍÁÎ è ïî ñîâìåñòèòåëüñòâó ñòóäåíò ÌÀÈ 5-ãî êóðñà, â 2017 ãîäó.\nÏî ïîâîäó áàãîâ ïèøèòå íà colorbash3000@gmail.com\nßíäåêñ Äåíüãè: 410015245438532");
}
//_____________________________________
void ToolsClass::set_notifi_stat(int n)
{
type_notif = n;
switch (type_notif)
{
case NOTIF_EVERYDAY:
{
ui.day_of_week_cb ->setVisible(false);
ui.day_of_week_lb ->setVisible(false);
ui.timeEdit ->setVisible(true);
ui.time_lb ->setVisible(true);
break;
}
case NOTIF_EVERYWEEK:
{
ui.day_of_week_cb ->setVisible(true );
ui.day_of_week_lb ->setVisible(true);
ui.timeEdit ->setVisible(true );
ui.time_lb ->setVisible(true);
break;
}
case NOTIF_NEVER:
{
ui.day_of_week_cb ->setVisible(false);
ui.day_of_week_lb ->setVisible(false);
ui.timeEdit ->setVisible(false);
ui.time_lb ->setVisible(false);
break;
}
}
}
//_____________________________________
void ToolsClass::addPerson ()
{
add_pers_form.exec();
}
//_____________________________________