From fe4380b8ba69851da8eb3c78eb50c70b88588c21 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Fri, 7 Feb 2014 00:12:22 +0100 Subject: [PATCH] EpisodeItem behavior and highlight/style --- touch/ButtonArea.qml | 3 ++- touch/EpisodeItem.qml | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/touch/ButtonArea.qml b/touch/ButtonArea.qml index cfd3282..774c07c 100644 --- a/touch/ButtonArea.qml +++ b/touch/ButtonArea.qml @@ -23,10 +23,11 @@ import QtQuick 2.0 MouseArea { id: mouseArea property bool transparent: false + property bool canHighlight: true Rectangle { anchors.fill: parent - color: mouseArea.pressed?'#33ffffff':(mouseArea.transparent?'#00000000':'#88000000') + color: (mouseArea.pressed && mouseArea.canHighlight)?'#33ffffff':(mouseArea.transparent?'#00000000':'#88000000') visible: parent.enabled } } diff --git a/touch/EpisodeItem.qml b/touch/EpisodeItem.qml index fddae22..595896f 100644 --- a/touch/EpisodeItem.qml +++ b/touch/EpisodeItem.qml @@ -93,9 +93,14 @@ Item { ButtonArea { id: episodeItemArea + opacity: canHighlight ? 1 : 0.2 + canHighlight: (episodeList.selectedIndex == index) || (episodeList.selectedIndex == -1) + onClicked: { if (episodeList.selectedIndex == index) { episodeList.selectedIndex = -1; + } else if (episodeList.selectedIndex != -1) { + episodeList.selectedIndex = -1; } else { episodeList.selectedIndex = index; } @@ -151,13 +156,23 @@ Item { elide: Text.ElideRight text: title - color: isNew ? Constants.colors.fresh : 'white' + color: { + if (episodeItem.isPlaying) { + return Constants.colors.playback; + } else if (progress > 0) { + return Constants.colors.download; + } else if (isNew) { + return Constants.colors.fresh; + } else { + return 'white'; + } + } opacity: { - switch (downloadState) { - case Constants.state.normal: return 0.8; - case Constants.state.downloaded: return 1; - case Constants.state.deleted: return 0.3; + if (downloadState == Constants.state.deleted && !isNew && progress <= 0) { + return 0.3; + } else { + return 1.0; } } }