Permalink
Browse files

change tooltips for the save upload button to make it more clear

  • Loading branch information...
jacob1 committed Dec 19, 2014
1 parent 0f583f3 commit 3b09c4bdbc714c3b9c6a2b5ab553197230410c6c
Showing with 44 additions and 6 deletions.
  1. +15 −3 src/gui/game/GameView.cpp
  2. +2 −0 src/gui/game/GameView.h
  3. +23 −3 src/gui/save/ServerSaveActivity.cpp
  4. +4 −0 src/gui/save/ServerSaveActivity.h
@@ -267,11 +267,12 @@ GameView::GameView():
v->c->SaveAsCurrent();
}
};
saveSimulationButton = new SplitButton(ui::Point(currentX, Size.Y-16), ui::Point(150, 15), "[untitled simulation]", "Upload the simulation under the current name", "Upload the simulation under a new name", 19);
saveSimulationButton = new SplitButton(ui::Point(currentX, Size.Y-16), ui::Point(150, 15), "[untitled simulation]", "", "", 19);
saveSimulationButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
saveSimulationButton->SetIcon(IconSave);
currentX+=151;
((SplitButton*)saveSimulationButton)->SetSplitActionCallback(new SaveSimulationAction(this));
SetSaveButtonTooltips();
AddComponent(saveSimulationButton);
class UpVoteAction : public ui::ButtonAction
@@ -981,6 +982,7 @@ void GameView::NotifySaveChanged(GameModel * sender)
currentSaveType = 0;
}
saveSimulationButton->Enabled = (saveSimulationButtonEnabled || ctrlBehaviour);
SetSaveButtonTooltips();
c->HistorySnapshot();
}
@@ -1897,7 +1899,7 @@ void GameView::enableCtrlBehaviour()
saveSimulationButton->Appearance.BackgroundInactive = saveSimulationButton->Appearance.BackgroundHover = ui::Colour(255, 255, 255);
saveSimulationButton->Appearance.TextInactive = saveSimulationButton->Appearance.TextHover = ui::Colour(0, 0, 0);
saveSimulationButton->Enabled = true;
((SplitButton*)saveSimulationButton)->SetToolTips("Save the simulation to your hard drive", "Save the simulation to your hard drive");
SetSaveButtonTooltips();
searchButton->Appearance.BackgroundInactive = searchButton->Appearance.BackgroundHover = ui::Colour(255, 255, 255);
searchButton->Appearance.TextInactive = searchButton->Appearance.TextHover = ui::Colour(0, 0, 0);
searchButton->SetToolTip("Open a simulation from your hard drive");
@@ -1924,7 +1926,7 @@ void GameView::disableCtrlBehaviour()
saveSimulationButton->Appearance.BackgroundHover = ui::Colour(20, 20, 20);
saveSimulationButton->Appearance.TextInactive = saveSimulationButton->Appearance.TextHover = ui::Colour(255, 255, 255);
saveSimulationButton->Enabled = saveSimulationButtonEnabled;
((SplitButton*)saveSimulationButton)->SetToolTips("Upload the simulation under current name", "Upload the simulation under new name");
SetSaveButtonTooltips();
searchButton->Appearance.BackgroundInactive = ui::Colour(0, 0, 0);
searchButton->Appearance.BackgroundHover = ui::Colour(20, 20, 20);
searchButton->Appearance.TextInactive = searchButton->Appearance.TextHover = ui::Colour(255, 255, 255);
@@ -1938,6 +1940,16 @@ void GameView::disableCtrlBehaviour()
}
}
void GameView::SetSaveButtonTooltips()
{
if (ctrlBehaviour)
((SplitButton*)saveSimulationButton)->SetToolTips("Save the simulation to your hard drive", "Save the simulation to your hard drive");
else if (((SplitButton*)saveSimulationButton)->GetShowSplit())
((SplitButton*)saveSimulationButton)->SetToolTips("Reupload the current simulation", "Modify simulation properties");
else
((SplitButton*)saveSimulationButton)->SetToolTips("Reupload the current simulation", "Upload a new simulation");
}
void GameView::OnDraw()
{
Graphics * g = ui::Engine::Ref().g;
@@ -113,6 +113,8 @@ class GameView: public ui::Window
int lastOffset;
void setToolButtonOffset(int offset);
void SetSaveButtonTooltips();
void screenshot();
void record();
@@ -58,6 +58,16 @@ class ServerSaveActivity::RulesAction: public ui::ButtonAction
}
};
class ServerSaveActivity::NameChangedAction: public ui::TextboxAction
{
public:
ServerSaveActivity * a;
NameChangedAction(ServerSaveActivity * a) : a(a) {}
virtual void TextChangedCallback(ui::Textbox * sender) {
a->CheckName(sender->GetText());
}
};
class SaveUploadTask: public Task
{
SaveInfo save;
@@ -98,11 +108,12 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
callback(callback),
saveUploadTask(NULL)
{
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point((Size.X/2)-8, 16), "Save to server:");
titleLabel = new ui::Label(ui::Point(4, 5), ui::Point((Size.X/2)-8, 16), "");
titleLabel->SetTextColour(style::Colour::InformationTitle);
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
AddComponent(titleLabel);
CheckName(save.GetName()); //set titleLabel text
ui::Label * previewLabel = new ui::Label(ui::Point((Size.X/2)+4, 5), ui::Point((Size.X/2)-8, 16), "Preview:");
previewLabel->SetTextColour(style::Colour::InformationTitle);
@@ -113,6 +124,7 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
nameField = new ui::Textbox(ui::Point(8, 25), ui::Point((Size.X/2)-16, 16), save.GetName(), "[save name]");
nameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
nameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
nameField->SetActionCallback(new NameChangedAction(this));
AddComponent(nameField);
FocusComponent(nameField);
@@ -276,8 +288,8 @@ void ServerSaveActivity::ShowPublishingInfo()
"\btPublished saves\bw will appear on the 'By Date' feed and will be seen by many people. These saves also contribute to your Average Score, which is displayed publicly on your profile page on the website. Publish saves that you want people to see so they can comment and vote on.\n"
"\btUnpublished saves\bw will not be shown on the 'By Date' feed. These will not contribute to your Average Score. They are not completely private though, as anyone who knows the save id will be able to view it. You can give the save id out to show specific people the save but not allow just everyone to see it.\n"
"\n"
"To quickly resave a save, open it and click the left side of the split resave button to \bt'save as current name'\bw. If you want to change the description or change the published status, you can click the right side to \bt'save as new name'\bw. Note that you can't change the name of saves; this will create an entirely new save with no comments, votes, or tags; separate from the original.\n"
"You may want to publish an unpublished save after it is finished, or to unpublish some currently published ones. You can do this by opening the save, selecting the 'save game as new name' button, and changing the published status there. You can also \btunpublish or delete saves\bw by selecting them in the 'my own' section of the browser and clicking either one of the buttons that appear on bottom.\n"
"To quickly resave a save, open it and click the left side of the split resave button to \bt'Reupload the current simulation'\bw. If you want to change the description or change the published status, you can click the right side to \bt'Modify simulation properties'\bw. Note that you can't change the name of saves; this will create an entirely new save with no comments, votes, or tags; separate from the original.\n"
"You may want to publish an unpublished save after it is finished, or to unpublish some currently published ones. You can do this by opening the save, selecting the 'Modify simulation properties' button, and changing the published status there. You can also \btunpublish or delete saves\bw by selecting them in the 'my own' section of the browser and clicking either one of the buttons that appear on bottom.\n"
"If a save is under a week old and gains popularity fast, it will be automatically placed on the \btfront page\bw. Only published saves will be able to get here. Moderators can also choose to promote any save onto the front page, but this happens rarely. They can also demote any save from the front page that breaks a rule or they feel doesn't belong.\n"
"Once you make a save, you can resave it as many times as you want. A short previous \btsave history\bw is saved, just right click any save in the save browser and select 'View History' to view it. This is useful for when you accidentally save something you didn't mean to and want to go back to the old version.\n"
;
@@ -313,6 +325,14 @@ void ServerSaveActivity::ShowRules()
new InformationMessage("Save Uploading Rules", rules, true);
}
void ServerSaveActivity::CheckName(std::string newname)
{
if (newname.length() && newname == save.GetName() && save.GetUserName() == Client::Ref().GetAuthUser().Username)
titleLabel->SetText("Modify simulation properties:");
else
titleLabel->SetText("Upload new simulation:");
}
void ServerSaveActivity::OnTick(float dt)
{
if(saveUploadTask)
@@ -7,6 +7,7 @@
namespace ui
{
class Label;
class Textbox;
class Checkbox;
}
@@ -30,6 +31,7 @@ class ServerSaveActivity: public WindowActivity, public RequestListener, public
virtual void Exit();
virtual void ShowPublishingInfo();
virtual void ShowRules();
virtual void CheckName(std::string newname);
virtual void OnDraw();
virtual void OnResponseReady(void * imagePtr, int identifier);
virtual void OnTick(float dt);
@@ -40,6 +42,7 @@ class ServerSaveActivity: public WindowActivity, public RequestListener, public
SaveUploadedCallback * callback;
SaveInfo save;
VideoBuffer * thumbnail;
ui::Label * titleLabel;
ui::Textbox * nameField;
ui::Textbox * descriptionField;
ui::Checkbox * publishedCheckbox;
@@ -48,4 +51,5 @@ class ServerSaveActivity: public WindowActivity, public RequestListener, public
class SaveAction;
class PublishingAction;
class RulesAction;
class NameChangedAction;
};

0 comments on commit 3b09c4b

Please sign in to comment.