Skip to content

Commit

Permalink
ыщке other formats by library,name
Browse files Browse the repository at this point in the history
  • Loading branch information
w17 committed Sep 6, 2017
1 parent 822262f commit 2d52beb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
4 changes: 4 additions & 0 deletions plugins/arclite/changelog
@@ -1,3 +1,7 @@
w17 06.09.2017 17:35:57 +0300 - build 258

1. Sort other formats by (library, name).

w17 06.09.2017 15:56:47 +0300 - build 257

1. Skip external Zip codecs in 7z compression method list.
Expand Down
2 changes: 1 addition & 1 deletion plugins/arclite/project.ini
Expand Up @@ -2,4 +2,4 @@
MODULE = arclite
VER_MAJOR = 3
VER_MINOR = 0
VER_BUILD = 257
VER_BUILD = 258
31 changes: 20 additions & 11 deletions plugins/arclite/ui.cpp
Expand Up @@ -1306,29 +1306,38 @@ class UpdateDialog: public Far::Dialog {
}
};

vector<wstring> format_names;
unsigned other_format_index = 0;
bool found = false;
for (ArcFormats::const_iterator arc_iter = arc_formats.begin(); arc_iter != arc_formats.end(); arc_iter++) {
if (arc_iter->second.updatable && (!multifile || !ArcAPI::is_single_file_format(arc_iter->first))) {
if (!multifile && arc_iter->first == c_SWFc && !is_SWFu(options.arc_path))
continue;
const auto main_type = find(main_formats.begin(), main_formats.end(), arc_iter->first);
if (main_type == main_formats.end()) {
if (find(main_formats.begin(), main_formats.end(), arc_iter->first) == main_formats.end()) {
other_formats.push_back(arc_iter->first);
format_names.push_back(arc_iter->second.name);
if (options.arc_type == arc_iter->first) {
other_format_index = static_cast<unsigned>(other_formats.size()) - 1;
found = true;
}
}
}
}
std::sort(other_formats.begin(), other_formats.end(), [&](const auto& a, const auto& b) {
const auto& a_format = arc_formats.at(a);
const auto& b_format = arc_formats.at(b);
if (a_format.lib_index != b_format.lib_index)
return a_format.lib_index < b_format.lib_index;
else
return _wcsicmp(a_format.name.data(), b_format.name.data()) < 0;
});
vector<wstring> other_format_names;
unsigned other_format_index = 0;
bool found = false;
for (const auto& t : other_formats) {
if (t == options.arc_type) {
other_format_index = static_cast<unsigned>(other_formats.size()) - 1;
found = true;
}
other_format_names.push_back(arc_formats.at(t).name);
}
if (!other_formats.empty()) {
if (!main_formats.empty())
spacer(1);
other_formats_ctrl_id = radio_button(Far::get_msg(MSG_UPDATE_DLG_ARC_TYPE_OTHER), found);
combo_box(format_names, other_format_index, AUTO_SIZE, DIF_DROPDOWNLIST);
combo_box(other_format_names, other_format_index, AUTO_SIZE, DIF_DROPDOWNLIST);
}

new_line();
Expand Down

0 comments on commit 2d52beb

Please sign in to comment.