From 25a17d72e103cc0d7f8be27cec3ff2143221412a Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 20 Dec 2017 11:36:32 +0100 Subject: [PATCH] Get rid of idiosyncratic accelerator syntax --- src/frontends/qt4/GuiBibtex.cpp | 4 ++-- src/frontends/qt4/GuiCompare.cpp | 4 ++-- src/frontends/qt4/GuiDocument.cpp | 4 ++-- src/frontends/qt4/GuiExternal.cpp | 2 +- src/frontends/qt4/GuiGraphics.cpp | 4 ++-- src/frontends/qt4/GuiInclude.cpp | 2 +- src/frontends/qt4/GuiPrefs.cpp | 4 ++-- src/frontends/qt4/GuiView.cpp | 22 +++++++++++----------- src/frontends/qt4/LyXFileDialog.cpp | 19 ++----------------- 9 files changed, 25 insertions(+), 40 deletions(-) diff --git a/src/frontends/qt4/GuiBibtex.cpp b/src/frontends/qt4/GuiBibtex.cpp index d3c728a2a5..1c3917b94b 100644 --- a/src/frontends/qt4/GuiBibtex.cpp +++ b/src/frontends/qt4/GuiBibtex.cpp @@ -432,7 +432,7 @@ bool GuiBibtex::isValid() QString GuiBibtex::browseBib(QString const & in_name) const { - QString const label1 = qt_("Documents|#o#O"); + QString const label1 = qt_("D&ocuments"); QString const dir1 = toqstr(lyxrc.document_path); QStringList const filter(qt_("BibTeX Databases (*.bib)")); return browseRelToParent(in_name, bufferFilePath(), @@ -442,7 +442,7 @@ QString GuiBibtex::browseBib(QString const & in_name) const QString GuiBibtex::browseBst(QString const & in_name) const { - QString const label1 = qt_("Documents|#o#O"); + QString const label1 = qt_("D&ocuments"); QString const dir1 = toqstr(lyxrc.document_path); QStringList const filter(qt_("BibTeX Styles (*.bst)")); return browseRelToParent(in_name, bufferFilePath(), diff --git a/src/frontends/qt4/GuiCompare.cpp b/src/frontends/qt4/GuiCompare.cpp index 4ea7f35784..f7a8132577 100644 --- a/src/frontends/qt4/GuiCompare.cpp +++ b/src/frontends/qt4/GuiCompare.cpp @@ -159,11 +159,11 @@ QString GuiCompare::browse(QString const & in_name) const if (lyxview().documentBufferView()) { QString path = bufferFilePath(); filename = browseRelToParent(in_name, path, title, filters, false, - qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); + qt_("D&ocuments"), toqstr(lyxrc.document_path)); } else { QString path = toqstr(lyxrc.document_path); QString rel_filename = browseRelToParent(in_name, path, title, filters, false, - qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); + qt_("D&ocuments"), toqstr(lyxrc.document_path)); filename = makeAbsPath(rel_filename, path); } return filename; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 53cee98e04..e6217f5cb3 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -2307,7 +2307,7 @@ void GuiDocument::updatePagestyle(string const & items, string const & sel) void GuiDocument::browseLayout() { - QString const label1 = qt_("Layouts|#o#O"); + QString const label1 = qt_("Lay&outs"); QString const dir1 = toqstr(lyxrc.document_path); QStringList const filter(qt_("LyX Layout (*.layout)")); QString file = browseRelToParent(QString(), bufferFilePath(), @@ -2376,7 +2376,7 @@ void GuiDocument::browseMaster() QString const docpath = toqstr(support::onlyPath(buffer().absFileName())); QStringList const filter(qt_("LyX Files (*.lyx)")); QString file = browseRelToSub(old, docpath, title, filter, false, - qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); + qt_("D&ocuments"), toqstr(lyxrc.document_path)); if (!file.isEmpty()) latexModule->childDocLE->setText(file); diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 8215f07e60..f721bd28b6 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -672,7 +672,7 @@ QString GuiExternal::browse(QString const & input, QString const bufpath = bufferFilePath(); QStringList const filter = templateFilters(template_name); - QString const label1 = qt_("Documents|#o#O"); + QString const label1 = qt_("D&ocuments"); QString const dir1 = toqstr(lyxrc.document_path); return browseRelToParent(input, bufpath, title, filter, false, label1, dir1); diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index d2467cdd93..3c6bd21376 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -789,8 +789,8 @@ QString GuiGraphics::browse(QString const & in_name) const return browseRelToParent(in_name, bufferFilePath(), title, fileFilters(QString()), false, - qt_("Clipart|#C#c"), toqstr(clipdir), - qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); + qt_("&Clipart"), toqstr(clipdir), + qt_("D&ocuments"), toqstr(lyxrc.document_path)); } diff --git a/src/frontends/qt4/GuiInclude.cpp b/src/frontends/qt4/GuiInclude.cpp index 3e184cd352..4cae710d61 100644 --- a/src/frontends/qt4/GuiInclude.cpp +++ b/src/frontends/qt4/GuiInclude.cpp @@ -327,7 +327,7 @@ QString GuiInclude::browse(QString const & in_name, Type in_type) const QString const docpath = toqstr(support::onlyPath(buffer().absFileName())); return browseRelToParent(in_name, docpath, title, filters, false, - qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); + qt_("D&ocuments"), toqstr(lyxrc.document_path)); } diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index c73114949b..1474cb37f9 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -138,11 +138,11 @@ QString browseLibFile(QString const & dir, QStringList const & filters) { // FIXME UNICODE - QString const label1 = qt_("System files|#S#s"); + QString const label1 = qt_("&System files"); QString const dir1 = toqstr(addName(package().system_support().absFileName(), fromqstr(dir))); - QString const label2 = qt_("User files|#U#u"); + QString const label2 = qt_("&User files"); QString const dir2 = toqstr(addName(package().user_support().absFileName(), fromqstr(dir))); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 2aee2735d3..78fe8af1ff 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2193,8 +2193,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) static FileName selectTemplateFile() { FileDialog dlg(qt_("Select template file")); - dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); - dlg.setButton2(qt_("Templates|#T#t"), toqstr(lyxrc.template_path)); + dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path)); + dlg.setButton2(qt_("&Templates"), toqstr(lyxrc.template_path)); FileDialog::Result result = dlg.open(toqstr(lyxrc.template_path), QStringList(qt_("LyX Documents (*.lyx)"))); @@ -2250,8 +2250,8 @@ void GuiView::openDocument(string const & fname) if (fname.empty()) { FileDialog dlg(qt_("Select document to open")); - dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); - dlg.setButton2(qt_("Examples|#E#e"), toqstr(lyxrc.example_path)); + dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path)); + dlg.setButton2(qt_("&Examples"), toqstr(lyxrc.example_path)); QStringList const filter(qt_("LyX Documents (*.lyx)")); FileDialog::Result result = @@ -2388,8 +2388,8 @@ void GuiView::importDocument(string const & argument) theFormats().prettyName(format)); FileDialog dlg(toqstr(text)); - dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); - dlg.setButton2(qt_("Examples|#E#e"), toqstr(lyxrc.example_path)); + dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path)); + dlg.setButton2(qt_("&Examples"), toqstr(lyxrc.example_path)); docstring filter = theFormats().prettyName(format); filter += " (*.{"; @@ -2521,8 +2521,8 @@ void GuiView::insertLyXFile(docstring const & fname) // FIXME UNICODE FileDialog dlg(qt_("Select LyX document to insert")); - dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); - dlg.setButton2(qt_("Examples|#E#e"), toqstr(lyxrc.example_path)); + dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path)); + dlg.setButton2(qt_("&Examples"), toqstr(lyxrc.example_path)); FileDialog::Result result = dlg.open(toqstr(initpath), QStringList(qt_("LyX Documents (*.lyx)"))); @@ -2561,8 +2561,8 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname, RenameKind kin // No argument? Ask user through dialog. // FIXME UNICODE FileDialog dlg(qt_("Choose a filename to save document as")); - dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); - dlg.setButton2(qt_("Templates|#T#t"), toqstr(lyxrc.template_path)); + dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path)); + dlg.setButton2(qt_("&Templates"), toqstr(lyxrc.template_path)); if (!isLyXFileName(fname.absFileName())) fname.changeExtension(".lyx"); @@ -2679,7 +2679,7 @@ bool GuiView::exportBufferAs(Buffer & b, docstring const & iformat) FileName fname = b.fileName(); FileDialog dlg(qt_("Choose a filename to export the document as")); - dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); + dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path)); QStringList types; QString const anyformat = qt_("Guess from extension (*.*)"); diff --git a/src/frontends/qt4/LyXFileDialog.cpp b/src/frontends/qt4/LyXFileDialog.cpp index e218fcfc0c..adaa1b792a 100644 --- a/src/frontends/qt4/LyXFileDialog.cpp +++ b/src/frontends/qt4/LyXFileDialog.cpp @@ -25,21 +25,6 @@ using namespace lyx::support; namespace lyx { -/// return the Qt form of the label -static QString getLabel(QString const & qstr) -{ - // FIXME UNICODE (or "qt-ify") - string str = fromqstr(qstr); - string label; - string sc = split(str, label, '|'); - if (sc.length() < 2) - return toqstr(label); - size_t pos = label.find(sc[1]); - if (pos != string::npos) - label.insert(pos, 1, '&'); - return toqstr(label); -} - LyXFileDialog::LyXFileDialog(QString const & title, QString const & path, @@ -60,7 +45,7 @@ LyXFileDialog::LyXFileDialog(QString const & title, b1_dir_ = b1.second; QToolButton * tb = new QToolButton(this); connect(tb, SIGNAL(clicked()), this, SLOT(button1Clicked())); - tb->setText(getLabel(b1.first)); + tb->setText(b1.first); layout.at(0)->addWidget(tb); } @@ -68,7 +53,7 @@ LyXFileDialog::LyXFileDialog(QString const & title, b2_dir_ = b2.second; QToolButton * tb = new QToolButton(this); connect(tb, SIGNAL(clicked()), this, SLOT(button2Clicked())); - tb->setText(getLabel(b2.first)); + tb->setText(b2.first); layout.at(0)->addWidget(tb); } }