Esempio n. 1
0
void ChatForm::onCancelCallTriggered()
{
    qDebug() << "onCancelCallTriggered";

    enableCallButtons();

    hideNetcam();
    emit cancelCall(callId, f->getFriendID());
}
Esempio n. 2
0
void ChatForm::onCancelCallTriggered()
{
    qDebug() << "onCancelCallTriggered";

    if (!coreav->cancelCall(f->getFriendID()))
        qWarning() << "Failed to cancel a call! Assuming we're not in call";

    enableCallButtons();
    stopCounter();
    hideNetcam();
}
Esempio n. 3
0
void ChatForm::onAvMediaChange(uint32_t FriendId, int CallId, bool video)
{
    if (FriendId != f->getFriendID() || CallId != callId)
        return;

    qDebug() << "onAvMediaChange";

    if (video)
        showNetcam();
    else
        hideNetcam();
}
Esempio n. 4
0
void ChatForm::onAvEnd(uint32_t FriendId, int)
{
    if (FriendId != f->getFriendID())
        return;

    qDebug() << "onAvEnd";

    delete callConfirm;
    callConfirm = nullptr;

    enableCallButtons();
    stopCounter();
    hideNetcam();
}
Esempio n. 5
0
void ChatForm::onAvRejected(uint32_t FriendId, int)
{
    if (FriendId != f->getFriendID())
        return;

    qDebug() << "onAvRejected";

    delete callConfirm;
    callConfirm = nullptr;

    enableCallButtons();

    insertChatMessage(ChatMessage::createChatInfoMessage(tr("Call rejected"), ChatMessage::INFO, QDateTime::currentDateTime()));

    hideNetcam();
}
Esempio n. 6
0
void ChatForm::onHangupCallTriggered()
{
    qDebug() << "onHangupCallTriggered";

    //Fixes an OS X bug with ending a call while in full screen
    if (netcam && netcam->isFullScreen())
        netcam->showNormal();

    audioInputFlag = false;
    audioOutputFlag = false;
    coreav->cancelCall(f->getFriendID());

    stopCounter();
    enableCallButtons();
    hideNetcam();
}
Esempio n. 7
0
void ChatForm::onAvCancel(uint32_t FriendId, int)
{
    if (FriendId != f->getFriendID())
        return;

    qDebug() << "onAvCancel";

    delete callConfirm;
    callConfirm = nullptr;

    enableCallButtons();
    stopCounter();

    hideNetcam();

    addSystemInfoMessage(tr("%1 stopped calling").arg(f->getDisplayedName()), ChatMessage::INFO, QDateTime::currentDateTime());
}
Esempio n. 8
0
void ChatForm::onAvStart(uint32_t FriendId, bool video)
{
    if (FriendId != f->getFriendID())
        return;

    qDebug() << "onAvStart";

    audioInputFlag = true;
    audioOutputFlag = true;
    disableCallButtons();

    if (video)
    {
        videoButton->setObjectName("red");
        videoButton->setToolTip(tr("End video call"));
        videoButton->style()->polish(videoButton);
        connect(videoButton, SIGNAL(clicked()),
                this, SLOT(onHangupCallTriggered()));

        showNetcam();
    }
    else
    {
        callButton->setObjectName("red");
        callButton->setToolTip(tr("End audio call"));
        callButton->style()->polish(callButton);
        connect(callButton, SIGNAL(clicked()),
                this, SLOT(onHangupCallTriggered()));
        hideNetcam();
    }

    micButton->setObjectName("green");
    micButton->style()->polish(micButton);
    micButton->setToolTip(tr("Mute microphone"));
    volButton->setObjectName("green");
    volButton->style()->polish(volButton);
    volButton->setToolTip(tr("Mute call"));

    connect(micButton, SIGNAL(clicked()),
            this, SLOT(onMicMuteToggle()));
    connect(volButton, SIGNAL(clicked()),
            this, SLOT(onVolMuteToggle()));

    startCounter();
}
Esempio n. 9
0
void GroupChatForm::onCallClicked()
{
    if (!inCall)
    {
        Core::getInstance()->getAv()->joinGroupCall(group->getGroupId());
        audioInputFlag = true;
        audioOutputFlag = true;
        callButton->setObjectName("red");
        callButton->style()->polish(callButton);
        callButton->setToolTip(tr("End audio call"));
        micButton->setObjectName("green");
        micButton->style()->polish(micButton);
        micButton->setToolTip(tr("Mute microphone"));
        volButton->setObjectName("green");
        volButton->style()->polish(volButton);
        volButton->setToolTip(tr("Mute call"));
        inCall = true;
        showNetcam();
    }
    else
    {
        Core::getInstance()->getAv()->leaveGroupCall(group->getGroupId());
        audioInputFlag = false;
        audioOutputFlag = false;
        callButton->setObjectName("green");
        callButton->style()->polish(callButton);
        callButton->setToolTip(tr("Start audio call"));
        micButton->setObjectName("grey");
        micButton->style()->polish(micButton);
        micButton->setToolTip("");
        volButton->setObjectName("grey");
        volButton->style()->polish(volButton);
        volButton->setToolTip("");
        inCall = false;
        hideNetcam();
    }
}
Esempio n. 10
0
void ChatForm::onAnswerCallTriggered()
{
    qDebug() << "onAnswerCallTriggered";

    if (callConfirm)
    {
        delete callConfirm;
        callConfirm = nullptr;
    }

    Audio::getInstance().stopLoop();

    disableCallButtons();

    if (!coreav->answerCall(f->getFriendID()))
    {
        enableCallButtons();
        stopCounter();
        hideNetcam();
        return;
    }

    onAvStart(f->getFriendID(), coreav->isCallVideoEnabled(f->getFriendID()));
}
Esempio n. 11
0
void GroupChatForm::onUserListChanged()
{
    int peersCount = group->getPeersCount();
    if (peersCount == 1)
        nusersLabel->setText(tr("1 user in chat", "Number of users in chat"));
    else
        nusersLabel->setText(tr("%1 users in chat", "Number of users in chat").arg(peersCount));

    QLayoutItem *child;
    while ((child = namesListLayout->takeAt(0)))
    {
        child->widget()->hide();
        delete child->widget();
        delete child;
    }
    peerLabels.clear();

    // the list needs peers in peernumber order, nameLayout needs alphabetical
    QList<QLabel*> nickLabelList;

    // first traverse in peer number order, storing the QLabels as necessary
    QStringList names = group->getPeerList();
    unsigned nNames = names.size();
    for (unsigned i=0; i<nNames; ++i)
    {
        QString tooltip = correctNames(names[i]);
        peerLabels.append(new QLabel(names[i]));
        if (!tooltip.isEmpty())
            peerLabels[i]->setToolTip(tooltip);
        peerLabels[i]->setTextFormat(Qt::PlainText);
        nickLabelList.append(peerLabels[i]);
        if (group->isSelfPeerNumber(i))
            peerLabels[i]->setStyleSheet("QLabel {color : green;}");

        if (netcam && !group->isSelfPeerNumber(i))
            static_cast<GroupNetCamView*>(netcam)->addPeer(i, names[i]);
    }

    if (netcam)
        static_cast<GroupNetCamView*>(netcam)->clearPeers();

    // now alphabetize and add to layout
    qSort(nickLabelList.begin(), nickLabelList.end(), [](QLabel *a, QLabel *b){return a->text().toLower() < b->text().toLower();});
    for (unsigned i=0; i<nNames; ++i)
    {
        QLabel *label = nickLabelList.at(i);
        if (i != nNames - 1)
            label->setText(label->text() + ", ");

        namesListLayout->addWidget(label);
    }

    // Enable or disable call button
    if (peersCount > 1 && group->isAvGroupchat())
    {
        // don't set button to green if call running
        if(!inCall)
        {
            callButton->setEnabled(true);
            callButton->setObjectName("green");
            callButton->style()->polish(callButton);
            callButton->setToolTip(tr("Start audio call"));
        }
    }
    else
    {
        callButton->setEnabled(false);
        callButton->setObjectName("grey");
        callButton->style()->polish(callButton);
        callButton->setToolTip("");
        Core::getInstance()->getAv()->leaveGroupCall(group->getGroupId());
        hideNetcam();
    }
}