EpisodeItem behavior and highlight/style

This commit is contained in:
Thomas Perl 2014-02-07 00:12:22 +01:00
parent 51efb2e089
commit fe4380b8ba
2 changed files with 22 additions and 6 deletions

View file

@ -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
}
}

View file

@ -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;
}
}
}