selecting a stamp moves it to the front of the list again (unless you hold ctrl)
attempted to do MVC right?
This commit is contained in:
parent
672c5ee913
commit
c06afff0a5
@ -909,6 +909,20 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
void Client::MoveStampToFront(std::string stampID)
|
||||
{
|
||||
for (std::list<std::string>::iterator iterator = stampIDs.begin(), end = stampIDs.end(); iterator != end; ++iterator)
|
||||
{
|
||||
if((*iterator) == stampID)
|
||||
{
|
||||
stampIDs.erase(iterator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
stampIDs.push_front(stampID);
|
||||
updateStamps();
|
||||
}
|
||||
|
||||
SaveFile * Client::GetStamp(std::string stampID)
|
||||
{
|
||||
std::string stampFile = std::string(STAMPS_DIR PATH_SEP + stampID + ".stm");
|
||||
|
@ -121,6 +121,7 @@ public:
|
||||
void RescanStamps();
|
||||
int GetStampsCount();
|
||||
SaveFile * GetFirstStamp();
|
||||
void MoveStampToFront(std::string stampID);
|
||||
|
||||
RequestStatus AddComment(int saveID, std::string comment);
|
||||
|
||||
|
@ -118,6 +118,8 @@ public:
|
||||
if(cc->localBrowser->GetSave())
|
||||
{
|
||||
cc->gameModel->SetStamp(cc->localBrowser->GetSave()->GetGameSave());
|
||||
if (cc->localBrowser->GetMoveToFront())
|
||||
Client::Ref().MoveStampToFront(cc->localBrowser->GetSave()->GetName());
|
||||
cc->LoadStamp();
|
||||
}
|
||||
}
|
||||
|
@ -152,6 +152,16 @@ void LocalBrowserController::Selected(std::string saveName, bool selected)
|
||||
browserModel->DeselectSave(saveName);
|
||||
}
|
||||
|
||||
bool LocalBrowserController::GetMoveToFront()
|
||||
{
|
||||
return browserModel->GetMoveToFront();
|
||||
}
|
||||
|
||||
void LocalBrowserController::SetMoveToFront(bool move)
|
||||
{
|
||||
browserModel->SetMoveToFront(move);
|
||||
}
|
||||
|
||||
void LocalBrowserController::Exit()
|
||||
{
|
||||
if(ui::Engine::Ref().GetWindow() == browserView)
|
||||
|
@ -31,7 +31,8 @@ public:
|
||||
void rescanStampsC();
|
||||
void RefreshSavesList();
|
||||
void OpenSave(SaveFile * stamp);
|
||||
void SetStamp();
|
||||
bool GetMoveToFront();
|
||||
void SetMoveToFront(bool move);
|
||||
void NextPage();
|
||||
void PrevPage();
|
||||
void Update();
|
||||
|
@ -13,7 +13,8 @@
|
||||
|
||||
LocalBrowserModel::LocalBrowserModel():
|
||||
stamp(NULL),
|
||||
currentPage(1)
|
||||
currentPage(1),
|
||||
stampToFront(1)
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
//stampIDs = Client::Ref().GetStamps();
|
||||
@ -61,6 +62,16 @@ void LocalBrowserModel::SetSave(SaveFile * newStamp)
|
||||
stamp = new SaveFile(*newStamp);
|
||||
}
|
||||
|
||||
bool LocalBrowserModel::GetMoveToFront()
|
||||
{
|
||||
return stampToFront;
|
||||
}
|
||||
|
||||
void LocalBrowserModel::SetMoveToFront(bool move)
|
||||
{
|
||||
stampToFront = move;
|
||||
}
|
||||
|
||||
void LocalBrowserModel::UpdateSavesList(int pageNumber)
|
||||
{
|
||||
std::vector<SaveFile*> tempSavesList = savesList;
|
||||
|
@ -22,6 +22,7 @@ class LocalBrowserModel {
|
||||
std::vector<SaveFile*> savesList;
|
||||
std::vector<LocalBrowserView*> observers;
|
||||
int currentPage;
|
||||
bool stampToFront;
|
||||
void notifySavesListChanged();
|
||||
void notifyPageChanged();
|
||||
void notifySelectedChanged();
|
||||
@ -35,6 +36,8 @@ public:
|
||||
void RescanStamps();
|
||||
SaveFile * GetSave();
|
||||
void SetSave(SaveFile * newStamp);
|
||||
bool GetMoveToFront();
|
||||
void SetMoveToFront(bool move);
|
||||
std::vector<std::string> GetSelected() { return selected; }
|
||||
void ClearSelected() { selected.clear(); notifySelectedChanged(); }
|
||||
void SelectSave(std::string stampID);
|
||||
|
@ -210,8 +210,12 @@ void LocalBrowserView::OnMouseWheel(int x, int y, int d)
|
||||
}
|
||||
void LocalBrowserView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||
{
|
||||
if(key==KEY_ESCAPE)
|
||||
if(key == KEY_ESCAPE)
|
||||
c->Exit();
|
||||
if (key == KEY_CTRL)
|
||||
c->SetMoveToFront(false);
|
||||
else
|
||||
c->SetMoveToFront(true);
|
||||
}
|
||||
|
||||
LocalBrowserView::~LocalBrowserView() {
|
||||
|
Reference in New Issue
Block a user