commit a4dfc5b9bc132060bd2945c50ba9fac274186e66 Author: Dark Steveneq Date: Fri Oct 10 21:19:26 2025 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..ff51edf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100755 index 0000000..3ff5300 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.sourceDirectory": "/home/dark/qyouradio/qyouradio" +} \ No newline at end of file diff --git a/build.nix b/build.nix new file mode 100755 index 0000000..8c80cfc --- /dev/null +++ b/build.nix @@ -0,0 +1,41 @@ +{ stdenv +, lib +, clang +, qtbase +, qtdeclarative +, qtmultimedia +, qtlocation +, qtwebview +, qtwayland +, libglvnd +, cmake +, wrapQtAppsHook +}: +stdenv.mkDerivation { + pname = "qyouradio"; + version = "1.0"; + + src = ./qyouradio; + + buildInputs = [ + qtbase + qtdeclarative + qtlocation + qtmultimedia + qtwebview + ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + qtwayland + libglvnd + ]; + + nativeBuildInputs = [ + clang + cmake + wrapQtAppsHook + ]; + + installPhase = '' + mkdir -p $out/bin + cp qyouradio $out/bin/ + ''; +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100755 index 0000000..f4ca54b --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1759362264, + "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1760036653, + "narHash": "sha256-FJOwW7YMxtnMi3R+MxwiVsUsrOtm3ubIBo8Jdc1nH6w=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b6bae5b8d26ef00d8df42206ac24d0665640286b", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1754788789, + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100755 index 0000000..b11345c --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:nixos/nixpkgs"; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "aarch64-linux" "x86_64-linux" ]; + perSystem = { config, pkgs, ... }: { + packages.default = pkgs.qt6Packages.callPackage ./build.nix { }; + devShells.default = pkgs.mkShell { + inputsFrom = [ config.packages.default ]; + buildInputs = with pkgs; [ + gdb + qtcreator + qt6.qttools + + # this is for the shellhook portion + qt6.wrapQtAppsHook + makeWrapper + bashInteractive + ]; + # set the environment variables that unpatched Qt apps expect + shellHook = '' + bashdir=$(mktemp -d) + makeWrapper "$(type -p bash)" "$bashdir/bash" "''${qtWrapperArgs[@]}" + exec "$bashdir/bash" + ''; + }; + }; + }; +} \ No newline at end of file diff --git a/qyouradio/.gitignore b/qyouradio/.gitignore new file mode 100755 index 0000000..aa3808c --- /dev/null +++ b/qyouradio/.gitignore @@ -0,0 +1,82 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +*.qbs.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + +# Directories with generated files +.moc/ +.obj/ +.pch/ +.rcc/ +.uic/ +/build*/ diff --git a/qyouradio/CMakeLists.txt b/qyouradio/CMakeLists.txt new file mode 100755 index 0000000..f5bc99f --- /dev/null +++ b/qyouradio/CMakeLists.txt @@ -0,0 +1,84 @@ +cmake_minimum_required(VERSION 3.16) + +project(qyouradio VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +FUNCTION(PREPEND var ) + SET(listVar "") + FOREACH(f ${${var}}) + LIST(APPEND listVar "${CMAKE_CURRENT_SOURCE_DIR}/${f}") + ENDFOREACH(f) + SET(${var} "${listVar}" PARENT_SCOPE) +ENDFUNCTION() + +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick LinguistTools) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick LinguistTools) + +add_subdirectory(locale/) +add_subdirectory(src/) + +set(PROJECT_SOURCES + ${CXX_FILES} + ${QML_FILES} + ${TS_FILES} +) + +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + qt_add_executable(qyouradio + MANUAL_FINALIZATION + ${PROJECT_SOURCES} + ) +# Define target properties for Android with Qt 6 as: +# set_property(TARGET qyouradio APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR +# ${CMAKE_CURRENT_SOURCE_DIR}/android) +# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation + + qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR}/locale ${TS_FILES}) +else() + if(ANDROID) + add_library(qyouradio SHARED + ${PROJECT_SOURCES} + ) +# Define properties for Android with Qt 5 after find_package() calls as: +# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") + else() + add_executable(qyouradio + ${PROJECT_SOURCES} + ) + endif() + + qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR}/locale ${TS_FILES}) +endif() + +target_link_libraries(qyouradio + PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick) + +# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. +# If you are developing for iOS or macOS you should consider setting an +# explicit, fixed bundle identifier manually though. +if(${QT_VERSION} VERSION_LESS 6.1.0) + set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER xyz.nonmesoft.qyouradio) +endif() +set_target_properties(qyouradio PROPERTIES + ${BUNDLE_ID_OPTION} + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE +) + +include(GNUInstallDirs) +install(TARGETS qyouradio + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +if(QT_VERSION_MAJOR EQUAL 6) + qt_import_qml_plugins(qyouradio) + qt_finalize_executable(qyouradio) +endif() diff --git a/qyouradio/locale/CMakeLists.txt b/qyouradio/locale/CMakeLists.txt new file mode 100644 index 0000000..c0cf048 --- /dev/null +++ b/qyouradio/locale/CMakeLists.txt @@ -0,0 +1,7 @@ +set(TS_FILES + qyouradio_en_US.ts + qyouradio_pl_PL.ts +) + +PREPEND(TS_FILES) +set(TS_FILES ${TS_FILES} PARENT_SCOPE) diff --git a/qyouradio/locale/qyouradio_en_US.ts b/qyouradio/locale/qyouradio_en_US.ts new file mode 100755 index 0000000..edd0d34 --- /dev/null +++ b/qyouradio/locale/qyouradio_en_US.ts @@ -0,0 +1,3 @@ + + + diff --git a/qyouradio/locale/qyouradio_pl_PL.ts b/qyouradio/locale/qyouradio_pl_PL.ts new file mode 100755 index 0000000..9a6efd5 --- /dev/null +++ b/qyouradio/locale/qyouradio_pl_PL.ts @@ -0,0 +1,3 @@ + + + diff --git a/qyouradio/src/CMakeLists.txt b/qyouradio/src/CMakeLists.txt new file mode 100644 index 0000000..57b0108 --- /dev/null +++ b/qyouradio/src/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(qml) +set(QML_FILES ${QML_FILES} PARENT_SCOPE) + +set(CXX_FILES + main.cpp +) +PREPEND(CXX_FILES) +set(CXX_FILES ${CXX_FILES} PARENT_SCOPE) diff --git a/qyouradio/src/main.cpp b/qyouradio/src/main.cpp new file mode 100755 index 0000000..0bdc446 --- /dev/null +++ b/qyouradio/src/main.cpp @@ -0,0 +1,34 @@ +#include +#include + +#include +#include + +int main(int argc, char *argv[]) +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + QGuiApplication app(argc, argv); + + QTranslator translator; + const QStringList uiLanguages = QLocale::system().uiLanguages(); + for (const QString &locale : uiLanguages) { + const QString baseName = "qyouradio_" + QLocale(locale).name(); + if (translator.load(":/i18n/" + baseName)) { + app.installTranslator(&translator); + break; + } + } + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/qyouradio/src/qml/CMakeLists.txt b/qyouradio/src/qml/CMakeLists.txt new file mode 100644 index 0000000..bc66982 --- /dev/null +++ b/qyouradio/src/qml/CMakeLists.txt @@ -0,0 +1,9 @@ +set(QML_FILES + qml.qrc + # main.qml + + components/qml.qrc + # components/Button.qml +) +PREPEND(QML_FILES) +set(QML_FILES ${QML_FILES} PARENT_SCOPE) diff --git a/qyouradio/src/qml/components/Button.qml b/qyouradio/src/qml/components/Button.qml new file mode 100644 index 0000000..8033669 --- /dev/null +++ b/qyouradio/src/qml/components/Button.qml @@ -0,0 +1,18 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 as QC + +QC.Button { + highlighted: true + background: Rectangle { + color: hovered ? "#0056b3" : "#007bff" + radius: 5 + } + + implicitHeight: 36 + + Component.onCompleted: { + contentItem.color = "#f4f4f4"; + font.family = "Arial"; + font.pointSize = 12; + } +} diff --git a/qyouradio/src/qml/components/CheckBox.qml b/qyouradio/src/qml/components/CheckBox.qml new file mode 100644 index 0000000..9187fcc --- /dev/null +++ b/qyouradio/src/qml/components/CheckBox.qml @@ -0,0 +1,13 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.155 as QC + +QC.CheckBox { + implicitWidth: 14 + implicitHeight: 14 + contentItem: Rectangle { + radius: 2 + color: parent.checked ? (parent.hovered ? "#0056b3" : "#007bff") : "#ffffff" + border.color: parent.checked ? (parent.hovered ? "#0056b3" : "#007bff") : "#ffffff" + border.width: 1 + } +} diff --git a/qyouradio/src/qml/components/Slider.qml b/qyouradio/src/qml/components/Slider.qml new file mode 100644 index 0000000..36f35b6 --- /dev/null +++ b/qyouradio/src/qml/components/Slider.qml @@ -0,0 +1,62 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 as QC + +QC.Slider { + from: 0.0 + value: 0.5 + stepSize: 0.1 + to: 1.1 + snapMode: Slider.SnapAlways + + implicitWidth: 130 + implicitHeight: 20 + + background: Rectangle { + color: "#555" + radius: 5 + + // OpacityAnimator on opacity { + // from: 0.7 + // to: 1 + // duration: 200 + // target: parent + // running: parent.hovered + // } + + // OpacityAnimator on opacity { + // from: 1 + // to: 0.7 + // duration: 200 + // target: parent + // running: !parent.parent.hovered + // } + } + + handle: Rectangle { + x: parent.leftPadding + parent.visualPosition * (parent.availableWidth - width) + y: parent.topPadding + parent.availableHeight / 2 - height / 2 + width: 20 + height: 20 + radius: 10 + color: "#007bff" + + OpacityAnimator on opacity{ + from: 0.7 + to: 1 + duration: 200 + target: parent + running: parent.hovered + } + OpacityAnimator on opacity{ + from: 1 + to: 0.7 + duration: 200 + target: parent + running: !parent.hovered + } + } + + onMoved: function() { + value = Math.max(value, 0.1); + } +} diff --git a/qyouradio/src/qml/components/qml.qrc b/qyouradio/src/qml/components/qml.qrc new file mode 100755 index 0000000..6d9bef5 --- /dev/null +++ b/qyouradio/src/qml/components/qml.qrc @@ -0,0 +1,7 @@ + + + Button.qml + CheckBox.qml + Slider.qml + + diff --git a/qyouradio/src/qml/main.qml b/qyouradio/src/qml/main.qml new file mode 100755 index 0000000..60b3d5f --- /dev/null +++ b/qyouradio/src/qml/main.qml @@ -0,0 +1,22 @@ +import QtQuick 2.15 +import QtQuick.Window 2.15 +import "components/" + +Window { + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") + + Button { + text: qsTr("Play") + } + + CheckBox { + + } + + Slider { + + } +} diff --git a/qyouradio/src/qml/qml.qrc b/qyouradio/src/qml/qml.qrc new file mode 100755 index 0000000..5f6483a --- /dev/null +++ b/qyouradio/src/qml/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + +