diff --git a/LenaPi/MusicPlayer.qml b/LenaPi/MusicPlayer.qml new file mode 100644 index 0000000..04c4a72 --- /dev/null +++ b/LenaPi/MusicPlayer.qml @@ -0,0 +1,44 @@ +import QtQuick 2.0 + +Item{ + id: container + + Image { + id: backgroundImage + + anchors.fill: parent + source: "file:///home/ar/source/testLenaPi/benjamin/image.jpg" + fillMode: Image.PreserveAspectCrop + verticalAlignment: Image.AlignTop + } + RoundButton{ + id: backNavigation + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: 20 + } + + Rectangle { + id: controlPannel + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + color: "#99ffffff" + height: 120 + + RoundButton{ + id: startPause + anchors.centerIn: parent + width: 80 + imageSource: "qrc:/icon_play" + + onClicked:{ + if(imageSource == "qrc:/icon_play") + imageSource = "qrc:/icon_pause" + else + imageSource = "qrc:/icon_play" + } + } + } +} diff --git a/LenaPi/RoundButton.qml b/LenaPi/RoundButton.qml index 2323615..1f65010 100644 --- a/LenaPi/RoundButton.qml +++ b/LenaPi/RoundButton.qml @@ -10,7 +10,7 @@ Rectangle { color: "white" - width: 50 + width: 65 height: width radius: width/2 diff --git a/LenaPi/lenapi.qrc b/LenaPi/lenapi.qrc index 174a464..6d29653 100644 --- a/LenaPi/lenapi.qrc +++ b/LenaPi/lenapi.qrc @@ -3,5 +3,7 @@ resources/back.png resources/defaultImage.png resources/sky.jpg + resources/pause.jpg + resources/play.jpg diff --git a/LenaPi/main.qml b/LenaPi/main.qml index 3826654..938dae7 100644 --- a/LenaPi/main.qml +++ b/LenaPi/main.qml @@ -18,6 +18,7 @@ Window { Loader{ anchors.fill: parent + //source: "MusicPlayer.qml" source: "Navigation.qml" } diff --git a/LenaPi/models/NavigationListModel.cpp b/LenaPi/models/NavigationListModel.cpp index 4369b46..906f610 100644 --- a/LenaPi/models/NavigationListModel.cpp +++ b/LenaPi/models/NavigationListModel.cpp @@ -33,6 +33,12 @@ bool NavigationListModel::isBackVisible() return mIsBackVisible; } +void NavigationListModel::navigateTo(NavigationItemModel *item) +{ + if(!item) return; + setModelItems(item->getSiblings()); +} + void NavigationListModel::navigateBack() { if(!mIsBackVisible || mItems.isEmpty()) return; @@ -40,5 +46,5 @@ void NavigationListModel::navigateBack() auto item = qobject_cast(mItems.at(0)); if(!item || item->getParentItem()->isRoot()) return; - setModelItems(item->getParentItem()->getSiblings()); + navigateTo(item->getParentItem()); } diff --git a/LenaPi/models/NavigationListModel.h b/LenaPi/models/NavigationListModel.h index 6f4e65e..3b6eaa1 100644 --- a/LenaPi/models/NavigationListModel.h +++ b/LenaPi/models/NavigationListModel.h @@ -22,6 +22,7 @@ public: bool isBackVisible(); + void navigateTo(NavigationItemModel* item); Q_INVOKABLE void navigateBack(); private: diff --git a/LenaPi/qml.qrc b/LenaPi/qml.qrc index 06ea4f2..a874956 100644 --- a/LenaPi/qml.qrc +++ b/LenaPi/qml.qrc @@ -6,5 +6,6 @@ MyScrollView.qml RoundButton.qml Navigation.qml + MusicPlayer.qml diff --git a/LenaPi/resources/pause.jpg b/LenaPi/resources/pause.jpg new file mode 100644 index 0000000..65c879c Binary files /dev/null and b/LenaPi/resources/pause.jpg differ diff --git a/LenaPi/resources/play.jpg b/LenaPi/resources/play.jpg new file mode 100644 index 0000000..9ac5500 Binary files /dev/null and b/LenaPi/resources/play.jpg differ