Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Fixed lost files from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVanAssche committed May 14, 2018
1 parent 3b6931c commit a2db446
Show file tree
Hide file tree
Showing 6 changed files with 342 additions and 5 deletions.
1 change: 0 additions & 1 deletion harbour-sailfinder.pro
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ SOURCES += src/harbour-sailfinder.cpp \
src/models/matcheslistmodel.cpp

DISTFILES += qml/harbour-sailfinder.qml \
qml/cover/CoverPage.qml \
qml/pages/FirstPage.qml \
qml/pages/MainPage.qml \
qml/pages/AboutPage.qml \
Expand Down
21 changes: 17 additions & 4 deletions qml/cover/CoverPage.qml → qml/components/DefaultCover.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,23 @@
import QtQuick 2.0
import Sailfish.Silica 1.0

CoverBackground {
Label {
Item {
anchors.fill: parent

Column {
width: parent.width
anchors.centerIn: parent
text: "Sailfinder"

Image {
width: Theme.itemSizeSmall
anchors.horizontalCenter: parent.horizontalCenter
source: "qrc:///images/cover-logo.png"
}

TextLabel {
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeLarge
text: sfos.appNamePretty
}
}
}

96 changes: 96 additions & 0 deletions qml/components/MatchesCover.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* This file is part of Sailfinder.
*
* Sailfinder is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sailfinder 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Sailfinder. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.0
import QtQuick.Layouts 1.1
import Sailfish.Silica 1.0

Item {
anchors.fill: parent

function populate() {
if(api.matchesList !== "null") {
numberOfMatches.text = api.matchesList.numberOfMatches()
repeater.model = api.matchesList
}
}

Connections {
target: api
onMatchesListChanged: populate()
}

GridLayout {
id: layout
anchors.fill: parent // IMPORTANT: Using GridLayout without this will fail!
columns: 2
columnSpacing: 0
rowSpacing: 0

Repeater {
id: repeater

Image {
id: image
width: Layout.columnSpan*parent.width/parent.columns
height: Layout.rowSpan*parent.width/parent.columns
Layout.minimumWidth: width
Layout.minimumHeight: height
Layout.preferredWidth: width
Layout.preferredHeight: height
Layout.maximumWidth: parent.width
Layout.maximumHeight: parent.height
Layout.fillHeight: true
Layout.fillWidth: true
sourceSize.width: width
sourceSize.height: height
source: model.avatar
asynchronous: true
opacity: progress/3 // background
visible: index < 8 // limit the number of pictures
Behavior on opacity { FadeAnimator {} }
onStatusChanged: {
if(status == Image.Error) {
console.warn("Can't load image for matches cover")
}
}
}
}
}

Column {
width: parent.width
anchors.centerIn: parent

TextLabel {
id: numberOfMatches
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
font.bold: true
visible: text.length > 0
}


TextLabel {
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
//% "Matches"
text: qsTrId("sailfinder-matches")
font.bold: numberOfMatches.text.length == 0 // no matches yet
}
}
}
65 changes: 65 additions & 0 deletions qml/components/ProfileCover.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* This file is part of Sailfinder.
*
* Sailfinder is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sailfinder 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Sailfinder. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0

Item {
anchors.fill: parent

function populate() {
if(api.profile !== "null") {
background.source = api.profile.photos.getPhoto(0).url
}
}

Connections {
target: api
onProfileChanged: populate()
}

Image {
id: background
anchors.fill: parent
asynchronous: true
opacity: progress/3 // background
Behavior on opacity { FadeAnimator {} }
onStatusChanged: {
if(status == Image.Error) {
console.warn("Can't load image as cover background")
}
}
}

Column {
width: parent.width
anchors.centerIn: parent

Image {
width: Theme.itemSizeSmall
anchors.horizontalCenter: parent.horizontalCenter
source: "qrc:///images/cover-logo.png"
}

TextLabel {
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
//% "Profile"
text: qsTrId("sailfinder-profile")
}
}
}
117 changes: 117 additions & 0 deletions qml/components/RecommendationsCover.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* This file is part of Sailfinder.
*
* Sailfinder is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sailfinder 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Sailfinder. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0

Item {
property bool _loaded
property bool _canLike

function populate() {
if(api.recommendation !== "null") {
background.source = api.recommendation.photos.getPhoto(0).url
name.text = api.recommendation.name
distance.text = api.recommendation.distance + " km"
_canLike = api.canLike
_loaded = true
}
}

anchors.fill: parent

Connections {
target: api
onRecommendationChanged: populate()
}

Image {
id: background
anchors.fill: parent
asynchronous: true
opacity: _canLike? progress/3: 0.0 // background
Behavior on opacity { FadeAnimator {} }
onStatusChanged: {
if(status == Image.Error) {
console.warn("Can't load image as cover background")
}
}
}

// Normal recommendations swiping
Column {
width: parent.width
anchors.centerIn: parent
opacity: _canLike? 1.0: 0.0
Behavior on opacity { FadeAnimator {} }

TextLabel {
id: name
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
font.bold: true
}

TextLabel {
id: distance
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeLarge
}
}

// Exhausted swiping
Column {
width: parent.width
anchors.centerIn: parent
opacity: _canLike? 0.0: 1.0
Behavior on opacity { FadeAnimator {} }

Image {
width: Theme.itemSizeSmall
anchors.horizontalCenter: parent.horizontalCenter
source: "qrc:///images/cover-logo.png"
}

TextLabel {
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeLarge
//% "Exhausted!"
text: qsTrId("sailfinder-out-of-recs")
}
}

CoverActionList {
enabled: _loaded && app.swipeViewIndex === 0 && _canLike
iconBackground: true

CoverAction {
iconSource: "../resources/images/dislike.png"
onTriggered: {
_loaded = false
api.passUser(api.recommendation.id)
}
}

CoverAction {
iconSource: "../resources/images/like.png"
onTriggered: {
_loaded = false
api.likeUser(api.recommendation.id)
}
}
}
}
47 changes: 47 additions & 0 deletions qml/pages/CoverPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* This file is part of Sailfinder.
*
* Sailfinder is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sailfinder 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Sailfinder. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0
import "../components"

CoverBackground {
id: cover
property bool _loading: true

Connections {
target: api
onAuthenticatedChanged: _loading = false
}

DefaultCover {
visible: _loading
}

RecommendationsCover {
visible: app.swipeViewIndex === 0 && !_loading
}

MatchesCover {
visible: app.swipeViewIndex === 1 && !_loading
}

ProfileCover {
visible: app.swipeViewIndex === 2 && !_loading
}
}

0 comments on commit a2db446

Please sign in to comment.