src/gmenu2x.cpp |
1516 | 1516 | InputDialog id(this,tr["Insert a name for the new section"]); |
1517 | 1517 | if (id.exec()) { |
1518 | 1518 | //only if a section with the same name does not exist |
1519 | | if (find(menu->sections.begin(),menu->sections.end(),id.input)==menu->sections.end()) { |
| 1519 | if (find(menu->sections.begin(), menu->sections.end(), id.getInput()) |
| 1520 | == menu->sections.end()) { |
1520 | 1521 | //section directory doesn't exists |
1521 | 1522 | ledOn(); |
1522 | | if (menu->addSection(id.input)) { |
| 1523 | if (menu->addSection(id.getInput())) { |
1523 | 1524 | menu->setSectionIndex( menu->sections.size()-1 ); //switch to the new section |
1524 | 1525 | sync(); |
1525 | 1526 | } |
... | ... | |
1532 | 1533 | InputDialog id(this,tr["Insert a new name for this section"],menu->selSection()); |
1533 | 1534 | if (id.exec()) { |
1534 | 1535 | //only if a section with the same name does not exist & !samename |
1535 | | if (menu->selSection()!=id.input && find(menu->sections.begin(),menu->sections.end(),id.input)==menu->sections.end()) { |
| 1536 | if (menu->selSection() != id.getInput() |
| 1537 | && find(menu->sections.begin(),menu->sections.end(), id.getInput()) |
| 1538 | == menu->sections.end()) { |
1536 | 1539 | //section directory doesn't exists |
1537 | | string newsectiondir = "sections/"+id.input; |
1538 | | string sectiondir = "sections/"+menu->selSection(); |
| 1540 | string newsectiondir = "sections/" + id.getInput(); |
| 1541 | string sectiondir = "sections/" + menu->selSection(); |
1539 | 1542 | ledOn(); |
1540 | 1543 | if (rename(sectiondir.c_str(), "tmpsection")==0 && rename("tmpsection", newsectiondir.c_str())==0) { |
1541 | 1544 | string oldpng = sectiondir+".png", newpng = newsectiondir+".png"; |
... | ... | |
1550 | 1553 | sc.move("skin:"+oldpng, "skin:"+newpng); |
1551 | 1554 | } |
1552 | 1555 | } |
1553 | | menu->sections[menu->selSectionIndex()] = id.input; |
| 1556 | menu->sections[menu->selSectionIndex()] = id.getInput(); |
1554 | 1557 | sync(); |
1555 | 1558 | } |
1556 | 1559 | ledOff(); |
src/inputdialog.h |
57 | 57 | int kbLength, kbWidth, kbHeight, kbLeft; |
58 | 58 | SDL_Rect kbRect; |
59 | 59 | IconButton *btnBackspaceX, *btnBackspaceL, *btnSpace, *btnConfirm, *btnChangeKeys; |
| 60 | string input; |
60 | 61 | |
61 | 62 | void backspace(); |
62 | 63 | void space(); |
... | ... | |
69 | 70 | public: |
70 | 71 | InputDialog(GMenu2X *gmenu2x, const string &text, const string &startvalue="", const string &title="", const string &icon=""); |
71 | 72 | |
72 | | string input; |
73 | 73 | bool exec(); |
| 74 | const string &getInput() { return input; } |
74 | 75 | }; |
75 | 76 | |
76 | 77 | #endif /*INPUTDIALOG_H_*/ |