MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { populateScene(); h1Splitter = new QSplitter; h2Splitter = new QSplitter; QSplitter *vSplitter = new QSplitter; vSplitter->setOrientation(Qt::Vertical); vSplitter->addWidget(h1Splitter); vSplitter->addWidget(h2Splitter); View *view = new View("Top left view"); view->view()->setScene(scene); h1Splitter->addWidget(view); view = new View("Top right view"); view->view()->setScene(scene); h1Splitter->addWidget(view); view = new View("Bottom left view"); view->view()->setScene(scene); h2Splitter->addWidget(view); view = new View("Bottom right view"); view->view()->setScene(scene); h2Splitter->addWidget(view); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(vSplitter); setLayout(layout); setWindowTitle(tr("Chip Demo")); }
/// /// main function TODO_DOCS_ /// @author matthew: TODO_AUTHOR_FULL_NAME_ /// /// @param argc number of command line arguments, including program name /// @param argv supplied command line arguments, including program name /// @returns errorCode the error Code; 0 if no error /// int main( int argc, char* argv[] ) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(1000, 500); glutCreateWindow(argv[0]); glEnable(GL_LIGHTING); // load textures TextureLoader::loadTextures(); // create scene LitScene theScene; sv = new StereoSceneViewport(theScene); sv->initProjection(60, 1, 40); sv->cam.updateScreenCenter(); resetCamera(); hud = new Hud(sv->cam); populateScene(theScene); // Final setup, including callbacks glClearColor(0,0,0,0); glutDisplayFunc(gldisplay); glutKeyboardFunc(glkeyboard); glutPassiveMotionFunc(glpassivemouse); glutMouseFunc(glmouse); glutTimerFunc(20, gltimer, 0); glutReshapeFunc(glreshape); glutMainLoop(); }
void initEvent() { vl::Log::notify(appletInfo()); if(!vl::Has_Occlusion_Query) { vl::Log::error("No support to hardware occlusion culling found!\n"); vl::Time::sleep(2000); exit(1); } // ####################################################################### // # These 4 lines are the only code needed to enable occlusion culling, # // # no special sorter or render rank/block setup needed! # // ####################################################################### // wraps the regular renderer inside the occlusion renderer vl::Renderer* regular_renderer = rendering()->as<vl::Rendering>()->renderer(); // creates our occlusion renderer mOcclusionRenderer = new vl::OcclusionCullRenderer; mOcclusionRenderer->setWrappedRenderer( regular_renderer ); // installs the occlusion renderer in place of the regular one rendering()->as<vl::Rendering>()->setRenderer( mOcclusionRenderer.get() ); // note: to disable occlusion culling just restore the 'regular_renderer' as we do below in 'keyPressEvent()' populateScene(); }
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { populateScene(); View *view = new View("Top left view"); view->view()->setScene(scene); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(view); setLayout(layout); setWindowTitle(tr("Chip Demo")); }
ChipTester::ChipTester(QWidget *parent) : QGraphicsView(parent), npaints(0) { resize(400, 300); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setFrameStyle(0); setTransformationAnchor(NoAnchor); populateScene(); setScene(scene); setWindowTitle(tr("Chip Demo")); }
/******************************************************************************* initScene *******************************************************************************/ void SettingsScene::initScene() { // create pages m_pages[SETTINGS::GENERAL] = new PageGeneral(parentView()); m_pages[SETTINGS::PLAYER] = new PagePlayer(parentView()); m_pages[SETTINGS::LIBRARY] = new PageLibrary(parentView()); m_pages[SETTINGS::SHORTCUT] = new PageShortcut(parentView()); m_pages[SETTINGS::SCROBBLER] = new PageScrobbler(parentView()); m_pages[SETTINGS::SONGINFO] = new PageSongInfo(parentView()); /* first init => always restore settings */ restore_settings(); /* layout */ m_layout = new QGraphicsLinearLayout(Qt::Vertical); m_layout->setSpacing(10); m_layout->addItem( m_pages.value(SETTINGS::GENERAL) ); m_layout->addItem( m_pages.value(SETTINGS::PLAYER) ); m_layout->addItem( m_pages.value(SETTINGS::LIBRARY) ); m_layout->addItem( m_pages.value(SETTINGS::SHORTCUT) ); m_layout->addItem( m_pages.value(SETTINGS::SONGINFO) ); m_layout->addItem( m_pages.value(SETTINGS::SCROBBLER) ); m_container = new QGraphicsWidget(); m_container->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); m_container->setLayout(m_layout); m_container->setPos(0,0); this->addItem(m_container); /* il faut interdire la modification des parametres de collection si un database builder est en cours */ connect(ThreadManager::instance(), SIGNAL(dbBuildStart()), this, SLOT(slot_dbBuilder_stateChange())); connect(ThreadManager::instance(), SIGNAL(dbBuildFinished()), this, SLOT(slot_dbBuilder_stateChange())); connect(Database::instance(), SIGNAL(settingsChanged()), this, SLOT(slot_database_settingsChanged())); connect(MainLeftWidget::instance(), SIGNAL(dbNameChanged()), this, SLOT(slot_database_settingsChanged())); connect(MainLeftWidget::instance(), SIGNAL(settings_save_clicked()), this, SLOT(slot_apply_settings())); connect(MainLeftWidget::instance(), SIGNAL(settings_cancel_clicked()), this, SLOT(slot_cancel_settings())); connect(m_pages[SETTINGS::GENERAL], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::PLAYER], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::LIBRARY], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SHORTCUT], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SCROBBLER], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SONGINFO], SIGNAL(layout_changed()), this, SLOT(populateScene())); setInit(true); }
/******************************************************************************* initScene *******************************************************************************/ void SettingsScene::initScene() { // create pages m_pages[SETTINGS::GENERAL] = new PageGeneral(parentView()); m_pages[SETTINGS::PLAYER] = new PagePlayer(parentView()); m_pages[SETTINGS::LIBRARY] = new PageLibrary(parentView()); m_pages[SETTINGS::SHORTCUT] = new PageShortcut(parentView()); m_pages[SETTINGS::SCROBBLER] = new PageScrobbler(parentView()); m_pages[SETTINGS::SONGINFO] = new PageSongInfo(parentView()); connect(m_pages[SETTINGS::GENERAL], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::PLAYER], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::LIBRARY], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SHORTCUT], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SCROBBLER], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SONGINFO], SIGNAL(layout_changed()), this, SLOT(populateScene())); m_header = new HeaderItem(qobject_cast<QGraphicsView*> (parentView())->viewport()); m_header->setText( tr("Settings") ); /* bottom widget */ m_bottomWidget = new BottomWidget(); connect(m_bottomWidget, SIGNAL(save_clicked()), this, SLOT(slot_apply_settings())); connect(m_bottomWidget, SIGNAL(cancel_clicked()), this, SLOT(slot_cancel_settings())); this->addItem(m_header); this->addItem(m_pages.value(SETTINGS::GENERAL)); this->addItem(m_pages.value(SETTINGS::PLAYER)); this->addItem(m_pages.value(SETTINGS::LIBRARY)); this->addItem(m_pages.value(SETTINGS::SHORTCUT)); this->addItem(m_pages.value(SETTINGS::SCROBBLER)); this->addItem(m_pages.value(SETTINGS::SONGINFO)); /* first init => always restore settings */ restore_settings(); /* il faut interdire la modification des parametres de collection si un database builder est en cours */ connect(ThreadManager::instance(), SIGNAL(dbBuildStart()), this, SLOT(slot_dbBuilder_stateChange())); connect(ThreadManager::instance(), SIGNAL(dbBuildFinished()), this, SLOT(slot_dbBuilder_stateChange())); setInit(true); }
MainScene::MainScene(QObject *parent):QGraphicsScene(parent) { //same as QGraphicsScene(parent), NO, you can not use QObject(parent); populateScene(); }
/******************************************************************************* resizeScene *******************************************************************************/ void SettingsScene::resizeScene() { populateScene(); }
void SettingsScene::slot_database_settingsChanged() { static_cast<PageLibrary*>(m_pages[SETTINGS::LIBRARY])->restoreSettings(); populateScene(); }