Commit 77a50d57 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

refactor call view UI/UX

Change-Id: I5dbb49de98ec9c2e69636d69d063ebc02a86c5a3
Reviewed-by: Kateryna Kostiuk's avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent 3bd4b5ec
......@@ -76,6 +76,11 @@
@property (unsafe_unretained) IBOutlet NSTextField* timeSpentLabel;
@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
@property (unsafe_unretained) IBOutlet NSView* controlsPanel;
......@@ -85,10 +90,10 @@
@property (unsafe_unretained) IBOutlet IconButton* pickUpButton;
@property (unsafe_unretained) IBOutlet IconButton* muteAudioButton;
@property (unsafe_unretained) IBOutlet IconButton* muteVideoButton;
@property (unsafe_unretained) IBOutlet IconButton* addContactButton;
@property (unsafe_unretained) IBOutlet IconButton* transferButton;
@property (unsafe_unretained) IBOutlet IconButton* addParticipantButton;
@property (unsafe_unretained) IBOutlet IconButton* chatButton;
@property (unsafe_unretained) IBOutlet IconButton* qualityButton;
@property (unsafe_unretained) IBOutlet NSView* advancedPanel;
@property (unsafe_unretained) IBOutlet IconButton* advancedButton;
......@@ -129,7 +134,7 @@
recordOnOffButton, pickUpButton, chatButton, transferButton, addParticipantButton, timeSpentLabel,
muteVideoButton, muteAudioButton, controlsPanel, advancedPanel, advancedButton, headerContainer, videoView,
incomingDisplayName, incomingPersonPhoto, previewView, splitView, loadingIndicator, ringingPanel, joinPanel,
outgoingPanel;
outgoingPanel, outgoingPersonLabel, outgoingStateLabel, outgoingPhoto, outgoingId;
@synthesize previewHolder;
@synthesize videoHolder;
......@@ -171,10 +176,10 @@
videoHolder = [[RendererConnectionsHolder alloc] init];
[loadingIndicator setColor:[NSColor whiteColor]];
[loadingIndicator setNumberOfLines:100];
[loadingIndicator setWidthOfLine:2];
[loadingIndicator setLengthOfLine:2];
[loadingIndicator setInnerMargin:30];
[loadingIndicator setNumberOfLines:200];
[loadingIndicator setWidthOfLine:4];
[loadingIndicator setLengthOfLine:4];
[loadingIndicator setInnerMargin:59];
[self.videoView setCallDelegate:self];
CGColor* color = [[[NSColor blackColor] colorWithAlphaComponent:0.2] CGColor];
......@@ -203,7 +208,7 @@
[timeSpentLabel setHidden:YES];
}
-(void) updateCall:(BOOL) firstRun
-(void) updateCall
{
if (accountInfo_ == nil)
return;
......@@ -216,8 +221,17 @@
auto currentCall = callModel->getCall(callUid_);
NSLog(@"\n status %@ \n",@(lrc::api::call::to_string(currentCall.status).c_str()));
auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel);
if (convIt != accountInfo_->conversationModel->allFilteredConversations().end())
[personLabel setStringValue:bestNameForConversation(*convIt, *accountInfo_->conversationModel)];
if (convIt != accountInfo_->conversationModel->allFilteredConversations().end()) {
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())];
if (refreshDurationTimer == nil)
refreshDurationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
......@@ -226,11 +240,7 @@
userInfo:nil
repeats:YES];
[stateLabel 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))];
}
[outgoingStateLabel setStringValue:@(to_string(currentCall.status).c_str())];
// Default values for this views
[loadingIndicator setHidden:YES];
......@@ -245,9 +255,15 @@
case Status::SEARCHING:
case Status::OUTGOING_REQUESTED:
case Status::CONNECTING:
[headerContainer setHidden:YES];
[outgoingPanel setHidden:NO];
[outgoingPhoto setHidden:NO];
[self setupContactInfo:outgoingPhoto];
[loadingIndicator setHidden:NO];
[controlsPanel setHidden:YES];
break;
case Status::INCOMING_RINGING:
[outgoingPhoto setHidden:YES];
[controlsPanel setHidden:YES];
[outgoingPanel setHidden:YES];
[self setupIncoming:callUid_];
......@@ -255,15 +271,22 @@
case Status::OUTGOING_RINGING:
[controlsPanel setHidden:YES];
[outgoingPanel setHidden:NO];
[loadingIndicator setHidden:NO];
[headerContainer setHidden:YES];
break;
// case Status::CONFERENCE:
// [self setupConference:currentCall];
// break;
/*case Status::CONFERENCE:
[self setupConference:currentCall];
break;*/
case Status::PAUSED:
case Status::PEER_PAUSED:
case Status::INACTIVE:
case Status::IN_PROGRESS:
// change constraints (uncollapse avatar)
[self setupContactInfo:personPhoto];
[timeSpentLabel setHidden:NO];
[outgoingPhoto setHidden:YES];
[headerContainer setHidden:NO];
break;
case Status::CONNECTED:
case Status::AUTO_ANSWERING:
break;
......@@ -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
{
if (accountInfo_ == nil)
......@@ -336,7 +370,7 @@
self.selectedCallChanged = QObject::connect(callModel,
&lrc::api::NewCallModel::callStatusChanged,
[self](const std::string callId) {
[self updateCall:NO];
[self updateCall];
});
}
......@@ -531,6 +565,7 @@
[self.chatButton setHidden:YES];
[self.addParticipantButton setHidden:YES];
[self.transferButton setHidden:YES];
[self.qualityButton setHidden:YES];
[self.chatButton setPressed:NO];
[self.mergeCallsButton setState:NSOffState];
......@@ -539,7 +574,9 @@
[personLabel setStringValue:@""];
[timeSpentLabel setStringValue:@""];
[stateLabel setStringValue:@""];
[self.addContactButton setHidden:YES];
[outgoingPersonLabel setStringValue:@""];
[outgoingStateLabel setStringValue:@""];
[advancedButton setPressed:NO];
[advancedPanel setHidden:YES];
......@@ -563,7 +600,7 @@
return;
[loadingIndicator setAnimates:YES];
[self updateCall:YES];
[self updateCall];
/* monitor media for messaging text messaging */
QObject::disconnect(self.messageConnection);
......@@ -794,7 +831,6 @@
self.addToContactPopover = NULL;
}
[self.addContactButton setPressed:NO];
[self.transferButton setPressed:NO];
[self.addParticipantButton setState:NSOffState];
}
......
......@@ -17,14 +17,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import <map>
#import <Foundation/Foundation.h>
#import "NSString+Extensions.h"
// new lrc
#import <api/conversation.h>
#import <api/conversationmodel.h>
#import <api/account.h>
#import <api/contactmodel.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)
{
......@@ -77,3 +85,22 @@ static inline lrc::api::ConversationModel::ConversationQueue::const_iterator get
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.
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