/*
 * Description  : slot function for operation failure. The signal is emitted by isds client
 * Parameters   : aError : see the definition of IRQError
 */
void IRCategoryView::operationException(IRQError aError)
{
    Q_UNUSED(aError);
    iApplication->stopLoadingAnimation();

    disconnectIsdsClient();
    
#ifdef SUBTITLE_STR_BY_LOCID
    popupNote(hbTrId("txt_irad_info_failed_to_connect"), HbMessageBox::MessageTypeWarning);
#else
    popupNote(hbTrId("Connecting failed"), HbMessageBox::MessageTypeWarning);
#endif
    
    //if category view is starting view and failed to get data from ISDS server, back to main view
    if (getViewManager()->currentView() == this &&
        iListView->model()->rowCount() == 0)
    {
        getViewManager()->activateView(EIRView_MainView);
    }
    if((getViewManager()->currentViewId() == EIRView_MainView) || (getViewManager()->currentViewId() == EIRView_FavoritesView))
    {
        IRBaseView *baseView = static_cast<IRBaseView*>(getViewManager()->currentView());
        baseView->updateView();
    }
}
/*
 * Description  : slot function when an item in a list is clicked. call isds client to get 
 *                channel list under the clicked category.
 * Parameters   : aItem  : pointer to the clicked item
 * Return       : None
 */
void IRCategoryView::handleItemSelected()
{
    if (iIsdsClient && iListView)
    {
        int index = iListView->currentIndex().row();
        if ( iLastSelectItem != index )
        {
            IRBaseView *stationView = getViewManager()->getView(EIRView_StationsView);
            if( stationView )
            {
                static_cast<IrAbstractListViewBase*>(stationView)->resetCurrentItem();
            }
        }
        iLastSelectItem = index;
        if (iIsdsClient->isdsIsCategoryBanner())
        {
            ++index;
        }
        
        const QString& headingText = iModel->categoryName(iListView->currentIndex());
        IRStationsView *stationsView =
        static_cast<IRStationsView*>(getViewManager()->getView(EIRView_StationsView, true));
        stationsView->loadCategoryStations(index, headingText);
    }
}
void IRNowPlayingView::handleDetailInfoAction()
{
    LOG_METHOD;
    getViewManager()->activateView(EIRView_StationDetailsView);
    IRStationDetailsView *channelHistoryView = static_cast<IRStationDetailsView*>(getViewManager()->getView(EIRView_StationDetailsView));
    channelHistoryView->setDetails();

}
예제 #4
0
GLDisplay* XmdvToolMainWnd::getGLDisplay(){
	if (getViewManager() == 0) {
		return 0;
	}
	if (getViewManager()->getActiveViewWindow() == 0) {
		return 0 ;
	}
	if (getViewManager()->getActiveViewWindow()->getGLDisplay() == 0) {
		return 0 ;
	}

	return getViewManager()->getActiveViewWindow()->getGLDisplay();
}
예제 #5
0
void OkcViewDisplay::refreshBrush() {
	OkcVisualMapResult* okvVMR = getOkcVisualMapResult();
	Operator* brushQ = (Operator*)(okvVMR->getBrushOperator());
	PipelineManager* pm = getPipelineManager();
	Brush *brush = okvVMR->getBrush();

	//If the maximum and minimum values for one dimension has the exact same value,
	//they should be adjusted to a little different values,
	//otherwise, some records having the same value as this max/min value
	//cannot be highlighted.

	int i;
	for (i=0; i<brush->getDimSize(); i++) {
		brush->max[i] += XMDV_DBL_EPSILON;
		brush->min[i] -= XMDV_DBL_EPSILON;
	}

	OkcData* brushStorage = brush->toOkcDataStorage();
	std::vector<double> buf;
	brushStorage->getData(buf, 3);
	int pID = getPipelineID();
	// update the assistant input by the reverse pipeline
	pm->updateAssisInput(pID, brushStorage, XmdvTool::ASSISDATA_BRUSH);

	delete brushStorage;
	pm->assemble(pID, brushQ);
	getViewManager()->refreshDisplayByPID(pID);
}
/*
 * Description : slot function for canceling request.
 *               Before data is received, cancel requests through isds client
 */
void IRCategoryView::cancelRequest()
{
    iIsdsClient->isdsCancelRequest();
    disconnectIsdsClient();
    iApplication->stopLoadingAnimation();
    
    //if this function is called and this view is current view, it indicates that this view is starting view and 
    //data has not been loaded yet, so we need to back to collections view
    if (getViewManager()->currentView() == this)
    {
        getViewManager()->activateView(EIRView_MainView);
    }
    if((getViewManager()->currentViewId() == EIRView_MainView) || (getViewManager()->currentViewId() == EIRView_FavoritesView))
    {
        IRBaseView *baseView = static_cast<IRBaseView*>(getViewManager()->currentView());
        baseView->updateView();
    }
}
void IRCategoryView::resetCurrentItem()
{
    iLastSelectItem = 0;
    IRBaseView *stationView = getViewManager()->getView(EIRView_StationsView);
    if( stationView )
    {
        static_cast<IrAbstractListViewBase*>(stationView)->resetCurrentItem();
    }
}
/*
 * Description : constructor
 */
IRNowPlayingView::IRNowPlayingView(IRApplication* aApplication, TIRViewId aViewId) :
    IRBaseView(aApplication, aViewId),
    iStatisticsReporter(NULL),
    iStationShare(NULL),
    iPlayStopAction(NULL),
    iLogoDownloadState(EIdle),    
    iSongNameLabel(NULL),
    iSongNameMarquee(NULL),
    iArtistName(NULL),
    iStationName(NULL),
    iStationLogo(NULL),
    iLogoNeedUpdate(true),    
    iFindinNmsAllowed(false),
    iSongNameAvailable(false)
#ifdef ADV_ENABLED
    ,iAdvImage(NULL)
    ,iAdvImageNeedUpdate(true)
    ,iAdvUrl(KDefaultAdvLink)    
#endif
{
    LOG_METHOD;
    
    iLaunchActionNeeded = (0 == getViewManager()->views().count()); // this is the starting view
        
    initialize();
    
    iStatisticsReporter = IRQStatisticsReporter::openInstance();
        
    connect(iPlayController, SIGNAL(metaDataAvailable(IRQMetaData*)), this, SLOT(updateMetaData(IRQMetaData*)));
    connect(iPlayController, SIGNAL(playingStarted()), this, SLOT(handlePlayStarted()));
    connect(iPlayController, SIGNAL(playingStopped()), this, SLOT(handlePlayStopped()));

    connect(iNetworkController, SIGNAL(networkRequestNotified(IRQNetworkEvent)),
            this, SLOT(handleNetworkEvent(IRQNetworkEvent)));
    connect(iApplication->getMediaKeyObserver(), SIGNAL(playPausePressed()), 
            this, SLOT(handlePlayPauseMediaKey()));
    connect(iApplication->getMediaKeyObserver(), SIGNAL(stopPressed()), 
            this, SLOT(handleStopMediaKey()));
    connect( getViewManager(), SIGNAL( orientationChanged(Qt::Orientation) ),
             this, SLOT( handleOrientationChanged(Qt::Orientation) ) );
    
    setFlag(EViewFlag_StickyViewEnabled);
}
/*
 * Description : actions when view is launched.
 */
void IRNowPlayingView::launchAction()
{      
    LOG_METHOD;
    setUseNetworkReason(EIR_UseNetwork_StartingView);
    updateForLauchAction();
#ifdef HS_WIDGET_ENABLED	
    iPlayController->setConnectingStationName(iStationName->plainText());
#endif	
    iApplication->verifyNetworkConnectivity();
    if( iApplication->isEmbeddedInstance())
    {
        getViewManager()->pushViewById(EIRView_PlsView);        
    }
    else
    {
        getViewManager()->pushViewById(EIRView_MainView);         
    }
    
    iLaunchActionNeeded = false;
}
/*
 * Description : update the station information.
 */
void IRStationDetailsView::setDetails()
{
    IRQPreset *nowPlayingPreset = iPlayController->getNowPlayingPreset();
    iStationName->setPlainText(nowPlayingPreset->nickName);
    iGenres->setPlainText(nowPlayingPreset->genreName);
    iLanguage->setPlainText(nowPlayingPreset->languageName);
    iCountry->setPlainText(nowPlayingPreset->countryName);
    iBitRate->setPlainText(QString::number(iPlayController->getNowPlayingBitRate()) + QString("kbps"));
    iDescription->setPlainText(nowPlayingPreset->description);
    iNowPlayingUrl->setPlainText(iPlayController->getNowPlayingUrl());
    handleOrientationChanged(getViewManager()->orientation());
}
void IRTermsConsView::initViewContents()
{               
    setObjectName(TERMS_CONS_VIEW_BASE_OBJECT_VIEW);
    QObjectList roots;
    roots.append(this);
    iLoader.setObjectTree(roots);
    iLoader.load(TERMS_CONS_VIEW_LAYOUT_FILENAME);        
    
	// load correct orientation
    connect( getViewManager(), SIGNAL( orientationChanged(Qt::Orientation) ),
             this, SLOT( handleOrientationChanged(Qt::Orientation) ) );
	handleOrientationChanged(getViewManager()->orientation());
	        
    HbPushButton *acceptButton = qobject_cast<HbPushButton *>(iLoader.findObject(TERMS_CONS_VIEW_ACCEPT_BTN));
    HbPushButton *declineButton = qobject_cast<HbPushButton *>(iLoader.findObject(TERMS_CONS_VIEW_DECLINE_BTN));
    
    connect( acceptButton, SIGNAL(released()),
             iApplication, SLOT(handleTermsConsAccepted()) );    
    connect( declineButton, SIGNAL(released()),
             iApplication, SIGNAL(quit()) );      
}
IRStationDetailsView::IRStationDetailsView(IRApplication* aApplication, TIRViewId aViewId) : IRBaseView(aApplication, aViewId),
                                    iScrollArea(NULL),iContainer(NULL),
                                    iStationName(NULL),iDescription(NULL),
                                    iGenres(NULL),iLanguage(NULL),
                                    iCountry(NULL),iBitRate(NULL),
                                    iNowPlayingUrl(NULL)
{
    
    createDetails();
    connect( getViewManager(), SIGNAL( orientationChanged(Qt::Orientation) ),
             this, SLOT( handleOrientationChanged(Qt::Orientation) ) );
}
/*
 * Description : from base class IRBaseView.
 *               handle view commands.
 * Parameters  : aCommand : see the definition of TIRViewCommand
 * Return      : EIR_DoDefault : caller does default handling
 *               EIR_NoDefault : caller doesn't do default handling
 */
TIRHandleResult IRNowPlayingView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason)
{
    LOG_METHOD;
	LOG_FORMAT("aCommand = %d", (int)aCommand);
    
    Q_UNUSED(aReason);
    TIRHandleResult ret = EIR_DoDefault;

    switch (aCommand)
    {
    case EIR_ViewCommand_TOBEACTIVATED:       
        handleOrientationChanged(getViewManager()->orientation());                 
        updateMusicStoreStatus();
        updateWidgets();
        ret = EIR_NoDefault;
        break;

    case EIR_ViewCommand_ACTIVATED:
        connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )),
                this, SLOT(handleLogoDownloaded(IRQPreset* )));
        updateStationLogo();
        getViewManager()->saveScreenShot();
        break;
        
    case EIR_ViewCommand_DEACTIVATE:
        if( iLogoDownloadState != EIdle )
        {
            // cancel downloading logo
            iIsdsClient->isdsLogoDownCancelTransaction();
            iLogoDownloadState = EIdle;            
        }        
        disconnect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset*)),
                   this, SLOT(handleLogoDownloaded(IRQPreset* )));
        ret = EIR_NoDefault;
        break;
    }

    return ret;
}
/********************************************************************************************************
 * SLOT for Network Event
 *******************************************************************************************************
 */
void IRNowPlayingView::handleNetworkEvent(IRQNetworkEvent aEvent)
{
    LOG_METHOD;
	LOG_FORMAT("aEvent = %d", (int)aEvent );
    if( this != getViewManager()->currentView() )
    {
        return;
    }
    
    switch(aEvent)
    {
    case EIRQNetworkConnectionEstablished:
        {
            if( EIR_UseNetwork_StartingView == getUseNetworkReason() )
            {
                IRPlayList *playList = iApplication->getPlayList();
                if (playList && 1 == playList->getNumberOfEntries())
                {
                    IRQPreset *preset = playList->getPresetForEntry(0);
                    iPlayController->connectToChannel(preset, EIRQAdhocExternal);
                    delete preset;
                }
                else
                {
                    IRLastPlayedStationInfo *lastPlayedStationInfo = iApplication->getLastPlayedStationInfo();                    
                    if( lastPlayedStationInfo )
                    {
                        IRQPreset *lastPreset = NULL;
                        lastPreset = lastPlayedStationInfo->getLastPlayedStation();
						if (lastPreset)
                        {
                            iPlayController->connectToChannel( lastPreset, lastPlayedStationInfo->connectedFrom() );
                        }
                    }                    
                }
            }
            else if( EIR_UseNetwork_PlayStation == getUseNetworkReason() )
            {
                iPlayController->resume();
            }
            break;
        }
    default:
        break;
    }
    
    setUseNetworkReason(EIR_UseNetwork_NoReason);
}
예제 #15
0
void XmdvToolMainWnd::updateMenuToolbarDock() {
	ViewManager* vm = getViewManager();
	ViewWindow* win = vm->getActiveViewWindow();

	// If an active view window exist, we do update menu and tool bar
	if (win!=0) {
		// get the visualization type for the current view
		XmdvTool::VISTYPE visType =  win->getVisType();
		int pID = win->getPipelineID();
		updateMenuToolbar(pID, visType);
	}else{
		// if no active view window exist, disable some of the menu and tool bar buttons
		disableMenuToolbar();
	}

	m_handleView->updateDockWidgets();
}
/*
 * Description : data is received from isds client. Load the data to the list widget and display
 *               the category view
 * 
 */
void IRCategoryView::dataChanged()
{
    disconnectIsdsClient();
    iApplication->stopLoadingAnimation();

    iListView->reset();
    iListView->setCurrentIndex(iModel->index(iLastSelectItem));
    iListView->scrollTo(iModel->index(iLastSelectItem));
    qreal value = 0.0;
    if (iListView->model()->rowCount() > 0)
    {
        value = iLastSelectItem / iListView->model()->rowCount();
    }
    iListView->verticalScrollBar()->setValue(value);
    
    getViewManager()->activateView(this);
}
/*
 * Description : virtual functions from base class IRBaseView. 
 *               handle view commands
 * 
 * see also    : IRBaseView::handleCommand
 */
TIRHandleResult IRCategoryView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason)
{    
    Q_UNUSED(aReason);
    TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason);
    
    switch (aCommand)
    {
        case EIR_ViewCommand_TOBEACTIVATED:
        {
            if (EIRViewPara_Genre == iViewParameter)
            {
                if (ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION != iLoadedSection)
                {
                    iLoader.load(ABSTRACT_LIST_VIEW_BASE_LAYOUT_FILENAME, ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION);
                    iLoadedSection = ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION;
                }
            }
            else
            {
                if (ABSTRACT_LIST_VIEW_BASE_NO_TOOLBAR_SECTION != iLoadedSection)
                {
                    iLoader.load(ABSTRACT_LIST_VIEW_BASE_LAYOUT_FILENAME, ABSTRACT_LIST_VIEW_BASE_NO_TOOLBAR_SECTION);
                    iLoadedSection = ABSTRACT_LIST_VIEW_BASE_NO_TOOLBAR_SECTION;
                    setToolBar(NULL);
                }
            }
        }
        break;

        case EIR_ViewCommand_ACTIVATED:
            if (EIRViewPara_Genre == getViewParameter())
            {
                getViewManager()->saveScreenShot();
            }
            break;
            
        default:
            break;
    }
    
    return ret;
}
/*
 * Description: initializing.
 */
void IRNowPlayingView::initialize()
{
    LOG_METHOD;
    setObjectName(NOW_PLAYING_VIEW_OBJECT_NAME);
    QObjectList roots;
    roots.append(this);
    iLoader.setObjectTree(roots);

    // Load XML file
    iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME);
    
    initMenu();
    initToolBar();
    initWidget();    
#ifdef SUBTITLE_STR_BY_LOCID
    setTitle(hbTrId("txt_irad_title_internet_radio"));
#else
    setTitle("Internet radio");      
#endif
    handleOrientationChanged(getViewManager()->orientation());
}
/*
 * Description : update the station information.
 */
void IRStationDetailsView::setDetails(const IRQPreset * aPreset)
{
    iStationName->setPlainText(aPreset->nickName);
    iGenres->setPlainText(aPreset->genreName);
    iLanguage->setPlainText(aPreset->languageName);
    iCountry->setPlainText(aPreset->countryName);

    unsigned int bitrate = 0;
    aPreset->getChannelBitrate(KChannelBitrateIndex, bitrate);
    iBitRate->setPlainText(QString::number(bitrate) + QString("kbps"));

    iDescription->setPlainText(aPreset->description);

    QList<QString> *urlList = aPreset->getURLsForBitrate(bitrate);
    if (urlList != NULL)
    {
        iNowPlayingUrl->setPlainText(urlList->at(KChannelURLIndex));
    }
    delete urlList;
    handleOrientationChanged(getViewManager()->orientation());
}
void IRNowPlayingView::handleSettingAction()
{
    LOG_METHOD_ENTER;
    getViewManager()->activateView(EIRView_SettingsView);
}
/********************************************************************************************************
 * SLOTs for Logo Download
 *******************************************************************************************************
 */
void IRNowPlayingView::handleLogoDownloaded(IRQPreset* aPreset)
{
    LOG_METHOD;
    if( EIdle == iLogoDownloadState )
    {        
        return;
    } 
            
    if( NULL == aPreset )
    {        
        if( EDownloadLogo == iLogoDownloadState )
        {         
            iLogoNeedUpdate = false;  
#ifdef ADV_ENABLED
            QTimer::singleShot(1, this, SLOT(updateAdvImage()));
#endif            
        }
#ifdef ADV_ENABLED      
        else if( EDownLoadAdvImage == iLogoDownloadState )
        {
            iAdvImageNeedUpdate = false;            
        }
#endif
        iLogoDownloadState = EIdle;      
        return;
    }
    
 
    
    QPixmap logoPixmap;
    if( logoPixmap.loadFromData((const unsigned char*)aPreset->logoData.constData(), aPreset->logoData.size()) )
    {
        if( EDownloadLogo == iLogoDownloadState )
        {		
            saveStationLogo(logoPixmap);
            QPixmap newLogoPixmap = 
                 logoPixmap.scaled(QSize(KNowPlayingLogoSize,KNowPlayingLogoSize),Qt::KeepAspectRatio);
            QIcon logoQIcon(newLogoPixmap);
            HbIcon logoHbIcon(logoQIcon);
            iStationLogo->setIcon(logoHbIcon);
            iPlayController->emitStationLogoUpdated(true);
            iLogoNeedUpdate = false;          
            getViewManager()->saveScreenShot();
#ifdef ADV_ENABLED
            QTimer::singleShot(1, this, SLOT(updateAdvImage()));
#endif
        }
#ifdef ADV_ENABLED      
        else if( EDownLoadAdvImage == iLogoDownloadState )
        {
            QIcon logoQIcon(logoPixmap);
            HbIcon logoHbIcon(logoQIcon);            
            iAdvImage->setIcon(logoHbIcon); 
            iAdvUrl = iPlayController->getNowPlayingPreset()->advertisementUrl;  
            iAdvImageNeedUpdate = false;            
        }
#endif
    }
    else
    {
        if( EDownloadLogo == iLogoDownloadState )
        {         
            iLogoNeedUpdate = false;  
#ifdef ADV_ENABLED
            QTimer::singleShot(1, this, SLOT(updateAdvImage()));
#endif            
        }
#ifdef ADV_ENABLED      
        else if( EDownLoadAdvImage == iLogoDownloadState )
        {
            iAdvImageNeedUpdate = false;            
        }
#endif        
    }

    iLogoDownloadState = EIdle;      
    
    delete aPreset;
    aPreset = NULL;
}
/********************************************************************************************************
 * SLOT for Menu Action
 *******************************************************************************************************
 */
void IRNowPlayingView::handleGoToStationAction()
{
    LOG_METHOD;
    getViewManager()->activateView(EIRView_OpenWebAddressView);
}
/*
 * Description : slot function for active network event
 * Parameters  : aEvent, see the definition of IRQNetworkEvent
 */
void IRCategoryView::networkRequestNotified(IRQNetworkEvent aEvent)
{
    Q_ASSERT(iViewParameter != EIRViewPara_InvalidId);
    
    if (getViewManager()->currentView() != this)
    {
        return;
    }
    
    switch (aEvent)
    {
    case EIRQNetworkConnectionEstablished:
        if (EIR_UseNetwork_StartingView == getUseNetworkReason())
        {
            IRQIsdsClient::IRQIsdsClientInterfaceIDs request = IRQIsdsClient::EGenre;
        
            switch (iViewParameter)
            {
            case EIRViewPara_Genre:
                request = IRQIsdsClient::EGenre;
                break;

            case EIRViewPara_Language:
                request = IRQIsdsClient::ELanguages;
                break;

            case EIRViewPara_Country:
                request = IRQIsdsClient::ECountries;
                break;

            default:
                break;
            }

            connectToIsdsClient();
            bool cache = false;
            iIsdsClient->isdsCategoryRequest(request, cache);
            iApplication->startLoadingAnimation(this, SLOT(cancelRequest()));
        }
        //for there may be some cache, and when we click, we need to handle here        
        else if ( EIR_UseNetwork_SelectItem == getUseNetworkReason())
        {
            handleItemSelected();               
        }        
        
        break;
       
    case EIRQConnectingCancelled:
    case EIRQDisplayNetworkMessageNoConnectivity:
        if (iListView->model()->rowCount() == 0)
        {
            getViewManager()->activateView(EIRView_MainView);
        }
        else
        {
            setCheckedAction();
        }
        
        break;
        
    default:
        setCheckedAction();
        break;
    }
    
    setUseNetworkReason(EIR_UseNetwork_NoReason);
}