/*!
 Sets the song \a duration.
*/
void MpPlaybackData::setDuration( int duration )
{
    TX_ENTRY_ARGS( "duration = " << duration )
    mDuration = duration;
    emit durationChanged();
    TX_EXIT
}
void KeyCaptureTestApp::processEvent(const QString &prefix, QEvent *ev)
{
    TX_ENTRY_ARGS(reinterpret_cast<int>(ev));
    if (ev){
        if (ev->type() == QEvent::KeyPress){
           QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
           QString keyName = mappingPtr->name(static_cast<Qt::Key>(keyEvent->key())); 
           
           addTextLine(prefix + QString("KeyPress:%1\n").arg(keyName));
        } else if (ev->type() == QEvent::KeyRelease){
           QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
           QString keyName = mappingPtr->name(static_cast<Qt::Key>(keyEvent->key()));
           
           addTextLine(prefix + QString("KeyRelease:%1\n").arg(keyName));
        } else if (ev->type() == XQKeyCapture::remoteEventType_KeyPress()){
           QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
           QString keyName = mappingPtr->name(static_cast<Qt::Key>(keyEvent->key()));

           addTextLine(prefix + QString("KeyPress:%1 (native:%2)\n").arg(keyName).arg(static_cast<int>(keyEvent->nativeVirtualKey())));
        } else if (ev->type() == XQKeyCapture::remoteEventType_KeyRelease()){
           QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
           QString keyName = mappingPtr->name(static_cast<Qt::Key>(keyEvent->key()));
                      
           addTextLine(prefix + QString("KeyRelease:%1 (native:%2)\n").arg(keyName).arg(static_cast<int>(keyEvent->nativeVirtualKey())));
        }
    }
    TX_EXIT_ARGS(reinterpret_cast<int>(ev));
}
/*!
 Slot to be called when an item is selected by the user.
*/
void MpCollectionContainerAlbums::itemActivated( const QModelIndex &index )
{
    if ( mCollectionContext == ECollectionContextAlbums ) {
        mCurrentAlbumIndex = index.row();
        TX_ENTRY_ARGS("mCurrentAlbumIndex=" << mCurrentAlbumIndex);
        MpCollectionListContainer::itemActivated(index);
    }
    else if ( mCollectionContext == ECollectionContextAlbumsTBone ) {
        int row = index.row();
        TX_ENTRY_ARGS("index=" << row);
        if ( mViewMode == MpCommon::FetchView ) {
            MpCollectionListContainer::itemActivated(index);
        }
        else {
            emit playAlbumSongs(mCurrentAlbumIndex, row);
        }
    }
    TX_EXIT
}
/*!
 \internal
 Handles an active object's request completion event.
 */
void MpMediaKeyRemConResponse::RunL()
{
    TX_ENTRY_ARGS( "iStatus=" << iStatus.Int() );
    // if any existing -> Send response
    if ( iResponseArray.Count() ) {
        CompleteAnyKey( iResponseArray[0] );
        // Remove already completed key
        iResponseArray.Remove( 0 );
        iResponseArray.Compress();
    }
    TX_EXIT
}
Пример #5
0
/*!
 Stub
 */
MpEngine::MpEngine()
    : mBalance(0),
    mLoudness(0)
{
    TX_LOG_ARGS("Stub")
}

/*!
 Stub
 */
MpEngine::~MpEngine()
{
    TX_ENTRY_ARGS("Stub")
}

// Audio Effects related
/*!
 Stub
 */
int MpEngine::balance()
{
    return mBalance;
}

/*!
Stub
 */
bool MpEngine::loudness()
/*!
 \internal
 Constructs the now playing widget private.
 */
MpNowPlayingWidgetPrivate::MpNowPlayingWidgetPrivate( MpNowPlayingWidget *qq )
    : q_ptr( qq ),
      mPrimaryText(0),
      mSecondaryText(0),
      mState( MpPlaybackData::NotPlaying ),
      mPlaybackData(0),
      mMpEngine(0),
      mIcon(0),
      mDocumentLoader(0),
      mCurrentPressedState( BannerNone )
{
    TX_ENTRY_ARGS( " Q pointer=" << ( void * )qq )
    QGraphicsWidget *widget;
    bool widgetsOk = false;
    
    HbStyleLoader::registerFilePath(NOW_PLAYING_CSS);  
    
    mPlayIcon = new HbIcon( QString( "qtg_mono_play" ) );
    mPauseIcon = new HbIcon( QString( "qtg_mono_pause" ) );

    mDocumentLoader = new HbDocumentLoader();
    if (mDocumentLoader) {
            mDocumentLoader->load( NOW_PLAYING_XML, &widgetsOk);
    }

    if (widgetsOk) {

        // find the main widget container and all of its child items
        widget = mDocumentLoader->findWidget(QString("nowPlayingContainer"));
        HbWidget* container = qobject_cast<HbWidget*>(widget);
        container->setParentItem(q_ptr);

        widget = mDocumentLoader->findWidget(QString("primaryText"));
        mPrimaryText = qobject_cast<HbLabel*>(widget);
        mPrimaryText->setObjectName( "bannerLabel" );
        mPrimaryText->setProperty( "state", "normal" );
        

        widget = mDocumentLoader->findWidget(QString("secondaryText"));
        mSecondaryText = qobject_cast<HbLabel*>(widget);
        mSecondaryText->setObjectName( "bannerLabel" );
        mSecondaryText->setProperty( "state", "normal" );
        
        
        widget = mDocumentLoader->findWidget(QString("playPause"));
        mIcon = qobject_cast<HbLabel*>(widget);
        mIcon->setObjectName( "bannerLabel" );
        mIcon->setProperty( "state", "normal" );
        
        HbStackedLayout *mylayout;
        mylayout = new HbStackedLayout(q_ptr);
        mylayout->addItem( container );

        q_ptr->setLayout( mylayout );
    }
    else {
        TX_LOG_ARGS("Error: invalid xml file.");
        Q_ASSERT_X(widgetsOk, "MpNowPlayingWidgetPrivate", "invalid xml file");
    }

    mMpEngine = MpEngineFactory::sharedEngine();
    mPlaybackData = mMpEngine->playbackData();
    setEnabled(true);
    TX_EXIT
}
/*!
 \internal
 Send the any key response back to Remcon server
 */
void MpMediaKeyRemConResponse::CompleteAnyKey(
    TRemConCoreApiOperationId aOperationId )
{
    TX_ENTRY_ARGS(" OperationId: " << aOperationId );
    if ( !IsActive() ) {
        switch ( aOperationId )
        {
            case ERemConCoreApiPausePlayFunction:
            {
                iRemConCoreApiTarget.PausePlayFunctionResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiPlay:
            {
                iRemConCoreApiTarget.PlayResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiStop:
            {
                iRemConCoreApiTarget.StopResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiPause:
            {
                iRemConCoreApiTarget.PauseResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiRewind:
            {
                iRemConCoreApiTarget.RewindResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiFastForward:
            {
                iRemConCoreApiTarget.FastForwardResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiBackward:
            {
                iRemConCoreApiTarget.BackwardResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiForward:
            {
                iRemConCoreApiTarget.ForwardResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiVolumeUp:
            {
                iRemConCoreApiTarget.VolumeUpResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            case ERemConCoreApiVolumeDown:
            {
                iRemConCoreApiTarget.VolumeDownResponse( iStatus, KErrNone );
                SetActive();
                break;
            }
            default:
            {
                TInt error = KErrNone;
                iRemConCoreApiTarget.SendResponse(
                    iStatus, aOperationId, error );
                SetActive();
                break;
            }
        }
    }
    // already active. Append to array and complete later.
    else
    {
        iResponseArray.Append( aOperationId );
    }
    TX_EXIT
}