Adding a comment updates the comment total / number of pages

This commit is contained in:
jacob1 2015-10-01 22:26:23 -04:00
parent b184c78cff
commit 55d20f1bb2
3 changed files with 10 additions and 0 deletions

View File

@ -86,6 +86,7 @@ bool PreviewController::SubmitComment(std::string comment)
} }
else else
{ {
previewModel->CommentAdded();
previewModel->UpdateComments(1); previewModel->UpdateComments(1);
} }
} }

View File

@ -141,6 +141,13 @@ void PreviewModel::UpdateComments(int pageNumber)
} }
} }
void PreviewModel::CommentAdded()
{
if (save)
save->Comments++;
commentsTotal++;
}
void PreviewModel::OnResponseReady(void * object, int identifier) void PreviewModel::OnResponseReady(void * object, int identifier)
{ {
if (identifier == 1) if (identifier == 1)
@ -166,6 +173,7 @@ void PreviewModel::OnResponseReady(void * object, int identifier)
saveComments = (std::vector<SaveComment*>*)object; saveComments = (std::vector<SaveComment*>*)object;
commentsLoaded = true; commentsLoaded = true;
notifySaveCommentsChanged(); notifySaveCommentsChanged();
notifyCommentsPageChanged();
} }
if (identifier == 1 || identifier == 2) if (identifier == 1 || identifier == 2)

View File

@ -48,6 +48,7 @@ public:
int GetCommentsPageNum(); int GetCommentsPageNum();
int GetCommentsPageCount(); int GetCommentsPageCount();
void UpdateComments(int pageNumber); void UpdateComments(int pageNumber);
void CommentAdded();
void AddObserver(PreviewView * observer); void AddObserver(PreviewView * observer);
void UpdateSave(int saveID, int saveDate); void UpdateSave(int saveID, int saveDate);