[Amarok] c9966b2: Half star rating in collection search field. From
Myriam Schweingruber
schweingruber at pharma-traduction.ch
Sun Dec 19 14:05:54 CET 2010
Hi all,
Something has gone wrong here, definitely, as now one can only filter
by half the value of a star anymore.
For information: Half a star = 1 rating point, not 0.5
If I now want to filter by rating, let's say between 1 and 7 rating
points I get a filter between 0.5 and 3.5
See also bug 260333
Regards, Myriam.
On Fri, Nov 26, 2010 at 02:16, Ralf Engels <ralf-engels at gmx.de> wrote:
> commit c9966b25e259568de09688d32db7ee7ae6ef8795
> branch master
> Author: Ralf Engels <ralf-engels at gmx.de>
> Date: Fri Nov 26 01:41:53 2010 +0100
>
> Half star rating in collection search field.
> From Daniel Faust
>
> diff --git a/src/browsers/CollectionTreeItemModelBase.cpp b/src/browsers/CollectionTreeItemModelBase.cpp
> index 280245a..0bff03b 100644
> --- a/src/browsers/CollectionTreeItemModelBase.cpp
> +++ b/src/browsers/CollectionTreeItemModelBase.cpp
> @@ -742,7 +742,7 @@ CollectionTreeItemModelBase::addFilters( Collections::QueryMaker * qm ) const
> }
> else if( lcField.compare( "rating", Qt::CaseInsensitive ) == 0 || lcField.compare( i18n( "rating" ), Qt::CaseInsensitive ) == 0 )
> {
> - ADD_OR_EXCLUDE_NUMBER_FILTER( Meta::valRating, elem.text.toInt(), compare );
> + ADD_OR_EXCLUDE_NUMBER_FILTER( Meta::valRating, elem.text.toFloat() * 2, compare );
> }
> else if( lcField.compare( "score", Qt::CaseInsensitive ) == 0 || lcField.compare( i18n( "score" ), Qt::CaseInsensitive ) == 0 )
> {
> diff --git a/src/context/widgets/RatingWidget.cpp b/src/context/widgets/RatingWidget.cpp
> index a2bfbaf..4a84091 100644
> --- a/src/context/widgets/RatingWidget.cpp
> +++ b/src/context/widgets/RatingWidget.cpp
> @@ -67,7 +67,7 @@ RatingWidget::RatingWidget( QGraphicsItem* parent )
> , m_startupUpdates( 2 )
> {
> setAcceptHoverEvents( true );
> - setToolTip( i18n( "Track rating: %1", d->rating ) );
> + setToolTip( i18n( "Track rating: %1", (float)d->rating / 2 ) );
> }
>
>
> @@ -218,7 +218,7 @@ RatingWidget::mousePressEvent( QGraphicsSceneMouseEvent* e )
> if ( ratingFromPos >= 0 )
> {
> d->hoverRating = d->rating = ratingFromPos;
> - setToolTip( i18n( "Track rating: %1", d->rating ) );
> + setToolTip( i18n( "Track rating: %1", (float)d->rating / 2 ) );
> update();
> emit ratingChanged( d->rating );
> }
> @@ -244,7 +244,7 @@ RatingWidget::hoverEnterEvent( QGraphicsSceneHoverEvent* e )
> contentsRect().width(), contentsRect().height() );
> d->hoverRating = d->ratingPainter.ratingFromPosition( rect, QPoint( e->pos().x(), e->pos().y() ) );
>
> - setToolTip( i18n( "Track rating: %1", d->rating ) );
> + setToolTip( i18n( "Track rating: %1", (float)d->rating / 2 ) );
>
> update();
> }
> diff --git a/src/widgets/MetaQueryWidget.cpp b/src/widgets/MetaQueryWidget.cpp
> index 838d12d..44c2536 100644
> --- a/src/widgets/MetaQueryWidget.cpp
> +++ b/src/widgets/MetaQueryWidget.cpp
> @@ -933,6 +933,11 @@ QString MetaQueryWidget::Filter::toString( bool invert )
> {
> strValue1 = Amarok::FileTypeSupport::toString( Amarok::FileType( numValue ));
> }
> + else if( field == Meta::valRating )
> + {
> + strValue1 = QString::number( (float)numValue / 2 );
> + strValue2 = QString::number( (float)numValue2 / 2 );
> + }
> else if( MetaQueryWidget::isDate(field) )
> {
> // here we are handling only the date. relative times are handled below
>
--
Protect your freedom and join the Fellowship of FSFE:
http://www.fsfe.org
Please don't send me proprietary file formats,
use ISO standard ODF instead (ISO/IEC 26300)
More information about the Amarok-devel
mailing list