Esempio n. 1
0
/** Convert relative path into absolute path based on a basepath.
  If relpath is absolute, just use that.
  If basepath doesn't exist use CWD.
  */
QString makeAbsPath(QString const & relpath, QString const & base)
{
	return toqstr(support::makeAbsPath(fromqstr(relpath),
		fromqstr(base)).absFileName());
}
Esempio n. 2
0
/** Add the extension \p ext to \p name.
 Use this instead of changeExtension if you know that \p name is without
 extension, because changeExtension would wrongly interpret \p name if it
 contains a dot.
 */
QString addExtension(QString const & name, QString const & ext)
{
	return toqstr(support::addExtension(fromqstr(name), fromqstr(ext)));
}
Esempio n. 3
0
/// Return the extension of the file (not including the .)
QString getExtension(QString const & name)
{
	return toqstr(support::getExtension(fromqstr(name)));
}
Esempio n. 4
0
QString changeExtension(QString const & oldname, QString const & ext)
{
	return toqstr(support::changeExtension(fromqstr(oldname), fromqstr(ext)));
}
Esempio n. 5
0
/// Remove the extension from \p name
QString removeExtension(QString const & name)
{
	return toqstr(support::removeExtension(fromqstr(name)));
}
Esempio n. 6
0
void GuiProgress::updateWithLyXErr()
{
    appendLyXErrMessage(toqstr(lyxerr_stream_.str()));
    lyxerr_stream_.str("");
}
Esempio n. 7
0
QString onlyPath(const QString & str)
{
	return toqstr(support::onlyPath(fromqstr(str)));
}
Esempio n. 8
0
QString const qt_(QString const & qstr)
{
	return toqstr(_(fromqstr(qstr)));
}
Esempio n. 9
0
QString internalPath(const QString & str)
{
	return toqstr(os::internal_path(fromqstr(str)));
}
Esempio n. 10
0
QString const qt_(char const * str, const char *)
{
	return toqstr(_(str));
}
Esempio n. 11
0
QString const qt_(string const & str)
{
	return toqstr(_(str));
}
Esempio n. 12
0
TempFile::TempFile(string const & mask)
{
	QFileInfo tmp_fi(QDir(toqstr(package().temp_dir().absoluteFilePath())), toqstr(mask));
	d = new Private(tmp_fi.absoluteFilePath());
}
Esempio n. 13
0
TempFile::TempFile(FileName const & temp_dir, string const & mask)
{
	QFileInfo tmp_fi(QDir(toqstr(temp_dir.absoluteFilePath())), toqstr(mask));
	d = new Private(tmp_fi.absoluteFilePath());
}
Esempio n. 14
0
QString Dialog::bufferFilePath() const
{
	return toqstr(buffer().filePath());
}
Esempio n. 15
0
void ShortcutWidget::removeFromSequence()
{
	keysequence_.removeKey();
	setText(toqstr(keysequence_.print(KeySequence::ForGui)));
}
Esempio n. 16
0
QString onlyFileName(const QString & str)
{
	return toqstr(support::onlyFileName(fromqstr(str)));
}
Esempio n. 17
0
void GuiClipboard::put(string const & text) const
{
	qApp->clipboard()->setText(toqstr(text));
}
Esempio n. 18
0
GuiFontInfo::GuiFontInfo(FontInfo const & f)
	: metrics(QFont())
{
	font.setKerning(false);
	QString const pat = symbolFamily(f.family());
	if (!pat.isEmpty()) {
		bool ok;
		font = symbolFont(pat, &ok);
	} else {
		switch (f.family()) {
		case ROMAN_FAMILY: {
			QString family = makeFontName(toqstr(lyxrc.roman_font_name),
				toqstr(lyxrc.roman_font_foundry)); 
			font.setFamily(family);
#ifdef Q_WS_MACX
#if QT_VERSION >= 0x040300 //&& QT_VERSION < 0x040800
			// Workaround for a Qt bug, see http://www.lyx.org/trac/ticket/3684
			// and http://bugreports.qt.nokia.com/browse/QTBUG-11145.
			// FIXME: Check whether this is really fixed in Qt 4.8
			if (family == "Times" && !font.exactMatch())
				font.setFamily("Times New Roman");
#endif
#endif
			break;
		}
		case SANS_FAMILY:
			font.setFamily(makeFontName(toqstr(lyxrc.sans_font_name),
						    toqstr(lyxrc.sans_font_foundry)));
			break;
		case TYPEWRITER_FAMILY:
			font.setFamily(makeFontName(toqstr(lyxrc.typewriter_font_name),
						    toqstr(lyxrc.typewriter_font_foundry)));
			break;
		default:
			break;
		}
	}

	switch (f.series()) {
		case MEDIUM_SERIES:
			font.setWeight(QFont::Normal);
			break;
		case BOLD_SERIES:
			font.setWeight(QFont::Bold);
			break;
		default:
			break;
	}

	switch (f.realShape()) {
		case ITALIC_SHAPE:
		case SLANTED_SHAPE:
			font.setItalic(true);
			break;
		default:
			break;
	}

	LYXERR(Debug::FONT, "Font '" << stateText(f)
		<< "' matched by\n" << font.family());

	// Is this an exact match?
	if (font.exactMatch())
		LYXERR(Debug::FONT, "This font is an exact match");
	else
		LYXERR(Debug::FONT, "This font is NOT an exact match");

	LYXERR(Debug::FONT, "XFLD: " << font.rawName());

	font.setPointSizeF(convert<double>(lyxrc.font_sizes[f.size()])
			       * lyxrc.zoom / 100.0);

	LYXERR(Debug::FONT, "The font has size: " << font.pointSizeF());

	if (f.realShape() != SMALLCAPS_SHAPE) {
		metrics = GuiFontMetrics(font);
	} else {
		// handle small caps ourselves ...
		FontInfo smallfont = f;
		smallfont.decSize().decSize().setShape(UP_SHAPE);
		QFont font2(font);
		font2.setKerning(false);
		font2.setPointSizeF(convert<double>(lyxrc.font_sizes[smallfont.size()])
			       * lyxrc.zoom / 100.0);

		metrics = GuiFontMetrics(font, font2);
	}
}