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

UI/UX: refactor conversation view


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

Change-Id: I2a934bc052333770af2d7cbde12ec471c55ca481
Reviewed-by: default avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent b04aa1d9
No related branches found
No related tags found
No related merge requests found
...@@ -210,8 +210,6 @@ SET(ringclient_VIEWS ...@@ -210,8 +210,6 @@ SET(ringclient_VIEWS
src/views/RoundedTextField.mm src/views/RoundedTextField.mm
src/views/MessageBubbleView.h src/views/MessageBubbleView.h
src/views/MessageBubbleView.mm src/views/MessageBubbleView.mm
src/views/SendMessageCell.h
src/views/SendMessageCell.mm
src/views/SendMessagePanel.h src/views/SendMessagePanel.h
src/views/SendMessagePanel.mm src/views/SendMessagePanel.mm
src/views/HoverButton.h src/views/HoverButton.h
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#import <globalinstances.h> #import <globalinstances.h>
#import "views/IconButton.h" #import "views/IconButton.h"
#import "views/HoverButton.h"
#import "views/IMTableCellView.h" #import "views/IMTableCellView.h"
#import "views/NSColor+RingTheme.h" #import "views/NSColor+RingTheme.h"
#import "QNSTreeController.h" #import "QNSTreeController.h"
...@@ -53,6 +54,7 @@ ...@@ -53,6 +54,7 @@
__unsafe_unretained IBOutlet NSTextField *conversationID; __unsafe_unretained IBOutlet NSTextField *conversationID;
__unsafe_unretained IBOutlet IconButton* sendButton; __unsafe_unretained IBOutlet IconButton* sendButton;
__unsafe_unretained IBOutlet IconButton *sendFileButton; __unsafe_unretained IBOutlet IconButton *sendFileButton;
__unsafe_unretained IBOutlet HoverButton *addContactButton;
__unsafe_unretained IBOutlet NSLayoutConstraint* sentContactRequestWidth; __unsafe_unretained IBOutlet NSLayoutConstraint* sentContactRequestWidth;
__unsafe_unretained IBOutlet NSButton* sentContactRequestButton; __unsafe_unretained IBOutlet NSButton* sentContactRequestButton;
IBOutlet MessagesVC* messagesViewVC; IBOutlet MessagesVC* messagesViewVC;
...@@ -157,6 +159,8 @@ ...@@ -157,6 +159,8 @@
[conversationID setHidden:hideBestId]; [conversationID setHidden:hideBestId];
[titleCenteredConstraint setActive:hideBestId]; [titleCenteredConstraint setActive:hideBestId];
[titleTopConstraint 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 { - (void)loadView {
...@@ -233,6 +237,18 @@ ...@@ -233,6 +237,18 @@
convModel_->placeCall(conv->uid); 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 { - (IBAction)backPressed:(id)sender {
[delegate rightPanelClosed]; [delegate rightPanelClosed];
[self hideWithAnimation:false]; [self hideWithAnimation:false];
......
...@@ -282,9 +282,7 @@ NSInteger const GENERIC_INT_TEXT_TAG = 100; ...@@ -282,9 +282,7 @@ NSInteger const GENERIC_INT_TEXT_TAG = 100;
[result updateWidthConstraint:finalWidth]; [result updateWidthConstraint:finalWidth];
auto& imageManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator()); auto& imageManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator());
if (isOutgoing) { if (!isOutgoing) {
[result.photoView setImage:[NSImage imageNamed:@"default_user_icon"]];
} else {
[result.photoView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(imageManip.conversationPhoto(*conv, convModel_->owner)))]; [result.photoView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(imageManip.conversationPhoto(*conv, convModel_->owner)))];
} }
......
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
} }
-(void)mouseEntered:(NSEvent *)theEvent { -(void)mouseEntered:(NSEvent *)theEvent {
if(self.isEnabled) {
self.bgColor = self.hoverColor; self.bgColor = self.hoverColor;
}
[super setNeedsDisplay:YES]; [super setNeedsDisplay:YES];
[super mouseEntered:theEvent]; [super mouseEntered:theEvent];
} }
......
...@@ -69,5 +69,12 @@ ...@@ -69,5 +69,12 @@
@property (nonatomic, strong) NSColor* imageColor; @property (nonatomic, strong) NSColor* imageColor;
/*
* Image color when button is disabled
* default value : [[NSColor grayColor] colorWithAlphaComponent:0.3];
*/
@property (nonatomic, strong) NSColor* buttonDisableColor;
@end @end
...@@ -62,13 +62,21 @@ ...@@ -62,13 +62,21 @@
backgroundColor = self.bgColor ; backgroundColor = self.bgColor ;
backgroundStrokeColor = self.bgColor; backgroundStrokeColor = self.bgColor;
if(!self.isEnabled) { if(!self.isEnabled) {
if (self.buttonDisableColor) {
tintColor = self.buttonDisableColor;
} else {
tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3]; tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3];
} }
} }
}
else if (!self.isEnabled) { else if (!self.isEnabled) {
backgroundColor = [self.bgColor colorWithAlphaComponent:0.7]; backgroundColor = [self.bgColor colorWithAlphaComponent:0.7];
backgroundStrokeColor = [self.bgColor colorWithAlphaComponent:0.7]; backgroundStrokeColor = [self.bgColor colorWithAlphaComponent:0.7];
if (self.buttonDisableColor) {
tintColor = self.buttonDisableColor;
} else {
tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3]; tintColor = [[NSColor grayColor] colorWithAlphaComponent:0.3];
}
} else if (self.mouseDown || self.isPressed) { } else if (self.mouseDown || self.isPressed) {
if (self.highlightColor) { if (self.highlightColor) {
backgroundColor = self.highlightColor; backgroundColor = self.highlightColor;
...@@ -84,6 +92,8 @@ ...@@ -84,6 +92,8 @@
backgroundStrokeColor = [self.bgColor darkenColorByValue:0.1]; backgroundStrokeColor = [self.bgColor darkenColorByValue:0.1];
} }
backgroundStrokeColor = NSColor.clearColor;
//// Subframes //// Subframes
NSRect group = NSMakeRect(NSMinX(dirtyRect) + floor(NSWidth(dirtyRect) * 0.03333) + 0.5, NSRect group = NSMakeRect(NSMinX(dirtyRect) + floor(NSWidth(dirtyRect) * 0.03333) + 0.5,
NSMinY(dirtyRect) + floor(NSHeight(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 @@ ...@@ -18,10 +18,7 @@
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "SendMessageCell.h"
@interface SendMessagePanel : NSView <MessageCellDelegate> @interface SendMessagePanel : NSView
@property (nonatomic, strong) IBOutlet SendMessageCell* messageCell;
@end @end
...@@ -22,33 +22,14 @@ ...@@ -22,33 +22,14 @@
@implementation SendMessagePanel @implementation SendMessagePanel
-(void) awakeFromNib {
self.messageCell.viewDelegate = self;
}
- (void)drawRect:(NSRect)dirtyRect { - (void)drawRect:(NSRect)dirtyRect {
NSBezierPath *path = [NSBezierPath bezierPath]; NSBezierPath *path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(40, dirtyRect.size.height)]; [path moveToPoint:NSMakePoint(0, dirtyRect.size.height)];
[path lineToPoint:NSMakePoint(dirtyRect.size.width - 40 , dirtyRect.size.height)]; [path lineToPoint:NSMakePoint(dirtyRect.size.width, dirtyRect.size.height)];
BOOL isEditing = [(NSTextField *)[self.messageCell controlView] currentEditor] != nil;
if(isEditing) {
[[NSColor ringBlue]set];
[path setLineWidth:3];
}
else {
[[NSColor quaternaryLabelColor]set]; [[NSColor quaternaryLabelColor]set];
[path setLineWidth:2]; [path setLineWidth:2];
}
[path stroke]; [path stroke];
[super drawRect:dirtyRect]; [super drawRect:dirtyRect];
} }
-(void) focusChanged {
[self setNeedsDisplay:YES];
}
@end @end
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