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;
|
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)
|
SaveFile * Client::GetStamp(std::string stampID)
|
||||||
{
|
{
|
||||||
std::string stampFile = std::string(STAMPS_DIR PATH_SEP + stampID + ".stm");
|
std::string stampFile = std::string(STAMPS_DIR PATH_SEP + stampID + ".stm");
|
||||||
|
@ -121,6 +121,7 @@ public:
|
|||||||
void RescanStamps();
|
void RescanStamps();
|
||||||
int GetStampsCount();
|
int GetStampsCount();
|
||||||
SaveFile * GetFirstStamp();
|
SaveFile * GetFirstStamp();
|
||||||
|
void MoveStampToFront(std::string stampID);
|
||||||
|
|
||||||
RequestStatus AddComment(int saveID, std::string comment);
|
RequestStatus AddComment(int saveID, std::string comment);
|
||||||
|
|
||||||
|
@ -118,6 +118,8 @@ public:
|
|||||||
if(cc->localBrowser->GetSave())
|
if(cc->localBrowser->GetSave())
|
||||||
{
|
{
|
||||||
cc->gameModel->SetStamp(cc->localBrowser->GetSave()->GetGameSave());
|
cc->gameModel->SetStamp(cc->localBrowser->GetSave()->GetGameSave());
|
||||||
|
if (cc->localBrowser->GetMoveToFront())
|
||||||
|
Client::Ref().MoveStampToFront(cc->localBrowser->GetSave()->GetName());
|
||||||
cc->LoadStamp();
|
cc->LoadStamp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,16 @@ void LocalBrowserController::Selected(std::string saveName, bool selected)
|
|||||||
browserModel->DeselectSave(saveName);
|
browserModel->DeselectSave(saveName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LocalBrowserController::GetMoveToFront()
|
||||||
|
{
|
||||||
|
return browserModel->GetMoveToFront();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalBrowserController::SetMoveToFront(bool move)
|
||||||
|
{
|
||||||
|
browserModel->SetMoveToFront(move);
|
||||||
|
}
|
||||||
|
|
||||||
void LocalBrowserController::Exit()
|
void LocalBrowserController::Exit()
|
||||||
{
|
{
|
||||||
if(ui::Engine::Ref().GetWindow() == browserView)
|
if(ui::Engine::Ref().GetWindow() == browserView)
|
||||||
|
@ -31,7 +31,8 @@ public:
|
|||||||
void rescanStampsC();
|
void rescanStampsC();
|
||||||
void RefreshSavesList();
|
void RefreshSavesList();
|
||||||
void OpenSave(SaveFile * stamp);
|
void OpenSave(SaveFile * stamp);
|
||||||
void SetStamp();
|
bool GetMoveToFront();
|
||||||
|
void SetMoveToFront(bool move);
|
||||||
void NextPage();
|
void NextPage();
|
||||||
void PrevPage();
|
void PrevPage();
|
||||||
void Update();
|
void Update();
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
LocalBrowserModel::LocalBrowserModel():
|
LocalBrowserModel::LocalBrowserModel():
|
||||||
stamp(NULL),
|
stamp(NULL),
|
||||||
currentPage(1)
|
currentPage(1),
|
||||||
|
stampToFront(1)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
//stampIDs = Client::Ref().GetStamps();
|
//stampIDs = Client::Ref().GetStamps();
|
||||||
@ -61,6 +62,16 @@ void LocalBrowserModel::SetSave(SaveFile * newStamp)
|
|||||||
stamp = new SaveFile(*newStamp);
|
stamp = new SaveFile(*newStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LocalBrowserModel::GetMoveToFront()
|
||||||
|
{
|
||||||
|
return stampToFront;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalBrowserModel::SetMoveToFront(bool move)
|
||||||
|
{
|
||||||
|
stampToFront = move;
|
||||||
|
}
|
||||||
|
|
||||||
void LocalBrowserModel::UpdateSavesList(int pageNumber)
|
void LocalBrowserModel::UpdateSavesList(int pageNumber)
|
||||||
{
|
{
|
||||||
std::vector<SaveFile*> tempSavesList = savesList;
|
std::vector<SaveFile*> tempSavesList = savesList;
|
||||||
|
@ -22,6 +22,7 @@ class LocalBrowserModel {
|
|||||||
std::vector<SaveFile*> savesList;
|
std::vector<SaveFile*> savesList;
|
||||||
std::vector<LocalBrowserView*> observers;
|
std::vector<LocalBrowserView*> observers;
|
||||||
int currentPage;
|
int currentPage;
|
||||||
|
bool stampToFront;
|
||||||
void notifySavesListChanged();
|
void notifySavesListChanged();
|
||||||
void notifyPageChanged();
|
void notifyPageChanged();
|
||||||
void notifySelectedChanged();
|
void notifySelectedChanged();
|
||||||
@ -35,6 +36,8 @@ public:
|
|||||||
void RescanStamps();
|
void RescanStamps();
|
||||||
SaveFile * GetSave();
|
SaveFile * GetSave();
|
||||||
void SetSave(SaveFile * newStamp);
|
void SetSave(SaveFile * newStamp);
|
||||||
|
bool GetMoveToFront();
|
||||||
|
void SetMoveToFront(bool move);
|
||||||
std::vector<std::string> GetSelected() { return selected; }
|
std::vector<std::string> GetSelected() { return selected; }
|
||||||
void ClearSelected() { selected.clear(); notifySelectedChanged(); }
|
void ClearSelected() { selected.clear(); notifySelectedChanged(); }
|
||||||
void SelectSave(std::string stampID);
|
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)
|
void LocalBrowserView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
{
|
{
|
||||||
if(key==KEY_ESCAPE)
|
if(key == KEY_ESCAPE)
|
||||||
c->Exit();
|
c->Exit();
|
||||||
|
if (key == KEY_CTRL)
|
||||||
|
c->SetMoveToFront(false);
|
||||||
|
else
|
||||||
|
c->SetMoveToFront(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalBrowserView::~LocalBrowserView() {
|
LocalBrowserView::~LocalBrowserView() {
|
||||||
|
Reference in New Issue
Block a user