Hi Keith, how do you like this:
QSringList list; if(m_bFilterGenre) list.append(m_pFilterGenre); if(m_bFilterBpm) list.append(m_pFilterBpm); if(m_bFilterYear) list.append(m_pFilterYear); filterText = list.join(" AND "); Kind regards Daniel -------- Original-Nachricht -------- > Datum: Wed, 21 Mar 2012 04:51:50 -0800 > Von: "keithsalisb...@gmail.com" <keithsalisb...@gmail.com> > An: mixxx-devel <mixxx-devel@lists.sourceforge.net> > Betreff: Re: [Mixxx-devel] Active Library Filter > Ok peeps, so I did a bit of refactoring tonight, so now the filters > are checkboxes rather than radio buttons - the advantage is that you > can filter for both genre and bpm - and it works brilliantly. Also > thanks to Daniels great suggestion I've hooked it up to the > currentPlayingDeckChanged so its really nice when you're in the mix > and bring the cross fader across only to be presented with a whole > load of suitable tracks. Makes djing your way through a big library > fun and easy - and helps to pull out some forgotten gems too. > > I know adding "Key" and "Year" will be great additions to the filters. > The only other idea I have is to add a slider to the bpm to give it > some range (+/-) - that would be kinda fun, but I don't know how to do > that just yet. > > However I've ended up with some pretty damn smelly code to create the > sql, and not being a native C++'er this is the best I could come up > with. > > QString filterText = ""; > QString filterTextA = (m_bFilterGenre) ? m_pFilterGenre : ""; > QString filterTextB = (m_bFilterBpm) ? m_pFilterBpm : ""; > QString filterJoin = (filterTextA != NULL && filterTextB != NULL) > ? " AND " : ""; > filterText = filterTextA + filterJoin + filterTextB; > > Problem is, as soon as I add some more filters - my next being "Year" > it gets unmanageable. So how do I write code like this in C++? > > In ruby, I could put them all in an array and use the join method. > > cheers > Keith > > > On 21 March 2012 01:04, <mar...@signalpirat.de> wrote: > > Hi Keith, > > > > I totally agree with Daniel that b) is better than a). > > Even greater would be the option to select (with a small button in the > > GUI) which deck(s) should be takes into consideration. > > > > Best regards, > > Martin > > > > > > > > > ------------------------------------------------------------------------------ > > This SF email is sponsosred by: > > Try Windows Azure free for 90 days Click Here > > http://p.sf.net/sfu/sfd2d-msazure > > _______________________________________________ > > Get Mixxx, the #1 Free MP3 DJ Mixing software Today > > http://mixxx.org > > > > > > Mixxx-devel mailing list > > Mixxx-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/mixxx-devel > > > > -- > keithsalisb...@gmail.com > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Get Mixxx, the #1 Free MP3 DJ Mixing software Today > http://mixxx.org > > > Mixxx-devel mailing list > Mixxx-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mixxx-devel -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Get Mixxx, the #1 Free MP3 DJ Mixing software Today http://mixxx.org Mixxx-devel mailing list Mixxx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mixxx-devel