コード例 #1
0
ファイル: options.c プロジェクト: mkroli/abook
static int
check_options()
{
	char *str;
	int err = 0;

	str = opt_get_str(STR_PRESERVE_FIELDS);
	if(strcasecmp(str, "all") && strcasecmp(str, "none") &&
			strcasecmp(str, "standard")) {
		fprintf(stderr, _("valid values for the 'preserve_fields' "
					"option are 'all', 'standard' "
					"(default), and 'none'\n"));
		restore_default(&abook_vars[STR_PRESERVE_FIELDS]);
		err++;
	}
	str = opt_get_str(STR_ADDRESS_STYLE);
	if(strcasecmp(str, "eu") && strcasecmp(str, "uk") &&
			strcasecmp(str, "us")) {
		fprintf(stderr, _("valid values for the 'address_style' "
					"option are 'eu' (default), 'uk', "
					"and 'us'\n"));
		restore_default(&abook_vars[STR_ADDRESS_STYLE]);
		err++;
	}

	return err;
}
コード例 #2
0
ファイル: service.cpp プロジェクト: lindianyin/testboost
int  service_config::load_from_file()
{
	xml_doc doc;
	if (!doc.parse_from_file("173.xml")){
		restore_default();
		save_default();
	}
	else{
		READ_XML_VALUE("config/", db_port_								);
		READ_XML_VALUE("config/", db_host_								);
		READ_XML_VALUE("config/", db_user_								);
		READ_XML_VALUE("config/", db_pwd_									);
		READ_XML_VALUE("config/", db_name_								);
		READ_XML_VALUE("config/", client_port_						);
		READ_XML_VALUE("config/", php_sign_key_						);
		READ_XML_VALUE("config/", accdb_port_							);
		READ_XML_VALUE("config/", accdb_host_							);
		READ_XML_VALUE("config/", accdb_user_							);
		READ_XML_VALUE("config/", accdb_pwd_							);
		READ_XML_VALUE("config/", accdb_name_							);
		READ_XML_VALUE("config/", cache_ip_								);
		READ_XML_VALUE("config/", cache_port_							);
		READ_XML_VALUE("config/", slave_cache_ip_					);
		READ_XML_VALUE("config/", slave_cache_port_				);
		READ_XML_VALUE("config/", alert_email_set_				);
	}
	return ERROR_SUCCESS_0;
}
コード例 #3
0
ファイル: options.c プロジェクト: mkroli/abook
void
init_opts()
{
	int i;

	for(i = 0; abook_vars[i].option; i++)
		restore_default(&abook_vars[i]);
}
コード例 #4
0
ファイル: signal.cpp プロジェクト: fuxiang90/fawkes
/** Unregister a SignalHandler for a signal
 * @param handler The SignalHandler you want to unregister, will unregister
 *                all signals this handler was registered for
 */
void
SignalManager::unregister_handler(SignalHandler *handler)
{

  for (unsigned int i = 0; i < NSIG; ++i) {
    if ( __signal_handlers[i] == handler ) {
      restore_default(i);
    }
  }
}
コード例 #5
0
ファイル: signal.cpp プロジェクト: fuxiang90/fawkes
/** Finalize (and free) the SignalManager instance, this does NOT
 * implicitly delete the signal handlers, you have to do this by yourself
 */
void
SignalManager::finalize()
{
  if ( __instance != NULL ) {
    for (unsigned int i = 0; i < NSIG; ++i) {
      restore_default(i);
    }
    delete __instance;
    __instance = NULL;
  }
}
コード例 #6
0
/**
 * @brief Creates a settings dialog.
 * @param parent Parent widget or nullptr.
 */
SettingsDialog::SettingsDialog(QWidget *parent) :
  QDialog(parent) {

  ui.setupUi(this);

  ui.quest_size_field->config("x", 0, 99999, 80);
  ui.map_grid_size_field->config("x", 8, 99999, 8);
  ui.sprite_grid_size_field->config("x", 8, 99999, 8);

  reset();

  connect(ui.button_box->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
          this, SLOT(reset()));
  connect(ui.button_box->button(QDialogButtonBox::RestoreDefaults),
          SIGNAL(clicked()), this, SLOT(restore_default()));
  connect(ui.button_box->button(QDialogButtonBox::Apply), SIGNAL(clicked()),
          this, SLOT(apply()));

  // General.
  connect(ui.working_directory_field, SIGNAL(textChanged(QString)),
          this, SLOT(change_working_directory()));
  connect(ui.working_directory_button, SIGNAL(clicked()),
          this, SLOT(browse_working_directory()));
  connect(ui.no_audio_field, SIGNAL(toggled(bool)),
          this, SLOT(change_no_audio()));
  connect(ui.video_acceleration_field, SIGNAL(toggled(bool)),
          this, SLOT(change_video_acceleration()));
  connect(ui.win_console_field, SIGNAL(toggled(bool)),
          this, SLOT(change_win_console()));
  connect(ui.quest_size_check_box, SIGNAL(toggled(bool)),
          this, SLOT(change_quest_size()));
  connect(ui.quest_size_field, SIGNAL(value_changed(int,int)),
          this, SLOT(change_quest_size()));

  // Text editor.
  connect(ui.font_family_field, SIGNAL(currentTextChanged(QString)),
          this, SLOT(change_font_family()));
  connect(ui.font_size_field, SIGNAL(valueChanged(int)),
          this, SLOT(change_font_size()));
  connect(ui.tab_length_field, SIGNAL(valueChanged(int)),
          this, SLOT(change_tab_length()));
  connect(ui.replace_tab_by_spaces, SIGNAL(toggled(bool)),
          this, SLOT(change_replace_tab_by_spaces()));

  // Map editor.
  connect(ui.map_background_field, SIGNAL(color_changed(QColor)),
          this, SLOT(change_map_background()));
  connect(ui.map_grid_show_at_opening_field, SIGNAL(clicked()),
          this, SLOT(change_map_grid_show_at_opening()));
  connect(ui.map_grid_size_field, SIGNAL(value_changed(int,int)),
          this, SLOT(change_map_grid_size()));
  connect(ui.map_grid_style_field, SIGNAL(currentIndexChanged(int)),
          this, SLOT(change_map_grid_style()));
  connect(ui.map_grid_color_field, SIGNAL(color_changed(QColor)),
          this, SLOT(change_map_grid_color()));

  // Sprite editor.
  connect(ui.sprite_main_background_field, SIGNAL(color_changed(QColor)),
          this, SLOT(change_sprite_main_background()));
  connect(ui.sprite_grid_show_at_opening_field, SIGNAL(clicked()),
          this, SLOT(change_sprite_grid_show_at_opening()));
  connect(ui.sprite_grid_size_field, SIGNAL(value_changed(int,int)),
          this, SLOT(change_sprite_grid_size()));
  connect(ui.sprite_grid_style_field, SIGNAL(currentIndexChanged(int)),
          this, SLOT(change_sprite_grid_style()));
  connect(ui.sprite_grid_color_field, SIGNAL(color_changed(QColor)),
          this, SLOT(change_sprite_grid_color()));
  connect(ui.sprite_auto_detect_grid_field, SIGNAL(clicked()),
          this, SLOT(change_sprite_auto_detect_grid()));
  connect(ui.sprite_previewer_background_field, SIGNAL(color_changed(QColor)),
          this, SLOT(change_sprite_previewer_background()));
  connect(ui.sprite_origin_show_at_opening_field, SIGNAL(clicked()),
          this, SLOT(change_sprite_origin_show_at_opening()));
  connect(ui.sprite_origin_color_field, SIGNAL(color_changed(QColor)),
          this, SLOT(change_sprite_origin_color()));
}
コード例 #7
0
ファイル: zeus.c プロジェクト: IngenicC/u-boot
int do_chkreset(cmd_tbl_t* cmdtp, int flag, int argc, char * const argv[])
{
	int delta;
	int count = 0;
	int post = 0;
	int factory_reset = 0;

	if (!sw_reset_pressed()) {
		printf("SW-Reset already high (Button released)\n");
		printf("-> No action taken!\n");
		return 0;
	}

	printf("Waiting for SW-Reset button to be released.");

	while (1) {
		delta = get_timer(start_time);
		if (!sw_reset_pressed())
			break;

		if ((delta > CONFIG_SYS_TIME_POST) && !post) {
			printf("\nWhen released now, POST tests will be started.");
			gpio_write_bit(CONFIG_SYS_GPIO_LED_GREEN, 0);
			post = 1;
		}

		if ((delta > CONFIG_SYS_TIME_FACTORY_RESET) && !factory_reset) {
			printf("\nWhen released now, factory default values"
			       " will be restored.");
			gpio_write_bit(CONFIG_SYS_GPIO_LED_RED, 0);
			factory_reset = 1;
		}

		udelay(1000);
		if (!(count++ % 1000))
			printf(".");
	}


	printf("\nSW-Reset Button released after %d milli-seconds!\n", delta);

	if (delta > CONFIG_SYS_TIME_FACTORY_RESET) {
		printf("Starting factory reset value restoration...\n");

		/*
		 * Restore default setting
		 */
		restore_default();

		/*
		 * Reset the board for default to become valid
		 */
		do_reset(NULL, 0, 0, NULL);

		return 0;
	}

	if (delta > CONFIG_SYS_TIME_POST) {
		printf("Starting POST configuration...\n");

		/*
		 * Enable POST upon next bootup
		 */
		out_be32((void *)CONFIG_SYS_POST_MAGIC, REBOOT_MAGIC);
		out_be32((void *)CONFIG_SYS_POST_VAL, REBOOT_DO_POST);
		post_bootmode_init();

		/*
		 * Reset the logbuffer for a clean start
		 */
		logbuff_reset();

		do_reset(NULL, 0, 0, NULL);

		return 0;
	}

	return 0;
}
コード例 #8
0
ファイル: signal.cpp プロジェクト: fuxiang90/fawkes
/** Unregister a SignalHandler for a signal
 * @param signum The signal number from <signal.h>
 */
void
SignalManager::unregister_handler(int signum)
{
  restore_default(signum);
}