Skip to content

Commit

Permalink
修复第二个打开群时不显示群公告的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
arjide committed Nov 10, 2014
1 parent 555051c commit 727ee00
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 2 additions & 1 deletion qml/Chat/GroupChatPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ChatPage{

data = JSON.parse(data)
if( data.retcode == 0 ){
text_announcement.text = data.result.ginfo.memo//设置群公告
myinfo.announcement = data.result.ginfo.memo//设置群公告

var members = data.result.cards
for ( var i in members ){
Expand Down Expand Up @@ -90,6 +90,7 @@ ChatPage{

Text{
id: text_announcement
text: myinfo.announcement//群公告
anchors.fill: parent
anchors.margins: 10
wrapMode: Text.WordWrap
Expand Down
14 changes: 14 additions & 0 deletions src/qqstars/qqiteminfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,11 @@ int GroupInfo::membersCount() const
return queue_members.count ();
}

QString GroupInfo::announcement() const
{
return m_announcement;
}

void GroupInfo::setCode(QString arg)
{
if (m_code == arg)
Expand Down Expand Up @@ -854,6 +859,15 @@ FriendInfo *GroupInfo::getMemberInfoByIndex(int index)
return queue_members[index];
}

void GroupInfo::setAnnouncement(QString arg)
{
if (m_announcement == arg)
return;

m_announcement = arg;
emit announcementChanged(arg);
}

DiscuInfo::DiscuInfo(QObject *parent):
QQItemInfo(Discu, parent)
{
Expand Down
8 changes: 7 additions & 1 deletion src/qqstars/qqiteminfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,19 @@ class GroupInfo:public QQItemInfo
Q_OBJECT
Q_PROPERTY(QString code READ code WRITE setCode NOTIFY codeChanged)//相当于好友的uin的功能
Q_PROPERTY(int membersCount READ membersCount NOTIFY memberCountChanged FINAL)//群成员个数
Q_PROPERTY(QString announcement READ announcement WRITE setAnnouncement NOTIFY announcementChanged)

QString m_code;
QQueue<FriendInfo*> queue_members;//储存群成员列表
QMap<QString, QString> map_card;

QString m_announcement;

public:
explicit GroupInfo(QObject *parent=0);
QString code() const;
int membersCount() const;
QString announcement() const;

public slots:
void setCode(QString arg);
void addMember(FriendInfo* info);//增加群成员
Expand All @@ -283,11 +287,13 @@ public slots:
void setMemberCard(const QString& uin, const QString& card);//给群成员设置群名片
QString getMemberCardByUin(const QString& uin, const QString& defaultCard);
FriendInfo* getMemberInfoByIndex(int index);//获取群成员信息
void setAnnouncement(QString arg);
signals:
void codeChanged(QString arg);
void memberCountChanged(int arg);
void memberIncrease(FriendInfo* info);//群成员增加了
void memberReduce(int index);//群成员减少了,index为被移除的群成员序号
void announcementChanged(QString arg);
};

class DiscuInfo:public QQItemInfo
Expand Down

0 comments on commit 727ee00

Please sign in to comment.