main ui: add welcome message

improve display of the ring id and add welcome message (same as website)

Issue: #79399
Change-Id: Id5864c678a6b3c07ba7ffc23ac80e78a41eadf9b
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a9895a..1bd5b6a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,7 +125,9 @@
    src/views/PersonCell.mm
    src/views/PersonCell.h
    src/views/RingOutlineView.mm
-   src/views/RingOutlineView.h)
+   src/views/RingOutlineView.h
+   src/views/RingIDField.mm
+   src/views/RingIDField.h)
 
 SET(ringclient_OTHERS
    src/main.mm
@@ -160,7 +162,9 @@
 SET_SOURCE_FILES_PROPERTIES(${myApp_ICON} PROPERTIES
        MACOSX_PACKAGE_LOCATION "Resources")
 
-SET(ring_ICONS ${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_accept.png
+SET(ring_ICONS
+${CMAKE_CURRENT_SOURCE_DIR}/data/symbol_name.png
+${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_accept.png
 ${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_call.png
 ${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_cancel.png
 ${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_hangup.png
diff --git a/data/symbol_name.png b/data/symbol_name.png
new file mode 100644
index 0000000..4c46125
--- /dev/null
+++ b/data/symbol_name.png
Binary files differ
diff --git a/src/RingWindowController.mm b/src/RingWindowController.mm
index c433aa4..e317dc9 100644
--- a/src/RingWindowController.mm
+++ b/src/RingWindowController.mm
@@ -110,7 +110,7 @@
         }
     }
 
-    [ringIDLabel setStringValue:[[NSString alloc] initWithFormat:@"Your Ring ID : %@", finalChoice->username().toNSString()]];
+    [ringIDLabel setStringValue:[[NSString alloc] initWithFormat:@"%@", finalChoice->username().toNSString()]];
 }
 
 - (IBAction)openPreferences:(id)sender
diff --git a/src/views/RingIDField.h b/src/views/RingIDField.h
new file mode 100644
index 0000000..e0746cd
--- /dev/null
+++ b/src/views/RingIDField.h
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (C) 2015 Savoir-faire Linux Inc.
+ *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@interface RingIDField : NSTextField
+
+@end
diff --git a/src/views/RingIDField.mm b/src/views/RingIDField.mm
new file mode 100644
index 0000000..864100b
--- /dev/null
+++ b/src/views/RingIDField.mm
@@ -0,0 +1,59 @@
+/*
+ *  Copyright (C) 2015 Savoir-faire Linux Inc.
+ *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#import "RingIDField.h"
+
+@interface RingIDField() {
+    NSSize m_previousIntrinsicContentSize;
+}
+
+@end
+
+@implementation RingIDField
+
+- (void)drawRect:(NSRect)dirtyRect
+{
+    [super drawRect:dirtyRect];
+
+    NSPoint origin = { 0.0,0.0 };
+    NSRect rect;
+    rect.origin = origin;
+    rect.size.width  = [self bounds].size.width;
+    rect.size.height = [self bounds].size.height;
+
+    NSBezierPath * path;
+    path = [NSBezierPath bezierPathWithRect:rect];
+    [path setLineWidth:3];
+    [[NSColor colorWithCalibratedRed:0.337 green:0.69 blue:0.788 alpha:1.0] set];
+    [path stroke];
+
+}
+
+@end
diff --git a/ui/RingWindow.xib b/ui/RingWindow.xib
index 722683d..1a01332 100644
--- a/ui/RingWindow.xib
+++ b/ui/RingWindow.xib
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
     </dependencies>
@@ -231,37 +231,75 @@
                             </tabViewItem>
                         </tabViewItems>
                     </tabView>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JN3-vO-zcd" userLabel="Ring ID">
-                        <rect key="frame" x="321" y="0.0" width="714" height="26"/>
-                        <constraints>
-                            <constraint firstAttribute="height" constant="26" id="TYe-h2-pPT"/>
-                        </constraints>
-                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="center" id="qCF-Zf-vZg">
-                            <font key="font" metaFont="system"/>
-                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                    </textField>
-                    <customView focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="tSW-YT-asL">
-                        <rect key="frame" x="323" y="0.0" width="730" height="626"/>
+                    <customView focusRingType="none" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tSW-YT-asL">
+                        <rect key="frame" x="533" y="-343" width="730" height="626"/>
                         <constraints>
                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="626" id="5yo-rb-X1O"/>
                             <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="725" id="ccX-uq-zuj"/>
                         </constraints>
                     </customView>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="Fzg-MB-mlx" userLabel="HomeView">
+                        <rect key="frame" x="323" y="0.0" width="730" height="626"/>
+                        <subviews>
+                            <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" misplaced="YES" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VJ1-xk-v5e">
+                                <rect key="frame" x="210" y="271" width="311" height="84"/>
+                                <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" id="eln-Vm-t0d">
+                                    <font key="font" size="15" name="HelveticaNeue"/>
+                                    <string key="title">Ring is a secure and distributed voice, video and chat communication platform that requires no centralized server and leaves the power of privacy in the hands of the user.</string>
+                                    <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kFj-Sh-o5u">
+                                <rect key="frame" x="200" y="244" width="330" height="19"/>
+                                <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="This is your RingID. Copy and share it with your friends!" id="Xb9-UT-M2F">
+                                    <font key="font" size="13" name="HelveticaNeue"/>
+                                    <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JN3-vO-zcd" userLabel="Ring ID" customClass="RingIDField">
+                                <rect key="frame" x="165" y="210" width="400" height="26"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="26" id="TYe-h2-pPT"/>
+                                    <constraint firstAttribute="width" constant="400" id="ywt-Ml-u9k"/>
+                                </constraints>
+                                <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" borderStyle="border" alignment="center" id="qCF-Zf-vZg">
+                                    <font key="font" size="15" name="HelveticaNeue"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f62-JV-dgr">
+                                <rect key="frame" x="255" y="363" width="220" height="75"/>
+                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="symbol_name" id="9ti-Q4-TAv"/>
+                            </imageView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="centerX" secondItem="f62-JV-dgr" secondAttribute="centerX" id="0hx-jq-Rdh"/>
+                            <constraint firstAttribute="centerX" secondItem="VJ1-xk-v5e" secondAttribute="centerX" id="IcQ-Ld-A3j"/>
+                            <constraint firstItem="VJ1-xk-v5e" firstAttribute="top" secondItem="f62-JV-dgr" secondAttribute="bottom" constant="8" id="PNC-n6-n33"/>
+                            <constraint firstAttribute="centerY" secondItem="VJ1-xk-v5e" secondAttribute="centerY" id="Rst-Fd-Tpe"/>
+                            <constraint firstAttribute="centerX" secondItem="kFj-Sh-o5u" secondAttribute="centerX" id="Zjg-a3-qf3"/>
+                            <constraint firstItem="kFj-Sh-o5u" firstAttribute="top" secondItem="VJ1-xk-v5e" secondAttribute="bottom" constant="8" id="btp-Ro-DNa"/>
+                            <constraint firstItem="JN3-vO-zcd" firstAttribute="top" secondItem="kFj-Sh-o5u" secondAttribute="bottom" constant="8" id="leT-Io-jce"/>
+                            <constraint firstAttribute="centerX" secondItem="JN3-vO-zcd" secondAttribute="centerX" id="xdj-mG-iqh"/>
+                        </constraints>
+                    </customView>
                 </subviews>
                 <constraints>
                     <constraint firstItem="xXW-iq-GcP" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="6mJ-d2-JIf"/>
+                    <constraint firstAttribute="trailing" secondItem="Fzg-MB-mlx" secondAttribute="trailing" id="7pE-x1-oME"/>
                     <constraint firstItem="bqQ-DB-Z0g" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" id="FeC-4y-ScK"/>
-                    <constraint firstAttribute="trailing" secondItem="JN3-vO-zcd" secondAttribute="trailing" constant="20" symbolic="YES" id="KPv-O8-ffI"/>
                     <constraint firstItem="xXW-iq-GcP" firstAttribute="top" secondItem="bqQ-DB-Z0g" secondAttribute="bottom" constant="8" id="KXj-CP-Fmh"/>
                     <constraint firstAttribute="bottom" secondItem="tSW-YT-asL" secondAttribute="bottom" id="Xa4-hd-K1t"/>
+                    <constraint firstAttribute="bottom" secondItem="Fzg-MB-mlx" secondAttribute="bottom" id="XrF-XJ-qvU"/>
                     <constraint firstItem="tSW-YT-asL" firstAttribute="leading" secondItem="bqQ-DB-Z0g" secondAttribute="trailing" constant="8" id="cW1-si-AGR"/>
                     <constraint firstAttribute="trailing" secondItem="tSW-YT-asL" secondAttribute="trailing" id="g0F-Wt-YT6"/>
                     <constraint firstAttribute="bottom" secondItem="xXW-iq-GcP" secondAttribute="bottom" constant="20" id="hQL-rc-Qaw"/>
                     <constraint firstItem="bqQ-DB-Z0g" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="jQg-C7-rD0"/>
-                    <constraint firstItem="JN3-vO-zcd" firstAttribute="leading" secondItem="tSW-YT-asL" secondAttribute="leading" id="rqu-Sb-asZ"/>
-                    <constraint firstItem="JN3-vO-zcd" firstAttribute="bottom" secondItem="tSW-YT-asL" secondAttribute="bottom" id="tIa-aw-5Gu"/>
+                    <constraint firstItem="Fzg-MB-mlx" firstAttribute="leading" secondItem="xXW-iq-GcP" secondAttribute="trailing" constant="8" id="uOF-tR-7xA"/>
+                    <constraint firstItem="Fzg-MB-mlx" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="vEg-yd-ePR"/>
                     <constraint firstItem="tSW-YT-asL" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="w5j-cX-qS9"/>
                 </constraints>
             </view>
@@ -289,4 +327,7 @@
             </connections>
         </viewController>
     </objects>
+    <resources>
+        <image name="symbol_name" width="225" height="75"/>
+    </resources>
 </document>