Exemplo n.º 1
0
///The item have to be updated
void HistoryTreeItem::updated()
{
   if (!getContactInfo(m_pItemCall->getPeerPhoneNumber()),true) {
      if(! m_pItemCall->getPeerName().trimmed().isEmpty()) {
         m_pPeerNameL->setText("<b>"+m_pItemCall->getPeerName()+"</b>");
      }
   }
   call_state state = m_pItemCall->getState();
   bool recording = m_pItemCall->getRecording();
   if(state != CALL_STATE_OVER) {
      if(state == CALL_STATE_CURRENT && recording) {
         m_pIconL->setPixmap(QPixmap(ICON_CURRENT_REC));
      }
      else {
         QString str = QString(callStateIcons[state]);
         m_pIconL->setPixmap(QPixmap(str));
      }
      m_pCallNumberL->setText(m_pItemCall->getPeerPhoneNumber());

      if(state == CALL_STATE_DIALING) {
         m_pCallNumberL->setText(m_pItemCall->getCallNumber());
      }
   }

}
Exemplo n.º 2
0
void LinkDoodService::sendMessage(Msg msg)
{

    qDebug() << Q_FUNC_INFO << "msg.msgid = " << msg.msgid;
    qDebug() << Q_FUNC_INFO << "msg.body = " << msg.body;
    qDebug() << Q_FUNC_INFO << "msg.msgtype = " << msg.msgtype;
    qDebug() << Q_FUNC_INFO << "msg.targetid = " << msg.targetid;
    qDebug() << Q_FUNC_INFO << "msg.fromid = " << msg.fromid;
    qDebug() << Q_FUNC_INFO << "msg.time = " << msg.time;
    getContactInfo(msg.targetid,msg);
//    if(m_pChatObserver != NULL){
//            m_pChatObserver->sendMessage(msg);
//    }
}
Exemplo n.º 3
0
void ChatControler::onMessageNotice(std::shared_ptr<service::Msg> msg)
{
    qDebug() << Q_FUNC_INFO ;

    if(msg->msgtype == 2)
    {
       qDebug() << Q_FUNC_INFO << "adaFZSDZDFGDFGfdxggxgf:" << msg->time;
       if(msg->time == 0){
           msg->time = QDateTime::currentDateTime().toMSecsSinceEpoch();
       }
       std::shared_ptr<service::MsgText> msgText = std::dynamic_pointer_cast<service::MsgText>(msg);
       Msg imMsg = msgtextToQmsgtext(msgText);
        qDebug() << Q_FUNC_INFO << "messageNotice:"<< imMsg.body;
       QString sessionId("");
       if(!getCurrentSessionId(sessionId)){
           emit chatMessageNotice(imMsg);
       }
       qDebug() << Q_FUNC_INFO << "SessionId:" << sessionId << "Time:" << imMsg.time;
       getContactInfo(imMsg.fromid,imMsg);
    }

}
Exemplo n.º 4
0
///Constructor
HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone)
   : QWidget(parent), m_pItemCall(0),m_pMenu(0),m_pAudioSlider(0),m_pTimeLeftL(0),m_pTimePlayedL(0),m_pPlayer(0),m_pContact(0)
{
   setContextMenuPolicy(Qt::CustomContextMenu);

   m_pCallAgain    = new KAction(this);
   m_pAddContact   = new KAction(this);
   m_pCopy         = new KAction(this);
   m_pEmail        = new KAction(this);
   m_pAddToContact = new KAction(this);
   m_pBookmark     = new KAction(this);

   m_pCallAgain->setShortcut    ( Qt::Key_Enter       );
   m_pCallAgain->setText        ( i18n("Call Again")             );
   m_pCallAgain->setIcon        ( KIcon(ICON_DIALING)            );

   m_pAddToContact->setShortcut ( Qt::CTRL + Qt::Key_E           );
   m_pAddToContact->setText     ( i18n("Add Number to Contact")  );
   m_pAddToContact->setIcon     ( KIcon("list-resource-add")     );
   m_pAddToContact->setDisabled ( true                           );

   m_pAddContact->setShortcut   ( Qt::CTRL + Qt::Key_E           );
   m_pAddContact->setText       ( i18n("Add Contact")            );
   m_pAddContact->setIcon       ( KIcon("contact-new")           );

   m_pCopy->setShortcut         ( Qt::CTRL + Qt::Key_C           );
   m_pCopy->setText             ( i18n("Copy")                   );
   m_pCopy->setIcon             ( KIcon("edit-copy")             );
   m_pCopy->setDisabled         ( true                           );

   m_pEmail->setShortcut        ( Qt::CTRL + Qt::Key_M           );
   m_pEmail->setText            ( i18n("Send Email")             );
   m_pEmail->setIcon            ( KIcon("mail-message-new")      );
   m_pEmail->setDisabled        ( true                           );

   m_pBookmark->setShortcut     ( Qt::CTRL + Qt::Key_D           );
   m_pBookmark->setText         ( i18n("Bookmark")               );
   m_pBookmark->setIcon         ( KIcon("bookmarks")             );

   m_pPlay = new QToolButton(this);

   m_pPlay->setIcon(KIcon("media-playback-start"));
   m_pPlay->setMinimumSize(30,30);
   m_pPlay->setMaximumSize(30,30);
   m_pPlay->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
   m_pPlay->setVisible(false);

   m_pRemove =  new QToolButton(this);
   m_pRemove->setIcon(KIcon("list-remove"));
   m_pRemove->setMinimumSize(30,30);
   m_pRemove->setMaximumSize(30,30);
   m_pRemove->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
   m_pRemove->setVisible(false);

   connect(m_pCallAgain    , SIGNAL(triggered())                        , this , SLOT(callAgain()         ));
   connect(m_pAddContact   , SIGNAL(triggered())                        , this , SLOT(addContact()        ));
   connect(m_pCopy         , SIGNAL(triggered())                        , this , SLOT(copy()              ));
   connect(m_pEmail        , SIGNAL(triggered())                        , this , SLOT(sendEmail()         ));
   connect(m_pAddToContact , SIGNAL(triggered())                        , this , SLOT(addToContact()      ));
   connect(m_pBookmark     , SIGNAL(triggered())                        , this , SLOT(bookmark()          ));
   connect(m_pPlay         , SIGNAL(clicked()  )                        , this , SLOT(showRecordPlayer()  ));
   connect(m_pRemove       , SIGNAL(clicked()  )                        , this , SLOT(removeRecording()   ));
   connect(this            , SIGNAL(customContextMenuRequested(QPoint)) , this , SLOT(showContext(QPoint) ));

   m_pIconL         = new QLabel( this );
   m_pPeerNameL     = new QLabel( this );
   m_pCallNumberL   = new QLabel( this );
   m_pLengthL     = new QLabel( this );
   m_pTimeL         = new QLabel( this );

   m_pIconL->setMinimumSize(70,0);
   m_pIconL->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::MinimumExpanding);
   QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);

   m_pMainLayout = new QGridLayout(this);
   m_pMainLayout->addWidget ( m_pIconL       , 0 , 0 , 4 , 1 );
   m_pMainLayout->addWidget ( m_pPeerNameL   , 0 , 1         );
   m_pMainLayout->addWidget ( m_pCallNumberL , 1 , 1         );
   m_pMainLayout->addWidget ( m_pTimeL       , 2 , 1         );
   m_pMainLayout->addItem   ( verticalSpacer , 4 , 1         );
   m_pMainLayout->addWidget ( m_pPlay        , 0 , 2 , 4 , 1 );
   m_pMainLayout->addWidget ( m_pRemove      , 0 , 3 , 4 , 1 );
   m_pMainLayout->addWidget ( m_pLengthL   , 0 , 4 , 4 , 1 );
   setLayout(m_pMainLayout);
   setMinimumSize(QSize(50, 30));
   setMaximumSize(QSize(300,99999));
   setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));

   if (!phone.isEmpty()) {
      getContactInfo(phone);
      m_pCallNumberL->setText(phone);
      m_PhoneNumber = phone;
   }
}
Exemplo n.º 5
0
    ContactWidget::ContactWidget(QWidget* _parent, std::shared_ptr<Logic::contact_profile> _profile, const std::map<QString, QString>& _countries)
        :QWidget(_parent),
        profile_(_profile),
        name_(new TextEmojiWidget(this, Fonts::appFontScaled(18), CommonStyle::getColor(CommonStyle::Color::TEXT_PRIMARY))),
        info_(new TextEmojiWidget(this, Fonts::appFontScaled(14), CommonStyle::getColor(CommonStyle::Color::TEXT_SECONDARY))),
        addButton_(new QPushButton(this)),
        callButton_(new QPushButton(this)),
        msgButton_(new QPushButton(this))
    {
        Utils::grabTouchWidget(this);

        setFixedSize(Utils::scale_value(widget_width), Utils::scale_value(widget_height));

        QHBoxLayout* rootLayout = Utils::emptyHLayout();
        rootLayout->setAlignment(Qt::AlignLeft);

        const QString displayName = _profile->get_contact_name();

        auto avatarWidget = new ContactAvatarWidget(
            this,
            _profile->get_aimid(),
            displayName,
            Utils::scale_value(widget_height),
            false);

        avatarWidget->setCursor(QCursor(Qt::PointingHandCursor));

        rootLayout->addWidget(avatarWidget);

        Utils::grabTouchWidget(avatarWidget);

        QVBoxLayout* infoLayout = Utils::emptyVLayout();
        infoLayout->setContentsMargins(Utils::scale_value(12), 0, 0, 0);
        infoLayout->setAlignment(Qt::AlignTop);

        name_->setObjectName(qsl("contact_name"));
        name_->setFading(true);
        name_->setText(_profile->get_contact_name());
        infoLayout->addWidget(name_);
        Utils::grabTouchWidget(name_);

        info_->setObjectName(qsl("contact_info"));
        info_->setText(getContactInfo(_profile, _countries));
        infoLayout->addWidget(info_);
        Utils::grabTouchWidget(info_);

        QHBoxLayout* buttonsLayout = new QHBoxLayout();
        buttonsLayout->setSpacing(Utils::scale_value(12));
        buttonsLayout->setAlignment(Qt::AlignLeft);

        Logic::ContactItem* contactItem = Logic::getContactListModel()->getContactItem(profile_->get_aimid());

        addButton_->setObjectName(qsl("add_contact_button"));
        addButton_->setVisible(!contactItem);
        addButton_->setCursor(QCursor(Qt::PointingHandCursor));
        buttonsLayout->addWidget(addButton_);
        Utils::grabTouchWidget(addButton_);

        msgButton_->setVisible(!!contactItem);
        msgButton_->setObjectName(qsl("msg_contact_button"));
        msgButton_->setCursor(QCursor(Qt::PointingHandCursor));
        buttonsLayout->addWidget(msgButton_);
        Utils::grabTouchWidget(msgButton_);

        callButton_->setVisible(!!contactItem);
        callButton_->setObjectName("call_contact_button");
        callButton_->setCursor(QCursor(Qt::PointingHandCursor));
        buttonsLayout->addWidget(callButton_);
        Utils::grabTouchWidget(callButton_);

        infoLayout->addLayout(buttonsLayout);

        rootLayout->addLayout(infoLayout);

        setLayout(rootLayout);

        connect(addButton_, &QPushButton::clicked, [this]()
        {
            emit addContact(profile_->get_aimid());
        });

        connect(msgButton_, &QPushButton::clicked, [this]()
        {
            emit msgContact(profile_->get_aimid());
        });

        connect(callButton_, &QPushButton::clicked, [this]()
        {
            emit callContact(profile_->get_aimid());
        });

        connect(avatarWidget, &ContactAvatarWidget::clickedInternal, [this]()
        {
            emit contactInfo(profile_->get_aimid());
        });
    }