summaryrefslogtreecommitdiff
path: root/src/options
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2013-03-16 17:45:18 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2013-03-16 17:45:18 (GMT)
commitf05044ab68e51ce9c374f6af09284051efcda449 (patch)
tree6ae35ed5f6f3395593fc0d2c90780d8162f302e7 /src/options
parentd383d6d7e5e1d3ca0856c02ebbcea5e9b8b2ff4e (diff)
downloadpowder-f05044ab68e51ce9c374f6af09284051efcda449.zip
powder-f05044ab68e51ce9c374f6af09284051efcda449.tar.gz
APIRequest, Aync methods for client, Profile edit/viewer (WIP)
Diffstat (limited to 'src/options')
-rw-r--r--src/options/OptionsController.cpp5
-rw-r--r--src/options/OptionsController.h1
-rw-r--r--src/options/OptionsModel.cpp11
-rw-r--r--src/options/OptionsModel.h2
-rw-r--r--src/options/OptionsView.cpp18
-rw-r--r--src/options/OptionsView.h1
6 files changed, 37 insertions, 1 deletions
diff --git a/src/options/OptionsController.cpp b/src/options/OptionsController.cpp
index b789c1f..17c42f4 100644
--- a/src/options/OptionsController.cpp
+++ b/src/options/OptionsController.cpp
@@ -54,6 +54,11 @@ void OptionsController::SetFullscreen(bool fullscreen)
model->SetFullscreen(fullscreen);
}
+void OptionsController::SetShowAvatars(bool showAvatars)
+{
+ model->SetShowAvatars(showAvatars);
+}
+
void OptionsController::SetScale(bool scale)
{
if(scale)
diff --git a/src/options/OptionsController.h b/src/options/OptionsController.h
index f76459c..481f9d2 100644
--- a/src/options/OptionsController.h
+++ b/src/options/OptionsController.h
@@ -27,6 +27,7 @@ public:
void SetFullscreen(bool fullscreen);
void SetScale(bool scale);
void SetFastQuit(bool fastquit);
+ void SetShowAvatars(bool showAvatars);
void Exit();
OptionsView * GetView();
virtual ~OptionsController();
diff --git a/src/options/OptionsModel.cpp b/src/options/OptionsModel.cpp
index fbfe2a0..8ca2a30 100644
--- a/src/options/OptionsModel.cpp
+++ b/src/options/OptionsModel.cpp
@@ -124,6 +124,17 @@ void OptionsModel::SetFastQuit(bool fastquit)
notifySettingsChanged();
}
+bool OptionsModel::GetShowAvatars()
+{
+ return Client::Ref().GetPrefBool("ShowAvatars", true);
+}
+
+void OptionsModel::SetShowAvatars(bool state)
+{
+ Client::Ref().SetPref("ShowAvatars", state);
+ notifySettingsChanged();
+}
+
void OptionsModel::notifySettingsChanged()
{
for(int i = 0; i < observers.size(); i++)
diff --git a/src/options/OptionsModel.h b/src/options/OptionsModel.h
index b0867c1..1fdf372 100644
--- a/src/options/OptionsModel.h
+++ b/src/options/OptionsModel.h
@@ -23,6 +23,8 @@ public:
void SetNewtonianGravity(bool state);
bool GetWaterEqualisation();
void SetWaterEqualisation(bool state);
+ bool GetShowAvatars();
+ void SetShowAvatars(bool state);
int GetAirMode();
void SetAirMode(int airMode);
int GetEdgeMode();
diff --git a/src/options/OptionsView.cpp b/src/options/OptionsView.cpp
index 5bbd608..70aeba5 100644
--- a/src/options/OptionsView.cpp
+++ b/src/options/OptionsView.cpp
@@ -5,7 +5,7 @@
#include "interface/DropDown.h"
OptionsView::OptionsView():
- ui::Window(ui::Point(-1, -1), ui::Point(300, 290)){
+ ui::Window(ui::Point(-1, -1), ui::Point(300, 310)){
ui::Label * tempLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 14), "Simulation Options");
tempLabel->SetTextColour(style::Colour::InformationTitle);
@@ -176,6 +176,21 @@ OptionsView::OptionsView():
AddComponent(tempLabel);
AddComponent(fastquit);
+ class ShowAvatarsAction: public ui::CheckboxAction
+ {
+ OptionsView * v;
+ public:
+ ShowAvatarsAction(OptionsView * v_){ v = v_; }
+ virtual void ActionCallback(ui::Checkbox * sender){ v->c->SetShowAvatars(sender->GetChecked()); }
+ };
+
+ showAvatars = new ui::Checkbox(ui::Point(8, 270), ui::Point(Size.X-6, 16), "Show Avatars", "");
+ showAvatars->SetActionCallback(new ShowAvatarsAction(this));
+ tempLabel = new ui::Label(ui::Point(showAvatars->Position.X+Graphics::textwidth(showAvatars->GetText().c_str())+20, showAvatars->Position.Y), ui::Point(Size.X-28, 16), "\bg- Disable if you have a slow connection");
+ tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
+ AddComponent(tempLabel);
+ AddComponent(showAvatars);
+
class CloseAction: public ui::ButtonAction
{
public:
@@ -206,6 +221,7 @@ void OptionsView::NotifySettingsChanged(OptionsModel * sender)
scale->SetChecked(sender->GetScale());
fullscreen->SetChecked(sender->GetFullscreen());
fastquit->SetChecked(sender->GetFastQuit());
+ showAvatars->SetChecked(sender->GetShowAvatars());
}
void OptionsView::AttachController(OptionsController * c_)
diff --git a/src/options/OptionsView.h b/src/options/OptionsView.h
index 8d41ba5..4ee254f 100644
--- a/src/options/OptionsView.h
+++ b/src/options/OptionsView.h
@@ -21,6 +21,7 @@ class OptionsView: public ui::Window {
ui::Checkbox * scale;
ui::Checkbox * fullscreen;
ui::Checkbox * fastquit;
+ ui::Checkbox * showAvatars;
public:
OptionsView();
void NotifySettingsChanged(OptionsModel * sender);