Changeset View
Changeset View
Standalone View
Standalone View
src/qml/PlayListEntry.qml
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public License | 14 | * You should have received a copy of the GNU Lesser General Public License | ||
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | import QtQuick 2.7 | 18 | import QtQuick 2.7 | ||
19 | import QtQuick.Layouts 1.2 | 19 | import QtQuick.Layouts 1.2 | ||
20 | import QtQuick.Controls 2.3 | 20 | import QtQuick.Controls 2.3 | ||
21 | import QtQuick.Controls 1.4 as Controls1 | | |||
22 | import QtQuick.Window 2.2 | 21 | import QtQuick.Window 2.2 | ||
23 | import QtGraphicalEffects 1.0 | 22 | import QtGraphicalEffects 1.0 | ||
24 | import org.kde.elisa 1.0 | 23 | import org.kde.elisa 1.0 | ||
25 | 24 | | |||
26 | FocusScope { | 25 | FocusScope { | ||
27 | id: playListEntry | 26 | id: playListEntry | ||
28 | 27 | | |||
29 | property var index | 28 | property var index | ||
Show All 13 Lines | |||||
43 | 42 | | |||
44 | signal startPlayback() | 43 | signal startPlayback() | ||
45 | signal pausePlayback() | 44 | signal pausePlayback() | ||
46 | signal removeFromPlaylist(var trackIndex) | 45 | signal removeFromPlaylist(var trackIndex) | ||
47 | signal switchToTrack(var trackIndex) | 46 | signal switchToTrack(var trackIndex) | ||
48 | 47 | | |||
49 | height: (hasAlbumHeader ? elisaTheme.playListDelegateWithHeaderHeight : elisaTheme.playListDelegateHeight) | 48 | height: (hasAlbumHeader ? elisaTheme.playListDelegateWithHeaderHeight : elisaTheme.playListDelegateHeight) | ||
50 | 49 | | |||
51 | Controls1.Action { | 50 | Action { | ||
52 | id: removeFromPlayList | 51 | id: removeFromPlayList | ||
53 | text: i18nc("Remove current track from play list", "Remove") | 52 | text: i18nc("Remove current track from play list", "Remove") | ||
54 | iconName: "error" | 53 | icon.name: "error" | ||
55 | onTriggered: { | 54 | onTriggered: { | ||
56 | playListEntry.removeFromPlaylist(playListEntry.index) | 55 | playListEntry.removeFromPlaylist(playListEntry.index) | ||
57 | } | 56 | } | ||
58 | } | 57 | } | ||
59 | 58 | | |||
60 | Controls1.Action { | 59 | Action { | ||
61 | id: playNow | 60 | id: playNow | ||
62 | text: i18nc("Play now current track from play list", "Play Now") | 61 | text: i18nc("Play now current track from play list", "Play Now") | ||
63 | iconName: "media-playback-start" | 62 | icon.name: "media-playback-start" | ||
64 | enabled: !(isPlaying === MediaPlayList.IsPlaying) && isValid | 63 | enabled: !(isPlaying === MediaPlayList.IsPlaying) && isValid | ||
65 | onTriggered: { | 64 | onTriggered: { | ||
66 | if (isPlaying === MediaPlayList.NotPlaying) { | 65 | if (isPlaying === MediaPlayList.NotPlaying) { | ||
67 | playListEntry.switchToTrack(playListEntry.index) | 66 | playListEntry.switchToTrack(playListEntry.index) | ||
68 | } | 67 | } | ||
69 | playListEntry.startPlayback() | 68 | playListEntry.startPlayback() | ||
70 | } | 69 | } | ||
71 | } | 70 | } | ||
72 | 71 | | |||
73 | Controls1.Action { | 72 | Action { | ||
74 | id: pauseNow | 73 | id: pauseNow | ||
75 | text: i18nc("Pause current track from play list", "Pause") | 74 | text: i18nc("Pause current track from play list", "Pause") | ||
76 | iconName: "media-playback-pause" | 75 | icon.name: "media-playback-pause" | ||
77 | enabled: isPlaying == MediaPlayList.IsPlaying && isValid | 76 | enabled: isPlaying == MediaPlayList.IsPlaying && isValid | ||
78 | onTriggered: playListEntry.pausePlayback() | 77 | onTriggered: playListEntry.pausePlayback() | ||
79 | } | 78 | } | ||
80 | 79 | | |||
81 | Controls1.Action { | 80 | Action { | ||
82 | id: showInfo | 81 | id: showInfo | ||
83 | text: i18nc("Show track metadata", "View Details") | 82 | text: i18nc("Show track metadata", "View Details") | ||
84 | iconName: "help-about" | 83 | icon.name: "help-about" | ||
85 | enabled: isValid | 84 | enabled: isValid | ||
86 | onTriggered: { | 85 | onTriggered: { | ||
87 | if (metadataLoader.active === false) { | 86 | if (metadataLoader.active === false) { | ||
88 | metadataLoader.active = true | 87 | metadataLoader.active = true | ||
89 | } | 88 | } | ||
90 | else { | 89 | else { | ||
91 | metadataLoader.item.close(); | 90 | metadataLoader.item.close(); | ||
92 | metadataLoader.active = false | 91 | metadataLoader.active = false | ||
▲ Show 20 Lines • Show All 329 Lines • ▼ Show 20 Line(s) | 408 | LabelWithToolTip { | |||
422 | elide: Text.ElideRight | 421 | elide: Text.ElideRight | ||
423 | } | 422 | } | ||
424 | 423 | | |||
425 | Item { | 424 | Item { | ||
426 | Layout.fillWidth: true | 425 | Layout.fillWidth: true | ||
427 | Layout.preferredWidth: 0 | 426 | Layout.preferredWidth: 0 | ||
428 | } | 427 | } | ||
429 | 428 | | |||
430 | Controls1.ToolButton { | 429 | FlatButtonWithToolTip { | ||
431 | id: infoButton | 430 | id: infoButton | ||
432 | objectName: 'infoButton' | 431 | objectName: 'infoButton' | ||
433 | 432 | | |||
434 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | 433 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | ||
435 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | 434 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | ||
436 | 435 | | |||
437 | opacity: 0 | 436 | opacity: 0 | ||
438 | 437 | | |||
439 | visible: opacity > 0.1 | 438 | visible: opacity > 0.1 | ||
440 | 439 | | |||
441 | action: showInfo | 440 | action: showInfo | ||
442 | Layout.alignment: Qt.AlignVCenter | Qt.AlignRight | 441 | Layout.alignment: Qt.AlignVCenter | Qt.AlignRight | ||
443 | } | 442 | } | ||
444 | 443 | | |||
445 | Controls1.ToolButton { | 444 | FlatButtonWithToolTip { | ||
446 | id: playPauseButton | 445 | id: playPauseButton | ||
447 | objectName: 'playPauseButton' | 446 | objectName: 'playPauseButton' | ||
448 | 447 | | |||
449 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | 448 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | ||
450 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | 449 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | ||
451 | 450 | | |||
452 | opacity: 0 | 451 | opacity: 0 | ||
453 | 452 | | |||
454 | scale: LayoutMirroring.enabled ? -1 : 1 // We can mirror the symmetrical pause icon | 453 | scale: LayoutMirroring.enabled ? -1 : 1 // We can mirror the symmetrical pause icon | ||
455 | 454 | | |||
456 | visible: opacity > 0.1 | 455 | visible: opacity > 0.1 | ||
457 | action: !(isPlaying === MediaPlayList.IsPlaying) ? playNow : pauseNow | 456 | action: !(isPlaying === MediaPlayList.IsPlaying) ? playNow : pauseNow | ||
458 | Layout.alignment: Qt.AlignVCenter | Qt.AlignRight | 457 | Layout.alignment: Qt.AlignVCenter | Qt.AlignRight | ||
459 | } | 458 | } | ||
460 | 459 | | |||
461 | Item { | 460 | Item { | ||
462 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | 461 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | ||
463 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | 462 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | ||
464 | Layout.maximumWidth: elisaTheme.smallDelegateToolButtonSize | 463 | Layout.maximumWidth: elisaTheme.smallDelegateToolButtonSize | ||
465 | Layout.maximumHeight: elisaTheme.smallDelegateToolButtonSize | 464 | Layout.maximumHeight: elisaTheme.smallDelegateToolButtonSize | ||
466 | Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter | 465 | Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter | ||
467 | 466 | | |||
468 | Controls1.ToolButton { | 467 | FlatButtonWithToolTip { | ||
469 | id: removeButton | 468 | id: removeButton | ||
470 | objectName: 'removeButton' | 469 | objectName: 'removeButton' | ||
471 | 470 | | |||
472 | anchors.fill: parent | 471 | anchors.fill: parent | ||
473 | 472 | | |||
474 | opacity: 0 | 473 | opacity: 0 | ||
475 | 474 | | |||
476 | visible: opacity > 0.1 | 475 | visible: opacity > 0.1 | ||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |