feat: Make directories stand out more in local file browser: "[dir]" instead of "dir" (#1339)
## Summary * **What is the goal of this PR?** It's difficult to distinguish directory names from normal file entries, so they are displayed now as "[dir]" instead of "dir" for classic theme * **What changes are included?** ## Additional Context * Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks, specific areas to focus on). --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**NO**_
This commit is contained in:
@@ -239,7 +239,11 @@ void FileBrowserActivity::loop() {
|
|||||||
|
|
||||||
std::string getFileName(std::string filename) {
|
std::string getFileName(std::string filename) {
|
||||||
if (filename.back() == '/') {
|
if (filename.back() == '/') {
|
||||||
return filename.substr(0, filename.length() - 1);
|
filename.pop_back();
|
||||||
|
if (!UITheme::getInstance().getTheme().showsFileIcons()) {
|
||||||
|
return "[" + filename + "]";
|
||||||
|
}
|
||||||
|
return filename;
|
||||||
}
|
}
|
||||||
const auto pos = filename.rfind('.');
|
const auto pos = filename.rfind('.');
|
||||||
return filename.substr(0, pos);
|
return filename.substr(0, pos);
|
||||||
|
|||||||
@@ -141,4 +141,5 @@ class BaseTheme {
|
|||||||
virtual void drawHelpText(const GfxRenderer& renderer, Rect rect, const char* label) const;
|
virtual void drawHelpText(const GfxRenderer& renderer, Rect rect, const char* label) const;
|
||||||
virtual void drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth) const;
|
virtual void drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth) const;
|
||||||
virtual void drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const char* label, const bool isSelected) const;
|
virtual void drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const char* label, const bool isSelected) const;
|
||||||
|
virtual bool showsFileIcons() const { return false; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,4 +68,5 @@ class LyraTheme : public BaseTheme {
|
|||||||
void fillPopupProgress(const GfxRenderer& renderer, const Rect& layout, const int progress) const override;
|
void fillPopupProgress(const GfxRenderer& renderer, const Rect& layout, const int progress) const override;
|
||||||
void drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth) const override;
|
void drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth) const override;
|
||||||
void drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const char* label, const bool isSelected) const override;
|
void drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const char* label, const bool isSelected) const override;
|
||||||
|
bool showsFileIcons() const override { return true; }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user