1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2025-04-21 12:27:27 +03:00

Removed duplicate code between MenuSettingFile and its MenuSettingImage subclass.

Also performed some cosmetic fixes.
This commit is contained in:
Maarten ter Huurne
2010-07-28 00:54:00 +02:00
parent ac30153cfc
commit 9d05af2881
4 changed files with 36 additions and 37 deletions

View File

@@ -24,15 +24,14 @@
using namespace std;
using namespace fastdelegate;
MenuSettingFile::MenuSettingFile(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter)
: MenuSetting(gmenu2x,name,description)
MenuSettingFile::MenuSettingFile(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter_)
: MenuSetting(gmenu2x, name, description)
, originalValue(*value)
, _value(value)
, filter(filter_)
{
IconButton *btn;
this->filter = filter;
_value = value;
originalValue = *value;
btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
btn->setAction(MakeDelegate(this, &MenuSettingFile::clear));
buttonBox.add(btn);
@@ -50,10 +49,8 @@ void MenuSettingFile::draw(int y)
void MenuSettingFile::manageInput()
{
if (gmenu2x->input[ACTION_X])
setValue("");
if (gmenu2x->input[ACTION_B])
select();
if (gmenu2x->input[ACTION_X]) clear();
if (gmenu2x->input[ACTION_B]) select();
}
void MenuSettingFile::clear()
@@ -64,8 +61,9 @@ void MenuSettingFile::clear()
void MenuSettingFile::select()
{
FileDialog fd(gmenu2x, description, filter, value());
if (fd.exec())
setValue(fd.getPath()+"/"+fd.getFile());
if (fd.exec()) {
setValue(fd.getPath() + "/" + fd.getFile());
}
}
void MenuSettingFile::setValue(const string &value)