mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 14:55:43 +02:00
calladapter: redesign for the call duration timer
Change-Id: Ie49de27f78d0f28df61c77041686957e3fcce838
This commit is contained in:
parent
9d0f84d8be
commit
460c6203de
5 changed files with 39 additions and 57 deletions
|
@ -33,7 +33,6 @@
|
||||||
|
|
||||||
CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject* parent)
|
CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject* parent)
|
||||||
: QmlAdapterBase(instance, parent)
|
: QmlAdapterBase(instance, parent)
|
||||||
, oneSecondTimer_(new QTimer(this))
|
|
||||||
, systemTray_(systemTray)
|
, systemTray_(systemTray)
|
||||||
{
|
{
|
||||||
accountId_ = lrcInstance_->getCurrentAccountId();
|
accountId_ = lrcInstance_->getCurrentAccountId();
|
||||||
|
@ -91,10 +90,6 @@ CallAdapter::onCallStatusChanged(const QString& accountId, const QString& callId
|
||||||
{
|
{
|
||||||
set_hasCall(lrcInstance_->hasActiveCall());
|
set_hasCall(lrcInstance_->hasActiveCall());
|
||||||
|
|
||||||
// :/ one timer for all the call overlays
|
|
||||||
if (!hasCall_)
|
|
||||||
oneSecondTimer_->stop();
|
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
|
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
|
||||||
auto& callModel = accInfo.callModel;
|
auto& callModel = accInfo.callModel;
|
||||||
|
@ -437,13 +432,6 @@ CallAdapter::connectCallModel(const QString& accountId)
|
||||||
{
|
{
|
||||||
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
|
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
|
||||||
|
|
||||||
QObject::connect(
|
|
||||||
oneSecondTimer_,
|
|
||||||
&QTimer::timeout,
|
|
||||||
this,
|
|
||||||
[this] { setTime(accountId_, convUid_); },
|
|
||||||
Qt::UniqueConnection);
|
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
accInfo.callModel.get(),
|
accInfo.callModel.get(),
|
||||||
&lrc::api::NewCallModel::onParticipantsChanged,
|
&lrc::api::NewCallModel::onParticipantsChanged,
|
||||||
|
@ -596,8 +584,6 @@ CallAdapter::sipInputPanelPlayDTMF(const QString& key)
|
||||||
void
|
void
|
||||||
CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
|
CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
|
||||||
{
|
{
|
||||||
setTime(accountId_, convUid_);
|
|
||||||
oneSecondTimer_->start(1000);
|
|
||||||
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId_);
|
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId_);
|
||||||
|
|
||||||
auto* call = lrcInstance_->getCallInfoForConversation(convInfo);
|
auto* call = lrcInstance_->getCallInfoForConversation(convInfo);
|
||||||
|
@ -952,19 +938,20 @@ CallAdapter::videoPauseThisCallToggle()
|
||||||
Q_EMIT previewVisibilityNeedToChange(shouldShowPreview(false));
|
Q_EMIT previewVisibilityNeedToChange(shouldShowPreview(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
QString
|
||||||
CallAdapter::setTime(const QString& accountId, const QString& convUid)
|
CallAdapter::getCallDurationTime(const QString& accountId, const QString& convUid)
|
||||||
{
|
{
|
||||||
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid, accountId);
|
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid, accountId);
|
||||||
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
|
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
|
||||||
return;
|
return QString();
|
||||||
}
|
}
|
||||||
const auto callInfo = lrcInstance_->getCurrentCallModel()->getCall(callId);
|
const auto callInfo = lrcInstance_->getCurrentCallModel()->getCall(callId);
|
||||||
if (callInfo.status == lrc::api::call::Status::IN_PROGRESS
|
if (callInfo.status == lrc::api::call::Status::IN_PROGRESS
|
||||||
|| callInfo.status == lrc::api::call::Status::PAUSED) {
|
|| callInfo.status == lrc::api::call::Status::PAUSED) {
|
||||||
auto timeString = lrcInstance_->getCurrentCallModel()->getFormattedCallDuration(callId);
|
return lrcInstance_->getCurrentCallModel()->getFormattedCallDuration(callId);
|
||||||
Q_EMIT updateTimeText(timeString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -77,6 +77,7 @@ public:
|
||||||
Q_INVOKABLE void updateCall(const QString& convUid = {},
|
Q_INVOKABLE void updateCall(const QString& convUid = {},
|
||||||
const QString& accountId = {},
|
const QString& accountId = {},
|
||||||
bool forceCallOnly = false);
|
bool forceCallOnly = false);
|
||||||
|
Q_INVOKABLE QString getCallDurationTime(const QString& accountId, const QString& convUid);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void callStatusChanged(int index, const QString& accountId, const QString& convUid);
|
void callStatusChanged(int index, const QString& accountId, const QString& convUid);
|
||||||
|
@ -115,8 +116,6 @@ private:
|
||||||
|
|
||||||
// For Call Overlay
|
// For Call Overlay
|
||||||
void updateCallOverlay(const lrc::api::conversation::Info& convInfo);
|
void updateCallOverlay(const lrc::api::conversation::Info& convInfo);
|
||||||
void setTime(const QString& accountId, const QString& convUid);
|
|
||||||
QTimer* oneSecondTimer_;
|
|
||||||
ScreenSaver screenSaver;
|
ScreenSaver screenSaver;
|
||||||
|
|
||||||
void preventScreenSaver(bool state);
|
void preventScreenSaver(bool state);
|
||||||
|
|
|
@ -113,11 +113,6 @@ Rectangle {
|
||||||
Connections {
|
Connections {
|
||||||
target: CallAdapter
|
target: CallAdapter
|
||||||
|
|
||||||
function onUpdateTimeText(time) {
|
|
||||||
audioCallOverlay.timeText = time
|
|
||||||
audioCallOverlay.setRecording(CallAdapter.isRecordingThisCall())
|
|
||||||
}
|
|
||||||
|
|
||||||
function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted, isRecording, isSIP, isConferenceCall, bestName) {
|
function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted, isRecording, isSIP, isConferenceCall, bestName) {
|
||||||
audioCallOverlay.showOnHoldImage(isPaused)
|
audioCallOverlay.showOnHoldImage(isPaused)
|
||||||
audioCallPageRectCentralRect.visible = !isPaused
|
audioCallPageRectCentralRect.visible = !isPaused
|
||||||
|
|
|
@ -34,7 +34,7 @@ import "../js/pluginhandlerpickercreation.js" as PluginHandlerPickerCreation
|
||||||
import "../../commoncomponents"
|
import "../../commoncomponents"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: callOverlayRect
|
id: root
|
||||||
|
|
||||||
property string timeText: "00:00"
|
property string timeText: "00:00"
|
||||||
property string remoteRecordingLabel: ""
|
property string remoteRecordingLabel: ""
|
||||||
|
@ -216,8 +216,8 @@ Rectangle {
|
||||||
SipInputPanel {
|
SipInputPanel {
|
||||||
id: sipInputPanel
|
id: sipInputPanel
|
||||||
|
|
||||||
x: callOverlayRect.width / 2 - sipInputPanel.width / 2
|
x: root.width / 2 - sipInputPanel.width / 2
|
||||||
y: callOverlayRect.height / 2 - sipInputPanel.height / 2
|
y: root.height / 2 - sipInputPanel.height / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer to decide when overlay fade out.
|
// Timer to decide when overlay fade out.
|
||||||
|
@ -227,20 +227,25 @@ Rectangle {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (overlayUpperPartRect.state !== 'freezed') {
|
if (overlayUpperPartRect.state !== 'freezed') {
|
||||||
overlayUpperPartRect.state = 'freezed'
|
overlayUpperPartRect.state = 'freezed'
|
||||||
resetRecordingLabelTimer.restart()
|
resetLabelsTimer.restart()
|
||||||
}
|
}
|
||||||
if (callOverlayButtonGroup.state !== 'freezed') {
|
if (callOverlayButtonGroup.state !== 'freezed') {
|
||||||
callOverlayButtonGroup.state = 'freezed'
|
callOverlayButtonGroup.state = 'freezed'
|
||||||
resetRecordingLabelTimer.restart()
|
resetLabelsTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer to reset recording label text
|
// Timer to reset recording label and call duration time
|
||||||
Timer {
|
Timer {
|
||||||
id: resetRecordingLabelTimer
|
id: resetLabelsTimer
|
||||||
|
|
||||||
interval: 1000
|
interval: 1000
|
||||||
|
running: root.visible
|
||||||
|
repeat: true
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
timeText = CallAdapter.getCallDurationTime(LRCInstance.currentAccountId,
|
||||||
|
LRCInstance.selectedConvUid)
|
||||||
if (callOverlayButtonGroup.state === 'freezed'
|
if (callOverlayButtonGroup.state === 'freezed'
|
||||||
&& !callViewContextMenu.peerIsRecording)
|
&& !callViewContextMenu.peerIsRecording)
|
||||||
remoteRecordingLabel = ""
|
remoteRecordingLabel = ""
|
||||||
|
@ -250,9 +255,9 @@ Rectangle {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: overlayUpperPartRect
|
id: overlayUpperPartRect
|
||||||
|
|
||||||
anchors.top: callOverlayRect.top
|
anchors.top: root.top
|
||||||
|
|
||||||
width: callOverlayRect.width
|
width: root.width
|
||||||
height: 50
|
height: 50
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
|
@ -370,8 +375,8 @@ Rectangle {
|
||||||
ResponsiveImage {
|
ResponsiveImage {
|
||||||
id: onHoldImage
|
id: onHoldImage
|
||||||
|
|
||||||
anchors.verticalCenter: callOverlayRect.verticalCenter
|
anchors.verticalCenter: root.verticalCenter
|
||||||
anchors.horizontalCenter: callOverlayRect.horizontalCenter
|
anchors.horizontalCenter: root.horizontalCenter
|
||||||
|
|
||||||
width: 200
|
width: 200
|
||||||
height: 200
|
height: 200
|
||||||
|
@ -384,23 +389,23 @@ Rectangle {
|
||||||
CallOverlayButtonGroup {
|
CallOverlayButtonGroup {
|
||||||
id: callOverlayButtonGroup
|
id: callOverlayButtonGroup
|
||||||
|
|
||||||
anchors.bottom: callOverlayRect.bottom
|
anchors.bottom: root.bottom
|
||||||
anchors.bottomMargin: 10
|
anchors.bottomMargin: 10
|
||||||
anchors.horizontalCenter: callOverlayRect.horizontalCenter
|
anchors.horizontalCenter: root.horizontalCenter
|
||||||
|
|
||||||
height: 56
|
height: 56
|
||||||
width: callOverlayRect.width
|
width: root.width
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
onChatButtonClicked: {
|
onChatButtonClicked: {
|
||||||
callOverlayRect.overlayChatButtonClicked()
|
root.overlayChatButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
onAddToConferenceButtonClicked: {
|
onAddToConferenceButtonClicked: {
|
||||||
// Create contact picker - conference.
|
// Create contact picker - conference.
|
||||||
ContactPickerCreation.createContactPickerObjects(
|
ContactPickerCreation.createContactPickerObjects(
|
||||||
ContactList.CONFERENCE,
|
ContactList.CONFERENCE,
|
||||||
callOverlayRect)
|
root)
|
||||||
ContactPickerCreation.openContactPicker()
|
ContactPickerCreation.openContactPicker()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,10 +439,10 @@ Rectangle {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: callOverlayButtonGroupLeftSideMouseArea
|
id: callOverlayButtonGroupLeftSideMouseArea
|
||||||
|
|
||||||
anchors.bottom: callOverlayRect.bottom
|
anchors.bottom: root.bottom
|
||||||
anchors.left: callOverlayRect.left
|
anchors.left: root.left
|
||||||
|
|
||||||
width: callOverlayRect.width / 6
|
width: root.width / 6
|
||||||
height: 60
|
height: 60
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
@ -456,10 +461,10 @@ Rectangle {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: callOverlayButtonGroupRightSideMouseArea
|
id: callOverlayButtonGroupRightSideMouseArea
|
||||||
|
|
||||||
anchors.bottom: callOverlayRect.bottom
|
anchors.bottom: root.bottom
|
||||||
anchors.right: callOverlayRect.right
|
anchors.right: root.right
|
||||||
|
|
||||||
width: callOverlayRect.width / 6
|
width: root.width / 6
|
||||||
height: 60
|
height: 60
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
@ -478,10 +483,10 @@ Rectangle {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: callOverlayRectMouseArea
|
id: callOverlayRectMouseArea
|
||||||
|
|
||||||
anchors.top: callOverlayRect.top
|
anchors.top: root.top
|
||||||
|
|
||||||
width: callOverlayRect.width
|
width: root.width
|
||||||
height: callOverlayRect.height
|
height: root.height
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
|
@ -518,13 +523,13 @@ Rectangle {
|
||||||
// Create contact picker - sip transfer.
|
// Create contact picker - sip transfer.
|
||||||
ContactPickerCreation.createContactPickerObjects(
|
ContactPickerCreation.createContactPickerObjects(
|
||||||
ContactList.TRANSFER,
|
ContactList.TRANSFER,
|
||||||
callOverlayRect)
|
root)
|
||||||
ContactPickerCreation.openContactPicker()
|
ContactPickerCreation.openContactPicker()
|
||||||
}
|
}
|
||||||
|
|
||||||
onPluginItemClicked: {
|
onPluginItemClicked: {
|
||||||
// Create plugin handler picker - PLUGINS
|
// Create plugin handler picker - PLUGINS
|
||||||
PluginHandlerPickerCreation.createPluginHandlerPickerObjects(callOverlayRect, true)
|
PluginHandlerPickerCreation.createPluginHandlerPickerObjects(root, true)
|
||||||
PluginHandlerPickerCreation.openPluginHandlerPicker()
|
PluginHandlerPickerCreation.openPluginHandlerPicker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,10 +177,6 @@ Rectangle {
|
||||||
Connections {
|
Connections {
|
||||||
target: CallAdapter
|
target: CallAdapter
|
||||||
|
|
||||||
function onUpdateTimeText(time) {
|
|
||||||
videoCallOverlay.timeText = time
|
|
||||||
}
|
|
||||||
|
|
||||||
function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted,
|
function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted,
|
||||||
isRecording, isSIP, isConferenceCall, bestName) {
|
isRecording, isSIP, isConferenceCall, bestName) {
|
||||||
videoCallOverlay.showOnHoldImage(isPaused)
|
videoCallOverlay.showOnHoldImage(isPaused)
|
||||||
|
|
Loading…
Add table
Reference in a new issue