From 176a8932ce4507e6bc92ef9da29fb2510fc3cd5f Mon Sep 17 00:00:00 2001 From: reionwong Date: Fri, 16 Jul 2021 16:35:50 +0800 Subject: [PATCH] Remove kirigami --- CMakeLists.txt | 6 +- README.md | 1 - src/CMakeLists.txt | 2 +- src/qml.qrc | 2 - src/qml/Footer.qml | 10 +- src/qml/HProgressBar.qml | 19 ++-- src/qml/Header.qml | 4 +- src/qml/MpvVideo.qml | 37 +++++-- src/qml/PlayListItemCompact.qml | 57 ---------- src/qml/PlayListItemWithThumbnail.qml | 153 -------------------------- src/qml/main.qml | 2 +- 11 files changed, 52 insertions(+), 241 deletions(-) delete mode 100644 src/qml/PlayListItemCompact.qml delete mode 100644 src/qml/PlayListItemWithThumbnail.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b02949..ac915cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,9 +72,9 @@ find_package(KF5KIO) set_package_properties(KF5KIO PROPERTIES TYPE REQUIRED URL "https://api.kde.org/frameworks/kio/html/index.html") -find_package(KF5Kirigami2) -set_package_properties(KF5Kirigami2 PROPERTIES TYPE REQUIRED - URL "https://api.kde.org/frameworks/kirigami/html/index.html") +#find_package(KF5Kirigami2) +#set_package_properties(KF5Kirigami2 PROPERTIES TYPE REQUIRED +# URL "https://api.kde.org/frameworks/kirigami/html/index.html") find_package(KF5XmlGui) set_package_properties(KF5XmlGui PROPERTIES TYPE REQUIRED diff --git a/README.md b/README.md index ac80b93..491aa8f 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ these are just some features that set Haruna apart from others players - KF5I18n - KF5IconThemes - KF5KIO -- KF5Kirigami2 - KF5XmlGui ### Runtime diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 68f8680..080ba20 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,7 +61,7 @@ target_link_libraries(cutefish-videoplayer PRIVATE KF5::KIOFileWidgets KF5::KIOWidgets KF5::KIONTLM - KF5::Kirigami2 +# KF5::Kirigami2 KF5::XmlGui Libmpv::Libmpv diff --git a/src/qml.qrc b/src/qml.qrc index 4af31b0..cd67322 100644 --- a/src/qml.qrc +++ b/src/qml.qrc @@ -29,13 +29,11 @@ qml/Haruna/Components/SelectActionPopup.qml qml/Settings/VideoSettings.qml qml/Menus/HelpMenu.qml - qml/PlayListItemWithThumbnail.qml qml/Haruna/Components/LabelWithTooltip.qml qml/Haruna/Components/SettingsHeader.qml qml/Haruna/Components/SettingsBasePage.qml qml/Haruna/Components/qmldir qml/Haruna/Components/ImageAdjustmentSlider.qml - qml/PlayListItemCompact.qml qml/Settings/CustomCommands.qml qml/Settings/EditCustomCommand.qml diff --git a/src/qml/Footer.qml b/src/qml/Footer.qml index d1a2b6c..3a5a5a1 100644 --- a/src/qml/Footer.qml +++ b/src/qml/Footer.qml @@ -26,7 +26,9 @@ Item { height: mainLayout.childrenRect.height + FishUI.Units.largeSpacing * 2 visible: true - opacity: mpv.mouseY > window.height - footer.height - FishUI.Units.largeSpacing * 3 ? 1 : 0 + opacity: mpv.mouseY > window.height - footer.height - FishUI.Units.largeSpacing * 3 + && playList.state === "hidden" ? 1 : 0 + enabled: opacity !== 0 Behavior on opacity { NumberAnimation { @@ -128,14 +130,10 @@ Item { } } - LabelWithTooltip { + Label { id: timeInfo - text: app.formatTime(mpv.position) + " / " + app.formatTime(mpv.duration) font.pointSize: FishUI.Units.gridUnit - 4 - toolTipText: qsTr("Remaining: ") + app.formatTime(mpv.remaining) - toolTipFontSize: timeInfo.font.pointSize + 2 - alwaysShowToolTip: true horizontalAlignment: Qt.AlignHCenter } diff --git a/src/qml/HProgressBar.qml b/src/qml/HProgressBar.qml index 0ba0cd5..2000c90 100644 --- a/src/qml/HProgressBar.qml +++ b/src/qml/HProgressBar.qml @@ -104,10 +104,10 @@ Slider { progressBarToolTip.text = app.formatTime(time) } - onEntered: { - progressBarToolTip.x = mouseX - (progressBarToolTip.width * 0.5) - progressBarToolTip.y = root.height - } + // onEntered: { + // progressBarToolTip.x = mouseX - (progressBarToolTip.width * 0.5) + // progressBarToolTip.y = root.height + // } onWheel: { if (wheel.angleDelta.y > 0) { @@ -221,11 +221,16 @@ Slider { Connections { target: mpv - onFileLoaded: chapters = mpv.getProperty("chapter-list") - onChapterChanged: { + + function onFileLoaded() { + chapters = mpv.getProperty("chapter-list") + } + + function onChapterChanged() { chaptersMenu.checkedItem = mpv.chapter } - onPositionChanged: { + + function onPositionChanged() { if (!root.seekStarted) { root.value = mpv.position } diff --git a/src/qml/Header.qml b/src/qml/Header.qml index 2c16f2d..8ae4756 100644 --- a/src/qml/Header.qml +++ b/src/qml/Header.qml @@ -9,7 +9,7 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import QtQml 2.12 -import org.kde.kirigami 2.11 as Kirigami +import FishUI 1.0 as FishUI import org.kde.haruna 1.0 import "Menus" @@ -55,7 +55,7 @@ ToolBar { contentItem: Rectangle { implicitWidth: parent.vertical ? 1 : 24 implicitHeight: parent.vertical ? 24 : 1 - color: Kirigami.Theme.textColor + color: FishUI.Theme.textColor } } diff --git a/src/qml/MpvVideo.qml b/src/qml/MpvVideo.qml index ea770ce..0b16f95 100644 --- a/src/qml/MpvVideo.qml +++ b/src/qml/MpvVideo.qml @@ -310,17 +310,38 @@ MpvObject { Connections { target: mediaPlayer2Player - onPlaypause: actions.playPauseAction.trigger() - onPlay: root.pause = false - onPause: root.pause = true - onStop: { + function onPlaypause() { + actions.playPauseAction.trigger() + } + + function onPlay() { + root.pause = false + } + + function onPause() { + root.pause = true + } + + function onStop() { root.position = 0 root.pause = true } - onNext: actions.playNextAction.trigger() - onPrevious: actions.playPreviousAction.trigger() - onSeek: root.command(["add", "time-pos", offset]) - onOpenUri: openFile(uri, false, false) + + function onNext() { + actions.playNextAction.trigger() + } + + function onPrevious() { + actions.playPreviousAction.trigger() + } + + function onSeek() { + root.command(["add", "time-pos", offset]) + } + + function onOpenUri() { + root.command(["add", "time-pos", offset]) + } } Rectangle { diff --git a/src/qml/PlayListItemCompact.qml b/src/qml/PlayListItemCompact.qml deleted file mode 100644 index dfb046a..0000000 --- a/src/qml/PlayListItemCompact.qml +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020 George Florea Bănuș - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 -import QtGraphicalEffects 1.12 - -import FishUI 1.0 as FishUI -import org.kde.haruna 1.0 -import Haruna.Components 1.0 as HC - -Item { - id: root - - property bool isPlaying: model.isPlaying - property string rowNumber: (index + 1).toString() - property var alpha: PlaylistSettings.overlayVideo ? 0.6 : 1 - - label: mainText() - subtitle: model.duration - icon: model.isPlaying ? "media-playback-start" : "" - backgroundColor: { - let color = model.isPlaying ? FishUI.Theme.highlightColor : FishUI.Theme.backgroundColor - Qt.hsla(color.hslHue, color.hslSaturation, color.hslLightness, alpha) - } - - onDoubleClicked: { - mpv.playlistModel.setPlayingVideo(index) - mpv.loadFile(path, !isYouTubePlaylist) - mpv.pause = false - } - - ToolTip { - text: (PlaylistSettings.showMediaTitle ? model.title : model.name) - visible: root.containsMouse - font.pointSize: FishUI.Units.gridUnit - 5 - } - - function mainText() { - const rowNumber = pad(root.rowNumber, playlistView.count.toString().length) + ". " - - if(PlaylistSettings.showRowNumber) { - return rowNumber + (PlaylistSettings.showMediaTitle ? model.title : model.name) - } - return (PlaylistSettings.showMediaTitle ? model.title : model.name) - } - - function pad(number, length) { - while (number.length < length) - number = "0" + number; - return number; - } -} diff --git a/src/qml/PlayListItemWithThumbnail.qml b/src/qml/PlayListItemWithThumbnail.qml deleted file mode 100644 index d548a9f..0000000 --- a/src/qml/PlayListItemWithThumbnail.qml +++ /dev/null @@ -1,153 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020 George Florea Bănuș - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 -import QtGraphicalEffects 1.12 - -import org.kde.kirigami 2.11 as Kirigami -import org.kde.haruna 1.0 -import Haruna.Components 1.0 - -Kirigami.BasicListItem { - id: root - - property bool isPlaying: model.isPlaying - property string rowNumber: (index + 1).toString() - property var alpha: PlaylistSettings.overlayVideo ? 0.6 : 1 - - height: (Kirigami.Units.gridUnit - 6) * 8 + PlaylistSettings.rowHeight - padding: 0 - backgroundColor: { - let color = model.isPlaying ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor - Qt.hsla(color.hslHue, color.hslSaturation, color.hslLightness, alpha) - } - - onDoubleClicked: { - mpv.playlistModel.setPlayingVideo(index) - mpv.loadFile(path, !isYouTubePlaylist) - mpv.pause = false - } - - contentItem: Rectangle { - anchors.fill: parent - color: "transparent" - RowLayout { - anchors.fill: parent - anchors.rightMargin: Kirigami.Units.largeSpacing - spacing: Kirigami.Units.largeSpacing - - Label { - id: rowNumberLabel - - text: pad(root.rowNumber, playlistView.count.toString().length) - visible: PlaylistSettings.showRowNumber - font.pointSize: (window.isFullScreen() && playList.bigFont) - ? Kirigami.Units.gridUnit - : Kirigami.Units.gridUnit - 6 - horizontalAlignment: Qt.AlignCenter - Layout.leftMargin: Kirigami.Units.largeSpacing - - function pad(number, length) { - while (number.length < length) - number = "0" + number; - return number; - } - } - - Rectangle { - id: separator - - width: 1 - color: Kirigami.Theme.alternateBackgroundColor - visible: PlaylistSettings.showRowNumber - Layout.fillHeight: true - } - - Item { - id: thumbnail - - width: (root.height - 20) * 1.33333 - height: root.height - 20 - - Image { - anchors.fill: parent - source: "image://thumbnail/" + model.path - sourceSize.width: parent.width - sourceSize.height: parent.height - fillMode: Image.PreserveAspectFit - - Rectangle { - visible: model.duration.length > 0 - height: 25 - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.right: parent.right - color: { - let color = Kirigami.Theme.alternateBackgroundColor - Qt.hsla(color.hslHue, color.hslSaturation, color.hslLightness, 0.8) - } - - Label { - anchors.centerIn: parent - color: Kirigami.Theme.textColor - horizontalAlignment: Qt.AlignCenter - text: model.duration - font.pointSize: (window.isFullScreen() && playList.bigFont) - ? Kirigami.Units.gridUnit - : Kirigami.Units.gridUnit - 5 - - Layout.margins: Kirigami.Units.largeSpacing - } - } - } - } - - Kirigami.Icon { - source: "media-playback-start" - width: Kirigami.Units.iconSizes.small - height: Kirigami.Units.iconSizes.small - visible: isPlaying - - Layout.leftMargin: PlaylistSettings.showRowNumber ? 0 : Kirigami.Units.largeSpacing - } - - LabelWithTooltip { - id: label - - text: PlaylistSettings.showMediaTitle ? model.title : model.name - toolTipFontSize: label.font.pointSize + 2 - color: Kirigami.Theme.textColor - horizontalAlignment: Qt.AlignLeft - verticalAlignment: Qt.AlignVCenter - elide: Text.ElideRight - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - font.pointSize: (window.isFullScreen() && playList.bigFont) - ? Kirigami.Units.gridUnit - : Kirigami.Units.gridUnit - 5 - font.weight: isPlaying ? Font.ExtraBold : Font.Normal - layer.enabled: true - Layout.fillWidth: true - Layout.fillHeight: true - Layout.topMargin: Kirigami.Units.largeSpacing - Layout.bottomMargin: Kirigami.Units.largeSpacing - Layout.leftMargin: PlaylistSettings.showRowNumber || isPlaying ? 0 : Kirigami.Units.largeSpacing - } - - Label { - visible: !thumbnail.visible - text: model.duration - horizontalAlignment: Qt.AlignCenter - font.pointSize: (window.isFullScreen() && playList.bigFont) - ? Kirigami.Units.gridUnit - : Kirigami.Units.gridUnit - 6 - - Layout.margins: Kirigami.Units.largeSpacing - } - } - } -} diff --git a/src/qml/main.qml b/src/qml/main.qml index df31e1d..1aaa015 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -45,7 +45,7 @@ FishUI.Window { contentTopMargin: 0 - // header: Header { id: header } + Header { id: header } // menuBar: MenuBar { // hoverEnabled: true