1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-29 15:52:48 +02:00

Converted public fields of InputDialog to private.

This commit is contained in:
Maarten ter Huurne 2010-07-26 05:58:06 +02:00
parent 07bad5ade1
commit 40ead3b642
3 changed files with 12 additions and 8 deletions

View File

@ -1516,10 +1516,11 @@ void GMenu2X::addSection() {
InputDialog id(this,tr["Insert a name for the new section"]); InputDialog id(this,tr["Insert a name for the new section"]);
if (id.exec()) { if (id.exec()) {
//only if a section with the same name does not exist //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 //section directory doesn't exists
ledOn(); ledOn();
if (menu->addSection(id.input)) { if (menu->addSection(id.getInput())) {
menu->setSectionIndex( menu->sections.size()-1 ); //switch to the new section menu->setSectionIndex( menu->sections.size()-1 ); //switch to the new section
sync(); sync();
} }
@ -1532,10 +1533,12 @@ void GMenu2X::renameSection() {
InputDialog id(this,tr["Insert a new name for this section"],menu->selSection()); InputDialog id(this,tr["Insert a new name for this section"],menu->selSection());
if (id.exec()) { if (id.exec()) {
//only if a section with the same name does not exist & !samename //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 //section directory doesn't exists
string newsectiondir = "sections/"+id.input; string newsectiondir = "sections/" + id.getInput();
string sectiondir = "sections/"+menu->selSection(); string sectiondir = "sections/" + menu->selSection();
ledOn(); ledOn();
if (rename(sectiondir.c_str(), "tmpsection")==0 && rename("tmpsection", newsectiondir.c_str())==0) { if (rename(sectiondir.c_str(), "tmpsection")==0 && rename("tmpsection", newsectiondir.c_str())==0) {
string oldpng = sectiondir+".png", newpng = newsectiondir+".png"; string oldpng = sectiondir+".png", newpng = newsectiondir+".png";
@ -1550,7 +1553,7 @@ void GMenu2X::renameSection() {
sc.move("skin:"+oldpng, "skin:"+newpng); sc.move("skin:"+oldpng, "skin:"+newpng);
} }
} }
menu->sections[menu->selSectionIndex()] = id.input; menu->sections[menu->selSectionIndex()] = id.getInput();
sync(); sync();
} }
ledOff(); ledOff();

View File

@ -57,6 +57,7 @@ private:
int kbLength, kbWidth, kbHeight, kbLeft; int kbLength, kbWidth, kbHeight, kbLeft;
SDL_Rect kbRect; SDL_Rect kbRect;
IconButton *btnBackspaceX, *btnBackspaceL, *btnSpace, *btnConfirm, *btnChangeKeys; IconButton *btnBackspaceX, *btnBackspaceL, *btnSpace, *btnConfirm, *btnChangeKeys;
string input;
void backspace(); void backspace();
void space(); void space();
@ -69,8 +70,8 @@ private:
public: public:
InputDialog(GMenu2X *gmenu2x, const string &text, const string &startvalue="", const string &title="", const string &icon=""); InputDialog(GMenu2X *gmenu2x, const string &text, const string &startvalue="", const string &title="", const string &icon="");
string input;
bool exec(); bool exec();
const string &getInput() { return input; }
}; };
#endif /*INPUTDIALOG_H_*/ #endif /*INPUTDIALOG_H_*/

View File

@ -77,7 +77,7 @@ void MenuSettingString::clear()
void MenuSettingString::edit() void MenuSettingString::edit()
{ {
InputDialog id(gmenu2x,description,value(), diagTitle,diagIcon); InputDialog id(gmenu2x,description,value(), diagTitle,diagIcon);
if (id.exec()) setValue(id.input); if (id.exec()) setValue(id.getInput());
} }
bool MenuSettingString::edited() { bool MenuSettingString::edited() {