1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-04 01:42:44 +00:00

Switched to a sane build system (CMake)

This commit is contained in:
Chris Josten 2020-10-25 19:58:02 +01:00
parent 9cfd6d7ee2
commit 228bcfb685
36 changed files with 286 additions and 211 deletions

42
core/CMakeLists.txt Normal file
View file

@ -0,0 +1,42 @@
project(jellyfin-qt)
find_package(Qt5 5.6 COMPONENTS Multimedia Network Qml WebSockets REQUIRED)
include(GNUInstallDirs)
set(jellyfin-qt_SOURCES
src/credentialmanager.cpp
src/jellyfin.cpp
src/jellyfinapiclient.cpp
src/jellyfinapimodel.cpp
src/jellyfindeviceprofile.cpp
src/jellyfinitem.cpp
src/jellyfinplaybackmanager.cpp
src/jellyfinwebsocket.cpp
src/jsonhelper.cpp
src/serverdiscoverymodel.cpp)
set(jellyfin-qt_HEADERS
include/JellyfinQt/credentialmanager.h
include/JellyfinQt/jellyfin.h
include/JellyfinQt/jellyfinapiclient.h
include/JellyfinQt/jellyfinapimodel.h
include/JellyfinQt/jellyfindeviceprofile.h
include/JellyfinQt/jellyfinitem.h
include/JellyfinQt/jellyfinplaybackmanager.h
include/JellyfinQt/jellyfinwebsocket.h
include/JellyfinQt/jsonhelper.h
include/JellyfinQt/serverdiscoverymodel.h)
add_definitions(-DSAILFIN_VERSION=\"${SAILFIN_VERSION}\")
add_library(jellyfin-qt ${jellyfin-qt_SOURCES} ${jellyfin-qt_HEADERS})
target_include_directories(jellyfin-qt
PUBLIC "include"
)
target_link_libraries(jellyfin-qt PUBLIC Qt5::Core Qt5::Multimedia Qt5::Network Qt5::Qml Qt5::WebSockets)
set_target_properties(jellyfin-qt PROPERTIES CXX_VISIBILITY_PRESET default)
install(TARGETS jellyfin-qt
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
export(TARGETS jellyfin-qt FILE JellyfinQtConfig.cmake)

View file

@ -1,34 +0,0 @@
TEMPLATE = lib
QT += qml multimedia network websockets
include(defines.pri)
include(../harbour-sailfin.pri)
SOURCES += \
src/credentialmanager.cpp \
src/jellyfin.cpp \
src/jellyfinapiclient.cpp \
src/jellyfinapimodel.cpp \
src/jellyfindeviceprofile.cpp \
src/jellyfinitem.cpp \
src/jellyfinplaybackmanager.cpp \
src/jellyfinwebsocket.cpp \
src/jsonhelper.cpp \
src/serverdiscoverymodel.cpp
HEADERS += \
include/credentialmanager.h \
include/jellyfin.h \
include/jellyfinapiclient.h \
include/jellyfinapimodel.h \
include/jellyfindeviceprofile.h \
include/jellyfinitem.h \
include/jellyfinplaybackmanager.h \
include/jellyfinwebsocket.h \
include/jsonhelper.h \
include/serverdiscoverymodel.h
VERSION = $$SAILFIN_VERSION
TARGET = jellyfin-qt
DESTDIR = lib

View file

@ -1,2 +0,0 @@
message(Including $$_FILE_ from $$IN_PWD)
INCLUDEPATH += $$IN_PWD/include

View file

@ -0,0 +1,16 @@
#ifndef JELLYFIN_H
#define JELLYFIN_H
#include <QtQml>
#include "JellyfinQt/jellyfinapiclient.h"
#include "JellyfinQt/jellyfinapimodel.h"
#include "JellyfinQt/jellyfinitem.h"
#include "JellyfinQt/serverdiscoverymodel.h"
#include "JellyfinQt/jellyfinplaybackmanager.h"
namespace Jellyfin {
void registerTypes();
}
#endif // JELLYFIN_H

View file

@ -251,8 +251,7 @@ private:
*/
class PublicUserModel : public ApiModel {
public:
explicit PublicUserModel (QObject *parent = nullptr)
: ApiModel ("/users/public", false, false, parent) { }
explicit PublicUserModel (QObject *parent = nullptr);
};
/**
@ -270,44 +269,37 @@ public slots:
class UserViewModel : public ApiModel {
public:
explicit UserViewModel (QObject *parent = nullptr)
: ApiModel ("/Users/{{user}}/Views", true, false, parent) {}
explicit UserViewModel (QObject *parent = nullptr);
};
class UserItemModel : public ItemModel {
public:
explicit UserItemModel (QObject *parent = nullptr)
: ItemModel ("/Users/{{user}}/Items", true, false, parent) {}
explicit UserItemModel (QObject *parent = nullptr);
};
class UserItemResumeModel : public ItemModel {
public:
explicit UserItemResumeModel (QObject *parent = nullptr)
: ItemModel ("/Users/{{user}}/Items/Resume", true, false, parent) {}
explicit UserItemResumeModel (QObject *parent = nullptr);
};
class UserItemLatestModel : public ItemModel {
public:
explicit UserItemLatestModel (QObject *parent = nullptr)
: ItemModel ("/Users/{{user}}/Items/Latest", false, false, parent) {}
explicit UserItemLatestModel (QObject *parent = nullptr);
};
class ShowNextUpModel : public ItemModel {
public:
explicit ShowNextUpModel (QObject *parent = nullptr)
: ItemModel("/Shows/NextUp", true, true, parent) {}
explicit ShowNextUpModel (QObject *parent = nullptr);
};
class ShowSeasonsModel : public ItemModel {
public:
explicit ShowSeasonsModel (QObject *parent = nullptr)
: ItemModel ("/Shows/{{show}}/Seasons", true, true, parent) {}
explicit ShowSeasonsModel (QObject *parent = nullptr);
};
class ShowEpisodesModel : public ItemModel {
public:
explicit ShowEpisodesModel (QObject *parent = nullptr)
: ItemModel ("/Shows/{{show}}/Episodes", true, true, parent) {}
explicit ShowEpisodesModel (QObject *parent = nullptr);
};

View file

@ -1,16 +0,0 @@
#ifndef JELLYFIN_H
#define JELLYFIN_H
#include <QtQml>
#include "jellyfinapiclient.h"
#include "jellyfinapimodel.h"
#include "jellyfinitem.h"
#include "serverdiscoverymodel.h"
#include "jellyfinplaybackmanager.h"
namespace Jellyfin {
void registerTypes();
}
#endif // JELLYFIN_H

View file

@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "credentialmanager.h"
#include "JellyfinQt/credentialmanager.h"
CredentialsManager * CredentialsManager::newInstance(QObject *parent) {
return new FallbackCredentialsManager(parent);

View file

@ -1,4 +1,22 @@
#include "jellyfin.h"
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "JellyfinQt/jellyfin.h"
namespace Jellyfin {
void registerTypes() {

View file

@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "jellyfinapiclient.h"
#include "JellyfinQt/jellyfinapiclient.h"
namespace Jellyfin {

View file

@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "jellyfinapimodel.h"
#include "JellyfinQt/jellyfinapimodel.h"
namespace Jellyfin {
ApiModel::ApiModel(QString path, bool hasRecordResponse, bool addUserId, QObject *parent)
@ -240,6 +240,29 @@ void ItemModel::onUserDataChanged(const QString &itemId, QSharedPointer<UserData
}
}
PublicUserModel::PublicUserModel(QObject *parent)
: ApiModel ("/users/public", false, false, parent) { }
UserViewModel::UserViewModel(QObject *parent)
: ApiModel ("/Users/{{user}}/Views", true, false, parent) {}
UserItemModel::UserItemModel(QObject *parent)
: ItemModel ("/Users/{{user}}/Items", true, false, parent) {}
UserItemResumeModel::UserItemResumeModel(QObject *parent)
: ItemModel ("/Users/{{user}}/Items/Resume", true, false, parent) {}
UserItemLatestModel::UserItemLatestModel(QObject *parent)
: ItemModel ("/Users/{{user}}/Items/Latest", false, false, parent) {}
ShowNextUpModel::ShowNextUpModel(QObject *parent)
: ItemModel("/Shows/NextUp", true, true, parent) {}
ShowSeasonsModel::ShowSeasonsModel(QObject *parent)
: ItemModel ("/Shows/{{show}}/Seasons", true, true, parent) {}
ShowEpisodesModel::ShowEpisodesModel(QObject *parent)
: ItemModel ("/Shows/{{show}}/Episodes", true, true, parent) {}
void registerModels(const char *URI) {
qmlRegisterUncreatableType<ApiModel>(URI, 1, 0, "ApiModel", "Is enum and base class");

View file

@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "jellyfindeviceprofile.h"
#include "JellyfinQt/jellyfindeviceprofile.h"
namespace Jellyfin {

View file

@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "jellyfinitem.h"
#include "JellyfinQt/jellyfinitem.h"
namespace Jellyfin {
const QRegularExpression JsonSerializable::m_listExpression = QRegularExpression("^QList<\\s*([a-zA-Z0-9]*)\\s*\\*?\\s*>$");

View file

@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "jellyfinplaybackmanager.h"
#include "JellyfinQt/jellyfinplaybackmanager.h"
namespace Jellyfin {

View file

@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "jellyfinwebsocket.h"
#include "JellyfinQt/jellyfinwebsocket.h"
namespace Jellyfin {
WebSocket::WebSocket(ApiClient *client)

View file

@ -1,4 +1,22 @@
#include "jsonhelper.h"
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "JellyfinQt/jsonhelper.h"
namespace Jellyfin {

View file

@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "serverdiscoverymodel.h"
#include "JellyfinQt/serverdiscoverymodel.h"
namespace Jellyfin {
ServerDiscoveryModel::ServerDiscoveryModel(QObject *parent)