Beispiel #1
0
int emct_main::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: exitChild(); break;
        case 1: closeEvent((*reinterpret_cast< QCloseEvent*(*)>(_a[1]))); break;
        case 2: getPath(); break;
        case 3: executeOption(); break;
        case 4: saveLog(); break;
        case 5: helpPdf(); break;
        case 6: { int _r = readConfigFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 7: openCon((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
        case 8: disableButtons(); break;
        case 9: enableButtons(); break;
        case 10: changeEStatus((*reinterpret_cast< std::string(*)>(_a[1]))); break;
        case 11: { int _r = readVersionFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 12: logAppend((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 13: logAppendError((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 14: logAppendOp((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
Beispiel #2
0
// Functions related to the main menu
void displayMainMenu(){
 	int option = -1;
	printf("+++++++++++++++++++++++\n");
	printf("Sys Admin Utility\n");
	printf("1. File Explorer\n");
	printf("2. Find  and Replace\n");
	printf("3. Show the Log\n");
	printf("4. Exit\n");
	printf("+++++++++++++++++++++++\n");
 	printf("Please enter an option between 1 to 4 \n");
 	writeToLog("Please enter an option between 1 to 4 ");
 	scanf("%d", &option);
    while(validate(option) == -1)
    {
    	printf("You entered an invalid option.... please re enter an option between 1 to 4\n ");
	 	writeToLog("You entered an invalid option.... please re enter an option between 1 to 4");
 		
 		scanf("%d", &option);
    }  
    executeOption(option);

}
Beispiel #3
0
int main(void) {
	LogList *logList = malloc(sizeof(LogList));
	FILE *fp;
	char fileName[MAX_FILE_LEN];

	int option = 0;
	int runFlag = TRUE;

	initializeLogList(logList);
	getFileName(fileName);

	if((fp = fopen(fileName, "r")) == NULL) {
		fprintf(stderr, "ERROR: FILE DOESN't EXIST\n");
		return EXIT_FAILURE;
	}

	parseFile(fp, logList);

	while(runFlag == TRUE) {
		promptUsage();
		scanf("%d", &option);
		while(getchar() != '\n');

		while(validateOption(option, 5) == FALSE) {
			printf(">> SELECT OPTION[1 - 5]: ");
			scanf("%d", &option);
			while(getchar() != '\n');
		}

		executeOption(option, *logList, fileName);
	}

	freeLogList(logList);
	free(logList);
	return 0;
}