added some meat to the global options dialog (no prefs are stored yet, though)
svn-id: r6862
This commit is contained in:
parent
e1851fc07f
commit
023d84a6a3
8 changed files with 140 additions and 68 deletions
|
@ -142,9 +142,9 @@ public:
|
|||
|
||||
bool _use_adlib;
|
||||
|
||||
int _master_volume;
|
||||
int _music_volume;
|
||||
int _sfx_volume;
|
||||
int _master_volume;
|
||||
bool _amiga;
|
||||
int _language;
|
||||
|
||||
|
|
|
@ -35,12 +35,11 @@ enum {
|
|||
kGoUpCmd = 'GoUp'
|
||||
};
|
||||
|
||||
BrowserDialog::BrowserDialog(NewGui *gui)
|
||||
BrowserDialog::BrowserDialog(NewGui *gui, const char *title)
|
||||
: Dialog(gui, 40, 10, 320 -2 * 40, 200 - 2 * 10),
|
||||
_node(0), _nodeContent(0) {
|
||||
// Headline - TODO: should be customizable during creation time
|
||||
new StaticTextWidget(this, 10, 8, _w-2 * 10, kLineHeight,
|
||||
"Select directory with game data", kTextAlignCenter);
|
||||
new StaticTextWidget(this, 10, 8, _w-2 * 10, kLineHeight, title, kTextAlignCenter);
|
||||
|
||||
// Current path - TODO: handle long paths ?
|
||||
_currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight,
|
||||
|
|
|
@ -35,7 +35,7 @@ class BrowserDialog : public Dialog {
|
|||
typedef ScummVM::String String;
|
||||
typedef ScummVM::StringList StringList;
|
||||
public:
|
||||
BrowserDialog(NewGui *gui);
|
||||
BrowserDialog(NewGui *gui, const char *title);
|
||||
virtual ~BrowserDialog();
|
||||
|
||||
virtual void open();
|
||||
|
|
|
@ -205,7 +205,7 @@ LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector)
|
|||
updateButtons();
|
||||
|
||||
// Create file browser dialog
|
||||
_browser = new BrowserDialog(_gui);
|
||||
_browser = new BrowserDialog(_gui, "Select directory with game data");
|
||||
}
|
||||
|
||||
LauncherDialog::~LauncherDialog() {
|
||||
|
@ -328,7 +328,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
|||
// options for that game.
|
||||
|
||||
if (_browser->runModal()) {
|
||||
// User did make a choice...
|
||||
// User made his choice...
|
||||
FilesystemNode *dir = _browser->getResult();
|
||||
|
||||
// ...so let's determine a list of candidates, games that
|
||||
|
@ -431,7 +431,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
|||
// - music & graphics driver (but see also the comments on EditGameDialog
|
||||
// for some techincal difficulties with this)
|
||||
// - default volumes (sfx/master/music)
|
||||
GlobalOptionsDialog options(_gui);
|
||||
GlobalOptionsDialog options(_gui, _detector);
|
||||
options.runModal();
|
||||
}
|
||||
break;
|
||||
|
|
105
gui/options.cpp
105
gui/options.cpp
|
@ -25,9 +25,8 @@
|
|||
#include "options.h"
|
||||
#include "PopUpWidget.h"
|
||||
|
||||
//#include "backends/fs/fs.h"
|
||||
#include "backends/fs/fs.h"
|
||||
#include "common/config-file.h"
|
||||
//#include "common/engine.h"
|
||||
#include "common/gameDetector.h"
|
||||
|
||||
/*
|
||||
|
@ -49,11 +48,15 @@ This just looks like an option dialog, but it doesn't change any actual settings
|
|||
// - default volumes (sfx/master/music)
|
||||
|
||||
enum {
|
||||
kOKCmd = 'OK '
|
||||
kMasterVolumeChanged = 'mavc',
|
||||
kMusicVolumeChanged = 'muvc',
|
||||
kSfxVolumeChanged = 'sfvc',
|
||||
kChooseSaveDirCmd = 'chos',
|
||||
kOKCmd = 'ok '
|
||||
};
|
||||
|
||||
GlobalOptionsDialog::GlobalOptionsDialog(NewGui *gui)
|
||||
: Dialog(gui, 10, 15, 320 - 2 * 10, 200 - 2 * 15) {
|
||||
GlobalOptionsDialog::GlobalOptionsDialog(NewGui *gui, GameDetector &detector)
|
||||
: Dialog(gui, 10, 15, 320 - 2 * 10, 200 - 2 * 15), _detector(detector) {
|
||||
// The GFX mode popup & a label
|
||||
// TODO - add an API to query the list of available GFX modes, and to get/set the mode
|
||||
new StaticTextWidget(this, 5, 10+1, 100, kLineHeight, "Graphics mode: ", kTextAlignRight);
|
||||
|
@ -94,51 +97,103 @@ GlobalOptionsDialog::GlobalOptionsDialog(NewGui *gui)
|
|||
new StaticTextWidget(this, 5, yoffset+26, 100, 16, "Music volume: ", kTextAlignRight);
|
||||
new StaticTextWidget(this, 5, yoffset+42, 100, 16, "SFX volume: ", kTextAlignRight);
|
||||
|
||||
SliderWidget *masterVolumeSlider, *musicVolumeSlider, *sfxVolumeSlider;
|
||||
_masterVolumeSlider = new SliderWidget(this, 105, yoffset+8, 85, 12, "Volume1", kMasterVolumeChanged);
|
||||
_musicVolumeSlider = new SliderWidget(this, 105, yoffset+24, 85, 12, "Volume2", kMusicVolumeChanged);
|
||||
_sfxVolumeSlider = new SliderWidget(this, 105, yoffset+40, 85, 12, "Volume3", kSfxVolumeChanged);
|
||||
|
||||
masterVolumeSlider = new SliderWidget(this, 105, yoffset+8, 85, 12, "Volume1", 0);
|
||||
musicVolumeSlider = new SliderWidget(this, 105, yoffset+24, 85, 12, "Volume2", 0);
|
||||
sfxVolumeSlider = new SliderWidget(this, 105, yoffset+40, 85, 12, "Volume3", 0);
|
||||
_masterVolumeSlider->setMinValue(0); _masterVolumeSlider->setMaxValue(255);
|
||||
_musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(255);
|
||||
_sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(255);
|
||||
|
||||
masterVolumeSlider->setMinValue(0); masterVolumeSlider->setMaxValue(255);
|
||||
musicVolumeSlider->setMinValue(0); musicVolumeSlider->setMaxValue(255);
|
||||
sfxVolumeSlider->setMinValue(0); sfxVolumeSlider->setMaxValue(255);
|
||||
_masterVolumeLabel = new StaticTextWidget(this, 200, yoffset+10, 24, 16, "100%", kTextAlignLeft);
|
||||
_musicVolumeLabel = new StaticTextWidget(this, 200, yoffset+26, 24, 16, "100%", kTextAlignLeft);
|
||||
_sfxVolumeLabel = new StaticTextWidget(this, 200, yoffset+42, 24, 16, "100%", kTextAlignLeft);
|
||||
|
||||
Widget *masterVolumeLabel, *musicVolumeLabel, *sfxVolumeLabel;
|
||||
|
||||
masterVolumeLabel = new StaticTextWidget(this, 200, yoffset+10, 24, 16, "100%", kTextAlignLeft);
|
||||
musicVolumeLabel = new StaticTextWidget(this, 200, yoffset+26, 24, 16, "100%", kTextAlignLeft);
|
||||
sfxVolumeLabel = new StaticTextWidget(this, 200, yoffset+42, 24, 16, "100%", kTextAlignLeft);
|
||||
|
||||
masterVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
musicVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
_masterVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
|
||||
|
||||
//
|
||||
// Save game path
|
||||
//
|
||||
new StaticTextWidget(this, 5, 106, 100, kLineHeight, "Savegame path: ", kTextAlignRight);
|
||||
new StaticTextWidget(this, 105, 106, 180, kLineHeight, "/foo/bar", kTextAlignLeft);
|
||||
new ButtonWidget(this, 105, 120, 64, 16, "Choose...", 0, 0);
|
||||
_savePath = new StaticTextWidget(this, 105, 106, 180, kLineHeight, "/foo/bar", kTextAlignLeft);
|
||||
new ButtonWidget(this, 105, 120, 64, 16, "Choose...", kChooseSaveDirCmd, 0);
|
||||
|
||||
// TODO: set _savePath to the current save path, i.e. as obtained via
|
||||
const char *dir = NULL;
|
||||
dir = g_config->get("savepath", "scummvm");
|
||||
if (dir) {
|
||||
_savePath->setLabel(dir);
|
||||
} else {
|
||||
char buf[256];
|
||||
getcwd(buf, sizeof(buf));
|
||||
_savePath->setLabel(buf);
|
||||
}
|
||||
// If that is NULL, we should use the current directory...
|
||||
|
||||
//
|
||||
// Add OK & Cancel buttons
|
||||
//
|
||||
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
||||
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
||||
|
||||
// Create file browser dialog
|
||||
_browser = new BrowserDialog(_gui, "Select directory for savegames");
|
||||
}
|
||||
|
||||
GlobalOptionsDialog::~GlobalOptionsDialog() {
|
||||
delete _browser;
|
||||
}
|
||||
|
||||
void GlobalOptionsDialog::open() {
|
||||
Dialog::open();
|
||||
|
||||
_soundVolumeMaster = _detector._master_volume;
|
||||
_soundVolumeMusic = _detector._music_volume;
|
||||
_soundVolumeSfx = _detector._sfx_volume;
|
||||
|
||||
_masterVolumeSlider->setValue(_soundVolumeMaster);
|
||||
_musicVolumeSlider->setValue(_soundVolumeMusic);
|
||||
_sfxVolumeSlider->setValue(_soundVolumeSfx);
|
||||
|
||||
_masterVolumeLabel->setValue(_soundVolumeMaster);
|
||||
_musicVolumeLabel->setValue(_soundVolumeMusic);
|
||||
_sfxVolumeLabel->setValue(_soundVolumeSfx);
|
||||
}
|
||||
|
||||
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
|
||||
if (cmd == kOKCmd) {
|
||||
switch (cmd) {
|
||||
case kChooseSaveDirCmd:
|
||||
if (_browser->runModal()) {
|
||||
// User made his choice...
|
||||
FilesystemNode *dir = _browser->getResult();
|
||||
_savePath->setLabel(dir->path());
|
||||
// TODO - we should check if the director is writeable before accepting it
|
||||
}
|
||||
break;
|
||||
case kMasterVolumeChanged:
|
||||
_soundVolumeMaster = _masterVolumeSlider->getValue();
|
||||
_masterVolumeLabel->setValue(_soundVolumeMaster);
|
||||
_masterVolumeLabel->draw();
|
||||
break;
|
||||
case kMusicVolumeChanged:
|
||||
_soundVolumeMusic = _musicVolumeSlider->getValue();
|
||||
_musicVolumeLabel->setValue(_soundVolumeMusic);
|
||||
_musicVolumeLabel->draw();
|
||||
break;
|
||||
case kSfxVolumeChanged:
|
||||
_soundVolumeSfx = _sfxVolumeSlider->getValue();
|
||||
_sfxVolumeLabel->setValue(_soundVolumeSfx);
|
||||
_sfxVolumeLabel->draw();
|
||||
break;
|
||||
case kOKCmd:
|
||||
// TODO Write back changes made to config object
|
||||
setResult(1);
|
||||
close();
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,18 +25,36 @@
|
|||
#include "common/str.h"
|
||||
#include "common/list.h"
|
||||
|
||||
class BrowserDialog;
|
||||
class GameDetector;
|
||||
|
||||
class GlobalOptionsDialog : public Dialog {
|
||||
typedef ScummVM::String String;
|
||||
public:
|
||||
GlobalOptionsDialog(NewGui *gui);
|
||||
GlobalOptionsDialog(NewGui *gui, GameDetector &detector);
|
||||
~GlobalOptionsDialog();
|
||||
|
||||
// void open();
|
||||
void open();
|
||||
// void close();
|
||||
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||
|
||||
protected:
|
||||
GameDetector &_detector;
|
||||
|
||||
BrowserDialog *_browser;
|
||||
StaticTextWidget*_savePath;
|
||||
|
||||
int _soundVolumeMaster;
|
||||
int _soundVolumeMusic;
|
||||
int _soundVolumeSfx;
|
||||
|
||||
SliderWidget *_masterVolumeSlider;
|
||||
SliderWidget *_musicVolumeSlider;
|
||||
SliderWidget *_sfxVolumeSlider;
|
||||
|
||||
StaticTextWidget *_masterVolumeLabel;
|
||||
StaticTextWidget *_musicVolumeLabel;
|
||||
StaticTextWidget *_sfxVolumeLabel;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -484,21 +484,21 @@ OptionsDialog::OptionsDialog(NewGui *gui, Scumm *scumm)
|
|||
new StaticTextWidget(this, 15, 26, 95, 16, "Music volume:", kTextAlignRight);
|
||||
new StaticTextWidget(this, 15, 42, 95, 16, "SFX volume:", kTextAlignRight);
|
||||
|
||||
masterVolumeSlider = new SliderWidget(this, 125, 8, 80, 12, "Volume1", kMasterVolumeChanged);
|
||||
musicVolumeSlider = new SliderWidget(this, 125, 24, 80, 12, "Volume2", kMusicVolumeChanged);
|
||||
sfxVolumeSlider = new SliderWidget(this, 125, 40, 80, 12, "Volume3", kSfxVolumeChanged);
|
||||
_masterVolumeSlider = new SliderWidget(this, 125, 8, 80, 12, "Volume1", kMasterVolumeChanged);
|
||||
_musicVolumeSlider = new SliderWidget(this, 125, 24, 80, 12, "Volume2", kMusicVolumeChanged);
|
||||
_sfxVolumeSlider = new SliderWidget(this, 125, 40, 80, 12, "Volume3", kSfxVolumeChanged);
|
||||
|
||||
masterVolumeSlider->setMinValue(0); masterVolumeSlider->setMaxValue(255);
|
||||
musicVolumeSlider->setMinValue(0); musicVolumeSlider->setMaxValue(255);
|
||||
sfxVolumeSlider->setMinValue(0); sfxVolumeSlider->setMaxValue(255);
|
||||
_masterVolumeSlider->setMinValue(0); _masterVolumeSlider->setMaxValue(255);
|
||||
_musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(255);
|
||||
_sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(255);
|
||||
|
||||
masterVolumeLabel = new StaticTextWidget(this, 210, 10, 24, 16, "Volume1", kTextAlignLeft);
|
||||
musicVolumeLabel = new StaticTextWidget(this, 210, 26, 24, 16, "Volume2", kTextAlignLeft);
|
||||
sfxVolumeLabel = new StaticTextWidget(this, 210, 42, 24, 16, "Volume3", kTextAlignLeft);
|
||||
_masterVolumeLabel = new StaticTextWidget(this, 210, 10, 24, 16, "Volume1", kTextAlignLeft);
|
||||
_musicVolumeLabel = new StaticTextWidget(this, 210, 26, 24, 16, "Volume2", kTextAlignLeft);
|
||||
_sfxVolumeLabel = new StaticTextWidget(this, 210, 42, 24, 16, "Volume3", kTextAlignLeft);
|
||||
|
||||
masterVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
musicVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
_masterVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
|
||||
//
|
||||
// Some misc options
|
||||
|
@ -530,13 +530,13 @@ void OptionsDialog::open() {
|
|||
_soundVolumeMusic = _scumm->_sound->_sound_volume_music;
|
||||
_soundVolumeSfx = _scumm->_sound->_sound_volume_sfx;
|
||||
|
||||
masterVolumeSlider->setValue(_soundVolumeMaster);
|
||||
musicVolumeSlider->setValue(_soundVolumeMusic);
|
||||
sfxVolumeSlider->setValue(_soundVolumeSfx);
|
||||
_masterVolumeSlider->setValue(_soundVolumeMaster);
|
||||
_musicVolumeSlider->setValue(_soundVolumeMusic);
|
||||
_sfxVolumeSlider->setValue(_soundVolumeSfx);
|
||||
|
||||
masterVolumeLabel->setValue(_soundVolumeMaster);
|
||||
musicVolumeLabel->setValue(_soundVolumeMusic);
|
||||
sfxVolumeLabel->setValue(_soundVolumeSfx);
|
||||
_masterVolumeLabel->setValue(_soundVolumeMaster);
|
||||
_musicVolumeLabel->setValue(_soundVolumeMusic);
|
||||
_sfxVolumeLabel->setValue(_soundVolumeSfx);
|
||||
|
||||
// update checkboxes, too
|
||||
subtitlesCheckbox->setState(_scumm->_noSubtitles == false);
|
||||
|
@ -554,19 +554,19 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
|
|||
_aboutDialog->runModal();
|
||||
break;
|
||||
case kMasterVolumeChanged:
|
||||
_soundVolumeMaster = masterVolumeSlider->getValue();
|
||||
masterVolumeLabel->setValue(_soundVolumeMaster);
|
||||
masterVolumeLabel->draw();
|
||||
_soundVolumeMaster = _masterVolumeSlider->getValue();
|
||||
_masterVolumeLabel->setValue(_soundVolumeMaster);
|
||||
_masterVolumeLabel->draw();
|
||||
break;
|
||||
case kMusicVolumeChanged:
|
||||
_soundVolumeMusic = musicVolumeSlider->getValue();
|
||||
musicVolumeLabel->setValue(_soundVolumeMusic);
|
||||
musicVolumeLabel->draw();
|
||||
_soundVolumeMusic = _musicVolumeSlider->getValue();
|
||||
_musicVolumeLabel->setValue(_soundVolumeMusic);
|
||||
_musicVolumeLabel->draw();
|
||||
break;
|
||||
case kSfxVolumeChanged:
|
||||
_soundVolumeSfx = sfxVolumeSlider->getValue();
|
||||
sfxVolumeLabel->setValue(_soundVolumeSfx);
|
||||
sfxVolumeLabel->draw();
|
||||
_soundVolumeSfx = _sfxVolumeSlider->getValue();
|
||||
_sfxVolumeLabel->setValue(_soundVolumeSfx);
|
||||
_sfxVolumeLabel->draw();
|
||||
break;
|
||||
case kOKCmd: {
|
||||
// Update the sound settings
|
||||
|
|
|
@ -94,13 +94,13 @@ protected:
|
|||
int _soundVolumeMusic;
|
||||
int _soundVolumeSfx;
|
||||
|
||||
SliderWidget *masterVolumeSlider;
|
||||
SliderWidget *musicVolumeSlider;
|
||||
SliderWidget *sfxVolumeSlider;
|
||||
SliderWidget *_masterVolumeSlider;
|
||||
SliderWidget *_musicVolumeSlider;
|
||||
SliderWidget *_sfxVolumeSlider;
|
||||
|
||||
StaticTextWidget *masterVolumeLabel;
|
||||
StaticTextWidget *musicVolumeLabel;
|
||||
StaticTextWidget *sfxVolumeLabel;
|
||||
StaticTextWidget *_masterVolumeLabel;
|
||||
StaticTextWidget *_musicVolumeLabel;
|
||||
StaticTextWidget *_sfxVolumeLabel;
|
||||
|
||||
CheckboxWidget *subtitlesCheckbox;
|
||||
CheckboxWidget *amigaPalCheckbox;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue