Commit 3c960bf6 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Anthony Léonard

UI: change element's placement in SmartList

make SmartList row UI more readable

Change-Id: I2f802908214af7a44df09759e63561bf42131d00
Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
parent 5df29b92
......@@ -183,6 +183,7 @@ NSInteger const CALL_BUTTON_TAG = 400;
[photoView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(qIdx.data(Qt::DecorationRole)))];
[((ContextualTableCellView*) result) setContextualsControls:[NSMutableArray arrayWithObject:[result viewWithTag:CALL_BUTTON_TAG]]];
[((ContextualTableCellView*) result) setShouldBlurParentView:NO];
NSTextField* details = [result viewWithTag:DETAILS_TAG];
if (p && p->phoneNumbers().size() > 0)
......
......@@ -237,6 +237,7 @@ NSInteger const PRESENCE_TAG = 800;
NSMutableArray* controls = [NSMutableArray arrayWithObject:[result viewWithTag:CALL_BUTTON_TAG]];
[((ContextualTableCellView*) result) setContextualsControls:controls];
[((ContextualTableCellView*) result) setShouldBlurParentView:YES];
if (auto call = RecentModel::instance().getActiveCall(qIdx)) {
[details setStringValue:call->roleData((int)Ring::Role::FormattedState).toString().toNSString()];
......@@ -249,13 +250,13 @@ NSInteger const PRESENCE_TAG = 800;
NSTextField* unreadCount = [result viewWithTag:TXT_BUTTON_TAG];
int unread = qIdx.data((int)Ring::Role::UnreadTextMessageCount).toInt();
[unreadCount setHidden:(unread == 0)];
[unreadCount.layer setCornerRadius:5.0f];
[unreadCount setStringValue:qIdx.data((int)Ring::Role::UnreadTextMessageCount).toString().toNSString()];
} else {
result = [outlineView makeViewWithIdentifier:@"CallCell" owner:outlineView];
NSMutableArray* controls = [NSMutableArray arrayWithObject:[result viewWithTag:CANCEL_BUTTON_TAG]];
[((ContextualTableCellView*) result) setContextualsControls:controls];
[((ContextualTableCellView*) result) setShouldBlurParentView:YES];
[((ContextualTableCellView*) result) setActiveState:NO];
NSTextField* details = [result viewWithTag:DETAILS_TAG];
......
......@@ -30,5 +30,9 @@
* BOOL specifying if controls should be presented when mouse is hover
*/
@property (nonatomic) BOOL activeState;
/**
* BOOL specifying if background behind controls should be blured
*/
@property (nonatomic) BOOL shouldBlurParentView;
@end
......@@ -19,6 +19,10 @@
#import "ContextualTableCellView.h"
@interface NSView (extension)
@property NSVisualEffectView* vibrantView;
@end;
@interface ContextualTableCellView()
@property NSTrackingArea *trackingArea;
......@@ -49,6 +53,8 @@
{
for (NSView* item in self.contextualsControls) {
[item setHidden:YES];
if(self.shouldBlurParentView && [item respondsToSelector:@selector(vibrantView)] && item.vibrantView)
[item.vibrantView setHidden:YES];
}
}
......@@ -59,6 +65,30 @@
for (NSView* item in self.contextualsControls) {
[item setHidden:NO];
if(!self.shouldBlurParentView)
{
break;
}
if([item respondsToSelector:@selector(vibrantView)] && !item.vibrantView) {
NSRect frame = CGRectMake(item.frame.origin.x - 20 , item.frame.origin.y - 50, item.frame.size.width + 53, item.frame.size.height + 100);
NSVisualEffectView *vibrantView = [[NSVisualEffectView alloc]
initWithFrame:frame];
vibrantView.appearance = [NSAppearance
appearanceNamed:NSAppearanceNameVibrantLight];
vibrantView.material = NSVisualEffectMaterialAppearanceBased;
vibrantView.blendingMode = NSVisualEffectBlendingModeWithinWindow;
[vibrantView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
vibrantView.alphaValue = 0.7;
if([item respondsToSelector:@selector(setVibrantView:)]) {
item.vibrantView = vibrantView;
}
[self addSubview: item.vibrantView];
[self addSubview:item];
}
if([item respondsToSelector:@selector(vibrantView)] && item.vibrantView) {
[item.vibrantView setHidden:NO];
}
}
}
......@@ -66,6 +96,9 @@
{
for (NSView* item in self.contextualsControls) {
[item setHidden:YES];
if(self.shouldBlurParentView && [item respondsToSelector:@selector(vibrantView)] && item.vibrantView) {
[item.vibrantView setHidden:YES];
}
}
}
......
......@@ -56,5 +56,11 @@
*/
@property CGFloat imageInsets;
/*
* Add bluer effect behind button
*/
@property NSVisualEffectView* vibrantView;
@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