Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
22f43c24
Commit
22f43c24
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
remove last UIActionSheet
parent
a2586287
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/mobile/iOS/Onelab/Parameter.mm
+42
-39
42 additions, 39 deletions
contrib/mobile/iOS/Onelab/Parameter.mm
with
42 additions
and
39 deletions
contrib/mobile/iOS/Onelab/Parameter.mm
+
42
−
39
View file @
22f43c24
...
...
@@ -72,29 +72,38 @@
std
::
vector
<
onelab
::
string
>
string
;
onelab
::
server
::
instance
()
->
get
(
string
,
[
name
UTF8String
]);
if
(
string
.
size
()
<
1
)
return
;
UIActionSheet
*
popupSelectValue
=
[[
UIActionSheet
alloc
]
initWithTitle
:[
Utils
getStringFromCString
:
string
[
0
].
getLabel
().
c_str
()]
delegate:
self
cancelButtonTitle
:
nil
destructiveButtonTitle
:
nil
otherButtonTitles:
nil
];
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
nil
message
:
nil
preferredStyle:
UIAlertControllerStyleActionSheet
];
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:
@"Cancel"
style:
UIAlertActionStyleCancel
handler:
^
(
UIAlertAction
*
action
)
{
}]];
std
::
vector
<
std
::
string
>
choices
=
string
[
0
].
getChoices
();
for
(
int
i
=
0
;
i
<
choices
.
size
();
i
++
)
[
popupSelectValue
addButtonWithTitle
:[
Utils
getStringFromCString
:
choices
[
i
].
c_str
()]];
[
popupSelectValue
addButtonWithTitle
:
@"Cancel"
];
[
popupSelectValue
setCancelButtonIndex
:
popupSelectValue
.
numberOfButtons
-
1
];
[
popupSelectValue
showInView
:
button
];
for
(
unsigned
int
i
=
0
;
i
<
choices
.
size
();
i
++
){
NSString
*
t
=
[
Utils
getStringFromCString
:
choices
[
i
].
c_str
()];
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:
t
style:
UIAlertActionStyleDefault
handler:
^
(
UIAlertAction
*
action
)
{
[
self
updateString
:
string
[
0
]
withValue
:
choices
[
i
]];
[
button
setTitle
:[
Utils
getStringFromCString
:
choices
[
i
].
c_str
()]
forState:
UIControlStateNormal
];
}]];
}
[
alertController
setModalPresentationStyle
:
UIModalPresentationPopover
];
UIPopoverPresentationController
*
popPresenter
=
[
alertController
popoverPresentationController
];
popPresenter
.
sourceView
=
button
;
popPresenter
.
sourceRect
=
button
.
bounds
;
// FIXME: is traverseResponderChainForUIViewController a good idea?
[[
Utils
traverseResponderChainForUIViewController
:
button
]
presentViewController
:
alertController
animated:
YES
completion
:
nil
];
}
-
(
void
)
actionSheet
:(
UIActionSheet
*
)
actionSheet
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
-
(
void
)
updateString
:
(
onelab
::
string
)
s
withValue
:(
std
::
string
)
v
{
std
::
vector
<
onelab
::
string
>
string
;
onelab
::
server
::
instance
()
->
get
(
string
,
[
name
UTF8String
]);
if
(
string
.
size
()
<
1
)
return
;
if
(
buttonIndex
<
string
[
0
].
getChoices
().
size
()){
std
::
string
selected
=
string
[
0
].
getChoices
()[
buttonIndex
];
string
[
0
].
setValue
(
selected
);
onelab
::
server
::
instance
()
->
set
(
string
[
0
]);
[
super
editValue
];
}
s
.
setValue
(
v
);
onelab
::
server
::
instance
()
->
set
(
s
);
[
super
editValue
];
}
-
(
void
)
refresh
...
...
@@ -145,30 +154,25 @@
std
::
vector
<
onelab
::
number
>
numbers
;
onelab
::
server
::
instance
()
->
get
(
numbers
,
[
name
UTF8String
]);
if
(
numbers
.
size
()
<
1
)
return
;
UIAlertController
*
alertController
;
UIAlertAction
*
destroyAction
;
alertController
=
[
UIAlertController
alertControllerWithTitle
:
nil
message
:
nil
preferredStyle:
UIAlertControllerStyleActionSheet
];
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
nil
message
:
nil
preferredStyle:
UIAlertControllerStyleActionSheet
];
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:
@"Cancel"
style:
UIAlertActionStyleCancel
handler:
^
(
UIAlertAction
*
action
)
{
}]];
std
::
vector
<
double
>
choices
=
numbers
[
0
].
getChoices
();
for
(
unsigned
int
i
=
0
;
i
<
choices
.
size
();
i
++
)
[
alertController
addAction:
[
UIAlertAction
actionWithTitle:
[
Utils
getStringFromCString
:
numbers
[
0
].
getValueLabel
(
choices
[
i
]).
c_str
()]
style:
UIAlertActionStyleDefault
handler
:
^
(
UIAlertAction
*
action
)
{
for
(
unsigned
int
i
=
0
;
i
<
choices
.
size
();
i
++
)
{
NSString
*
t
=
[
Utils
getStringFromCString
:
numbers
[
0
].
getValueLabel
(
choices
[
i
]).
c_str
()];
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:
t
style:
UIAlertActionStyleDefault
handler:
^
(
UIAlertAction
*
action
)
{
[
self
updateNumber
:
numbers
[
0
]
withValue
:
choices
[
i
]];
[
button
setTitle
:[
Utils
getStringFromCString
:
numbers
[
0
].
getValueLabel
(
i
).
c_str
()]
forState:
UIControlStateNormal
];
}]];
destroyAction
=
[
UIAlertAction
actionWithTitle
:
@"Cancel"
style:
UIAlertActionStyleDestructive
handler:
^
(
UIAlertAction
*
action
)
{
// do nothing
}];
[
alertController
addAction
:
destroyAction
];
}]];
}
[
alertController
setModalPresentationStyle
:
UIModalPresentationPopover
];
UIPopoverPresentationController
*
popPresenter
=
[
alertController
popoverPresentationController
];
popPresenter
.
sourceView
=
button
;
popPresenter
.
sourceRect
=
button
.
bounds
;
...
...
@@ -181,7 +185,6 @@
{
n
.
setValue
(
v
);
onelab
::
server
::
instance
()
->
set
(
n
);
[
super
editValue
];
}
...
...
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