Esempio n. 1
0
	ProfileDialog::ProfileDialog (IAccount *acc, QWidget *parent)
	: QDialog (parent)
	, Account_ (acc)
	, ProfileWidget_ (0)
	{
		Ui_.setupUi (this);

		QObject *profileObj = acc->GetProfile ();
		IProfile *profile = qobject_cast<IProfile*> (profileObj);
		if (!profile)
		{
			qWarning () << Q_FUNC_INFO
					<< "account profile"
					<< profileObj
					<< "doesn't implement IProfile";
			return;
		}
		connect (profileObj,
				SIGNAL (profileUpdated ()),
				this,
				SLOT (handleProfileUpdated ()));
		QWidget* w = profile->GetProfileWidget ();
		ProfileWidget_ = qobject_cast<IProfileWidget*> (w);
		if (ProfileWidget_)
			Ui_.gridLayout_2->addWidget (w);
		else
			qWarning () << Q_FUNC_INFO
					<< "widget"
					<< w
					<< "doesn't implement IProfileWidget";
	}
Esempio n. 2
0
	void LJProfile::handleProfileUpdate (const LJProfileData& profile)
	{
		ProfileData_ = profile;
		SaveAvatar ();
		for (int i = 0; i < ProfileData_.AvatarsID_.count (); ++i)
			SaveOthersAvatars (ProfileData_.AvatarsID_.value (i),
					ProfileData_.AvatarsUrls_.value (i));
		emit profileUpdated ();
	}
Esempio n. 3
0
void LJProfile::AddFriends (const QList<LJFriendEntry_ptr>& friends)
{
    ProfileData_.Friends_ << friends;
    std::sort (ProfileData_.Friends_.begin (), ProfileData_.Friends_.end (), CompareFriends);
    ProfileData_.Friends_.erase (std::unique (ProfileData_.Friends_.begin (), ProfileData_.Friends_.end (),
                                 [] (decltype (ProfileData_.Friends_.front ()) fr1,
                                     decltype (ProfileData_.Friends_.front ()) fr2)
    {
        return fr1->GetUserName () == fr2->GetUserName ();
    }), ProfileData_.Friends_.end ());

    emit profileUpdated ();
}
Esempio n. 4
0
void LJProfile::handleProfileUpdate (const LJProfileData& profile)
{
    ProfileData_ = profile;
    std::sort (ProfileData_.Moods_.begin (), ProfileData_.Moods_.end (),
               [] (decltype (ProfileData_.Moods_.at (0)) mood1,
                   decltype (ProfileData_.Moods_.at (0)) mood2)
    {
        return QString::localeAwareCompare (mood1.Name_, mood2.Name_) < 0;
    });
    SaveAvatar ();
    for (int i = 0; i < ProfileData_.AvatarsID_.count (); ++i)
        SaveOthersAvatars (ProfileData_.AvatarsID_.value (i),
                           ProfileData_.AvatarsUrls_.value (i));
    emit profileUpdated ();
}
Esempio n. 5
0
	void LJProfile::handleProfileUpdate (const LJProfileData& profile)
	{
		ProfileData_ = profile;
		SaveAvatar ();
		emit profileUpdated ();
	}