mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-02 14:01:10 +00:00
Factor out some common code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31655 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
973b0e25fb
commit
5f8f8dd947
@ -1835,14 +1835,13 @@ void PrefFileformats::updatePrettyname()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrefFileformats::updateViewers()
|
namespace {
|
||||||
{
|
void updateComboBox(LyXRC::Alternatives const & alts,
|
||||||
Format const f = currentFormat();
|
string const & fmt, QComboBox * combo)
|
||||||
viewerCO->clear();
|
{
|
||||||
viewerCO->addItem(qt_("None"), QString());
|
|
||||||
LyXRC::Alternatives::const_iterator it =
|
LyXRC::Alternatives::const_iterator it =
|
||||||
viewer_alternatives.find(f.name());
|
alts.find(fmt);
|
||||||
if (it != viewer_alternatives.end()) {
|
if (it != alts.end()) {
|
||||||
LyXRC::CommandSet const & cmds = it->second;
|
LyXRC::CommandSet const & cmds = it->second;
|
||||||
LyXRC::CommandSet::const_iterator sit =
|
LyXRC::CommandSet::const_iterator sit =
|
||||||
cmds.begin();
|
cmds.begin();
|
||||||
@ -1850,9 +1849,19 @@ void PrefFileformats::updateViewers()
|
|||||||
cmds.end();
|
cmds.end();
|
||||||
for (; sit != sen; ++sit) {
|
for (; sit != sen; ++sit) {
|
||||||
QString const qcmd = toqstr(*sit);
|
QString const qcmd = toqstr(*sit);
|
||||||
viewerCO->addItem(qcmd, qcmd);
|
combo->addItem(qcmd, qcmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PrefFileformats::updateViewers()
|
||||||
|
{
|
||||||
|
Format const f = currentFormat();
|
||||||
|
viewerCO->clear();
|
||||||
|
viewerCO->addItem(qt_("None"), QString());
|
||||||
|
updateComboBox(viewer_alternatives, f.name(), viewerCO);
|
||||||
viewerCO->addItem(qt_("Custom"), QString("custom viewer"));
|
viewerCO->addItem(qt_("Custom"), QString("custom viewer"));
|
||||||
|
|
||||||
int pos = viewerCO->findData(toqstr(f.viewer()));
|
int pos = viewerCO->findData(toqstr(f.viewer()));
|
||||||
@ -1873,19 +1882,7 @@ void PrefFileformats::updateEditors()
|
|||||||
Format const f = currentFormat();
|
Format const f = currentFormat();
|
||||||
editorCO->clear();
|
editorCO->clear();
|
||||||
editorCO->addItem(qt_("None"), QString());
|
editorCO->addItem(qt_("None"), QString());
|
||||||
LyXRC::Alternatives::const_iterator it =
|
updateComboBox(editor_alternatives, f.name(), editorCO);
|
||||||
editor_alternatives.find(f.name());
|
|
||||||
if (it != editor_alternatives.end()) {
|
|
||||||
LyXRC::CommandSet const & cmds = it->second;
|
|
||||||
LyXRC::CommandSet::const_iterator sit =
|
|
||||||
cmds.begin();
|
|
||||||
LyXRC::CommandSet::const_iterator const sen =
|
|
||||||
cmds.end();
|
|
||||||
for (; sit != sen; ++sit) {
|
|
||||||
QString const qcmd = toqstr(*sit);
|
|
||||||
editorCO->addItem(qcmd, qcmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
editorCO->addItem(qt_("Custom"), QString("custom editor"));
|
editorCO->addItem(qt_("Custom"), QString("custom editor"));
|
||||||
|
|
||||||
int pos = editorCO->findData(toqstr(f.editor()));
|
int pos = editorCO->findData(toqstr(f.editor()));
|
||||||
|
Loading…
Reference in New Issue
Block a user