Fix assert: Do not use translated names as keys

The panels in GuiDocument and GuiPrefs are stored in a map. The keys are
the translated descriptions of these panels. Whenever someone changes the
gui language and reopens the Document Settings pane, LyX asserted because
it could not find the "Child Documents" pane.
This commit is contained in:
Vincent van Ravesteijn 2013-05-12 18:30:59 +02:00
parent 3e65edd729
commit a033b88a37
3 changed files with 52 additions and 52 deletions

View File

@ -1391,28 +1391,28 @@ GuiDocument::GuiDocument(GuiView & lv)
// add the panels // add the panels
docPS->addPanel(latexModule, qt_("Document Class")); docPS->addPanel(latexModule, N_("Document Class"));
docPS->addPanel(masterChildModule, qt_("Child Documents")); docPS->addPanel(masterChildModule, N_("Child Documents"));
docPS->addPanel(modulesModule, qt_("Modules")); docPS->addPanel(modulesModule, N_("Modules"));
docPS->addPanel(localLayout, qt_("Local Layout")); docPS->addPanel(localLayout, N_("Local Layout"));
docPS->addPanel(fontModule, qt_("Fonts")); docPS->addPanel(fontModule, N_("Fonts"));
docPS->addPanel(textLayoutModule, qt_("Text Layout")); docPS->addPanel(textLayoutModule, N_("Text Layout"));
docPS->addPanel(pageLayoutModule, qt_("Page Layout")); docPS->addPanel(pageLayoutModule, N_("Page Layout"));
docPS->addPanel(marginsModule, qt_("Page Margins")); docPS->addPanel(marginsModule, N_("Page Margins"));
docPS->addPanel(langModule, qt_("Language")); docPS->addPanel(langModule, N_("Language"));
docPS->addPanel(colorModule, qt_("Colors")); docPS->addPanel(colorModule, N_("Colors"));
docPS->addPanel(numberingModule, qt_("Numbering & TOC")); docPS->addPanel(numberingModule, N_("Numbering & TOC"));
docPS->addPanel(biblioModule, qt_("Bibliography")); docPS->addPanel(biblioModule, N_("Bibliography"));
docPS->addPanel(indicesModule, qt_("Indexes")); docPS->addPanel(indicesModule, N_("Indexes"));
docPS->addPanel(pdfSupportModule, qt_("PDF Properties")); docPS->addPanel(pdfSupportModule, N_("PDF Properties"));
docPS->addPanel(mathsModule, qt_("Math Options")); docPS->addPanel(mathsModule, N_("Math Options"));
docPS->addPanel(floatModule, qt_("Float Placement")); docPS->addPanel(floatModule, N_("Float Placement"));
docPS->addPanel(listingsModule, qt_("Listings[[inset]]")); docPS->addPanel(listingsModule, N_("Listings[[inset]]"));
docPS->addPanel(bulletsModule, qt_("Bullets")); docPS->addPanel(bulletsModule, N_("Bullets"));
docPS->addPanel(branchesModule, qt_("Branches")); docPS->addPanel(branchesModule, N_("Branches"));
docPS->addPanel(outputModule, qt_("Output")); docPS->addPanel(outputModule, N_("Output"));
docPS->addPanel(preambleModule, qt_("LaTeX Preamble")); docPS->addPanel(preambleModule, N_("LaTeX Preamble"));
docPS->setCurrentPanel(qt_("Document Class")); docPS->setCurrentPanel("Document Class");
// FIXME: hack to work around resizing bug in Qt >= 4.2 // FIXME: hack to work around resizing bug in Qt >= 4.2
// bug verified with Qt 4.2.{0-3} (JSpitzm) // bug verified with Qt 4.2.{0-3} (JSpitzm)
#if QT_VERSION >= 0x040200 #if QT_VERSION >= 0x040200
@ -3192,11 +3192,11 @@ void GuiDocument::paramsToDialog()
if (!bufferview() || !buffer().hasChildren()) { if (!bufferview() || !buffer().hasChildren()) {
masterChildModule->childrenTW->clear(); masterChildModule->childrenTW->clear();
includeonlys_.clear(); includeonlys_.clear();
docPS->showPanel(qt_("Child Documents"), false); docPS->showPanel("Child Documents", false);
if (docPS->isCurrentPanel(qt_("Child Documents"))) if (docPS->isCurrentPanel("Child Documents"))
docPS->setCurrentPanel(qt_("Document Class")); docPS->setCurrentPanel("Document Class");
} else { } else {
docPS->showPanel(qt_("Child Documents"), true); docPS->showPanel("Child Documents", true);
masterChildModule->setEnabled(true); masterChildModule->setEnabled(true);
includeonlys_ = bp_.getIncludedChildren(); includeonlys_ = bp_.getIncludedChildren();
updateIncludeonlys(); updateIncludeonlys();

View File

@ -249,11 +249,11 @@ QString browseRelToSub(QString const & filename, QString const & relpath,
namespace frontend { namespace frontend {
string const catLookAndFeel = N_("Look & Feel"); QString const catLookAndFeel = N_("Look & Feel");
string const catEditing = N_("Editing"); QString const catEditing = N_("Editing");
string const catLanguage = N_("Language Settings"); QString const catLanguage = N_("Language Settings");
string const catOutput = N_("Output"); QString const catOutput = N_("Output");
string const catFiles = N_("File Handling"); QString const catFiles = N_("File Handling");
static void parseFontName(QString const & mangled0, static void parseFontName(QString const & mangled0,
string & name, string & foundry) string & name, string & foundry)
@ -387,7 +387,7 @@ QValidator::State StrftimeValidator::validate(QString & input, int & /*pos*/) co
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefOutput::PrefOutput(GuiPreferences * form) PrefOutput::PrefOutput(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("General"), form) : PrefModule(catOutput, N_("General"), form)
{ {
setupUi(this); setupUi(this);
@ -479,7 +479,7 @@ void PrefOutput::update(LyXRC const & rc)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefInput::PrefInput(GuiPreferences * form) PrefInput::PrefInput(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Keyboard/Mouse"), form) : PrefModule(catEditing, N_("Keyboard/Mouse"), form)
{ {
setupUi(this); setupUi(this);
@ -609,7 +609,7 @@ void PrefInput::on_scrollzoomEnableCB_toggled(bool enabled)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefCompletion::PrefCompletion(GuiPreferences * form) PrefCompletion::PrefCompletion(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Input Completion"), form) : PrefModule(catEditing, N_("Input Completion"), form)
{ {
setupUi(this); setupUi(this);
@ -699,7 +699,7 @@ void PrefCompletion::update(LyXRC const & rc)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefLatex::PrefLatex(GuiPreferences * form) PrefLatex::PrefLatex(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("LaTeX"), form) : PrefModule(catOutput, N_("LaTeX"), form)
{ {
setupUi(this); setupUi(this);
@ -928,7 +928,7 @@ void PrefLatex::update(LyXRC const & rc)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefScreenFonts::PrefScreenFonts(GuiPreferences * form) PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("Screen Fonts"), form) : PrefModule(catLookAndFeel, N_("Screen Fonts"), form)
{ {
setupUi(this); setupUi(this);
@ -1105,7 +1105,7 @@ struct ColorSorter
} // namespace anon } // namespace anon
PrefColors::PrefColors(GuiPreferences * form) PrefColors::PrefColors(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("Colors"), form) : PrefModule(catLookAndFeel, N_("Colors"), form)
{ {
setupUi(this); setupUi(this);
@ -1227,7 +1227,7 @@ void PrefColors::changeLyxObjectsSelection()
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefDisplay::PrefDisplay(GuiPreferences * form) PrefDisplay::PrefDisplay(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("Display"), form) : PrefModule(catLookAndFeel, N_("Display"), form)
{ {
setupUi(this); setupUi(this);
connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
@ -1301,7 +1301,7 @@ void PrefDisplay::update(LyXRC const & rc)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefPaths::PrefPaths(GuiPreferences * form) PrefPaths::PrefPaths(GuiPreferences * form)
: PrefModule(QString(), qt_("Paths"), form) : PrefModule(QString(), N_("Paths"), form)
{ {
setupUi(this); setupUi(this);
@ -1464,7 +1464,7 @@ void PrefPaths::selectLyxPipe()
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefSpellchecker::PrefSpellchecker(GuiPreferences * form) PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
: PrefModule(qt_(catLanguage), qt_("Spellchecker"), form) : PrefModule(catLanguage, N_("Spellchecker"), form)
{ {
setupUi(this); setupUi(this);
@ -1555,7 +1555,7 @@ void PrefSpellchecker::on_spellcheckerCB_currentIndexChanged(int index)
PrefConverters::PrefConverters(GuiPreferences * form) PrefConverters::PrefConverters(GuiPreferences * form)
: PrefModule(qt_(catFiles), qt_("Converters"), form) : PrefModule(catFiles, N_("Converters"), form)
{ {
setupUi(this); setupUi(this);
@ -1869,7 +1869,7 @@ private:
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefFileformats::PrefFileformats(GuiPreferences * form) PrefFileformats::PrefFileformats(GuiPreferences * form)
: PrefModule(qt_(catFiles), qt_("File Formats"), form) : PrefModule(catFiles, N_("File Formats"), form)
{ {
setupUi(this); setupUi(this);
@ -2237,7 +2237,7 @@ void PrefFileformats::on_formatRemovePB_clicked()
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefLanguage::PrefLanguage(GuiPreferences * form) PrefLanguage::PrefLanguage(GuiPreferences * form)
: PrefModule(qt_(catLanguage), qt_("Language"), form) : PrefModule(catLanguage, N_("Language"), form)
{ {
setupUi(this); setupUi(this);
@ -2387,7 +2387,7 @@ void PrefLanguage::update(LyXRC const & rc)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefPrinter::PrefPrinter(GuiPreferences * form) PrefPrinter::PrefPrinter(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("Printer"), form) : PrefModule(catOutput, N_("Printer"), form)
{ {
setupUi(this); setupUi(this);
@ -2503,7 +2503,7 @@ void PrefPrinter::update(LyXRC const & rc)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefUserInterface::PrefUserInterface(GuiPreferences * form) PrefUserInterface::PrefUserInterface(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("User Interface"), form) : PrefModule(catLookAndFeel, N_("User Interface"), form)
{ {
setupUi(this); setupUi(this);
@ -2563,7 +2563,7 @@ void PrefUserInterface::selectUi()
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefDocHandling::PrefDocHandling(GuiPreferences * form) PrefDocHandling::PrefDocHandling(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("Document Handling"), form) : PrefModule(catLookAndFeel, N_("Document Handling"), form)
{ {
setupUi(this); setupUi(this);
@ -2666,7 +2666,7 @@ void PrefDocHandling::on_clearSessionPB_clicked()
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefEdit::PrefEdit(GuiPreferences * form) PrefEdit::PrefEdit(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Control"), form) : PrefModule(catEditing, N_("Control"), form)
{ {
setupUi(this); setupUi(this);
@ -2754,7 +2754,7 @@ GuiShortcutDialog::GuiShortcutDialog(QWidget * parent) : QDialog(parent)
PrefShortcuts::PrefShortcuts(GuiPreferences * form) PrefShortcuts::PrefShortcuts(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Shortcuts"), form) : PrefModule(catEditing, N_("Shortcuts"), form)
{ {
setupUi(this); setupUi(this);
@ -3217,7 +3217,7 @@ void PrefShortcuts::shortcutRemovePressed()
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefIdentity::PrefIdentity(GuiPreferences * form) PrefIdentity::PrefIdentity(GuiPreferences * form)
: PrefModule(QString(), qt_("Identity"), form) : PrefModule(QString(), N_("Identity"), form)
{ {
setupUi(this); setupUi(this);
@ -3297,7 +3297,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
addModule(converters); addModule(converters);
addModule(formats); addModule(formats);
prefsPS->setCurrentPanel(qt_("User Interface")); prefsPS->setCurrentPanel("User Interface");
// FIXME: hack to work around resizing bug in Qt >= 4.2 // FIXME: hack to work around resizing bug in Qt >= 4.2
// bug verified with Qt 4.2.{0-3} (JSpitzm) // bug verified with Qt 4.2.{0-3} (JSpitzm)
#if QT_VERSION >= 0x040200 #if QT_VERSION >= 0x040200

View File

@ -105,13 +105,13 @@ void PanelStack::addCategory(QString const & name, QString const & parent)
if (parent.isEmpty()) { if (parent.isEmpty()) {
item = new QTreeWidgetItem(list_); item = new QTreeWidgetItem(list_);
item->setText(0, name); item->setText(0, qt_(name));
} }
else { else {
if (!panel_map_.contains(parent)) if (!panel_map_.contains(parent))
addCategory(parent); addCategory(parent);
item = new QTreeWidgetItem(panel_map_.value(parent)); item = new QTreeWidgetItem(panel_map_.value(parent));
item->setText(0, name); item->setText(0, qt_(name));
depth = 2; depth = 2;
list_->setRootIsDecorated(true); list_->setRootIsDecorated(true);
} }