diff --git a/.gitignore b/.gitignore index 91ccddb..0a0881b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ -build-LenaPi-Desktop-Debug *.autosave +build-LenaPi-Desktop-Debug +build-LenaPi-RasPi-Debug +build-LenaPi-RasPi-Release diff --git a/LenaPi/LenaPi.pro b/LenaPi/LenaPi.pro index b0eff75..56e316b 100644 --- a/LenaPi/LenaPi.pro +++ b/LenaPi/LenaPi.pro @@ -44,3 +44,5 @@ HEADERS += \ models/UiStateModel.h \ controllers/MusicController.h \ models/MusicModel.h + +INCLUDEPATH+=/usr/local/include diff --git a/LenaPi/LenaPi.pro.user b/LenaPi/LenaPi.pro.user index 47a5b61..3f9089e 100644 --- a/LenaPi/LenaPi.pro.user +++ b/LenaPi/LenaPi.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -8,7 +8,7 @@ ProjectExplorer.Project.ActiveTarget - 0 + 1 ProjectExplorer.Project.EditorSettings @@ -321,9 +321,309 @@ 1 + + ProjectExplorer.Project.Target.1 + + RasPi + RasPi + {e5a30b8d-6471-4036-a090-63cf64f951ac} + 0 + 0 + 0 + + /home/ar/source/LenaPi/build-LenaPi-RasPi-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/ar/source/LenaPi/build-LenaPi-RasPi-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/ar/source/LenaPi/build-LenaPi-RasPi-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Check for free disk space + + RemoteLinux.CheckForFreeDiskSpaceStep + + + + + + / + 5242880 + + + true + Upload files via SFTP + + RemoteLinux.DirectUploadStep + + /home/ar/source/LenaPi/build-LenaPi-RasPi-Debug/LenaPi + + + 10.0.1.187 + + + /opt/LenaPi/bin + + + /opt/qt5pi/sysroot + + + 2018-12-24T10:43:47 + + false + true + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Remote Linux Host + + DeployToGenericLinux + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 1 + + LenaPi (on Remote Device) + + RemoteLinuxRunConfiguration:LenaPi + + LenaPi + + false + + 3768 + false + true + false + false + true + + 1 + + ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.FileVersion diff --git a/LenaPi/PlayerControlPannel.qml b/LenaPi/PlayerControlPannel.qml index d96d8a5..e99423d 100644 --- a/LenaPi/PlayerControlPannel.qml +++ b/LenaPi/PlayerControlPannel.qml @@ -16,6 +16,7 @@ Rectangle { anchors.margins: container.margins model: container.model + // might require height for labels to be shown on RasPi (Qt 5.10) } PlayerButtons{ diff --git a/LenaPi/controllers/NavigationController.cpp b/LenaPi/controllers/NavigationController.cpp index 66064f2..726fcfc 100644 --- a/LenaPi/controllers/NavigationController.cpp +++ b/LenaPi/controllers/NavigationController.cpp @@ -54,6 +54,7 @@ void NavigationController::add(const QString &path, NavigationItemModel *parentI for(const auto& name : subDirsNames){ if(name == "." || name == "..") continue; + if(!checkContent(path + "/" + name)) continue; auto item = new NavigationItemModel(parentItem); if(!item->setPath(path + "/" + name)) { item->deleteLater(); @@ -65,6 +66,26 @@ void NavigationController::add(const QString &path, NavigationItemModel *parentI } } +bool NavigationController::checkContent(const QString &path) +{ + bool valid = false; + auto dir =QDir(path); + auto subDirsNames = dir.entryList(QDir::AllDirs); + if(subDirsNames.length() > 0) { + valid = true; + } else { + auto fileNames = dir.entryList(QDir::Files); + int numAudio = 0; + for(auto file:fileNames){ + if(file.endsWith(".flac") || file.endsWith(".mp3")){ + numAudio++; + } + } + if(numAudio > 0) valid = true; + } + return valid; +} + void NavigationController::onNavigationRequest() { auto item = qobject_cast(QObject::sender()); diff --git a/LenaPi/controllers/NavigationController.h b/LenaPi/controllers/NavigationController.h index eb7ead0..8350600 100644 --- a/LenaPi/controllers/NavigationController.h +++ b/LenaPi/controllers/NavigationController.h @@ -22,6 +22,7 @@ public: private: void setContextProperties(); void add(const QString & path, NavigationItemModel* parentItem); + bool checkContent(const QString& path); NavigationItemModel* mRootItem; NavigationListModel* mNavList; diff --git a/deployToRasPi b/deployToRasPi new file mode 100755 index 0000000..a781587 --- /dev/null +++ b/deployToRasPi @@ -0,0 +1,2 @@ +#!/bin/bash +scp -i ~/.ssh/id_rsa_raspi build-LenaPi-RasPi-Release/LenaPi root@10.0.1.187:/usr/local/bin