void AbstractNavigation::timerEvent(QTimerEvent * event) { // send viewChanged signal only after the n seconds of inactivity // (see AbstractNavigation::onCameraChanged) if(event->timerId() == m_eventTimer.timerId()) { m_eventTimer.stop(); onViewChanged(); } if (m_animation_active) { m_animation_progress += TIMER_MS / DURATION; if (m_animation_progress < 1.f) { updateTransition(); } else { finishTransition(); } } else { onTimerEvent(); // handled by super class } }
// Slot. void TransitionEditorWindow::createPoint(unsigned int pointType, float time, float value) { if (model_ == nullptr) return; if (transition_ == nullptr) return; if (pointType < 2 || pointType > 4) { qCritical("Invalid point type: %u", pointType); return; } TransitionPoint newPoint; newPoint.type = static_cast<TRMControlModel::Transition::Point::Type>(pointType); newPoint.value = value; newPoint.freeTime = time; QTableWidget* table = ui_->pointsTable; if (table->rowCount() == 0) { pointList_.push_back(std::move(newPoint)); } else { // Insert point at the end of the group. auto iter = pointList_.begin(); auto end = pointList_.end(); while (iter != end && static_cast<unsigned int>(iter->type) <= pointType) { ++iter; } pointList_.insert(iter, std::move(newPoint)); } updateTransition(); ui_->pointsTable->setCurrentItem(nullptr); ui_->equationsTree->setCurrentItem(nullptr); }
void TransitionEditorWindow::on_equationsTree_itemClicked(QTreeWidgetItem* item, int /*column*/) { qDebug("on_equationsTree_itemClicked"); if (model_ == nullptr) return; if (transition_ == nullptr) return; if (item == nullptr) return; QTreeWidgetItem* parent = item->parent(); if (parent == nullptr) { // root item ui_->formulaTextEdit->clear(); return; } int parentIndex = ui_->equationsTree->indexOfTopLevelItem(parent); int index = parent->indexOfChild(item); const auto& equation = model_->equationGroupList()[parentIndex].equationList[index]; // Set timeExpression for the current point. QTableWidgetItem* currentItem = ui_->pointsTable->currentItem(); if (currentItem == nullptr) return; int row = currentItem->row(); if (pointList_[row].timeExpression.lock() != equation) { pointList_[row].timeExpression = equation; updateTransition(); } }
void TransitionEditorWindow::on_updateParametersButton_clicked() { if (model_ == nullptr) return; if (transition_ == nullptr) return; updateTransition(); }
void Screen::update(long long gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { m_bOtherScreenHasFocus = otherScreenHasFocus; if (m_bIsExiting) { // If the screen is going away to die, it should transition off. m_eScreenState = Screen::TRANSITION_OFF; if (!updateTransition(gameTime, m_llTransitionOffTime, 1)) { // When the transition finishes, remove the screen. //ScreenManager.RemoveScreen(this); m_bIsExiting = false; } } else if (coveredByOtherScreen) { // If the screen is covered by another, it should transition off. if (updateTransition(gameTime, m_llTransitionOffTime, 1)) { // Still busy transitioning. m_eScreenState = Screen::TRANSITION_OFF; } else { // Transition finished! m_eScreenState = Screen::HIDDEN; } } else { // Otherwise the screen should transition on and become active. if (updateTransition(gameTime, m_llTransitionOffTime, -1)) { // Still busy transitioning. m_eScreenState = Screen::TRANSITION_ON; } else { // Transition finished! m_eScreenState = Screen::ACTIVE; } } }
void TransitionEditorWindow::on_transitionTypeComboBox_currentIndexChanged(int index) { qDebug("on_transitionTypeComboBox_currentIndexChanged index=%d", index); if (model_ == nullptr) return; if (transition_ == nullptr) return; if (index >= 0) { transitionType_ = static_cast<TRMControlModel::Transition::Type>(ui_->transitionTypeComboBox->itemData(index).toInt()); fillDefaultParameters(); updateTransition(); } }
void TransitionEditorWindow::on_pointsTable_itemChanged(QTableWidgetItem* item) { qDebug("on_pointsTable_itemChanged"); if (model_ == nullptr) return; if (transition_ == nullptr) return; int row = item->row(); int col = item->column(); bool updateWidgets = false; switch (col) { case 1: // Value pointList_[row].value = item->data(Qt::DisplayRole).toFloat(); updateWidgets = true; break; case 2: // Is phantom? pointList_[row].isPhantom = (item->checkState() == Qt::Checked); break; case 3: // Has slope? if (special_) return; pointList_[row].hasSlope = (item->checkState() == Qt::Checked); updateWidgets = true; break; case 4: // Slope if (special_) return; pointList_[row].slope = item->data(Qt::DisplayRole).toFloat(); updateWidgets = true; break; default: return; } if (updateWidgets) { updateTransition(); } }
//-------------------------------------------------------------- void GrafPlayerApp::update(){ dt = ofGetElapsedTimef()-lastTime; lastTime = ofGetElapsedTimef(); bool bTrans = false; if( mode == PLAY_MODE_LOAD ) { loadTags(); if(bUseAudio)audio.update(); } else if( mode == PLAY_MODE_PLAY && tags.size() > 0 ) { //---- set drawing data for render if( drawer.bSetupDrawer ) drawer.setup( &tags[currentTagID], tags[currentTagID].distMax ); //---- update tag playing state if( !myTagPlayer.bDonePlaying ) { myTagPlayer.update(&tags[currentTagID]); // normal play, update tag }else if( !myTagPlayer.bPaused && myTagPlayer.bDonePlaying && waitTimer > 0) { waitTimer -= dt; // pause time after drawn, before fades out } else if ( !myTagPlayer.bPaused && myTagPlayer.bDonePlaying && (drawer.alpha > 0 || particleDrawer.alpha > 0)) { updateTransition(0); bTrans = true; } else if ( !myTagPlayer.bPaused && myTagPlayer.bDonePlaying ) { resetPlayer(1); // setup for next tag } //---------- AUDIO applied if( bUseAudio) updateAudio(); //--------- ARCHITECTURE if( bUseArchitecture ) updateArchitecture(); //--------- PARTICLES updateParticles(); //--------- TAG ROTATION + POSITION if(bRotating && !myTagPlayer.bPaused ) rotationY += panel.getValueF("ROT_SPEED")*dt; // update pos / vel tags[currentTagID].position.x += tagPosVel.x; tags[currentTagID].position.y += tagPosVel.y; tagPosVel.x -= .1*tagPosVel.x; tagPosVel.y -= .1*tagPosVel.y; if(!bTrans) { tags[currentTagID].rotation_o = tags[currentTagID].rotation; tags[currentTagID].position_o = tags[currentTagID].position; } } // controls if( bShowPanel ) updateControlPanel(); }
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) , config_() , model_() , synthesis_(new Synthesis) , ui_(new Ui::MainWindow) , dataEntryWindow_(new DataEntryWindow) , intonationWindow_(new IntonationWindow) , intonationParametersWindow_(new IntonationParametersWindow) , postureEditorWindow_(new PostureEditorWindow) , prototypeManagerWindow_(new PrototypeManagerWindow) , specialTransitionEditorWindow_(new TransitionEditorWindow) , ruleManagerWindow_(new RuleManagerWindow) , ruleTesterWindow_(new RuleTesterWindow) , synthesisWindow_(new SynthesisWindow) , transitionEditorWindow_(new TransitionEditorWindow) { ui_->setupUi(this); ui_->logTextEdit->setMaximumBlockCount(MAX_LOG_BLOCK_COUNT); specialTransitionEditorWindow_->setSpecial(); connect(ui_->quitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); connect(ui_->aboutAction, SIGNAL(triggered()), this, SLOT(about())); coutStreamBuffer_.reset(new LogStreamBuffer(std::cout, false, ui_->logTextEdit)); cerrStreamBuffer_.reset(new LogStreamBuffer(std::cerr, true, ui_->logTextEdit)); LogStreamBuffer::registerQDebugMessageHandler(); connect(prototypeManagerWindow_.get(), SIGNAL(editTransitionButtonClicked(unsigned int, unsigned int)), transitionEditorWindow_.get(), SLOT(handleEditTransitionButtonClicked(unsigned int, unsigned int))); connect(prototypeManagerWindow_.get(), SIGNAL(editSpecialTransitionButtonClicked(unsigned int, unsigned int)), specialTransitionEditorWindow_.get(), SLOT(handleEditTransitionButtonClicked(unsigned int, unsigned int))); connect(dataEntryWindow_.get(), SIGNAL(categoryChanged()) , postureEditorWindow_.get(), SLOT(unselectPosture())); connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), postureEditorWindow_.get(), SLOT(unselectPosture())); connect(dataEntryWindow_.get(), SIGNAL(symbolChanged()) , postureEditorWindow_.get(), SLOT(unselectPosture())); connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), ruleManagerWindow_.get(), SLOT(loadRuleData())); connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), synthesisWindow_.get(), SLOT(setupParameterTable())); connect(postureEditorWindow_.get(), SIGNAL(postureChanged()), ruleManagerWindow_.get(), SLOT(unselectRule())); connect(postureEditorWindow_.get(), SIGNAL(postureCategoryChanged()), dataEntryWindow_.get(), SLOT(updateCategoriesTable())); connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), transitionEditorWindow_.get(), SLOT(updateEquationsTree())); connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), transitionEditorWindow_.get(), SLOT(updateTransition())); connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), specialTransitionEditorWindow_.get(), SLOT(updateEquationsTree())); connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), specialTransitionEditorWindow_.get(), SLOT(updateTransition())); connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), ruleManagerWindow_.get(), SLOT(setupRuleSymbolEquationsTable())); connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), ruleManagerWindow_.get(), SLOT(setupEquationsTree())); connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), transitionEditorWindow_.get(), SLOT(clear())); connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), ruleManagerWindow_.get(), SLOT(setupRuleTransitionsTable())); connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), ruleManagerWindow_.get(), SLOT(setupTransitionsTree())); connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), specialTransitionEditorWindow_.get(), SLOT(clear())); connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), ruleManagerWindow_.get(), SLOT(setupRuleSpecialTransitionsTable())); connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), ruleManagerWindow_.get(), SLOT(setupSpecialTransitionsTree())); connect(transitionEditorWindow_.get(), SIGNAL(equationReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupEquationsTree())); connect(transitionEditorWindow_.get(), SIGNAL(transitionChanged()), prototypeManagerWindow_.get(), SLOT(unselectTransition())); connect(specialTransitionEditorWindow_.get(), SIGNAL(equationReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupEquationsTree())); connect(specialTransitionEditorWindow_.get(), SIGNAL(transitionChanged()), prototypeManagerWindow_.get(), SLOT(unselectSpecialTransition())); connect(ruleManagerWindow_.get(), SIGNAL(categoryReferenceChanged()), dataEntryWindow_.get(), SLOT(updateCategoriesTable())); connect(ruleManagerWindow_.get(), SIGNAL(transitionReferenceChanged()) , prototypeManagerWindow_.get(), SLOT(setupTransitionsTree())); connect(ruleManagerWindow_.get(), SIGNAL(specialTransitionReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupSpecialTransitionsTree())); connect(ruleManagerWindow_.get(), SIGNAL(equationReferenceChanged()) , prototypeManagerWindow_.get(), SLOT(setupEquationsTree())); connect(synthesisWindow_.get(), SIGNAL(textSynthesized()), intonationWindow_.get(), SLOT(loadIntonationFromEventList())); connect(synthesisWindow_.get(), SIGNAL(audioStarted()), intonationWindow_.get(), SLOT(handleAudioStarted())); connect(synthesisWindow_.get(), SIGNAL(audioFinished()), intonationWindow_.get(), SLOT(handleAudioFinished())); connect(synthesisWindow_.get(), SIGNAL(synthesisFinished()), intonationWindow_.get(), SLOT(handleSynthesisFinished())); connect(intonationWindow_.get(), SIGNAL(synthesisRequested()), synthesisWindow_.get(), SLOT(synthesizeWithManualIntonation())); connect(intonationWindow_.get(), SIGNAL(synthesisToFileRequested(QString)), synthesisWindow_.get(), SLOT(synthesizeToFileWithManualIntonation(QString))); }
void StackGraph::logic(float t, float dt) { if(paused) return; if(activeNode==0) return; StackNode* clickedNode = mouseOverNode = 0; StackNode* nodeAtMouse = activeNode->mouseOverChildren(mousepos); if(nodeAtMouse != 0 && !nodeAtMouse->isLoading()) { mouseOverNode = nodeAtMouse; if(mouseclicked) clickedNode = nodeAtMouse; } if(clickedNode != 0) { selectNode(clickedNode); } else if(mouseclicked) { vec2f barclick = mousepos - corner; //select parent node if(section_bounds.contains(barclick)) { StackNode* parent = activeNode->getParent(); if(parent != 0) { setActiveNode(parent); resetView(); } } } if(in_transition>0.0) { updateTransition(dt); } else if(alpha < 1.0) { alpha = std::min(1.0f, alpha + dt); } if(last_update > gStackGraphFetchDelay) { last_update = 0.0; // activeNode->fetchBets(); } last_update += dt; //update the scale of the graph updateScale(dt); //update active node bets activeNode->updateBets(dt); //time char datestr[256]; long currtime = time(0); struct tm* timeinfo = localtime ( &currtime ); strftime(datestr, 256, "%d/%m/%Y %X", timeinfo); displaydate = datestr; mouseclicked = false; }