From 727ee00f666c253cddd7a4e0f5a5eb630e317d26 Mon Sep 17 00:00:00 2001 From: AfterTheRainOfStars <853715872@qq.com> Date: Mon, 10 Nov 2014 19:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AC=AC=E4=BA=8C=E4=B8=AA?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=BE=A4=E6=97=B6=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=BE=A4=E5=85=AC=E5=91=8A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/Chat/GroupChatPage.qml | 3 ++- src/qqstars/qqiteminfo.cpp | 14 ++++++++++++++ src/qqstars/qqiteminfo.h | 8 +++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/qml/Chat/GroupChatPage.qml b/qml/Chat/GroupChatPage.qml index a5057f0..55fba38 100644 --- a/qml/Chat/GroupChatPage.qml +++ b/qml/Chat/GroupChatPage.qml @@ -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 ){ @@ -90,6 +90,7 @@ ChatPage{ Text{ id: text_announcement + text: myinfo.announcement//群公告 anchors.fill: parent anchors.margins: 10 wrapMode: Text.WordWrap diff --git a/src/qqstars/qqiteminfo.cpp b/src/qqstars/qqiteminfo.cpp index 73f9f04..a4b563d 100644 --- a/src/qqstars/qqiteminfo.cpp +++ b/src/qqstars/qqiteminfo.cpp @@ -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) @@ -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) { diff --git a/src/qqstars/qqiteminfo.h b/src/qqstars/qqiteminfo.h index 50d874b..d4ad68b 100644 --- a/src/qqstars/qqiteminfo.h +++ b/src/qqstars/qqiteminfo.h @@ -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 queue_members;//储存群成员列表 QMap 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);//增加群成员 @@ -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