committed patch #1255847, thanks Simon Sawatzki.

svn-id: r18653
This commit is contained in:
Gregory Montoir 2005-08-10 18:30:55 +00:00
parent 3e7feb5cb1
commit 42d4032b59
3 changed files with 16 additions and 19 deletions

View file

@ -409,7 +409,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// Change path for the game // Change path for the game
case kCmdGameBrowser: { case kCmdGameBrowser: {
BrowserDialog browser("Select additional game directory", true); BrowserDialog browser("Select directory with game data", true);
if (browser.runModal() > 0) { if (browser.runModal() > 0) {
// User made his choice... // User made his choice...
FilesystemNode dir(browser.getResult()); FilesystemNode dir(browser.getResult());

View file

@ -571,19 +571,12 @@ GlobalOptionsDialog::GlobalOptionsDialog()
addButton(this, _w - 2 * (buttonWidth + 10), _h - buttonHeight - 8, "Cancel", kCloseCmd, 0, ws); addButton(this, _w - 2 * (buttonWidth + 10), _h - buttonHeight - 8, "Cancel", kCloseCmd, 0, ws);
addButton(this, _w - (buttonWidth + 10), _h - buttonHeight - 8, "OK", kOKCmd, 0, ws); addButton(this, _w - (buttonWidth + 10), _h - buttonHeight - 8, "OK", kOKCmd, 0, ws);
// Create file browser dialogs
_dirBrowser = new BrowserDialog("Select directory for savegames", true);
_fileBrowser = new BrowserDialog("Select SoundFont", false);
#ifdef SMALL_SCREEN_DEVICE #ifdef SMALL_SCREEN_DEVICE
_keysDialog = new KeysDialog(); _keysDialog = new KeysDialog();
#endif #endif
} }
GlobalOptionsDialog::~GlobalOptionsDialog() { GlobalOptionsDialog::~GlobalOptionsDialog() {
delete _dirBrowser;
delete _fileBrowser;
#ifdef SMALL_SCREEN_DEVICE #ifdef SMALL_SCREEN_DEVICE
delete _keysDialog; delete _keysDialog;
#endif #endif
@ -639,31 +632,37 @@ void GlobalOptionsDialog::close() {
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) { switch (cmd) {
case kChooseSaveDirCmd: case kChooseSaveDirCmd: {
if (_dirBrowser->runModal() > 0) { BrowserDialog browser("Select directory for savegames", true);
if (browser.runModal() > 0) {
// User made his choice... // User made his choice...
FilesystemNode dir(_dirBrowser->getResult()); FilesystemNode dir(browser.getResult());
_savePath->setLabel(dir.path()); _savePath->setLabel(dir.path());
draw(); draw();
// TODO - we should check if the directory is writeable before accepting it // TODO - we should check if the directory is writeable before accepting it
} }
break; break;
case kChooseExtraDirCmd: }
if (_dirBrowser->runModal() > 0) { case kChooseExtraDirCmd: {
BrowserDialog browser("Select directory for extra files", true);
if (browser.runModal() > 0) {
// User made his choice... // User made his choice...
FilesystemNode dir(_dirBrowser->getResult()); FilesystemNode dir(browser.getResult());
_extraPath->setLabel(dir.path()); _extraPath->setLabel(dir.path());
draw(); draw();
} }
break; break;
case kChooseSoundFontCmd: }
if (_fileBrowser->runModal() > 0) { case kChooseSoundFontCmd: {
BrowserDialog browser("Select SoundFont", false);
if (browser.runModal() > 0) {
// User made his choice... // User made his choice...
FilesystemNode file(_fileBrowser->getResult()); FilesystemNode file(browser.getResult());
_soundFont->setLabel(file.path()); _soundFont->setLabel(file.path());
draw(); draw();
} }
break; break;
}
#ifdef SMALL_SCREEN_DEVICE #ifdef SMALL_SCREEN_DEVICE
case kChooseKeyMappingCmd: case kChooseKeyMappingCmd:
_keysDialog->runModal(); _keysDialog->runModal();

View file

@ -118,8 +118,6 @@ public:
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
protected: protected:
BrowserDialog *_dirBrowser;
BrowserDialog *_fileBrowser;
#ifdef SMALL_SCREEN_DEVICE #ifdef SMALL_SCREEN_DEVICE
KeysDialog *_keysDialog; KeysDialog *_keysDialog;
#endif #endif