Started to add support for offline achievement viewings (still not

fully working).
This commit is contained in:
hiker 2014-02-26 08:19:24 +11:00
parent 7644a5960f
commit b17d2ca0e2
2 changed files with 9 additions and 7 deletions

View File

@ -66,11 +66,11 @@ void OnlineProfileAchievements::beforeAddingWidget()
OnlineProfileBase::beforeAddingWidget();
m_achievements_list_widget->clearColumns();
m_achievements_list_widget->addColumn( _("Name"), 2 );
if(m_visiting_profile->isCurrentUser())
if(m_visiting_profile && m_visiting_profile->isCurrentUser())
{
m_achievements_list_widget->addColumn( _("Progress"), 1 );
}
}
} // beforeAddingWidget
// -----------------------------------------------------------------------------

View File

@ -65,9 +65,9 @@ void OnlineProfileBase::loadedFromFile()
void OnlineProfileBase::beforeAddingWidget()
{
m_visiting_profile = ProfileManager::get()->getVisitingProfile();
if (!m_visiting_profile->isCurrentUser())
if (!m_visiting_profile || !m_visiting_profile->isCurrentUser())
m_settings_tab->setVisible(false);
}
} // beforeAddingWidget
// -----------------------------------------------------------------------------
void OnlineProfileBase::init()
@ -79,12 +79,14 @@ void OnlineProfileBase::init()
m_achievements_tab->setTooltip( _("Achievements") );
m_settings_tab->setTooltip( _("Account Settings") );
if (m_visiting_profile->isCurrentUser())
if (m_visiting_profile && m_visiting_profile->isCurrentUser())
m_header->setText(_("Your profile"), false);
else
else if (m_visiting_profile)
{
m_header->setText( m_visiting_profile->getUserName() + _("'s profile"), false);
m_header->setText(m_visiting_profile->getUserName() + _("'s profile"), false);
}
else
Log::error("OnlineProfileBase", "No visting profile");
} // init