1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-26 11:02:47 +02:00

Converted public fields of MessageBox to private.

This commit is contained in:
Maarten ter Huurne 2010-07-27 20:59:28 +02:00
parent 4de52ca2a1
commit 8f98a4b135
3 changed files with 17 additions and 12 deletions

View File

@ -492,8 +492,8 @@ void GMenu2X::viewLog() {
td.exec(); td.exec();
MessageBox mb(this, tr["Do you want to delete the log file?"], "icons/ebook.png"); MessageBox mb(this, tr["Do you want to delete the log file?"], "icons/ebook.png");
mb.buttons[ACTION_B] = tr["Yes"]; mb.setButton(ACTION_B, tr["Yes"]);
mb.buttons[ACTION_X] = tr["No"]; mb.setButton(ACTION_X, tr["No"]);
if (mb.exec() == ACTION_B) { if (mb.exec() == ACTION_B) {
ledOn(); ledOn();
unlink(logfile.c_str()); unlink(logfile.c_str());
@ -1221,7 +1221,7 @@ void GMenu2X::activateSdUsb() {
} else { } else {
system("scripts/usbon.sh sd"); system("scripts/usbon.sh sd");
MessageBox mb(this,tr["USB Enabled (SD)"],"icons/usb.png"); MessageBox mb(this,tr["USB Enabled (SD)"],"icons/usb.png");
mb.buttons[ACTION_B] = tr["Turn off"]; mb.setButton(ACTION_B, tr["Turn off"]);
mb.exec(); mb.exec();
system("scripts/usboff.sh sd"); system("scripts/usboff.sh sd");
} }
@ -1234,7 +1234,7 @@ void GMenu2X::activateNandUsb() {
} else { } else {
system("scripts/usbon.sh nand"); system("scripts/usbon.sh nand");
MessageBox mb(this,tr["USB Enabled (Nand)"],"icons/usb.png"); MessageBox mb(this,tr["USB Enabled (Nand)"],"icons/usb.png");
mb.buttons[ACTION_B] = tr["Turn off"]; mb.setButton(ACTION_B, tr["Turn off"]);
mb.exec(); mb.exec();
system("scripts/usboff.sh nand"); system("scripts/usboff.sh nand");
} }
@ -1247,7 +1247,7 @@ void GMenu2X::activateRootUsb() {
} else { } else {
system("scripts/usbon.sh root"); system("scripts/usbon.sh root");
MessageBox mb(this,tr["USB Enabled (Root)"],"icons/usb.png"); MessageBox mb(this,tr["USB Enabled (Root)"],"icons/usb.png");
mb.buttons[ACTION_B] = tr["Turn off"]; mb.setButton(ACTION_B, tr["Turn off"]);
mb.exec(); mb.exec();
system("scripts/usboff.sh root"); system("scripts/usboff.sh root");
} }
@ -1501,8 +1501,8 @@ void GMenu2X::editLink() {
void GMenu2X::deleteLink() { void GMenu2X::deleteLink() {
if (menu->selLinkApp()!=NULL) { if (menu->selLinkApp()!=NULL) {
MessageBox mb(this, tr.translate("Deleting $1",menu->selLink()->getTitle().c_str(),NULL)+"\n"+tr["Are you sure?"], menu->selLink()->getIconPath()); MessageBox mb(this, tr.translate("Deleting $1",menu->selLink()->getTitle().c_str(),NULL)+"\n"+tr["Are you sure?"], menu->selLink()->getIconPath());
mb.buttons[ACTION_B] = tr["Yes"]; mb.setButton(ACTION_B, tr["Yes"]);
mb.buttons[ACTION_X] = tr["No"]; mb.setButton(ACTION_X, tr["No"]);
if (mb.exec() == ACTION_B) { if (mb.exec() == ACTION_B) {
ledOn(); ledOn();
menu->deleteSelectedLink(); menu->deleteSelectedLink();
@ -1563,8 +1563,8 @@ void GMenu2X::renameSection() {
void GMenu2X::deleteSection() { void GMenu2X::deleteSection() {
MessageBox mb(this,tr["You will lose all the links in this section."]+"\n"+tr["Are you sure?"]); MessageBox mb(this,tr["You will lose all the links in this section."]+"\n"+tr["Are you sure?"]);
mb.buttons[ACTION_B] = tr["Yes"]; mb.setButton(ACTION_B, tr["Yes"]);
mb.buttons[ACTION_X] = tr["No"]; mb.setButton(ACTION_X, tr["No"]);
if (mb.exec() == ACTION_B) { if (mb.exec() == ACTION_B) {
ledOn(); ledOn();
if (rmtree(path+"sections/"+menu->selSection())) { if (rmtree(path+"sections/"+menu->selSection())) {

View File

@ -59,6 +59,10 @@ MessageBox::MessageBox(GMenu2X *gmenu2x, const string &text, const string &icon)
buttonLabels[ACTION_VOLDOWN] = "vol-"; buttonLabels[ACTION_VOLDOWN] = "vol-";
} }
void MessageBox::setButton(int action, const string &btn) {
buttons[action] = btn;
}
int MessageBox::exec() { int MessageBox::exec() {
int result = -1; int result = -1;

View File

@ -36,12 +36,13 @@ class MessageBox {
private: private:
string text, icon; string text, icon;
GMenu2X *gmenu2x; GMenu2X *gmenu2x;
public:
MessageBox(GMenu2X *gmenu2x, const string &text, const string &icon="");
vector<string> buttons; vector<string> buttons;
vector<string> buttonLabels; vector<string> buttonLabels;
vector<SDL_Rect> buttonPositions; vector<SDL_Rect> buttonPositions;
public:
MessageBox(GMenu2X *gmenu2x, const string &text, const string &icon="");
void setButton(int action, const string &btn);
int exec(); int exec();
}; };