MainBar: fixup file extension filter in "Import File" dialog
authorGerhard Sittig <gerhard.sittig@gmx.net>
Sun, 4 Feb 2018 13:54:32 +0000 (14:54 +0100)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 10 Feb 2018 19:35:32 +0000 (20:35 +0100)
commitca1d6d5f466272ac7e906b589e2804b12568fa96
tree08a5ae9755fef884727f49657d283eec2ea16d74
parentb5d20c6d003d853ad0828d15b365988519e73e88
MainBar: fixup file extension filter in "Import File" dialog

The previous implementation used a "*" filter when a file of any other
format than srzip got imported. This happened to be a duplicate of
"All files", and ignored the list of filename extensions provided by
the input formats.

This change does respect the input format's file extensions, and copes
with the lack of such a list (raw binary), as well as lists that have
one (most formats), or multiple extensions (raw analog).

This fixes bug #1039.

Another byproduct of the change is that extensions and their decoration
(separators, parentheses) move outside of tr() calls. These technical
details shall not concern translators, and translations for human
languages shall not break the filter mechanism.

This implementation might be "too complex, computationally expensive".
But it works, and fixes an issue, and the code path executes seldom and
waits for user interaction anyway. Cost reduction can get applied later.
pv/toolbars/mainbar.cpp