A new tab/screen for account settings

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13676 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-09-13 23:02:56 +00:00
parent 2c1d02095a
commit 503e261a36
9 changed files with 164 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/> <icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
<div x="1%" y="2%" width="98%" height="96%" layout="vertical-row" > <div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header id="title" text_align="center" width="80%" align="center" text="..."/> <header id="title" text_align="center" width="80%" align="center" text="..."/>
@ -12,6 +12,7 @@
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.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_players.png"/> <icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png" I18N="Section in the profile menu" text="Achievements"/> <icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png" I18N="Section in the profile menu" text="Achievements"/>
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
</tabs> </tabs>
<box proportion="1" width="100%" layout="vertical-row" padding="6"> <box proportion="1" width="100%" layout="vertical-row" padding="6">

View File

@ -2,7 +2,7 @@
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/> <icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
<div x="1%" y="2%" width="98%" height="96%" layout="vertical-row" > <div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header id="title" text_align="center" width="80%" align="center" text="..."/> <header id="title" text_align="center" width="80%" align="center" text="..."/>
@ -12,6 +12,7 @@
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.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_players.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"/>
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"/> <icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
</tabs> </tabs>
<box proportion="1" width="100%" layout="vertical-row" padding="6"> <box proportion="1" width="100%" layout="vertical-row" padding="6">

View File

@ -1,5 +1,7 @@
<stkgui> <stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" > <div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header id="title" text_align="center" width="80%" align="center" text="..."/> <header id="title" text_align="center" width="80%" align="center" text="..."/>
@ -10,6 +12,7 @@
<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_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_players.png" /> <icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"/> <icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
</tabs> </tabs>
<box proportion="1" width="100%" layout="vertical-row"> <box proportion="1" width="100%" layout="vertical-row">
@ -19,6 +22,4 @@
</box> </box>
</div> </div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
</stkgui> </stkgui>

View File

@ -0,0 +1,25 @@
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header id="title" text_align="center" width="80%" align="center" text="..."/>
<spacer height="25" width="10"/>
<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_ui.png"/>
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png" I18N="Section in the profile menu" text="Account Settings"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<div x="1%" y="2%" width="98%" height="96%" layout="vertical-row" >
</div>
</box>
</div>
</stkgui>

View File

@ -240,6 +240,7 @@ src/states_screens/online_profile_achievements.cpp
src/states_screens/online_profile_base.cpp src/states_screens/online_profile_base.cpp
src/states_screens/online_profile_friends.cpp src/states_screens/online_profile_friends.cpp
src/states_screens/online_profile_overview.cpp src/states_screens/online_profile_overview.cpp
src/states_screens/online_profile_settings.cpp
src/states_screens/online_screen.cpp src/states_screens/online_screen.cpp
src/states_screens/online_user_search.cpp src/states_screens/online_user_search.cpp
src/states_screens/options_screen_audio.cpp src/states_screens/options_screen_audio.cpp
@ -548,6 +549,7 @@ src/states_screens/online_profile_achievements.hpp
src/states_screens/online_profile_base.hpp src/states_screens/online_profile_base.hpp
src/states_screens/online_profile_friends.hpp src/states_screens/online_profile_friends.hpp
src/states_screens/online_profile_overview.hpp src/states_screens/online_profile_overview.hpp
src/states_screens/online_profile_settings.hpp
src/states_screens/online_screen.hpp src/states_screens/online_screen.hpp
src/states_screens/online_user_search.hpp src/states_screens/online_user_search.hpp
src/states_screens/options_screen_audio.hpp src/states_screens/options_screen_audio.hpp

View File

@ -26,6 +26,7 @@
#include "states_screens/online_profile_overview.hpp" #include "states_screens/online_profile_overview.hpp"
#include "states_screens/online_profile_friends.hpp" #include "states_screens/online_profile_friends.hpp"
#include "states_screens/online_profile_achievements.hpp" #include "states_screens/online_profile_achievements.hpp"
#include "states_screens/online_profile_settings.hpp"
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
@ -55,6 +56,8 @@ void OnlineProfileBase::loadedFromFile()
assert(m_friends_tab != NULL); assert(m_friends_tab != NULL);
m_achievements_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_achievements"); m_achievements_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_achievements");
assert(m_achievements_tab != NULL); assert(m_achievements_tab != NULL);
m_settings_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_settings");
assert(m_settings_tab != NULL);
} // loadedFromFile } // loadedFromFile
@ -72,11 +75,14 @@ void OnlineProfileBase::init()
m_overview_tab->setTooltip( _("Overview") ); m_overview_tab->setTooltip( _("Overview") );
m_friends_tab->setTooltip( _("Friends") ); m_friends_tab->setTooltip( _("Friends") );
m_achievements_tab->setTooltip( _("Achievements") ); m_achievements_tab->setTooltip( _("Achievements") );
m_settings_tab->setTooltip( _("Account Settings") );
if (m_visiting_profile->isCurrentUser()) if (m_visiting_profile->isCurrentUser())
m_header->setText(_("Your profile"), false); m_header->setText(_("Your profile"), false);
else else
{
m_header->setText( m_visiting_profile->getUserName() + _("'s profile"), false); m_header->setText( m_visiting_profile->getUserName() + _("'s profile"), false);
}
} // init } // init
@ -91,6 +97,7 @@ void OnlineProfileBase::eventCallback(Widget* widget, const std::string& name, c
if (selection == m_overview_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileOverview::getInstance()); if (selection == m_overview_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileOverview::getInstance());
else if (selection == m_friends_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileFriends::getInstance()); else if (selection == m_friends_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileFriends::getInstance());
else if (selection == m_achievements_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileAchievements::getInstance()); else if (selection == m_achievements_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileAchievements::getInstance());
else if (selection == m_settings_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileSettings::getInstance());
} }
else if (name == "back") else if (name == "back")
{ {

View File

@ -42,6 +42,7 @@ protected:
GUIEngine::IconButtonWidget * m_overview_tab; GUIEngine::IconButtonWidget * m_overview_tab;
GUIEngine::IconButtonWidget * m_friends_tab; GUIEngine::IconButtonWidget * m_friends_tab;
GUIEngine::IconButtonWidget * m_achievements_tab; GUIEngine::IconButtonWidget * m_achievements_tab;
GUIEngine::IconButtonWidget * m_settings_tab;
Online::Profile * m_visiting_profile; Online::Profile * m_visiting_profile;

View File

@ -0,0 +1,67 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2010 Glenn De Jonghe
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/online_profile_settings.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <IGUIButton.h>
#include <iostream>
#include <sstream>
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;
using namespace Online;
DEFINE_SCREEN_SINGLETON( OnlineProfileSettings );
// -----------------------------------------------------------------------------
OnlineProfileSettings::OnlineProfileSettings() : OnlineProfileBase("online/profile_settings.stkgui")
{
} // OnlineProfileSettings
// -----------------------------------------------------------------------------
void OnlineProfileSettings::loadedFromFile()
{
OnlineProfileBase::loadedFromFile();
} // loadedFromFile
// -----------------------------------------------------------------------------
void OnlineProfileSettings::init()
{
OnlineProfileBase::init();
m_profile_tabs->select( m_settings_tab->m_properties[PROP_ID], PLAYER_ID_GAME_MASTER );
} // init
// -----------------------------------------------------------------------------
void OnlineProfileSettings::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
OnlineProfileBase::eventCallback( widget, name, playerID);
} // eventCallback

View File

@ -0,0 +1,55 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2013 Glenn De Jonghe
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __HEADER_ONLINE_PROFILE_SETTINGS_HPP__
#define __HEADER_ONLINE_PROFILE_SETTINGS_HPP__
#include <string>
#include <irrString.h>
#include "guiengine/screen.hpp"
#include "guiengine/widgets.hpp"
#include "states_screens/online_profile_base.hpp"
namespace GUIEngine { class Widget; }
/**
* \brief Online profiel overview screen
* \ingroup states_screens
*/
class OnlineProfileSettings : public OnlineProfileBase, public GUIEngine::ScreenSingleton<OnlineProfileSettings>
{
protected:
OnlineProfileSettings();
public:
friend class GUIEngine::ScreenSingleton<OnlineProfileSettings>;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
const int playerID) OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void init() OVERRIDE;
};
#endif