Пример #1
0
AboutWindow::AboutWindow()
{
    typedef std::vector<Glib::ustring>	UStringList;
    moApplicationSPtr application( moApplication::Instance() );

#if defined(DEMO_VERSION) || defined(BETA_VERSION)
	set_name( (application->GetName() + moWCString(" Demo")).c_str() );
#else
	set_name( application->GetName().c_str() );
#endif

	set_version( (application->GetVersion() + "." BUILD_VERSION_STRING).c_str() );
	set_website( WEBSITE_URL );
	set_translator_credits( gettext("translator-credits") );

	const char* comments =																																																										
		"A Dungeon Master's Initiative Manager\n\n"
#if defined(DEMO_VERSION)
		"This version of Turn Watcher is a demonstration version only.\n\n"
#elif defined(BETA_VERSION)
		"This version of Turn Watcher is a beta version for demonstration purposes only, "
		"and is intended solely for registered beta testers. "
		"If you are not a registered beta tester, please uninstall this application and contact "
		"Made to Order Software Corporation to purchase a licensed copy.\n\n"
#endif
		"Uses Gtk+ 2.15, Gtkmm 2.12, iconv, intl, PNG and zlib.\n"
		"Licensed under the GNU Public License v2.\n"
		"https://sourceforge.net/projects/turnwatcher/\n"
		;

// TODO: we need to fix the comment for demo versions to work properly
#if defined(DEMO_VERSION) || defined(BETA_VERSION)
	set_comments( comments );
#else
	set_comments( gettext(comments) );
#endif

    UStringList	authors;
	authors.push_back( "R. Douglas Barbieri" );
	authors.push_back( "Alexis Wilke" );
	set_authors( authors );

    UStringList artists;
	artists.push_back( "Nikolai Lokteff" );
	set_artists( artists );

	// no gettext() for this one, doesn't need translation
	set_copyright( "Copyright (c) 2005-2013 Made to Order Software Corporation" );

	//set_license( gettext(product_license) );

	moWCString logopath( Common::GetFullPathnameForImage( ABOUT_IMAGE ) );
	if( logopath != "" )
	{
		Glib::RefPtr<Gdk::Pixbuf> logo = Gdk::Pixbuf::create_from_file( logopath.c_str() );
		set_logo( logo );
	}
}
Пример #2
0
AboutDialog::AboutDialog(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade) :
Gtk::AboutDialog(cobject),
m_refGlade(refGlade) {
#ifdef WIN32
	Glib::RefPtr<Gdk::Pixbuf> logo = Aeskulap::IconFactory::load_from_file("aeskulap.png");
	if(logo) {
			set_logo(logo);
	} 
#else
	set_logo_icon_name("aeskulap");
#endif

	set_version(VERSION);
}
Пример #3
0
int read_config_file(char *config_filename)
{
	FILE *fd;
	char *p;
	char textline[LINEBUFFER];
	int ret;

	if ((fd = fopen(config_filename, "r")) == NULL)
		return 1;

	while (fgets(textline, LINEBUFFER - 1, fd) != NULL) {
		/* We ignore blank lines and comments */
		if (textline[0] == '\n' || textline[0] == '#')
			continue;	

		p = strtok(textline, " \t\n");

		if (strncasecmp("server", p, 4) == 0) {
			int ret;
			p = strtok(NULL, " \t\n");
			ret = set_server(p);
			if (ret) {
				/* error */
				fflush(stderr);
				fflush(stdout);
				fprintf(stderr, "Server IP unknown.\n");
				exit(1);
			}
		} else if (strncasecmp("logfile", p, 7) == 0) {
			p = strtok(NULL, " \t\n");
			open_log(p);
		} else if (strncasecmp("background", p, 10) == 0) {
			p = strtok(NULL, " \t\n");
			set_background(p);
		} else if (strncasecmp("logo", p, 4) == 0) {
			p = strtok(NULL, " \t\n");
			set_logo(p);
		} else if (strncasecmp("foreground", p, 10) == 0) {
			p = strtok(NULL, " \t\n");
			set_foreground(p);
		} else if (strncasecmp("port", p, 4) == 0) {
			p = strtok(NULL, " \t\n");
			set_listen_port(p);
		}
	}
	ret = fclose(fd);
	return ret;

}
Пример #4
0
/**
 * Construct the (Singleton) about dialogue.
 *
 * @return a pointer to the (Singleton) about dialogue.
 */
Gtk::AboutDialog * About::create() {
	auto about = new Gtk::AboutDialog;
	std::vector<Glib::ustring> authors;
	authors.push_back("Michael Lamothe <*****@*****.**>");
	authors.push_back("Russel Winder <*****@*****.**>");
	//std::vector<Glib::ustring> documentors;
	about->set_authors(authors);
	about->set_comments(APPLICATION_NAME " is a Digital Television (DVB) viewer for GTK+3.");
	about->set_copyright(u8"Copyright © 2010–2011 Michael Lamothe <[email protected]\nCopyright © 2014, 2016	Russel Winder <*****@*****.**>");
	//about->set_documenters(documentors);
	about->set_license("This program is licenced under GNU General Public Licence (GPL) version 3.");
	about->set_logo(Gdk::Pixbuf::create_from_resource("/me-tv/images/me-tv.png"));
	about->set_name(APPLICATION_NAME);
	about->set_translator_credits("Translator Credits");
	about->set_version(VERSION);
	return about;
}
Пример #5
0
        MyAboutDialog(): Gtk::AboutDialog(),m_link(PACKAGE_URL,PACKAGE_URL){
            set_version(PACKAGE_VERSION);
            std::vector<Glib::ustring> authors;
            authors.push_back("Quentin Geissmann<*****@*****.**>");
            set_authors(authors);
            set_license("GPL_3_0");
            set_copyright("Quentin Geissmann 2012-2013");

            #if defined _WIN64 || defined _WIN32

            std::stringstream ss;
            ss<<ABOUT_TEXT<<std::endl<<PACKAGE_URL;
            set_comments(ss.str());
            #else
            set_website(PACKAGE_URL);
            set_website_label("Website");
            set_comments(ABOUT_TEXT);
            #endif

        set_logo(Gui_PixbufOpener::pixbufOpen(LOGO_IMG));

        }
Пример #6
0
int main(int argc, char *argv[])
{
	/* getopt */
	int next_option;

	int ret;
	int will_block = 0;

	/*! short options. See man getopt */
	const char *const short_options = "hc:l:L:b:f:xp:s:";
	/*! the array for the long options. */
	const struct option long_options[] = {
		{"help", 0, NULL, 'h'},
		{"config", 1, NULL, 'c'},
		{"logfile", 1, NULL, 'L'},
		{"background", 1, NULL, 'b'},
		{"foreground", 1, NULL, 'f'},
		{"logo", 1, NULL, 'l'},
		{"blocked", 0, NULL, 'x'},
		{"port", 1, NULL, 'p'},
		{"server", 1, NULL, 's'},
		{NULL, 0, NULL, 0}
	};

	/* Initializing exit function */
	if (atexit(f_atexit) != 0) {
		fprintf(stderr, "failed to register f_atexit() exit function\n");
		exit(EXIT_FAILURE);
	}
	if (signal(SIGINT, sig_ctrlc) == SIG_ERR) {
		fprintf(stderr, "Warning - Could not set CTRL-C handler\n");
	}

	/* First, set defaults */
	set_listen_port(PORT);
	set_foreground(FOREGROUND_IMAGE);
	set_logo(LOGO_IMAGE);
	/* Second, read entries from default config file. 
	 * They will eventually be replaced by command line settings. */
	read_config_file(CONFIGFILE);

	/* Then, overwrite with command line options... */
	do {
		next_option = getopt_long(argc, argv, short_options, long_options, NULL);
		switch (next_option) {
		case 'h':	/* -h or --help */
			print_usage();
			exit(1);

		case 'c':/* -c or --config */
			/* Things like "mdclient -p 7000 -c /etc/mymedusa.conf" 
			 * when port is set to a different value in /etc/mymedusa.conf
			 * may result in an unpredictable value for listen_port. Just don't do that. */
			read_config_file(strdup(optarg));
			break;

		case 'p': /* -p or --port */
			set_listen_port(strdup(optarg));
			break;

		case 'x': /* -x or --blocked */
			will_block = 1;
			break;

		case 'b': /* -b or --background */
			set_background(strdup(optarg));
			break;

		case 'l': /* -l or --logo */
			set_logo(strdup(optarg));
			break;

		case 'f': /* -f or --foreground */
			set_foreground(strdup(optarg));
			break;

		case 'L': /* -L or --logfile */
			close_log();
			open_log(strdup(optarg));
			break;
		case 's': /* -s or --server */
			ret = set_server(strdup(optarg));
			if (ret) {
				/* error */
				fflush(stderr);
				fflush(stdout);
				fprintf(stderr, "Server IP unknown.\n");
				exit(1);
			}
			break;

		case '?':/* The user specified an invalid option */
			/* Write usage info on the screen   */
			print_usage();
			exit(1);

		case -1: /* No more options */
			break;

		default: /* Garbage */
			abort();
		}
 } while (next_option != -1);

 if (will_block) {
  if (lockScreen() < 0) {
   write_log_fmt("Could not open display.\n");
			exit(EXIT_FAILURE);
		}
	}
				
	write_log_fmt("Starting...\n");
	listen_network();
	close_log();
	return 0;
}