Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
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
qtquickcontrols-nemo
Commits
7a03018b
Commit
7a03018b
authored
Aug 03, 2017
by
Aleksi Suomalainen
Committed by
GitHub
Aug 03, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into inversemousearea
parents
ea3e9c68
d5b5ecee
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
599 additions
and
294 deletions
+599
-294
IconPage.qml
examples/touch/content/IconPage.qml
+68
-0
main.qml
examples/touch/main.qml
+4
-0
touch.pro
examples/touch/touch.pro
+3
-17
ApplicationWindow.qml
src/controls/ApplicationWindow.qml
+345
-262
HeaderToolsLayout.qml
src/controls/HeaderToolsLayout.qml
+3
-3
IconButton.qml
src/controls/IconButton.qml
+71
-0
controls.pro
src/controls/controls.pro
+2
-1
nemoimageprovider.cpp
src/controls/nemoimageprovider.cpp
+5
-0
nemoimageprovider.h
src/controls/nemoimageprovider.h
+1
-0
qmldir
src/controls/qmldir
+1
-0
sizing.cpp
src/controls/sizing.cpp
+23
-0
sizing.h
src/controls/sizing.h
+3
-0
mlocalthemedaemonclient.cpp
src/controls/themedaemon/mlocalthemedaemonclient.cpp
+22
-10
mlocalthemedaemonclient.h
src/controls/themedaemon/mlocalthemedaemonclient.h
+2
-0
ButtonStyle.qml
src/styles/ButtonStyle.qml
+1
-1
IconButtonStyle.qml
src/styles/IconButtonStyle.qml
+43
-0
qmldir
src/styles/qmldir
+1
-0
styles.pro
src/styles/styles.pro
+1
-0
No files found.
examples/touch/content/IconPage.qml
0 → 100644
View file @
7a03018b
/****************************************************************************************
**
** Copyright (C) 2017 Eetu Kahelin
** 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.
**
****************************************************************************************/
import
QtQuick
2.6
import
QtQuick
.
Controls
1.0
//needed for the Stack attached property
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
Page
{
id
:
root
headerTools
:
HeaderToolsLayout
{
showBackButton
:
true
;
title
:
"
Icon example
"
}
allowedOrientations
:
Qt
.
PortraitOrientation
|
Qt
.
LandscapeOrientation
|
Qt
.
InvertedLandscapeOrientation
|
Qt
.
InvertedPortraitOrientation
Column
{
spacing
:
Theme
.
itemSpacingMedium
anchors.centerIn
:
parent
//fontawesome
IconButton
{
source
:
"
image://theme/compass
"
}
//fontawesome
IconButton
{
width
:
height
height
:
Theme
.
itemHeightExtraLarge
source
:
"
image://theme/bell
"
enabled
:
false
}
//fontawesome
IconButton
{
source
:
"
image://theme/address-book?
"
+
Theme
.
fillColor
}
//glacier
IconButton
{
width
:
height
height
:
Theme
.
itemHeightExtraLarge
source
:
"
image://theme/icon-m-framework-close-thumbnail
"
}
}
}
examples/touch/main.qml
View file @
7a03018b
...
...
@@ -116,6 +116,10 @@ ApplicationWindow {
title
:
"
Query Dialog
"
page
:
"
content/QueryDialogPage.qml
"
}
ListElement
{
title
:
"
Icons
"
page
:
"
content/IconPage.qml
"
}
}
...
...
examples/touch/touch.pro
View file @
7a03018b
...
...
@@ -24,29 +24,15 @@ qml.files += \
content
/
ButtonRowPage
.
qml
\
content
/
QueryDialogPage
.
qml
\
content
/
ListViewPage
.
qml
\
content
/
SelectRollerPage
.
qml
content
/
SelectRollerPage
.
qml
\
content
/
IconPage
.
qml
qml
.
path
=
/
usr
/
share
/
glacier
-
components
/
content
images
.
files
=
images
/*
.png
images.path = /usr/share/glacier-components/images
OTHER_FILES += \
main.qml \
content/AndroidDelegate.qml \
content/ButtonPage.qml \
content/ProgressBarPage.qml \
content/SliderPage.qml \
content/TabBarPage.qml \
content/TextInputPage.qml \
content/LiveCoding.qml \
content/SpinnerPage.qml \
content/LabelPage.qml \
content/CheckboxPage.qml \
content/ButtonRowPage.qml \
content/QueryDialogPage.qml \
content/ListViewPage.qml \
content/SelectRollerPage.qml
OTHER_FILES += $$qml.files
desktop.path = /usr/share/applications
...
...
src/controls/ApplicationWindow.qml
View file @
7a03018b
/*
* Copyright (C) 2013 Andrea Bernabei <and.bernabei@gmail.com>
* Copyright (C) 2013 Jolla Ltd.
* Copyright (C) 2017 Eetu Kahelin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
...
...
@@ -28,15 +30,14 @@ import QtQuick.Controls.Styles.Nemo 1.0
NemoWindow
{
id
:
root
width
:
320
height
:
640
property
alias
header
:
toolBar
/*! \internal */
default
property
alias
data
:
contentArea
.
data
property
alias
pageStack
:
stackView
property
alias
initialPage
:
stackView
.
initialItem
property
bool
applicationActive
:
Qt
.
application
.
active
property
alias
orientation
:
contentArea
.
uiOrientation
readonly
property
int
isUiPortrait
:
orientation
==
Qt
.
PortraitOrientation
||
orientation
==
Qt
.
InvertedPortraitOrientation
...
...
@@ -140,294 +141,376 @@ NemoWindow {
Item
{
id
:
backgroundItem
anchors.centerIn
:
parent
// NOTE: Using Screen.height/width will cause issues when the app is not fullscreen (e.g. when testing using Qt desktop)
// because in that case the app window will be smaller but the content will still be for fullscreen size
width
:
__transpose
?
Screen
.
height
:
Screen
.
width
height
:
__transpose
?
Screen
.
width
:
Screen
.
height
anchors.fill
:
parent
rotation
:
rotationToTransposeToPortrait
()
//This is the rotating item
Item
{
id
:
contentArea
width
:
parent
.
width
height
:
parent
.
height
anchors.centerIn
:
parent
property
int
_horizontalDimension
:
parent
?
parent
.
width
:
0
property
int
_verticalDimension
:
parent
?
parent
.
height
:
0
property
alias
defaultOrientationTransition
:
orientationState
.
defaultTransition
// This is used for states switching
property
int
filteredOrientation
//this is the reliable value which changes during the orientation transition
property
int
uiOrientation
property
bool
orientationTransitionRunning
:
false
StackView
{
id
:
stackView
anchors.top
:
root
.
isUiPortrait
?
toolBar
.
bottom
:
parent
.
top
anchors.right
:
parent
.
right
anchors.left
:
root
.
isUiPortrait
?
parent
.
left
:
toolBar
.
right
anchors.bottom
:
parent
.
bottom
clip
:
true
Component.onCompleted
:
stackInitialized
=
true
//IMPORTANT: this property makes it so that at app startup we wait for the initial page to be pushed
//before determining the initial ui orientation (see the states logic below)
//If we don't use this, the orientation will change first time based on NemoWindow's allowedOrientation,
//and the second time based on the allowedOrientations of the initialItem of the stack.
//Using this property avoids that, and make the UI directly start in the correct orientation
//TODO: find a cleaner way to do it (if there's any)
property
bool
stackInitialized
:
false
onStackInitializedChanged
:
if
(
stackInitialized
)
{
//set Screen.orientation as default, if allowed
if
(
root
.
isOrientationAllowed
(
Screen
.
orientation
))
{
contentArea
.
filteredOrientation
=
Screen
.
orientation
}
else
{
//let the window handle it, it will fall back to an allowed orientation
root
.
fallbackToAnAllowedOrientation
()
}
}
//this has to be a function, property won't work inside onCurrentItemChanged, as the property binding hasn't been updated yet there
//(hence we'd be using the old currentItem)
function
_isCurrentItemNemoPage
()
{
return
currentItem
&&
currentItem
.
hasOwnProperty
(
"
__isNemoPage
"
)
}
//update orientation constraints when a Page is pushed/popped
onCurrentItemChanged
:
{
if
(
_isCurrentItemNemoPage
())
root
.
orientationConstraintsChanged
()
}
id
:
clipping
//This properties are accessible for free by the Page via Stack.view.<property>
readonly
property
int
orientation
:
contentArea
.
uiOrientation
property
alias
allowedOrientations
:
root
.
allowedOrientations
property
alias
orientationTransitionRunning
:
contentArea
.
orientationTransitionRunning
z
:
1
width
:
parent
.
width
-
(
isUiLandscape
?
stackView
.
panelSize
:
0
)
height
:
parent
.
height
-
(
isUiPortrait
?
stackView
.
panelSize
:
0
)
clip
:
stackView
.
panelSize
>
0
Connections
{
id
:
pageConn
target
:
stackView
.
_isCurrentItemNemoPage
()
?
stackView
.
currentItem
:
null
onAllowedOrientationsChanged
:
root
.
orientationConstraintsChanged
()
//This is the rotating item
Item
{
id
:
contentArea
anchors.centerIn
:
parent
transform
:
Scale
{
id
:
contentScale
property
bool
animationRunning
:
xAnim
.
running
||
yAnim
.
running
Behavior
on
xScale
{
NumberAnimation
{
id
:
xAnim
;
duration
:
100
}
}
Behavior
on
yScale
{
NumberAnimation
{
id
:
yAnim
;
duration
:
100
}
}
}
delegate
:
StackViewDelegate
{
pushTransition
:
Component
{
StackViewTransition
{
PropertyAnimation
{
target
:
enterItem
property
:
"
x
"
from
:
target
.
width
to
:
0
duration
:
500
easing.type
:
Easing
.
OutQuad
}
PropertyAnimation
{
target
:
exitItem
property
:
"
x
"
from
:
0
to
:
-
target
.
width
duration
:
500
easing.type
:
Easing
.
OutQuad
}
property
int
_horizontalDimension
:
parent
?
parent
.
width
:
0
property
int
_verticalDimension
:
parent
?
parent
.
height
:
0
property
alias
defaultOrientationTransition
:
orientationState
.
defaultTransition
// This is used for states switching
property
int
filteredOrientation
//this is the reliable value which changes during the orientation transition
property
int
uiOrientation
property
bool
orientationTransitionRunning
:
false
StackView
{
id
:
stackView
anchors.top
:
root
.
isUiPortrait
?
toolBar
.
bottom
:
parent
.
top
anchors.right
:
parent
.
right
anchors.left
:
root
.
isUiPortrait
?
parent
.
left
:
toolBar
.
right
anchors.bottom
:
parent
.
bottom
property
real
panelSize
:
0
property
real
previousImSize
:
0
property
real
imSize
:
!
root
.
applicationActive
?
0
:
(
isUiPortrait
?
(
root
.
_transpose
?
Qt
.
inputMethod
.
keyboardRectangle
.
width
:
Qt
.
inputMethod
.
keyboardRectangle
.
height
)
:
(
root
.
_transpose
?
Qt
.
inputMethod
.
keyboardRectangle
.
height
:
Qt
.
inputMethod
.
keyboardRectangle
.
width
))
onImSizeChanged
:
{
if
(
imSize
<=
0
&&
previousImSize
>
0
)
{
imShowAnimation
.
stop
()
imHideAnimation
.
start
()
}
else
if
(
imSize
>
0
&&
previousImSize
<=
0
)
{
imHideAnimation
.
stop
()
imShowAnimation
.
to
=
imSize
imShowAnimation
.
start
()
}
else
{
panelSize
=
imSize
}
previousImSize
=
imSize
}
popTransition
:
Component
{
StackViewTransition
{
PropertyAnimation
{
target
:
enterItem
property
:
"
x
"
from
:
-
target
.
width
to
:
0
duration
:
500
easing.type
:
Easing
.
OutQuad
}
PropertyAnimation
{
target
:
exitItem
property
:
"
x
"
from
:
0
to
:
target
.
width
duration
:
500
easing.type
:
Easing
.
OutQuad
}
}
clip
:
true
Component.onCompleted
:
{
stackInitialized
=
true
}
//IMPORTANT: this property makes it so that at app startup we wait for the initial page to be pushed
//before determining the initial ui orientation (see the states logic below)
//If we don't use this, the orientation will change first time based on NemoWindow's allowedOrientation,
//and the second time based on the allowedOrientations of the initialItem of the stack.
//Using this property avoids that, and make the UI directly start in the correct orientation
//TODO: find a cleaner way to do it (if there's any)
property
bool
stackInitialized
:
false
onStackInitializedChanged
:
if
(
stackInitialized
)
{
//set Screen.orientation as default, if allowed
if
(
root
.
isOrientationAllowed
(
Screen
.
orientation
))
{
contentArea
.
filteredOrientation
=
Screen
.
orientation
}
else
{
//let the window handle it, it will fall back to an allowed orientation
root
.
fallbackToAnAllowedOrientation
()
}
}
}
}
//this has to be a function, property won't work inside onCurrentItemChanged, as the property binding hasn't been updated yet there
//(hence we'd be using the old currentItem)
function
_isCurrentItemNemoPage
()
{
return
currentItem
&&
currentItem
.
hasOwnProperty
(
"
__isNemoPage
"
)
}
Header
{
id
:
toolBar
stackView
:
root
.
pageStack
appWindow
:
root
//update orientation constraints when a Page is pushed/popped
onCurrentItemChanged
:
{
if
(
_isCurrentItemNemoPage
())
root
.
orientationConstraintsChanged
()
}
//used to animate the dimmer when pages are pushed/popped (see Header's QML code)
property
alias
__dimmer
:
headerDimmerContainer
}
//This properties are accessible for free by the Page via Stack.view.<property>
readonly
property
int
orientation
:
contentArea
.
uiOrientation
property
alias
allowedOrientations
:
root
.
allowedOrientations
property
alias
orientationTransitionRunning
:
contentArea
.
orientationTransitionRunning
Item
{
//This item handles the rotation of the dimmer.
//All this because QML doesn't have a horizontal gradient (unless you import GraphicalEffects)
//and having a container which doesn't rotate but just resizes makes it easier to rotate its inner
//child
id
:
headerDimmerContainer
//README: Don't use AnchorChanges for this item!
//Reason: state changes disable bindings while the transition from one state to another is running.
//This causes the dimmer not to follow the drawer when the drawer is closed right before the orientation change
anchors.top
:
isUiPortrait
?
toolBar
.
bottom
:
parent
.
top
anchors.left
:
isUiPortrait
?
parent
.
left
:
toolBar
.
right
anchors.right
:
isUiPortrait
?
parent
.
right
:
undefined
anchors.bottom
:
isUiPortrait
?
undefined
:
parent
.
bottom
//we only set the size in one orientation, the anchors will take care of the other
width
:
if
(
!
isUiPortrait
)
Theme
.
itemHeightExtraSmall
/
2
height
:
if
(
isUiPortrait
)
Theme
.
itemHeightExtraSmall
/
2
//MAKE SURE THAT THE HEIGHT SPECIFIED BY THE THEME IS AN EVEN NUMBER, TO AVOID ROUNDING ERRORS IN THE LAYOUT
Rectangle
{
id
:
headerDimmer
anchors.centerIn
:
parent
gradient
:
Gradient
{
GradientStop
{
position
:
0
;
color
:
Theme
.
backgroundColor
}
GradientStop
{
position
:
1
;
color
:
"
transparent
"
}
Connections
{
id
:
pageConn
target
:
stackView
.
_isCurrentItemNemoPage
()
?
stackView
.
currentItem
:
null
onAllowedOrientationsChanged
:
root
.
orientationConstraintsChanged
()
}
}
}
Item
{
id
:
orientationState
state
:
'
Unanimated
'
states
:
[
State
{
name
:
'
Unanimated
'
when
:
!
stackView
||
!
stackInitialized
},
State
{
name
:
'
Portrait
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
PortraitOrientation
// && stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_horizontalDimension
height
:
_verticalDimension
rotation
:
0
uiOrientation
:
Qt
.
PortraitOrientation
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
width
rotation
:
0
}
},
State
{
name
:
'
Landscape
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
LandscapeOrientation
//&& stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_verticalDimension
height
:
_horizontalDimension
rotation
:
90
uiOrientation
:
Qt
.
LandscapeOrientation
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
height
rotation
:
-
90
}
},
State
{
name
:
'
PortraitInverted
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
InvertedPortraitOrientation
//&& stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_horizontalDimension
height
:
_verticalDimension
rotation
:
180
uiOrientation
:
Qt
.
InvertedPortraitOrientation
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
width
rotation
:
0
}
},
State
{
name
:
'
LandscapeInverted
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
InvertedLandscapeOrientation
//&& stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_verticalDimension
height
:
_horizontalDimension
rotation
:
270
uiOrientation
:
Qt
.
InvertedLandscapeOrientation
delegate
:
StackViewDelegate
{
pushTransition
:
Component
{
StackViewTransition
{
PropertyAnimation
{
target
:
enterItem
property
:
"
x
"
from
:
target
.
width
to
:
0
duration
:
500
easing.type
:
Easing
.
OutQuad
}
PropertyAnimation
{
target
:
exitItem
property
:
"
x
"
from
:
0
to
:
-
target
.
width
duration
:
500
easing.type
:
Easing
.
OutQuad
}
}
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
height
rotation
:
-
90
popTransition
:
Component
{
StackViewTransition
{
PropertyAnimation
{
target
:
enterItem
property
:
"
x
"
from
:
-
target
.
width
to
:
0
duration
:
500
easing.type
:
Easing
.
OutQuad
}
PropertyAnimation
{
target
:
exitItem
property
:
"
x
"
from
:
0
to
:
target
.
width
duration
:
500
easing.type
:
Easing
.
OutQuad
}
}
}
}
]
property
Transition
defaultTransition
:
Transition
{
to
:
'
Portrait,Landscape,PortraitInverted,LandscapeInverted
'
from
:
'
Portrait,Landscape,PortraitInverted,LandscapeInverted
'
}
SequentialAnimation
{
PropertyAction
{
target
:
contentArea
property
:
'
orientationTransitionRunning
'
value
:
true
id
:
imHideAnimation
PauseAnimation
{
duration
:
200
}
NumberAnimation
{
target
:
contentArea
property
:
'
opacity
'
target
:
stackView
property
:
'
panelSize
'
to
:
0
duration
:
150
duration
:
200
easing.type
:
Easing
.
InOutQuad
}
PropertyAction
{
target
:
contentArea
properties
:
'
width,height,rotation,uiOrientation
'
}
AnchorAnimation
{
duration
:
0
}
PropertyAction
{
target
:
headerDimmer
properties
:
'
width,height,rotation
'
}
NumberAnimation
{
id
:
imShowAnimation
target
:
stackView
property
:
'
panelSize
'
duration
:
200
easing.type
:
Easing
.
InOutQuad
}
}
Header
{
id
:
toolBar
stackView
:
root
.
pageStack
appWindow
:
root
//used to animate the dimmer when pages are pushed/popped (see Header's QML code)
property
alias
__dimmer
:
headerDimmerContainer
}
Item
{
//This item handles the rotation of the dimmer.
//All this because QML doesn't have a horizontal gradient (unless you import GraphicalEffects)
//and having a container which doesn't rotate but just resizes makes it easier to rotate its inner
//child
id
:
headerDimmerContainer
//README: Don't use AnchorChanges for this item!
//Reason: state changes disable bindings while the transition from one state to another is running.
//This causes the dimmer not to follow the drawer when the drawer is closed right before the orientation change
anchors.top
:
isUiPortrait
?
toolBar
.
bottom
:
parent
.
top
anchors.left
:
isUiPortrait
?
parent
.
left
:
toolBar
.
right
anchors.right
:
isUiPortrait
?
parent
.
right
:
undefined
anchors.bottom
:
isUiPortrait
?
undefined
:
parent
.
bottom
//we only set the size in one orientation, the anchors will take care of the other
width
:
if
(
!
isUiPortrait
)
Theme
.
itemHeightExtraSmall
/
2
height
:
if
(
isUiPortrait
)
Theme
.
itemHeightExtraSmall
/
2
//MAKE SURE THAT THE HEIGHT SPECIFIED BY THE THEME IS AN EVEN NUMBER, TO AVOID ROUNDING ERRORS IN THE LAYOUT
Rectangle
{
id
:
headerDimmer
anchors.centerIn
:
parent
gradient
:
Gradient
{
GradientStop
{
position
:
0
;
color
:
Theme
.
backgroundColor
}
GradientStop
{
position
:
1
;
color
:
"
transparent
"
}
}
NumberAnimation
{
target
:
contentArea
property
:
'
opacity
'
to
:
1
duration
:
150
}
}
Item
{
id
:
orientationState
state
:
'
Unanimated
'
states
:
[
State
{
name
:
'
Unanimated
'
when
:
!
stackView
||
!
stackInitialized
},
State
{
name
:
'
Portrait
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
PortraitOrientation
// && stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_horizontalDimension
height
:
_verticalDimension
rotation
:
0
uiOrientation
:
Qt
.
PortraitOrientation
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
width
rotation
:
0
}
AnchorChanges
{
target
:
clipping
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.right
:
undefined
anchors.bottom
:
undefined
}
},
State
{
name
:
'
Landscape
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
LandscapeOrientation
//&& stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_verticalDimension
height
:
_horizontalDimension
rotation
:
90
uiOrientation
:
Qt
.
LandscapeOrientation
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
height
rotation
:
-
90
}
AnchorChanges
{
target
:
clipping
anchors.top
:
undefined
anchors.left
:
undefined
anchors.right
:
parent
.
right
anchors.bottom
:
parent
.
bottom
}
},
State
{
name
:
'
PortraitInverted
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
InvertedPortraitOrientation
//&& stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_horizontalDimension
height
:
_verticalDimension
rotation
:
180
uiOrientation
:
Qt
.
InvertedPortraitOrientation
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
width
rotation
:
0
}
AnchorChanges
{
target
:
clipping
anchors.top
:
undefined
anchors.left
:
undefined
anchors.right
:
parent
.
right
anchors.bottom
:
parent
.
bottom
}
},
State
{
name
:
'
LandscapeInverted
'
when
:
contentArea
.
filteredOrientation
===
Qt
.
InvertedLandscapeOrientation
//&& stackInitialized
PropertyChanges
{
target
:
contentArea
restoreEntryValues
:
false
width
:
_verticalDimension
height
:
_horizontalDimension
rotation
:
270
uiOrientation
:
Qt
.
InvertedLandscapeOrientation
}
PropertyChanges
{
target
:
headerDimmer
height
:
Theme
.
itemHeightExtraSmall
/
2
width
:
parent
.
height
rotation
:
-
90
}
AnchorChanges
{
target
:
clipping
anchors.top
:
undefined
anchors.left
:
parent
.
left
anchors.right
:
undefined
anchors.bottom
:
parent
.
bottom
}
}
PropertyAction
{
target
:
contentArea
property
:
'
orientationTransitionRunning
'
value
:
false
]
property
Transition
defaultTransition
:
Transition
{
to
:
'
Portrait,Landscape,PortraitInverted,LandscapeInverted
'
from
:
'
Portrait,Landscape,PortraitInverted,LandscapeInverted
'
SequentialAnimation
{
PropertyAction
{
target
:
contentArea
property
:
'
orientationTransitionRunning
'
value
:
true
}
NumberAnimation
{
target
:
contentArea
property
:
'
opacity
'
to
:
0
duration
:
150
}
PropertyAction
{
target
:
contentArea
properties
:
'
width,height,rotation,uiOrientation
'
}
AnchorAnimation
{
duration
:
0
}
PropertyAction
{
target
:
headerDimmer
properties
:
'
width,height,rotation
'
}
NumberAnimation
{
target
:
contentArea
property
:
'
opacity
'
to
:
1
duration
:
150
}
PropertyAction
{
target
:
contentArea
property
:
'
orientationTransitionRunning
'
value
:
false
}
}
}
}
Component.onCompleted
:
{
if
(
transitions
.
length
===
0
)
{
transitions
=
[
defaultTransition
]
Component.onCompleted
:
{
if
(
transitions
.
length
===
0
)
{
transitions
=
[
defaultTransition
]
}
}
}
}
...
...
src/controls/HeaderToolsLayout.qml
View file @
7a03018b
...
...
@@ -22,7 +22,8 @@ Item {
property
bool
isUiPortrait
:
header
&&
header
.
appWindow
.
isUiPortrait
property
bool
showBackButton
:
false
property
int
toolMeasure
:
parent
.
width
/
10
height
:
toolMeasure
Rectangle
{
id
:
backButton
width
:
opacity
?
size
.
dp
(
60
)
:
0
...
...
@@ -84,13 +85,12 @@ Item {
anchors.rightMargin
:
size
.
dp
(
20
)
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
tools
?
(
size
.
dp
(
50
)
*
Math
.
min
(
maxNumberOfToolButtons
,
tools
.
length
))
:
0
property
int
maxNumberOfToolButtons
:
3
RowLayout
{
id
:
toolsRow
anchors.centerIn
:
parent
height
:
toolMeasure
function
assignRotationBindings
()
{
for
(
var
i
=
0
;
i
<
children
.
length
;
++
i
)
{
children
[
i
].
rotation
=
Qt
.
binding
(
function
()
{
return
isUiPortrait
?
0
:
90
})
...
...
src/controls/IconButton.qml
0 → 100644
View file @
7a03018b
/****************************************************************************************
**
** Copyright (C) 2017 Eetu Kahelin
** 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.
**
****************************************************************************************/
import
QtQuick
2.6
import
QtQuick
.
Controls
1.0
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
Button
{
property
color
highlightColor
:
Theme
.
accentColor
property
bool
highlighted
:
pressed
property
bool
_showPress
:
highlighted
||
pressTimer
.
running
property
string
source
property
string
highlightSource
:
{
if
(
source
!=
""
)
{
var
tmpSrc
=
source
.
toString
()
var
i
=
tmpSrc
.
lastIndexOf
(
"
?
"
)
if
(
i
!==
-
1
)
{
tmpSrc
=
tmpSrc
.
substring
(
0
,
i
)
}
return
tmpSrc
+
"
?
"
+
highlightColor
}
else
{
return
""
}
}
onPressedChanged
:
{
if
(
pressed
)
{
pressTimer
.
start
()
}
}
width
:
Theme
.
itemHeightLarge
height
:
width
style
:
IconButtonStyle
{
}
Timer
{
id
:
pressTimer
interval
:
20
}
}
src/controls/controls.pro
View file @
7a03018b
...
...
@@ -22,7 +22,8 @@ QML_FILES += \
ListViewItemWithActions
.
qml
\
GlacierRoller
.
qml
\
GlacierRollerItem
.
qml
\
InverseMouseArea
.
qml
InverseMouseArea
.
qml
\
IconButton
.
qml
OTHER_FILES
+=
qmldir
\
$$
QML_FILES
...
...
src/controls/nemoimageprovider.cpp
View file @
7a03018b
...
...
@@ -30,3 +30,8 @@ QImage NemoImageProvider::requestImage(const QString &id, QSize *size, const QSi
Q_UNUSED
(
requestedSize
);
return
m_client
->
readImage
(
id
);
}
QPixmap
NemoImageProvider
::
requestPixmap
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
)
{
Q_UNUSED
(
size
);
return
m_client
->
requestPixmap
(
id
,
requestedSize
);
}
src/controls/nemoimageprovider.h
View file @
7a03018b
...
...
@@ -27,6 +27,7 @@ class NemoImageProvider : public QQuickImageProvider
public:
explicit
NemoImageProvider
();
QImage
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
);
QPixmap
requestPixmap
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
);
private:
MLocalThemeDaemonClient
*
m_client
;
};
...
...
src/controls/qmldir
View file @
7a03018b
...
...
@@ -24,6 +24,7 @@ ListViewItemWithActions 1.0 ListViewItemWithActions.qml
GlacierRoller 1.0 GlacierRoller.qml
GlacierRollerItem 1.0 GlacierRollerItem.qml
InverseMouseArea 1.0 InverseMouseArea.qml
IconButton 1.0 IconButton.qml
# MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC.
...
...
src/controls/sizing.cpp
View file @
7a03018b
...
...
@@ -105,3 +105,26 @@ float Sizing::dp(float value)
{
return
value
*
m_dp_factor
;
}
void
Sizing
::
setMmScaleFactor
(
float
value
)
{
if
(
value
!=
0
)
{
qDebug
()
<<
"Set custom mm scale factor"
;
m_p_width
=
value
;
setMmScaleFactor
();
}
}
void
Sizing
::
setDpScaleFactor
(
float
value
)
{
if
(
value
!=
0
)
{
qDebug
()
<<
"Set custom dp scale factor"
;
m_dp_factor
=
value
;
}
}
src/controls/sizing.h
View file @
7a03018b
...
...
@@ -37,6 +37,9 @@ public:
Q_INVOKABLE
float
mm
(
float
value
);
Q_INVOKABLE
float
dp
(
float
value
);
Q_INVOKABLE
void
setMmScaleFactor
(
float
value
);
Q_INVOKABLE
void
setDpScaleFactor
(
float
value
);
private:
bool
m_valid
;
...
...
src/controls/themedaemon/mlocalthemedaemonclient.cpp
View file @
7a03018b
...
...
@@ -48,9 +48,9 @@ MLocalThemeDaemonClient::MLocalThemeDaemonClient(const QString &testPath, QObjec
MAbstractThemeDaemonClient
(
parent
),
m_pixmapCache
(),
m_imageDirNodes
()
#ifdef HAVE_MLITE
,
themeItem
(
"/meegotouch/theme/name"
)
#endif
#ifdef HAVE_MLITE
,
themeItem
(
"/meegotouch/theme/name"
)
#endif
{
QStringList
themeRoots
;
QString
themeRoot
=
testPath
;
...
...
@@ -111,6 +111,7 @@ MLocalThemeDaemonClient::MLocalThemeDaemonClient(const QString &testPath, QObjec
inheritanceChain
.
insert
(
nextTheme
);
// the paths should be stored in reverse order than in the inheritance chain
themeRoots
.
prepend
(
themeRoot
+
QDir
::
separator
()
+
nextTheme
+
QDir
::
separator
()
+
QLatin1String
(
"meegotouch"
));
themeRoots
.
prepend
(
themeRoot
+
QDir
::
separator
()
+
nextTheme
+
QDir
::
separator
()
+
QLatin1String
(
"fontawesome"
));
QString
parentTheme
=
themeIndexFile
.
value
(
"X-MeeGoTouch-Metatheme/X-Inherits"
,
""
).
toString
();
...
...
@@ -148,7 +149,8 @@ MLocalThemeDaemonClient::~MLocalThemeDaemonClient()
QPixmap
MLocalThemeDaemonClient
::
requestPixmap
(
const
QString
&
id
,
const
QSize
&
requestedSize
)
{
QPixmap
pixmap
;
qDebug
()
<<
"ID requested: "
<<
id
;
QStringList
parts
=
id
.
split
(
'?'
);
QSize
size
=
requestedSize
;
if
(
size
.
width
()
<
1
)
{
...
...
@@ -158,20 +160,30 @@ QPixmap MLocalThemeDaemonClient::requestPixmap(const QString &id, const QSize &r
size
.
rheight
()
=
0
;
}
const
PixmapIdentifier
pixmapId
(
id
,
size
);
const
PixmapIdentifier
pixmapId
(
parts
.
at
(
0
)
,
size
);
pixmap
=
m_pixmapCache
.
value
(
pixmapId
);
if
(
pixmap
.
isNull
())
{
// The pixmap is not cached yet. Decode the image and
// store it into the cache as pixmap.
const
QImage
image
=
readImage
(
id
);
const
QImage
image
=
readImage
(
parts
.
at
(
0
)
);
if
(
!
image
.
isNull
())
{
pixmap
=
QPixmap
::
fromImage
(
image
);
if
(
requestedSize
.
isValid
()
&&
(
pixmap
.
size
()
!=
requestedSize
))
{
pixmap
=
pixmap
.
scaled
(
requestedSize
);
}
if
(
parts
.
length
()
>
1
)
if
(
parts
.
length
()
>
1
&&
QColor
::
isValidColor
(
parts
.
at
(
1
)))
{
QPainter
painter
(
&
pixmap
);
painter
.
setCompositionMode
(
QPainter
::
CompositionMode_SourceIn
);
painter
.
fillRect
(
pixmap
.
rect
(),
parts
.
at
(
1
));
painter
.
end
();
}
m_pixmapCache
.
insert
(
pixmapId
,
pixmap
);
}
if
(
requestedSize
.
width
()
>
0
&&
requestedSize
.
height
()
>
0
)
pixmap
=
pixmap
.
scaled
(
requestedSize
.
width
(),
requestedSize
.
height
(),
Qt
::
IgnoreAspectRatio
);
else
pixmap
=
pixmap
;
m_pixmapCache
.
insert
(
pixmapId
,
pixmap
);
}
return
pixmap
;
}
...
...
src/controls/themedaemon/mlocalthemedaemonclient.h
View file @
7a03018b
...
...
@@ -45,6 +45,8 @@
#include <QHash>
#include <QPixmap>
#include <QString>
#include <QPainter>
#include <QColor>
#ifdef HAVE_MLITE
#include <mgconfitem.h>
...
...
src/styles/ButtonStyle.qml
View file @
7a03018b
...
...
@@ -46,7 +46,7 @@ ButtonStyle {
RadialGradient
{
x
:
control
.
pressX
-
width
/
2
y
:
control
.
pressY
-
height
/
2
width
:
Theme
.
itemWidth
Medium
width
:
Theme
.
itemWidth
Small
height
:
width
visible
:
control
.
pressed
...
...
src/styles/IconButtonStyle.qml
0 → 100644
View file @
7a03018b
/****************************************************************************************
**
** Copyright (C) 2017 Eetu Kahelin
** 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.
**
****************************************************************************************/
import
QtQuick
2.6
import
QtQuick
.
Controls
1.0
import
QtQuick
.
Controls
.
Styles
1.4
import
QtGraphicalEffects
1.0
ButtonStyle
{
background
:
Image
{
fillMode
:
Image
.
PreserveAspectFit
opacity
:
control
.
enabled
?
1.0
:
0.5
source
:
control
.
_showPress
?
control
.
highlightSource
:
control
.
source
}
}
src/styles/qmldir
View file @
7a03018b
...
...
@@ -20,3 +20,4 @@ SpinBoxStyle 1.0 SpinBoxStyle.qml
TabViewStyle 1.0 TabViewStyle.qml
TableViewStyle 1.0 TableViewStyle.qml
TextFieldStyle 1.0 TextFieldStyle.qml
IconButtonStyle 1.0 IconButtonStyle.qml
src/styles/styles.pro
View file @
7a03018b
...
...
@@ -27,6 +27,7 @@ QML_FILES = \
TextFieldStyle
.
qml
\
ToolBarStyle
.
qml
\
ToolButtonStyle
.
qml
\
IconButtonStyle
.
qml
#
Images
QML_FILES
+=
\
...
...
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