Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Theme] migrate colors to new Theme class
  • Loading branch information
neochapay committed Apr 15, 2017
1 parent 4de110a commit 2516c34
Show file tree
Hide file tree
Showing 76 changed files with 277 additions and 3,110 deletions.
7 changes: 3 additions & 4 deletions examples/touch/content/ButtonPage.qml
Expand Up @@ -41,7 +41,6 @@
import QtQuick 2.1
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
Expand All @@ -54,11 +53,11 @@ Page {
anchors.centerIn: parent

Button {
property bool isGlacier: Theme.name == "Glacier"
property bool isGlacier: true
anchors.margins: 20
text: isGlacier ? "Set Ugly Theme" : "Set Nice Theme"
onClicked: isGlacier ? Theme.loadFromFile("ugly.json")
: Theme.loadFromFile("glacier.json")
onClicked: isGlacier ? Theme.loadTheme("ugly")
: Theme.loadTheme("glacier")
}

Button {
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/ButtonRowPage.qml
Expand Up @@ -32,7 +32,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/CheckboxPage.qml
Expand Up @@ -32,7 +32,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/LabelPage.qml
Expand Up @@ -32,7 +32,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/ListViewPage.qml
@@ -1,7 +1,6 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0

Page {
id: listViewPage
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/ProgressBarPage.qml
Expand Up @@ -41,7 +41,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/QueryDialogPage.qml
Expand Up @@ -32,7 +32,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/SelectRollerPage.qml
@@ -1,7 +1,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/SliderPage.qml
Expand Up @@ -41,7 +41,6 @@
import QtQuick 2.1
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
Expand Down
2 changes: 0 additions & 2 deletions examples/touch/content/SpinnerPage.qml
Expand Up @@ -32,8 +32,6 @@
import QtQuick 2.1
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

Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/TabBarPage.qml
Expand Up @@ -41,7 +41,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/content/TextInputPage.qml
Expand Up @@ -41,7 +41,6 @@
import QtQuick 2.1
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
Expand Down
1 change: 0 additions & 1 deletion examples/touch/main.qml
Expand Up @@ -41,7 +41,6 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.0
import "content"
Expand Down
2 changes: 1 addition & 1 deletion rpm/qtquickcontrols-nemo.spec
@@ -1,6 +1,6 @@
Name: qt5-qtquickcontrols-nemo
Summary: Nemomobile Qt Quick Controls
Version: 5.2.0
Version: 5.3.0
Release: nemo1
Group: Qt/Qt
License: LGPLv2.1 with exception or GPLv3
Expand Down
27 changes: 13 additions & 14 deletions src/controls/ApplicationWindow.qml
Expand Up @@ -23,7 +23,6 @@ import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Controls.Private 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0

NemoWindow {
id: root
Expand All @@ -43,7 +42,7 @@ NemoWindow {
//is this safe? can there be some situation in which it's neither portrait nor landscape?
readonly property int isUiLandscape: !isUiPortrait

readonly property var _bgColor: Theme.window.background
readonly property var _bgColor: Theme.backgroundColor
color: _bgColor

//README: allowedOrientations' default value is set in NemoWindow's c++ implementation
Expand Down Expand Up @@ -226,15 +225,15 @@ NemoWindow {
property: "x"
from: target.width
to: 0
duration: Theme.pageStack.transitionDuration
duration: 500

This comment has been minimized.

Copy link
@topiasv

topiasv Apr 15, 2017

All these durations should not be hardcoded but should be in some sort of variable like they used to be. If it's not in the Theme class, it should be somewhere else as a defined variable so that changing them wouldn't be too hard.

easing.type: Easing.OutQuad
}
PropertyAnimation {
target: exitItem
property: "x"
from: 0
to: -target.width
duration: Theme.pageStack.transitionDuration
duration: 500
easing.type: Easing.OutQuad
}
}
Expand All @@ -246,15 +245,15 @@ NemoWindow {
property: "x"
from: -target.width
to: 0
duration: Theme.pageStack.transitionDuration
duration: 500
easing.type: Easing.OutQuad
}
PropertyAnimation {
target: exitItem
property: "x"
from: 0
to: target.width
duration: Theme.pageStack.transitionDuration
duration: 500
easing.type: Easing.OutQuad
}
}
Expand Down Expand Up @@ -287,16 +286,16 @@ NemoWindow {
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.header.dimmer.height
height: if (isUiPortrait) Theme.header.dimmer.height
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: Theme.header.dimmer.startPosition; color: Theme.header.dimmer.startColor }
GradientStop { position: Theme.header.dimmer.endPosition; color: Theme.header.dimmer.endColor }
GradientStop { position: 0; color: Theme.backgroundColor }
GradientStop { position: 1; color: "transparent" }
}
}
}
Expand Down Expand Up @@ -324,7 +323,7 @@ NemoWindow {
}
PropertyChanges {
target: headerDimmer
height: Theme.header.dimmer.height
height: Theme.itemHeightExtraSmall/2
width: parent.width
rotation: 0
}
Expand All @@ -342,7 +341,7 @@ NemoWindow {
}
PropertyChanges {
target: headerDimmer
height: Theme.header.dimmer.height
height: Theme.itemHeightExtraSmall/2
width: parent.height
rotation: -90
}
Expand All @@ -360,7 +359,7 @@ NemoWindow {
}
PropertyChanges {
target: headerDimmer
height: Theme.header.dimmer.height
height: Theme.itemHeightExtraSmall/2
width: parent.width
rotation: 0
}
Expand All @@ -378,7 +377,7 @@ NemoWindow {
}
PropertyChanges {
target: headerDimmer
height: Theme.header.dimmer.height
height: Theme.itemHeightExtraSmall/2
width: parent.height
rotation: -90
}
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Button.qml
Expand Up @@ -19,7 +19,7 @@

import QtQuick 2.1
import QtQuick.Controls 1.0

import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0

Button {
Expand Down
3 changes: 2 additions & 1 deletion src/controls/ButtonRow.qml
@@ -1,6 +1,7 @@
/****************************************************************************************
**
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** Copyright (C) 2017 Sergey Chupligin <neochapay@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
Expand Down Expand Up @@ -30,7 +31,7 @@
****************************************************************************************/

import QtQuick 2.1
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Controls.Nemo 1.0

Rectangle {
id: main
Expand Down
1 change: 1 addition & 0 deletions src/controls/Checkbox.qml
@@ -1,5 +1,6 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0

CheckBox {
Expand Down
9 changes: 4 additions & 5 deletions src/controls/Header.qml
Expand Up @@ -2,7 +2,6 @@ import QtQuick 2.1
import QtQuick.Window 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0

Expand Down Expand Up @@ -149,14 +148,14 @@ Item {
SequentialAnimation {
id: changeToolsLayoutAnim
NumberAnimation { id: fadeOut; target: root; property: "opacity"; to: 0;
duration: Theme.pageStack.transitionDuration/2; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 }
duration: 250; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 }
//headerTools may change now, so we have to close the drawer
ScriptAction { script: closeDrawer() }
ScriptAction { script: updateHeaderTools() }
//tell the (maybe new) layout that we're its container
ScriptAction { script: propagateHeaderReference() }
NumberAnimation { id: fadeIn; target: root; property: "opacity"; to: 1;
duration: Theme.pageStack.transitionDuration/2; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 }
duration: 250; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 }

}

Expand All @@ -181,7 +180,7 @@ Item {
anchors.right: parent.right
//README: the rest of the anchors/sizes will be set by AnchorChanges!

color: Theme.header.background
color: Theme.backgroundColor

FilteringMouseArea {
id: mouseArea
Expand Down Expand Up @@ -305,7 +304,7 @@ Item {
Rectangle {
id: drawerContainer

color: Theme.header.background
color: Theme.backgroundColor

Binding on width {
value: drawer.width
Expand Down
5 changes: 2 additions & 3 deletions src/controls/HeaderToolsLayout.qml
@@ -1,6 +1,5 @@
import QtQuick 2.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0

Expand Down Expand Up @@ -60,7 +59,7 @@ Item {
anchors.rightMargin: size.dp(20)
clip: true
font.family: Theme.fontFamily
color: Theme.label.color
color: Theme.textColor
font.pointSize: size.dp(24)
font.weight: Font.Bold
LinearGradient {
Expand All @@ -71,7 +70,7 @@ Item {
start: Qt.point(0,0)
end: Qt.point(width,0)
gradient: Gradient { GradientStop { position: 0; color: "transparent"}
GradientStop {position: 0.9; color: Theme.header.background } }
GradientStop {position: 0.9; color: Theme.backgroundColor } }
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/controls/Label.qml
Expand Up @@ -29,11 +29,11 @@
**
****************************************************************************************/
import QtQuick 2.1
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Controls.Nemo 1.0

Text {
renderType: Text.NativeRendering
font.family: Theme.fontFamily
color: Theme.label.color
font.pointSize: size.dp(Theme.label.pointSize)
color: Theme.textColor
font.pointSize: size.dp(Theme.fontSizeLarge)
}
2 changes: 1 addition & 1 deletion src/controls/ListView.qml
@@ -1,7 +1,7 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Controls.Nemo 1.0

ListView {
id: listView
Expand Down
3 changes: 1 addition & 2 deletions src/controls/Page.qml
Expand Up @@ -32,7 +32,6 @@
import QtQuick 2.1
import QtQuick.Controls 1.0 // Needed for things like Stack attached properties
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Window 2.0

NemoPage {
Expand Down Expand Up @@ -70,7 +69,7 @@ NemoPage {
Rectangle {
id: background
anchors.fill: parent
color: Theme.page.background
color: Theme.backgroundColor
}

Item {
Expand Down
2 changes: 0 additions & 2 deletions src/controls/Slider.qml
@@ -1,9 +1,7 @@
import QtQuick 2.1
import QtQuick.Controls 1.0

import QtQuick.Controls.Styles.Nemo 1.0


Slider {
id: slider
property bool showValue: false
Expand Down

0 comments on commit 2516c34

Please sign in to comment.