mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
Fixed translation of grids
This commit is contained in:
parent
168167f7cc
commit
e40231348c
1
HISTORY
1
HISTORY
@ -223,3 +223,4 @@ Version 0.3.0
|
||||
Version 0.3.1
|
||||
|
||||
- Fixed hide root menu from a subview template
|
||||
- Fixed translation of grids
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user