mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-22 09:15:18 +00:00
Make libJellyfinQt a proper qml plugin
This commit is contained in:
parent
96ecd8e7d8
commit
64ad37707c
|
@ -19,11 +19,15 @@ endif()
|
||||||
|
|
||||||
if(PLATFORM_SAILFISHOS)
|
if(PLATFORM_SAILFISHOS)
|
||||||
# Hardcode this less?
|
# Hardcode this less?
|
||||||
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/share/harbour-sailfin/lib")
|
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/share/harbour-sailfin/nl/netsoj/chris/Jellyfin")
|
||||||
set(USE_MLITE ON)
|
set(USE_MLITE ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (PLATFORM_SAILFISHOS)
|
||||||
|
set(CMAKE_BUILD_SHARED_LIBS NO)
|
||||||
|
endif()
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
|
|
||||||
if(PLATFORM_SAILFISHOS)
|
if(PLATFORM_SAILFISHOS)
|
||||||
add_subdirectory(sailfish)
|
add_subdirectory(sailfish)
|
||||||
elseif(PLATFORM_QTQUICK)
|
elseif(PLATFORM_QTQUICK)
|
||||||
|
|
|
@ -101,7 +101,7 @@ endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_library(JellyfinQt ${JellyfinQt_SOURCES} ${JellyfinQt_HEADERS})
|
add_library(JellyfinQt ${JellyfinQt_SOURCES} ${JellyfinQt_HEADERS} qmldir JellyfinQt.qmltypes)
|
||||||
|
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0")
|
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0")
|
||||||
if(BUILD_PRECOMPILED_HEADERS)
|
if(BUILD_PRECOMPILED_HEADERS)
|
||||||
|
@ -128,4 +128,29 @@ install(TARGETS JellyfinQt
|
||||||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
|
||||||
|
add_custom_target(qmltypes
|
||||||
|
COMMAND qmlplugindump -nonrelocatable nl.netsoj.chris.Jellyfin 1.0 > $$PWD/JellyfinQt.qmltypes)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
TARGET JellyfinQt
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} -E copy
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/qmldir
|
||||||
|
$<TARGET_FILE_DIR:JellyfinQt>/qmldir
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
TARGET JellyfinQt
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} -E copy
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/JellyfinQt.qmltypes
|
||||||
|
$<TARGET_FILE_DIR:JellyfinQt>/JellyfinQt.qmltypes
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
set(QML_IMPORT_PATH $<TARGET_FILE_DIR:JellyfinQt> CACHE PATH "")
|
||||||
|
install(FILES $<TARGET_FILE_DIR:JellyfinQt>/qmldir DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
export(TARGETS JellyfinQt FILE JellyfinQtConfig.cmake)
|
export(TARGETS JellyfinQt FILE JellyfinQtConfig.cmake)
|
||||||
|
|
1828
core/JellyfinQt.qmltypes
Normal file
1828
core/JellyfinQt.qmltypes
Normal file
File diff suppressed because it is too large
Load diff
|
@ -19,35 +19,18 @@
|
||||||
#ifndef JELLYFIN_H
|
#ifndef JELLYFIN_H
|
||||||
#define JELLYFIN_H
|
#define JELLYFIN_H
|
||||||
|
|
||||||
|
#include <QQmlExtensionPlugin>
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
|
|
||||||
#include "model/item.h"
|
|
||||||
#include "dto/itemfields.h"
|
|
||||||
#include "dto/mediastream.h"
|
|
||||||
#include "dto/nameguidpair.h"
|
|
||||||
#include "dto/userdto.h"
|
|
||||||
#include "dto/useritemdatadto.h"
|
|
||||||
|
|
||||||
#include "apiclient.h"
|
|
||||||
#include "apimodel.h"
|
|
||||||
#include "serverdiscoverymodel.h"
|
|
||||||
#include "websocket.h"
|
|
||||||
#include "viewmodel/item.h"
|
|
||||||
#include "viewmodel/itemmodel.h"
|
|
||||||
#include "viewmodel/loader.h"
|
|
||||||
#include "viewmodel/mediastream.h"
|
|
||||||
#include "viewmodel/modelstatus.h"
|
|
||||||
#include "viewmodel/platformmediacontrol.h"
|
|
||||||
#include "viewmodel/playbackmanager.h"
|
|
||||||
#include "viewmodel/playlist.h"
|
|
||||||
#include "viewmodel/settings.h"
|
|
||||||
#include "viewmodel/userdata.h"
|
|
||||||
#include "viewmodel/usermodel.h"
|
|
||||||
#include "viewmodel/user.h"
|
|
||||||
|
|
||||||
namespace Jellyfin {
|
namespace Jellyfin {
|
||||||
|
|
||||||
void registerTypes(const char *uri = "nl.netsoj.chris.Jellyfin");
|
class JellyfinPlugin : public QQmlExtensionPlugin {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||||
|
public:
|
||||||
|
void registerTypes(const char *uri) override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
module nl.netsoj.chris.Jellyfin
|
||||||
|
plugin JellyfinQt
|
|
@ -17,9 +17,34 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
#include "JellyfinQt/jellyfin.h"
|
#include "JellyfinQt/jellyfin.h"
|
||||||
|
|
||||||
|
#include "JellyfinQt/model/item.h"
|
||||||
|
#include "JellyfinQt/dto/itemfields.h"
|
||||||
|
#include "JellyfinQt/dto/mediastream.h"
|
||||||
|
#include "JellyfinQt/dto/nameguidpair.h"
|
||||||
|
#include "JellyfinQt/dto/userdto.h"
|
||||||
|
#include "JellyfinQt/dto/useritemdatadto.h"
|
||||||
|
|
||||||
|
#include "JellyfinQt/apiclient.h"
|
||||||
|
#include "JellyfinQt/apimodel.h"
|
||||||
|
#include "JellyfinQt/serverdiscoverymodel.h"
|
||||||
|
#include "JellyfinQt/websocket.h"
|
||||||
|
#include "JellyfinQt/viewmodel/item.h"
|
||||||
|
#include "JellyfinQt/viewmodel/itemmodel.h"
|
||||||
|
#include "JellyfinQt/viewmodel/loader.h"
|
||||||
|
#include "JellyfinQt/viewmodel/mediastream.h"
|
||||||
|
#include "JellyfinQt/viewmodel/modelstatus.h"
|
||||||
|
#include "JellyfinQt/viewmodel/platformmediacontrol.h"
|
||||||
|
#include "JellyfinQt/viewmodel/playbackmanager.h"
|
||||||
|
#include "JellyfinQt/viewmodel/playlist.h"
|
||||||
|
#include "JellyfinQt/viewmodel/settings.h"
|
||||||
|
#include "JellyfinQt/viewmodel/userdata.h"
|
||||||
|
#include "JellyfinQt/viewmodel/usermodel.h"
|
||||||
|
#include "JellyfinQt/viewmodel/user.h"
|
||||||
|
|
||||||
namespace Jellyfin {
|
namespace Jellyfin {
|
||||||
|
|
||||||
void registerTypes(const char *uri) {
|
void JellyfinPlugin::registerTypes(const char *uri) {
|
||||||
qmlRegisterType<ApiClient>(uri, 1, 0, "ApiClient");
|
qmlRegisterType<ApiClient>(uri, 1, 0, "ApiClient");
|
||||||
qmlRegisterType<ServerDiscoveryModel>(uri, 1, 0, "ServerDiscoveryModel");
|
qmlRegisterType<ServerDiscoveryModel>(uri, 1, 0, "ServerDiscoveryModel");
|
||||||
qmlRegisterType<ViewModel::PlaybackManager>(uri, 1, 0, "PlaybackManager");
|
qmlRegisterType<ViewModel::PlaybackManager>(uri, 1, 0, "PlaybackManager");
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
app.setApplicationDisplayName(QStringLiteral("Sailfin QtQuick"));
|
app.setApplicationDisplayName(QStringLiteral("Sailfin QtQuick"));
|
||||||
|
app.setApplicationName("Sailfin QtQuick");
|
||||||
|
app.setOrganizationDomain("nl.netsoj.chris");
|
||||||
|
app.setOrganizationName("Chris Josten");
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
// Disable Qt nagging about "implicitly defined onFoo properties in connections are deprecated",
|
// Disable Qt nagging about "implicitly defined onFoo properties in connections are deprecated",
|
||||||
|
@ -25,7 +28,8 @@ int main(int argc, char** argv) {
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
qDebug() << "Registering types";
|
qDebug() << "Registering types";
|
||||||
Jellyfin::registerTypes();
|
Jellyfin::JellyfinPlugin plugin;
|
||||||
|
plugin.registerTypes("nl.netsoj.chris.Jellyfin");
|
||||||
|
|
||||||
qDebug() << "Loading file";
|
qDebug() << "Loading file";
|
||||||
engine.load(QStringLiteral("qrc:/qml/main.qml"));
|
engine.load(QStringLiteral("qrc:/qml/main.qml"));
|
||||||
|
|
|
@ -58,6 +58,7 @@ set(sailfin_QML_SOURCES
|
||||||
qml/pages/itemdetails/UnsupportedPage.qml
|
qml/pages/itemdetails/UnsupportedPage.qml
|
||||||
qml/pages/itemdetails/VideoPage.qml
|
qml/pages/itemdetails/VideoPage.qml
|
||||||
qml/pages/settings/DebugPage.qml
|
qml/pages/settings/DebugPage.qml
|
||||||
|
qml/pages/settings/StreamingPage.qml
|
||||||
qml/pages/setup/AddServerConnectingPage.qml
|
qml/pages/setup/AddServerConnectingPage.qml
|
||||||
qml/pages/setup/AddServerPage.qml
|
qml/pages/setup/AddServerPage.qml
|
||||||
qml/pages/setup/LoginDialog.qml
|
qml/pages/setup/LoginDialog.qml
|
||||||
|
@ -90,14 +91,12 @@ install(FILES icons/86x86/harbour-sailfin.png
|
||||||
DESTINATION share/icons/hicolor/86x86/apps
|
DESTINATION share/icons/hicolor/86x86/apps
|
||||||
)
|
)
|
||||||
install(FILES icons/108x108/harbour-sailfin.png
|
install(FILES icons/108x108/harbour-sailfin.png
|
||||||
DESTINATION share/icons/hicolor/108x108/apps
|
DESTINATION share/icons/hicolor/108x108/apps )
|
||||||
)
|
|
||||||
install(FILES icons/128x128/harbour-sailfin.png
|
install(FILES icons/128x128/harbour-sailfin.png
|
||||||
DESTINATION share/icons/hicolor/128x128/apps
|
DESTINATION share/icons/hicolor/128x128/apps
|
||||||
)
|
)
|
||||||
install(FILES icons/172x172/harbour-sailfin.png
|
install(FILES icons/172x172/harbour-sailfin.png
|
||||||
DESTINATION share/icons/hicolor/172x172/apps
|
DESTINATION share/icons/hicolor/172x172/apps )
|
||||||
)
|
|
||||||
|
|
||||||
# Tell Qt Creator where the application executable(s) would be located on the
|
# Tell Qt Creator where the application executable(s) would be located on the
|
||||||
# device.
|
# device.
|
||||||
|
|
|
@ -33,10 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#include <sailfishapp.h>
|
#include <sailfishapp.h>
|
||||||
|
|
||||||
#include <JellyfinQt/jellyfin.h>
|
|
||||||
|
|
||||||
static const char *SANDBOX_PROGRAM = "/usr/bin/sailjail";
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
//QQmlDebuggingEnabler enabler;
|
//QQmlDebuggingEnabler enabler;
|
||||||
//enabler.startTcpDebugServer(9999);
|
//enabler.startTcpDebugServer(9999);
|
||||||
|
@ -60,7 +56,6 @@ int main(int argc, char *argv[]) {
|
||||||
cmdParser.addHelpOption();
|
cmdParser.addHelpOption();
|
||||||
cmdParser.addVersionOption();
|
cmdParser.addVersionOption();
|
||||||
|
|
||||||
Jellyfin::registerTypes();
|
|
||||||
QQuickView *view = SailfishApp::createView();
|
QQuickView *view = SailfishApp::createView();
|
||||||
view->setSource(SailfishApp::pathToMainQml());
|
view->setSource(SailfishApp::pathToMainQml());
|
||||||
view->show();
|
view->show();
|
||||||
|
|
Loading…
Reference in a new issue