Get rid of idiosyncratic accelerator syntax

This commit is contained in:
Juergen Spitzmueller 2017-12-20 11:36:32 +01:00
parent 4cb5cc0c7d
commit 25a17d72e1
9 changed files with 25 additions and 40 deletions

View File

@ -432,7 +432,7 @@ bool GuiBibtex::isValid()
QString GuiBibtex::browseBib(QString const & in_name) const 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); QString const dir1 = toqstr(lyxrc.document_path);
QStringList const filter(qt_("BibTeX Databases (*.bib)")); QStringList const filter(qt_("BibTeX Databases (*.bib)"));
return browseRelToParent(in_name, bufferFilePath(), 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 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); QString const dir1 = toqstr(lyxrc.document_path);
QStringList const filter(qt_("BibTeX Styles (*.bst)")); QStringList const filter(qt_("BibTeX Styles (*.bst)"));
return browseRelToParent(in_name, bufferFilePath(), return browseRelToParent(in_name, bufferFilePath(),

View File

@ -159,11 +159,11 @@ QString GuiCompare::browse(QString const & in_name) const
if (lyxview().documentBufferView()) { if (lyxview().documentBufferView()) {
QString path = bufferFilePath(); QString path = bufferFilePath();
filename = browseRelToParent(in_name, path, title, filters, false, filename = browseRelToParent(in_name, path, title, filters, false,
qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); qt_("D&ocuments"), toqstr(lyxrc.document_path));
} else { } else {
QString path = toqstr(lyxrc.document_path); QString path = toqstr(lyxrc.document_path);
QString rel_filename = browseRelToParent(in_name, path, title, filters, false, 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); filename = makeAbsPath(rel_filename, path);
} }
return filename; return filename;

View File

@ -2307,7 +2307,7 @@ void GuiDocument::updatePagestyle(string const & items, string const & sel)
void GuiDocument::browseLayout() void GuiDocument::browseLayout()
{ {
QString const label1 = qt_("Layouts|#o#O"); QString const label1 = qt_("Lay&outs");
QString const dir1 = toqstr(lyxrc.document_path); QString const dir1 = toqstr(lyxrc.document_path);
QStringList const filter(qt_("LyX Layout (*.layout)")); QStringList const filter(qt_("LyX Layout (*.layout)"));
QString file = browseRelToParent(QString(), bufferFilePath(), QString file = browseRelToParent(QString(), bufferFilePath(),
@ -2376,7 +2376,7 @@ void GuiDocument::browseMaster()
QString const docpath = toqstr(support::onlyPath(buffer().absFileName())); QString const docpath = toqstr(support::onlyPath(buffer().absFileName()));
QStringList const filter(qt_("LyX Files (*.lyx)")); QStringList const filter(qt_("LyX Files (*.lyx)"));
QString file = browseRelToSub(old, docpath, title, filter, false, 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()) if (!file.isEmpty())
latexModule->childDocLE->setText(file); latexModule->childDocLE->setText(file);

View File

@ -672,7 +672,7 @@ QString GuiExternal::browse(QString const & input,
QString const bufpath = bufferFilePath(); QString const bufpath = bufferFilePath();
QStringList const filter = templateFilters(template_name); 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); QString const dir1 = toqstr(lyxrc.document_path);
return browseRelToParent(input, bufpath, title, filter, false, label1, dir1); return browseRelToParent(input, bufpath, title, filter, false, label1, dir1);

View File

@ -789,8 +789,8 @@ QString GuiGraphics::browse(QString const & in_name) const
return browseRelToParent(in_name, bufferFilePath(), return browseRelToParent(in_name, bufferFilePath(),
title, fileFilters(QString()), false, title, fileFilters(QString()), false,
qt_("Clipart|#C#c"), toqstr(clipdir), qt_("&Clipart"), toqstr(clipdir),
qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); qt_("D&ocuments"), toqstr(lyxrc.document_path));
} }

View File

@ -327,7 +327,7 @@ QString GuiInclude::browse(QString const & in_name, Type in_type) const
QString const docpath = toqstr(support::onlyPath(buffer().absFileName())); QString const docpath = toqstr(support::onlyPath(buffer().absFileName()));
return browseRelToParent(in_name, docpath, title, filters, false, return browseRelToParent(in_name, docpath, title, filters, false,
qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); qt_("D&ocuments"), toqstr(lyxrc.document_path));
} }

View File

@ -138,11 +138,11 @@ QString browseLibFile(QString const & dir,
QStringList const & filters) QStringList const & filters)
{ {
// FIXME UNICODE // FIXME UNICODE
QString const label1 = qt_("System files|#S#s"); QString const label1 = qt_("&System files");
QString const dir1 = QString const dir1 =
toqstr(addName(package().system_support().absFileName(), fromqstr(dir))); 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 = QString const dir2 =
toqstr(addName(package().user_support().absFileName(), fromqstr(dir))); toqstr(addName(package().user_support().absFileName(), fromqstr(dir)));

View File

@ -2193,8 +2193,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
static FileName selectTemplateFile() static FileName selectTemplateFile()
{ {
FileDialog dlg(qt_("Select template file")); FileDialog dlg(qt_("Select template file"));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Templates|#T#t"), toqstr(lyxrc.template_path)); dlg.setButton2(qt_("&Templates"), toqstr(lyxrc.template_path));
FileDialog::Result result = dlg.open(toqstr(lyxrc.template_path), FileDialog::Result result = dlg.open(toqstr(lyxrc.template_path),
QStringList(qt_("LyX Documents (*.lyx)"))); QStringList(qt_("LyX Documents (*.lyx)")));
@ -2250,8 +2250,8 @@ void GuiView::openDocument(string const & fname)
if (fname.empty()) { if (fname.empty()) {
FileDialog dlg(qt_("Select document to open")); FileDialog dlg(qt_("Select document to open"));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Examples|#E#e"), toqstr(lyxrc.example_path)); dlg.setButton2(qt_("&Examples"), toqstr(lyxrc.example_path));
QStringList const filter(qt_("LyX Documents (*.lyx)")); QStringList const filter(qt_("LyX Documents (*.lyx)"));
FileDialog::Result result = FileDialog::Result result =
@ -2388,8 +2388,8 @@ void GuiView::importDocument(string const & argument)
theFormats().prettyName(format)); theFormats().prettyName(format));
FileDialog dlg(toqstr(text)); FileDialog dlg(toqstr(text));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Examples|#E#e"), toqstr(lyxrc.example_path)); dlg.setButton2(qt_("&Examples"), toqstr(lyxrc.example_path));
docstring filter = theFormats().prettyName(format); docstring filter = theFormats().prettyName(format);
filter += " (*.{"; filter += " (*.{";
@ -2521,8 +2521,8 @@ void GuiView::insertLyXFile(docstring const & fname)
// FIXME UNICODE // FIXME UNICODE
FileDialog dlg(qt_("Select LyX document to insert")); FileDialog dlg(qt_("Select LyX document to insert"));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Examples|#E#e"), toqstr(lyxrc.example_path)); dlg.setButton2(qt_("&Examples"), toqstr(lyxrc.example_path));
FileDialog::Result result = dlg.open(toqstr(initpath), FileDialog::Result result = dlg.open(toqstr(initpath),
QStringList(qt_("LyX Documents (*.lyx)"))); 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. // No argument? Ask user through dialog.
// FIXME UNICODE // FIXME UNICODE
FileDialog dlg(qt_("Choose a filename to save document as")); FileDialog dlg(qt_("Choose a filename to save document as"));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Templates|#T#t"), toqstr(lyxrc.template_path)); dlg.setButton2(qt_("&Templates"), toqstr(lyxrc.template_path));
if (!isLyXFileName(fname.absFileName())) if (!isLyXFileName(fname.absFileName()))
fname.changeExtension(".lyx"); fname.changeExtension(".lyx");
@ -2679,7 +2679,7 @@ bool GuiView::exportBufferAs(Buffer & b, docstring const & iformat)
FileName fname = b.fileName(); FileName fname = b.fileName();
FileDialog dlg(qt_("Choose a filename to export the document as")); 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; QStringList types;
QString const anyformat = qt_("Guess from extension (*.*)"); QString const anyformat = qt_("Guess from extension (*.*)");

View File

@ -25,21 +25,6 @@ using namespace lyx::support;
namespace lyx { 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, LyXFileDialog::LyXFileDialog(QString const & title,
QString const & path, QString const & path,
@ -60,7 +45,7 @@ LyXFileDialog::LyXFileDialog(QString const & title,
b1_dir_ = b1.second; b1_dir_ = b1.second;
QToolButton * tb = new QToolButton(this); QToolButton * tb = new QToolButton(this);
connect(tb, SIGNAL(clicked()), this, SLOT(button1Clicked())); connect(tb, SIGNAL(clicked()), this, SLOT(button1Clicked()));
tb->setText(getLabel(b1.first)); tb->setText(b1.first);
layout.at(0)->addWidget(tb); layout.at(0)->addWidget(tb);
} }
@ -68,7 +53,7 @@ LyXFileDialog::LyXFileDialog(QString const & title,
b2_dir_ = b2.second; b2_dir_ = b2.second;
QToolButton * tb = new QToolButton(this); QToolButton * tb = new QToolButton(this);
connect(tb, SIGNAL(clicked()), this, SLOT(button2Clicked())); connect(tb, SIGNAL(clicked()), this, SLOT(button2Clicked()));
tb->setText(getLabel(b2.first)); tb->setText(b2.first);
layout.at(0)->addWidget(tb); layout.at(0)->addWidget(tb);
} }
} }