Conversation view: UI
Update UI elements:
-change messages background and text color
-change buttons centering
Change-Id: I18cb667fdbf6365db8db7a1d9ae2f9eb2ed90b34
Reviewed-by: Anthony Léonard <anthony.leonard@savoirfairelinux.com>
diff --git a/src/MessagesVC.mm b/src/MessagesVC.mm
index a38ba67..a44ba20 100644
--- a/src/MessagesVC.mm
+++ b/src/MessagesVC.mm
@@ -107,11 +107,11 @@
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 @@
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 @@
#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 @@
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];
diff --git a/src/views/IMTableCellView.mm b/src/views/IMTableCellView.mm
index 4b8bd07..e8e874f 100644
--- a/src/views/IMTableCellView.mm
+++ b/src/views/IMTableCellView.mm
@@ -30,7 +30,7 @@
{
if ([self.identifier isEqualToString:@"RightMessageView"]) {
self.msgBackground.pointerDirection = RIGHT;
- self.msgBackground.bgColor = [NSColor ringBlue];
+ self.msgBackground.bgColor = [NSColor ringLightBlue];
}
else {
diff --git a/src/views/NSColor+RingTheme.h b/src/views/NSColor+RingTheme.h
index 08d145b..b0b0b7f 100644
--- a/src/views/NSColor+RingTheme.h
+++ b/src/views/NSColor+RingTheme.h
@@ -22,6 +22,7 @@
@interface NSColor (RingTheme)
+ (NSColor*) ringBlue;
++ (NSColor*) ringLightBlue;
+ (NSColor*) ringBlueWithAlpha:(CGFloat) a;
+ (NSColor*) ringDarkBlue;
diff --git a/src/views/NSColor+RingTheme.mm b/src/views/NSColor+RingTheme.mm
index 1090e95..cecf14e 100644
--- a/src/views/NSColor+RingTheme.mm
+++ b/src/views/NSColor+RingTheme.mm
@@ -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;