diff --git a/LenaPi/LenaPi.pro b/LenaPi/LenaPi.pro index baa2c3a..c21dbe6 100644 --- a/LenaPi/LenaPi.pro +++ b/LenaPi/LenaPi.pro @@ -3,7 +3,7 @@ TEMPLATE = app QT += qml quick multimedia CONFIG += c++11 LIBS += - +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-files SOURCES += main.cpp \ controllers/MusicPlayer.cpp \ models/NavigationListModel.cpp \ @@ -51,3 +51,6 @@ HEADERS += \ controllers/SettingsHandler.h INCLUDEPATH+=/usr/local/include + +DISTFILES += \ + android-files/AndroidManifest.xml diff --git a/LenaPi/LenaPi.pro.user b/LenaPi/LenaPi.pro.user index bcdddb7..a1418e5 100644 --- a/LenaPi/LenaPi.pro.user +++ b/LenaPi/LenaPi.pro.user @@ -1,14 +1,14 @@ - + EnvironmentId - {0510cc5f-8237-43aa-9f4f-ce9a2d4944ec} + {baaf8c13-9b67-4e08-b264-88275a728682} ProjectExplorer.Project.ActiveTarget - 0 + 0 ProjectExplorer.Project.EditorSettings @@ -28,7 +28,7 @@ QmlJSGlobal - 2 + 2 UTF-8 false 4 @@ -37,6 +37,7 @@ true true 1 + false true false 0 @@ -45,6 +46,7 @@ 0 8 true + false 1 true true @@ -59,6 +61,7 @@ true + false true true true @@ -74,7 +77,7 @@ true true Builtin.DefaultTidyAndClazy - 2 + 4 @@ -85,30 +88,44 @@ ProjectExplorer.Project.Target.0 - Desktop - Desktop - Desktop - {ebe72439-b95e-4a0f-b855-a910128856ec} - 0 - 0 - 0 + Android.Device.Type + Android Qt 5.15.2 (android) Clang Multi-Abi + Android Qt 5.15.2 (android) Clang Multi-Abi + {ec9ac26e-ce2e-4aaf-b544-ccaec5b0b918} + 1 + 0 + 0 0 - /home/araemer/source/lenapi/build-LenaPi-Desktop-Debug - /home/araemer/source/lenapi/build-LenaPi-Desktop-Debug + /home/jmr/privat/src/LenaPi/build-LenaPi-Android_Qt_5_15_2_android_Clang_Multi_Abi-Debug + /home/jmr/privat/src/LenaPi/build-LenaPi-Android_Qt_5_15_2_android_Clang_Multi_Abi-Debug true QtProjectManager.QMakeBuildStep - false - + + armeabi-v7a + true Qt4ProjectManager.MakeStep - 2 + + true + Copy application data + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-31 + + true + Build Android APK + QmakeProjectManager.AndroidBuildApkStep + false + + 4 Build Build ProjectExplorer.BuildSteps.Build @@ -119,7 +136,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -127,6 +144,7 @@ 2 false + false Debug Qt4ProjectManager.Qt4BuildConfiguration @@ -134,21 +152,35 @@ 0 - /home/araemer/source/lenapi/build-LenaPi-Desktop-Release - /home/araemer/source/lenapi/build-LenaPi-Desktop-Release + /home/jmr/privat/src/LenaPi/build-LenaPi-Android_Qt_5_15_2_android_Clang_Multi_Abi-Release + /home/jmr/privat/src/LenaPi/build-LenaPi-Android_Qt_5_15_2_android_Clang_Multi_Abi-Release true QtProjectManager.QMakeBuildStep - false - + + armeabi-v7a + true Qt4ProjectManager.MakeStep - 2 + + true + Copy application data + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-31 + + true + Build Android APK + QmakeProjectManager.AndroidBuildApkStep + false + + 4 Build Build ProjectExplorer.BuildSteps.Build @@ -159,7 +191,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -167,6 +199,7 @@ 2 false + false Release Qt4ProjectManager.Qt4BuildConfiguration @@ -176,13 +209,12 @@ 0 - /home/araemer/source/lenapi/build-LenaPi-Desktop-Profile - /home/araemer/source/lenapi/build-LenaPi-Desktop-Profile + /home/jmr/privat/src/LenaPi/build-LenaPi-Android_Qt_5_15_2_android_Clang_Multi_Abi-Profile + /home/jmr/privat/src/LenaPi/build-LenaPi-Android_Qt_5_15_2_android_Clang_Multi_Abi-Profile true QtProjectManager.QMakeBuildStep - false @@ -190,7 +222,20 @@ true Qt4ProjectManager.MakeStep - 2 + + true + Copy application data + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-31 + + true + Build Android APK + QmakeProjectManager.AndroidBuildApkStep + false + + 4 Build Build ProjectExplorer.BuildSteps.Build @@ -201,7 +246,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -209,6 +254,7 @@ 2 false + false Profile Qt4ProjectManager.Qt4BuildConfiguration @@ -217,10 +263,200 @@ 0 0 - 3 + 3 - 0 + + true + <b>Deploy to Android device</b> + Qt4ProjectManager.AndroidDeployQtStep + + 1 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + Qt4ProjectManager.AndroidDeployConfiguration2 + + 1 + + + arm64-v8a + armeabi-v7a + armeabi + + 58009fc2 + 28 + + + dwarf + + cpu-cycles + + -F + true + true + true + + + + + + + + 0 + + LenaPi + Qt4ProjectManager.AndroidRunConfiguration:/home/jmr/privat/src/LenaPi/LenaPi/LenaPi.pro + /home/jmr/privat/src/LenaPi/LenaPi/LenaPi.pro + false + true + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop + desktop + desktop + {73308c85-3272-4fe8-8c9f-0eb72285644f} + 1 + 0 + 0 + + 0 + /home/jmr/privat/src/LenaPi/build-LenaPi-desktop-Debug + /home/jmr/privat/src/LenaPi/build-LenaPi-desktop-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 0 + + + /home/jmr/privat/src/LenaPi/build-LenaPi-desktop-Release + /home/jmr/privat/src/LenaPi/build-LenaPi-desktop-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + /home/jmr/privat/src/LenaPi/build-LenaPi-desktop-Profile + /home/jmr/privat/src/LenaPi/build-LenaPi-desktop-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 Deploy Deploy ProjectExplorer.BuildSteps.Deploy @@ -230,82 +466,33 @@ false ProjectExplorer.DefaultDeployConfiguration - 1 + 1 dwarf cpu-cycles - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - -F true - 4096 - false - false - 1000 - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 2 - Qt4ProjectManager.Qt4RunConfiguration:/home/araemer/source/lenapi/LenaPi/LenaPi.pro - /home/araemer/source/lenapi/LenaPi/LenaPi.pro + Qt4ProjectManager.Qt4RunConfiguration:/home/jmr/privat/src/LenaPi/LenaPi/LenaPi.pro + /home/jmr/privat/src/LenaPi/LenaPi/LenaPi.pro false true true false true - 1 + 1 ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.FileVersion diff --git a/LenaPi/Navigation.qml b/LenaPi/Navigation.qml index 5251493..cd5df5b 100644 --- a/LenaPi/Navigation.qml +++ b/LenaPi/Navigation.qml @@ -1,4 +1,5 @@ import QtQuick 2.0 +import QtQuick.Controls 2.4 /** * @brief Navigation view containing list view displaying artists or genres and albums @@ -39,6 +40,12 @@ Item { color: "#99ffffff" + Label{ + text: debug.pDebugOutput + anchors.centerIn: parent + visible: text !== "" + } + ListView{ id: circleList anchors.left: parent.left diff --git a/LenaPi/android-files/AndroidManifest.xml b/LenaPi/android-files/AndroidManifest.xml new file mode 100644 index 0000000..0236a61 --- /dev/null +++ b/LenaPi/android-files/AndroidManifest.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LenaPi/controllers/NavigationController.cpp b/LenaPi/controllers/NavigationController.cpp index ff2ad3c..0b04961 100644 --- a/LenaPi/controllers/NavigationController.cpp +++ b/LenaPi/controllers/NavigationController.cpp @@ -21,11 +21,17 @@ NavigationController::NavigationController(QObject *parent) : QObject(parent), }); } +void NavigationController::setDebugOutput(const QString& text) +{ + mDebugOutput = text; + emit debugOutputChanged(); +} + void NavigationController::init(const QString &rootPath) { auto rootDir = QDir(rootPath); if(!rootDir.exists()) return; - mRootPath = rootPath; + mRootPath = rootPath; add(mRootPath, mRootItem); @@ -49,6 +55,7 @@ void NavigationController::setContextProperties() mContext->setContextProperty("navigationList", mNavList); mContext->setContextProperty("uiStateModel", mUiState); mContext->setContextProperty("musicModel", mMediaPlayer); + mContext->setContextProperty("debug", this); } void NavigationController::add(const QString &path, NavigationItemModel *parentItem) diff --git a/LenaPi/controllers/NavigationController.h b/LenaPi/controllers/NavigationController.h index 6f40c5b..46fbdc2 100644 --- a/LenaPi/controllers/NavigationController.h +++ b/LenaPi/controllers/NavigationController.h @@ -15,6 +15,12 @@ class MusicPlayer; class NavigationController : public QObject { Q_OBJECT + + Q_PROPERTY(QString pDebugOutput READ getDebugOutput NOTIFY debugOutputChanged) + +signals: + void debugOutputChanged(); + public: explicit NavigationController(QObject *parent = nullptr); @@ -37,6 +43,8 @@ public: */ void setContext(QQmlContext* context); + QString getDebugOutput() const { return mDebugOutput; } + private: /** * @brief Register models in context @@ -55,6 +63,12 @@ private: */ bool checkContent(const QString& path); + /** + * @brief Set Debug Output. Necessary as Android Debugger does not work yet + * @param text Output to show in ui + */ + void setDebugOutput(const QString& text); + NavigationItemModel* mRootItem; NavigationListModel* mNavList; @@ -63,6 +77,8 @@ private: QString mRootPath = "."; + QString mDebugOutput; + QQmlContext* mContext = nullptr; private slots: diff --git a/LenaPi/controllers/SettingsHandler.cpp b/LenaPi/controllers/SettingsHandler.cpp index 9dd1373..a0f6edb 100644 --- a/LenaPi/controllers/SettingsHandler.cpp +++ b/LenaPi/controllers/SettingsHandler.cpp @@ -1,4 +1,5 @@ #include "SettingsHandler.h" +#include constexpr const char* const rootPath = "rootPath"; constexpr const char* const profile = "profile"; @@ -59,11 +60,20 @@ QString SettingsHandler::getShutdownScript() const void SettingsHandler::initDefaults() { - mDefaults.insert(rootPath, "/home/ar/source/lenaMusic/"); - mDefaults.insert(profile, "RasPiTouch"); - mDefaults.insert(enableEnergySaver, true); + mDefaults.insert(rootPath, QStandardPaths::MusicLocation); + mDefaults.insert(enableEnergySaver, false); mDefaults.insert(timeout, 60); mDefaults.insert(shutdownScript, "/usr/local/sbin/do_shutdown.sh"); + mDefaults.insert(profile, "RasPiTouch"); + // @todo add profile Android? Or simply scale ui for RasPi + // mDefaults.insert(profile, "Android"); + +// Defaults for LenaPi +// mDefaults.insert(rootPath, "/home/ar/source/lenaMusic/"); +// mDefaults.insert(profile, "RasPiTouch"); +// mDefaults.insert(enableEnergySaver, true); +// mDefaults.insert(timeout, 60); +// mDefaults.insert(shutdownScript, "/usr/local/sbin/do_shutdown.sh"); } diff --git a/LenaPi/models/UiStateModel.h b/LenaPi/models/UiStateModel.h index d7eff7c..bcd352d 100644 --- a/LenaPi/models/UiStateModel.h +++ b/LenaPi/models/UiStateModel.h @@ -4,6 +4,7 @@ #include #include #include +#include /** * @brief Handles state of UI by providing the qml source.