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