Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-client-macos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-client-macos
Commits
53428a5d
Commit
53428a5d
authored
10 years ago
by
Alexandre Lision
Browse files
Options
Downloads
Patches
Plain Diff
accounts: add proxy model on account protocols
Refs #67077 Change-Id: If6a1f50e1d9fd22e3dd397fa654ccdb95cc791e2
parent
e1e9e6aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Accounts.xib
+27
-4
27 additions, 4 deletions
Accounts.xib
AccountsVC.mm
+23
-13
23 additions, 13 deletions
AccountsVC.mm
with
50 additions
and
17 deletions
Accounts.xib
+
27
−
4
View file @
53428a5d
...
...
@@ -11,7 +11,6 @@
<outlet
property=
"advancedTabItem"
destination=
"RT7-u6-bhe"
id=
"eAT-ce-MyD"
/>
<outlet
property=
"audioTabItem"
destination=
"hiU-GG-6Eg"
id=
"D2g-nf-MQS"
/>
<outlet
property=
"configPanels"
destination=
"Jki-s4-F1W"
id=
"nY4-dc-CQg"
/>
<outlet
property=
"generalItem"
destination=
"tPR-Ac-N5Y"
id=
"noJ-hl-xr4"
/>
<outlet
property=
"generalTabItem"
destination=
"tPR-Ac-N5Y"
id=
"39S-pz-1Xs"
/>
<outlet
property=
"protocolList"
destination=
"rZv-qd-BGe"
id=
"yU0-6C-Vt1"
/>
<outlet
property=
"ringTabItem"
destination=
"1HC-kF-Jun"
id=
"FJZ-2g-Y1i"
/>
...
...
@@ -33,7 +32,7 @@
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<outlineView
focusRingType=
"none"
verticalHuggingPriority=
"750"
allowsExpansionToolTips=
"YES"
columnAutoresizingStyle=
"lastColumnOnly"
multipleSelection=
"NO"
autosaveColumns=
"NO"
headerView=
"0lm-pU-hrg"
indentationPerLevel=
"16"
outlineTableColumn=
"Ppv-dQ-Azf"
id=
"Dsf-ph-Qfe"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"31
9
"
height=
"19"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"31
8
"
height=
"19"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<size
key=
"intercellSpacing"
width=
"3"
height=
"2"
/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
...
...
@@ -130,11 +129,11 @@
</connections>
</button>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"9VL-9a-rDg"
>
<rect
key=
"frame"
x=
"18"
y=
"110"
width=
"
48
"
height=
"17"
/>
<rect
key=
"frame"
x=
"18"
y=
"110"
width=
"
107
"
height=
"17"
/>
<constraints>
<constraint
firstAttribute=
"width"
relation=
"greaterThanOrEqual"
constant=
"41"
id=
"VFE-du-cB1"
/>
</constraints>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Create"
id=
"OZ9-qH-dYW"
>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Create
Account
"
id=
"OZ9-qH-dYW"
>
<font
key=
"font"
metaFont=
"systemBold"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"controlColor"
catalog=
"System"
colorSpace=
"catalog"
/>
...
...
@@ -200,6 +199,26 @@
<outlet
property=
"delegate"
destination=
"-2"
id=
"hfK-WK-DJT"
/>
</connections>
</tabView>
<button
verticalHuggingPriority=
"750"
misplaced=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"IqR-Q4-2bh"
>
<rect
key=
"frame"
x=
"266"
y=
"128"
width=
"80"
height=
"32"
/>
<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"
misplaced=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"dxk-Wh-H0B"
>
<rect
key=
"frame"
x=
"186"
y=
"128"
width=
"80"
height=
"32"
/>
<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>
</subviews>
<constraints>
<constraint
firstItem=
"99I-xI-Ioi"
firstAttribute=
"top"
secondItem=
"USD-1t-wb3"
secondAttribute=
"bottom"
constant=
"8"
id=
"1XJ-nm-ejL"
/>
...
...
@@ -207,21 +226,25 @@
<constraint
firstAttribute=
"bottom"
secondItem=
"Jki-s4-F1W"
secondAttribute=
"bottom"
constant=
"21"
id=
"C1O-rd-eUI"
/>
<constraint
firstItem=
"99I-xI-Ioi"
firstAttribute=
"leading"
secondItem=
"USD-1t-wb3"
secondAttribute=
"leading"
id=
"DEr-QA-KVD"
/>
<constraint
firstItem=
"9VL-9a-rDg"
firstAttribute=
"top"
secondItem=
"99I-xI-Ioi"
secondAttribute=
"bottom"
constant=
"8"
id=
"Hqz-b8-72b"
/>
<constraint
firstItem=
"dxk-Wh-H0B"
firstAttribute=
"top"
secondItem=
"USD-1t-wb3"
secondAttribute=
"bottom"
constant=
"8"
id=
"I6a-5r-IWG"
/>
<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=
"zWn-Zy-Uau"
firstAttribute=
"leading"
secondItem=
"9VL-9a-rDg"
secondAttribute=
"leading"
id=
"N5s-qp-4jy"
/>
<constraint
firstItem=
"zWn-Zy-Uau"
firstAttribute=
"top"
secondItem=
"9VL-9a-rDg"
secondAttribute=
"bottom"
constant=
"8"
id=
"PQk-F1-OVM"
/>
<constraint
firstItem=
"IqR-Q4-2bh"
firstAttribute=
"trailing"
secondItem=
"USD-1t-wb3"
secondAttribute=
"trailing"
id=
"PRl-vJ-LZB"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"zWn-Zy-Uau"
secondAttribute=
"bottom"
constant=
"81"
id=
"TKb-2d-r0S"
/>
<constraint
firstItem=
"zWn-Zy-Uau"
firstAttribute=
"bottom"
secondItem=
"rZv-qd-BGe"
secondAttribute=
"bottom"
id=
"UIa-O1-w7s"
/>
<constraint
firstItem=
"USD-1t-wb3"
firstAttribute=
"leading"
secondItem=
"Hz6-mo-xeY"
secondAttribute=
"leading"
constant=
"20"
id=
"UMl-rU-m5q"
/>
<constraint
firstItem=
"zWn-Zy-Uau"
firstAttribute=
"leading"
secondItem=
"99I-xI-Ioi"
secondAttribute=
"leading"
id=
"b1b-5h-ggf"
/>
<constraint
firstItem=
"zWn-Zy-Uau"
firstAttribute=
"leading"
secondItem=
"USD-1t-wb3"
secondAttribute=
"leading"
id=
"b7w-li-5Xd"
/>
<constraint
firstItem=
"IqR-Q4-2bh"
firstAttribute=
"top"
secondItem=
"USD-1t-wb3"
secondAttribute=
"bottom"
constant=
"8"
id=
"bn8-b3-3Bx"
/>
<constraint
firstItem=
"Jki-s4-F1W"
firstAttribute=
"top"
secondItem=
"Hz6-mo-xeY"
secondAttribute=
"top"
constant=
"20"
id=
"fez-KJ-jhG"
/>
<constraint
firstItem=
"USD-1t-wb3"
firstAttribute=
"top"
secondItem=
"Hz6-mo-xeY"
secondAttribute=
"top"
constant=
"20"
id=
"kk3-Vh-Zw5"
/>
<constraint
firstItem=
"zWn-Zy-Uau"
firstAttribute=
"leading"
secondItem=
"Hz6-mo-xeY"
secondAttribute=
"leading"
constant=
"20"
id=
"lRr-SS-K5h"
/>
<constraint
firstItem=
"Jki-s4-F1W"
firstAttribute=
"leading"
secondItem=
"USD-1t-wb3"
secondAttribute=
"trailing"
constant=
"8"
id=
"sH0-jY-3Fg"
/>
<constraint
firstItem=
"rZv-qd-BGe"
firstAttribute=
"leading"
secondItem=
"zWn-Zy-Uau"
secondAttribute=
"trailing"
constant=
"8"
id=
"y2z-JO-Y63"
/>
<constraint
firstItem=
"IqR-Q4-2bh"
firstAttribute=
"leading"
secondItem=
"dxk-Wh-H0B"
secondAttribute=
"trailing"
constant=
"12"
id=
"yYZ-UL-F0F"
/>
</constraints>
<point
key=
"canvasLocation"
x=
"517"
y=
"249.5"
/>
</customView>
...
...
This diff is collapsed.
Click to expand it.
AccountsVC.mm
+
23
−
13
View file @
53428a5d
...
...
@@ -49,6 +49,20 @@
#import "AccSecurityVC.h"
#import "AccRingVC.h"
// We disabled IAX protocol for now, so don't show it to the user
class
ActiveProtocolModel
:
public
QSortFilterProxyModel
{
public:
ActiveProtocolModel
(
QAbstractItemModel
*
parent
)
:
QSortFilterProxyModel
(
parent
)
{
setSourceModel
(
parent
);
}
virtual
bool
filterAcceptsRow
(
int
source_row
,
const
QModelIndex
&
source_parent
)
const
{
return
sourceModel
()
->
index
(
source_row
,
0
,
source_parent
).
flags
()
&
Qt
::
ItemIsEnabled
;
}
};
@interface
AccountsVC
()
@property
(
assign
)
IBOutlet
NSPopUpButton
*
protocolList
;
...
...
@@ -61,6 +75,7 @@
@property
(
retain
)
IBOutlet
NSTabViewItem
*
ringTabItem
;
@property
QNSTreeController
*
treeController
;
@property
ActiveProtocolModel
*
proxyProtocolModel
;
@property
(
assign
)
IBOutlet
NSOutlineView
*
accountsListView
;
@property
(
assign
)
IBOutlet
NSTabView
*
accountDetailsView
;
...
...
@@ -85,14 +100,7 @@
@synthesize
accountsListView
;
@synthesize
accountDetailsView
;
@synthesize
treeController
;
-
(
id
)
initWithCoder
:(
NSCoder
*
)
aDecoder
{
if
(
self
=
[
super
initWithCoder
:
aDecoder
])
{
NSLog
(
@"INIT Accounts VC"
);
}
return
self
;
}
@synthesize
proxyProtocolModel
;
-
(
void
)
awakeFromNib
{
...
...
@@ -117,6 +125,7 @@
});
self
.
proxyProtocolModel
=
new
ActiveProtocolModel
(
AccountModel
::
instance
()
->
protocolModel
());
QModelIndex
qProtocolIdx
=
AccountModel
::
instance
()
->
protocolModel
()
->
selectionModel
()
->
currentIndex
();
[
self
.
protocolList
addItemWithTitle
:
AccountModel
:
:
instance
()
->
protocolModel
()
->
data
(
qProtocolIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
...
...
@@ -157,13 +166,12 @@
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
();
NSString
*
newAccName
=
[[
NSString
alloc
]
initWithFormat
:
@"
New
%@ account"
,
NSString
*
newAccName
=
[[
NSString
alloc
]
initWithFormat
:
@"%@ account"
,
AccountModel
:
:
instance
()
->
protocolModel
()
->
data
(
qIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
(),
nil
];
Account
*
newAcc
=
AccountModel
::
instance
()
->
add
([
newAccName
UTF8String
],
qIdx
);
...
...
@@ -172,8 +180,9 @@
-
(
IBAction
)
protocolSelectedChanged
:(
id
)
sender
{
int
index
=
[
sender
indexOfSelectedItem
];
QModelIndex
proxyIdx
=
proxyProtocolModel
->
index
(
index
,
0
);
AccountModel
::
instance
()
->
protocolModel
()
->
selectionModel
()
->
setCurrentIndex
(
AccountModel
::
instance
()
->
protocolModel
()
->
index
(
inde
x
),
QItemSelectionModel
::
ClearAndSelect
);
proxyProtocolModel
->
mapToSource
(
proxyId
x
),
QItemSelectionModel
::
ClearAndSelect
);
}
...
...
@@ -357,7 +366,8 @@
-
(
BOOL
)
menu
:(
NSMenu
*
)
menu
updateItem
:(
NSMenuItem
*
)
item
atIndex
:(
NSInteger
)
index
shouldCancel
:(
BOOL
)
shouldCancel
{
QModelIndex
qIdx
=
AccountModel
::
instance
()
->
protocolModel
()
->
index
(
index
);
QModelIndex
proxyIdx
=
proxyProtocolModel
->
index
(
index
,
0
);
QModelIndex
qIdx
=
AccountModel
::
instance
()
->
protocolModel
()
->
index
(
proxyProtocolModel
->
mapToSource
(
proxyIdx
).
row
());
[
item
setTitle
:
AccountModel
:
:
instance
()
->
protocolModel
()
->
data
(
qIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
return
YES
;
...
...
@@ -365,7 +375,7 @@
-
(
NSInteger
)
numberOfItemsInMenu
:(
NSMenu
*
)
menu
{
return
AccountModel
::
instance
()
->
p
rotocolModel
()
->
rowCount
();
return
proxyP
rotocolModel
->
rowCount
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment