Skip to content

Commit

Permalink
Adding a comment updates the comment total / number of pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Oct 2, 2015
1 parent b184c78 commit 55d20f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/gui/preview/PreviewController.cpp
Expand Up @@ -86,6 +86,7 @@ bool PreviewController::SubmitComment(std::string comment)
}
else
{
previewModel->CommentAdded();
previewModel->UpdateComments(1);
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/gui/preview/PreviewModel.cpp
Expand Up @@ -141,6 +141,13 @@ void PreviewModel::UpdateComments(int pageNumber)
}
}

void PreviewModel::CommentAdded()
{
if (save)
save->Comments++;
commentsTotal++;
}

void PreviewModel::OnResponseReady(void * object, int identifier)
{
if (identifier == 1)
Expand All @@ -166,6 +173,7 @@ void PreviewModel::OnResponseReady(void * object, int identifier)
saveComments = (std::vector<SaveComment*>*)object;
commentsLoaded = true;
notifySaveCommentsChanged();
notifyCommentsPageChanged();
}

if (identifier == 1 || identifier == 2)
Expand Down
1 change: 1 addition & 0 deletions src/gui/preview/PreviewModel.h
Expand Up @@ -48,6 +48,7 @@ class PreviewModel: RequestListener {
int GetCommentsPageNum();
int GetCommentsPageCount();
void UpdateComments(int pageNumber);
void CommentAdded();

void AddObserver(PreviewView * observer);
void UpdateSave(int saveID, int saveDate);
Expand Down

0 comments on commit 55d20f1

Please sign in to comment.