Commit f46768fd authored by Alexandre Lision's avatar Alexandre Lision

accounts: cleanup UI

- add delete icon in account general details panel
- remove up and down buttons (not used/explained)

Tuleap: #335
Change-Id: Iee1efc57b0b93b3187696da61f244ca0a737f5e0
parent c1f96660
......@@ -214,6 +214,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_persons.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_history.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/general.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/video.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_delete.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_video.png)
SET_SOURCE_FILES_PROPERTIES(${ring_ICONS} PROPERTIES
......
......@@ -80,6 +80,11 @@ typedef NS_ENUM(NSInteger, TagViews) {
AccountModel::instance().selectedAccount()->setHasCustomUserAgent([sender state] == NSOnState);
}
- (IBAction)removeAccount:(id)sender {
AccountModel::instance().remove(AccountModel::instance().selectedAccount());
AccountModel::instance().save();
}
- (void)loadAccount
{
auto account = AccountModel::instance().selectedAccount();
......
......@@ -16,12 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define ALIAS_TAG 0
#define HOSTNAME_TAG 1
#define USERNAME_TAG 2
#define PASSWORD_TAG 3
#define USERAGENT_TAG 4
#import "AccRingVC.h"
#import <accountmodel.h>
......@@ -55,12 +49,18 @@
@synthesize userAgentTextField;
@synthesize allowContacts, allowHistory, allowUnknown;
typedef NS_ENUM(NSInteger, TagViews) {
ALIAS = 0,
HOSTNAME,
USERAGENT,
};
- (void)awakeFromNib
{
NSLog(@"INIT Ring VC");
[aliasTextField setTag:ALIAS_TAG];
[userAgentTextField setTag:USERAGENT_TAG];
[bootstrapField setTag:HOSTNAME_TAG];
[aliasTextField setTag:TagViews::ALIAS];
[userAgentTextField setTag:TagViews::USERAGENT];
[bootstrapField setTag:TagViews::HOSTNAME];
QObject::connect(AccountModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
......@@ -71,15 +71,14 @@
});
}
- (Account*) currentAccount
{
auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
return AccountModel::instance().getAccountByModelIndex(accIdx);
- (IBAction)removeAccount:(id)sender {
AccountModel::instance().remove(AccountModel::instance().selectedAccount());
AccountModel::instance().save();
}
- (void)loadAccount
{
auto account = [self currentAccount];
auto account = AccountModel::instance().selectedAccount();
[self.aliasTextField setStringValue:account->alias().toNSString()];
......@@ -110,28 +109,28 @@
}
- (IBAction)toggleUpnp:(NSButton *)sender {
[self currentAccount]->setUpnpEnabled([sender state] == NSOnState);
AccountModel::instance().selectedAccount()->setUpnpEnabled([sender state] == NSOnState);
}
- (IBAction)toggleAutoAnswer:(NSButton *)sender {
[self currentAccount]->setAutoAnswer([sender state] == NSOnState);
AccountModel::instance().selectedAccount()->setAutoAnswer([sender state] == NSOnState);
}
- (IBAction)toggleCustomAgent:(NSButton *)sender {
[self.userAgentTextField setEnabled:[sender state] == NSOnState];
[self currentAccount]->setHasCustomUserAgent([sender state] == NSOnState);
AccountModel::instance().selectedAccount()->setHasCustomUserAgent([sender state] == NSOnState);
}
- (IBAction)toggleAllowFromUnknown:(id)sender {
[self currentAccount]->setAllowIncomingFromUnknown([sender state] == NSOnState);
AccountModel::instance().selectedAccount()->setAllowIncomingFromUnknown([sender state] == NSOnState);
[allowHistory setEnabled:![sender state] == NSOnState];
[allowContacts setEnabled:![sender state] == NSOnState];
}
- (IBAction)toggleAllowFromHistory:(id)sender {
[self currentAccount]->setAllowIncomingFromHistory([sender state] == NSOnState);
AccountModel::instance().selectedAccount()->setAllowIncomingFromHistory([sender state] == NSOnState);
}
- (IBAction)toggleAllowFromContacts:(id)sender {
[self currentAccount]->setAllowIncomingFromContact([sender state] == NSOnState);
AccountModel::instance().selectedAccount()->setAllowIncomingFromContact([sender state] == NSOnState);
}
#pragma mark - NSTextFieldDelegate methods
......@@ -146,18 +145,15 @@
NSTextField *textField = [notif object];
switch ([textField tag]) {
case ALIAS_TAG:
[self currentAccount]->setAlias([[textField stringValue] UTF8String]);
[self currentAccount]->setDisplayName([[textField stringValue] UTF8String]);
break;
case HOSTNAME_TAG:
[self currentAccount]->setHostname([[textField stringValue] UTF8String]);
case TagViews::ALIAS:
AccountModel::instance().selectedAccount()->setAlias([[textField stringValue] UTF8String]);
AccountModel::instance().selectedAccount()->setDisplayName([[textField stringValue] UTF8String]);
break;
case PASSWORD_TAG:
[self currentAccount]->setPassword([[textField stringValue] UTF8String]);
case TagViews::HOSTNAME:
AccountModel::instance().selectedAccount()->setHostname([[textField stringValue] UTF8String]);
break;
case USERAGENT_TAG:
[self currentAccount]->setUserAgent([[textField stringValue] UTF8String]);
case TagViews::USERAGENT:
AccountModel::instance().selectedAccount()->setUserAgent([[textField stringValue] UTF8String]);
break;
default:
break;
......
......@@ -172,22 +172,6 @@ typedef NS_ENUM(NSUInteger, Action) {
delete proxyProtocolModel;
}
- (IBAction)moveUp:(id)sender {
AccountModel::instance().moveUp();
}
- (IBAction)moveDown:(id)sender {
AccountModel::instance().moveDown();
}
- (IBAction)removeAccount:(id)sender {
if(treeController.selectedNodes.count > 0) {
QModelIndex qIdx = [treeController toQIdx:[treeController selectedNodes][0]];
AccountModel::instance().remove(qIdx);
AccountModel::instance().save();
}
}
- (IBAction)addAccount:(id)sender {
QModelIndex qIdx = AccountModel::instance().protocolModel()->selectionModel()->currentIndex();
......
......@@ -188,6 +188,16 @@
<action selector="toggleUpnp:" target="-2" id="pl8-QR-BBc"/>
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p00-of-ToC">
<rect key="frame" x="532" y="273" width="30" height="30"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ic_delete" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="u1c-BX-hXL">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="removeAccount:" target="-2" id="uzp-ub-gsq"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="POs-9R-DUW" firstAttribute="leading" secondItem="3ZB-JI-U6Y" secondAttribute="trailing" constant="8" id="I7j-dS-1py"/>
......@@ -200,4 +210,7 @@
<point key="canvasLocation" x="13" y="8.5"/>
</customView>
</objects>
<resources>
<image name="ic_delete" width="72" height="72"/>
</resources>
</document>
......@@ -213,10 +213,26 @@
</fragment>
</attributedString>
</textField>
<button translatesAutoresizingMaskIntoConstraints="NO" id="Ozb-Bq-opJ">
<rect key="frame" x="579" y="414" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="1k4-J3-F2v"/>
<constraint firstAttribute="height" constant="30" id="GrG-YX-xfO"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ic_delete" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="jda-Gm-dN1">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="removeAccount:" target="-2" id="QAc-I1-OZP"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="Zpn-KI-Jfm" firstAttribute="leading" secondItem="reK-M8-Eie" secondAttribute="leading" id="0aK-Ci-93E"/>
<constraint firstAttribute="centerX" secondItem="c6M-WV-uVk" secondAttribute="centerX" id="4bm-Jh-lHq"/>
<constraint firstItem="Ozb-Bq-opJ" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="7uN-Mu-ngw"/>
<constraint firstAttribute="trailing" secondItem="Ozb-Bq-opJ" secondAttribute="trailing" constant="20" id="Mbz-PD-D32"/>
<constraint firstItem="D7f-4A-xXM" firstAttribute="leading" secondItem="idQ-yZ-XB3" secondAttribute="trailing" constant="8" id="UB7-B8-DZ4"/>
<constraint firstItem="idQ-yZ-XB3" firstAttribute="trailing" secondItem="PJq-0f-wMN" secondAttribute="trailing" id="bRe-Xq-vE7"/>
<constraint firstItem="fJM-4J-mvZ" firstAttribute="leading" secondItem="e6G-kW-opo" secondAttribute="trailing" constant="8" id="nAb-oD-B0a"/>
......@@ -228,4 +244,7 @@
</customView>
<userDefaultsController representsSharedInstance="YES" id="OEq-Ja-Vda"/>
</objects>
<resources>
<image name="ic_delete" width="72" height="72"/>
</resources>
</document>
......@@ -65,13 +65,13 @@
</connections>
</tabView>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="57" horizontalPageScroll="10" verticalLineScroll="57" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZBN-hf-rGe">
<rect key="frame" x="20" y="149" width="250" height="400"/>
<rect key="frame" x="20" y="115" width="250" height="500"/>
<clipView key="contentView" id="f8N-NI-2Mk">
<rect key="frame" x="0.0" y="0.0" width="250" height="400"/>
<rect key="frame" x="0.0" y="0.0" width="250" height="500"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" autosaveColumns="NO" rowHeight="55" rowSizeStyle="automatic" viewBased="YES" outlineTableColumn="eOe-f3-q88" id="jXv-6I-P9R" customClass="RingOutlineView">
<rect key="frame" x="0.0" y="0.0" width="250" height="0.0"/>
<rect key="frame" x="0.0" y="0.0" width="250" height="500"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
......@@ -161,7 +161,7 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<constraints>
<constraint firstAttribute="height" constant="400" id="UBl-FT-gaL"/>
<constraint firstAttribute="height" constant="500" id="UBl-FT-gaL"/>
<constraint firstAttribute="width" constant="250" id="aC0-6T-CUo"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="x1l-v5-r0B">
......@@ -173,22 +173,8 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<button identifier="RemoveAccount" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="99I-xI-Ioi">
<rect key="frame" x="14" y="113" width="82" height="32"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="Lcf-3l-7oj"/>
<constraint firstAttribute="width" constant="70" id="YaI-pj-FUh"/>
</constraints>
<buttonCell key="cell" type="push" bezelStyle="rounded" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ziu-EK-QJX">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="removeAccount:" target="-2" id="h9h-4J-fcH"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zWn-Zy-Uau">
<rect key="frame" x="14" y="562" width="82" height="32"/>
<rect key="frame" x="14" y="54" width="82" height="32"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="wC2-dX-oeG"/>
</constraints>
......@@ -201,7 +187,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9VL-9a-rDg">
<rect key="frame" x="18" y="598" width="105" height="17"/>
<rect key="frame" x="18" y="90" width="105" height="17"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="41" id="VFE-du-cB1"/>
</constraints>
......@@ -212,7 +198,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rZv-qd-BGe">
<rect key="frame" x="96" y="566" width="177" height="26"/>
<rect key="frame" x="96" y="58" width="177" height="26"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" identifier="protocolList" imageScaling="proportionallyDown" inset="2" id="bfy-Lh-jXj">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
......@@ -226,34 +212,12 @@
<action selector="protocolSelectedChanged:" target="-2" id="83Y-L0-Bav"/>
</connections>
</popUpButton>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IqR-Q4-2bh">
<rect key="frame" x="199" y="113" width="77" height="32"/>
<constraints>
<constraint firstAttribute="width" constant="65" id="QQX-uY-Hq2"/>
</constraints>
<buttonCell key="cell" type="push" title="Down" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6Co-ei-tUA">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="moveDown:" target="-2" id="0GS-Xo-bu7"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dxk-Wh-H0B">
<rect key="frame" x="126" y="113" width="77" height="32"/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="on2-tl-jhF">
<rect key="frame" x="116" y="13" width="80" height="32"/>
<constraints>
<constraint firstAttribute="width" constant="65" id="ZIi-di-Z52"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="68" id="COM-pP-trH"/>
<constraint firstAttribute="height" constant="21" id="zSJ-GQ-dyi"/>
</constraints>
<buttonCell key="cell" type="push" title="Up" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="HoA-BH-xam">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="moveUp:" target="-2" id="Na8-jb-xhV"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="on2-tl-jhF">
<rect key="frame" x="59" y="50" width="80" height="32"/>
<buttonCell key="cell" type="push" title="Import" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="zov-Bb-Fgp">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
......@@ -262,8 +226,12 @@
<action selector="importAccount:" target="-2" id="0Dl-fT-SY4"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8zw-sS-2ZT">
<rect key="frame" x="152" y="50" width="80" height="32"/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8zw-sS-2ZT">
<rect key="frame" x="196" y="13" width="80" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="68" id="YuZ-Gp-CPP"/>
<constraint firstAttribute="height" constant="21" id="xKV-h7-UOA"/>
</constraints>
<buttonCell key="cell" type="push" title="Export" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OeK-Sf-pdc">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
......@@ -274,32 +242,28 @@
</button>
</subviews>
<constraints>
<constraint firstItem="9VL-9a-rDg" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="6f4-PL-Fhx"/>
<constraint firstAttribute="bottom" secondItem="Jki-s4-F1W" secondAttribute="bottom" constant="20" id="C1O-rd-eUI"/>
<constraint firstAttribute="trailing" secondItem="Jki-s4-F1W" secondAttribute="trailing" constant="20" id="J96-3h-sxa"/>
<constraint firstItem="zWn-Zy-Uau" firstAttribute="top" secondItem="rZv-qd-BGe" secondAttribute="top" id="KqW-8M-1Ad"/>
<constraint firstItem="99I-xI-Ioi" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="Mif-e1-csx"/>
<constraint firstItem="IqR-Q4-2bh" firstAttribute="top" secondItem="ZBN-hf-rGe" secondAttribute="bottom" constant="8" id="MpQ-8y-79O"/>
<constraint firstItem="zWn-Zy-Uau" firstAttribute="leading" secondItem="9VL-9a-rDg" secondAttribute="leading" id="N5s-qp-4jy"/>
<constraint firstItem="Jki-s4-F1W" firstAttribute="leading" secondItem="8zw-sS-2ZT" secondAttribute="trailing" constant="8" id="Pc6-IH-cZd"/>
<constraint firstItem="rZv-qd-BGe" firstAttribute="trailing" secondItem="ZBN-hf-rGe" secondAttribute="trailing" id="UlG-Hv-ZCc"/>
<constraint firstItem="ZBN-hf-rGe" firstAttribute="top" secondItem="rZv-qd-BGe" secondAttribute="bottom" constant="20" id="Zpc-1R-BnS"/>
<constraint firstItem="Jki-s4-F1W" firstAttribute="leading" secondItem="ZBN-hf-rGe" secondAttribute="trailing" constant="8" id="Zzg-Tr-BVP"/>
<constraint firstItem="Jki-s4-F1W" firstAttribute="leading" secondItem="IqR-Q4-2bh" secondAttribute="trailing" constant="8" id="aSV-XE-k1u"/>
<constraint firstItem="zWn-Zy-Uau" firstAttribute="leading" secondItem="99I-xI-Ioi" secondAttribute="leading" id="b1b-5h-ggf"/>
<constraint firstItem="9VL-9a-rDg" firstAttribute="top" secondItem="ZBN-hf-rGe" secondAttribute="bottom" constant="8" id="dl0-mM-why"/>
<constraint firstItem="Jki-s4-F1W" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="fez-KJ-jhG"/>
<constraint firstItem="rZv-qd-BGe" firstAttribute="top" secondItem="9VL-9a-rDg" secondAttribute="bottom" constant="8" id="ge2-uV-Gff"/>
<constraint firstItem="ZBN-hf-rGe" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="jPM-jY-R59"/>
<constraint firstItem="on2-tl-jhF" firstAttribute="top" secondItem="rZv-qd-BGe" secondAttribute="bottom" constant="20" id="lRd-oa-cDr"/>
<constraint firstItem="zWn-Zy-Uau" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="lRr-SS-K5h"/>
<constraint firstItem="IqR-Q4-2bh" firstAttribute="leading" secondItem="dxk-Wh-H0B" secondAttribute="trailing" constant="8" id="pYF-s0-cSa"/>
<constraint firstItem="99I-xI-Ioi" firstAttribute="top" secondItem="ZBN-hf-rGe" secondAttribute="bottom" constant="8" id="qlR-1N-Pj8"/>
<constraint firstItem="8zw-sS-2ZT" firstAttribute="top" secondItem="rZv-qd-BGe" secondAttribute="bottom" constant="20" id="rVH-wD-IKs"/>
<constraint firstItem="8zw-sS-2ZT" firstAttribute="leading" secondItem="on2-tl-jhF" secondAttribute="trailing" constant="12" id="sDm-KA-PB0"/>
<constraint firstItem="ZBN-hf-rGe" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="u8B-Kk-OHn"/>
<constraint firstItem="rZv-qd-BGe" firstAttribute="leading" secondItem="zWn-Zy-Uau" secondAttribute="trailing" constant="8" id="y2z-JO-Y63"/>
<constraint firstItem="dxk-Wh-H0B" firstAttribute="top" secondItem="ZBN-hf-rGe" secondAttribute="bottom" constant="8" id="zTd-2r-hid"/>
</constraints>
<point key="canvasLocation" x="542" y="273.5"/>
</customView>
</objects>
<resources>
<image name="NSAddTemplate" width="11" height="11"/>
<image name="NSRemoveTemplate" width="11" height="11"/>
</resources>
</document>
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