Ensure comments page count is loaded correctly, fixes #117

This commit is contained in:
Simon Robertshaw 2012-08-14 17:00:12 +01:00
parent 66fffe649d
commit 03188e5853
2 changed files with 23 additions and 19 deletions

View File

@ -248,6 +248,7 @@ void PreviewModel::Update()
if(updateSaveInfoFinished && save)
{
commentsTotal = save->Comments;
try
{
save->SetGameSave(new GameSave(&saveDataBuffer[0], saveDataBuffer.size()));
@ -257,6 +258,7 @@ void PreviewModel::Update()
throw PreviewModelException("Save file corrupt or from newer version");
}
notifySaveChanged();
notifyCommentsPageChanged();
}
}
}
@ -285,7 +287,7 @@ void PreviewModel::Update()
}
}
notifySaveChanged();
notifyCommentsPageChanged();
if(!save)
throw PreviewModelException("Unable to load save");
}

View File

@ -54,25 +54,25 @@ void * SearchModel::updateSaveListT()
void SearchModel::UpdateSaveList(int pageNumber, std::string query)
{
lastQuery = query;
lastError = "";
saveListLoaded = false;
saveList.clear();
//resultCount = 0;
currentPage = pageNumber;
notifySaveListChanged();
notifyPageChanged();
selected.clear();
notifySelectedChanged();
if(pageNumber == 1 && !showOwn && !showFavourite && currentSort == "best" && query == "")
SetShowTags(true);
else
SetShowTags(false);
//Threading
if(!updateSaveListWorking)
{
lastQuery = query;
lastError = "";
saveListLoaded = false;
saveList.clear();
//resultCount = 0;
currentPage = pageNumber;
notifySaveListChanged();
notifyPageChanged();
selected.clear();
notifySelectedChanged();
if(pageNumber == 1 && !showOwn && !showFavourite && currentSort == "best" && query == "")
SetShowTags(true);
else
SetShowTags(false);
updateSaveListFinished = false;
updateSaveListWorking = true;
pthread_create(&updateSaveListThread, 0, &SearchModel::updateSaveListTHelper, this);
@ -119,7 +119,8 @@ void SearchModel::Update()
void ** tempInformation;
//vector<SaveInfo*> * tempSaveList;
pthread_join(updateSaveListThread, (void**)(&tempInformation));
resultCount = thResultCount;
saveList = *(vector<SaveInfo*>*)tempInformation[0];
delete (vector<SaveInfo*>*)tempInformation[0];
@ -140,7 +141,8 @@ void SearchModel::Update()
{
lastError = Client::Ref().GetLastError();
}
//currentPage = pageNumber;
resultCount = thResultCount;
notifyPageChanged();
notifySaveListChanged();
}