diff options
-rw-r--r-- | displaymenu.c | 2 | ||||
-rw-r--r-- | menuitem.c | 33 | ||||
-rw-r--r-- | menuitem.h | 4 |
3 files changed, 19 insertions, 20 deletions
diff --git a/displaymenu.c b/displaymenu.c index a7c4940..7e41197 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -356,7 +356,7 @@ bool cNopacityDisplayMenu::SetItemRecording(const cRecording *Recording, int Ind bool isFolder = false; if (Total > 0) isFolder = true; - cNopacityMenuItem *item = new cNopacityRecordingMenuItem(osd, Recording, Selectable, isFolder, Total, New); + cNopacityMenuItem *item = new cNopacityRecordingMenuItem(osd, Recording, Selectable, isFolder, Level, Total, New); cPoint itemSize; menuView->GetMenuItemSize(MenuCategory(), &itemSize); item->SetFont(menuView->GetMenuItemFont(mcRecording)); @@ -2,6 +2,8 @@ #include <string> #include <sstream> #include <algorithm> +#include <iostream> +#include <vector> // cNopacityMenuItem ------------- @@ -577,9 +579,10 @@ void cNopacityChannelMenuItem::Render() { // cNopacityRecordingMenuItem ------------- -cNopacityRecordingMenuItem::cNopacityRecordingMenuItem(cOsd *osd, const cRecording *Recording, bool sel, bool isFolder, int Total, int New) : cNopacityMenuItem (osd, "", sel) { +cNopacityRecordingMenuItem::cNopacityRecordingMenuItem(cOsd *osd, const cRecording *Recording, bool sel, bool isFolder, int Level, int Total, int New) : cNopacityMenuItem (osd, "", sel) { this->Recording = Recording; this->isFolder = isFolder; + this->Level = Level; this->Total = Total; this->New = New; } @@ -605,23 +608,19 @@ void cNopacityRecordingMenuItem::CreatePixmapTextScroller(int totalWidth) { } void cNopacityRecordingMenuItem::CreateText() { - if (isFolder) { - const cRecordingInfo *recInfo = Recording->Info(); - strRecName = recInfo->Title(); - } else { - std::string recName = Recording->Name(); - if (Recording->IsEdited()) { - try { - if (recName.at(0) == '%') { - recName = recName.substr(1); - } - } catch (...) {} + std::string recName = Recording->Name(); + try { + std::vector<std::string> tokens; + std::istringstream f(recName.c_str()); + std::string s; + while (std::getline(f, s, FOLDERDELIMCHAR)) { + tokens.push_back(s); } - try { - if (recName.find(FOLDERDELIMCHAR) != std::string::npos) { - recName = recName.substr(recName.find(FOLDERDELIMCHAR) + 1); - } - } catch (...) {} + strRecName = tokens.at(Level); + if (!isFolder && Recording->IsEdited()) { + strRecName = strRecName.substr(1); + } + } catch (...) { strRecName = recName.c_str(); } } @@ -121,7 +121,7 @@ class cNopacityRecordingMenuItem : public cNopacityMenuItem { private: const cRecording *Recording; bool isFolder; - int Total, New; + int Level, Total, New; std::string strRecName; std::string strRecNameFull; void SetTextFull(void); @@ -138,7 +138,7 @@ private: int CheckScrollableRecording(void); int CheckScrollableFolder(void); public: - cNopacityRecordingMenuItem(cOsd *osd, const cRecording *Recording, bool sel, bool isFolder, int Total, int New); + cNopacityRecordingMenuItem(cOsd *osd, const cRecording *Recording, bool sel, bool isFolder, int Level, int Total, int New); ~cNopacityRecordingMenuItem(void); void CreatePixmapTextScroller(int totalWidth); void CreateText(void); |