Skip to content
Snippets Groups Projects
Commit 77a50d57 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk
Browse files

refactor call view UI/UX


Change-Id: I5dbb49de98ec9c2e69636d69d063ebc02a86c5a3
Reviewed-by: default avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent 3bd4b5ec
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,11 @@ ...@@ -76,6 +76,11 @@
@property (unsafe_unretained) IBOutlet NSTextField* timeSpentLabel; @property (unsafe_unretained) IBOutlet NSTextField* timeSpentLabel;
@property (unsafe_unretained) IBOutlet NSImageView* personPhoto; @property (unsafe_unretained) IBOutlet NSImageView* personPhoto;
@property (unsafe_unretained) IBOutlet NSImageView* outgoingPhoto;
@property (unsafe_unretained) IBOutlet NSTextField* outgoingPersonLabel;
@property (unsafe_unretained) IBOutlet NSTextField* outgoingStateLabel;
@property (unsafe_unretained) IBOutlet NSTextField* outgoingId;
// Call Controls // Call Controls
@property (unsafe_unretained) IBOutlet NSView* controlsPanel; @property (unsafe_unretained) IBOutlet NSView* controlsPanel;
...@@ -85,10 +90,10 @@ ...@@ -85,10 +90,10 @@
@property (unsafe_unretained) IBOutlet IconButton* pickUpButton; @property (unsafe_unretained) IBOutlet IconButton* pickUpButton;
@property (unsafe_unretained) IBOutlet IconButton* muteAudioButton; @property (unsafe_unretained) IBOutlet IconButton* muteAudioButton;
@property (unsafe_unretained) IBOutlet IconButton* muteVideoButton; @property (unsafe_unretained) IBOutlet IconButton* muteVideoButton;
@property (unsafe_unretained) IBOutlet IconButton* addContactButton;
@property (unsafe_unretained) IBOutlet IconButton* transferButton; @property (unsafe_unretained) IBOutlet IconButton* transferButton;
@property (unsafe_unretained) IBOutlet IconButton* addParticipantButton; @property (unsafe_unretained) IBOutlet IconButton* addParticipantButton;
@property (unsafe_unretained) IBOutlet IconButton* chatButton; @property (unsafe_unretained) IBOutlet IconButton* chatButton;
@property (unsafe_unretained) IBOutlet IconButton* qualityButton;
@property (unsafe_unretained) IBOutlet NSView* advancedPanel; @property (unsafe_unretained) IBOutlet NSView* advancedPanel;
@property (unsafe_unretained) IBOutlet IconButton* advancedButton; @property (unsafe_unretained) IBOutlet IconButton* advancedButton;
...@@ -129,7 +134,7 @@ ...@@ -129,7 +134,7 @@
recordOnOffButton, pickUpButton, chatButton, transferButton, addParticipantButton, timeSpentLabel, recordOnOffButton, pickUpButton, chatButton, transferButton, addParticipantButton, timeSpentLabel,
muteVideoButton, muteAudioButton, controlsPanel, advancedPanel, advancedButton, headerContainer, videoView, muteVideoButton, muteAudioButton, controlsPanel, advancedPanel, advancedButton, headerContainer, videoView,
incomingDisplayName, incomingPersonPhoto, previewView, splitView, loadingIndicator, ringingPanel, joinPanel, incomingDisplayName, incomingPersonPhoto, previewView, splitView, loadingIndicator, ringingPanel, joinPanel,
outgoingPanel; outgoingPanel, outgoingPersonLabel, outgoingStateLabel, outgoingPhoto, outgoingId;
@synthesize previewHolder; @synthesize previewHolder;
@synthesize videoHolder; @synthesize videoHolder;
...@@ -171,10 +176,10 @@ ...@@ -171,10 +176,10 @@
videoHolder = [[RendererConnectionsHolder alloc] init]; videoHolder = [[RendererConnectionsHolder alloc] init];
[loadingIndicator setColor:[NSColor whiteColor]]; [loadingIndicator setColor:[NSColor whiteColor]];
[loadingIndicator setNumberOfLines:100]; [loadingIndicator setNumberOfLines:200];
[loadingIndicator setWidthOfLine:2]; [loadingIndicator setWidthOfLine:4];
[loadingIndicator setLengthOfLine:2]; [loadingIndicator setLengthOfLine:4];
[loadingIndicator setInnerMargin:30]; [loadingIndicator setInnerMargin:59];
[self.videoView setCallDelegate:self]; [self.videoView setCallDelegate:self];
CGColor* color = [[[NSColor blackColor] colorWithAlphaComponent:0.2] CGColor]; CGColor* color = [[[NSColor blackColor] colorWithAlphaComponent:0.2] CGColor];
...@@ -203,7 +208,7 @@ ...@@ -203,7 +208,7 @@
[timeSpentLabel setHidden:YES]; [timeSpentLabel setHidden:YES];
} }
-(void) updateCall:(BOOL) firstRun -(void) updateCall
{ {
if (accountInfo_ == nil) if (accountInfo_ == nil)
return; return;
...@@ -216,8 +221,17 @@ ...@@ -216,8 +221,17 @@
auto currentCall = callModel->getCall(callUid_); auto currentCall = callModel->getCall(callUid_);
NSLog(@"\n status %@ \n",@(lrc::api::call::to_string(currentCall.status).c_str())); NSLog(@"\n status %@ \n",@(lrc::api::call::to_string(currentCall.status).c_str()));
auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel); auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel);
if (convIt != accountInfo_->conversationModel->allFilteredConversations().end()) if (convIt != accountInfo_->conversationModel->allFilteredConversations().end()) {
[personLabel setStringValue:bestNameForConversation(*convIt, *accountInfo_->conversationModel)]; NSString* bestName = bestNameForConversation(*convIt, *accountInfo_->conversationModel);
[personLabel setStringValue:bestName];
[outgoingPersonLabel setStringValue:bestName];
NSString* ringID = bestIDForConversation(*convIt, *accountInfo_->conversationModel);
if([bestName isEqualToString:ringID]) {
ringID = @"";
}
[outgoingId setStringValue:ringID];
}
[timeSpentLabel setStringValue:@(callModel->getFormattedCallDuration(callUid_).c_str())]; [timeSpentLabel setStringValue:@(callModel->getFormattedCallDuration(callUid_).c_str())];
if (refreshDurationTimer == nil) if (refreshDurationTimer == nil)
refreshDurationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 refreshDurationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
...@@ -226,11 +240,7 @@ ...@@ -226,11 +240,7 @@
userInfo:nil userInfo:nil
repeats:YES]; repeats:YES];
[stateLabel setStringValue:@(to_string(currentCall.status).c_str())]; [stateLabel setStringValue:@(to_string(currentCall.status).c_str())];
[outgoingStateLabel setStringValue:@(to_string(currentCall.status).c_str())];
if (firstRun) {
// QVariant photo = GlobalInstances::pixmapManipulator().callPhoto(currentCall, QSize(100,100), NO);
//[personPhoto setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(photo))];
}
// Default values for this views // Default values for this views
[loadingIndicator setHidden:YES]; [loadingIndicator setHidden:YES];
...@@ -245,9 +255,15 @@ ...@@ -245,9 +255,15 @@
case Status::SEARCHING: case Status::SEARCHING:
case Status::OUTGOING_REQUESTED: case Status::OUTGOING_REQUESTED:
case Status::CONNECTING: case Status::CONNECTING:
[headerContainer setHidden:YES];
[outgoingPanel setHidden:NO];
[outgoingPhoto setHidden:NO];
[self setupContactInfo:outgoingPhoto];
[loadingIndicator setHidden:NO]; [loadingIndicator setHidden:NO];
[controlsPanel setHidden:YES];
break; break;
case Status::INCOMING_RINGING: case Status::INCOMING_RINGING:
[outgoingPhoto setHidden:YES];
[controlsPanel setHidden:YES]; [controlsPanel setHidden:YES];
[outgoingPanel setHidden:YES]; [outgoingPanel setHidden:YES];
[self setupIncoming:callUid_]; [self setupIncoming:callUid_];
...@@ -255,15 +271,22 @@ ...@@ -255,15 +271,22 @@
case Status::OUTGOING_RINGING: case Status::OUTGOING_RINGING:
[controlsPanel setHidden:YES]; [controlsPanel setHidden:YES];
[outgoingPanel setHidden:NO]; [outgoingPanel setHidden:NO];
[loadingIndicator setHidden:NO];
[headerContainer setHidden:YES];
break; break;
// case Status::CONFERENCE: /*case Status::CONFERENCE:
// [self setupConference:currentCall]; [self setupConference:currentCall];
// break; break;*/
case Status::PAUSED: case Status::PAUSED:
case Status::PEER_PAUSED: case Status::PEER_PAUSED:
case Status::INACTIVE: case Status::INACTIVE:
case Status::IN_PROGRESS: case Status::IN_PROGRESS:
// change constraints (uncollapse avatar)
[self setupContactInfo:personPhoto];
[timeSpentLabel setHidden:NO]; [timeSpentLabel setHidden:NO];
[outgoingPhoto setHidden:YES];
[headerContainer setHidden:NO];
break;
case Status::CONNECTED: case Status::CONNECTED:
case Status::AUTO_ANSWERING: case Status::AUTO_ANSWERING:
break; break;
...@@ -278,6 +301,17 @@ ...@@ -278,6 +301,17 @@
} }
-(void) setupContactInfo:(NSImageView*)imageView
{
auto* convModel = accountInfo_->conversationModel.get();
auto it = getConversationFromUid(convUid_, *convModel);
if (it != convModel->allFilteredConversations().end()) {
auto& imgManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator());
QVariant photo = imgManip.conversationPhoto(*it, *accountInfo_, QSize(120, 120), NO);
[imageView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(photo))];
}
}
-(void) setupIncoming:(const std::string&) callId -(void) setupIncoming:(const std::string&) callId
{ {
if (accountInfo_ == nil) if (accountInfo_ == nil)
...@@ -336,7 +370,7 @@ ...@@ -336,7 +370,7 @@
self.selectedCallChanged = QObject::connect(callModel, self.selectedCallChanged = QObject::connect(callModel,
&lrc::api::NewCallModel::callStatusChanged, &lrc::api::NewCallModel::callStatusChanged,
[self](const std::string callId) { [self](const std::string callId) {
[self updateCall:NO]; [self updateCall];
}); });
} }
...@@ -531,6 +565,7 @@ ...@@ -531,6 +565,7 @@
[self.chatButton setHidden:YES]; [self.chatButton setHidden:YES];
[self.addParticipantButton setHidden:YES]; [self.addParticipantButton setHidden:YES];
[self.transferButton setHidden:YES]; [self.transferButton setHidden:YES];
[self.qualityButton setHidden:YES];
[self.chatButton setPressed:NO]; [self.chatButton setPressed:NO];
[self.mergeCallsButton setState:NSOffState]; [self.mergeCallsButton setState:NSOffState];
...@@ -539,7 +574,9 @@ ...@@ -539,7 +574,9 @@
[personLabel setStringValue:@""]; [personLabel setStringValue:@""];
[timeSpentLabel setStringValue:@""]; [timeSpentLabel setStringValue:@""];
[stateLabel setStringValue:@""]; [stateLabel setStringValue:@""];
[self.addContactButton setHidden:YES];
[outgoingPersonLabel setStringValue:@""];
[outgoingStateLabel setStringValue:@""];
[advancedButton setPressed:NO]; [advancedButton setPressed:NO];
[advancedPanel setHidden:YES]; [advancedPanel setHidden:YES];
...@@ -563,7 +600,7 @@ ...@@ -563,7 +600,7 @@
return; return;
[loadingIndicator setAnimates:YES]; [loadingIndicator setAnimates:YES];
[self updateCall:YES]; [self updateCall];
/* monitor media for messaging text messaging */ /* monitor media for messaging text messaging */
QObject::disconnect(self.messageConnection); QObject::disconnect(self.messageConnection);
...@@ -794,7 +831,6 @@ ...@@ -794,7 +831,6 @@
self.addToContactPopover = NULL; self.addToContactPopover = NULL;
} }
[self.addContactButton setPressed:NO];
[self.transferButton setPressed:NO]; [self.transferButton setPressed:NO];
[self.addParticipantButton setState:NSOffState]; [self.addParticipantButton setState:NSOffState];
} }
......
...@@ -17,14 +17,22 @@ ...@@ -17,14 +17,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#import <map>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "NSString+Extensions.h" #import "NSString+Extensions.h"
// new lrc
#import <api/conversation.h> #import <api/conversation.h>
#import <api/conversationmodel.h> #import <api/conversationmodel.h>
#import <api/account.h> #import <api/account.h>
#import <api/contactmodel.h> #import <api/contactmodel.h>
#import <api/contact.h> #import <api/contact.h>
#import <map>
// old lrc
#import <QSortFilterProxyModel>
#import <accountmodel.h>
#import <codecmodel.h>
static inline NSString* bestIDForConversation(const lrc::api::conversation::Info& conv, const lrc::api::ConversationModel& model) static inline NSString* bestIDForConversation(const lrc::api::conversation::Info& conv, const lrc::api::ConversationModel& model)
{ {
...@@ -77,3 +85,22 @@ static inline lrc::api::ConversationModel::ConversationQueue::const_iterator get ...@@ -77,3 +85,22 @@ static inline lrc::api::ConversationModel::ConversationQueue::const_iterator get
return uid == conv.uid; return uid == conv.uid;
}); });
} }
static inline void
setVideoAutoQuality(bool autoQuality, std::string accountId)
{
auto thisAccount = AccountModel::instance().getById(QByteArray::fromStdString(accountId));
if (const auto& codecModel = thisAccount->codecModel()) {
const auto& videoCodecs = codecModel->videoCodecs();
for (int i=0; i < videoCodecs->rowCount();i++) {
const auto& idx = videoCodecs->index(i,0);
if (autoQuality) {
videoCodecs->setData(idx, "true", CodecModel::Role::AUTO_QUALITY_ENABLED);
} else {
videoCodecs->setData(idx, "false", CodecModel::Role::AUTO_QUALITY_ENABLED);
}
}
codecModel << CodecModel::EditAction::SAVE;
}
}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment