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

Conversation view: UI

Update UI elements:
-change messages background and text color
-change buttons centering

Change-Id: I18cb667fdbf6365db8db7a1d9ae2f9eb2ed90b34
Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
parent 64d025a6
......@@ -107,11 +107,11 @@ QAbstractItemModel* currentModel;
NSMutableAttributedString* msgAttString =
[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",qIdx.data((int)Qt::DisplayRole).toString().toNSString()]
attributes:[self messageAttributesFor:qIdx]];
attributes:[self messageAttributes]];
NSAttributedString* timestampAttrString =
[[NSAttributedString alloc] initWithString:qIdx.data((int)Media::TextRecording::Role::FormattedDate).toString().toNSString()
attributes:[self timestampAttributesFor:qIdx]];
attributes:[self timestampAttributes]];
CGFloat finalWidth = MAX(msgAttString.size.width, timestampAttrString.size.width);
......@@ -143,10 +143,10 @@ QAbstractItemModel* currentModel;
double someWidth = outlineView.frame.size.width * 0.7;
NSMutableAttributedString* msgAttString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",qIdx.data((int)Qt::DisplayRole).toString().toNSString()]
attributes:[self messageAttributesFor:qIdx]];
attributes:[self messageAttributes]];
NSAttributedString *timestampAttrString = [[NSAttributedString alloc] initWithString:
qIdx.data((int)Media::TextRecording::Role::FormattedDate).toString().toNSString()
attributes:[self timestampAttributesFor:qIdx]];
attributes:[self timestampAttributes]];
[msgAttString appendAttributedString:timestampAttrString];
......@@ -163,17 +163,10 @@ QAbstractItemModel* currentModel;
#pragma mark - Text formatting
- (NSMutableDictionary*) timestampAttributesFor:(QModelIndex) qIdx
- (NSMutableDictionary*) timestampAttributes
{
auto dir = qvariant_cast<Media::Media::Direction>(qIdx.data((int)Media::TextRecording::Role::Direction));
NSMutableDictionary* attrs = [NSMutableDictionary dictionary];
if (dir == Media::Media::Direction::IN) {
attrs[NSForegroundColorAttributeName] = [NSColor grayColor];
} else {
attrs[NSForegroundColorAttributeName] = [NSColor whiteColor];
}
attrs[NSForegroundColorAttributeName] = [NSColor grayColor];
NSFont* systemFont = [NSFont systemFontOfSize:12.0f];
attrs[NSFontAttributeName] = systemFont;
attrs[NSParagraphStyleAttributeName] = [self paragraphStyle];
......@@ -181,17 +174,10 @@ QAbstractItemModel* currentModel;
return attrs;
}
- (NSMutableDictionary*) messageAttributesFor:(QModelIndex) qIdx
- (NSMutableDictionary*) messageAttributes
{
auto dir = qvariant_cast<Media::Media::Direction>(qIdx.data((int)Media::TextRecording::Role::Direction));
NSMutableDictionary* attrs = [NSMutableDictionary dictionary];
if (dir == Media::Media::Direction::IN) {
attrs[NSForegroundColorAttributeName] = [NSColor blackColor];
} else {
attrs[NSForegroundColorAttributeName] = [NSColor whiteColor];
}
attrs[NSForegroundColorAttributeName] = [NSColor blackColor];
NSFont* systemFont = [NSFont systemFontOfSize:14.0f];
attrs[NSFontAttributeName] = systemFont;
attrs[NSParagraphStyleAttributeName] = [self paragraphStyle];
......
......@@ -30,7 +30,7 @@
{
if ([self.identifier isEqualToString:@"RightMessageView"]) {
self.msgBackground.pointerDirection = RIGHT;
self.msgBackground.bgColor = [NSColor ringBlue];
self.msgBackground.bgColor = [NSColor ringLightBlue];
}
else {
......
......@@ -22,6 +22,7 @@
@interface NSColor (RingTheme)
+ (NSColor*) ringBlue;
+ (NSColor*) ringLightBlue;
+ (NSColor*) ringBlueWithAlpha:(CGFloat) a;
+ (NSColor*) ringDarkBlue;
......
......@@ -51,6 +51,11 @@
return [NSColor colorWithCalibratedRed:41/255.0 green:41/255.0 blue:41/255.0 alpha:1.0];
}
+ (NSColor*) ringLightBlue
{
return [NSColor colorWithCalibratedRed:59/255.0 green:193/255.0 blue:211/255.0 alpha:0.3];
}
- (NSColor *)lightenColorByValue:(float)value {
float red = [self redComponent];
red += value;
......
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