void TestApp::changeCurrentScene(const std::string& sceneId_) { //try { std::string sceneId = sceneId_; if (sceneId == "default") { sceneId = SceneHandler::getDefaultSceneId(); } SceneBase* scene = SceneHandler::getSceneHandler()->createScene(sceneId, mOgreRoot); if (scene == 0) { //error() << dc_funcinfo << "could not create scene " << sceneId; if (mScene) { // continue using current scene return; } else { if (sceneId == SceneHandler::getDefaultSceneId()) { // use a fallback scene sceneId = "general"; } //warning() << dc_funcinfo << "trying fallback scene " << sceneId; scene = SceneHandler::getSceneHandler()->createScene(sceneId, mOgreRoot); if (!scene) { //throw Exception("Could create neither default scene nor fallback scene"); } } } if (!scene->initScene()) { //std::cerr << "Could not initialize the scene " << sceneId << std::endl; SceneHandler::getSceneHandler()->deleteScene(scene); return; } else { // force an initial update of Ogre scenenodes here //scene->updateOgreRepresentations(true); } if (scene) { setCurrentScene(scene); } else { //std::cerr << dc_funcinfo << "NULL scene created: don't know scene ID " << sceneId_ << std::endl; } //} catch (Exception e) { // std::cerr << "Unhandled exception reached main-program: \n" // << e.getErrorMessage() <<std::endl; // e.printBacktrace(); // exit(1); //} }
/******************************************************************************* 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(); }