示例#1
0
docstring GuiBibitem::dialogToParams() const
{
	InsetCommandParams params(insetCode());
	params["key"] = qstring_to_ucs4(keyED->text());
	params["label"] = qstring_to_ucs4(labelED->text());
	return from_utf8(InsetCommand::params2string(params));
}
示例#2
0
void GuiSearch::replaceallClicked()
{
	replace(qstring_to_ucs4(findCO->currentText()),
		qstring_to_ucs4(replaceCO->currentText()),
		caseCB->isChecked(), wordsCB->isChecked(), true, true);
	uniqueInsert(findCO, findCO->currentText());
	uniqueInsert(replaceCO, replaceCO->currentText());
}
示例#3
0
文件: GuiNomencl.cpp 项目: bsjung/Lyx
void GuiNomenclature::applyView()
{
	params_["prefix"] = qstring_to_ucs4(prefixED->text());
	params_["symbol"] = qstring_to_ucs4(symbolED->text());
	QString description = descriptionTE->toPlainText();
	description.replace('\n',"\\\\");
	params_["description"] = qstring_to_ucs4(description);
}
示例#4
0
void GuiSearch::replaceClicked()
{
	docstring const needle = qstring_to_ucs4(findCO->currentText());
	docstring const repl = qstring_to_ucs4(replaceCO->currentText());
	replace(needle, repl, caseCB->isChecked(), wordsCB->isChecked(),
		!backwardsCB->isChecked(), false);
	uniqueInsert(findCO, findCO->currentText());
	uniqueInsert(replaceCO, replaceCO->currentText());
}
示例#5
0
docstring GuiNomenclature::dialogToParams() const
{
	InsetCommandParams params(insetCode());
	params["prefix"] = qstring_to_ucs4(prefixED->text());
	params["symbol"] = qstring_to_ucs4(symbolED->text());
	QString description = descriptionTE->toPlainText();
	description.replace('\n',"\\\\");
	params["description"] = qstring_to_ucs4(description);
	return from_utf8(InsetNomencl::params2string(params));
}
示例#6
0
docstring GuiBibitem::dialogToParams() const
{
	InsetCommandParams params(insetCode());
	QString label = labelED->text();
	if (!yearED->isHidden())
		label += "(" + yearED->text() + ")" + allAuthorsED->text();
	params["key"] = qstring_to_ucs4(keyED->text());
	params["label"] = qstring_to_ucs4(label);
	params["literal"] = literalCB->isChecked()
			? from_ascii("true") : from_ascii("false");
	return from_utf8(InsetCommand::params2string(params));
}
示例#7
0
文件: Validator.cpp 项目: bsjung/Lyx
QValidator::State PathValidator::validate(QString & qtext, int &) const
{
	if (!latex_doc_)
		return QValidator::Acceptable;

	docstring const text = support::trim(qstring_to_ucs4(qtext));
	if (text.empty())
		return acceptable_if_empty_ ?
			QValidator::Acceptable : QValidator::Intermediate;

	docstring invalid_chars = from_ascii("#$%{}()[]\"^");
	if (!tex_allows_spaces_)
		invalid_chars += ' ';

	if (text.find_first_of(invalid_chars) != docstring::npos) {

		static int counter = 0;
		if (counter == 0) {
			Alert::error(_("Invalid filename"),
				     _("LyX does not provide LaTeX support for file names containing any of these characters:\n") +
					 printable_list(invalid_chars));
		}
		++counter;
		return QValidator::Intermediate;
	}

	return QValidator::Acceptable;
}
示例#8
0
docstring GuiHyperlink::dialogToParams() const
{
	InsetCommandParams params(insetCode());

	params["target"] = qstring_to_ucs4(targetED->text());
	params["name"] = qstring_to_ucs4(nameED->text());
	if (webRB->isChecked())
		params["type"] = from_utf8("");
	else if (emailRB->isChecked())
		params["type"] = from_utf8("mailto:");
	else if (fileRB->isChecked())
		params["type"] = from_utf8("file:");
	params["literal"] = literalCB->isChecked()
			? from_ascii("true") : from_ascii("false");
	params.setCmdName("href");
	return from_utf8(InsetHyperlink::params2string(params));
}
示例#9
0
void GuiSearch::findClicked()
{
	docstring const needle = qstring_to_ucs4(findCO->currentText());
	find(needle, caseCB->isChecked(), wordsCB->isChecked(),
		!backwardsCB->isChecked());
	uniqueInsert(findCO, findCO->currentText());
	findCO->lineEdit()->selectAll();
}
示例#10
0
void GuiPrintNomencl::applyView()
{
	docstring const set_width = qstring_to_ucs4(setWidthCO->itemData(
		setWidthCO->currentIndex()).toString());
	params_["set_width"] = set_width;
	docstring width;
	if (set_width == from_ascii("custom"))
		width = from_utf8(widgetsToLength(valueLE, unitLC));
	params_["width"] = width;
}
示例#11
0
/** \returns the equivalent of the string passed in
 *  although any brace expressions are expanded.
 *  (E.g. "*.{png,jpg}" -> "*.png *.jpg")
 */
QStringList fileFilters(QString const & desc)
{
	// we have: "*.{gif,png,jpg,bmp,pbm,ppm,tga,tif,xpm,xbm}"
	// but need:  "*.cpp;*.cc;*.C;*.cxx;*.c++"
	FileFilterList filters(qstring_to_ucs4(desc));
	//LYXERR0("DESC: " << desc);
	QStringList list;
	for (size_t i = 0; i != filters.filters_.size(); ++i) {
		QString f = filters.filters_[i].toString();
		//LYXERR0("FILTER: " << f);
		list.append(f);
	}
	return list;
}
示例#12
0
docstring const internalLineEnding(QString const & str)
{
	docstring const s = subst(qstring_to_ucs4(str), 
				  from_ascii("\r\n"), from_ascii("\n"));
	return subst(s, '\r', '\n');
}