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;
......
......@@ -27,16 +27,16 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="EJD-f8-Xqd">
<rect key="frame" x="0.0" y="71" width="798" height="457"/>
<rect key="frame" x="0.0" y="51" width="798" height="477"/>
<subviews>
<scrollView verticalCompressionResistancePriority="250" borderType="none" autohidesScrollers="YES" horizontalLineScroll="62" horizontalPageScroll="10" verticalLineScroll="62" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" scrollerKnobStyle="dark" translatesAutoresizingMaskIntoConstraints="NO" id="Ez2-Rf-DZN">
<rect key="frame" x="49" y="0.0" width="700" height="457"/>
<rect key="frame" x="49" y="0.0" width="700" height="477"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="ofC-Bs-tHR">
<rect key="frame" x="0.0" y="0.0" width="700" height="457"/>
<rect key="frame" x="0.0" y="0.0" width="700" height="477"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" autosaveColumns="NO" rowHeight="60" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="16" outlineTableColumn="hwp-Th-i2d" id="bOO-CW-S21">
<rect key="frame" x="0.0" y="0.0" width="700" height="457"/>
<rect key="frame" x="0.0" y="0.0" width="700" height="477"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="0.0" colorSpace="deviceWhite"/>
......@@ -167,7 +167,7 @@
<rect key="frame" x="20" y="525" width="758" height="5"/>
</box>
<button toolTip="Record" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ooq-vs-Xt1" customClass="IconButton">
<rect key="frame" x="20" y="534" width="40" height="40"/>
<rect key="frame" x="20" y="537" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="69o-49-0QB"/>
<constraint firstAttribute="width" constant="40" id="ImE-zq-KIj"/>
......@@ -194,7 +194,7 @@
<constraint firstAttribute="height" constant="21" id="ESK-Wb-Nis"/>
<constraint firstAttribute="width" constant="150" id="Er6-l6-0VP"/>
</constraints>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" inset="2" arrowPosition="arrowAtCenter" altersStateOfSelectedItem="NO" id="Tyz-Ji-vBU">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="border" inset="2" arrowPosition="arrowAtCenter" altersStateOfSelectedItem="NO" id="Tyz-Ji-vBU">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="qAY-8F-TWH">
......@@ -216,10 +216,10 @@
</textFieldCell>
</textField>
<customView verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="Rth-di-Tls" customClass="SendMessagePanel">
<rect key="frame" x="0.0" y="0.0" width="798" height="70"/>
<rect key="frame" x="0.0" y="0.0" width="798" height="50"/>
<subviews>
<textField verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="bsk-Gj-qQ2">
<rect key="frame" x="48" y="5" width="660" height="60"/>
<rect key="frame" x="48" y="5" width="660" height="40"/>
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" placeholderString="Send a message" id="Ilz-7v-2fr" customClass="SendMessageCell">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
......@@ -238,7 +238,7 @@
</connections>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UJf-cF-RAo" customClass="IconButton">
<rect key="frame" x="708" y="15" width="40" height="40"/>
<rect key="frame" x="708" y="5" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="TmF-ip-m4C"/>
<constraint firstAttribute="height" constant="40" id="rbQ-lE-sAq"/>
......@@ -258,7 +258,7 @@
<constraint firstAttribute="bottom" secondItem="bsk-Gj-qQ2" secondAttribute="bottom" constant="5" id="TID-Ww-Gmw"/>
<constraint firstAttribute="trailing" secondItem="UJf-cF-RAo" secondAttribute="trailing" constant="50" id="XqO-dy-4yf"/>
<constraint firstItem="UJf-cF-RAo" firstAttribute="centerY" secondItem="Rth-di-Tls" secondAttribute="centerY" id="d73-0x-wSy"/>
<constraint firstAttribute="height" constant="70" id="jJO-v2-Wuj"/>
<constraint firstAttribute="height" constant="50" id="jJO-v2-Wuj"/>
<constraint firstItem="bsk-Gj-qQ2" firstAttribute="top" secondItem="Rth-di-Tls" secondAttribute="top" constant="5" id="jJr-Dt-hhr"/>
<constraint firstItem="bsk-Gj-qQ2" firstAttribute="leading" secondItem="Rth-di-Tls" secondAttribute="leading" constant="50" id="khQ-CU-aUr"/>
</constraints>
......@@ -275,7 +275,7 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" tag="400" translatesAutoresizingMaskIntoConstraints="NO" id="cFH-d7-Erh" userLabel="Call Button" customClass="IconButton">
<rect key="frame" x="738" y="534" width="40" height="40"/>
<rect key="frame" x="738" y="537" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="4jd-jn-RY1"/>
<constraint firstAttribute="height" constant="40" id="DMa-Lq-2Tk"/>
......@@ -289,7 +289,7 @@
</connections>
</button>
<button toolTip="Send Contact Request" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4ZO-un-Lrm" userLabel="Send Request" customClass="IconButton">
<rect key="frame" x="688" y="534" width="40" height="40"/>
<rect key="frame" x="688" y="537" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="KPs-ix-z2g"/>
<constraint firstAttribute="width" priority="750" constant="40" id="LYJ-5C-Yza"/>
......@@ -312,7 +312,7 @@
<constraint firstItem="xdB-aI-PSs" firstAttribute="leading" secondItem="ooq-vs-Xt1" secondAttribute="trailing" constant="4" id="8eg-qb-9Gx"/>
<constraint firstAttribute="bottom" secondItem="Rth-di-Tls" secondAttribute="bottom" id="9nL-Hs-Oak"/>
<constraint firstItem="Rth-di-Tls" firstAttribute="leading" secondItem="EJD-f8-Xqd" secondAttribute="leading" id="Ijp-QX-Dkw"/>
<constraint firstItem="cFH-d7-Erh" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="12" id="Tok-wc-chb"/>
<constraint firstItem="cFH-d7-Erh" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="9" id="Tok-wc-chb"/>
<constraint firstItem="Uqj-Xr-xl5" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" id="Tzd-wA-uMM"/>
<constraint firstItem="EJD-f8-Xqd" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="58" id="XkO-FA-l3J"/>
<constraint firstItem="Sn1-dJ-QCw" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="58" id="aZT-2B-gv9"/>
......@@ -320,7 +320,7 @@
<constraint firstItem="EJD-f8-Xqd" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" id="bvr-Gv-Sgb"/>
<constraint firstItem="Sn1-dJ-QCw" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="dtD-1T-QlG"/>
<constraint firstItem="Rth-di-Tls" firstAttribute="top" secondItem="EJD-f8-Xqd" secondAttribute="bottom" constant="1" id="f8h-bA-ZrZ"/>
<constraint firstItem="ooq-vs-Xt1" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="12" id="gkR-53-qs5"/>
<constraint firstItem="ooq-vs-Xt1" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="9" id="gkR-53-qs5"/>
<constraint firstAttribute="trailing" secondItem="Rth-di-Tls" secondAttribute="trailing" id="iT0-rG-86d"/>
<constraint firstItem="cFH-d7-Erh" firstAttribute="centerY" secondItem="4ZO-un-Lrm" secondAttribute="centerY" id="lbz-xF-PHc"/>
<constraint firstAttribute="trailing" secondItem="Sn1-dJ-QCw" secondAttribute="trailing" constant="20" id="m05-gh-crH"/>
......
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