updated PathWidget to skip reloading if path has not changed

This commit is contained in:
Thomas Jentzsch 2022-07-02 20:59:33 +02:00
parent 7dc71fec94
commit c90908327c
2 changed files with 6 additions and 8 deletions

View File

@ -154,6 +154,11 @@ NavigationWidget::PathWidget::PathWidget(GuiObject* boss, CommandReceiver* targe
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void NavigationWidget::PathWidget::setPath(const string& path) void NavigationWidget::PathWidget::setPath(const string& path)
{ {
if(path == myLastPath)
return;
myLastPath = path;
const int fontWidth = _font.getMaxCharWidth(); const int fontWidth = _font.getMaxCharWidth();
int x = _x + fontWidth, w = _w; int x = _x + fontWidth, w = _w;
FSNode node(path); FSNode node(path);

View File

@ -71,14 +71,7 @@ class NavigationWidget : public Widget
const string& getPath(int idx) const; const string& getPath(int idx) const;
private: private:
struct PathType string myLastPath;
{
string path;
StaticTextWidget* widget{nullptr};
explicit PathType(const string& _path, StaticTextWidget* _widget)
: path{_path}, widget{_widget} {}
};
std::vector<FolderLinkWidget*> myFolderList; std::vector<FolderLinkWidget*> myFolderList;
CommandReceiver* myTarget{nullptr}; CommandReceiver* myTarget{nullptr};