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

Commit

Permalink
Merge pull request #174 from DylanVanAssche/cover
Browse files Browse the repository at this point in the history
Cover
  • Loading branch information
DylanVanAssche authored May 14, 2018
2 parents a2db446 + eefec9f commit b0146b4
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 44 deletions.
2 changes: 1 addition & 1 deletion harbour-sailfinder.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
Type=Application
X-Nemo-Application-Type=silica-qt5
Icon=harbour-sailfinder
Exec=harbour-sailfinder
Exec=invoker --type=silica-qt5 -s /usr/bin/harbour-sailfinder
Name=Sailfinder
5 changes: 5 additions & 0 deletions harbour-sailfinder.pro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ SOURCES += src/harbour-sailfinder.cpp \
src/models/matcheslistmodel.cpp

DISTFILES += qml/harbour-sailfinder.qml \
qml/pages/CoverPage.qml \
qml/pages/FirstPage.qml \
qml/pages/MainPage.qml \
qml/pages/AboutPage.qml \
Expand All @@ -85,6 +86,10 @@ DISTFILES += qml/harbour-sailfinder.qml \
rpm/harbour-sailfinder.changes \
qml/js/authentication.js \
qml/css/authentication.css \
qml/components/RecommendationsCover.qml \
qml/components/MatchesCover.qml \
qml/components/ProfileCover.qml \
qml/components/DefaultCover.qml
qml/components/SchoolJobDelegate.qml

SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256
Expand Down
1 change: 1 addition & 0 deletions qml/components/PhotoGridLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Item {
}
asynchronous: true
opacity: progress
visible: index < 6 // Max 6 photos
Behavior on opacity { FadeAnimator {} }
onStatusChanged: {
if(status == Image.Error) {
Expand Down
12 changes: 8 additions & 4 deletions qml/components/TextLabel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ import QtQuick 2.2
import Sailfish.Silica 1.0

Label {
anchors { left: parent.left; right: parent.right; leftMargin: Theme.horizontalPageMargin; rightMargin: Theme.horizontalPageMargin }
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
}
font.pixelSize: Theme.fontSizeMedium
wrapMode: Text.WordWrap
truncationMode: TruncationMode.Fade

Behavior on opacity {
FadeAnimation {}
}
Behavior on opacity { FadeAnimation {} }
}
5 changes: 3 additions & 2 deletions qml/harbour-sailfinder.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import "pages"
ApplicationWindow
{
property bool networkStatus
property int swipeViewIndex: 0

id: app
initialPage: Component { FirstPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
initialPage: Component { FirstPage {} }
cover: Qt.resolvedUrl("pages/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
onNetworkStatusChanged: {
if(networkStatus == false) {
Expand Down
1 change: 1 addition & 0 deletions qml/pages/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Page {
onHeaderChanged: swipeView._profileHeader = text
}
}
onCurrentIndexChanged: app.swipeViewIndex = currentIndex
}

NavigationBar {
Expand Down
2 changes: 2 additions & 0 deletions rpm/harbour-sailfinder.changes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- [IMPROVEMENT] Stability improvements for the login screen
- [IMPROVEMENT] Location updates are still working OK
- [IMPROVEMENT] Automatically throttle the quality of the pictures to reduce data usage on mobile networks
- [IMPROVEMENT] Use Silica booster for faster startup
- [NEW] SFOS cover when Sailfinder is minimized
- [NEW] Delete pictures from Tinder (hold a profile picture to show remove screen)
- [NEW] Opt-in for Smart Photo's
- [NEW] Moved to OBS for building RPM's
Expand Down
73 changes: 73 additions & 0 deletions rpm/harbour-sailfinder.spec.7918
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#
# Do NOT Edit the Auto-generated Part!
# Generated by: spectacle version 0.27
#

Name: harbour-sailfinder

# >> macros
# << macros

%{!?qtc_qmake:%define qtc_qmake %qmake}
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Sailfinder
Version: 4.4
Release: 4
Group: Qt/Qt
License: GPLv3
URL: https://github.com/DylanVanAssche/harbour-sailfinder
Source0: %{name}-%{version}.tar.bz2
Source100: harbour-sailfinder.yaml
Requires: sailfishsilica-qt5 >= 0.10.9
Requires: nemo-qml-plugin-notifications-qt5
Requires: nemo-qml-plugin-configuration-qt5
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: desktop-file-utils

%description
Sailfinder is a Sailfish OS application to have fun on Tinder.

%prep
%setup -q -n %{name}-%{version}

# >> setup
# << setup

%build
# >> build pre
# << build pre

%qtc_qmake5 \
VERSION=%{version}

%qtc_make %{?_smp_mflags}

# >> build post
# << build post

%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%qmake5_install

# >> install post
# << install post

desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop

%files
%defattr(-,root,root,-)
%{_bindir}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
# >> files
# << files
75 changes: 39 additions & 36 deletions src/harbour-sailfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,46 +33,49 @@

int main(int argc, char *argv[])
{
// Set up qml engine.
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());
qApp->setApplicationVersion(QString(APP_VERSION));
// Enforce QT_OPENGL_NO_BGRA for Xperia X
qputenv("QT_OPENGL_NO_BGRA", "1");

// Set application version and enable logging
enableLogger(false);
// Set up qml engine.
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());
qApp->setApplicationVersion(QString(APP_VERSION));

// Enable default translations
QTranslator *translator = new QTranslator(qApp);
QString trPath = SailfishApp::pathTo(QStringLiteral("translations")).toLocalFile();
QString appName = app->applicationName();
// Check if translations have been already loaded
if (!translator->load(QLocale::system(), appName, "-", trPath))
{
// Load default translations if not
translator->load(appName, trPath);
app->installTranslator(translator);
}
else
{
translator->deleteLater();
}
// Set application version and enable logging
enableLogger(false);

// Register custom QML modules
qmlRegisterUncreatableType<User>("Harbour.Sailfinder.Models", 1, 0, "User", "read only");
qmlRegisterUncreatableType<Person>("Harbour.Sailfinder.Models", 1, 0, "Person", "read only");
qmlRegisterUncreatableType<Recommendation>("Harbour.Sailfinder.Models", 1, 0, "Recommendation", "read only");
qmlRegisterUncreatableType<Match>("Harbour.Sailfinder.Models", 1, 0, "Match", "read only");
qmlRegisterUncreatableType<Photo>("Harbour.Sailfinder.Models", 1, 0, "Photo", "read only");
qmlRegisterUncreatableType<Message>("Harbour.Sailfinder.Models", 1, 0, "Message", "read only");
qmlRegisterUncreatableType<School>("Harbour.Sailfinder.Models", 1, 0, "School", "read only");
qmlRegisterUncreatableType<Job>("Harbour.Sailfinder.Models", 1, 0, "Job", "read only");
qmlRegisterUncreatableType<Sailfinder>("Harbour.Sailfinder.Models", 1, 0, "Sailfinder", "read only");
qmlRegisterType<API>("Harbour.Sailfinder.API", 1, 0, "API");
qmlRegisterType<OS>("Harbour.Sailfinder.SFOS", 1, 0, "SFOS");
// Enable default translations
QTranslator *translator = new QTranslator(qApp);
QString trPath = SailfishApp::pathTo(QStringLiteral("translations")).toLocalFile();
QString appName = app->applicationName();
// Check if translations have been already loaded
if(!translator->load(QLocale::system(), appName, "-", trPath))
{
// Load default translations if not
translator->load(appName, trPath);
app->installTranslator(translator);
}
else
{
translator->deleteLater();
}

// Start the application.
view->setSource(SailfishApp::pathTo("qml/harbour-sailfinder.qml"));
view->show();
// Register custom QML modules
qmlRegisterUncreatableType<User>("Harbour.Sailfinder.Models", 1, 0, "User", "read only");
qmlRegisterUncreatableType<Person>("Harbour.Sailfinder.Models", 1, 0, "Person", "read only");
qmlRegisterUncreatableType<Recommendation>("Harbour.Sailfinder.Models", 1, 0, "Recommendation", "read only");
qmlRegisterUncreatableType<Match>("Harbour.Sailfinder.Models", 1, 0, "Match", "read only");
qmlRegisterUncreatableType<Photo>("Harbour.Sailfinder.Models", 1, 0, "Photo", "read only");
qmlRegisterUncreatableType<Message>("Harbour.Sailfinder.Models", 1, 0, "Message", "read only");
qmlRegisterUncreatableType<School>("Harbour.Sailfinder.Models", 1, 0, "School", "read only");
qmlRegisterUncreatableType<Job>("Harbour.Sailfinder.Models", 1, 0, "Job", "read only");
qmlRegisterUncreatableType<Sailfinder>("Harbour.Sailfinder.Models", 1, 0, "Sailfinder", "read only");
qmlRegisterType<API>("Harbour.Sailfinder.API", 1, 0, "API");
qmlRegisterType<OS>("Harbour.Sailfinder.SFOS", 1, 0, "SFOS");

// Start the application.
view->setSource(SailfishApp::pathTo("qml/harbour-sailfinder.qml"));
view->show();

return app->exec();
}
4 changes: 4 additions & 0 deletions src/models/matcheslistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,8 @@ void MatchesListModel::updateMatchLastMessage(const QString &matchId, Message *l
this->endResetModel();
}

int MatchesListModel::numberOfMatches()
{
return this->matchesList().count();
}

1 change: 1 addition & 0 deletions src/models/matcheslistmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class MatchesListModel : public QAbstractListModel
QList<Match *> matchesList() const;
void setMatchesList(const QList<Match *> &matchesList);
void updateMatchLastMessage(const QString &matchId, Message* lastMessage);
Q_INVOKABLE int numberOfMatches();

protected:
QHash<int, QByteArray> roleNames() const;
Expand Down
2 changes: 1 addition & 1 deletion src/models/photolistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PhotoListModel::~PhotoListModel()

Photo* PhotoListModel::getPhoto(int index)
{
if(index < this->photoList().length() && index > 0) {
if(index < this->photoList().length() && index >= 0) {
return this->photoList().at(index);
}
return new Photo(QString("NA"), QUrl(""));
Expand Down

0 comments on commit b0146b4

Please sign in to comment.