forked from CodingMorry7/Get2gether
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patherror.cpp
84 lines (75 loc) · 2.82 KB
/
error.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
#include <QMessageBox>
#include <QString>
#include <QDebug>
#include "error.h"
/*=================================================================================================================================*/
// class Error-Specific Methods
/*=================================================================================================================================*/
/*.------------------------.*/
/*| Constructor |*/
/*'------------------------'*/
error::error()
{
}
/*=================================================================================================================================*/
/*.------------------------.*/
/*| Print |*/
/*'------------------------'*/
void error::printError(ErrorCode error_code)
{
QMessageBox ErrorBox;
ErrorBox.setWindowTitle("Woah There!");
QString errorMsg, consoleMsg;
switch(error_code)
{
case EDIT_ERROR_UNAUTH_USER:
{
errorMsg = "Error: You can't change other's schedules.";
consoleMsg = "Modification failed: You can only modify events you own.";
break;
}
case DELETE_ERROR_UNAUTH_USER:
{
errorMsg = "Error : You can't delete other's schedules.";
consoleMsg = "Deletion failed: You can only delete events you own.";
break;
}
case ADD_ERROR_NO_GROUP_SELECTED:
{
errorMsg = "Error : Select a group you want to add a group event.";
consoleMsg = "Insertion failed : Select group to add group event.";
break;
}
case EDIT_ERROR_INVALID_MODE:
{
errorMsg = "Error : You can't edit group event from personal calendar.";
consoleMsg = "Modification failed : Group event must be edited from group calendar.";
break;
}
case DELETE_ERROR_INVALID_MODE:
{
errorMsg = "Error : You can't delete group event from personal calendar.";
consoleMsg = "Deletion failed : Group event must be deleted from group calendar.";
break;
}
case DELETE_NO_DATE_SELECTED:
{
errorMsg = "Error : No event was selected. Try again.";
consoleMsg = "Deletion failed : Select an event to delete.";
break;
}
case TXTBOX_MAX_CHAR_REACHED:
{
errorMsg = "Error : Your input is over the character limit.";
consoleMsg = "Character input failed : You must include no more characters than what's indicated.";
}
default:
{
errorMsg = "Error : action causes unknown error.";
consoleMsg = "Recent action has caused an error";
}
}
ErrorBox.setText(errorMsg);
ErrorBox.exec();
qDebug().noquote() << consoleMsg;
}