save to server button is disabled when not logged in, but tags are viewable (read only)

This commit is contained in:
jacob1 2013-07-16 16:55:39 -04:00
parent d4ff778434
commit 9628a11245
4 changed files with 33 additions and 29 deletions

View File

@ -1162,21 +1162,16 @@ void GameController::OpenColourPicker()
void GameController::OpenTags()
{
if(gameModel->GetUser().ID)
if(gameModel->GetSave() && gameModel->GetSave()->GetID())
{
if(gameModel->GetSave() && gameModel->GetSave()->GetID())
{
tagsWindow = new TagsController(new TagsCallback(this), gameModel->GetSave());
ui::Engine::Ref().ShowWindow(tagsWindow->GetView());
}
else
{
new ErrorMessage("Error", "No save open");
}
if (tagsWindow)
delete tagsWindow;
tagsWindow = new TagsController(new TagsCallback(this), gameModel->GetSave());
ui::Engine::Ref().ShowWindow(tagsWindow->GetView());
}
else
{
new ErrorMessage("Error", "You need to login to edit tags.");
new ErrorMessage("Error", "No save open");
}
}

View File

@ -836,6 +836,7 @@ void GameView::NotifyUserChanged(GameModel * sender)
((SplitButton*)loginButton)->SetShowSplit(true);
((SplitButton*)loginButton)->SetRightToolTip("Edit profile");
}
saveSimulationButtonEnabled = sender->GetUser().ID;
NotifySaveChanged(sender);
}
@ -892,7 +893,7 @@ void GameView::NotifySaveChanged(GameModel * sender)
downVoteButton->Appearance.BorderDisabled = ui::Colour(100, 100, 100);
}
tagSimulationButton->Enabled = (sender->GetSave()->GetID() && sender->GetUser().ID);
tagSimulationButton->Enabled = sender->GetSave()->GetID();
if(sender->GetSave()->GetID())
{
std::stringstream tagsStream;
@ -951,6 +952,7 @@ void GameView::NotifySaveChanged(GameModel * sender)
tagSimulationButton->SetText("[no tags set]");
currentSaveType = 0;
}
saveSimulationButton->Enabled = (saveSimulationButtonEnabled || ctrlBehaviour);
c->HistorySnapshot();
}
@ -1813,6 +1815,7 @@ void GameView::enableCtrlBehaviour()
//Show HDD save & load buttons
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;
searchButton->Appearance.BackgroundInactive = searchButton->Appearance.BackgroundHover = ui::Colour(255, 255, 255);
searchButton->Appearance.TextInactive = searchButton->Appearance.TextHover = ui::Colour(0, 0, 0);
if (currentSaveType == 2)
@ -1837,6 +1840,7 @@ void GameView::disableCtrlBehaviour()
saveSimulationButton->Appearance.BackgroundInactive = ui::Colour(0, 0, 0);
saveSimulationButton->Appearance.BackgroundHover = ui::Colour(20, 20, 20);
saveSimulationButton->Appearance.TextInactive = saveSimulationButton->Appearance.TextHover = ui::Colour(255, 255, 255);
saveSimulationButton->Enabled = saveSimulationButtonEnabled;
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);

View File

@ -81,15 +81,16 @@ private:
float lastLogEntry;
ui::Button * scrollBar;
ui::Button * searchButton;
ui::Button * reloadButton;
ui::Button * saveSimulationButton;
ui::Button * downVoteButton;
ui::Button * upVoteButton;
ui::Button * tagSimulationButton;
ui::Button * clearSimButton;
ui::Button * loginButton;
ui::Button * simulationOptionButton;
ui::Button * displayModeButton;
ui::Button * reloadButton;
ui::Button * saveSimulationButton;
bool saveSimulationButtonEnabled;
ui::Button * downVoteButton;
ui::Button * upVoteButton;
ui::Button * tagSimulationButton;
ui::Button * clearSimButton;
ui::Button * loginButton;
ui::Button * simulationOptionButton;
ui::Button * displayModeButton;
ui::Button * pauseButton;
ui::Point currentMouse;
@ -125,18 +126,18 @@ private:
void enableAltBehaviour();
void disableAltBehaviour();
public:
GameView();
virtual ~GameView();
GameView();
virtual ~GameView();
//Breaks MVC, but any other way is going to be more of a mess.
ui::Point GetMousePosition();
void SetSample(SimulationSample sample);
//Breaks MVC, but any other way is going to be more of a mess.
ui::Point GetMousePosition();
void SetSample(SimulationSample sample);
void SetHudEnable(bool hudState);
bool GetHudEnable();
void SetDebugHUD(bool mode);
bool GetDebugHUD();
bool CtrlBehaviour(){ return ctrlBehaviour; }
bool ShiftBehaviour(){ return shiftBehaviour; }
bool CtrlBehaviour(){ return ctrlBehaviour; }
bool ShiftBehaviour(){ return shiftBehaviour; }
void ExitPrompt();
SelectMode GetSelectMode() { return selectMode; }
void BeginStampSelection();

View File

@ -56,9 +56,13 @@ TagsView::TagsView():
addButton->SetActionCallback(new AddTagAction(this));
AddComponent(addButton);
title = new ui::Label(ui::Point(5, 5), ui::Point(185, 16), "Manage tags: \bgTags are only to \nbe used to improve search results");
if (!Client::Ref().GetAuthUser().ID)
addButton->Enabled = false;
title = new ui::Label(ui::Point(5, 5), ui::Point(185, 28), "Manage tags: \bgTags are only to \nbe used to improve search results");
title->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
title->Appearance.VerticalAlign = ui::Appearance::AlignTop;
title->SetMultiline(true);
AddComponent(title);
}