paused checkbox when saving

This commit is contained in:
jacob1
2013-01-07 13:24:38 -05:00
parent d8166998f8
commit 76947cefbc
2 changed files with 8 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
#include "client/Client.h" #include "client/Client.h"
#include "tasks/Task.h" #include "tasks/Task.h"
#include "Style.h" #include "Style.h"
#include "client/GameSave.h"
class ServerSaveActivity::CancelAction: public ui::ButtonAction class ServerSaveActivity::CancelAction: public ui::ButtonAction
{ {
@@ -97,7 +98,7 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
descriptionField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; descriptionField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
AddComponent(descriptionField); AddComponent(descriptionField);
publishedCheckbox = new ui::Checkbox(ui::Point(8, 45), ui::Point((Size.X/2)-16, 16), "Publish", ""); publishedCheckbox = new ui::Checkbox(ui::Point(8, 45), ui::Point((Size.X/2)-80, 16), "Publish", "");
if(Client::Ref().GetAuthUser().Username != save.GetUserName()) if(Client::Ref().GetAuthUser().Username != save.GetUserName())
{ {
//Save is not owned by the user, disable by default //Save is not owned by the user, disable by default
@@ -110,6 +111,10 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
} }
AddComponent(publishedCheckbox); AddComponent(publishedCheckbox);
pausedCheckbox = new ui::Checkbox(ui::Point(160, 45), ui::Point(55, 16), "Paused", "");
pausedCheckbox->SetChecked(save.GetGameSave()->paused);
AddComponent(pausedCheckbox);
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point((Size.X/2)-75, 16), "Cancel"); ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point((Size.X/2)-75, 16), "Cancel");
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
@@ -206,6 +211,7 @@ void ServerSaveActivity::saveUpload()
save.SetPublished(publishedCheckbox->GetChecked()); save.SetPublished(publishedCheckbox->GetChecked());
save.SetUserName(Client::Ref().GetAuthUser().Username); save.SetUserName(Client::Ref().GetAuthUser().Username);
save.SetID(0); save.SetID(0);
save.GetGameSave()->paused = pausedCheckbox->GetChecked();
if(Client::Ref().UploadSave(save) != RequestOkay) if(Client::Ref().UploadSave(save) != RequestOkay)
{ {

View File

@@ -41,6 +41,7 @@ protected:
ui::Textbox * nameField; ui::Textbox * nameField;
ui::Textbox * descriptionField; ui::Textbox * descriptionField;
ui::Checkbox * publishedCheckbox; ui::Checkbox * publishedCheckbox;
ui::Checkbox * pausedCheckbox;
class CancelAction; class CancelAction;
class SaveAction; class SaveAction;
friend class CancelAction; friend class CancelAction;