Skip to content

Commit

Permalink
added MyFlipable
Browse files Browse the repository at this point in the history
  • Loading branch information
bram authored and bram committed Jan 21, 2013
1 parent 1904846 commit f7e3b70
Show file tree
Hide file tree
Showing 4 changed files with 2,713 additions and 50 deletions.
26 changes: 2 additions & 24 deletions SettingsTab.qml
Expand Up @@ -12,11 +12,11 @@ Tab {

title: "Settings"

Flipable {
MyFlipable {
id: flipable
anchors.fill: parent

property bool flipped: false
flipsvertically: false

front: Rectangle {
id: frontside
Expand Down Expand Up @@ -298,27 +298,5 @@ Tab {

}
}

transform: Rotation {
id: rotation
origin.x: flipable.width/2
origin.y: flipable.height/2
axis.x: 0; axis.y: 1; axis.z: 0 // add option: which axis
angle: 0 // the default angle
}

states: State {
name: "back"
PropertyChanges { target: rotation; angle: 180 }
when: flipable.flipped
}

transitions: Transition {
NumberAnimation { target: rotation; property: "angle"; duration: Storage.getSetting("flipspeed") } // add option: speed
}

function flip () {
flipable.flipped = !flipable.flipped
}
}
}
28 changes: 3 additions & 25 deletions SubredditTab.qml
Expand Up @@ -12,11 +12,11 @@ Tab {

title: (url == "/") ? "reddit.com" : url.substring(1)

Flipable {
MyFlipable {
id: flipable
anchors.fill: parent

property bool flipped: false
flipsvertically: false

JSONListModel {
id: linkslistmodel
Expand Down Expand Up @@ -82,7 +82,7 @@ Tab {

color: Js.getBackgroundColor()

Flipable {
Flipable { // why can't this be made into a myflipable?
id: itemflipable
anchors.fill: parent

Expand Down Expand Up @@ -318,27 +318,5 @@ Tab {
}
}
}

transform: Rotation {
id: rotation
origin.x: flipable.width/2
origin.y: flipable.height/2
axis.x: 0; axis.y: 1; axis.z: 0
angle: 0 // the default angle
}

states: State {
name: "back"
PropertyChanges { target: rotation; angle: 180 }
when: flipable.flipped
}

transitions: Transition {
NumberAnimation { target: rotation; property: "angle"; duration: Storage.getSetting("flipspeed") } // add option: speed
}

function flip () {
flipable.flipped = !flipable.flipped
}
}
}
2 changes: 1 addition & 1 deletion main.qml
Expand Up @@ -20,7 +20,7 @@ Rectangle {
anchors.fill: parent
ItemStyle.class: "new-tabs"

selectedTabIndex: 1
selectedTabIndex: 1 // skip the settings page

SettingsTab {}

Expand Down

0 comments on commit f7e3b70

Please sign in to comment.