Commit 0bf03755 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

fix: search new contact ui

Change-Id: I6a842a1d57ca268372a6eb9ba51bfd0eea89214a
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent a261cfc1
......@@ -424,6 +424,13 @@ NSInteger const REQUEST_SEG = 1;
[unreadCount setIntValue:conversation.unreadMessages];
NSTextField* displayName = [result viewWithTag:DISPLAYNAME_TAG];
NSTextField* displayRingID = [result viewWithTag:RING_ID_LABEL];
NSTextField* lastInteractionDate = [result viewWithTag:DATE_TAG];
NSTextField* interactionSnippet = [result viewWithTag:SNIPPET_TAG];
[displayName setStringValue:@""];
[displayRingID setStringValue:@""];
[lastInteractionDate setStringValue:@""];
[interactionSnippet setStringValue:@""];
NSImageView* photoView = [result viewWithTag:IMAGE_TAG];
NSString* displayNameString = bestNameForConversation(conversation, *convModel_);
NSString* displayIDString = bestIDForConversation(conversation, *convModel_);
if(displayNameString.length == 0 || [displayNameString isEqualToString:displayIDString]) {
......@@ -435,10 +442,24 @@ NSInteger const REQUEST_SEG = 1;
[displayRingID setStringValue:displayIDString];
[displayRingID setHidden:NO];
}
NSImageView* photoView = [result viewWithTag:IMAGE_TAG];
auto& imageManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator());
[photoView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(imageManip.conversationPhoto(conversation, convModel_->owner)))];
NSImage* image = QtMac::toNSImage(qvariant_cast<QPixmap>(imageManip.conversationPhoto(conversation, convModel_->owner)));
if(image) {
[NSLayoutConstraint deactivateConstraints:[photoView constraints]];
NSArray* constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"H:[photoView(54)]"
options:0
metrics:nil views:NSDictionaryOfVariableBindings(photoView)];
[NSLayoutConstraint activateConstraints:constraints];
} else {
[NSLayoutConstraint deactivateConstraints:[photoView constraints]];
NSArray* constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"H:[photoView(0)]"
options:0
metrics:nil views:NSDictionaryOfVariableBindings(photoView)];
[NSLayoutConstraint activateConstraints:constraints];
}
[photoView setImage: image];
NSView* presenceView = [result viewWithTag:PRESENCE_TAG];
auto contact = convModel_->owner.contactModel->getContact(conversation.participants[0]);
......@@ -447,8 +468,6 @@ NSInteger const REQUEST_SEG = 1;
} else {
[presenceView setHidden:YES];
}
NSTextField* lastInteractionDate = [result viewWithTag:DATE_TAG];
NSTextField* interactionSnippet = [result viewWithTag:SNIPPET_TAG];
NSButton* addContactButton = [result viewWithTag:ADD_BUTTON_TAG];
NSButton* refuseContactButton = [result viewWithTag:REFUSE_BUTTON_TAG];
NSButton* blockContactButton = [result viewWithTag:BLOCK_BUTTON_TAG];
......
......@@ -86,12 +86,12 @@
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" tag="100" translatesAutoresizingMaskIntoConstraints="NO" id="sHH-wj-oHs">
<rect key="frame" x="12" y="6" width="48" height="48"/>
<rect key="frame" x="6" y="6" width="54" height="48"/>
<constraints>
<constraint firstAttribute="width" constant="48" id="C2Y-L7-ryb"/>
<constraint firstAttribute="width" constant="54" id="C2Y-L7-ryb"/>
<constraint firstAttribute="height" constant="48" id="Q3H-Dy-81c"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSUser" id="bqQ-Jp-DPH"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageAlignment="right" imageScaling="proportionallyDown" image="NSUser" id="bqQ-Jp-DPH"/>
</imageView>
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" tag="300" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="14" translatesAutoresizingMaskIntoConstraints="NO" id="MYe-rn-qOP" userLabel="UnreadMsgCount" customClass="RoundedTextField">
<rect key="frame" x="50" y="40" width="10" height="14"/>
......@@ -238,7 +238,7 @@
</subviews>
<constraints>
<constraint firstItem="epa-Ih-aKF" firstAttribute="top" secondItem="Z6G-mQ-L3J" secondAttribute="top" constant="7" id="34y-lV-vl2"/>
<constraint firstItem="sHH-wj-oHs" firstAttribute="leading" secondItem="Z6G-mQ-L3J" secondAttribute="leading" constant="12" id="CGt-hN-ulS"/>
<constraint firstItem="sHH-wj-oHs" firstAttribute="leading" secondItem="Z6G-mQ-L3J" secondAttribute="leading" constant="6" id="CGt-hN-ulS"/>
<constraint firstItem="ejM-H2-aJX" firstAttribute="leading" secondItem="Fc5-KS-cim" secondAttribute="trailing" constant="5" id="CqZ-iW-bob"/>
<constraint firstItem="bZ6-1S-zx2" firstAttribute="leading" secondItem="epa-Ih-aKF" secondAttribute="leading" id="Ffs-rJ-b8V"/>
<constraint firstItem="YkV-D4-ddd" firstAttribute="trailing" secondItem="sHH-wj-oHs" secondAttribute="trailing" constant="-0.5" id="HSa-sm-3vp"/>
......
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