Commit db95b479 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

UI/UX: refactor conversation view

This patch refactor elements placement on send panel and actions
panel of conversation view.

Change-Id: I2a934bc052333770af2d7cbde12ec471c55ca481
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent b04aa1d9
......@@ -210,8 +210,6 @@ SET(ringclient_VIEWS
src/views/RoundedTextField.mm
src/views/MessageBubbleView.h
src/views/MessageBubbleView.mm
src/views/SendMessageCell.h
src/views/SendMessageCell.mm
src/views/SendMessagePanel.h
src/views/SendMessagePanel.mm
src/views/HoverButton.h
......
......@@ -29,6 +29,7 @@
#import <globalinstances.h>
#import "views/IconButton.h"
#import "views/HoverButton.h"
#import "views/IMTableCellView.h"
#import "views/NSColor+RingTheme.h"
#import "QNSTreeController.h"
......@@ -53,6 +54,7 @@
__unsafe_unretained IBOutlet NSTextField *conversationID;
__unsafe_unretained IBOutlet IconButton* sendButton;
__unsafe_unretained IBOutlet IconButton *sendFileButton;
__unsafe_unretained IBOutlet HoverButton *addContactButton;
__unsafe_unretained IBOutlet NSLayoutConstraint* sentContactRequestWidth;
__unsafe_unretained IBOutlet NSButton* sentContactRequestButton;
IBOutlet MessagesVC* messagesViewVC;
......@@ -157,6 +159,8 @@
[conversationID setHidden:hideBestId];
[titleCenteredConstraint setActive:hideBestId];
[titleTopConstraint setActive:!hideBestId];
auto accountType = convModel_->owner.profileInfo.type;
[addContactButton setHidden:((convModel_->owner.contactModel->getContact(conv->participants[0]).profileInfo.type != lrc::api::profile::Type::TEMPORARY) || accountType == lrc::api::profile::Type::SIP)];
}
- (void)loadView {
......@@ -233,6 +237,18 @@
convModel_->placeCall(conv->uid);
}
- (IBAction)placeAudioCall:(id)sender
{
auto* conv = [self getCurrentConversation];
convModel_->placeAudioOnlyCall(conv->uid);
}
- (IBAction)addContact:(id)sender
{
auto* conv = [self getCurrentConversation];
convModel_->makePermanent(conv->uid);
}
- (IBAction)backPressed:(id)sender {
[delegate rightPanelClosed];
[self hideWithAnimation:false];
......
......@@ -282,10 +282,8 @@ NSInteger const GENERIC_INT_TEXT_TAG = 100;
[result updateWidthConstraint:finalWidth];
auto& imageManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator());
if (isOutgoing) {
[result.photoView setImage:[NSImage imageNamed:@"default_user_icon"]];
} else {
[result.photoView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(imageManip.conversationPhoto(*conv, convModel_->owner)))];
if (!isOutgoing) {
[result.photoView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(imageManip.conversationPhoto(*conv, convModel_->owner)))];
}
return result;
......
......@@ -34,7 +34,9 @@
}
-(void)mouseEntered:(NSEvent *)theEvent {
self.bgColor = self.hoverColor;
if(self.isEnabled) {
self.bgColor = self.hoverColor;
}
[super setNeedsDisplay:YES];
[super mouseEntered:theEvent];
}
......
......@@ -69,5 +69,12 @@
@property (nonatomic, strong) NSColor* imageColor;
/*
* Image color when button is disabled
* default value : [[NSColor grayColor] colorWithAlphaComponent:0.3];
*/
@property (nonatomic, strong) NSColor* buttonDisableColor;
@end
......@@ -62,13 +62,21 @@
backgroundColor = self.bgColor ;
backgroundStrokeColor = self.bgColor;
if(!self.isEnabled) {
tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3];
if (self.buttonDisableColor) {
tintColor = self.buttonDisableColor;
} else {
tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3];
}
}
}
else if (!self.isEnabled) {
backgroundColor = [self.bgColor colorWithAlphaComponent:0.7];
backgroundStrokeColor = [self.bgColor colorWithAlphaComponent:0.7];
tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3];
if (self.buttonDisableColor) {
tintColor = self.buttonDisableColor;
} else {
tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3];
}
} else if (self.mouseDown || self.isPressed) {
if (self.highlightColor) {
backgroundColor = self.highlightColor;
......@@ -84,6 +92,8 @@
backgroundStrokeColor = [self.bgColor darkenColorByValue:0.1];
}
backgroundStrokeColor = NSColor.clearColor;
//// Subframes
NSRect group = NSMakeRect(NSMinX(dirtyRect) + floor(NSWidth(dirtyRect) * 0.03333) + 0.5,
NSMinY(dirtyRect) + floor(NSHeight(dirtyRect) * 0.03333) + 0.5,
......
/*
* Copyright (C) 2017 Savoir-faire Linux Inc.
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import <Cocoa/Cocoa.h>
@protocol MessageCellDelegate
-(void) focusChanged;
@end
@interface SendMessageCell : NSTextFieldCell
@property (strong, nonatomic) id <MessageCellDelegate> viewDelegate;
@end
/*
* Copyright (C) 2017 Savoir-faire Linux Inc.
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import "SendMessageCell.h"
@implementation SendMessageCell
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
NSColor* textColor;
[self.viewDelegate focusChanged];
[super drawWithFrame:cellFrame inView:controlView];
}
@end
......@@ -18,10 +18,7 @@
*/
#import <Cocoa/Cocoa.h>
#import "SendMessageCell.h"
@interface SendMessagePanel : NSView <MessageCellDelegate>
@property (nonatomic, strong) IBOutlet SendMessageCell* messageCell;
@interface SendMessagePanel : NSView
@end
......@@ -22,33 +22,14 @@
@implementation SendMessagePanel
-(void) awakeFromNib {
self.messageCell.viewDelegate = self;
}
- (void)drawRect:(NSRect)dirtyRect {
NSBezierPath *path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(40, dirtyRect.size.height)];
[path lineToPoint:NSMakePoint(dirtyRect.size.width - 40 , dirtyRect.size.height)];
BOOL isEditing = [(NSTextField *)[self.messageCell controlView] currentEditor] != nil;
if(isEditing) {
[[NSColor ringBlue]set];
[path setLineWidth:3];
}
else {
[[NSColor quaternaryLabelColor]set];
[path setLineWidth:2];
}
[path moveToPoint:NSMakePoint(0, dirtyRect.size.height)];
[path lineToPoint:NSMakePoint(dirtyRect.size.width, dirtyRect.size.height)];
[[NSColor quaternaryLabelColor]set];
[path setLineWidth:2];
[path stroke];
[super drawRect:dirtyRect];
}
-(void) focusChanged {
[self setNeedsDisplay:YES];
}
@end
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