Hi Jeff,<br><br>Sound like a good idea. What about a disable/enable for the dynamic collection? If it already exists or not possible, please inform me. I don't really know any code except podcasts and mediadevices and don't use dynamic collection either.
<br><br><div><span class="gmail_quote">2006/9/29, Jeff Mitchell <<a href="mailto:kde-dev@emailgoeshere.com">kde-dev@emailgoeshere.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Folks--<br><br>Today I was coding up better fileAdded and fileDeleted behavior with AFT and<br>the Playlist, when I realized that a problem has existed for quite some time:<br>we have many ways of disabling or enabling playlist items, but only one
<br>variable to keep its state.  This is very limiting, because items can be<br>disabled or enabled for completely different reasons -- if a file exists or<br>doesn't exist, if a file's has or hasn't been played in Dynamic mode, and
<br>possible other uses in the future (such as a mode where the entire playlist<br>is played in random order, tracks being disabled as they're played).  And it<br>was causing other problems, such as files that were detected as being added
<br>back to collection folders causing tracks to be enabled that should be<br>disabled because of dynamic playlists.  Hacks around this were very kludgy.<br><br>Anyways (I know how much Ian hates rambles), I came up with a solution that I
<br>think is pretty robust.  PlaylistItem::setEnabled no longer takes a bool, and<br>should not be called directly.  Instead, you call<br>PlaylistItem::setDynamicEnabled or PlaylistItem::setFilestatusEnabled.  These<br>update the respective variables indicating whether the item should be
<br>disabled because of dynamic playlists, or because the file doesn't exist, and<br>then in turn call setEnabled.  setEnabled now ANDs the various other bools<br>together, only having the item enabled if they all indicate it should be.
<br><br>You can probably see how this can easily be extended: simply create a setter<br>and getter for the new bool that indicates if an item should be disabled or<br>not; have the setter call setEnabled when done; add the bool to the
<br>setEnabled ANDing of the various bool values.  That's basically it.  There's<br>one more function I added, setAllCriteriaEnabled, which sets all globally so<br>should also be modified.<br><br>I tried to be careful in determining which value should be modified where, but
<br>I anticipate that there could be some issues in Dynamic Playlist mode, so<br>I'll be testing it, and hopefully other people will be as well (read:  PLEASE<br>TEST IT  :-)  ).  We have a ways to 1.4.4, we're in no rush, so should have
<br>plenty of time to iron out the kinks.<br><br>Anyways, sorry if this breaks dynamic playlists a bit, but it will end up<br>making our life much easier anytime that we need to enable or disable the<br>playlistitems for any reason, without having to hack around the other
<br>possibilities.<br><br>--Jeff<br>_______________________________________________<br>Amarok mailing list<br><a href="mailto:Amarok@kde.org">Amarok@kde.org</a><br><a href="https://mail.kde.org/mailman/listinfo/amarok">https://mail.kde.org/mailman/listinfo/amarok
</a><br></blockquote></div><br>