diff -r 608f67c22514 -r 896e9dbc5f19 qtinternetradio/ui/src/irplayingbanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/src/irplayingbanner.cpp Wed Aug 18 09:40:26 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include + +#include "irplayingbanner.h" +#include "iruidefines.h" + +IRPlayingBanner::IRPlayingBanner() : iStationName(NULL), iArtistSongName(NULL) +{ + grabGesture(Qt::TapGesture); +} + +void IRPlayingBanner::gestureEvent(QGestureEvent *aEvent) +{ + HbTapGesture *tapGesture = qobject_cast(aEvent->gesture(Qt::TapGesture)); + if (!tapGesture) + { + return; + } + + if (Qt::GestureStarted == tapGesture->state()) + { + setPlayingBannerTextColor(KNowPlayingBannerColorPressed); + } + else if (Qt::GestureFinished == tapGesture->state()) + { + setPlayingBannerTextColor(KNowPlayingBannerColorNormal); + emit playingBannerTapFinished(); + } + else if (Qt::GestureCanceled == tapGesture->state()) + { + setPlayingBannerTextColor(KNowPlayingBannerColorNormal); + } +} + +void IRPlayingBanner::changeEvent(QEvent *event) +{ + if (HbEvent::ThemeChanged == event->type()) + { + setPlayingBannerTextColor(KNowPlayingBannerColorNormal); + } + + HbWidget::changeEvent(event); +} + +void IRPlayingBanner::setPlayingBannerTextColor(const QString &aColor) +{ + init(); + QColor color = HbColorScheme::color(aColor); + iStationName->setTextColor(color); + iArtistSongName->setTextColor(color); +} + +void IRPlayingBanner::init() +{ + if (iStationName && iArtistSongName) + { + return; + } + + int max = layout()->count(); + for (int i = 0; i < max; i++) + { + QObject *obj = dynamic_cast(layout()->itemAt(i)); + if (obj->objectName() == ABSTRACT_LIST_VIEW_BASE_OBJECT_STATIONNAME) + { + iStationName = static_cast(obj); + } + else if (obj->objectName() == ABSTRACT_LIST_VIEW_BASE_OBJECT_ARTISTSONGNAME) + { + iArtistSongName = static_cast(obj);; + } + } +}