Start of the GUI additions. Need some refactoring first.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13501 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-08-18 14:54:41 +00:00
parent 9003af59e1
commit 70bb8df317
6 changed files with 53 additions and 15 deletions

View File

@ -3,13 +3,13 @@
<div x="2%" y="5%" width="96%" height="85%" layout="vertical-row" > <div x="2%" y="5%" width="96%" height="85%" layout="vertical-row" >
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true" <header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the server info dialog' dialog" text="Server Info"/> I18N="User info dialog' dialog" text="User Info"/>
<spacer height="20" width="50"> <spacer height="20" width="50">
<div width="80%" align="center" layout="vertical-row" height="fit" > <div width="80%" align="center" layout="vertical-row" height="fit" >
<div width="100%" height="fit" layout="horizontal-row" > <div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the server info dialog" text="Name"/> <label proportion="1" text_align="left" I18N="User info dialog" text="Name"/>
<label id="name" proportion="2" text_align="left" text=""/> <label id="name" proportion="2" text_align="left" text=""/>
</div> </div>
</div> </div>
@ -21,10 +21,16 @@
<spacer height="20" width="50"> <spacer height="20" width="50">
<buttonbar id="options" width="90%" height="20%" align="center"> <buttonbar id="options" width="90%" height="20%" align="center">
<icon-button id="enter" width="64" height="64" icon="gui/green_check.png" <icon-button id="friend" width="64" height="64" icon="gui/main_help.png"
I18N="Login dialog" text="Enter" label_location="bottom"/> I18N="User info dialog" text="Add Friend" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png" <icon-button id="accept" width="64" height="64" icon="gui/green_check.png"
I18N="Login dialog" text="Cancel" label_location="bottom"/> I18N="User info dialog" text="Accept" label_location="bottom"/>
<icon-button id="decline" width="64" height="64" icon="gui/red_mark.png"
I18N="User info dialog" text="Decline" label_location="bottom"/>
<icon-button id="enter" width="64" height="64" icon="gui/difficulty_medium.png"
I18N="User info dialog" text="View" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="User info dialog" text="Cancel" label_location="bottom"/>
</buttonbar> </buttonbar>

View File

@ -280,10 +280,10 @@ namespace Online{
// ============================================================================ // ============================================================================
const CurrentUser::setAddonVoteRequest * CurrentUser::requestSetAddonVote( const std::string & addon_id, float rating) const const CurrentUser::SetAddonVoteRequest * CurrentUser::requestSetAddonVote( const std::string & addon_id, float rating) const
{ {
assert(isRegisteredUser()); assert(isRegisteredUser());
CurrentUser::setAddonVoteRequest * request = new CurrentUser::setAddonVoteRequest(); CurrentUser::SetAddonVoteRequest * request = new CurrentUser::SetAddonVoteRequest();
request->setURL((std::string)UserConfigParams::m_server_multiplayer + "client-user.php"); request->setURL((std::string)UserConfigParams::m_server_multiplayer + "client-user.php");
request->setParameter("action", std::string("set-addon-vote")); request->setParameter("action", std::string("set-addon-vote"));
request->setParameter("token", getToken()); request->setParameter("token", getToken());
@ -294,7 +294,7 @@ namespace Online{
return request; return request;
} }
void CurrentUser::setAddonVoteRequest::callback() void CurrentUser::SetAddonVoteRequest::callback()
{ {
if(m_success) if(m_success)
{ {
@ -321,6 +321,14 @@ namespace Online{
return request; return request;
} }
void CurrentUser::FriendRequest::callback()
{
if(m_success)
{
//FIXME
}
}
// ============================================================================ // ============================================================================
const CurrentUser::AcceptFriendRequest * CurrentUser::requestAcceptFriend(const uint32_t friend_id) const const CurrentUser::AcceptFriendRequest * CurrentUser::requestAcceptFriend(const uint32_t friend_id) const
@ -336,6 +344,14 @@ namespace Online{
return request; return request;
} }
void CurrentUser::AcceptFriendRequest::callback()
{
if(m_success)
{
//FIXME
}
}
// ============================================================================ // ============================================================================
const CurrentUser::DeclineFriendRequest * CurrentUser::requestDeclineFriend(const uint32_t friend_id) const const CurrentUser::DeclineFriendRequest * CurrentUser::requestDeclineFriend(const uint32_t friend_id) const
@ -351,6 +367,14 @@ namespace Online{
return request; return request;
} }
void CurrentUser::DeclineFriendRequest::callback()
{
if(m_success)
{
//FIXME
}
}
// ============================================================================ // ============================================================================
const irr::core::stringw CurrentUser::getUserName() const const irr::core::stringw CurrentUser::getUserName() const

View File

@ -19,7 +19,7 @@
#ifndef HEADER_CURRENT_ONLINE_USER_HPP #ifndef HEADER_CURRENT_ONLINE_USER_HPP
#define HEADER_CURRENT_ONLINE_USER_HPP #define HEADER_CURRENT_ONLINE_USER_HPP
#include "http_manager.hpp" #include "online/http_manager.hpp"
#include "online/server.hpp" #include "online/server.hpp"
#include "online/user.hpp" #include "online/user.hpp"
#include "online/profile.hpp" #include "online/profile.hpp"
@ -88,10 +88,10 @@ namespace Online{
ServerJoinRequest() : XMLRequest(RT_SERVER_JOIN) {} ServerJoinRequest() : XMLRequest(RT_SERVER_JOIN) {}
}; };
class setAddonVoteRequest : public XMLRequest { class SetAddonVoteRequest : public XMLRequest {
virtual void callback (); virtual void callback ();
public: public:
setAddonVoteRequest() : XMLRequest() {} SetAddonVoteRequest() : XMLRequest() {}
}; };
class FriendRequest : public XMLRequest { class FriendRequest : public XMLRequest {
@ -155,7 +155,7 @@ namespace Online{
const irr::core::stringw &email); const irr::core::stringw &email);
const XMLRequest * requestGetAddonVote(const std::string & addon_id) const; const XMLRequest * requestGetAddonVote(const std::string & addon_id) const;
const setAddonVoteRequest * requestSetAddonVote(const std::string & addon_id, float rating) const; const SetAddonVoteRequest * requestSetAddonVote(const std::string & addon_id, float rating) const;
const FriendRequest * requestFriendRequest(const uint32_t friend_id) const; const FriendRequest * requestFriendRequest(const uint32_t friend_id) const;
const AcceptFriendRequest * requestAcceptFriend(const uint32_t friend_id) const; const AcceptFriendRequest * requestAcceptFriend(const uint32_t friend_id) const;
const DeclineFriendRequest * requestDeclineFriend(const uint32_t friend_id) const; const DeclineFriendRequest * requestDeclineFriend(const uint32_t friend_id) const;

View File

@ -56,6 +56,12 @@ UserInfoDialog::UserInfoDialog(uint32_t visiting_id)
assert(m_info_widget != NULL); assert(m_info_widget != NULL);
m_options_widget = getWidget<RibbonWidget>("options"); m_options_widget = getWidget<RibbonWidget>("options");
assert(m_options_widget != NULL); assert(m_options_widget != NULL);
m_friend_widget = getWidget<IconButtonWidget>("friend");
assert(m_friend_widget != NULL);
m_accept_widget = getWidget<IconButtonWidget>("accept");
assert(m_accept_widget != NULL);
m_decline_widget = getWidget<IconButtonWidget>("decline");
assert(m_decline_widget != NULL);
m_enter_widget = getWidget<IconButtonWidget>("enter"); m_enter_widget = getWidget<IconButtonWidget>("enter");
assert(m_enter_widget != NULL); assert(m_enter_widget != NULL);
m_cancel_widget = getWidget<IconButtonWidget>("cancel"); m_cancel_widget = getWidget<IconButtonWidget>("cancel");

View File

@ -47,7 +47,9 @@ private:
GUIEngine::LabelWidget * m_info_widget; GUIEngine::LabelWidget * m_info_widget;
GUIEngine::RibbonWidget * m_options_widget; GUIEngine::RibbonWidget * m_options_widget;
GUIEngine::IconButtonWidget * m_add_widget; GUIEngine::IconButtonWidget * m_friend_widget;
GUIEngine::IconButtonWidget * m_accept_widget;
GUIEngine::IconButtonWidget * m_decline_widget;
GUIEngine::IconButtonWidget * m_enter_widget; GUIEngine::IconButtonWidget * m_enter_widget;
GUIEngine::IconButtonWidget * m_cancel_widget; GUIEngine::IconButtonWidget * m_cancel_widget;

View File

@ -46,7 +46,7 @@ private:
const std::string m_addon_id; const std::string m_addon_id;
bool m_self_destroy; bool m_self_destroy;
const Online::XMLRequest * m_fetch_vote_request; const Online::XMLRequest * m_fetch_vote_request;
const Online::CurrentUser::setAddonVoteRequest * m_perform_vote_request; const Online::CurrentUser::SetAddonVoteRequest * m_perform_vote_request;
GUIEngine::LabelWidget * m_info_widget; GUIEngine::LabelWidget * m_info_widget;