Esempio n. 1
0
void WindowManager::manageNextWindow() {
    if (!m_nextWindow) {
        return;
    }

    switch (m_nextAction) {
        case NextWindowAction::Replace: {
            popWindow();
            pushWindow(m_nextWindow);
            break;
        }
        case NextWindowAction::ReplaceAll: {
            for (Window* win : m_windows) {
                removeWindow(win);
            }
            m_windows.clear();

            pushWindow(m_nextWindow);
            break;
        }
        case NextWindowAction::None:
        default:
            LOG(ERROR) << "Invalid window action for next window" << std::endl;
            break;
    }
    m_nextWindow = nullptr;
    m_nextAction = NextWindowAction::None;
}
Esempio n. 2
0
bool GradErrorCheck::check(GradAppData* data){
	string first,last,email,stunum,course,areas,program,supervisor;
	first = data->first;
	last = data->last;
	areas = data->areas;
	program = data->program;
	stunum = data->stuNum;
	course = data->course;
	email = data->email;
	supervisor = data->supervisor;


	bool good = true;
	
	unsigned invalidF = (first).find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'");
	unsigned invalidL = (last).find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'");
	unsigned invalidSup = (supervisor).find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'");
	string stringToFind1("@carleton.ca");
	unsigned validChars1 = (email).find(stringToFind1);
	unsigned validStu = (stunum).find_first_not_of("0123456789");
	
	

	

	//string* areas, string* program, string* supervisor
	if(areas.length() == 0){
		cout << "Study Area is empty" <<endl;
		popWindow("Choose a main study area");
		return !good;
	
	}
	else if(program.length() == 0){
		cout << "Program is empty" <<endl;
		popWindow("Choose a program");
		return !good;
		
	}



	
	

	if(course.length() == 0){
		cout << "Course is empty" <<endl;
		popWindow("Choose a course");
		return !good;
		
	}
		
	else if(first.length() == 0){
		cout << "First name is empty" <<endl;
		popWindow("First name is empty");
		return !good;
	}
                
		
	else if(last.length() == 0){
		cout << "Last Name is Empty" <<endl;
		popWindow("Last Name is Empty");
		return !good;
	}
                
	
                
	else if(email.length() == 0){
		cout << "Email is Empty" <<endl;
		popWindow("Email is Empty");
		return !good;
	}
                	
	
                
	else if(stunum.length() == 0){
		cout << "Student Number is Empty" <<endl;
		popWindow("Student Number is Empty");
		return !good;
	}

	
	
	
  
	else if (invalidF != string::npos) {
		cout << "You entered a non-alphabetical character, " << (first)[invalidF];
		cout << ", at position " << invalidF << endl;
			
		popWindow("You entered a non-alphabetical character in first name");
		return !good;
		
   	}


	
  
	else if (invalidL != string::npos) {
		cout << "You entered a non-alphabetical character, " << (last)[invalidL];
		cout << ", at position " << invalidL << endl;
		popWindow("You entered a non-alphabetical character in last name");
		return !good;
   	}

   	else if (invalidSup != string::npos) {
		cout << "You entered a non-alphabetical character, " << (supervisor)[invalidSup];
		cout << ", at position " << invalidSup << endl;
		popWindow("You entered a non-alphabetical character in supervisor");
		return !good;
   	}


	

	else if (validChars1 == string::npos) {
		cout << "Invalid e-mail address. Please enter your Carleton e-mail address ([email protected]) to register." << endl;
		popWindow("Invalid e-mail address. Please enter your Carleton e-mail address ([email protected]) to register.");
		return !good;
	}

	
  
	


	
	else if (validStu != string::npos) {
		cout << "You entered a character which is not a number between 0-9: " << (stunum)[validStu];
		cout << ", at position " << validStu << "Please re-enter your student number." << endl;
		popWindow("Your student number contains invalid characters");
		return !good;
    }

	else if ((stunum).length() != 9) {
		cout << "A valid student number has exactly 9 characters. Please re-enter your student number." << endl;
		popWindow("A valid student number has exactly 9 characters.");
		return !good;
	}
	



		

	

	return good;
}
Esempio n. 3
0
void StackedWindow::clearWindows() {
    while (stack.size() > 1) {
        popWindow();
    }
}