forked from apermatigari/CS-100-Final-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.cpp
210 lines (176 loc) · 6.58 KB
/
display.cpp
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#include <iostream>
#include "getInput.h"
#include "taskList.h"
#include "task.h"
#include "display.h"
using namespace std;
#include <string>
#include <string>
#include <vector>
// whole calendar and table view are in terminal
int display::Display() {
// other variables also need to be put in here, I just put the Title getter for the time being
getInput user;
string name;
char currentInput;
//Beginnning prompt
cout << "WELCOME TO TIMEPULSE (TP)" << endl;
cout << "PURPOSE: Create tasks and place them into a calender or table view for the user to see!" << endl;
cout << "STEP 1: Create a task" << endl;
cout << "STEP 2: Assign a title, description, due date, and priority to the task" << endl;
cout << "STEP 3: View all your tasks in a calender view or table format" << endl;
cout << "From here, you can either create more tasks, edit current tasks, remove tasks that are finished/uneeded, or switch between view modes" << endl;
cout << "to visualize your tasks!" << endl;
cout << "ENJOY TP!" << endl << endl;
cout << "c: create a task" << endl;
cout << "e: edit a task" << endl;
cout << "r: to remove a task" << endl;
cout << "v: view a task" << endl;
cout << "q: to end program" << endl << endl;
currentInput = user.getInputTask();
//In getInput class, have a function that returns the stored input for currentView(1 or 2), then return and based on that value go to which view
while(currentInput != 'q') {
if(currentInput == 'a' || currentInput == 'p' || currentInput == 'w' || currentInput == 'A' || currentInput == 'P' || currentInput == 'W') {
chooseRoute(currentInput, user);
}
cout << endl;
cout << "c: create a task" << endl;
cout << "e: edit a task" << endl;
cout << "r: to remove a task" << endl;
cout << "v: view a task" << endl;
cout << "q: to end program" << endl << endl;
currentInput = user.getInputTask();
}
return 0;
}
void display::chooseRoute(char route, getInput user) {
if(route == 'a') {
cout << "MOVING TO TABLE VIEW" << endl;
cout << endl;
goToTableView(user);
}
else if(route == 'A') {
cout << "MOVING TO WEEKLY CALENDAR VIEW" << endl;
cout << endl;
goToCalendarView(user);
}
else if(route == 'p') {
cout << "MOVING TO TABLE VIEW (PRIORITY)" << endl;
cout << endl;
goToTableViewPriority(user);
}
else if(route == 'P') {
cout << "MOVING TO WEEKLY CALENDAR VIEW (PRIORITY)" << endl;
cout << endl;
goToCalendarViewPriority(user);
}
else if(route == 'w') {
cout << "MOVING TO TABLE VIEW (TIME)" << endl;
cout << endl;
goToTableViewTime(user);
}
else if(route == 'W') {
cout << "MOVING TO WEEKLY CALENDAR VIEW (TIME))" << endl;
cout << endl;
goToCalendarViewTime(user);
}
}
void display::goToCalendarView(getInput user) {
//Display
return;
}
void display::goToCalendarViewPriority(getInput user) {
//Display
return;
}
void display::goToCalendarViewTime(getInput user) {
//Display
return;
}
void display::goToTableView(getInput user) {
int i;
string title;
string description;
string dueDate;
int hour;
char priority;
if(user.myTasks.getAllTasksList().size() == 0) {
cout << "NO TASKS IN LIST" << endl;
return;
}
//Printing out all tasks(No order)
cout << "ALL TASKS TO BE DONE (STANDARD): " << endl << endl;
for(i = 0; i < user.myTasks.getListSize(); ++i) {
title = user.myTasks.getAllTasksList().at(i).getTaskName();
description = user.myTasks.getAllTasksList().at(i).getDescription();
dueDate = user.myTasks.getAllTasksList().at(i).getDueDate();
hour = user.myTasks.getAllTasksList().at(i).getDueDateHour();
priority = user.myTasks.getAllTasksList().at(i).getPriority();
cout << "Task: " << i+1 << endl << endl;
cout << "Title: " << title << endl;
cout << "Due Date: " << dueDate << endl;
cout << "Time: " << hour << endl;
cout << "Priority: " << priority << endl;
cout << "Description: " << description << endl;
cout << endl << endl;
}
return;
}
void display::goToTableViewPriority(getInput user) {
int i;
string title;
string description;
string dueDate;
int hour;
char priority;
if(user.myTasks.getAllTasksList().size() == 0) {
cout << "NO TASKS IN LIST" << endl;
return;
}
//Printing out all tasks(Order by priority)
cout << "ALL TASKS TO BE DONE (SORTED BY PRIORITY): " << endl << endl;
for(i = 0; i < user.myTasks.getListSize(); ++i) {
title = user.myTasks.getPriorityVector().at(i).getTaskName();
description = user.myTasks.getPriorityVector().at(i).getDescription();
dueDate = user.myTasks.getPriorityVector().at(i).getDueDate();
hour = user.myTasks.getPriorityVector().at(i).getDueDateHour();
priority = user.myTasks.getPriorityVector().at(i).getPriority();
cout << "Task: " << i+1 << endl << endl;
cout << "Title: " << title << endl;
cout << "Due Date: " << dueDate << endl;
cout << "Time: " << hour << endl;
cout << "Priority: " << priority << endl;
cout << "Description: " << description << endl;
cout << endl << endl;
}
return;
}
void display::goToTableViewTime(getInput user) {
int i;
string title;
string description;
string dueDate;
int hour;
char priority;
if(user.myTasks.getAllTasksList().size() == 0) {
cout << "NO TASKS IN LIST" << endl;
return;
}
//Printing out all tasks(Order by time)
cout << "ALL TASKS TO BE DONE (SORTED BY TIME): " << endl << endl;
for(i = 0; i < user.myTasks.getListSize(); ++i) {
title = user.myTasks.getTimeVector().at(i).getTaskName();
description = user.myTasks.getTimeVector().at(i).getDescription();
dueDate = user.myTasks.getTimeVector().at(i).getDueDate();
hour = user.myTasks.getTimeVector().at(i).getDueDateHour();
priority = user.myTasks.getTimeVector().at(i).getPriority();
cout << "Task: " << i+1 << endl << endl;
cout << "Title: " << title << endl;
cout << "Due Date: " << dueDate << endl;
cout << "Time: " << hour << endl;
cout << "Priority: " << priority << endl;
cout << "Description: " << description << endl;
cout << endl << endl;
}
return;
}