diff --git a/src/audiomanager.cpp b/src/audiomanager.cpp index f8d2aee2..38b860f3 100644 --- a/src/audiomanager.cpp +++ b/src/audiomanager.cpp @@ -31,7 +31,6 @@ private: Entry* m_entry = nullptr; bool m_readyToPlay = false; - bool playerOpen = false; bool m_isSeekable = false; bool m_lockPositionSaving = false; // sort of lock mutex to prevent updating the player position while changing sources (which will emit lots of playerPositionChanged signals) @@ -69,11 +68,6 @@ Entry* AudioManager::entry () const return d->m_entry; } -bool AudioManager::playerOpen() const -{ - return d->playerOpen; -} - bool AudioManager::muted() const { return d->m_player.isMuted(); @@ -245,12 +239,6 @@ void AudioManager::setEntry(Entry* entry) d->m_lockPositionSaving = false; } -void AudioManager::setPlayerOpen(bool state) -{ - d->playerOpen = state; - Q_EMIT playerOpenChanged(state); -} - void AudioManager::setMuted(bool muted) { d->m_player.setMuted(muted); diff --git a/src/audiomanager.h b/src/audiomanager.h index 5cc9ec02..7b7c3f47 100644 --- a/src/audiomanager.h +++ b/src/audiomanager.h @@ -22,11 +22,6 @@ class AudioManager : public QObject { Q_OBJECT - Q_PROPERTY(bool playerOpen - READ playerOpen - WRITE setPlayerOpen - NOTIFY playerOpenChanged) - Q_PROPERTY(Entry* entry READ entry WRITE setEntry @@ -111,8 +106,6 @@ public: [[nodiscard]] Entry* entry() const; - [[nodiscard]] bool playerOpen() const; - [[nodiscard]] bool muted() const; [[nodiscard]] qreal volume() const; @@ -149,8 +142,6 @@ public: Q_SIGNALS: - void playerOpenChanged(bool state); - void entryChanged(Entry* entry); void mutedChanged(bool muted); @@ -193,8 +184,6 @@ public Q_SLOTS: void setEntry(Entry* entry); - void setPlayerOpen(bool state); - void setMuted(bool muted); void setVolume(qreal volume); diff --git a/src/qml/FooterBar.qml b/src/qml/FooterBar.qml index b311e5b1..a36e0ccd 100644 --- a/src/qml/FooterBar.qml +++ b/src/qml/FooterBar.qml @@ -87,14 +87,14 @@ Flickable { anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - height: root.height + footerLoader.minimizedSize + height: root.height + root.miniplayerSize spacing: 0 MinimizedPlayerControls { id: playControlItem Layout.fillWidth: true - Layout.minimumHeight: Kirigami.Units.gridUnit * 2.5 + Layout.minimumHeight: root.miniplayerSize Layout.alignment: Qt.AlignTop focus: true } diff --git a/src/qml/MinimizedPlayerControls.qml b/src/qml/MinimizedPlayerControls.qml index 2a3b2ccf..bef5cc84 100644 --- a/src/qml/MinimizedPlayerControls.qml +++ b/src/qml/MinimizedPlayerControls.qml @@ -18,14 +18,9 @@ Item { property int miniplayerheight: Kirigami.Units.gridUnit * 3 property int progressbarheight: Kirigami.Units.gridUnit / 6 property int buttonsize: Kirigami.Units.gridUnit * 2 - anchors.right: parent.right - anchors.left: parent.left - anchors.bottom: parent.bottom - width: parent.width - //height: (audio.entry == undefined || audio.playerOpen) ? 0 : Kirigami.Units.gridUnit * 3.5 + (Kirigami.Units.gridUnit / 6) height: miniplayerheight + progressbarheight - //margins.bottom: miniprogressbar.height - visible: (audio.entry !== undefined) && !audio.playerOpen + + visible: (audio.entry) // Set background Rectangle { @@ -100,14 +95,14 @@ Item { id: trackClick anchors.fill: parent hoverEnabled: true - onClicked: pageStack.layers.push("qrc:/PlayerControls.qml") + onClicked: toOpen.restart() } } Controls.Button { id: playButton icon.name: audio.playbackState === Audio.PlayingState ? "media-playback-pause" : "media-playback-start" - icon.height: parent.parent.buttonsize //Kirigami.Units.gridUnit * 2.5 - icon.width: parent.parent.buttonsize //Kirigami.Units.gridUnit * 2.5 + icon.height: parent.parent.buttonsize + icon.width: parent.parent.buttonsize flat: true Layout.fillHeight: true Layout.maximumHeight: parent.parent.miniplayerheight diff --git a/src/qml/PlayerControls.qml b/src/qml/PlayerControls.qml index ded7af3b..10f08fe9 100644 --- a/src/qml/PlayerControls.qml +++ b/src/qml/PlayerControls.qml @@ -20,9 +20,6 @@ Kirigami.Page { clip: true Layout.margins: 0 - Component.onCompleted: audio.playerOpen = true - Component.onDestruction: audio.playerOpen = false - ColumnLayout { anchors.fill: parent Controls.SwipeView { diff --git a/src/qml/main.qml b/src/qml/main.qml index e6a6b98d..5492c2da 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -17,12 +17,9 @@ import org.kde.alligator 1.0 Kirigami.ApplicationWindow { id: root - title: "Alligator" - //pageStack.initialPage: SettingsManager.lastOpenedPage === "FeedListPage" ? feedList - // : SettingsManager.lastOpenedPage === "QueuePage" ? queueList - // : feedList + property var miniplayerSize: Kirigami.Units.gridUnit * 3 + Kirigami.Units.gridUnit / 6 Kirigami.PagePool { id: mainPagePool cachePages: true @@ -84,17 +81,8 @@ Kirigami.ApplicationWindow { id: contextDrawer } - /*FeedListPage { - id: feedList - } - - QueuePage { - id: queueList - }*/ - AudioManager { id: audio - playerOpen: false } Mpris2 { @@ -109,20 +97,14 @@ Kirigami.ApplicationWindow { } } - footer: Loader { - active: (audio.entry) && !audio.playerOpen - visible: (audio.entry) && !audio.playerOpen - sourceComponent: MinimizedPlayerControls { } - } - - /* + // create space at the bottom to show miniplayer without it hiding stuff + // underneath + pageStack.anchors.bottomMargin: (audio.entry) ? miniplayerSize : 0 Loader { id: footerLoader - property var minimizedSize: Kirigami.Units.gridUnit * 3.0 - anchors.fill: parent - active: (audio.entry == undefined) ? false : true + active: (audio.entry) ? true : false visible: active z: (!item || item.contentY == 0) ? -1 : 999 sourceComponent: FooterBar { @@ -132,18 +114,12 @@ Kirigami.ApplicationWindow { } - Item { - visible: (audio.entry !== undefined) - height: footerLoader.minimizedSize - } - */ - - /*Kirigami.OverlaySheet { - id: playeroverlay - sheetOpen: False - PlayerControls { - height: root.height*5.0/6.0 - width: root.width*5.0/6.0; - } + // Doesn't look like this is needed at all: + // capture mouse events behind flickable when it is open + /*MouseArea { + visible: footerLoader.item.contentY != 0 // only capture when the mobile footer panel is open + anchors.fill: footerLoader + preventStealing: true + onClicked: mouse.accepted = true }*/ }