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
e9156fc8
Commit
e9156fc8
authored
Nov 13, 2014
by
Aleksi Suomalainen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #30 from locusf/master
Orientation and small fixes
parents
6a3fc00e
797b89ee
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
104 additions
and
7 deletions
+104
-7
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
+22
-0
nemovars.conf
src/nemovars.conf
+1
-0
MainScreen.qml
src/qml/MainScreen.qml
+12
-1
Statusbar.qml
src/qml/Statusbar.qml
+4
-2
compositor.qml
src/qml/compositor.qml
+4
-0
rotation.js
src/qml/scripts/rotation.js
+55
-0
src.pro
src/src.pro
+4
-2
No files found.
rpm/lipstick-glacier-home-qt5.spec
View file @
e9156fc8
...
...
@@ -9,7 +9,7 @@ Name: lipstick-glacier-home-qt5
# << macros
Summary: A nice homescreen for Glacier experience
Version: 0.1
5
Version: 0.1
6
Release: 1
Group: System/GUI/Other
License: BSD
...
...
rpm/lipstick-glacier-home-qt5.yaml
View file @
e9156fc8
Name
:
lipstick-glacier-home-qt5
Summary
:
A nice homescreen for Glacier experience
Version
:
0.1
5
Version
:
0.1
6
Release
:
1
Group
:
System/GUI/Other
License
:
BSD
...
...
src/main.cpp
View file @
e9156fc8
...
...
@@ -28,6 +28,7 @@
#include <QQmlEngine>
#include <QQmlContext>
#include "glacierwindowmodel.h"
#include <QScreen>
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -36,6 +37,27 @@ int main(int argc, char **argv)
QGuiApplication
::
setFont
(
QFont
(
"Open Sans"
));
app
.
setCompositorPath
(
"/usr/share/lipstick-glacier-home-qt5/qml/compositor.qml"
);
Qt
::
ScreenOrientation
nativeOrientation
=
app
.
primaryScreen
()
->
nativeOrientation
();
QByteArray
v
=
qgetenv
(
"GLACIER_NATIVEORIENTATION"
);
if
(
!
v
.
isEmpty
())
{
switch
(
v
.
toInt
())
{
case
1
:
nativeOrientation
=
Qt
::
PortraitOrientation
;
break
;
case
2
:
nativeOrientation
=
Qt
::
LandscapeOrientation
;
break
;
case
4
:
nativeOrientation
=
Qt
::
InvertedPortraitOrientation
;
break
;
case
8
:
nativeOrientation
=
Qt
::
InvertedLandscapeOrientation
;
break
;
default:
nativeOrientation
=
app
.
primaryScreen
()
->
nativeOrientation
();
}
}
app
.
engine
()
->
rootContext
()
->
setContextProperty
(
"nativeOrientation"
,
v
);
qmlRegisterType
<
GlacierWindowModel
>
(
"org.nemomobile.glacier"
,
1
,
0
,
"GlacierWindowModel"
);
app
.
setQmlPath
(
"/usr/share/lipstick-glacier-home-qt5/qml/MainScreen.qml"
);
// Give these to the environment inside the lipstick homescreen
...
...
src/nemovars.conf
View file @
e9156fc8
QT_QUICK_CONTROLS_STYLE
=
Nemo
GLACIER_NATIVEORIENTATION
=
1
src/qml/MainScreen.qml
View file @
e9156fc8
...
...
@@ -36,10 +36,11 @@ import QtQuick.Controls.Styles.Nemo 1.0
import
QtQuick
.
Window
2.1
import
org
.
nemomobile
.
time
1.0
import
org
.
nemomobile
.
configuration
1.0
import
org
.
nemomobile
.
lipstick
0.1
import
"
scripts/desktop.js
"
as
Desktop
import
"
scripts/rotation.js
"
as
Rotation
Page
{
// This is used in the favorites page and in the lock screen
WallClock
{
id
:
wallClock
...
...
@@ -56,6 +57,7 @@ Page {
property
alias
lockscreen
:
lockScreen
property
alias
switcher
:
switcher
// Implements back key navigation
Keys.onReleased
:
{
if
(
event
.
key
===
Qt
.
Key_Back
)
{
if
(
pageStack
.
depth
>
1
)
{
...
...
@@ -69,6 +71,15 @@ Page {
id
:
statusbar
}
orientation
:
Lipstick
.
compositor
.
screenOrientation
onOrientationChanged
:
{
Rotation
.
rotateObject
(
desktop
.
parent
,
Screen
.
angleBetween
(
orientation
,
Screen
.
primaryOrientation
),
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
))
}
onParentChanged
:
{
Rotation
.
rotateObject
(
desktop
.
parent
,
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
),
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
))
}
Component
.
onCompleted
:
{
Desktop
.
instance
=
desktop
}
...
...
src/qml/Statusbar.qml
View file @
e9156fc8
...
...
@@ -125,7 +125,7 @@ Item {
font.pointSize
:
6
font.bold
:
true
wrapMode
:
Text
.
ElideRight
text
:
(
cellularNetworkName
!==
""
)
?
cellularNetworkName
.
value
.
substring
(
0
,
3
).
toUpperCase
()
:
"
N/
A
"
text
:
(
cellularNetworkName
.
value
!==
""
)
?
cellularNetworkName
.
value
.
substring
(
0
,
3
).
toUpperCase
()
:
"
N
A
"
}
Label
{
...
...
@@ -136,7 +136,7 @@ Item {
font.pointSize
:
6
text
:
{
var
techToG
=
{
gprs
:
"
2
"
,
egprs
:
"
2.5
"
,
umts
:
"
3
"
,
hspa
:
"
3.5
"
,
lte
:
"
4
"
,
unknown
:
"
0
"
}
return
techToG
[
cellularDataTechnology
.
value
]
+
"
G
"
return
techToG
[
cellularDataTechnology
.
value
?
cellularDataTechnology
.
value
:
"
unknown
"
]
+
"
G
"
}
}
panel
:
SimPanel
{}
...
...
@@ -212,6 +212,8 @@ Item {
return
"
qrc:/qml/images/battery4.png
"
}
else
if
(
batteryChargePercentage
.
value
<=
80
)
{
return
"
qrc:/qml/images/battery5.png
"
}
else
{
return
"
qrc:/qml/images/battery6.png
"
}
}
}
...
...
src/qml/compositor.qml
View file @
e9156fc8
...
...
@@ -70,6 +70,10 @@ Compositor {
}
}
onSensorOrientationChanged
:
{
screenOrientation
=
sensorOrientation
}
Connections
{
target
:
root
onActiveFocusItemChanged
:
{
...
...
src/qml/scripts/rotation.js
0 → 100644
View file @
e9156fc8
/****************************************************************************************
**
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
function
rotateObject
(
obj
,
r
,
nr
)
{
if
(
obj
.
rotation
!==
r
)
{
var
nativeIsPortrait
=
((
nr
===
0
)
||
(
nr
===
180
))
var
isPortrait
=
((
r
===
0
)
||
(
r
===
180
))
var
correction
=
0
var
isNative
=
((
nativeIsPortrait
||
isPortrait
)
&&
!
(
nativeIsPortrait
&&
isPortrait
))
//xor
//xor
if
((
isNative
||
!
nativeIsPortrait
)
&&
!
(
isNative
&&
!
nativeIsPortrait
))
{
correction
=
obj
.
width
/
2
-
obj
.
height
/
2
}
var
diff
=
Math
.
abs
(
r
-
obj
.
rotation
)
obj
.
rotation
=
r
if
((
diff
===
90
)
||
(
diff
===
270
))
{
console
.
log
(
"
rotateObject swapping w,h
"
)
var
w
=
obj
.
width
obj
.
width
=
obj
.
height
obj
.
height
=
w
}
obj
.
x
=
correction
obj
.
y
=
-
correction
}
}
src/src.pro
View file @
e9156fc8
...
...
@@ -43,7 +43,8 @@ qmlcompositor.files = qml/compositor/WindowWrapperMystic.qml \
qml
/
compositor
/
ScreenGestureArea
.
qml
scripts
.
path
=
/
usr
/
share
/
lipstick
-
glacier
-
home
-
qt5
/
qml
/
scripts
scripts
.
files
=
qml
/
scripts
/
desktop
.
js
scripts
.
files
=
qml
/
scripts
/
desktop
.
js
\
qml
/
scripts
/
rotation
.
js
system
.
path
=
/
usr
/
share
/
lipstick
-
glacier
-
home
-
qt5
/
qml
/
system
system
.
files
=
qml
/
ShutdownScreen
.
qml
...
...
@@ -104,6 +105,7 @@ OTHER_FILES += qml/*.qml \
qml/VolumeControl.qml \
qml/BatteryPanel.qml \
qml/CommonPanel.qml \
qml/ShutdownScreen.qml
qml/ShutdownScreen.qml \
qml/scripts/rotation.js
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