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 ) {
const XMLElement *thumbnailelement = session->FirstChildElement("Thumbnail");
// if there is a user defined thumbnail, get it
if (thumbnailelement)
if (thumbnailelement) {
ret.thumbnail = XMLToImage(thumbnailelement);
ret.user_thumbnail_ = true;
}
// otherwise get the default saved thumbnail in session
else
ret.thumbnail = XMLToImage(session);

View File

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

View File

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