Commit 6456baa6 authored by Edric Milaret's avatar Edric Milaret

windows: disable call control when no current call

Refs #73662

Change-Id: I1f2ee3b953a806649f2c7d2e866c5313da4adb86
parent 9e12e886
......@@ -44,7 +44,7 @@ CallWidget::CallWidget(QWidget *parent) :
ui->muteSpeakerButton->setCheckable(true);
ui->callInvite->setVisible(false);
actualCall_ = nullptr;
setActualCall(nullptr);
videoRenderer_ = nullptr;
try {
......@@ -154,7 +154,7 @@ CallWidget::callIncoming(Call *call)
{
if (!call->account()->isAutoAnswer())
ui->callInvite->setVisible(true);
actualCall_ = call;
setActualCall(call);
}
void
......@@ -171,7 +171,7 @@ CallWidget::on_refuseButton_clicked()
if (actualCall_ == nullptr)
return;
actualCall_->performAction(Call::Action::REFUSE);
actualCall_ = nullptr;
setActualCall(nullptr);
ui->callInvite->setVisible(false);
}
......@@ -196,7 +196,7 @@ void
CallWidget::addedCall(Call* call, Call* parent) {
Q_UNUSED(parent);
if (call->direction() == Call::Direction::OUTGOING) {
actualCall_ = call;
setActualCall(call);
}
}
......@@ -207,8 +207,8 @@ CallWidget::callStateChanged(Call* call, Call::State previousState)
if (call == nullptr)
return;
ui->callList->setCurrentIndex(callModel_->getIndex(actualCall_));
if (call->state() == Call::State::OVER) {
actualCall_ = nullptr;
if (call->state() == Call::State::OVER || call->state() == Call::State::ERROR) {
setActualCall(nullptr);
ui->videoWidget->hide();
} else if (call->state() == Call::State::HOLD) {
ui->videoWidget->hide();
......@@ -230,7 +230,7 @@ CallWidget::on_callList_activated(const QModelIndex &index)
ui->videoWidget->hide();
actualCall_->performAction(Call::Action::HOLD);
}
actualCall_ = callSelected;
setActualCall(callSelected);
actualCall_->performAction(Call::Action::HOLD);
ui->videoWidget->show();
}
......@@ -300,7 +300,8 @@ CallWidget::on_contactView_doubleClicked(const QModelIndex &index)
}
}
void CallWidget::on_historyList_doubleClicked(const QModelIndex &index)
void
CallWidget::on_historyList_doubleClicked(const QModelIndex &index)
{
QString number = index.model()->data(index, static_cast<int>(Call::Role::Number)).toString();
if (not number.isEmpty()) {
......@@ -309,3 +310,11 @@ void CallWidget::on_historyList_doubleClicked(const QModelIndex &index)
outCall->performAction(Call::Action::ACCEPT);
}
}
void
CallWidget::setActualCall(Call* value)
{
actualCall_ = value;
ui->holdButton->setEnabled(actualCall_ != nullptr);
ui->hangupButton->setEnabled(actualCall_ != nullptr);
}
......@@ -81,6 +81,7 @@ private:
int outputVolume_;
int inputVolume_;
void findRingAccount();
void setActualCall(Call *value);
};
#endif // CALLWIDGET_H
......@@ -135,6 +135,9 @@
</item>
<item>
<widget class="QPushButton" name="holdButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Hold/Unhold</string>
</property>
......@@ -146,6 +149,9 @@
</item>
<item>
<widget class="QPushButton" name="hangupButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment