Fixed display of achievements when not logged in.

This commit is contained in:
hiker 2014-03-13 08:31:06 +11:00
parent 955b27bf75
commit a5f9d26f88
2 changed files with 17 additions and 8 deletions

View File

@ -71,9 +71,10 @@ void OnlineProfileAchievements::beforeAddingWidget()
OnlineProfileBase::beforeAddingWidget();
m_achievements_list_widget->clearColumns();
m_achievements_list_widget->addColumn( _("Name"), 2 );
// For the currently logged in user achievement progress will
// also be displayed.
if(m_visiting_profile && m_visiting_profile->isCurrentUser())
// For the current player (even if not logged in, i.e. m_visiting_profile
// = NULL) user achievement progress will also be displayed
if(!m_visiting_profile || m_visiting_profile->isCurrentUser())
{
m_achievements_list_widget->addColumn( _("Progress"), 1 );
}
@ -87,10 +88,10 @@ void OnlineProfileAchievements::init()
OnlineProfileBase::init();
m_profile_tabs->select( m_achievements_tab->m_properties[PROP_ID],
PLAYER_ID_GAME_MASTER );
assert(m_visiting_profile != NULL);
// For current user add the progrss information.
if(m_visiting_profile->isCurrentUser())
// m_visiting_profile is NULL if the user is not logged in.
if(!m_visiting_profile || m_visiting_profile->isCurrentUser())
{
// No need to wait for results, since they are local anyway
m_waiting_for_achievements = false;

View File

@ -47,9 +47,9 @@ OnlineProfileBase::OnlineProfileBase(const char* filename) : Screen(filename)
*/
void OnlineProfileBase::loadedFromFile()
{
m_profile_tabs = this->getWidget<RibbonWidget>("profile_tabs");
m_profile_tabs = getWidget<RibbonWidget>("profile_tabs");
assert(m_profile_tabs != NULL);
m_header = this->getWidget<LabelWidget>("title");
m_header = getWidget<LabelWidget>("title");
assert(m_header != NULL);
m_overview_tab =
@ -75,6 +75,13 @@ void OnlineProfileBase::beforeAddingWidget()
m_visiting_profile = ProfileManager::get()->getVisitingProfile();
if (!m_visiting_profile || !m_visiting_profile->isCurrentUser())
m_settings_tab->setVisible(false);
// If not logged in, don't show profile or friends
if (!m_visiting_profile)
{
m_friends_tab->setVisible(false);
m_profile_tabs->setVisible(false);
}
} // beforeAddingWidget
// -----------------------------------------------------------------------------
@ -89,7 +96,8 @@ void OnlineProfileBase::init()
m_achievements_tab->setTooltip( _("Achievements") );
m_settings_tab->setTooltip( _("Account Settings") );
if (m_visiting_profile && m_visiting_profile->isCurrentUser())
// If no visiting_profile is defined, use the data of the current player.
if (!m_visiting_profile || m_visiting_profile->isCurrentUser())
m_header->setText(_("Your profile"), false);
else if (m_visiting_profile)
{