2
* Copyright (C) 2012 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Eric Gregory <eric@yorba.org>
22
import "../Components"
24
// AlbumViewerTransitionPortraitPage is just like AlbumOpener, except it only
25
// shows one page at a time. This is intended for use in AlbumViewerTransition
26
// as a replacement for AlbumOpener when used in portrait mode and closing
27
// an even-numbered page.
29
id: albumViewerTransitionPortraitPage
35
property bool isPreview: false
38
property bool contentHasPreviewFrame: false
41
property int viewingPage
45
property int insideLeftPage: defaultInsideLeftPage
48
property int insideRightPage: defaultInsideRightPage
50
// Here, openFraction refers to how "flipped" the page is, rather than
51
// how open the album is.
52
property real openFraction: 0
56
property real topMargin: previewTopMargin
59
property real bottomMargin: previewBottomMargin
62
property real gutterMargin: previewGutterMargin
65
property real outerMargin: previewOuterMargin
68
property real insideMargin: previewInsideMargin
73
property bool isFlipping: (openFraction != 0 && openFraction != 1)
76
property alias frameToContentWidth: page.frameToContentWidth
79
property alias frameToContentHeight: page.frameToContentHeight
83
property alias load: page.load
87
property int defaultInsideLeftPage: page.leftPageForCurrent(currentOrFirstContentPage)
90
property int defaultInsideRightPage: page.rightPageForCurrent(currentOrFirstContentPage)
94
property alias pageTopMargin: page.pageTopMargin
97
property alias pageBottomMargin: page.pageBottomMargin
100
property alias pageGutterMargin: page.pageGutterMargin
103
property alias pageOuterMargin: page.pageOuterMargin
106
property alias pageInsideMargin: page.pageInsideMargin
110
property alias previewTopMargin: page.previewTopMargin
113
property alias previewBottomMargin: page.previewBottomMargin
116
property alias previewGutterMargin: page.previewGutterMargin
119
property alias previewOuterMargin: page.previewOuterMargin
122
property alias previewInsideMargin: page.previewInsideMargin
127
property int currentOrFirstContentPage: (!album
129
: (album.currentPage == album.firstValidCurrentPage
130
? album.firstContentPage
131
: album.currentPage))
133
onAlbumChanged: openFraction = (!album || album.closed ? 0 : 1)
137
ignoreUnknownSignals: true
138
onClosedChanged: openFraction = (album.closed ? 0 : 1)
144
x: width * openFraction // Shift it over as it opens so the visuals stay centered.
147
height: parent.height
154
album: albumViewerTransitionPortraitPage.album
156
frontPage: viewingPage
157
backPage: album !== null ? album.currentPage : viewingPage
159
isPreview: albumOpenerPortrait.isPreview
160
contentHasPreviewFrame: albumViewerTransitionPortraitPage.contentHasPreviewFrame
162
flipFraction: -openFraction
164
topMargin: albumViewerTransitionPortraitPage.topMargin
165
bottomMargin: albumViewerTransitionPortraitPage.bottomMargin
166
gutterMargin: albumViewerTransitionPortraitPage.gutterMargin
167
outerMargin: albumViewerTransitionPortraitPage.outerMargin
168
insideMargin: albumViewerTransitionPortraitPage.insideMargin