summaryrefslogtreecommitdiff
path: root/src/gui/profile/ProfileActivity.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2013-04-07 13:40:00 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2013-04-07 13:40:00 (GMT)
commitb4fb55f86e9add3248166278bb566f210dacf636 (patch)
tree2a1fa8d339fdf03741998873a523258a87dea739 /src/gui/profile/ProfileActivity.cpp
parent8d312ecdfadb7c68d00caf01effe0c1e0a45cb76 (diff)
downloadpowder-b4fb55f86e9add3248166278bb566f210dacf636.zip
powder-b4fb55f86e9add3248166278bb566f210dacf636.tar.gz
Allow signing out and editing profile from the old login button, add a button to edit avatar (directs to the website at the moment) Allow viewing profiles by clicking avatars
Diffstat (limited to 'src/gui/profile/ProfileActivity.cpp')
-rw-r--r--src/gui/profile/ProfileActivity.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gui/profile/ProfileActivity.cpp b/src/gui/profile/ProfileActivity.cpp
index 54da81e..fe6ab80 100644
--- a/src/gui/profile/ProfileActivity.cpp
+++ b/src/gui/profile/ProfileActivity.cpp
@@ -49,11 +49,13 @@ ProfileActivity::ProfileActivity(std::string username) :
}
};
- ui::Button * closeButton = new ui::Button(ui::Point(0, Size.Y-15), ui::Point((Size.X/2)+1, 15), "Close");
- closeButton->SetActionCallback(new CloseAction(this));
+ ui::Button * closeButton = new ui::Button(ui::Point(0, Size.Y-15), ui::Point(Size.X, 15), "Close");
+ closeButton->SetActionCallback(new CloseAction(this));
if(editable)
{
+ closeButton->Size.X = (Size.X/2)+1;
+
ui::Button * saveButton = new ui::Button(ui::Point(Size.X/2, Size.Y-15), ui::Point(Size.X/2, 15), "Save");
saveButton->SetActionCallback(new SaveAction(this));
AddComponent(saveButton);
@@ -67,6 +69,17 @@ ProfileActivity::ProfileActivity(std::string username) :
void ProfileActivity::setUserInfo(UserInfo newInfo)
{
+ class EditAvatarAction: public ui::ButtonAction
+ {
+ ProfileActivity * a;
+ public:
+ EditAvatarAction(ProfileActivity * a) : a(a) { }
+ void ActionCallback(ui::Button * sender_)
+ {
+ OpenURI("http://" SERVER "/Profile/Avatar.html");
+ }
+ };
+
info = newInfo;
if(!info.Biography.length() && !editable)
@@ -79,11 +92,18 @@ void ProfileActivity::setUserInfo(UserInfo newInfo)
AddComponent(avatar);
int currentY = 5;
- ui::Label * title = new ui::Label(ui::Point(4, currentY), ui::Point(Size.X-8-(40+8), 15), info.Username);
+ if(editable)
+ {
+ ui::Button * editAvatar = new ui::Button(ui::Point(Size.X - (40 + 16 + 75), currentY), ui::Point(75, 15), "Edit Avatar");
+ editAvatar->SetActionCallback(new EditAvatarAction(this));
+ AddComponent(editAvatar);
+ }
+ ui::Label * title = new ui::Label(ui::Point(4, currentY), ui::Point(Size.X-8-(40+8+75), 15), info.Username);
title->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
AddComponent(title);
currentY += 20;
+
ui::Label * locationTitle = new ui::Label(ui::Point(4, currentY), ui::Point(Size.X-8-(40+8), 15), "Location");
locationTitle->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
AddComponent(locationTitle);