Fix compilation qt + included string by getting rid of the #ifdef

BOOST_FORMAT stuff


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7257 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-10 12:14:47 +00:00
parent deb40aadc6
commit 6c1b980274
3 changed files with 22 additions and 49 deletions

View File

@ -27,18 +27,13 @@
using std::pair;
using std::make_pair;
using lyx::support::bformat;
int prompt_pimpl(string const & tit, string const & question,
int default_button, int cancel_button,
string const & b1, string const & b2, string const & b3)
{
#if USE_BOOST_FORMAT
boost::format fmt(_("LyX: %1$s"));
fmt % tit;
string const title = fmt.str();
#else
string const title = _("LyX: ") + tit;
#endif
string const title = bformat(_("LyX: %1$s"), tit);
int res = QMessageBox::information(0, toqstr(title), toqstr(formatted(question)),
toqstr(b1), toqstr(b2), b3.empty() ? QString::null : toqstr(b3),
@ -53,39 +48,21 @@ int prompt_pimpl(string const & tit, string const & question,
void warning_pimpl(string const & tit, string const & message)
{
#if USE_BOOST_FORMAT
boost::format fmt(_("LyX: %1$s"));
fmt % tit;
string const title = fmt.str();
#else
string const title = _("LyX: ") + tit;
#endif
string const title = bformat(_("LyX: %1$s"), tit);
QMessageBox::warning(0, toqstr(title), toqstr(formatted(message)));
}
void error_pimpl(string const & tit, string const & message)
{
#if USE_BOOST_FORMAT
boost::format fmt(_("LyX: %1$s"));
fmt % tit;
string const title = fmt.str();
#else
string const title = _("LyX: ") + tit;
#endif
string const title = bformat(_("LyX: %1$s"), tit);
QMessageBox::critical(0, toqstr(title), toqstr(formatted(message)));
}
void information_pimpl(string const & tit, string const & message)
{
#if USE_BOOST_FORMAT
boost::format fmt(_("LyX: %1$s"));
fmt % tit;
string const title = fmt.str();
#else
string const title = _("LyX: ") + tit;
#endif
string const title = bformat(_("LyX: %1$s"), tit);
QMessageBox::information(0, toqstr(title), toqstr(formatted(message)));
}
@ -93,13 +70,7 @@ void information_pimpl(string const & tit, string const & message)
pair<bool, string> const
askForText_pimpl(string const & msg, string const & dflt)
{
#if USE_BOOST_FORMAT
boost::format fmt(_("LyX: %1$s"));
fmt % msg;
string const title = fmt.str();
#else
string const title = _("LyX: ") + msg;
#endif
string const title = bformat(_("LyX: %1$s"), msg);
QAskForTextDialog d(0, toqstr(title), true);
// less than ideal !
d.askLA->setText(toqstr('&' + msg));

View File

@ -1,3 +1,9 @@
2003-07-11 André Pönitz <poenitz@lyx.org>
* Alert_pimpl.C:
* QDocument.C: use bformat() instead of #ifdef
2003-07-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* introduce namespace lyx::graphics

View File

@ -25,6 +25,7 @@
#include "lyxrc.h" // defaultUnit
#include "tex-strings.h" // tex_graphics
#include "support/tostr.h"
#include "support/lstrings.h"
#include "support/filetools.h" // LibFileSearch()
#include "support/BoostFormat.h"
#include "lyxtextclasslist.h"
@ -47,19 +48,12 @@
#include <vector>
using std::vector;
using lyx::support::bformat;
typedef Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> > base_class;
QDocument::QDocument()
: base_class(_("LyX: Document Settings"))
{
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
lang_ = getSecond(langs);
}
namespace {
char const * encodings[] = { "LaTeX default", "latin1", "latin2",
@ -71,6 +65,12 @@ char const * encodings[] = { "LaTeX default", "latin1", "latin2",
}
QDocument::QDocument()
: base_class(_("LyX: Document Settings")),
lang_(getSecond(frnt::getLanguageData(false)))
{}
void QDocument::build_dialog()
{
dialog_.reset(new QDocumentDialog(this));
@ -128,11 +128,7 @@ void QDocument::build_dialog()
dialog_->latexModule->classCO->insertItem(toqstr(cit->description()));
} else {
string item =
#if USE_BOOST_FORMAT
boost::io::str(boost::format(_("Unavailable: %1$s")) % cit->description());
#else
_("Unavailable: ") + cit->description();
#endif
bformat(_("Unavailable: %1$s"), cit->description());
dialog_->latexModule->classCO->insertItem(toqstr(item));
}
}
@ -602,7 +598,7 @@ void QDocument::update_contents()
// margins
MarginsModuleBase * m(dialog_->marginsModule);
MarginsModuleBase * m = dialog_->marginsModule;
int item = params.paperpackage;
if (params.use_geometry) {