Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page transition #21

Merged
merged 1 commit into from Jan 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/controls/ApplicationWindow.qml
Expand Up @@ -195,6 +195,50 @@ NemoWindow {
target: stackView._isCurrentItemNemoPage() ? stackView.currentItem : null
onAllowedOrientationsChanged: root.orientationConstraintsChanged()
}

delegate: StackViewDelegate {
pushTransition: Component {
StackViewTransition {
PropertyAnimation {
target: enterItem
property: "x"
from: target.width
to: 0
duration: Theme.pageStack.transitionDuration
easing.type: Easing.OutQuad
}
PropertyAnimation {
target: exitItem
property: "x"
from: 0
to: -target.width
duration: Theme.pageStack.transitionDuration
easing.type: Easing.OutQuad
}
}
}
popTransition: Component {
StackViewTransition {
PropertyAnimation {
target: enterItem
property: "x"
from: -target.width
to: 0
duration: Theme.pageStack.transitionDuration
easing.type: Easing.OutQuad
}
PropertyAnimation {
target: exitItem
property: "x"
from: 0
to: target.width
duration: Theme.pageStack.transitionDuration
easing.type: Easing.OutQuad
}
}
}

}
}

Item {
Expand Down
13 changes: 13 additions & 0 deletions src/styles/autogenerated/nemotheme.cpp
Expand Up @@ -45,6 +45,7 @@ NemoTheme::NemoTheme(QObject *parent)
, m_toolBar(new NemoThemeToolBar(this))
, m_window(new NemoThemeWindow(this))
, m_page(new NemoThemePage(this))
, m_pageStack(new NemoThemePageStack(this))
, m_spinner(new NemoThemeSpinner(this))
, m_label(new NemoThemeLabel(this))
, m_checkbox(new NemoThemeCheckbox(this))
Expand Down Expand Up @@ -120,6 +121,11 @@ NemoThemePage * NemoTheme::page() const
return m_page;
}

NemoThemePageStack * NemoTheme::pageStack() const
{
return m_pageStack;
}

NemoThemeSpinner * NemoTheme::spinner() const
{
return m_spinner;
Expand Down Expand Up @@ -396,6 +402,13 @@ void NemoTheme::loadFromFile(const QString &fileName)
} else {
m_page->dimmer()->setEndPositionDefault();
}
// Setting properties for pageStack
QJsonObject stylesPageStack = styles.value("pageStack").toObject();
if (stylesPageStack.contains("transitionDuration")) {
m_pageStack->setTransitionDuration(jsonToInt(stylesPageStack.value("transitionDuration"), defines));
} else {
m_pageStack->setTransitionDurationDefault();
}
// Setting properties for spinner
QJsonObject stylesSpinner = styles.value("spinner").toObject();
if (stylesSpinner.contains("radius")) {
Expand Down
4 changes: 4 additions & 0 deletions src/styles/autogenerated/nemotheme.h
Expand Up @@ -31,6 +31,7 @@
#include "nemothemetoolbar.h"
#include "nemothemewindow.h"
#include "nemothemepage.h"
#include "nemothemepagestack.h"
#include "nemothemespinner.h"
#include "nemothemelabel.h"
#include "nemothemecheckbox.h"
Expand All @@ -47,6 +48,7 @@ class NemoTheme: public QObject
Q_PROPERTY(NemoThemeToolBar * toolBar READ toolBar CONSTANT)
Q_PROPERTY(NemoThemeWindow * window READ window CONSTANT)
Q_PROPERTY(NemoThemePage * page READ page CONSTANT)
Q_PROPERTY(NemoThemePageStack * pageStack READ pageStack CONSTANT)
Q_PROPERTY(NemoThemeSpinner * spinner READ spinner CONSTANT)
Q_PROPERTY(NemoThemeLabel * label READ label CONSTANT)
Q_PROPERTY(NemoThemeCheckbox * checkbox READ checkbox CONSTANT)
Expand All @@ -64,6 +66,7 @@ class NemoTheme: public QObject
NemoThemeToolBar * toolBar() const;
NemoThemeWindow * window() const;
NemoThemePage * page() const;
NemoThemePageStack * pageStack() const;
NemoThemeSpinner * spinner() const;
NemoThemeLabel * label() const;
NemoThemeCheckbox * checkbox() const;
Expand All @@ -83,6 +86,7 @@ public Q_SLOTS:
NemoThemeToolBar * m_toolBar;
NemoThemeWindow * m_window;
NemoThemePage * m_page;
NemoThemePageStack * m_pageStack;
NemoThemeSpinner * m_spinner;
NemoThemeLabel * m_label;
NemoThemeCheckbox * m_checkbox;
Expand Down
50 changes: 50 additions & 0 deletions src/styles/autogenerated/nemothemepagestack.cpp
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden

#include "nemothemepagestack.h"

NemoThemePageStack::NemoThemePageStack(QObject *parent)
: QObject(parent)
, m_transitionDuration(500)
{
}

int NemoThemePageStack::transitionDuration() const
{
return m_transitionDuration;
}

void NemoThemePageStack::setTransitionDuration(int transitionDuration)
{
if (m_transitionDuration != transitionDuration) {
m_transitionDuration = transitionDuration;
emit transitionDurationChanged();
}
}

void NemoThemePageStack::setTransitionDurationDefault()
{
if (m_transitionDuration != 500) {
m_transitionDuration = 500;
emit transitionDurationChanged();
}
}
43 changes: 43 additions & 0 deletions src/styles/autogenerated/nemothemepagestack.h
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden

#ifndef NEMOTHEMEPAGESTACK_H
#define NEMOTHEMEPAGESTACK_H

#include <QtCore/QObject>

class NemoThemePageStack: public QObject
{
Q_OBJECT
Q_PROPERTY(int transitionDuration READ transitionDuration NOTIFY transitionDurationChanged)
public:
explicit NemoThemePageStack(QObject *parent = 0);
int transitionDuration() const;
void setTransitionDuration(int transitionDuration);
void setTransitionDurationDefault();
Q_SIGNALS:
void transitionDurationChanged();
private:
int m_transitionDuration;
};

#endif //NEMOTHEMEPAGESTACK_H
1 change: 1 addition & 0 deletions src/styles/qquicknemostyleextensionplugin.cpp
Expand Up @@ -52,6 +52,7 @@ void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<NemoThemeSpinner>(uri, 1, 0, "NemoThemeSpinner", reason);
qmlRegisterUncreatableType<NemoThemeLabel>(uri, 1, 0, "NemoThemeLabel", reason);
qmlRegisterUncreatableType<NemoThemeCheckbox>(uri, 1, 0, "NemoThemeCheckbox", reason);
qmlRegisterUncreatableType<NemoThemePageStack>(uri, 1, 0, "NemoThemePageStack", reason);


qmlRegisterSingletonType<QObject>(uri, 1, 0, "Theme", nemo_theme_provider);
Expand Down
6 changes: 4 additions & 2 deletions src/styles/styles.pro
Expand Up @@ -86,7 +86,8 @@ HEADERS += \
autogenerated/nemothemepagedimmer.h \
autogenerated/nemothemespinner.h \
autogenerated/nemothemelabel.h \
autogenerated/nemothemecheckbox.h
autogenerated/nemothemecheckbox.h \
autogenerated/nemothemepagestack.h

SOURCES += \
qquicknemostyleextensionplugin.cpp \
Expand All @@ -103,7 +104,8 @@ SOURCES += \
autogenerated/nemothemepagedimmer.cpp \
autogenerated/nemothemespinner.cpp \
autogenerated/nemothemelabel.cpp \
autogenerated/nemothemecheckbox.cpp
autogenerated/nemothemecheckbox.cpp \
autogenerated/nemothemepagestack.cpp

INSTALLS += target images qmlfiles themes

Expand Down
3 changes: 3 additions & 0 deletions src/styles/themes/ugly.json
Expand Up @@ -61,6 +61,9 @@
"checkbox": {
"back1": "#0091e5",
"back2": "#313131"
},
"pageStack": {
"transitionDuration": 1500
}
}
}
14 changes: 14 additions & 0 deletions tools/themehelper/components.json
Expand Up @@ -233,6 +233,16 @@
"type": "QColor"
}
]
},
{
"name": "PageStack",
"properties": [
{
"name": "transitionDuration",
"type": "int",
"default": 500
}
]
}
],
"properties": [
Expand Down Expand Up @@ -264,6 +274,10 @@
"name": "page",
"object": "Page"
},
{
"name": "pageStack",
"object": "PageStack"
},
{
"name": "spinner",
"object": "Spinner"
Expand Down