Ejemplo n.º 1
0
/*******************************************************************************
    eventFilter
*******************************************************************************/
bool BrowserView::eventFilter(QObject *obj, QEvent *ev)
{
    if(!is_started) return false;

    //Debug::debug() << "BrowserView eventFilter  obj" << obj;
    int type = ev->type();
    QWidget *wid = qobject_cast<QWidget*>(obj);

    if (obj == this)
    {
        return false;
    }

    if (wid && (wid == m_scrollbar ))
    {
      if(type == QEvent::Hide || type == QEvent::Show) 
      {
        SceneBase * scene = m_scenes.value( VIEW::Id(SETTINGS()->_viewMode) );
        if( scene->isInit() )
          scene->resizeScene();
      }
    }

    return QWidget::eventFilter(obj, ev);
}
Ejemplo n.º 2
0
/*******************************************************************************
    resizeEvent
*******************************************************************************/
void BrowserView::resizeEvent( QResizeEvent * event)
{
    Debug::debug() << "  [BrowserView] resizeEvent";
    if(!is_started) return;
    
    SceneBase * scene = m_scenes.value( VIEW::Id(SETTINGS()->_viewMode) );
    if( scene->isInit() )
      scene->resizeScene();
     
     event->accept();
}
Ejemplo n.º 3
0
/*******************************************************************************
    switch_view
*******************************************************************************/
void BrowserView::switch_view(BrowserParam& param)
{
    Debug::debug() << "  [BrowserView] switch_view param.mode " << param.mode;
    //Debug::debug() << "  [BrowserView] switch_view param.filter" << param.filter;
    //Debug::debug() << "  [BrowserView] switch_view param.data" << param.data;

    /* save current state */
    SETTINGS()->_viewMode = param.mode;

    CentralToolBar::instance()->showHideGoUp(param.mode);
    
    /* handle scene switch view */
    SceneBase * scene = m_scenes[ param.mode ];

    if( !scene->isInit() )
      scene->initScene();
          
    scene->setMode( param.mode );
    scene->setFilter( param.filter );
    scene->setData( param.data );
    scene->populateScene();
    this->setFocus();
    
    show_bottom_panel( m_scenes[param.mode]->bottomWidget() );

    CentralToolBar::instance()->setExplorerFilterText(param.filter);
    

    switch( VIEW::typeForView(VIEW::Id(param.mode)) ) {
      case VIEW::LOCAL      : setScene(static_cast<LocalScene*>(m_scenes[param.mode]));    break;
      case VIEW::RADIO      : setScene(static_cast<StreamScene*>(m_scenes[param.mode]));   break;
      case VIEW::CONTEXT    : setScene(static_cast<ContextScene*>(m_scenes[param.mode]));  break;
      case VIEW::SETTING    : setScene(static_cast<SettingsScene*>(m_scenes[param.mode])); break;
      case VIEW::FILESYSTEM : setScene(static_cast<FileScene*>(m_scenes[param.mode]));     break;
      case VIEW::ABOUT      : setScene(static_cast<AboutScene*>(m_scenes[param.mode]));    break;
    }

    /* restore scroll position */
    m_scrollbar->setSliderPosition(param.scroll);

    /* status widget update */
    do_statuswidget_update();    
}