diff options
author | louis <louis.braun@gmx.de> | 2015-03-20 16:43:20 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-03-20 16:43:20 +0100 |
commit | e40231348c36cb2161cfe64aa516a2cdb02f7171 (patch) | |
tree | ca911d2183b09f80a3e6dccc48cb831eba4d5c14 | |
parent | 168167f7ccae519f65e03affee55eb5c1430a896 (diff) | |
download | vdr-plugin-skindesigner-e40231348c36cb2161cfe64aa516a2cdb02f7171.tar.gz vdr-plugin-skindesigner-e40231348c36cb2161cfe64aa516a2cdb02f7171.tar.bz2 |
Fixed translation of grids
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | libtemplate/templateview.c | 49 | ||||
-rw-r--r-- | libtemplate/templateview.h | 3 |
3 files changed, 53 insertions, 0 deletions
@@ -223,3 +223,4 @@ Version 0.3.0 Version 0.3.1 - Fixed hide root menu from a subview template +- Fixed translation of grids diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index 97db545..e0cd079 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -92,6 +92,18 @@ cTemplateViewGrid *cTemplateView::GetViewGrid(int gridID) { return hit->second; } +void cTemplateView::InitViewGridIterator(void) { + geIt = viewGrids.begin(); +} + +cTemplateViewGrid *cTemplateView::GetNextViewGrid(void) { + if (geIt == viewGrids.end()) + return NULL; + cTemplateViewGrid *viewGrid = geIt->second; + geIt++; + return viewGrid; +} + cTemplateViewList *cTemplateView::GetViewList(eViewList vl) { map < eViewList, cTemplateViewList* >::iterator hit = viewLists.find(vl); if (hit == viewLists.end()) @@ -415,6 +427,43 @@ void cTemplateView::Translate(void) { } } + //Translate ViewGrids + InitViewGridIterator(); + cTemplateViewGrid *viewGrid = NULL; + while(viewGrid = GetNextViewGrid()) { + viewGrid->InitIterator(); + cTemplatePixmap *pix = NULL; + while(pix = viewGrid->GetNextPixmap()) { + pix->InitIterator(); + cTemplateFunction *func = NULL; + while(func = pix->GetNextFunction()) { + if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox) { + string text = func->GetParameter(ptText); + string translation; + bool translated = globals->Translate(text, translation); + if (translated) { + func->SetTranslatedText(translation); + } + } + if (func->GetType() == ftLoop) { + cTemplateLoopFunction *funcsLoop = dynamic_cast<cTemplateLoopFunction*>(func); + funcsLoop->InitIterator(); + cTemplateFunction *loopFunc = NULL; + while(loopFunc = funcsLoop->GetNextFunction()) { + if (loopFunc->GetType() == ftDrawText || loopFunc->GetType() == ftDrawTextBox) { + string text = loopFunc->GetParameter(ptText); + string translation; + bool translated = globals->Translate(text, translation); + if (translated) { + loopFunc->SetTranslatedText(translation); + } + } + } + } + } + } + } + //Translate Plugin Views for (map < string, map< int, cTemplateView*> >::iterator it = pluginViews.begin(); it != pluginViews.end(); it++) { map< int, cTemplateView*> plugViews = it->second; diff --git a/libtemplate/templateview.h b/libtemplate/templateview.h index 84bc9f1..fa55ba2 100644 --- a/libtemplate/templateview.h +++ b/libtemplate/templateview.h @@ -58,6 +58,7 @@ protected: //helpers to iterate data structures map < eViewElement, cTemplateViewElement* >::iterator veIt; map < eViewList, cTemplateViewList* >::iterator vlIt; + map < int, cTemplateViewGrid* >::iterator geIt; map < eSubView, cTemplateView* >::iterator svIt; vector< cTemplateViewTab* >::iterator vtIt; //helpers to check valid xml templates @@ -89,6 +90,8 @@ public: cTemplateViewElement *GetNextViewElement(void); //access view grids cTemplateViewGrid *GetViewGrid(int gridID); + void InitViewGridIterator(void); + cTemplateViewGrid *GetNextViewGrid(void); //access list elements cTemplateViewList *GetViewList(eViewList vl); void InitViewListIterator(void); |