This repository has been archived by the owner on Jul 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b6931c
commit a2db446
Showing
6 changed files
with
342 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
|