Commit 04a56126 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

UI/UX: fix account selection

Change-Id: I72597323ff40f9a86aa3447325085f91f60efd95
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 3164fb0b
......@@ -40,6 +40,10 @@
#import "utils.h"
#import "views/NSColor+RingTheme.h"
@interface NSMenu ()
- (void) _setHasPadding: (BOOL) pad onEdge: (int) whatEdge;
@end
@interface ChooseAccountVC () <NSMenuDelegate>
@end
......@@ -73,6 +77,11 @@ NSMenuItem* selectedMenuItem;
profileImage.layer.backgroundColor = [[NSColor ringGreyLight] CGColor];
accountsMenu = [[NSMenu alloc] initWithTitle:@""];
if ([accountsMenu respondsToSelector: @selector(_setHasPadding:onEdge:)])
{
[accountsMenu _setHasPadding: NO onEdge: 1];
[accountsMenu _setHasPadding: NO onEdge: 3];
}
[accountsMenu setDelegate:self];
accountSelectionButton.menu = accountsMenu;
[accountSelectionButton setAutoenablesItems:NO];
......@@ -160,7 +169,6 @@ NSMenuItem* selectedMenuItem;
}
[menuBarItem setView:itemView];
[accountsMenu addItem:menuBarItem];
[accountsMenu addItem:[NSMenuItem separatorItem]];
}
// create "add a new account" menu item
......@@ -312,7 +320,7 @@ NSMenuItem* selectedMenuItem;
#pragma mark - NSPopUpButton item selection
- (IBAction)itemChanged:(id)sender {
NSInteger row = [(NSPopUpButton *)sender indexOfSelectedItem] / 2;
NSInteger row = [(NSPopUpButton *)sender indexOfSelectedItem];
auto accList = accMdl_->getAccountList();
if (row >= accList.size())
return;
......
......@@ -23,13 +23,13 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="230" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="230" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<box boxType="custom" borderType="none" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ZIZ-jd-eLK">
<rect key="frame" x="0.0" y="0.0" width="230" height="50"/>
<box boxType="custom" borderType="none" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ZIZ-jd-eLK">
<rect key="frame" x="0.0" y="0.0" width="230" height="60"/>
<view key="contentView" id="rZm-2b-CxI">
<rect key="frame" x="0.0" y="0.0" width="230" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="230" height="60"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<constraints>
......@@ -38,7 +38,7 @@
<color key="fillColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</box>
<button toolTip="Create New Account" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BkF-b3-tzE" customClass="HoverButton">
<rect key="frame" x="0.0" y="2" width="230" height="48"/>
<rect key="frame" x="0.0" y="0.0" width="230" height="60"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" imagePosition="overlaps" alignment="center" transparent="YES" imageScaling="proportionallyDown" id="lfv-A5-Wu4">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
......@@ -59,7 +59,7 @@
</userDefinedRuntimeAttributes>
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="V91-eS-dUh">
<rect key="frame" x="48" y="25" width="44" height="20"/>
<rect key="frame" x="48" y="30" width="44" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="VWk-wM-WSB"/>
</constraints>
......@@ -70,7 +70,7 @@
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" tag="100" translatesAutoresizingMaskIntoConstraints="NO" id="XKc-lc-K67">
<rect key="frame" x="5" y="5" width="40" height="40"/>
<rect key="frame" x="5" y="10" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="2Pd-xj-eIf"/>
<constraint firstAttribute="width" constant="40" id="IEA-OA-uSx"/>
......@@ -78,7 +78,7 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageAlignment="right" imageScaling="proportionallyDown" id="B0y-e0-cVi"/>
</imageView>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" tag="500" translatesAutoresizingMaskIntoConstraints="NO" id="TdK-5g-ddU" userLabel="AccountState" customClass="RoundedTextField">
<rect key="frame" x="33" y="5" width="14" height="14"/>
<rect key="frame" x="33" y="10" width="14" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="13.5" id="Mj5-H6-ylc"/>
<constraint firstAttribute="width" constant="9.5" id="aYl-Xd-vky"/>
......@@ -101,7 +101,7 @@
</userDefinedRuntimeAttributes>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tLn-uH-gZ6">
<rect key="frame" x="48" y="5" width="35" height="16"/>
<rect key="frame" x="48" y="10" width="35" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" title="Label" id="uPR-fc-nOP">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -109,7 +109,7 @@
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="IyH-ia-I3z">
<rect key="frame" x="105" y="15" width="20" height="20"/>
<rect key="frame" x="105" y="20" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="7xp-S1-EWG"/>
<constraint firstAttribute="width" constant="20" id="QGs-sS-H6l"/>
......@@ -117,7 +117,7 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSAddTemplate" id="9b9-Jo-NAF"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0PP-Di-b7L">
<rect key="frame" x="192" y="25" width="35" height="20"/>
<rect key="frame" x="192" y="30" width="35" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="8mL-jo-3Kb"/>
</constraints>
......@@ -131,26 +131,26 @@
<constraints>
<constraint firstAttribute="trailing" secondItem="BkF-b3-tzE" secondAttribute="trailing" id="4zr-zt-tNR"/>
<constraint firstItem="IyH-ia-I3z" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" id="6of-Nf-Di4"/>
<constraint firstItem="0PP-Di-b7L" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="5" id="7h7-LT-HCJ"/>
<constraint firstAttribute="bottom" secondItem="BkF-b3-tzE" secondAttribute="bottom" constant="2" id="Erj-JK-1Jc"/>
<constraint firstAttribute="bottom" secondItem="BkF-b3-tzE" secondAttribute="bottom" id="Erj-JK-1Jc"/>
<constraint firstAttribute="trailing" secondItem="0PP-Di-b7L" secondAttribute="trailing" constant="5" id="GU6-yw-2Nu"/>
<constraint firstItem="BkF-b3-tzE" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="M0t-ie-V4X"/>
<constraint firstItem="TdK-5g-ddU" firstAttribute="trailing" secondItem="XKc-lc-K67" secondAttribute="trailing" id="NU8-DL-jhB"/>
<constraint firstItem="0PP-Di-b7L" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="tLn-uH-gZ6" secondAttribute="trailing" constant="20" id="Nb4-Z8-9Ul"/>
<constraint firstItem="TdK-5g-ddU" firstAttribute="bottom" secondItem="XKc-lc-K67" secondAttribute="bottom" id="PGs-u9-1qr"/>
<constraint firstAttribute="bottom" secondItem="tLn-uH-gZ6" secondAttribute="bottom" constant="5" id="QNf-aN-2HB"/>
<constraint firstAttribute="bottom" secondItem="tLn-uH-gZ6" secondAttribute="bottom" constant="10" id="QNf-aN-2HB"/>
<constraint firstAttribute="bottom" secondItem="ZIZ-jd-eLK" secondAttribute="bottom" id="RRa-dJ-Zbr"/>
<constraint firstItem="ZIZ-jd-eLK" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="Rl2-Z2-XC6"/>
<constraint firstAttribute="bottom" secondItem="XKc-lc-K67" secondAttribute="bottom" constant="5" id="SOc-zB-t6m"/>
<constraint firstItem="V91-eS-dUh" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="5" id="SQI-pe-c4a"/>
<constraint firstAttribute="bottom" secondItem="XKc-lc-K67" secondAttribute="bottom" constant="10" id="SOc-zB-t6m"/>
<constraint firstItem="V91-eS-dUh" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="10" id="SQI-pe-c4a"/>
<constraint firstItem="XKc-lc-K67" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="5" id="TUF-fx-zE7"/>
<constraint firstItem="tLn-uH-gZ6" firstAttribute="leading" secondItem="V91-eS-dUh" secondAttribute="leading" id="WcF-NN-pmz"/>
<constraint firstItem="ZIZ-jd-eLK" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="X9L-7K-HGm"/>
<constraint firstItem="0PP-Di-b7L" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="V91-eS-dUh" secondAttribute="trailing" constant="20" id="ZH1-rk-GX6"/>
<constraint firstItem="IyH-ia-I3z" firstAttribute="centerY" secondItem="Hz6-mo-xeY" secondAttribute="centerY" id="hQd-Pw-y4Q"/>
<constraint firstItem="XKc-lc-K67" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="5" id="ipM-Ca-Man"/>
<constraint firstItem="XKc-lc-K67" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="10" id="ipM-Ca-Man"/>
<constraint firstAttribute="trailing" secondItem="ZIZ-jd-eLK" secondAttribute="trailing" id="nIe-my-eAj"/>
<constraint firstItem="V91-eS-dUh" firstAttribute="leading" secondItem="XKc-lc-K67" secondAttribute="trailing" constant="5" id="rBn-Ol-rkr"/>
<constraint firstItem="0PP-Di-b7L" firstAttribute="top" secondItem="V91-eS-dUh" secondAttribute="top" id="yBS-XS-NWz"/>
<constraint firstItem="BkF-b3-tzE" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="yKW-iG-nvv"/>
</constraints>
</customView>
......
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