diff --git a/qtquick/CMakeLists.txt b/qtquick/CMakeLists.txt index 05f8619..34dbf06 100644 --- a/qtquick/CMakeLists.txt +++ b/qtquick/CMakeLists.txt @@ -1,8 +1,9 @@ find_package(Qt5 COMPONENTS Gui Qml Quick) set(sailfin_SOURCES - src/main.cpp) + src/main.cpp) -add_executable(sailfin ${sailfin_SOURCES}) +qt5_add_resources(sailfin_RESOURCES qml.qrc) +add_executable(sailfin ${sailfin_SOURCES} ${sailfin_RESOURCES}) target_link_libraries(sailfin PUBLIC Qt5::Gui Qt5::Qml Qt5::Quick jellyfin-qt) install(TARGETS sailfin diff --git a/qtquick/assets/img/particle.png b/qtquick/assets/img/particle.png new file mode 100644 index 0000000..e2d89c0 Binary files /dev/null and b/qtquick/assets/img/particle.png differ diff --git a/qtquick/qml.qrc b/qtquick/qml.qrc new file mode 100644 index 0000000..a82a7b3 --- /dev/null +++ b/qtquick/qml.qrc @@ -0,0 +1,7 @@ + + + qml/main.qml + qml/components/Background.qml + assets/img/particle.png + + diff --git a/qtquick/qml/components/Background.qml b/qtquick/qml/components/Background.qml new file mode 100644 index 0000000..f760e91 --- /dev/null +++ b/qtquick/qml/components/Background.qml @@ -0,0 +1,36 @@ +import QtQuick 2.12 +import QtQuick.Particles 2.12 + +Rectangle { + color: "black" + + ParticleSystem { + id: particleSystem + } + + Emitter { + id: emitter + anchors.fill: parent + system: particleSystem + emitRate: width * height / (lifeSpan * 100) + lifeSpan: 10000 + lifeSpanVariation: 500 + size: 16 + endSize: 64 + } + + Wander { + anchors.fill: parent + system: particleSystem + pace: 100 + affectedParameter: Wander.Velocity + xVariance: 300 + yVariance: 300 + } + + + ImageParticle { + source: "/assets/img/particle.png" + system: particleSystem + } +} diff --git a/qtquick/qml/main.qml b/qtquick/qml/main.qml new file mode 100644 index 0000000..d171b11 --- /dev/null +++ b/qtquick/qml/main.qml @@ -0,0 +1,14 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 + +import "components" + +Window { + width: 600 + height: 600 + visible: true + + Background { + anchors.fill: parent + } +} diff --git a/qtquick/src/main.cpp b/qtquick/src/main.cpp index 84e0c9a..a1fbc5c 100644 --- a/qtquick/src/main.cpp +++ b/qtquick/src/main.cpp @@ -1,9 +1,22 @@ +#include +#include #include +#include + #include int main(int argc, char** argv) { QGuiApplication app(argc, argv); - Jellyfin::registerTypes(); + app.setApplicationDisplayName(QStringLiteral("Sailfin QtQuick")); + qDebug() << "Creating engine"; + QQmlApplicationEngine engine; + + qDebug() << "Registering types"; + Jellyfin::registerTypes(); + + qDebug() << "Loading file"; + engine.load(QStringLiteral("qrc:/qml/main.qml")); + qDebug() << "Entering event loop"; return app.exec(); }