From e7317582fbb1548cf020578b5fabed976fc94dba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Sat, 24 Nov 2007 22:15:52 +0000 Subject: [PATCH] less boost, just plain C++. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21768 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiPrefs.cpp | 52 ++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 43b681222b..d08b10eab0 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -59,18 +59,14 @@ #include #include -#include - #include #include #include -#include using namespace Ui; using std::endl; using std::ostringstream; -using std::pair; using std::string; using std::vector; @@ -108,13 +104,18 @@ static size_t findPos_helper(std::vector const & vec, A const & val) } -static std::pair parseFontName(string const & name) +static void parseFontName(QString const & mangled0, + string & name, string & foundry) { - size_t const idx = name.find('['); - if (idx == string::npos || idx == 0) - return make_pair(name, string()); - return make_pair(name.substr(0, idx - 1), - name.substr(idx + 1, name.size() - idx - 2)); + std::string mangled = fromqstr(mangled0); + size_t const idx = mangled.find('['); + if (idx == string::npos || idx == 0) { + name = mangled; + foundry.clear(); + } else { + name = mangled.substr(0, idx - 1), + foundry = mangled.substr(idx + 1, mangled.size() - idx - 2); + } } @@ -136,20 +137,23 @@ static void setComboxFont(QComboBox * cb, string const & family, // We count in reverse in order to prefer the Xft foundry for (int i = cb->count(); --i >= 0;) { - pair tmp = parseFontName(fromqstr(cb->itemText(i))); - if (compare_ascii_no_case(tmp.first, family) == 0) { + string name, foundry; + parseFontName(cb->itemText(i), name, foundry); + if (compare_ascii_no_case(name, family) == 0) { cb->setCurrentIndex(i); return; } } // family alone can contain e.g. "Helvetica [Adobe]" - pair tmpfam = parseFontName(family); + string tmpname, tmpfoundry; + parseFontName(toqstr(family), tmpname, tmpfoundry); // We count in reverse in order to prefer the Xft foundry for (int i = cb->count(); --i >= 0; ) { - pair tmp = parseFontName(fromqstr(cb->itemText(i))); - if (compare_ascii_no_case(tmp.first, tmpfam.first) == 0) { + string name, foundry; + parseFontName(cb->itemText(i), name, foundry); + if (compare_ascii_no_case(name, foundry) == 0) { cb->setCurrentIndex(i); return; } @@ -178,8 +182,8 @@ static void setComboxFont(QComboBox * cb, string const & family, } QFontInfo info(font); - pair tmp = parseFontName(fromqstr(info.family())); - string const & default_font_name = tmp.first; + string default_font_name, dummyfoundry; + parseFontName(info.family(), default_font_name, dummyfoundry); lyxerr << "Apparent font is " << default_font_name << endl; for (int i = 0; i < cb->count(); ++i) { @@ -465,12 +469,12 @@ void PrefScreenFonts::apply(LyXRC & rc) const { LyXRC const oldrc = rc; - boost::tie(rc.roman_font_name, rc.roman_font_foundry) - = parseFontName(fromqstr(screenRomanCO->currentText())); - boost::tie(rc.sans_font_name, rc.sans_font_foundry) = - parseFontName(fromqstr(screenSansCO->currentText())); - boost::tie(rc.typewriter_font_name, rc.typewriter_font_foundry) = - parseFontName(fromqstr(screenTypewriterCO->currentText())); + parseFontName(screenRomanCO->currentText(), + rc.roman_font_name, rc.roman_font_foundry); + parseFontName(screenSansCO->currentText(), + rc.sans_font_name, rc.sans_font_foundry); + parseFontName(screenTypewriterCO->currentText(), + rc.typewriter_font_name, rc.typewriter_font_foundry); rc.zoom = screenZoomSB->value(); rc.dpi = screenDpiSB->value(); @@ -680,7 +684,7 @@ void PrefDisplay::apply(LyXRC & rc) const case 2: rc.preview = LyXRC::PREVIEW_ON; break; } - lyx::graphics::DisplayType dtype; + graphics::DisplayType dtype; switch (displayGraphicsCO->currentIndex()) { case 3: dtype = graphics::NoDisplay; break; case 2: dtype = graphics::ColorDisplay; break; -- 2.39.2