Exemple #1
0
GroupRequestDlg::GroupRequestDlg(const ShareQQMsgPtr msg, Contact *contact, Group *group, QWidget *parent) : QDialog(parent),
    ui_(new Ui::GroupRequestDlg)
{
	assert(group);

    ui_->setupUi(this);

	QQSystemGMsg *sysg_msg = (QQSystemGMsg *)msg.data();
    QString name;

    if (contact)
    {
        name = contact->name();
    }
    else
    {
        
		name = sysg_msg->talkTo();
    }
    ui_->lbl_request_name_->setText(name);
    ui_->lbl_group_name_->setText(group->name());

	if ( contact )
	{
		ui_->lbl_avatar_->setPixmap(contact->icon());
	}
    ui_->pte_msg_->appendPlainText(msg->msg());

    gid_ = msg->talkTo();
    id_ = msg->sendUin();

    connect(ui_->pb_ok_ , SIGNAL(clicked()), this, SLOT(slotOkClicked()));
    connect(ui_->pb_ignore_ , SIGNAL(clicked()), this, SLOT(slotIgnoreClicked()));
    connect(ui_->rb_deny_, SIGNAL(toggled(bool)), this, SLOT(slotToggleDenyReason(bool)));
}
Exemple #2
0
void ChatLogWin::showChatLog(QVector<ShareQQMsgPtr> &chat_logs)
{
    ui_->msgbrowse->clear();
    ShareQQMsgPtr msg;
    foreach (msg, chat_logs)
    {
        QQGroupChatMsg *chat_msg = static_cast<QQGroupChatMsg*>(msg.data());

        qint64 time = chat_msg->time();

        QDateTime date_time;
        date_time.setMSecsSinceEpoch(time * 1000);
        QString time_str = date_time.toString("dd ap hh:mm:ss");

        insertNameLine(convertor_->convert(chat_msg->sendUin()) + " " + time_str, Qt::blue);

        for (int i = 0; i < chat_msg->msg_.size(); ++i)
        {
            if (chat_msg->msg_[i].type() == QQChatItem::kQQFace)
            {
                insertQQFace(chat_msg->msg_[i].content());
            }
            else if (chat_msg->msg_[i].type() == QQChatItem::kWord)
                insertWord(chat_msg->msg_[i].content(), QFont(), Qt::black, 9);
            else
            {
                insertImg(chat_msg->msg_[i].content());
            }
        }
    }
Exemple #3
0
void RequestMsgProcessor::onNewSystemMsg(ShareQQMsgPtr msg)
{
    QString gid = 0;
    if ( msg->type() == QQMsg::kSystemG )
    {
        QQSystemGMsg *sysg_msg = (QQSystemGMsg *)msg.data();
        gid = sysg_msg->from_uin;
        if ( sysg_msg->sys_g_type == "group_leave" )
        {
            qDebug() << sysg_msg->sendUin() << "had leave group" << endl;
            return;
        }
    }
    Contact *contact = Roster::instance()->contact(msg->sendUin());
    if ( !contact )
    {
        StrangerManager *mgr = StrangerManager::instance();
        contact = mgr->strangerInfo(msg->sendUin());
    }

    if ( !contact )
    {
        connect(StrangerManager::instance(), SIGNAL(newStrangerInfo(QString, Contact *)), this, SLOT(onNewStrangerInfo(QString, Contact *)));
        connect(StrangerManager::instance(), SIGNAL(newStrangerIcon(QString, QPixmap)), this, SLOT(onNewStrangerIcon(QString, QPixmap)));
    }
Exemple #4
0
void NotifierPlugin::onNewChatMsg(ShareQQMsgPtr msg)
{
    Notification notification;
    Talkable *talkable = NULL;
    QString sender_id;
    if ( msg->type() == QQMsg::kSess )
    {
        sender_id = msg->sendUin();
        talkable = StrangerManager::instance()->stranger(sender_id);
    }
    else
    {
        sender_id = msg->talkTo();
        talkable = Roster::instance()->talkable(sender_id);
        if ( !talkable )
            talkable = StrangerManager::instance()->stranger(sender_id);
    }

    QString sender_name = talkable ?  talkable->markname() : sender_id;
    notification.title = sender_name + tr(" has new message");  
    notification.icon = talkable ? talkable->avatar() : QPixmap();
    notification.content = msg->msg();
    notification.ms_timeout = 5000;

    switch ( msg->type() )
    {
        case QQMsg::kFriend:
            notification.type = NFT_Chat;
            break;
        case QQMsg::kGroup:
            notification.type = NFT_GroupChat;
            break;
        case QQMsg::kSess:
            notification.type = NFT_SessChat;
            break;
    }
    NotifyWidget *w = new NotifyWidget(notification);
    w->appear();
}
Exemple #5
0
void ChatMsgProcessor::onNewChatMsg(ShareQQMsgPtr msg)
{
    QQMsgListener *listener = listenerById(msg->talkTo());

    if ( listener )
    {
        listener->showMsg(msg);
    }
    else
    {
        old_msgs_.push_back(msg);
        createTrayNotify(msg);

        ChatDlgManager *chatdlg_mgr = ChatDlgManager::instance();
        if ( chatdlg_mgr->isOpening(msg->talkTo()) )
        {
            chatdlg_mgr->notifyDlgById(msg->talkTo());
        }

        SoundPlayer::singleton()->play(SoundPlayer::kMsg);
    }
}