Skip to content
Snippets Groups Projects
Commit 6456baa6 authored by Edric Milaret's avatar Edric Milaret
Browse files

windows: disable call control when no current call

Refs #73662

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