EpisodeItem behavior and highlight/style
This commit is contained in:
parent
51efb2e089
commit
fe4380b8ba
2 changed files with 22 additions and 6 deletions
|
@ -23,10 +23,11 @@ import QtQuick 2.0
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
property bool transparent: false
|
property bool transparent: false
|
||||||
|
property bool canHighlight: true
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: mouseArea.pressed?'#33ffffff':(mouseArea.transparent?'#00000000':'#88000000')
|
color: (mouseArea.pressed && mouseArea.canHighlight)?'#33ffffff':(mouseArea.transparent?'#00000000':'#88000000')
|
||||||
visible: parent.enabled
|
visible: parent.enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,9 +93,14 @@ Item {
|
||||||
ButtonArea {
|
ButtonArea {
|
||||||
id: episodeItemArea
|
id: episodeItemArea
|
||||||
|
|
||||||
|
opacity: canHighlight ? 1 : 0.2
|
||||||
|
canHighlight: (episodeList.selectedIndex == index) || (episodeList.selectedIndex == -1)
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (episodeList.selectedIndex == index) {
|
if (episodeList.selectedIndex == index) {
|
||||||
episodeList.selectedIndex = -1;
|
episodeList.selectedIndex = -1;
|
||||||
|
} else if (episodeList.selectedIndex != -1) {
|
||||||
|
episodeList.selectedIndex = -1;
|
||||||
} else {
|
} else {
|
||||||
episodeList.selectedIndex = index;
|
episodeList.selectedIndex = index;
|
||||||
}
|
}
|
||||||
|
@ -151,13 +156,23 @@ Item {
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: title
|
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: {
|
opacity: {
|
||||||
switch (downloadState) {
|
if (downloadState == Constants.state.deleted && !isNew && progress <= 0) {
|
||||||
case Constants.state.normal: return 0.8;
|
return 0.3;
|
||||||
case Constants.state.downloaded: return 1;
|
} else {
|
||||||
case Constants.state.deleted: return 0.3;
|
return 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue