more unicode work.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15284 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-09 12:07:05 +00:00
parent e6fea4b844
commit f9c4f9cca3
7 changed files with 69 additions and 49 deletions

View File

@ -388,20 +388,20 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
floatModule = new FloatPlacement;
connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
docPS->addPanel(latexModule, lyx::to_utf8(_("Document Class")));
docPS->addPanel(fontModule, lyx::to_utf8(_("Fonts")));
docPS->addPanel(textLayoutModule, lyx::to_utf8(_("Text Layout")));
docPS->addPanel(pageLayoutModule, lyx::to_utf8(_("Page Layout")));
docPS->addPanel(marginsModule, lyx::to_utf8(_("Page Margins")));
docPS->addPanel(langModule, lyx::to_utf8(_("Language")));
docPS->addPanel(numberingModule, lyx::to_utf8(_("Numbering & TOC")));
docPS->addPanel(biblioModule, lyx::to_utf8(_("Bibliography")));
docPS->addPanel(mathsModule, lyx::to_utf8(_("Math Options")));
docPS->addPanel(floatModule, lyx::to_utf8(_("Float Placement")));
docPS->addPanel(bulletsModule, lyx::to_utf8(_("Bullets")));
docPS->addPanel(branchesModule, lyx::to_utf8(_("Branches")));
docPS->addPanel(preambleModule, lyx::to_utf8(_("LaTeX Preamble")));
docPS->setCurrentPanel(lyx::to_utf8(_("Document Class")));
docPS->addPanel(latexModule, _("Document Class"));
docPS->addPanel(fontModule, _("Fonts"));
docPS->addPanel(textLayoutModule, _("Text Layout"));
docPS->addPanel(pageLayoutModule, _("Page Layout"));
docPS->addPanel(marginsModule, _("Page Margins"));
docPS->addPanel(langModule, _("Language"));
docPS->addPanel(numberingModule, _("Numbering & TOC"));
docPS->addPanel(biblioModule, _("Bibliography"));
docPS->addPanel(mathsModule, _("Math Options"));
docPS->addPanel(floatModule, _("Float Placement"));
docPS->addPanel(bulletsModule, _("Bullets"));
docPS->addPanel(branchesModule, _("Branches"));
docPS->addPanel(preambleModule, _("LaTeX Preamble"));
docPS->setCurrentPanel(_("Document Class"));
}
@ -412,7 +412,7 @@ QDocumentDialog::~QDocumentDialog()
void QDocumentDialog::showPreamble()
{
docPS->setCurrentPanel(lyx::to_utf8(_("LaTeX Preamble")));
docPS->setCurrentPanel(_("LaTeX Preamble"));
}

View File

@ -178,7 +178,7 @@ string const internal_path(QString const & input)
PrefAscii::PrefAscii(QWidget * parent)
: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Plain text")), 0, parent)
: PrefModule(_(Outputs), _("Plain text"), 0, parent)
{
setupUi(this);
connect(asciiLinelengthSB, SIGNAL(valueChanged(int)),
@ -203,7 +203,7 @@ void PrefAscii::update(LyXRC const & rc)
PrefDate::PrefDate(QWidget * parent)
: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Date format")), 0, parent)
: PrefModule(_(Outputs), _("Date format"), 0, parent)
{
setupUi(this);
connect(DateED, SIGNAL(textChanged(const QString&)),
@ -224,7 +224,7 @@ void PrefDate::update(LyXRC const & rc)
PrefKeyboard::PrefKeyboard(QPrefs * form, QWidget * parent)
: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Keyboard")), form, parent)
: PrefModule(_(LookAndFeel), _("Keyboard"), form, parent)
{
setupUi(this);
@ -298,7 +298,7 @@ void PrefKeyboard::on_secondKeymapPB_clicked(bool)
PrefLatex::PrefLatex(QPrefs * form, QWidget * parent)
: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("LaTeX")), form, parent)
: PrefModule(_(Outputs), _("LaTeX"), form, parent)
{
setupUi(this);
connect(latexEncodingED, SIGNAL(textChanged(const QString&)),
@ -345,7 +345,7 @@ void PrefLatex::update(LyXRC const & rc)
PrefScreenFonts::PrefScreenFonts(QPrefs * form, QWidget * parent)
: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Screen fonts")), form, parent)
: PrefModule(_(LookAndFeel), _("Screen fonts"), form, parent)
{
setupUi(this);
@ -497,7 +497,7 @@ void PrefScreenFonts::select_typewriter(const QString& name)
PrefColors::PrefColors(QPrefs * form, QWidget * parent)
: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Colors")), form, parent)
: PrefModule(_(LookAndFeel), _("Colors"), form, parent)
{
setupUi(this);
@ -566,7 +566,7 @@ void PrefColors::change_color()
PrefCygwinPath::PrefCygwinPath(QWidget * parent)
: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Paths")), 0, parent)
: PrefModule(_(Outputs), _("Paths"), 0, parent)
{
setupUi(this);
connect(pathCB, SIGNAL(toggled(bool)),
@ -587,7 +587,7 @@ void PrefCygwinPath::update(LyXRC const & rc)
PrefDisplay::PrefDisplay(QWidget * parent)
: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Graphics")), 0, parent)
: PrefModule(_(LookAndFeel), _("Graphics"), 0, parent)
{
setupUi(this);
connect(instantPreviewCO, SIGNAL(activated(int)),
@ -654,7 +654,7 @@ void PrefDisplay::update(LyXRC const & rc)
PrefPaths::PrefPaths(QPrefs * form, QWidget * parent)
: PrefModule(string(), lyx::to_utf8(_("Paths")), form, parent)
: PrefModule(docstring(), _("Paths"), form, parent)
{
setupUi(this);
connect(templateDirPB, SIGNAL(clicked()), this, SLOT(select_templatedir()));
@ -743,7 +743,7 @@ void PrefPaths::select_lyxpipe()
PrefSpellchecker::PrefSpellchecker(QPrefs * form, QWidget * parent)
: PrefModule(lyx::to_utf8(_(LanguageSettings)), lyx::to_utf8(_("Spellchecker")), form, parent)
: PrefModule(_(LanguageSettings), _("Spellchecker"), form, parent)
{
setupUi(this);
@ -844,7 +844,7 @@ void PrefSpellchecker::select_dict()
PrefConverters::PrefConverters(QPrefs * form, QWidget * parent)
: PrefModule(string(), lyx::to_utf8(_("Converters")), form, parent)
: PrefModule(docstring(), _("Converters"), form, parent)
{
setupUi(this);
@ -1033,7 +1033,7 @@ void PrefConverters::remove_converter()
PrefCopiers::PrefCopiers(QPrefs * form, QWidget * parent)
: PrefModule(string(), lyx::to_utf8(_("Copiers")), form, parent)
: PrefModule(docstring(), _("Copiers"), form, parent)
{
setupUi(this);
@ -1276,7 +1276,7 @@ void PrefCopiers::remove_copier()
PrefFileformats::PrefFileformats(QPrefs * form, QWidget * parent)
: PrefModule(string(), lyx::to_utf8(_("File formats")), form, parent)
: PrefModule(docstring(), _("File formats"), form, parent)
{
setupUi(this);
@ -1521,7 +1521,7 @@ void PrefFileformats::remove_format()
PrefLanguage::PrefLanguage(QWidget * parent)
: PrefModule(string(), lyx::to_utf8(_("Language")), 0, parent)
: PrefModule(docstring(), _("Language"), 0, parent)
{
setupUi(this);
@ -1597,7 +1597,7 @@ void PrefLanguage::update(LyXRC const & rc)
PrefPrinter::PrefPrinter(QWidget * parent)
: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Printer")), 0, parent)
: PrefModule(_(Outputs), _("Printer"), 0, parent)
{
setupUi(this);
@ -1689,7 +1689,7 @@ void PrefPrinter::update(LyXRC const & rc)
PrefUserInterface::PrefUserInterface(QPrefs * form, QWidget * parent)
: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("User interface")), form, parent)
: PrefModule(_(LookAndFeel), _("User interface"), form, parent)
{
setupUi(this);
@ -1801,7 +1801,7 @@ void PrefUserInterface::select_bind()
PrefIdentity::PrefIdentity(QWidget * parent)
: PrefModule(string(), lyx::to_utf8(_("Identity")), 0, parent)
: PrefModule(docstring(), _("Identity"), 0, parent)
{
setupUi(this);
@ -1870,7 +1870,7 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
add(new PrefUserInterface(form_));
add(new PrefIdentity);
prefsPS->setCurrentPanel(lyx::to_utf8(_("User interface")));
prefsPS->setCurrentPanel(_("User interface"));
form_->bcview().setOK(savePB);
form_->bcview().setApply(applyPB);

View File

@ -60,7 +60,7 @@ class PrefModule : public QWidget
{
Q_OBJECT
public:
PrefModule(std::string const & cat, std::string const & t, QPrefs * form = 0, QWidget * parent = 0)
PrefModule(lyx::docstring const & cat, lyx::docstring const & t, QPrefs * form = 0, QWidget * parent = 0)
: QWidget(parent), category_(cat), title_(t), form_(form)
{
}
@ -69,17 +69,17 @@ public:
virtual void apply(LyXRC & rc) const = 0;
virtual void update(LyXRC const & rc) = 0;
std::string const & category() {
lyx::docstring const & category() {
return category_;
}
std::string const & title() {
lyx::docstring const & title() {
return title_;
}
protected:
std::string category_;
std::string title_;
lyx::docstring category_;
lyx::docstring title_;
QPrefs * form_;
Q_SIGNALS:

View File

@ -22,9 +22,10 @@
#include <boost/assert.hpp>
using std::string;
#include <iostream>
using lyx::docstring;
using std::endl;
using std::cout;
@ -59,13 +60,14 @@ PanelStack::PanelStack(QWidget * parent)
}
void PanelStack::addCategory(string const & n, string const & parent)
void PanelStack::addCategory(docstring const & n, docstring const & parent)
{
QTreeWidgetItem * item;
QString name = toqstr(n);
QString name;
ucs4_to_qstring(n, name);
cout << "addCategory n= " << n << " parent= " << endl;
cout << "addCategory n= " << lyx::to_utf8(n) << " parent= " << endl;
if (parent.empty()) {
item = new QTreeWidgetItem(list_);
@ -103,7 +105,7 @@ void PanelStack::addCategory(string const & n, string const & parent)
}
void PanelStack::addPanel(QWidget * panel, string const & name, string const & parent)
void PanelStack::addPanel(QWidget * panel, docstring const & name, docstring const & parent)
{
addCategory(name, parent);
QTreeWidgetItem * item = panel_map_.find(name)->second;
@ -117,7 +119,7 @@ void PanelStack::addPanel(QWidget * panel, string const & name, string const & p
}
void PanelStack::setCurrentPanel(string const & name)
void PanelStack::setCurrentPanel(docstring const & name)
{
PanelMap::const_iterator cit = panel_map_.find(name);
BOOST_ASSERT(cit != panel_map_.end());

View File

@ -12,6 +12,8 @@
#ifndef PANELSTACK_H
#define PANELSTACK_H
#include "support/docstring.h"
#include <QWidget>
#include <map>
@ -28,20 +30,22 @@ public:
PanelStack(QWidget * parent = 0);
/// add a category with no associated panel
void addCategory(std::string const & name, std::string const & parent = std::string());
void addCategory(lyx::docstring const & name,
lyx::docstring const & parent = lyx::docstring());
/// add a widget panel with a given name, under the given parent
void addPanel(QWidget * panel, std::string const & name, std::string const & parent = std::string());
void addPanel(QWidget * panel, lyx::docstring const & name,
lyx::docstring const & parent = lyx::docstring());
/// set current panel by logical name
void setCurrentPanel(std::string const &);
void setCurrentPanel(lyx::docstring const &);
public Q_SLOTS:
/// set current panel from an item
void switchPanel(QTreeWidgetItem * i, QTreeWidgetItem* previous=0);
private:
typedef std::map<std::string, QTreeWidgetItem *> PanelMap;
typedef std::map<lyx::docstring, QTreeWidgetItem *> PanelMap;
PanelMap panel_map_;

View File

@ -123,6 +123,18 @@ QString const toqstr(string const & str)
void ucs4_to_qstring(char_type const * str, size_t ls, QString & s)
{
s.reserve(ls);
s.clear();
for (size_t i = 0; i < ls; ++i)
s.append(ucs4_to_qchar(str[i]));
}
void ucs4_to_qstring(lyx::docstring const & str, QString & s)
{
size_t ls = str.size();
s.reserve(ls);
s.clear();
for (size_t i = 0; i < ls; ++i)
s.append(ucs4_to_qchar(str[i]));

View File

@ -71,6 +71,8 @@ QString const toqstr(lyx::docstring const & ucs4);
void ucs4_to_qstring(lyx::char_type const * str, size_t ls, QString & s);
void ucs4_to_qstring(lyx::docstring const & str, QString & s);
lyx::docstring const qstring_to_ucs4(QString const & qstr);
void qstring_to_ucs4(QString const & qstr, std::vector<lyx::char_type> & ucs4);