Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
glacier-home
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
glacier-home
Commits
134c2ba6
Commit
134c2ba6
authored
Jul 11, 2014
by
Aleksi Suomalainen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[usbmode] USB mode selector.
parent
6bd69873
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
163 additions
and
0 deletions
+163
-0
USBModeSelector.qml
src/qml/USBModeSelector.qml
+163
-0
No files found.
src/qml/USBModeSelector.qml
0 → 100644
View file @
134c2ba6
import
QtQuick
2.0
import
org
.
nemomobile
.
lipstick
0.1
Item
{
property
bool
isPortrait
:
(
orientationAngleContextProperty
.
value
==
90
||
orientationAngleContextProperty
.
value
==
270
)
id
:
usbWindow
width
:
initialSize
.
width
height
:
initialSize
.
height
/*
TODO
ContextProperty {
id: orientationAngleContextProperty
key: "/Screen/CurrentWindow/OrientationAngle"
}
*/
QtObject
{
id
:
orientationAngleContextProperty
property
int
value
:
0
}
Item
{
property
bool
shouldBeVisible
id
:
usbDialog
width
:
usbWindow
.
isPortrait
?
usbWindow
.
height
:
usbWindow
.
width
height
:
usbWindow
.
isPortrait
?
usbWindow
.
width
:
usbWindow
.
height
transform
:
Rotation
{
origin.x
:
{
switch
(
orientationAngleContextProperty
.
value
)
{
case
270
:
return
usbWindow
.
height
/
2
case
180
:
case
90
:
return
usbWindow
.
width
/
2
default
:
return
0
}
}
origin
.
y
:
{
switch
(
orientationAngleContextProperty
.
value
)
{
case
270
:
case
180
:
return
usbWindow
.
height
/
2
case
90
:
return
usbWindow
.
width
/
2
default
:
return
0
}
}
angle
:
(
orientationAngleContextProperty
.
value
===
undefined
||
orientationAngleContextProperty
.
value
==
0
)
?
0
:
-
360
+
orientationAngleContextProperty
.
value
}
opacity
:
shouldBeVisible
?
1
:
0
Rectangle
{
anchors.fill
:
parent
color
:
"
black
"
opacity
:
0.8
border.color
:
"
white
"
}
MouseArea
{
id
:
usbDialogBackground
anchors.fill
:
parent
onClicked
:
{
usbModeSelector
.
setUSBMode
(
4
);
usbDialog
.
shouldBeVisible
=
false
}
Rectangle
{
id
:
chargingOnly
anchors
{
top
:
parent
.
top
left
:
parent
.
left
right
:
parent
.
right
topMargin
:
parent
.
height
/
4
}
height
:
102
color
:
"
black
"
radius
:
5
border
{
color
:
"
gray
"
width
:
2
}
Text
{
anchors
{
fill
:
parent
}
text
:
"
Current mode: Charging only
"
color
:
"
white
"
font.pixelSize
:
30
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
}
}
Text
{
id
:
button1
anchors
{
top
:
chargingOnly
.
bottom
topMargin
:
40
left
:
parent
.
left
right
:
parent
.
right
}
text
:
"
MTP Mode
"
color
:
"
white
"
font.pixelSize
:
30
wrapMode
:
Text
.
WordWrap
horizontalAlignment
:
Text
.
AlignHCenter
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
usbModeSelector
.
setUSBMode
(
11
);
usbDialog
.
shouldBeVisible
=
false
}
}
}
Text
{
id
:
button2
anchors
{
top
:
button1
.
bottom
topMargin
:
40
left
:
parent
.
left
right
:
parent
.
right
}
text
:
"
Mass Storage Mode
"
color
:
"
white
"
font.pixelSize
:
30
wrapMode
:
Text
.
WordWrap
horizontalAlignment
:
Text
.
AlignHCenter
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
usbModeSelector
.
setUSBMode
(
3
);
usbDialog
.
shouldBeVisible
=
false
}
}
}
Text
{
id
:
button3
anchors
{
top
:
button2
.
bottom
topMargin
:
40
left
:
parent
.
left
right
:
parent
.
right
}
text
:
"
Developer Mode
"
color
:
"
white
"
font.pixelSize
:
30
wrapMode
:
Text
.
WordWrap
horizontalAlignment
:
Text
.
AlignHCenter
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
usbModeSelector
.
setUSBMode
(
10
);
usbDialog
.
shouldBeVisible
=
false
}
}
}
}
Connections
{
target
:
usbModeSelector
onWindowVisibleChanged
:
if
(
usbModeSelector
.
windowVisible
)
usbDialog
.
shouldBeVisible
=
true
}
Behavior
on
opacity
{
NumberAnimation
{
duration
:
250
onRunningChanged
:
if
(
!
running
&&
usbDialog
.
opacity
==
0
)
usbModeSelector
.
windowVisible
=
false
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment