--- a/radioapp/radiowidgets/src/radiostationcarousel.cpp Mon Aug 23 14:17:50 2010 +0300
+++ b/radioapp/radiowidgets/src/radiostationcarousel.cpp Fri Sep 03 12:25:04 2010 +0300
@@ -82,7 +82,8 @@
mModel( NULL ),
mPosAdjustmentDisabled( false ),
mScrollDirection( Scroll::Shortest ),
- mManualSeekMode( false )
+ mManualSeekMode( false ),
+ mOrientation( false )
#ifdef USE_DEBUGGING_CONTROLS
,mRdsLabel( new RadioFadingLabel( this ) )
#endif // USE_DEBUGGING_CONTROLS
@@ -440,6 +441,7 @@
void RadioStationCarousel::setLandscape( bool landscape )
{
CALL_TO_ALL_ITEMS( setLandscape( landscape ) );
+ mOrientation = landscape;
}
/*!
@@ -629,9 +631,17 @@
HbScrollArea::gestureEvent( event );
- if ( HbPanGesture* gesture = qobject_cast<HbPanGesture*>( event->gesture( Qt::PanGesture ) ) ) {
- if ( gesture->state() == Qt::GestureFinished ) {
- adjustPos( (int)gesture->offset().x() );
+ if ( mOrientation ) {
+ if ( HbPanGesture* gesture = qobject_cast<HbPanGesture*>( event->gesture( Qt::PanGesture ) ) ) {
+ if ( gesture->state() == Qt::GestureFinished ) {
+ adjustPos( (int)gesture->offset().y() );
+ }
+ }
+ } else {
+ if ( HbPanGesture* gesture = qobject_cast<HbPanGesture*>( event->gesture( Qt::PanGesture ) ) ) {
+ if ( gesture->state() == Qt::GestureFinished ) {
+ adjustPos( (int)gesture->offset().x() );
+ }
}
}
}
@@ -860,30 +870,50 @@
int newIndex = mCurrentIndex;
bool needsToScroll = false;
- if ( isScrollingAllowed() && abs( offset ) >= threshold ) {
+ if ( isScrollingAllowed() && abs( offset ) >= threshold ) {
needsToScroll = true;
if ( offset > 0 ) {
newPos = 0;
mScrollDirection = Scroll::Right;
if ( !mIsCustomFreq ) {
- const uint newFreq = mModel->findClosest( mItems[CenterItem]->frequency(), StationSkip::PreviousFavorite ).frequency();
+ if ( mModel->favoriteCount() > 1 ){
+ const uint newFreq = mModel->findClosest( mItems[CenterItem]->frequency(), StationSkip::PreviousFavorite ).frequency();
+ if ( newFreq > 0 ) {
+ newIndex = mModel->indexFromFrequency( newFreq );
+ } else {
+ needsToScroll = false;
+ newPos = mMidScrollPos;
+ }
+ } else {
+ const uint newFreq = mModel->findClosest( mItems[CenterItem]->frequency(), StationSkip::Previous ).frequency();
+ if ( newFreq > 0 ) {
+ newIndex = mModel->indexFromFrequency( newFreq );
+ } else {
+ needsToScroll = false;
+ newPos = mMidScrollPos;
+ }
+ }
+ }
+ } else {
+ mScrollDirection = Scroll::Left;
+ newPos = mMaxScrollPos;
+
+ if ( mModel->favoriteCount() > 1 ){
+ const uint newFreq = mModel->findClosest( mItems[CenterItem]->frequency(), StationSkip::NextFavorite ).frequency();
if ( newFreq > 0 ) {
newIndex = mModel->indexFromFrequency( newFreq );
} else {
needsToScroll = false;
newPos = mMidScrollPos;
}
- }
- } else {
- mScrollDirection = Scroll::Left;
- newPos = mMaxScrollPos;
-
- const uint newFreq = mModel->findClosest( mItems[CenterItem]->frequency(), StationSkip::NextFavorite ).frequency();
- if ( newFreq > 0 ) {
- newIndex = mModel->indexFromFrequency( newFreq );
} else {
- needsToScroll = false;
- newPos = mMidScrollPos;
+ const uint newFreq = mModel->findClosest( mItems[CenterItem]->frequency(), StationSkip::Next ).frequency();
+ if ( newFreq > 0 ) {
+ newIndex = mModel->indexFromFrequency( newFreq );
+ } else {
+ needsToScroll = false;
+ newPos = mMidScrollPos;
+ }
}
}
}