Commit 256814e7 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Adrien Béraud

UI/UX: account settings

Change-Id: I193caa1455a70582050217cdf22a0aab2b988132
parent bdaa274b
......@@ -113,7 +113,7 @@ typedef NS_ENUM(NSInteger, TagViews) {
- (void)awakeFromNib
{
[super awakeFromNib];
[photoView setBordered:YES];
// [photoView setBordered:YES];
[addProfilePhotoImage setWantsLayer: YES];
devicesTableView.delegate = self;
devicesTableView.dataSource = self;
......@@ -140,7 +140,7 @@ typedef NS_ENUM(NSInteger, TagViews) {
QVariant photo = GlobalInstances::pixmapManipulator().personPhoto(ba, nil);
if(QtMac::toNSImage(qvariant_cast<QPixmap>(photo))) {
[photoView setBordered:NO];
//[photoView setBordered:NO];
NSImage *image = QtMac::toNSImage(qvariant_cast<QPixmap>(photo));
CGFloat newSize = MIN(image.size.height, image.size.width);
image = [image cropImageToSize:CGSizeMake(newSize, newSize)];
......@@ -148,7 +148,7 @@ typedef NS_ENUM(NSInteger, TagViews) {
[addProfilePhotoImage setHidden:YES];
} else {
[photoView setImage:nil];
[photoView setBordered:YES];
// [photoView setBordered:YES];
[addProfilePhotoImage setHidden:NO];
}
NSString* displayName = @(account.profileInfo.alias.c_str());
......@@ -225,18 +225,22 @@ typedef NS_ENUM(NSInteger, TagViews) {
returnCode:(NSInteger) code
contextInfo:(void*) contextInfo
{
//do nothing when editing canceled
if (code == 0) {
return;
}
if (auto outputImage = [picker outputImage]) {
auto image = [picker inputImage];
CGFloat newSize = MIN(image.size.height, image.size.width);
outputImage = [outputImage cropImageToSize:CGSizeMake(newSize, newSize)];
[photoView setImage: [outputImage roundCorners: outputImage.size.height * 0.5]];
[photoView setBordered:NO];
// [photoView setBordered:NO];
[addProfilePhotoImage setHidden:YES];
auto imageToBytes = QByteArray::fromNSData([outputImage TIFFRepresentation]).toBase64();
std::string imageToString = std::string(imageToBytes.constData(), imageToBytes.length());
self.accountModel->setAvatar(self.selectedAccountID, imageToString);
} else if(!photoView.image) {
[photoView setBordered:YES];
//[photoView setBordered:YES];
[addProfilePhotoImage setHidden:NO];
}
}
......
......@@ -86,6 +86,10 @@ typedef NS_ENUM(NSInteger, TagViews) {
returnCode:(NSInteger) code
contextInfo:(void*) contextInfo
{
//do nothing when editing canceled
if (code == 0) {
return;
}
if (auto outputImage = [picker outputImage]) {
[photoView setBordered:NO];
auto image = [picker inputImage];
......
......@@ -133,6 +133,10 @@ NSTimer* timeoutTimer;
returnCode:(NSInteger) code
contextInfo:(void*) contextInfo
{
//do nothing when editing canceled
if (code == 0) {
return;
}
if (auto outputImage = [picker outputImage]) {
[photoView setBordered:NO];
auto image = [picker inputImage];
......
......@@ -162,6 +162,10 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2;
returnCode:(NSInteger) code
contextInfo:(void*) contextInfo
{
//do nothing when editing canceled
if (code == 0) {
return;
}
if (auto outputImage = [picker outputImage]) {
[photoView setBordered:NO];
auto image = [picker inputImage];
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -33,8 +33,20 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystemBold"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" alphaValue="0.29999999999999999" translatesAutoresizingMaskIntoConstraints="NO" id="h0K-g2-bgQ" customClass="HoverButton">
<rect key="frame" x="155" y="287" width="91" height="90"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" alignment="center" refusesFirstResponder="YES" transparent="YES" imageScaling="proportionallyDown" inset="2" id="Ded-FV-C1n">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="hoverColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="editPhoto:" target="-2" id="6Cy-I5-H1E"/>
<action selector="editPhoto:" target="-2" id="ZqF-dw-9gc"/>
</connections>
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vGN-UO-vCk">
......@@ -148,6 +160,8 @@ Gw
</textField>
</subviews>
<constraints>
<constraint firstItem="h0K-g2-bgQ" firstAttribute="top" secondItem="gTr-1R-5qI" secondAttribute="top" id="3p7-UD-eti"/>
<constraint firstItem="h0K-g2-bgQ" firstAttribute="bottom" secondItem="gTr-1R-5qI" secondAttribute="bottom" id="9PF-KD-nWz"/>
<constraint firstItem="k1Y-Gu-pHf" firstAttribute="top" secondItem="AbV-oR-qrC" secondAttribute="top" id="BAX-Ro-h80"/>
<constraint firstItem="SUD-CK-UdK" firstAttribute="bottom" secondItem="lgy-cp-ZAK" secondAttribute="bottom" id="CUL-RU-jNp"/>
<constraint firstItem="SyG-hW-jMO" firstAttribute="top" secondItem="ZIg-7T-R16" secondAttribute="bottom" constant="20" id="CqL-Zc-y07"/>
......@@ -158,6 +172,7 @@ Gw
<constraint firstAttribute="trailing" secondItem="SyG-hW-jMO" secondAttribute="trailing" constant="20" id="Meg-na-Q6u"/>
<constraint firstAttribute="trailing" secondItem="H2H-Nj-iaA" secondAttribute="trailing" constant="20" id="N1z-aK-mCv"/>
<constraint firstItem="D0T-VV-iYE" firstAttribute="bottom" secondItem="ltT-Ku-8cT" secondAttribute="bottom" id="OJd-Jr-GTq"/>
<constraint firstItem="h0K-g2-bgQ" firstAttribute="trailing" secondItem="gTr-1R-5qI" secondAttribute="trailing" id="P8V-b6-9vP"/>
<constraint firstItem="5bs-k5-y85" firstAttribute="bottom" secondItem="KhB-Ik-Njv" secondAttribute="bottom" id="Ppo-F5-NZ1"/>
<constraint firstItem="SUD-CK-UdK" firstAttribute="leading" secondItem="5bs-k5-y85" secondAttribute="leading" id="QLI-6r-1Am"/>
<constraint firstAttribute="trailing" secondItem="D0T-VV-iYE" secondAttribute="trailing" constant="20" id="TB2-A1-kcZ"/>
......@@ -185,6 +200,7 @@ Gw
<constraint firstItem="lgy-cp-ZAK" firstAttribute="top" secondItem="ltT-Ku-8cT" secondAttribute="bottom" constant="20" id="vOg-6e-IOQ"/>
<constraint firstItem="ltT-Ku-8cT" firstAttribute="leading" secondItem="AbV-oR-qrC" secondAttribute="leading" constant="20" id="voL-dH-p00"/>
<constraint firstItem="vGN-UO-vCk" firstAttribute="top" secondItem="gTr-1R-5qI" secondAttribute="bottom" constant="20" id="xN0-Qd-on6"/>
<constraint firstItem="h0K-g2-bgQ" firstAttribute="leading" secondItem="gTr-1R-5qI" secondAttribute="leading" id="xbD-Wf-3Ry"/>
<constraint firstAttribute="trailing" secondItem="vGN-UO-vCk" secondAttribute="trailing" constant="80" id="xrR-Fc-y0P"/>
<constraint firstItem="KhB-Ik-Njv" firstAttribute="top" secondItem="SyG-hW-jMO" secondAttribute="bottom" constant="20" id="yb8-g2-sOW"/>
</constraints>
......
......@@ -41,8 +41,20 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystemBold"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" alphaValue="0.29999999999999999" translatesAutoresizingMaskIntoConstraints="NO" id="ajM-4b-k6F" customClass="HoverButton">
<rect key="frame" x="155" y="343" width="91" height="90"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" alignment="center" refusesFirstResponder="YES" transparent="YES" imageScaling="proportionallyDown" inset="2" id="xy7-bc-QCd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="hoverColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="editPhoto:" target="-2" id="0AC-cZ-xCz"/>
<action selector="editPhoto:" target="-2" id="2Ha-fx-TAe"/>
</connections>
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="99y-na-GTj">
......@@ -320,6 +332,7 @@ Gw
<constraint firstItem="WGe-uI-HhQ" firstAttribute="centerY" secondItem="b0r-ri-6ZA" secondAttribute="centerY" id="4FT-Ah-t63"/>
<constraint firstItem="WGe-uI-HhQ" firstAttribute="leading" secondItem="b0r-ri-6ZA" secondAttribute="trailing" constant="3" id="4Km-fL-QuX"/>
<constraint firstItem="de8-5s-scH" firstAttribute="centerY" secondItem="mU4-ba-cip" secondAttribute="centerY" id="5fr-98-682"/>
<constraint firstItem="ajM-4b-k6F" firstAttribute="bottom" secondItem="vby-AD-tor" secondAttribute="bottom" id="5tD-Yh-QEo"/>
<constraint firstItem="8hq-sG-FEh" firstAttribute="leading" secondItem="gKX-gX-nko" secondAttribute="leading" constant="20" id="6Ei-bL-EqF"/>
<constraint firstAttribute="trailing" secondItem="Nny-Rd-SVl" secondAttribute="trailing" constant="20" id="6bc-Ei-eFR"/>
<constraint firstItem="vby-AD-tor" firstAttribute="centerX" secondItem="gKX-gX-nko" secondAttribute="centerX" id="8Dl-Bk-xeJ"/>
......@@ -335,6 +348,7 @@ Gw
<constraint firstItem="jta-f3-H1W" firstAttribute="top" secondItem="99y-na-GTj" secondAttribute="bottom" constant="20" id="N6i-8s-rnl"/>
<constraint firstItem="mU4-ba-cip" firstAttribute="leading" secondItem="JGA-h8-Nhd" secondAttribute="leading" id="O5c-Px-dnR"/>
<constraint firstItem="4oE-Ad-4bY" firstAttribute="top" secondItem="Nny-Rd-SVl" secondAttribute="bottom" constant="20" id="RO6-TB-9e4"/>
<constraint firstItem="ajM-4b-k6F" firstAttribute="leading" secondItem="vby-AD-tor" secondAttribute="leading" id="SDb-V2-z64"/>
<constraint firstAttribute="trailing" secondItem="jta-f3-H1W" secondAttribute="trailing" constant="20" id="SX0-7R-MJl"/>
<constraint firstItem="yaf-61-UuK" firstAttribute="top" secondItem="ie2-fK-FsB" secondAttribute="bottom" constant="15" id="Sxu-Ev-Jnh"/>
<constraint firstItem="LVv-bg-Ols" firstAttribute="top" secondItem="b0r-ri-6ZA" secondAttribute="bottom" constant="8" id="T0g-el-LD4"/>
......@@ -342,6 +356,7 @@ Gw
<constraint firstAttribute="bottom" secondItem="FAG-OH-C4R" secondAttribute="bottom" constant="20" id="YE6-QP-dDj"/>
<constraint firstItem="LVv-bg-Ols" firstAttribute="centerX" secondItem="gKX-gX-nko" secondAttribute="centerX" id="Zgw-sa-Pg4"/>
<constraint firstItem="FAG-OH-C4R" firstAttribute="leading" secondItem="NHb-Jx-MH0" secondAttribute="trailing" constant="10" id="aGL-DS-6od"/>
<constraint firstItem="ajM-4b-k6F" firstAttribute="top" secondItem="vby-AD-tor" secondAttribute="top" id="c2R-9y-Mht"/>
<constraint firstItem="rxZ-gN-ou1" firstAttribute="leading" secondItem="hwE-M9-zUH" secondAttribute="trailing" constant="3" id="c7T-UX-ozI"/>
<constraint firstItem="tXp-94-ns5" firstAttribute="centerX" secondItem="gKX-gX-nko" secondAttribute="centerX" id="do1-ZG-nHg"/>
<constraint firstItem="g1K-rU-VmV" firstAttribute="centerY" secondItem="vby-AD-tor" secondAttribute="centerY" id="gKa-0L-f4d"/>
......@@ -358,6 +373,7 @@ Gw
<constraint firstItem="b0r-ri-6ZA" firstAttribute="top" secondItem="8hq-sG-FEh" secondAttribute="bottom" constant="20" id="rfm-9m-nQK"/>
<constraint firstItem="rxZ-gN-ou1" firstAttribute="centerY" secondItem="hwE-M9-zUH" secondAttribute="centerY" id="rlS-7G-12B"/>
<constraint firstItem="99y-na-GTj" firstAttribute="centerX" secondItem="gKX-gX-nko" secondAttribute="centerX" id="syr-CX-eyE"/>
<constraint firstItem="ajM-4b-k6F" firstAttribute="trailing" secondItem="vby-AD-tor" secondAttribute="trailing" id="vFJ-PC-TiJ"/>
<constraint firstItem="JGA-h8-Nhd" firstAttribute="leading" secondItem="LVv-bg-Ols" secondAttribute="trailing" constant="8" id="x8S-ie-153"/>
<constraint firstItem="LVv-bg-Ols" firstAttribute="leading" secondItem="b0r-ri-6ZA" secondAttribute="leading" id="xlV-fq-lwI"/>
<constraint firstItem="4oE-Ad-4bY" firstAttribute="leading" secondItem="gKX-gX-nko" secondAttribute="leading" constant="20" id="zbc-0N-sAn"/>
......
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