exifpanel: sort the list of exif tags

(cherry picked from commit 88e5ec5dc6a47d3a9cc751d2902aadc540ce0826)
This commit is contained in:
Alberto Griggio 2020-04-07 09:48:14 -07:00 committed by Lawrence Lee
parent 9735ba5768
commit f62f6807a7
No known key found for this signature in database
GPG Key ID: 048FF2B76A63895F
2 changed files with 13 additions and 6 deletions

View File

@ -174,7 +174,7 @@ void ExifPanel::setImageData (const FramesMetaData* id)
idata = id;
}
Gtk::TreeModel::Children ExifPanel::addTag(const std::string &key, const Glib::ustring &label, const Glib::ustring &value, bool editable, bool edited)
void ExifPanel::addTag(const std::string &key, const Glib::ustring &label, const Glib::ustring &value, bool editable, bool edited)
{
// TODO Re-fix #5923 if necessary
@ -184,7 +184,7 @@ Gtk::TreeModel::Children ExifPanel::addTag(const std::string &key, const Glib::u
auto root = exifTreeModel->children();
Gtk::TreeModel::Row row = * (exifTreeModel->append (root));
Gtk::TreeModel::Row row = *(exifTreeModel->append(root));
row[exifColumns.editable] = editable;
row[exifColumns.edited] = edited;
row[exifColumns.key] = key;
@ -200,8 +200,6 @@ Gtk::TreeModel::Children ExifPanel::addTag(const std::string &key, const Glib::u
} else if (editable) {
row[exifColumns.icon] = keepicon;
}
return row.children();
}
void ExifPanel::refreshTags()
@ -244,6 +242,7 @@ void ExifPanel::refreshTags()
addTag(pos->key(), pos->tagLabel(), pos->print(&exif), true, edited);
}
}
std::map<std::string, std::string> keymap;
for (const auto& tag : exif) {
const bool editable = ed.find(tag.key()) != ed.end();
if (
@ -255,9 +254,17 @@ void ExifPanel::refreshTags()
|| tag.size() < 256
)
) {
addTag(tag.key(), tag.tagLabel(), tag.print(&exif), false, false);
std::string lbl = tag.tagLabel();
for (auto &c : lbl) {
c = std::tolower(c);
}
keymap[lbl] = tag.key();
}
}
for (auto &p : keymap) {
auto &tag = *(exif.findKey(Exiv2::ExifKey(p.second)));
addTag(tag.key(), tag.tagLabel(), tag.print(&exif), false, false);
}
} catch (const std::exception& exc) {
return;
}

View File

@ -82,7 +82,7 @@ private:
const std::vector<std::pair<std::string, Glib::ustring>> editableTags;
Gtk::TreeModel::Children addTag(const std::string &key, const Glib::ustring &label, const Glib::ustring &value, bool editable, bool edited);
void addTag(const std::string &key, const Glib::ustring &label, const Glib::ustring &value, bool editable, bool edited);
void refreshTags();
void resetIt(const Gtk::TreeModel::const_iterator& iter);
void resetPressed();