void	win_char_editor::file_save_as()
{
	QString new_file;
	if (never_saved)
		new_file = save_chr(this, "");
	else
		new_file = save_chr(this, file);
	if (!new_file.isEmpty())
		{
		file_s(new_file);
		}
}
Esempio n. 2
0
/*
 * main
 */
int
main(int argc, char **argv)
{
	struct prog_opts prog_opts;
	int i;
	struct image curr_img;

	/* configure defaults */
	prog_opts.verbose_fl=0;
	prog_opts.tile_w=DEFAULT_W;
	prog_opts.tile_h=DEFAULT_H;
	prog_opts.out_bpp=DEFAULT_BPP;
	prog_opts.out_filename=DEFAULT_OUTFILE;

	/* load command-line configuration */
	if (!parse_args(&prog_opts, argc, argv))
	{
		return EXIT_FAILURE;
	}

	TRACE("opts: %ux%u@%u '%s'\n", prog_opts.tile_w, prog_opts.tile_h, prog_opts.out_bpp, prog_opts.out_filename);

	if (optind >= argc)
	{
		usage();
		return EXIT_FAILURE;
	}

	if (optind+1 != argc)
	{
		fprintf(stderr, "Currently only supports exactly 1 input filename.\n");
		usage();
		return EXIT_FAILURE;
	}

	for (i=optind; i<argc; i++)
	{
		if (!load_png(argv[i], &curr_img))
		{
			fprintf(stderr, "Could not load image '%s'\n", argv[i]);
			return EXIT_FAILURE;
		}
		if (!save_chr(prog_opts.out_filename, &curr_img, prog_opts.tile_w, prog_opts.tile_h))
		{
			fprintf(stderr, "Could not save image '%s'\n", prog_opts.out_filename);
			return EXIT_FAILURE;
		}
		image_destroy(&curr_img);
	}

	return EXIT_SUCCESS;
}