diff --git a/src/ui/listView.cpp b/src/ui/listView.cpp index b62088c..b302627 100644 --- a/src/ui/listView.cpp +++ b/src/ui/listView.cpp @@ -64,8 +64,10 @@ ListView::~ListView() delete _font; } -void ListView::drawHeader(const string &headerText) +void ListView::drawHeader(string headerText) { + headerText = Util::replaceString(headerText,"%20"," "); + _font = OpenFont("LiberationMono", 35, 1); SetFont(_font, BLACK); diff --git a/src/ui/listView.h b/src/ui/listView.h index 3a927fe..aed4779 100644 --- a/src/ui/listView.h +++ b/src/ui/listView.h @@ -39,7 +39,7 @@ public: * draws the header including an item to navigate a page up * */ - void drawHeader(const string &headerText); + void drawHeader(string headerText); /** * draws the footer including a page changer diff --git a/src/util/item.cpp b/src/util/item.cpp index c709bd9..0be69eb 100644 --- a/src/util/item.cpp +++ b/src/util/item.cpp @@ -49,6 +49,7 @@ Item::Item(const string &xmlItem) } _title = _title.substr(_title.find_last_of("/") + 1, _title.length()); + _title = Util::replaceString(_title,"%20"," "); } void Item::open() const @@ -72,4 +73,4 @@ void Item::open() const { Message(3, "Warning", "The filetype is currently not supported. :/", 600); } -} +} \ No newline at end of file diff --git a/src/util/util.cpp b/src/util/util.cpp index 6934738..3851115 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -81,4 +81,14 @@ string Util::getXMLAttribute(const string &buffer, const string &name) } return NULL; +} + +string Util::replaceString(string item, const string& find, const string& to) +{ + for (size_t pos = item.find(find); pos != string::npos; pos = item.find(find, pos)) + { + item.replace(pos, find.length(), to); + } + + return item; } \ No newline at end of file diff --git a/src/util/util.h b/src/util/util.h index 75c9fee..eb87cbb 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -57,6 +57,8 @@ public: */ static string getXMLAttribute(const string &buffer, const string &name); + static string replaceString(string item,const string& find,const string& to); + private: Util() {} };