summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Kaduk <mateusz.kaduk@gmail.com>2004-12-27 05:50:18 +0000
committerMateusz Kaduk <mateusz.kaduk@gmail.com>2004-12-27 05:50:18 +0000
commit27be25397b09772928d5cdf8c47e350f9baefb69 (patch)
tree6e6d6fd80fea53651e46e251c2c8145ee399b2ba
parent5b3b8e8089902cb957e4dd19c0b258bc7bdb8065 (diff)
downloadmana-27be25397b09772928d5cdf8c47e350f9baefb69.tar.gz
mana-27be25397b09772928d5cdf8c47e350f9baefb69.tar.bz2
mana-27be25397b09772928d5cdf8c47e350f9baefb69.tar.xz
mana-27be25397b09772928d5cdf8c47e350f9baefb69.zip
Using Configuration class
Added switch for sound
-rw-r--r--src/gui/setup.cpp32
-rw-r--r--src/gui/setup.h4
2 files changed, 29 insertions, 7 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 84c3b2be..0f3b2b1b 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -39,16 +39,18 @@ Setup::Setup(gcn::Container *parent)
: Window(parent, "Setup")
{
modesListModel = new ModesListModel();
- displayLabel = new gcn::Label("Display");
+ displayLabel = new gcn::Label("Display settings");
modesList = new gcn::ListBox(modesListModel);
scrollArea = new gcn::ScrollArea(modesList);
fsCheckBox = new CheckBox("Full screen", false);
+ soundLabel = new gcn::Label("Sound settings");
+ soundCheckBox = new CheckBox("Sound", false);
applyButton = new Button("Apply");
cancelButton = new Button("Cancel");
/* Set dimension */
scrollArea->setDimension(gcn::Rectangle(0,0,120,50));
- displayLabel->setDimension(gcn::Rectangle(0,0,80, 16));
+ displayLabel->setDimension(gcn::Rectangle(0,0,100,16));
applyButton->setDimension(gcn::Rectangle(0,0,80, 16));
cancelButton->setDimension(gcn::Rectangle(0,0,80, 16));
@@ -59,7 +61,9 @@ Setup::Setup(gcn::Container *parent)
/* Set position */
scrollArea->setPosition(10,40);
displayLabel->setPosition(10,10);
- fsCheckBox->setPosition(100,16);
+ soundLabel->setPosition(10,90);
+ fsCheckBox->setPosition(110,36);
+ soundCheckBox->setPosition(10,116);
applyButton->setPosition(10,190);
cancelButton->setPosition(150,190);
@@ -71,6 +75,8 @@ Setup::Setup(gcn::Container *parent)
add(scrollArea);
add(displayLabel);
add(fsCheckBox);
+ add(soundLabel);
+ add(soundCheckBox);
add(applyButton);
add(cancelButton);
@@ -79,6 +85,8 @@ Setup::Setup(gcn::Container *parent)
//TODO: load default settings
modesList->setSelected(1);
+ fsCheckBox->setMarked(config.getValue("screen",0));
+ soundCheckBox->setMarked(config.getValue("sound",0));
}
/*
@@ -101,13 +109,25 @@ void Setup::action(const std::string& eventId)
{
if(eventId == "apply") {
setVisible(false);
- //TODO: Save&apply setup changes
- if(fsCheckBox->isMarked() == true) {
+
+ /* Display settings */
+ if(fsCheckBox->isMarked() == true && config.getValue("screen",0) == 2) {
+ config.setValue("screen",1);
set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,800,600,0,0);
- } else {
+
+ } else
+ if(fsCheckBox->isMarked() == false && config.getValue("screen",0) == 1) {
+ config.setValue("screen",2);
set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0);
}
+ /* Sound settings */
+ if(soundCheckBox->isMarked() == true) {
+ config.setValue("sound",1);
+ } else {
+ config.setValue("sound",0);
+ }
+
} else if(eventId == "cancel") {
setVisible(false);
}
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 3c43f727..7c56f3c9 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -33,9 +33,11 @@ class Setup : public Window, public gcn::ActionListener {
/* Dialog parts */
ModesListModel *modesListModel;
gcn::Label *displayLabel;
+ CheckBox *fsCheckBox;
+ gcn::Label *soundLabel;
+ CheckBox *soundCheckBox;
gcn::ScrollArea *scrollArea;
gcn::ListBox *modesList;
- CheckBox *fsCheckBox;
Button *applyButton;
Button *cancelButton;