summaryrefslogtreecommitdiff
path: root/src/preview/PreviewView.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-03-09 16:50:14 (GMT)
committer jacob1 <jfu614@gmail.com>2013-03-09 16:50:14 (GMT)
commitc66d4c72f5470a46564174ebf7a75c597b275731 (patch)
tree02294839c8ba2bba30774103624148c3af6bd3a4 /src/preview/PreviewView.cpp
parent1ca39e1e7dc3659e4cb16aff515f30acfe88850d (diff)
parent6090f0b0aaf302612f363cd3d85408e3b7d1150b (diff)
downloadpowder-c66d4c72f5470a46564174ebf7a75c597b275731.zip
powder-c66d4c72f5470a46564174ebf7a75c597b275731.tar.gz
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/preview/PreviewView.cpp')
-rw-r--r--src/preview/PreviewView.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp
index 1859a2a..005cef9 100644
--- a/src/preview/PreviewView.cpp
+++ b/src/preview/PreviewView.cpp
@@ -489,15 +489,18 @@ void PreviewView::NotifyCommentsPageChanged(PreviewModel * sender)
void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
{
- if(sender->GetComments())
- {
- comments = std::vector<SaveComment>(sender->GetComments()->begin(), sender->GetComments()->end());
- }
- else
+ std::vector<SaveComment*> * comments = sender->GetComments();
+
+ for(int i = 0; i < commentComponents.size(); i++)
{
- comments.clear();
+ commentsPanel->RemoveChild(commentComponents[i]);
+ delete commentComponents[i];
}
+ commentComponents.clear();
+ commentTextComponents.clear();
+ commentsPanel->InnerSize = ui::Point(0, 0);
+ if(comments)
{
for(int i = 0; i < commentComponents.size(); i++)
{
@@ -510,10 +513,10 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
int currentY = 0;//-yOffset;
ui::Label * tempUsername;
ui::Label * tempComment;
- for(int i = 0; i < comments.size(); i++)
+ for(int i = 0; i < comments->size(); i++)
{
int usernameY = currentY+5, commentY;
- tempUsername = new ui::Label(ui::Point(5, currentY+5), ui::Point(Size.X-((XRES/2) + 13), 16), comments[i].authorName);
+ tempUsername = new ui::Label(ui::Point(5, currentY+5), ui::Point(Size.X-((XRES/2) + 13), 16), comments->at(i)->authorName);
tempUsername->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
tempUsername->Appearance.VerticalAlign = ui::Appearance::AlignBottom;
currentY += 16;
@@ -523,7 +526,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
commentY = currentY+5;
- tempComment = new ui::Label(ui::Point(5, currentY+5), ui::Point(Size.X-((XRES/2) + 13), -1), comments[i].comment);
+ tempComment = new ui::Label(ui::Point(5, currentY+5), ui::Point(Size.X-((XRES/2) + 13), -1), comments->at(i)->comment);
tempComment->SetMultiline(true);
tempComment->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
tempComment->Appearance.VerticalAlign = ui::Appearance::AlignTop;