void LabelPointsBySectionImageToolBoxAction::createMainCommandWidget()
{
    QVBoxLayout *vb=new QVBoxLayout();

    select = new QPushButton("Select Point");
    select->setCheckable(true);
    connect(select,SIGNAL(toggled(bool)),this,SLOT(selectionPointButtonClick(bool)));

    vb->addWidget(select);

    QHBoxLayout *hb=new QHBoxLayout();

    QPushButton *updatePB = new QPushButton("update");
    connect(updatePB,SIGNAL(clicked()),this,SLOT(updateData()));
    QPushButton *reloadPB = new QPushButton("reload");
    connect(reloadPB,SIGNAL(clicked()),this,SLOT(reloadData()));
    QPushButton *loadfilePB = new QPushButton("load file");
    connect(loadfilePB,SIGNAL(clicked()),this,SLOT(loadFileData()));
    QPushButton *savefilePB = new QPushButton("save file");
    connect(savefilePB,SIGNAL(clicked()),this,SLOT(saveFileData()));

    hb->addWidget(updatePB);
    hb->addWidget(reloadPB);
    hb->addWidget(loadfilePB);
    hb->addWidget(savefilePB);

    vb->addLayout(hb);

    QGroupBox *gb = new QGroupBox("Main Commands");

    gb->setLayout(vb);

    this->addWidget(gb);
}
Example #2
0
/*++
********************************************************************************
                                                                            
 FUNCTION:

 DESCRIPTION:

 ARGUMENTS:

 RETURNS:

********************************************************************************
--*/
int fNext(FINDHANDLE handle, FINDDATA *finddata)
{
struct dirent *dirEntry;
struct stat statEntry;
	if (!handle) return 0;

	for (dirEntry = readdir(handle);dirEntry;dirEntry = readdir(handle))
    if (fMatchs(finddata->pattern,dirEntry->d_name))
	{
        strcpy(finddata->name, dirEntry->d_name);
        stat(finddata->name, &statEntry);
        switch (dirEntry->d_type) {
        case DT_DIR:
            finddata->attrib = FILE_ATTR_DIRECTORY;
            break;
        case DT_SOCK:
            finddata->attrib = FILE_ATTR_SOCK;
            break;
        case DT_LNK:
            finddata->attrib = FILE_ATTR_LINK;
            break;
        case DT_REG:
        default:
            finddata->attrib = 0;
            break;
        }
        saveFileData(statEntry, finddata);
        return 1;
    }
    return 0;
}
Example #3
0
//The primary conroller for the game. Using the progress value passed in,
//the function knows what the current stat of the game is. Currently, there
//is nothing after progress value = 3, and the game isn't saved after the fight
//ends, but this can be changed/expanded
void playGame(Hero* heroes, char* playerName, Boss* boss, int progress, int choice)
{

	//Added flavor 
	if(progress > 0)
	{
		printf("\nWelcome back %s.\n\n", playerName);
	}

	//holds what the last thing done was.
	int initialprogress = progress;

	Hero* chosenHeroes;
	Shop* s;
	//another check for how the data is laid out. This is so we can immediately print out
	//heroes if we have already selected heroes. 
	if(progress > 1)
	{
		chosenHeroes = heroes;
	}	
	
	switch(progress)
	{
		//initial player identification
		case 0:
			playerName = getPlayerName();
			choice = chooseSaveFile();
			saveFileData(choice, choiceToFile(choice-1), NULL, playerName, 1);
		//hero selection
		case 1:
			chosenHeroes = pickHeroes(heroes);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 2);
			free(heroes);
		//equip heroes with items 
		case 2:
			//shop
			s = loadShop();
			goShopping(chosenHeroes, s);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 3);
		//fight the boss (a boss? Maybe find some way to get more than one boss in there?)
		case 3: 
			boss = loadBoss();
			int result = fight(boss, chosenHeroes);
			result == 0 ? printf("You won! Congrats!\n") : printf("Oh no, you lost! Reload to try again.\n");
			//If you're in here, it's probably to delete this line first
			printf("\n\n**********CONGRATS! YOU MADE IT TO THE END OF 2050!*************\n\n");
			freeHeroesAndItems(chosenHeroes);
			freeBossTree(boss->root);
			free(boss);
			break;
		default:
			//What?
			printf("Something fatal happened with the progress value. Check gamestate.txt.\n");
			break;
	}
	

	//I don't actually remember why I did this, but it works. 
	//I think because if it's a save file, it's freed elsewhere?
	if(initialprogress == 0)
	{
		free(playerName);
	}
	return;
}
Example #4
0
int main(int argc, char **argv)
{
	if(argc<2) {
		printf(	"MAUtil::MAFS Bundle tool\n\n"
				"This tool is used to build a binary image of a folder on a desktop computer.\n\n"
				"Usage:\n"
				"bundle <parameters>\n\n"
				"Parameters:\n"
				"  -in <input file or folder> the input files or folders to add to the\n" 
				"                             image (multiple -in directives may be added).\n"
				"  -out <output file>         the name of the image to be created (only one).\n"
				"  -toUpper/-toLower          change case of all file names to upper or lower\n"
				"                             case.\n\n"
				"Example:\n"
				"  bundle -in data -out anotherworld.bun -toLower\n"
				);
	}

	for(int i = 1; i < argc; i++) {
		if(strcmp(argv[i], "-in")==0) {
			i++;
			if(i>=argc) {
				printf("not enough parameters for -in");			
				return 1;
			}
			inFiles.push_back(argv[i]);
		}
		else if(strcmp(argv[i], "-out")==0) {
			if(outFile) {
				printf("cannot have multiple out files.");
				return 1;
			}

			i++;
			if(i>=argc) {
				printf("not enough parameters for -out");			
				return 1;
			}
			outFile = fopen(argv[i], "wb");
		}
		else if(strcmp(argv[i], "-toUpper")==0) {
			changeCase = 1;
		}
		else if(strcmp(argv[i], "-toLower")==0) {
			changeCase = 2;
		} else {
			printf("invalid argument");
			return 1;
		}
	}
	if(inFiles.size()==0) return 1;
	if(!outFile) return 1;

	VolumeEntry* root = new VolumeEntry;
	root->name = "Root";
	root->type = 0; // directory

	for(size_t i = 0; i < inFiles.size(); i++) {
		File file(inFiles[i]);
		if(file.isDirectory()) {
			parseDirectory(file, root);
		} else {
			VolumeEntry *child = new VolumeEntry;
			root->children.push_back(child);
			parse(file, child);
		}
	}

	fseek(outFile, START_OF_VOLUME_ENTRIES, SEEK_SET);
	saveVolumeEntries(root);
	saveFileData();
	writeHeader();
	fclose(outFile);
	
	return 0;
}
Example #5
0
void playGame(Hero* heroes, char* playerName, Boss* boss, int progress, int choice)
{

	//Added flavor 
	if(progress > 0)
	{
		printf("\nWelcome back %s.\n\n", playerName);
	}

	//holds what the last thing done was.
	int initialprogress = progress;

	Hero* chosenHeroes;
	Shop* s;
	//another check for how the data is laid out. This is so we can immediately print out
	//heroes if we have already selected heroes. 
	if(progress > 1)
	{
		chosenHeroes = heroes;
	}	
	
	switch(progress)
	{
		//initial player identification
		case 0:
			playerName = getPlayerName();
			choice = chooseSaveFile();
			saveFileData(choice, choiceToFile(choice-1), NULL, playerName, 1);
		//hero selection
		case 1:
			chosenHeroes = pickHeroes(heroes);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 2);
			free(heroes);
		//equip heroes with items 
		case 2:
			//shop
			s = loadShop();
			//Maybe?
			//testShop(s);
			goShopping(chosenHeroes, s);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 3);
		//fight the boss (a boss? Maybe find some way to get more than one boss in there?)
		case 3: 
			printHeroes(chosenHeroes, NUMCHOSENHEROES);
			freeHeroesAndItems(chosenHeroes);
			//fight	
			break;
		default:
			//What?
			printf("Something fatal happened with the progress value. Check gamestate.txt.\n");
			break;
	}
	
	printf("\n\n**********Until Next Homework!*************\n\n");

	//I don't actually remember why I did this, but it works. 
	//I think because if it's a save file, it's freed elsewhere?
	if(initialprogress == 0)
	{
		free(playerName);
	}
	return;
}