Since we're now caching this, we can sort it once, rather than

lots of times.

(cherry picked from commit 7fd1a14c1b)
This commit is contained in:
Richard Heck 2016-10-19 17:28:51 -04:00
parent 2775295014
commit 1cdbf23d69
3 changed files with 4 additions and 6 deletions

View File

@ -2436,6 +2436,7 @@ vector<Format const *> const & BufferParams::exportableFormats(bool only_viewabl
theConverters().getReachable(*it, only_viewable, false, excludes);
result.insert(result.end(), r.begin(), r.end());
}
sort(result.begin(), result.end(), Format::formatSorter);
cached = result;
valid = true;
return cached;

View File

@ -2545,11 +2545,9 @@ void GuiDocument::updateDefaultFormat()
outputModule->defaultFormatCO->clear();
outputModule->defaultFormatCO->addItem(qt_("Default"),
QVariant(QString("default")));
typedef vector<Format const *> Formats;
Formats formats = param_copy.exportableFormats(true);
sort(formats.begin(), formats.end(), Format::formatSorter);
Formats::const_iterator cit = formats.begin();
Formats::const_iterator end = formats.end();
vector<Format const *> const & formats = param_copy.exportableFormats(true);
vector<Format const *>::const_iterator cit = formats.begin();
vector<Format const *>::const_iterator end = formats.end();
for (; cit != end; ++cit)
outputModule->defaultFormatCO->addItem(qt_((*cit)->prettyname()),
QVariant(toqstr((*cit)->name())));

View File

@ -1055,7 +1055,6 @@ void MenuDefinition::expandFormats(MenuItem::Kind const kind, Buffer const * buf
LATTEST(false);
return;
}
sort(formats.begin(), formats.end(), Format::formatSorter);
bool const view_update = (kind == MenuItem::ViewFormats
|| kind == MenuItem::UpdateFormats);