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
79a7eb36
Commit
79a7eb36
authored
Nov 14, 2014
by
Aleksi Suomalainen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #31 from filippz/master
Rotation logic rewrite and bugfix
parents
e9156fc8
11ac1239
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
27 deletions
+47
-27
lipstick-glacier-home-qt5.spec
rpm/lipstick-glacier-home-qt5.spec
+1
-1
lipstick-glacier-home-qt5.yaml
rpm/lipstick-glacier-home-qt5.yaml
+1
-1
main.cpp
src/main.cpp
+1
-1
GlacierRotation.qml
src/qml/GlacierRotation.qml
+33
-19
MainScreen.qml
src/qml/MainScreen.qml
+8
-3
src.pro
src/src.pro
+3
-2
No files found.
rpm/lipstick-glacier-home-qt5.spec
View file @
79a7eb36
...
@@ -9,7 +9,7 @@ Name: lipstick-glacier-home-qt5
...
@@ -9,7 +9,7 @@ Name: lipstick-glacier-home-qt5
# << macros
# << macros
Summary: A nice homescreen for Glacier experience
Summary: A nice homescreen for Glacier experience
Version: 0.1
6
Version: 0.1
7
Release: 1
Release: 1
Group: System/GUI/Other
Group: System/GUI/Other
License: BSD
License: BSD
...
...
rpm/lipstick-glacier-home-qt5.yaml
View file @
79a7eb36
Name
:
lipstick-glacier-home-qt5
Name
:
lipstick-glacier-home-qt5
Summary
:
A nice homescreen for Glacier experience
Summary
:
A nice homescreen for Glacier experience
Version
:
0.1
6
Version
:
0.1
7
Release
:
1
Release
:
1
Group
:
System/GUI/Other
Group
:
System/GUI/Other
License
:
BSD
License
:
BSD
...
...
src/main.cpp
View file @
79a7eb36
...
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
...
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
nativeOrientation
=
app
.
primaryScreen
()
->
nativeOrientation
();
nativeOrientation
=
app
.
primaryScreen
()
->
nativeOrientation
();
}
}
}
}
app
.
engine
()
->
rootContext
()
->
setContextProperty
(
"nativeOrientation"
,
v
);
app
.
engine
()
->
rootContext
()
->
setContextProperty
(
"nativeOrientation"
,
nativeOrientation
);
qmlRegisterType
<
GlacierWindowModel
>
(
"org.nemomobile.glacier"
,
1
,
0
,
"GlacierWindowModel"
);
qmlRegisterType
<
GlacierWindowModel
>
(
"org.nemomobile.glacier"
,
1
,
0
,
"GlacierWindowModel"
);
app
.
setQmlPath
(
"/usr/share/lipstick-glacier-home-qt5/qml/MainScreen.qml"
);
app
.
setQmlPath
(
"/usr/share/lipstick-glacier-home-qt5/qml/MainScreen.qml"
);
// Give these to the environment inside the lipstick homescreen
// Give these to the environment inside the lipstick homescreen
...
...
src/qml/
scripts/rotation.js
→
src/qml/
GlacierRotation.qml
View file @
79a7eb36
...
@@ -29,27 +29,41 @@
...
@@ -29,27 +29,41 @@
**
**
****************************************************************************************/
****************************************************************************************/
function
rotateObject
(
obj
,
r
,
nr
)
{
import
QtQuick
2.1
import
QtQuick
.
Window
2.1
import
org
.
nemomobile
.
lipstick
0.1
if
(
obj
.
rotation
!==
r
)
{
Item
{
var
nativeIsPortrait
=
((
nr
===
0
)
||
(
nr
===
180
))
var
isPortrait
=
((
r
===
0
)
||
(
r
===
180
))
var
correction
=
0
QtObject
{
var
isNative
=
((
nativeIsPortrait
||
isPortrait
)
&&
!
(
nativeIsPortrait
&&
isPortrait
))
//xor
id
:
privateProperties
//xor
property
int
nativeRotation
:
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
)
if
((
isNative
||
!
nativeIsPortrait
)
&&
!
(
isNative
&&
!
nativeIsPortrait
))
{
property
bool
nativeIsPortrait
:
((
nativeRotation
===
0
)
||
(
nativeRotation
===
180
))
correction
=
obj
.
width
/
2
-
obj
.
height
/
2
}
}
var
diff
=
Math
.
abs
(
r
-
obj
.
rotation
)
function
rotateObject
(
obj
,
o
)
{
obj
.
rotation
=
r
if
((
diff
===
90
)
||
(
diff
===
270
))
{
var
r
=
Screen
.
angleBetween
(
o
,
Screen
.
primaryOrientation
)
console
.
log
(
"
rotateObject swapping w,h
"
)
if
(
obj
.
rotation
!==
r
)
{
var
w
=
obj
.
width
obj
.
width
=
obj
.
height
var
isPortrait
=
((
r
===
0
)
||
(
r
===
180
))
obj
.
height
=
w
var
correction
=
0
var
isNative
=
((
privateProperties
.
nativeIsPortrait
||
isPortrait
)
&&
!
(
privateProperties
.
nativeIsPortrait
&&
isPortrait
))
//xor
var
diff
=
Math
.
abs
(
r
-
obj
.
rotation
)
//xor
if
((
isNative
||
!
privateProperties
.
nativeIsPortrait
)
&&
!
(
isNative
&&
!
privateProperties
.
nativeIsPortrait
))
{
correction
=
obj
.
width
/
2
-
obj
.
height
/
2
if
(
diff
===
180
)
correction
=
-
correction
}
obj
.
rotation
=
r
if
((
diff
===
90
)
||
(
diff
===
270
))
{
var
w
=
obj
.
width
obj
.
width
=
obj
.
height
obj
.
height
=
w
}
obj
.
x
=
correction
obj
.
y
=
-
correction
}
}
obj
.
x
=
correction
obj
.
y
=
-
correction
}
}
}
}
src/qml/MainScreen.qml
View file @
79a7eb36
...
@@ -38,7 +38,6 @@ import org.nemomobile.time 1.0
...
@@ -38,7 +38,6 @@ import org.nemomobile.time 1.0
import
org
.
nemomobile
.
configuration
1.0
import
org
.
nemomobile
.
configuration
1.0
import
org
.
nemomobile
.
lipstick
0.1
import
org
.
nemomobile
.
lipstick
0.1
import
"
scripts/desktop.js
"
as
Desktop
import
"
scripts/desktop.js
"
as
Desktop
import
"
scripts/rotation.js
"
as
Rotation
Page
{
Page
{
// This is used in the favorites page and in the lock screen
// This is used in the favorites page and in the lock screen
...
@@ -71,17 +70,23 @@ Page {
...
@@ -71,17 +70,23 @@ Page {
id
:
statusbar
id
:
statusbar
}
}
GlacierRotation
{
id
:
glacierRotation
}
orientation
:
Lipstick
.
compositor
.
screenOrientation
orientation
:
Lipstick
.
compositor
.
screenOrientation
onOrientationChanged
:
{
onOrientationChanged
:
{
Rotation
.
rotateObject
(
desktop
.
parent
,
Screen
.
angleBetween
(
orientation
,
Screen
.
primaryOrientation
),
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
)
)
glacierRotation
.
rotateObject
(
desktop
.
parent
,
orientation
)
}
}
onParentChanged
:
{
onParentChanged
:
{
Rotation
.
rotateObject
(
desktop
.
parent
,
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
),
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
)
)
glacierRotation
.
rotateObject
(
desktop
.
parent
,
nativeOrientation
)
}
}
Component
.
onCompleted
:
{
Component
.
onCompleted
:
{
Desktop
.
instance
=
desktop
Desktop
.
instance
=
desktop
Lipstick
.
compositor
.
screenOrientation
=
nativeOrientation
}
}
function
lockscreenVisible
()
{
function
lockscreenVisible
()
{
...
...
src/src.pro
View file @
79a7eb36
...
@@ -34,7 +34,8 @@ qml.files = qml/MainScreen.qml \
...
@@ -34,7 +34,8 @@ qml.files = qml/MainScreen.qml \
qml
/
VolumeControl
.
qml
\
qml
/
VolumeControl
.
qml
\
qml
/
BatteryPanel
.
qml
\
qml
/
BatteryPanel
.
qml
\
qml
/
CommonPanel
.
qml
\
qml
/
CommonPanel
.
qml
\
qml
/
ShutdownScreen
.
qml
qml
/
ShutdownScreen
.
qml
\
qml
/
GlacierRotation
.
qml
qmlcompositor
.
path
=
/
usr
/
share
/
lipstick
-
glacier
-
home
-
qt5
/
qml
/
compositor
qmlcompositor
.
path
=
/
usr
/
share
/
lipstick
-
glacier
-
home
-
qt5
/
qml
/
compositor
qmlcompositor
.
files
=
qml
/
compositor
/
WindowWrapperMystic
.
qml
\
qmlcompositor
.
files
=
qml
/
compositor
/
WindowWrapperMystic
.
qml
\
...
@@ -106,6 +107,6 @@ OTHER_FILES += qml/*.qml \
...
@@ -106,6 +107,6 @@ OTHER_FILES += qml/*.qml \
qml/BatteryPanel.qml \
qml/BatteryPanel.qml \
qml/CommonPanel.qml \
qml/CommonPanel.qml \
qml/ShutdownScreen.qml \
qml/ShutdownScreen.qml \
qml/
scripts/rotation.js
qml/
GlacierRotation.qml
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