Commit 1004caa8 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

fix: ui call view

This patch fix the problems:
- exit full screen mode when call is finished
- clean up last video picture when call is finished
- hide call options if no mouse activity detected
- resize video to use full screen

Change-Id: I7544dd616e88e35cacf3ca8c60d65aedbfe14860
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 557f5eac
......@@ -177,6 +177,8 @@
[loadingIndicator setInnerMargin:30];
[self.videoView setCallDelegate:self];
CGColor* color = [[[NSColor blackColor] colorWithAlphaComponent:0.2] CGColor];
[headerContainer.layer setBackgroundColor:color];
}
-(void) updateDurationLabel
......@@ -217,7 +219,6 @@
if (convIt != accountInfo_->conversationModel->allFilteredConversations().end())
[personLabel setStringValue:bestNameForConversation(*convIt, *accountInfo_->conversationModel)];
[timeSpentLabel setStringValue:@(callModel->getFormattedCallDuration(callUid_).c_str())];
[timeSpentLabel setHidden:NO];
if (refreshDurationTimer == nil)
refreshDurationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
......@@ -227,13 +228,12 @@
[stateLabel setStringValue:@(to_string(currentCall.status).c_str())];
if (firstRun) {
//QVariant photo = GlobalInstances::pixmapManipulator().callPhoto(current, QSize(100,100));
// QVariant photo = GlobalInstances::pixmapManipulator().callPhoto(currentCall, QSize(100,100), NO);
//[personPhoto setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(photo))];
}
// Default values for this views
[loadingIndicator setHidden:YES];
[videoView setShouldAcceptInteractions:NO];
[ringingPanel setHidden:YES];
[outgoingPanel setHidden:YES];
[controlsPanel setHidden:NO];
......@@ -263,6 +263,7 @@
case Status::PEER_PAUSED:
case Status::INACTIVE:
case Status::IN_PROGRESS:
[timeSpentLabel setHidden:NO];
case Status::CONNECTED:
case Status::AUTO_ANSWERING:
break;
......@@ -350,6 +351,8 @@
&lrc::api::NewCallModel::remotePreviewStarted,
[self](const std::string& callId, Video::Renderer* renderer) {
NSLog(@"Video started!");
[videoView setShouldAcceptInteractions:YES];
[self mouseIsMoving: NO];
[self connectVideoRenderer:renderer];
});
......@@ -413,6 +416,8 @@
videoHolder.started = QObject::connect(renderer,
&Video::Renderer::started,
[=]() {
[self mouseIsMoving: NO];
[videoView setShouldAcceptInteractions:YES];
QObject::disconnect(videoHolder.frameUpdated);
videoHolder.frameUpdated = QObject::connect(renderer,
&Video::Renderer::frameUpdated,
......@@ -424,6 +429,8 @@
videoHolder.stopped = QObject::connect(renderer,
&Video::Renderer::stopped,
[=]() {
[self mouseIsMoving: YES];
[videoView setShouldAcceptInteractions:NO];
QObject::disconnect(videoHolder.frameUpdated);
[(CallLayer*)videoView.layer setVideoRunning:NO];
});
......@@ -516,6 +523,7 @@
QObject::disconnect(previewHolder.started);
QObject::disconnect(self.messageConnection);
[previewView.layer setContents:nil];
[(CallLayer*)videoView.layer setVideoRunning:NO];
[_brokerPopoverVC performClose:self];
[self.addToContactPopover performClose:self];
......@@ -546,7 +554,8 @@
auto* convModel = accountInfo_->conversationModel.get();
// when call comes in we want to show the controls/header
[self mouseIsMoving:YES];
[self mouseIsMoving: YES];
[videoView setShouldAcceptInteractions: NO];
[self connectVideoSignals];
/* check if text media is already present */
......@@ -604,6 +613,7 @@
}
if (!animate) {
[self cleanUp];
[self.view setHidden:YES];
return;
}
......
......@@ -180,10 +180,21 @@ NSLock* currentFrameLk;
GLint inScalingUniform = glGetUniformLocation(sProg, "in_Scaling");
if (ratio < 1.0)
glUniform2f(inScalingUniform, 1.0, ratio);
else
glUniform2f(inScalingUniform, 1.0/ratio, 1.0);
float multiplier = MAX(frameRatio, ratio);
if((viewRatio >= 1 && frameRatio >= 1) ||
(viewRatio < 1 && frameRatio < 1) ||
(ratio > 0.5 && ratio < 1.5) ) {
if (ratio > 1.0)
glUniform2f(inScalingUniform, 1.0, 1.0 * ratio);
else
glUniform2f(inScalingUniform, 1.0/ratio, 1.0);
} else {
if (ratio < 1.0)
glUniform2f(inScalingUniform, 1.0, 1.0 * ratio);
else
glUniform2f(inScalingUniform, 1.0/ratio, 1.0);
}
}
[currentFrameLk unlock];
......
......@@ -201,10 +201,10 @@
- (void)mouseMoved:(NSEvent *)theEvent
{
[NSObject cancelPreviousPerformRequestsWithTarget:self]; // cancel showContextualMenu
[self performSelector:@selector(mouseIdle:) withObject:theEvent afterDelay:3];
if (self.callDelegate)
[self.callDelegate mouseIsMoving:YES];
[NSObject cancelPreviousPerformRequestsWithTarget:self]; // cancel showContextualMenu
[self performSelector:@selector(mouseIdle:) withObject:theEvent afterDelay:3];
if (self.callDelegate && shouldAcceptInteractions)
[self.callDelegate mouseIsMoving:YES];
}
- (void) mouseIdle:(NSEvent *)theEvent
......@@ -225,8 +225,9 @@
else if([theEvent clickCount] == 2)
{
[NSObject cancelPreviousPerformRequestsWithTarget:self]; // cancel showContextualMenu
if(self.callDelegate)
if(self.callDelegate) {
[self.callDelegate callShouldToggleFullScreen];
}
}
}
......
......@@ -55,10 +55,10 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="d0X-cW-Xgz">
<rect key="frame" x="20" y="438" width="705" height="71"/>
<rect key="frame" x="0.0" y="438" width="745" height="71"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cIU-M7-xpN">
<rect key="frame" x="583" y="23" width="104" height="24"/>
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cIU-M7-xpN">
<rect key="frame" x="623" y="23" width="104" height="24"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="9vz-kb-6L6"/>
</constraints>
......@@ -653,13 +653,13 @@
<constraint firstAttribute="bottom" secondItem="Eoi-B8-iL6" secondAttribute="bottom" constant="20" id="9j2-HZ-hNX"/>
<constraint firstItem="MNG-eU-B2N" firstAttribute="centerX" secondItem="2wf-Py-l6B" secondAttribute="centerX" id="DbU-cn-glx"/>
<constraint firstItem="W4l-Be-bhM" firstAttribute="centerY" secondItem="2wf-Py-l6B" secondAttribute="centerY" id="De3-8O-mXx"/>
<constraint firstAttribute="trailing" secondItem="d0X-cW-Xgz" secondAttribute="trailing" constant="20" id="G79-Jv-EYw"/>
<constraint firstAttribute="trailing" secondItem="d0X-cW-Xgz" secondAttribute="trailing" id="G79-Jv-EYw"/>
<constraint firstAttribute="bottom" secondItem="6y6-RH-qOp" secondAttribute="bottom" constant="20" id="HOt-7O-FU2"/>
<constraint firstAttribute="trailing" secondItem="6y6-RH-qOp" secondAttribute="trailing" constant="20" id="KTx-SN-RUg"/>
<constraint firstItem="d0X-cW-Xgz" firstAttribute="top" secondItem="2wf-Py-l6B" secondAttribute="top" id="MKB-zm-C75"/>
<constraint firstAttribute="centerY" secondItem="JwW-2h-DyZ" secondAttribute="centerY" id="Na1-o4-4Ds"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="575" id="aB1-HF-No8"/>
<constraint firstItem="d0X-cW-Xgz" firstAttribute="leading" secondItem="2wf-Py-l6B" secondAttribute="leading" constant="20" id="efy-70-qsJ"/>
<constraint firstItem="d0X-cW-Xgz" firstAttribute="leading" secondItem="2wf-Py-l6B" secondAttribute="leading" id="efy-70-qsJ"/>
<constraint firstItem="se7-PJ-iwD" firstAttribute="centerX" secondItem="2wf-Py-l6B" secondAttribute="centerX" id="hts-ke-nkj"/>
<constraint firstItem="Eoi-B8-iL6" firstAttribute="top" secondItem="MNG-eU-B2N" secondAttribute="bottom" constant="8" id="jm6-9s-ojD"/>
<constraint firstItem="W4l-Be-bhM" firstAttribute="centerX" secondItem="2wf-Py-l6B" secondAttribute="centerX" id="lvd-la-SAZ"/>
......
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