From 503e261a36c29222583f532dc9dd3c5cd00afa90 Mon Sep 17 00:00:00 2001 From: unitraxx Date: Fri, 13 Sep 2013 23:02:56 +0000 Subject: [PATCH] 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 --- data/gui/online/profile_achievements.stkgui | 3 +- data/gui/online/profile_friends.stkgui | 3 +- data/gui/online/profile_overview.stkgui | 5 +- data/gui/online/profile_settings.stkgui | 25 +++++++ sources.cmake | 2 + src/states_screens/online_profile_base.cpp | 7 ++ src/states_screens/online_profile_base.hpp | 1 + .../online_profile_settings.cpp | 67 +++++++++++++++++++ .../online_profile_settings.hpp | 55 +++++++++++++++ 9 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 data/gui/online/profile_settings.stkgui create mode 100644 src/states_screens/online_profile_settings.cpp create mode 100644 src/states_screens/online_profile_settings.hpp diff --git a/data/gui/online/profile_achievements.stkgui b/data/gui/online/profile_achievements.stkgui index b4734544b..d072200b5 100644 --- a/data/gui/online/profile_achievements.stkgui +++ b/data/gui/online/profile_achievements.stkgui @@ -2,7 +2,7 @@ -
+
@@ -12,6 +12,7 @@ + diff --git a/data/gui/online/profile_friends.stkgui b/data/gui/online/profile_friends.stkgui index 3da7e4e48..b0c6b073c 100644 --- a/data/gui/online/profile_friends.stkgui +++ b/data/gui/online/profile_friends.stkgui @@ -2,7 +2,7 @@ -
+
@@ -12,6 +12,7 @@ + diff --git a/data/gui/online/profile_overview.stkgui b/data/gui/online/profile_overview.stkgui index 0d2c124cb..ab7a4d2da 100644 --- a/data/gui/online/profile_overview.stkgui +++ b/data/gui/online/profile_overview.stkgui @@ -1,5 +1,7 @@ + +
@@ -10,6 +12,7 @@ + @@ -19,6 +22,4 @@
- -
diff --git a/data/gui/online/profile_settings.stkgui b/data/gui/online/profile_settings.stkgui new file mode 100644 index 000000000..1e9fc1501 --- /dev/null +++ b/data/gui/online/profile_settings.stkgui @@ -0,0 +1,25 @@ + + + + +
+ +
+ + + + + + + + + + + +
+ +
+
+
+ +
diff --git a/sources.cmake b/sources.cmake index a0baed12c..7159b37c0 100644 --- a/sources.cmake +++ b/sources.cmake @@ -240,6 +240,7 @@ src/states_screens/online_profile_achievements.cpp src/states_screens/online_profile_base.cpp src/states_screens/online_profile_friends.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_user_search.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_friends.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_user_search.hpp src/states_screens/options_screen_audio.hpp diff --git a/src/states_screens/online_profile_base.cpp b/src/states_screens/online_profile_base.cpp index 64f158400..5e401a008 100644 --- a/src/states_screens/online_profile_base.cpp +++ b/src/states_screens/online_profile_base.cpp @@ -26,6 +26,7 @@ #include "states_screens/online_profile_overview.hpp" #include "states_screens/online_profile_friends.hpp" #include "states_screens/online_profile_achievements.hpp" +#include "states_screens/online_profile_settings.hpp" #include #include @@ -55,6 +56,8 @@ void OnlineProfileBase::loadedFromFile() assert(m_friends_tab != NULL); m_achievements_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_achievements"); assert(m_achievements_tab != NULL); + m_settings_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_settings"); + assert(m_settings_tab != NULL); } // loadedFromFile @@ -72,11 +75,14 @@ void OnlineProfileBase::init() m_overview_tab->setTooltip( _("Overview") ); m_friends_tab->setTooltip( _("Friends") ); m_achievements_tab->setTooltip( _("Achievements") ); + m_settings_tab->setTooltip( _("Account Settings") ); if (m_visiting_profile->isCurrentUser()) m_header->setText(_("Your profile"), false); else + { m_header->setText( m_visiting_profile->getUserName() + _("'s profile"), false); + } } // 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()); 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_settings_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileSettings::getInstance()); } else if (name == "back") { diff --git a/src/states_screens/online_profile_base.hpp b/src/states_screens/online_profile_base.hpp index e974f0f5e..6b5ceba7a 100644 --- a/src/states_screens/online_profile_base.hpp +++ b/src/states_screens/online_profile_base.hpp @@ -42,6 +42,7 @@ protected: GUIEngine::IconButtonWidget * m_overview_tab; GUIEngine::IconButtonWidget * m_friends_tab; GUIEngine::IconButtonWidget * m_achievements_tab; + GUIEngine::IconButtonWidget * m_settings_tab; Online::Profile * m_visiting_profile; diff --git a/src/states_screens/online_profile_settings.cpp b/src/states_screens/online_profile_settings.cpp new file mode 100644 index 000000000..f18270d9f --- /dev/null +++ b/src/states_screens/online_profile_settings.cpp @@ -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 + +#include +#include + +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 + diff --git a/src/states_screens/online_profile_settings.hpp b/src/states_screens/online_profile_settings.hpp new file mode 100644 index 000000000..5dc5284ca --- /dev/null +++ b/src/states_screens/online_profile_settings.hpp @@ -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 +#include + +#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 +{ +protected: + OnlineProfileSettings(); + +public: + friend class GUIEngine::ScreenSingleton; + + /** \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