From 40ead3b6425df9931eb7d5cea1dd2e5322980626 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Mon, 26 Jul 2010 05:58:06 +0200 Subject: [PATCH] Converted public fields of InputDialog to private. --- src/gmenu2x.cpp | 15 +++++++++------ src/inputdialog.h | 3 ++- src/menusettingstring.cpp | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 9e99447..d04a55d 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1516,10 +1516,11 @@ void GMenu2X::addSection() { InputDialog id(this,tr["Insert a name for the new section"]); if (id.exec()) { //only if a section with the same name does not exist - if (find(menu->sections.begin(),menu->sections.end(),id.input)==menu->sections.end()) { + if (find(menu->sections.begin(), menu->sections.end(), id.getInput()) + == menu->sections.end()) { //section directory doesn't exists ledOn(); - if (menu->addSection(id.input)) { + if (menu->addSection(id.getInput())) { menu->setSectionIndex( menu->sections.size()-1 ); //switch to the new section sync(); } @@ -1532,10 +1533,12 @@ void GMenu2X::renameSection() { InputDialog id(this,tr["Insert a new name for this section"],menu->selSection()); if (id.exec()) { //only if a section with the same name does not exist & !samename - if (menu->selSection()!=id.input && find(menu->sections.begin(),menu->sections.end(),id.input)==menu->sections.end()) { + if (menu->selSection() != id.getInput() + && find(menu->sections.begin(),menu->sections.end(), id.getInput()) + == menu->sections.end()) { //section directory doesn't exists - string newsectiondir = "sections/"+id.input; - string sectiondir = "sections/"+menu->selSection(); + string newsectiondir = "sections/" + id.getInput(); + string sectiondir = "sections/" + menu->selSection(); ledOn(); if (rename(sectiondir.c_str(), "tmpsection")==0 && rename("tmpsection", newsectiondir.c_str())==0) { string oldpng = sectiondir+".png", newpng = newsectiondir+".png"; @@ -1550,7 +1553,7 @@ void GMenu2X::renameSection() { sc.move("skin:"+oldpng, "skin:"+newpng); } } - menu->sections[menu->selSectionIndex()] = id.input; + menu->sections[menu->selSectionIndex()] = id.getInput(); sync(); } ledOff(); diff --git a/src/inputdialog.h b/src/inputdialog.h index 886de09..9b311c9 100644 --- a/src/inputdialog.h +++ b/src/inputdialog.h @@ -57,6 +57,7 @@ private: int kbLength, kbWidth, kbHeight, kbLeft; SDL_Rect kbRect; IconButton *btnBackspaceX, *btnBackspaceL, *btnSpace, *btnConfirm, *btnChangeKeys; + string input; void backspace(); void space(); @@ -69,8 +70,8 @@ private: public: InputDialog(GMenu2X *gmenu2x, const string &text, const string &startvalue="", const string &title="", const string &icon=""); - string input; bool exec(); + const string &getInput() { return input; } }; #endif /*INPUTDIALOG_H_*/ diff --git a/src/menusettingstring.cpp b/src/menusettingstring.cpp index fb7e031..04e3347 100644 --- a/src/menusettingstring.cpp +++ b/src/menusettingstring.cpp @@ -77,7 +77,7 @@ void MenuSettingString::clear() void MenuSettingString::edit() { InputDialog id(gmenu2x,description,value(), diagTitle,diagIcon); - if (id.exec()) setValue(id.input); + if (id.exec()) setValue(id.getInput()); } bool MenuSettingString::edited() {