-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelpDesk app
332 lines (291 loc) · 15.6 KB
/
HelpDesk app
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
#include <memory>
#include <vector>
#include <map>
#include <nana/deploy.hpp>
#include <nana/gui.hpp>
#include <nana/gui/place.hpp>
#include <nana/gui/widgets/button.hpp>
#include <nana/gui/widgets/combox.hpp>
#include <nana/gui/widgets/label.hpp>
#include <nana/gui/widgets/progress.hpp>
#include <nana/gui/widgets/tabbar.hpp>
#include <nana/gui/widgets/panel.hpp>
#include <nana/gui/widgets/listbox.hpp>
#include <nana/gui/widgets/treebox.hpp>
#include <nana/gui/widgets/checkbox.hpp>
#include <nana/gui/widgets/date_chooser.hpp>
#include <nana/gui/widgets/textbox.hpp>
#include <nana/gui/widgets/categorize.hpp>
#include <nana/gui/widgets/group.hpp>
#include <nana/gui/timer.hpp>
#include <nana/gui/tooltip.hpp>
#include <nana/filesystem/filesystem_ext.hpp>
#include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
class Responses { //base class for random response generation
public:
string genResp();
};
string Responses::genResp() { //random response generation for confirmation of navigation option
srand(time(NULL));
int genRand = 1 + rand() % 6;
switch (genRand) {
case 1:
return "Got it.";
break;
case 2:
return "Understood.";
break;
case 3:
return "Choice confirmed.";
break;
case 4:
return "Displaying the required information...";
break;
case 5:
return "Okay.";
break;
default:
return "Option confirmed.";
}
}
class Intro : public Responses { //derived class utlizing function overriding to randomly generate introductory dialogue by IRIS
public:
string genResp();
};
string Intro::genResp() { //overridden function definition
srand(time(NULL));
int genRand = 1 + rand() % 6;
switch (genRand) {
case 1:
return "Welcome to HelpDesk! I'm IRIS. How may I help you?";
break;
case 2:
return "Welcome to HelpDesk! I am IRIS. How may I be of assistance?";
break;
case 3:
return "Hello, I am IRIS. Welcome to HelpDesk! What do you need help with?";
break;
case 4:
return "Welcome to HelpDesk! I am IRIS. Do you need any help?";
break;
case 5:
return "Hi, I am IRIS. Welcome to HelpDesk! Can I help you?";
break;
default:
return "Hello. I am IRIS. Welcome to HelpDesk! If there is any problem, you can ask me.";
}
}
class Outro : public Responses { //derived class utlizing function overriding to randomly generate exiting dialogue by IRIS
public:
string genResp();
};
string Outro::genResp() { //overridden function definition
srand(time(NULL));
int genRand = 1 + rand() % 6;
switch (genRand) {
case 1:
return "Goodbye! Quit?";
break;
case 2:
return "Feel free to come back any time. Quit?";
break;
case 3:
return "For any further questions, you may come back again. Quit?";
break;
case 4:
return "HelpDesk will entertain any queries if needed. Quit?";
break;
case 5:
return "Okay, goodbye. Quit?";
break;
default:
return "Exiting HelpDesk. Are you sure you want to quit?";
}
}
class Blocks { //class for blocks or modules of AAOffice
public:
string timer(), notepad(), extra(), credits(); //function prototypes
};
string Blocks::credits() { //generating random response in each case along with necessary menu information about modules
Responses r;
return r.genResp() + "\n\nCREDITS\nAyesha Tahir\tBSCS-10A\nAzka Khan\tBSCS-10A\nLibrary\t\tNANA";
}
string Blocks::timer() {
Responses r;
return r.genResp() + "\n\nABOUT POMOTIMER:\nA timer designed to utilize the infamous scientifically proven time management and productivity method called 'Pomodoro'.";
}
string Blocks::notepad() {
Responses r;
return r.genResp() + "\n\nABOUT BRAINSCAPE\nAn app designed to help you view the calendar, set reminders, organize your to-do list and use a simple notepad.";
}
string Blocks::extra() {
Responses r;
return r.genResp() + "\n\nABOUT REFLECT\nThis is an app which is designed to help students evaluate their goals and get motivated in order to complete their goals.";
}
namespace demo //gui programming start
{
using namespace nana;
namespace fs = std::filesystem;
namespace fs_ext = nana::filesystem_ext;
class widget_show : public form //derived class for displaying widgets
{
place place_{ *this };
timer timer_;
group simple_{ *this, "<bold=true, color=0xff0000>HelpDesk</>", true /*formated*/ }, //setting div's
comboxes_{ simple_, "<bold=true>FAQ's/Study Resources</>", true },
buttons2_{ simple_, "<bold=true>AAOffice Features</>", true },
labels_{ simple_, "<bold=true>Meet</> <bold=true, color=0xff0000>IRIS</>", true };
combox cb_e{ comboxes_, ("IRIS") }, //creating and setting comboxes names
cb_e2{ comboxes_, ("Study stress") },
cb_e3{ comboxes_, ("Study tips") },
cb_e4{ comboxes_, ("Study audio") },
cb_e5{ comboxes_, ("Scholarships") };
button b_timer{ buttons2_, ("POMOTimer") }, //creating and setting buttons names
b_calender{ buttons2_, ("Calender") },
b_r{ buttons2_, ("BrainScape") },
b_g{ buttons2_, ("REFLECT") },
b_c{ buttons2_, ("Credits") };
label lab{ labels_ }; //creation of label
public:
widget_show() //setting form details
: form(API::make_center(650, 300), appear::decorate<appear::sizable>()) //setting form dimensions along with responsiveness
{
nana::API::track_window_size(*this, { 300,300 }, false); //minimum
this->caption(("HelpDesk v1.0")); //setting window title
place_.div(R"(vertical
<weight=30% min=260 <weight=10> <simples gap=3 margin=5> >
<weight=20 tab >
<tab_frame> )");
place_["simples"] << simple_;
simple_.div("vertical all min=260 gap=3 margin=5"); //setting general div settings for all widgets
simple_["all"] << labels_ << comboxes_ << buttons2_; //setting order of widgets
_m_init_buttons(); //setting button details
_m_init_labels(); //setting label details
_m_init_comboxs(); //setting combox details
this->events().unload([this](const arg_unload& ei) //generation of msgbox upon clicking cross
{
msgbox mb(*this, ("Quit"), msgbox::yes_no); //msgbox of type question with "yes\no" options + setting title of msgbox window
Outro o; //creation of outro object
mb.icon(mb.icon_question) << (o.genResp()); //call random outro response for msgbox content
ei.cancel = (mb() == mb.pick_no); //quitting app upon choosing no
});
place_.collocate();
};
private:
void _m_init_buttons() //buttons details
{
Blocks b; //creation of button object
buttons2_.div("buttons min=25 gap=5 margin=3"); //setting button div's
buttons2_["buttons"] << b_timer << b_r << b_g << b_c; //setting order of buttons
msgbox mb5{ *this, "What is POMOTimer?" }; //creating and setting msgbox titles
msgbox mb7{ *this, "What is BrainScape?" };
msgbox mb8{ *this, "What is REFLECT?" };
msgbox mb9{ *this, "Credits" };
mb5.icon(mb5.icon_information) << b.timer(); //setting msgboxes' types as information and calling members functions for displaying information about modules
mb7.icon(mb7.icon_information) << b.notepad();
mb8.icon(mb8.icon_information) << b.extra();
mb9.icon(mb9.icon_information) << b.credits();
b_timer.events().click(mb5); //creating events for calling msgboxes upon cliking on buttons
b_r.events().click(mb7);
b_g.events().click(mb8);
b_c.events().click(mb9);
}
void _m_init_comboxs() //combox details
{
comboxes_.div("buttons min=25 gap=5 margin=3"); //setting arrangement of comboxes
comboxes_["buttons"] << cb_e << cb_e2 << cb_e3 << cb_e4 << cb_e5; //setting order of comboxes
cb_e.push_back(("About")); //creating drop down option for about IRIS
msgbox mb(*this, ("Who is IRIS?")); //msgbox for information about IRIS
mb.icon(mb.icon_information); //msgbox of type information
cb_e.events().selected([this, mb](const nana::arg_combox& acmb) mutable //displaying content upon drop down option selection for "About IRIS"
{
mb << ("I am IRIS, a mini system designed to assist you with Frequently Asked Question (FAQ's) regarding study resources. You can also use the given options to access information about the multiple modules/features which AAOffice v1.0 contains.");
mb();
//Clear the buffer, otherwise the mb shows the text generated in
//the last selected event.
mb.clear();
cb_e.push_back(("About IRIS")); //creating drop down option to allow user to access options repeatedly
cb_e.erase(2); //same option as combox made unavailable
});
cb_e4.push_back(("Start study audio")); //creating drop down option for study music
msgbox mb2(*this, ("Start music/white noise")); //msgbox for information about IRIS
mb2.icon(mb2.icon_information); //msgbox of type information
cb_e4.events().selected([this, mb2](const nana::arg_combox& acmb) mutable //displaying content upon drop down option selection for study music
{
mb2 << ("Started music/white noise...\nResources: White noise, Lofi Girl Study Beats Radio"); //displaying message
system("start \"\" \"https://www.youtube.com/watch?v=5qap5aO4i9A&ab_channel=LofiGirl\""); //opening links for resources
system("start \"\" \"https://www.youtube.com/watch?v=nMfPqeZjc2c&t=2554s\"");
mb2();
//Clear the buffer, otherwise the mb shows the text generated in
//the last selected event.
mb2.clear();
cb_e4.push_back(("Study audio")); //creating drop down option to allow user to access options repeatedly
cb_e4.erase(2); //same option as combox made unavailable
});
cb_e2.push_back(("Study stress help")); //creating drop down option for study stress help
msgbox mb3(*this, ("How to deal with study stress?")); //msgbox for study stress help
mb3.icon(mb3.icon_information); //msgbox of type information
cb_e2.events().selected([this, mb3](const nana::arg_combox& acmb) mutable //displaying content upon drop down option selection for study stress help
{
mb3 << ("Opened stress management help resources...\nResources: BestColleges, Med School Insiders(YouTube)"); //displaying message
system("start \"\" \"https://www.youtube.com/watch?v=Bk2-dKH2Ta4\""); //opening links for resources
system("start \"\" \"https://www.bestcolleges.com/resources/balancing-stress/\"");
mb3();
//Clear the buffer, otherwise the mb shows the text generated in
//the last selected event.
mb3.clear();
cb_e2.push_back(("Study stress")); //creating drop down option to allow user to access options repeatedly
cb_e2.erase(2); //same option as combox made unavailable
});
cb_e3.push_back(("Study tips resources")); //creating drop down option for study tips
msgbox mb4(*this, ("How to study effectively?")); //msgbox for study tips
mb4.icon(mb4.icon_information); //msgbox of type information
cb_e3.events().selected([this, mb4](const nana::arg_combox& acmb) mutable //displaying content upon drop down option selection for study tips
{
mb4 << ("Loaded study tips...\nResources: StudyQuill(YouTube), Oxford Learning, College Info Geek"); //displaying message
system("start \"\" \"https://www.youtube.com/watch?v=ZbjjwgiVQKk&ab_channel=studyquillstudyquill\""); //opening links for resources
system("start \"\" \"https://www.oxfordlearning.com/best-methods-of-self-study-for-students/\"");
system("start \"\" \"https://collegeinfogeek.com/study-tips/\"");
mb4();
//Clear the buffer, otherwise the mb shows the text generated in
//the last selected event.
mb4.clear();
cb_e3.push_back(("Study tips")); //creating drop down option to allow user to access options repeatedly
cb_e3.erase(2); //same option as combox made unavailable
});
cb_e5.push_back(("Scholarships info")); //creating drop down option for scholarships information
msgbox mb5(*this, ("Information about scholarships")); //msgbox for scholarships info
mb5.icon(mb5.icon_information); //msgbox of type information
cb_e5.events().selected([this, mb5](const nana::arg_combox& acmb) mutable //displaying content upon drop down option selection for scholarships information
{
mb5 << ("Opened scholarship information website...\nResources: HEC Website Pakistan"); //displaying message
system("start \"\" \"https://www.hec.gov.pk/english/scholarshipsgrants/Pages/internationalScholarships.aspx\""); //opening links for resources
mb5();
//Clear the buffer, otherwise the mb shows the text generated in
//the last selected event.
mb5.clear();
cb_e5.push_back(("Scholarships")); //creating drop down option to allow user to access options repeatedly
cb_e5.erase(2); //same option as combox made unavailable
});
}
void _m_init_labels() //labels details
{
Intro i; //creation of intro object
labels_.div("buttons gap=5 min=25 margin=3"); //setting labels arrangment
labels_["buttons"] << (i.genResp()) << lab; //generating random intro by calling member function
lab.format(true); //setting formatting for label
}
}; //end class widget_show
void go() { //function to execute GUI
widget_show wdshow;
wdshow.show();
exec();
}
}
int main() { //main start
demo::go(); //start up interface for app
} //main end