-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudytimer.h
More file actions
173 lines (144 loc) · 4.62 KB
/
Copy pathstudytimer.h
File metadata and controls
173 lines (144 loc) · 4.62 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#ifndef STUDYTIMER_H
#define STUDYTIMER_H
#include <QDialog>
#include <QMutex>
#include <QListWidgetItem>
#include "alert.h"
//#include "alerttime.h"
namespace Ui {
class StudyTimer;
}
class StudyTimer : public QDialog
{
Q_OBJECT
public:
explicit StudyTimer(QWidget *parent = nullptr);
~StudyTimer();
/**
* @name Set StudyTimer's Reference
* @brief Sets the study timer's stored reference.
* @param c The StudyTimer to be stored in this calendar's reference.
* @return Void.
*
* Sets the study timer's stored reference to the provided StudyTimer object.
*/
void setRef(StudyTimer* c);
/**
* @name Set StudyTimer's Alerts Queue
* @brief Sets the study timer's alerts queue.
* @param alertsQueue The alerts queue for the study timer.
* @return Void.
*
* Sets the study timer's alerts queue to the provided alerts queue.
*/
void setAQ(std::vector<Alert*>* alertsQueue);
/**
* @name Set StudyTimer's Designated Mutex
* @brief Sets the study timer's designated mutex.
* @param m The mutex belonging to the study timer.
* @return Void.
*
* Sets the study timer's designated mutex to the provided QMutex.
*/
void setMutex(QMutex* m);
private:
Ui::StudyTimer *ui;
StudyTimer* ref;
QMutex* mtx;
QDateTime endtime;
std::vector<Alert*>* aQ;
QListWidgetItem* currentTItem;
/**
* @name currentTItem setter
* @brief Sets currentTItem to the given QListWidgetItem.
* @return Void.
*
* Sets the pointer to the current timer to point to the given QListWidgetItem.
*/
void setCurrentListWidgetItem(QListWidgetItem*);
/**
* @name StudyTimer Alert Getter
* @brief Returns a pointer to the Alert corresponding to the provided QListWidgetItem.
* @return A pointer to the Alert corresponding to the provided QListWidgetItem
*
* Returns a pointer to the Alert corresponding to the provided QListWidgetItem.
*/
Alert* getAlert(QListWidgetItem*);
std::map<QListWidgetItem*, Alert*> alertWidgetMap;
/**
* @name Time to Alert
* @brief Returns a string with the hours, minutes, and seconds left until the study timer goes off.
* @param inputAlertTime The time at which the study timer will go off.
* @return A string formatted as "[Hours] hours, [Minutes] minutes, and [Seconds] seconds left."
*
* Returns a string with the hours, minutes, and seconds left until the timer goes off, formatted as "[Hours] hours, [Minutes] minutes, and [Seconds] seconds left.".
*/
std::string timeToAlert(QDateTime inputAlertTime);
private slots:
void on_timeEdit_userTimeChanged(const QTime &time);
void on_listWidget_itemClicked(QListWidgetItem *item);
void on_startStudyTimer_clicked();
void on_stopStudyTimer_clicked();
void on_listWidget_itemDoubleClicked(QListWidgetItem *item);
public slots:
/**
* @name Delete STItem
* @brief Deletes the stItem corresponding to Alert a.
* @param a The alert
* @return Void.
*
* Deletes the stItem corresponding to Alert a.
*/
void remove_sTItem(Alert* a);
/**
* @name Automated Study Timer Creator
* @brief Creates a study timer based on the provided int and string.
* @return Void.
*
* Creates a study timer based on the provided int and string, without looking for user input. Meant for use with voice commands.
*/
void voice_create_studytimer(int, QString);
};
#endif // STUDYTIMER_H
/*
#ifndef STUDYTIMER_H
#define STUDYTIMER_H
#include <QDialog>
#include <QMutex>
#include <QListWidgetItem>
#include "alert.h"
#include "alerttime.h"
namespace Ui {
class StudyStudyTimer;
}
class StudyStudyTimer : public QDialog
{
Q_OBJECT
public:
explicit StudyStudyTimer(QWidget *parent = nullptr);
~StudyStudyTimer();
void setRef(StudyStudyTimer*);
void setAQ(std::vector<Alert*>*);
void setMutex(QMutex*);
private:
Ui::StudyStudyTimer *ui;
StudyStudyTimer* ref;
QMutex* mtx;
AlertTime endtime;
std::vector<Alert*>* aQ;
QListWidgetItem* currentSTItem;
void setCurrentListWidgetItem(QListWidgetItem*);
Alert* getAlert(QListWidgetItem*);
std::map<QListWidgetItem*, Alert*> alertWidgetMap;
private slots:
void on_timeEdit_userTimeChanged(const QTime &time);
void on_listWidget_itemClicked(QListWidgetItem *item);
void on_startStudyStudyTimer_clicked();
void on_stopStudyStudyTimer_clicked();
void on_listWidget_itemDoubleClicked(QListWidgetItem *item);
public slots:
void remove_stItem(Alert*);
void voice_create_studytimer(int);
};
#endif // STUDYTIMER_H
*/