Add icon to show hardware decoding info in source panel

This commit is contained in:
Bruno Herbelin
2023-06-01 23:42:29 +02:00
parent 514d4170be
commit d7d099d2d7

View File

@@ -666,8 +666,9 @@ void ImGuiVisitor::visit (Source& s)
void ImGuiVisitor::visit (MediaSource& s) void ImGuiVisitor::visit (MediaSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos(); ImVec2 _top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN; _top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
ImVec2 top = _top;
// Media info // Media info
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
@@ -694,6 +695,16 @@ void ImGuiVisitor::visit (MediaSource& s)
if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
SystemToolkit::open(SystemToolkit::path_filename(s.path())); SystemToolkit::open(SystemToolkit::path_filename(s.path()));
// Icon to inform hardware decoding
std::string decoder = s.mediaplayer()->decoderName();
if ( decoder.compare("software") != 0) {
top = _top;
top.y += ImGui::GetFrameHeight();
ImGui::SetCursorPos(top);
decoder = "Using hardware decoder\n" + decoder;
ImGuiToolkit::Indication(decoder.c_str(), ICON_FA_MICROCHIP);
}
ImGui::SetCursorPos(botom); ImGui::SetCursorPos(botom);
} }
else { else {