Add tag icon in thumbnail to identify as user defined

This commit is contained in:
Bruno
2021-08-04 00:29:31 +02:00
parent 9a87764949
commit 5eddfcf196
3 changed files with 12 additions and 2 deletions

View File

@@ -56,8 +56,10 @@ SessionInformation SessionCreator::info(const std::string& filename)
if (session != nullptr ) { if (session != nullptr ) {
const XMLElement *thumbnailelement = session->FirstChildElement("Thumbnail"); const XMLElement *thumbnailelement = session->FirstChildElement("Thumbnail");
// if there is a user defined thumbnail, get it // if there is a user defined thumbnail, get it
if (thumbnailelement) if (thumbnailelement) {
ret.thumbnail = XMLToImage(thumbnailelement); ret.thumbnail = XMLToImage(thumbnailelement);
ret.user_thumbnail_ = true;
}
// otherwise get the default saved thumbnail in session // otherwise get the default saved thumbnail in session
else else
ret.thumbnail = XMLToImage(session); ret.thumbnail = XMLToImage(session);

View File

@@ -82,9 +82,11 @@ protected:
struct SessionInformation { struct SessionInformation {
std::string description; std::string description;
FrameBufferImage *thumbnail; FrameBufferImage *thumbnail;
bool user_thumbnail_;
SessionInformation() { SessionInformation() {
description = ""; description = "";
thumbnail = nullptr; thumbnail = nullptr;
user_thumbnail_ = false;
} }
}; };

View File

@@ -4118,6 +4118,7 @@ void Navigator::RenderMainPannelVimix()
static std::string _file_info = ""; static std::string _file_info = "";
static Thumbnail _file_thumbnail; static Thumbnail _file_thumbnail;
static bool with_tag_ = false;
// load info only if changed from the one already displayed // load info only if changed from the one already displayed
if (_displayed_over != _file_over) { if (_displayed_over != _file_over) {
@@ -4127,6 +4128,7 @@ void Navigator::RenderMainPannelVimix()
if (info.thumbnail) { if (info.thumbnail) {
// set image content to thumbnail display // set image content to thumbnail display
_file_thumbnail.fill( info.thumbnail ); _file_thumbnail.fill( info.thumbnail );
with_tag_ = info.user_thumbnail_;
delete info.thumbnail; delete info.thumbnail;
} else } else
_file_thumbnail.reset(); _file_thumbnail.reset();
@@ -4135,10 +4137,14 @@ void Navigator::RenderMainPannelVimix()
if ( !_file_info.empty()) { if ( !_file_info.empty()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImVec2 p_ = ImGui::GetCursorScreenPos();
_file_thumbnail.Render(size.x); _file_thumbnail.Render(size.x);
ImGui::Text("%s", _file_info.c_str()); ImGui::Text("%s", _file_info.c_str());
if (with_tag_) {
ImGui::SetCursorScreenPos(p_ + ImVec2(6, 6));
ImGui::Text(ICON_FA_TAG);
}
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
else else
selection_session_mode_changed = true; selection_session_mode_changed = true;