1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-12-27 12:41:11 +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;
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));
buttonBox.add(btn);
@ -30,6 +31,10 @@ BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
btn->setAction(MakeDelegate(this, &BrowseDialog::confirm));
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");
iconFolder = gmenu2x->sc.skinRes("imgs/folder.png");
iconFile = gmenu2x->sc.skinRes("imgs/file.png");
@ -89,7 +94,7 @@ BrowseDialog::Action BrowseDialog::getAction(bevent_t *event)
action = BrowseDialog::ACT_SCROLLDOWN;
break;
case LEFT:
case CLEAR:
case CANCEL:
action = BrowseDialog::ACT_GOUP;
break;
case ACCEPT:
@ -133,8 +138,7 @@ void BrowseDialog::handleInput()
action = BrowseDialog::ACT_GOUP;
switch (action) {
case BrowseDialog::ACT_CLOSE:
close = true;
result = false;
quit();
break;
case BrowseDialog::ACT_UP:
if (selected == 0)
@ -190,8 +194,7 @@ void BrowseDialog::directoryUp()
p = path.rfind("/", p - 1);
if (p == string::npos || path.compare(0, 1, "/") != 0 || path.length() < 2) {
close = true;
result = false;
quit();
} else {
selected = 0;
setPath(path.substr(0, p));
@ -215,6 +218,12 @@ void BrowseDialog::confirm()
close = true;
}
void BrowseDialog::quit()
{
result = false;
close = true;
}
void BrowseDialog::paint()
{
unsigned int i, iY;

View File

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