Ejemplo n.º 1
0
void ZLBooleanOption::setValue(bool value) {
	if (myIsSynchronized && (myValue == value)) {
		return;
	}
	myValue = value;
	myIsSynchronized = true;
	if (myValue == myDefaultValue) {
		unsetConfigValue();
	} else {
		setConfigValue(booleanToString(myValue));
	}
}
Ejemplo n.º 2
0
void XMLUtility::write(QXmlStreamWriter& writer, const QRegExp& regExp, const QString& name)
{
  if (regExp.isEmpty() || !regExp.isValid() || name.length() == 0)
  {
    return;
  }

  writer.writeStartElement(name);
  writer.writeAttribute("IsMinimal", booleanToString(regExp.isMinimal()));
  writer.writeAttribute("CaseSensitive", caseToString(regExp.caseSensitivity()));
  writer.writeAttribute("PatternSyntax", getEnumMapper().PatternSyntaxToString(regExp.patternSyntax()));
  writer.writeCharacters(regExp.pattern());
  writer.writeEndElement();
}
Ejemplo n.º 3
0
extern bool ini_conf_save(p_conf conf)
{
	dictionary *dict;
	FILE *fp;
	char buf[PATH_MAX];
	int i;

	if (conf == NULL) {
		return false;
	}

	conf->confver = XREADER_VERSION_NUM;
	dict = dictionary_new(0);

	if (dict == NULL)
		return false;

	fp = fopen(conf_filename, "w");

	if (fp == NULL) {
		return false;
	}

	if (iniparser_setstring(dict, "Global", NULL) != 0)
		goto error;
	if (iniparser_setstring(dict, "UI", NULL) != 0)
		goto error;
	if (iniparser_setstring(dict, "Text", NULL) != 0)
		goto error;
	if (iniparser_setstring(dict, "Image", NULL) != 0)
		goto error;
	if (iniparser_setstring(dict, "Music", NULL) != 0)
		goto error;

	iniparser_setstring(dict, "Global:path", conf->path);
	iniparser_setstring(dict, "UI:forecolor",
						hexToString(buf, sizeof(buf), conf->forecolor));
	iniparser_setstring(dict, "Image:giftranscolor",
						hexToString(buf, sizeof(buf), conf->giftranscolor));
	iniparser_setstring(dict, "UI:bgcolor",
						hexToString(buf, sizeof(buf), conf->bgcolor));
	iniparser_setstring(dict, "UI:have_bg",
						booleanToString(buf, sizeof(buf), conf->have_bg));
	iniparser_setstring(dict, "UI:titlecolor",
						hexToString(buf, sizeof(buf), conf->titlecolor));
	iniparser_setstring(dict, "UI:menutextcolor",
						hexToString(buf, sizeof(buf), conf->menutextcolor));
	iniparser_setstring(dict, "UI:menubcolor",
						hexToString(buf, sizeof(buf), conf->menubcolor));
	iniparser_setstring(dict, "UI:selicolor",
						hexToString(buf, sizeof(buf), conf->selicolor));
	iniparser_setstring(dict, "UI:selbcolor",
						hexToString(buf, sizeof(buf), conf->selbcolor));
	iniparser_setstring(dict, "UI:msgbcolor",
						hexToString(buf, sizeof(buf), conf->msgbcolor));
	iniparser_setstring(dict, "UI:usedyncolor",
						booleanToString(buf, sizeof(buf), conf->usedyncolor));
	iniparser_setstring(dict, "Text:rowspace",
						dwordToString(buf, sizeof(buf), conf->rowspace));
	iniparser_setstring(dict, "Text:infobar",
						infobarToString(buf, sizeof(buf), conf->infobar));
	iniparser_setstring(dict, "Text:infobar_style",
						intToString(buf, sizeof(buf), conf->infobar_style));
	iniparser_setstring(dict, "Text:rlastrow",
						booleanToString(buf, sizeof(buf), conf->rlastrow));
	iniparser_setstring(dict, "Text:autobm",
						booleanToString(buf, sizeof(buf), conf->autobm));
	iniparser_setstring(dict, "Text:vertread",
						vertreadToString(buf, sizeof(buf), conf->vertread));
	iniparser_setstring(dict, "Text:encode",
						encodeToString(buf, sizeof(buf), conf->encode));
	iniparser_setstring(dict, "Image:fit",
						fitToString(buf, sizeof(buf), conf->fit));
	iniparser_setstring(dict, "Image:imginfobar",
						booleanToString(buf, sizeof(buf), conf->imginfobar));
	iniparser_setstring(dict, "Text:scrollbar",
						booleanToString(buf, sizeof(buf), conf->scrollbar));
	iniparser_setstring(dict, "Image:scale",
						dwordToString(buf, sizeof(buf), conf->scale));
	iniparser_setstring(dict, "Image:rotate",
						rotateToString(buf, sizeof(buf), conf->rotate));

	for (i = 0; i < 20; ++i) {
		char key[20];

		SPRINTF_S(key, "Text:txtkey1_%02d", i);
		iniparser_setstring(dict, key,
							hexToString(buf, sizeof(buf), conf->txtkey[i]));
		SPRINTF_S(key, "Image:imgkey1_%02d", i);
		iniparser_setstring(dict, key,
							hexToString(buf, sizeof(buf), conf->imgkey[i]));
	}
	iniparser_setstring(dict, "Global:shortpath", conf->shortpath);
	iniparser_setstring(dict, "Global:confver",
						hexToString(buf, sizeof(buf), conf->confver));
	iniparser_setstring(dict, "Image:bicubic",
						booleanToString(buf, sizeof(buf), conf->bicubic));
	iniparser_setstring(dict, "Text:wordspace",
						dwordToString(buf, sizeof(buf), conf->wordspace));
	iniparser_setstring(dict, "Text:borderspace",
						dwordToString(buf, sizeof(buf), conf->borderspace));
	iniparser_setstring(dict, "Global:lastfile", conf->lastfile);
	iniparser_setstring(dict, "Music:mp3encode",
						encodeToString(buf, sizeof(buf), conf->mp3encode));
	iniparser_setstring(dict, "Music:lyricencode",
						encodeToString(buf, sizeof(buf), conf->lyricencode));
	iniparser_setstring(dict, "Music:mp3cycle",
						cycleToString(buf, sizeof(buf), conf->mp3cycle));
	iniparser_setstring(dict, "Global:isreading",
						booleanToString(buf, sizeof(buf), conf->isreading));
	iniparser_setstring(dict, "UI:bgarch", conf->bgarch);
	iniparser_setstring(dict, "UI:bgfile", conf->bgfile);
	iniparser_setstring(dict, "UI:bgwhere",
						intToString(buf, sizeof(buf), conf->bgwhere));
	iniparser_setstring(dict, "Image:slideinterval",
						dwordToString(buf, sizeof(buf), conf->slideinterval));
	iniparser_setstring(dict, "Music:hprmctrl",
						booleanToString(buf, sizeof(buf), conf->hprmctrl));
	iniparser_setstring(dict, "UI:grayscale",
						intToString(buf, sizeof(buf), conf->grayscale));
	iniparser_setstring(dict, "Global:showhidden",
						booleanToString(buf, sizeof(buf), conf->showhidden));
	iniparser_setstring(dict, "Global:showunknown",
						booleanToString(buf, sizeof(buf), conf->showunknown));
	iniparser_setstring(dict, "Global:showfinfo",
						booleanToString(buf, sizeof(buf), conf->showfinfo));
	iniparser_setstring(dict, "Global:allowdelete",
						booleanToString(buf, sizeof(buf), conf->allowdelete));
	iniparser_setstring(dict, "Global:arrange",
						arrangeToString(buf, sizeof(buf), conf->arrange));
	iniparser_setstring(dict, "Global:enableusb",
						booleanToString(buf, sizeof(buf), conf->enableusb));
	iniparser_setstring(dict, "Image:viewpos",
						viewposToString(buf, sizeof(buf), conf->viewpos));
	iniparser_setstring(dict, "Image:imgmvspd",
						dwordToString(buf, sizeof(buf), conf->imgmvspd));
	iniparser_setstring(dict, "Image:imgpaging",
						imgpagingToString(buf, sizeof(buf), conf->imgpaging));
	iniparser_setstring(dict, "Image:imgpaging_spd",
						dwordToString(buf, sizeof(buf), conf->imgpaging_spd));
	iniparser_setstring(dict, "Image:imgpaging_interval",
						dwordToString(buf, sizeof(buf),
									  conf->imgpaging_interval));
	iniparser_setstring(dict, "Image:imgpaging_duration",
						dwordToString(buf, sizeof(buf),
									  conf->imgpaging_duration));
	for (i = 0; i < 20; ++i) {
		char key[20];

		SPRINTF_S(key, "Global:flkey1_%02d", i);
		iniparser_setstring(dict, key,
							hexToString(buf, sizeof(buf), conf->flkey[i]));
	}
	iniparser_setstring(dict, "UI:fontsize",
						intToString(buf, sizeof(buf), conf->fontsize));
	iniparser_setstring(dict, "Text:reordertxt",
						booleanToString(buf, sizeof(buf), conf->reordertxt));
	iniparser_setstring(dict, "Text:pagetonext",
						booleanToString(buf, sizeof(buf), conf->pagetonext));
	iniparser_setstring(dict, "Text:autopage",
						intToString(buf, sizeof(buf), conf->autopage));
	iniparser_setstring(dict, "Text:prev_autopage",
						intToString(buf, sizeof(buf), conf->prev_autopage));
	iniparser_setstring(dict, "Text:autopagetype",
						intToString(buf, sizeof(buf), conf->autopagetype));
	iniparser_setstring(dict, "Text:autolinedelay",
						intToString(buf, sizeof(buf), conf->autolinedelay));
	iniparser_setstring(dict, "Image:thumb",
						thumbToString(buf, sizeof(buf), conf->thumb));
	iniparser_setstring(dict, "Text:bookfontsize",
						intToString(buf, sizeof(buf), conf->bookfontsize));
	iniparser_setstring(dict, "Text:enable_analog",
						booleanToString(buf, sizeof(buf), conf->enable_analog));
	iniparser_setstring(dict, "Image:img_enable_analog",
						booleanToString(buf, sizeof(buf),
										conf->img_enable_analog));
	for (i = 0; i < 20; ++i) {
		char key[20];

		SPRINTF_S(key, "Text:txtkey2_%02d", i);
		iniparser_setstring(dict, key,
							hexToString(buf, sizeof(buf), conf->txtkey2[i]));
		SPRINTF_S(key, "Image:imgkey2_%02d", i);
		iniparser_setstring(dict, key,
							hexToString(buf, sizeof(buf), conf->imgkey2[i]));
		SPRINTF_S(key, "Global:flkey2_%02d", i);
		iniparser_setstring(dict, key,
							hexToString(buf, sizeof(buf), conf->flkey2[i]));
	}
	iniparser_setstring(dict, "Image:imgpagereserve",
						dwordToString(buf, sizeof(buf), conf->imgpagereserve));
	iniparser_setstring(dict, "Music:lyricex",
						dwordToString(buf, sizeof(buf), conf->lyricex));
	iniparser_setstring(dict, "Music:autoplay",
						booleanToString(buf, sizeof(buf), conf->autoplay));
	iniparser_setstring(dict, "Text:usettf",
						booleanToString(buf, sizeof(buf), conf->usettf));
	iniparser_setstring(dict, "Text:cttfarch", conf->cttfarch);
	iniparser_setstring(dict, "Text:cttfpath", conf->cttfpath);
	iniparser_setstring(dict, "Text:ettfarch", conf->ettfarch);
	iniparser_setstring(dict, "Text:ettfpath", conf->ettfpath);
	for (i = 0; i < 3; ++i) {
		char key[20];

		SPRINTF_S(key, "Global:freqs_%d", i);
		iniparser_setstring(dict, key,
							intToString(buf, sizeof(buf), conf->freqs[i]));
	}
	iniparser_setstring(dict, "Image:imgbrightness",
						intToString(buf, sizeof(buf), conf->imgbrightness));
	iniparser_setstring(dict, "Global:dis_scrsave",
						booleanToString(buf, sizeof(buf), conf->dis_scrsave));
	iniparser_setstring(dict, "Global:autosleep",
						intToString(buf, sizeof(buf), conf->autosleep));
	iniparser_setstring(dict, "Image:load_exif",
						booleanToString(buf, sizeof(buf), conf->load_exif));
	iniparser_setstring(dict, "Global:launchtype",
						intToString(buf, sizeof(buf), conf->launchtype));
	iniparser_setstring(dict, "Text:infobar_use_ttf_mode",
						booleanToString(buf, sizeof(buf),
										conf->infobar_use_ttf_mode));
	iniparser_setstring(dict, "Text:infobar_fontsize",
						dwordToString(buf, sizeof(buf),
									  conf->infobar_fontsize));
	iniparser_setstring(dict, "Image:no_repeat",
						booleanToString(buf, sizeof(buf), conf->img_no_repeat));

	iniparser_setstring(dict, "Global:hide_flash",
						booleanToString(buf, sizeof(buf), conf->hide_flash));

	iniparser_setstring(dict, "Text:tabstop",
						dwordToString(buf, sizeof(buf), conf->tabstop));

	iniparser_setstring(dict, "Music:apetagorder",
						booleanToString(buf, sizeof(buf), conf->apetagorder));

	iniparser_setstring(dict, "UI:language", conf->language);

	iniparser_setstring(dict, "UI:filelistwidth",
						intToString(buf, sizeof(buf), conf->filelistwidth));

	iniparser_setstring(dict, "Text:ttf_load_to_memory",
						booleanToString(buf, sizeof(buf),
										conf->ttf_load_to_memory));

	iniparser_setstring(dict, "Global:save_password",
						booleanToString(buf, sizeof(buf), conf->save_password));

	iniparser_setstring(dict, "Text:scrollbar_width",
						intToString(buf, sizeof(buf), conf->scrollbar_width));

	iniparser_setstring(dict, "Text:hide_last_row",
						booleanToString(buf, sizeof(buf), conf->hide_last_row));

	iniparser_setstring(dict, "Text:infobar_show_timer",
						booleanToString(buf, sizeof(buf),
										conf->infobar_show_timer));

	iniparser_setstring(dict, "Text:englishtruncate",
						booleanToString(buf, sizeof(buf),
										conf->englishtruncate));

	iniparser_setstring(dict, "Image:image_scroll_chgn_speed",
						booleanToString(buf, sizeof(buf),
										conf->image_scroll_chgn_speed));

	iniparser_setstring(dict, "Text:ttf_haste_up",
						booleanToString(buf, sizeof(buf), conf->ttf_haste_up));

	iniparser_setstring(dict, "Text:linenum_style",
						booleanToString(buf, sizeof(buf), conf->linenum_style));

	iniparser_setstring(dict, "Text:infobar_align",
						alignToString(buf, sizeof(buf), conf->infobar_align));

	iniparser_setstring(dict, "Music:musicdrv_opts", conf->musicdrv_opts);

	iniparser_setstring(dict, "Image:magnetic_scrolling",
						booleanToString(buf, sizeof(buf),
										conf->magnetic_scrolling));

	iniparser_setstring(dict, "Image:use_image_queue",
						booleanToString(buf, sizeof(buf),
										conf->use_image_queue));

	iniparser_setstring(dict, "Image:max_cache_img",
						dwordToString(buf, sizeof(buf), conf->max_cache_img));

	iniparser_setstring(dict, "Music:show_encoder_msg",
						booleanToString(buf, sizeof(buf),
										conf->show_encoder_msg));
	
	iniparser_dump_ini(dict, fp);

	fclose(fp);

	dictionary_del(dict);

	return true;
  error:
	if (fp != NULL)
		fclose(fp);
	return false;
}