FIX: show printer file path & title

Change-Id: Ie5eff188c3039deeca5da96b54407194bf8910a0
Jira: STUDIO-6268
This commit is contained in:
chunmao.guo 2024-02-18 14:58:44 +08:00 committed by Lane.Wei
parent 74d4213ccf
commit 87a98ce1fa
2 changed files with 11 additions and 4 deletions

View File

@ -295,9 +295,16 @@ void ImageGrid::mouseMoved(wxMouseEvent& event)
if (hit != std::make_pair(m_hit_type, m_hit_item)) { if (hit != std::make_pair(m_hit_type, m_hit_item)) {
m_hit_type = hit.first; m_hit_type = hit.first;
m_hit_item = hit.second; m_hit_item = hit.second;
if (hit.first == HIT_ITEM) if (hit.first == HIT_ITEM) {
SetToolTip(from_u8(m_file_sys->GetFile(hit.second).Title())); SetToolTip({});
else auto & file = m_file_sys->GetFile(hit.second);
if (auto title = file.Title(); !title.empty()) {
auto tip = wxString::Format(_L("File: %s\nTitle: %s\n"), from_u8(file.name), from_u8(title));
SetToolTip(tip);
} else {
SetToolTip(from_u8(file.name));
}
} else
SetToolTip({}); SetToolTip({});
Refresh(); Refresh();
} }

View File

@ -376,7 +376,7 @@ size_t PrinterFileSystem::GetCount() const
int PrinterFileSystem::File::DownloadProgress() const { return download ? download->progress : !local_path.empty() ? 100 : -2; } int PrinterFileSystem::File::DownloadProgress() const { return download ? download->progress : !local_path.empty() ? 100 : -2; }
std::string PrinterFileSystem::File::Title() const { return Metadata("Title", name); } std::string PrinterFileSystem::File::Title() const { return Metadata("Title", ""); }
std::string PrinterFileSystem::File::Metadata(std::string const &key, std::string const &dflt) const std::string PrinterFileSystem::File::Metadata(std::string const &key, std::string const &dflt) const
{ {