Stable version of profile where your friends are actually showed with their username in a small list.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13459 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
098b191e9e
commit
c687151d11
@ -7,8 +7,8 @@
|
|||||||
<spacer height="25" width="10"/>
|
<spacer height="25" width="10"/>
|
||||||
|
|
||||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||||
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_video.png" />
|
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.png" />
|
||||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_video.png" I18N="Section in the profile menu" text="Friends"/>
|
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" I18N="Section in the profile menu" text="Friends"/>
|
||||||
</tabs>
|
</tabs>
|
||||||
|
|
||||||
<box proportion="1" width="100%" layout="vertical-row">
|
<box proportion="1" width="100%" layout="vertical-row">
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
<spacer height="25" width="10"/>
|
<spacer height="25" width="10"/>
|
||||||
|
|
||||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||||
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_video.png" I18N="Section in the profile menu" text="Overview"/>
|
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.png" I18N="Section in the profile menu" text="Overview"/>
|
||||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_video.png" />
|
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
|
||||||
</tabs>
|
</tabs>
|
||||||
|
|
||||||
<box proportion="1" width="100%" layout="vertical-row">
|
<box proportion="1" width="100%" layout="vertical-row">
|
||||||
|
@ -218,19 +218,6 @@ namespace Online{
|
|||||||
CurrentUser::get()->signOut(m_success, m_result);
|
CurrentUser::get()->signOut(m_success, m_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
const Profile::FriendsListRequest * CurrentUser::requestFriendsOf(const uint32_t visiting_id){
|
|
||||||
assert(isRegisteredUser());
|
|
||||||
Profile::FriendsListRequest * request = new Profile::FriendsListRequest();
|
|
||||||
request->setURL((std::string)UserConfigParams::m_server_multiplayer + "client-user.php");
|
|
||||||
request->setParameter("action",std::string("get-friends-list"));
|
|
||||||
request->setParameter("token", getToken());
|
|
||||||
request->setParameter("userid", getUserID());
|
|
||||||
request->setParameter("visitingid", visiting_id);
|
|
||||||
HTTPManager::get()->addRequest(request);
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
CurrentUser::ServerJoinRequest * CurrentUser::requestServerJoin(uint32_t server_id,
|
CurrentUser::ServerJoinRequest * CurrentUser::requestServerJoin(uint32_t server_id,
|
||||||
|
@ -139,9 +139,6 @@ namespace Online{
|
|||||||
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 Profile::FriendsListRequest * requestFriendsOf(const uint32_t visiting_id);
|
|
||||||
|
|
||||||
/** Returns the username if signed in. */
|
/** Returns the username if signed in. */
|
||||||
const irr::core::stringw getUserName() const;
|
const irr::core::stringw getUserName() const;
|
||||||
const UserState getUserState() const { return m_state.getAtomic(); }
|
const UserState getUserState() const { return m_state.getAtomic(); }
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include "online/profile.hpp"
|
#include "online/profile.hpp"
|
||||||
|
|
||||||
#include "online/profile_manager.hpp"
|
#include "online/profile_manager.hpp"
|
||||||
|
#include "online/http_manager.hpp"
|
||||||
|
#include "config/user_config.hpp"
|
||||||
#include "online/current_user.hpp"
|
#include "online/current_user.hpp"
|
||||||
#include "utils/log.hpp"
|
#include "utils/log.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
@ -55,20 +57,21 @@ namespace Online{
|
|||||||
if(m_has_fetched_friends)
|
if(m_has_fetched_friends)
|
||||||
return;
|
return;
|
||||||
setState (S_FETCHING);
|
setState (S_FETCHING);
|
||||||
m_friends_list_request = CurrentUser::get()->requestFriendsOf(m_id);
|
m_friends_list_request = requestFriendsList();
|
||||||
}
|
}
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
|
||||||
void Profile::friendsListCallback(const XMLNode * input)
|
void Profile::friendsListCallback(const XMLNode * input)
|
||||||
{
|
{
|
||||||
uint32_t friendid(0);
|
|
||||||
irr::core::stringw username("check");
|
|
||||||
const XMLNode * friends_xml = input->getNode("friends");
|
const XMLNode * friends_xml = input->getNode("friends");
|
||||||
m_friends.clearAndDeleteAll();
|
m_friends.clearAndDeleteAll();
|
||||||
|
uint32_t friendid(0);
|
||||||
|
irr::core::stringw username("");
|
||||||
for (unsigned int i = 0; i < friends_xml->getNumNodes(); i++)
|
for (unsigned int i = 0; i < friends_xml->getNumNodes(); i++)
|
||||||
{
|
{
|
||||||
friends_xml->getNode(i)->get("friend_id", &friendid);
|
friends_xml->getNode(i)->get("friend_id", &friendid);
|
||||||
|
friends_xml->getNode(i)->get("friend_name", &username);
|
||||||
m_friends.push_back(new User(username, friendid));
|
m_friends.push_back(new User(username, friendid));
|
||||||
}
|
}
|
||||||
m_has_fetched_friends = true;
|
m_has_fetched_friends = true;
|
||||||
@ -78,6 +81,18 @@ namespace Online{
|
|||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
const Profile::FriendsListRequest * Profile::requestFriendsList()
|
||||||
|
{
|
||||||
|
FriendsListRequest * request = new FriendsListRequest();
|
||||||
|
request->setURL((std::string)UserConfigParams::m_server_multiplayer + "client-user.php");
|
||||||
|
request->setParameter("action",std::string("get-friends-list"));
|
||||||
|
request->setParameter("token", CurrentUser::get()->getToken());
|
||||||
|
request->setParameter("userid", CurrentUser::get()->getUserID());
|
||||||
|
request->setParameter("visitingid", m_id);
|
||||||
|
HTTPManager::get()->addRequest(request);
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
void Profile::FriendsListRequest::callback()
|
void Profile::FriendsListRequest::callback()
|
||||||
{
|
{
|
||||||
uint32_t user_id(0);
|
uint32_t user_id(0);
|
||||||
|
@ -71,6 +71,7 @@ namespace Online{
|
|||||||
void setState(State state) { m_state.setAtomic(state); }
|
void setState(State state) { m_state.setAtomic(state); }
|
||||||
const State getState() const { return m_state.getAtomic(); }
|
const State getState() const { return m_state.getAtomic(); }
|
||||||
|
|
||||||
|
const FriendsListRequest * requestFriendsList();
|
||||||
void friendsListCallback(const XMLNode * input);
|
void friendsListCallback(const XMLNode * input);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user