1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-23 03:51:52 +02:00

Modified the key shortcuts of the file input dialog.

This commit is contained in:
Ayla 2011-09-18 02:21:04 +02:00
parent b5131c1db9
commit 5dd6d31b25
2 changed files with 16 additions and 6 deletions

View File

@ -18,7 +18,8 @@ BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
{ {
IconButton *btn; IconButton *btn;
btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Up one folder"]); buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/left.png"));
btn = new IconButton(gmenu2x, "skin:imgs/buttons/a.png", gmenu2x->tr["Up one folder"]);
btn->setAction(MakeDelegate(this, &BrowseDialog::directoryUp)); btn->setAction(MakeDelegate(this, &BrowseDialog::directoryUp));
buttonBox.add(btn); buttonBox.add(btn);
@ -30,6 +31,10 @@ BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
btn->setAction(MakeDelegate(this, &BrowseDialog::confirm)); btn->setAction(MakeDelegate(this, &BrowseDialog::confirm));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, "skin:imgs/buttons/select.png", gmenu2x->tr["Exit"]);
btn->setAction(MakeDelegate(this, &BrowseDialog::quit));
buttonBox.add(btn);
iconGoUp = gmenu2x->sc.skinRes("imgs/go-up.png"); iconGoUp = gmenu2x->sc.skinRes("imgs/go-up.png");
iconFolder = gmenu2x->sc.skinRes("imgs/folder.png"); iconFolder = gmenu2x->sc.skinRes("imgs/folder.png");
iconFile = gmenu2x->sc.skinRes("imgs/file.png"); iconFile = gmenu2x->sc.skinRes("imgs/file.png");
@ -89,7 +94,7 @@ BrowseDialog::Action BrowseDialog::getAction(bevent_t *event)
action = BrowseDialog::ACT_SCROLLDOWN; action = BrowseDialog::ACT_SCROLLDOWN;
break; break;
case LEFT: case LEFT:
case CLEAR: case CANCEL:
action = BrowseDialog::ACT_GOUP; action = BrowseDialog::ACT_GOUP;
break; break;
case ACCEPT: case ACCEPT:
@ -133,8 +138,7 @@ void BrowseDialog::handleInput()
action = BrowseDialog::ACT_GOUP; action = BrowseDialog::ACT_GOUP;
switch (action) { switch (action) {
case BrowseDialog::ACT_CLOSE: case BrowseDialog::ACT_CLOSE:
close = true; quit();
result = false;
break; break;
case BrowseDialog::ACT_UP: case BrowseDialog::ACT_UP:
if (selected == 0) if (selected == 0)
@ -190,8 +194,7 @@ void BrowseDialog::directoryUp()
p = path.rfind("/", p - 1); p = path.rfind("/", p - 1);
if (p == string::npos || path.compare(0, 1, "/") != 0 || path.length() < 2) { if (p == string::npos || path.compare(0, 1, "/") != 0 || path.length() < 2) {
close = true; quit();
result = false;
} else { } else {
selected = 0; selected = 0;
setPath(path.substr(0, p)); setPath(path.substr(0, p));
@ -215,6 +218,12 @@ void BrowseDialog::confirm()
close = true; close = true;
} }
void BrowseDialog::quit()
{
result = false;
close = true;
}
void BrowseDialog::paint() void BrowseDialog::paint()
{ {
unsigned int i, iY; unsigned int i, iY;

View File

@ -84,6 +84,7 @@ private:
void directoryUp(); void directoryUp();
void directoryEnter(); void directoryEnter();
void confirm(); void confirm();
void quit();
public: public:
bool exec(); bool exec();