void MainWindow::actionFps(){ QAction *action = (QAction*)sender(); setFps(action->property("fps").toInt()); updateFps(); }
PixmapAnimator::PixmapAnimator( QWidget *parent, QList<QString> frames ) : BasicAnimator( parent ) { foreach( QString name, frames ) pixmaps.append( new QPixmap( name ) ); currentPixmap = pixmaps.at( 0 ); setFps( frames.count() ); /* default to 1 sec loop */ }
void VideoRate::setup(VideoSource & _source, float fps){ source = &_source; ofAddListener(source->newFrameEvent,this,&VideoRate::newVideoFrame); setFps(fps); front = _source.getNextVideoFrame(); //startThread(true,false); ofAddListener(ofEvents().update,this,&VideoRate::glThreadUpdate); }
Camera::Camera( int xSize, int ySize, float fps ) { setSize(xSize, ySize); setFps(fps); setPosition(Vector3d(0., 0., 0.)); setFocusPosition(0.); storeCamera(camStore); }
PixmapAnimator::PixmapAnimator( QWidget *parent, QList<QString> frames ) : QAbstractAnimation( parent ), current_frame( 0 ) { foreach( QString name, frames ) pixmaps.append( new QPixmap( name ) ); currentPixmap = pixmaps.at( 0 ); setFps( frames.count() ); /* default to 1 sec loop */ setLoopCount( -1 ); }
void configureFromRead( const VideoFFmpegReader& reader ) { setWidth ( reader.width() ); setHeight ( reader.height() ); setAspectRatio ( reader.aspectRatio() ); setFps ( reader.fps() ); setBitRate ( reader.bitRate() ); setFormat ( reader.formatName() ); setCodec ( reader.codecName() ); }
AnalyzerBase::AnalyzerBase(QWidget *parent) : QGLWidget(parent), m_fht(new FHT(log2(gConfig.FramesToRender))), m_fftData(m_fht->size()), m_renderTimer(new QTimer(this)) { setFps(60); // Default unless changed by subclass connect(m_renderTimer, &QTimer::timeout, this, &QGLWidget::updateGL); //initialize openGL context before managing GL calls makeCurrent(); connectSignals(); }
void MainWindow::loadSettings(){ setFullScreen(false); setHideMenu(false); QSettings settingsNative; resize(settingsNative.value("size", QSize(320, 480 + ui.menuBar->height())).toSize()); move(settingsNative.value("pos", QPoint(0, 0)).toPoint()); int red = settingsNative.value("backgroundRed", 240).toInt(); int green = settingsNative.value("backgroundGreen", 240).toInt(); int blue = settingsNative.value("backgroundBlue", 240).toInt(); QColor backgroundColor = QColor(red, green, blue); red = settingsNative.value("canvasRed", 255).toInt(); green = settingsNative.value("canvasGreen", 255).toInt(); blue = settingsNative.value("canvasBlue", 255).toInt(); QColor canvasColor = QColor(red, green, blue); red = settingsNative.value("infoRed", 0).toInt(); green = settingsNative.value("infoGreen", 0).toInt(); blue = settingsNative.value("infoBlue", 0).toInt(); QColor infoColor = QColor(red, green, blue); setBackgroundColor(backgroundColor); setCanvasColor(canvasColor); setInfoColor(infoColor); updateBackgroundColor(); updateCanvasColor(); updateInfoColor(); QSettings settings(Constants::SETTINGS_FOLDER + "/" + Constants::PLAYER_SETTINGS_FILE, QSettings::IniFormat); setWidth(settings.value("width", 320).toInt()); setHeight(settings.value("height", 480).toInt()); setScale(settings.value("scale", 100).toInt()); setFps(settings.value("fps", 60).toInt()); setOrientation(static_cast<Orientation>(settings.value("orientation", ePortrait).toInt())); setDrawInfos(settings.value("drawInfos", false).toBool()); setAutoScale(settings.value("autoScale", false).toBool()); setAlwaysOnTop(settings.value("alwaysOnTop", false).toBool()); checkLoadedSettings(); updateFps(); updateDrawInfos(); updateAlwaysOnTop(); updateAutoScale(); updateOrientation(); updateResolution(); }
JpegServer::JpegServer(QObject *parent) : QTcpServer(parent) , m_scene(0) , m_fps(10) , m_adaptiveWriteEnabled(true) , m_timeAccum(0) , m_frameCount(0) , m_onlyRenderOnSlideChange(false) , m_slideChanged(true) , m_sender(0) { connect(&m_timer, SIGNAL(timeout()), this, SLOT(generateNextFrame())); setFps(m_fps); }
void FpsSelector::indexChanged(int const index) { if (getCustomIndex(comboBox_) == index) { bool ok = false; double const fps = QInputDialog::getDouble(comboBox_, tr("Set Frame Rate"), tr("Frame rate (fps):"), double(value_.width()) / value_.height(), 30.0, 120.0, 4, &ok); setFps(comboBox_, ok ? QSize(int(fps * 10000 + 0.5), 10000) : value_); } }
DIA_encodingBase::DIA_encodingBase( uint32_t fps1000 ) { _lastnb=0; _totalSize=0; _audioSize=0; _videoSize=0; _current=0; setFps(fps1000); _originalPriority=getpriority(PRIO_PROCESS, 0); _lastTime=0; _lastFrame=0; _fps_average=0; _total=1000; }
void VideoFrameDesc::setParameters( const ProfileLoader::Profile& profile ) { // width if( profile.count( constants::avProfileWidth ) ) setWidth( atoi( profile.find( constants::avProfileWidth )->second.c_str() ) ); // height if( profile.count( constants::avProfileHeight ) ) setHeight( atoi( profile.find( constants::avProfileHeight )->second.c_str() ) ); // pixel format if( profile.count( constants::avProfilePixelFormat ) ) setPixelFormat( profile.find( constants::avProfilePixelFormat )->second ); // fps if( profile.count( constants::avProfileFrameRate ) ) setFps( atof( profile.find( constants::avProfileFrameRate )->second.c_str() ) ); }
//============================================================== // Чтение количества кадров в секунду из XML //============================================================== bool SettingAnimation::readFpsFromXml(QDomElement root) { const QDomElement elemFps = root.firstChildElement("Fps"); if (elemFps.isNull()) return false; const QString strFps = elemFps.text(); bool ok = false; const int fps = strFps.toInt(&ok); if (!ok || (fps <= 0) || (fps > 100)) return false; setFps(fps); return true; }
DIA_encoding::DIA_encoding( uint32_t fps1000 ) { uint32_t useTray=0; if(!prefs->get(FEATURE_USE_SYSTRAY,&useTray)) useTray=0; _lastnb=0; _totalSize=0; _audioSize=0; _videoSize=0; _current=0; setFps(fps1000); _lastTime=0; _lastFrame=0; _fps_average=0; tray=NULL; _total=1000; }
DIA_encoding::DIA_encoding( uint32_t fps1000 ) { uint32_t useTray=0; if(!prefs->get(FEATURE_USE_SYSTRAY,&useTray)) useTray=0; ADM_assert(dialog==NULL); stopReq=0; _totalSize=0; _audioSize=0; _videoSize=0; _current=0; setFps(fps1000); dialog=create_dialog1(); gtk_register_dialog(dialog); //gtk_transient(dialog); gtk_signal_connect(GTK_OBJECT(WID(closebutton1)), "clicked", GTK_SIGNAL_FUNC(DIA_stop), NULL); gtk_signal_connect(GTK_OBJECT(dialog), "delete_event", GTK_SIGNAL_FUNC(on_destroy_abort), NULL); gtk_widget_show(dialog); // gtk_window_set_modal(GTK_WINDOW(dialog), 1); if(useTray) { gtk_window_iconify(GTK_WINDOW(dialog)); UI_iconify(); } _lastTime=0; _lastFrame=0; _fps_average=0; tray=NULL; if(useTray) tray=new ADM_tray("Encoding"); }
void FpsSelector::reject() { setFps(comboBox_, value_); }
void DIA_encodingBase::refresh(void) { uint32_t time=clock.getElapsedMS(); if(time>_nextUpdate) { uint32_t deltaTime=time-_lastClock; uint32_t deltaFrame=_currentFrameCount-_lastFrameCount; uint64_t deltaDts=_currentDts-_lastDts; if(sampleIndex>ADM_ENCODING_SAMPLE) { uint32_t qSum=0; for(int i=0;i<ADM_ENCODING_SAMPLE;i++) qSum+=samples[i].qz; qSum/=ADM_ENCODING_SAMPLE; aprintf("Q:%d\n",qSum); setAverageQz(qSum); } if(sampleIndex>ADM_ENCODING_SAMPLE) { int start=sampleIndex%ADM_ENCODING_SAMPLE; int end=(sampleIndex+ADM_ENCODING_SAMPLE-1)%ADM_ENCODING_SAMPLE; uint64_t deltaTime=samples[end].sampleTime-samples[start].sampleTime; uint64_t deltaSize=samples[end].size-samples[start].size; aprintf("dTime:%d dSize:%d\n",deltaTime,deltaSize); if(deltaTime>1000) { float delta; delta=deltaSize; delta/=deltaTime; delta*=8; // byte -> bit delta*=1000; // b/us -> kb/s aprintf("br:%d\n",(int)delta); setAverageBitrateKbits((uint32_t)delta); } } if(deltaFrame) { float thisAverage; //printf("**********************************DFrame=%d, DTime=%d\n",(int)deltaFrame,(int)deltaTime); thisAverage=((float)deltaFrame); thisAverage/=deltaTime; thisAverage*=1000; _fps_average=_fps_average*0.5+0.5*thisAverage; //printf("************** Fps:%d\n",(int)_fps_average); setFps(_fps_average); float percent=(float)_currentDts/(float)_totalDurationUs; if(percent>1.0) percent=1.0; percent*=100; setPercent((uint32_t)percent); setFrameCount(_currentFrameCount); setElapsedTimeMs(time); } if(deltaDts ) { float dtsPerSec=deltaDts; dtsPerSec/=deltaTime; dtsPerSec/=1000.; // dts advance per second float leftDts=_totalDurationUs-_currentDts; //printf("***************%u to encoding\n",(int)(leftDts/1000000)); //printf("Advanc=%d ms/sec\n",(int)(dtsPerSec*1000)); if(dtsPerSec>0.01) { leftDts=leftDts/dtsPerSec; _remainingTimeUs=(_remainingTimeUs/2)+(leftDts/2); leftDts=_remainingTimeUs; leftDts/=1000.; // us -> ms //printf("***************%u s left\n",(int)(leftDts/1000)); setRemainingTimeMS((uint32_t)leftDts); } } _nextUpdate=time+GUI_UPDATE_RATE; setAudioSize(_audioSize); setVideoSize(_videoSize); setTotalSize(_audioSize+_videoSize); _lastFrameCount=_currentFrameCount; _lastDts=_currentDts; _lastClock=time; } UI_purge(); }
void PropertyTimelineWidget::setDuration(int duration) { duration_ = duration; setFps(fps_); }
void App::onInit() { setupWindow(GAME_WIDTH, GAME_HEIGHT, "SDL Engine Example Game", "../../assets/", 2); setFps(60); }
DIA_encoding::DIA_encoding( uint32_t fps1000 ) { uint32_t useTray=0; if(!prefs->get(FEATURE_USE_SYSTRAY,&useTray)) useTray=0; ADM_assert(dialog==NULL); stopReq=0; _lastnb=0; _totalSize=0; _audioSize=0; _videoSize=0; _current=0; setFps(fps1000); _originalPriority=getpriority(PRIO_PROCESS, 0); dialog=create_dialog1(); gtk_register_dialog(dialog); #ifndef __WIN32 // check for root privileges if (getuid() != 0) { // set priority to normal, regardless of preferences gtk_combo_box_set_active(GTK_COMBO_BOX(WID(combobox_priority)), 2); }else { gtk_widget_set_sensitive(WID(combobox_priority), 0); } gtk_signal_connect(GTK_OBJECT(WID(checkbutton_shutdown)), "toggled", GTK_SIGNAL_FUNC(shutdown_toggled), NULL); #endif gtk_signal_connect(GTK_OBJECT(WID(combobox_priority)), "changed", GTK_SIGNAL_FUNC(change_priority), NULL); gtk_signal_connect(GTK_OBJECT(WID(closebutton1)), "clicked", GTK_SIGNAL_FUNC(DIA_stop), NULL); gtk_signal_connect(GTK_OBJECT(dialog), "delete_event", GTK_SIGNAL_FUNC(on_destroy_abort), NULL); // set priority uint32_t priority; prefs->get(PRIORITY_ENCODING,&priority); #ifndef __WIN32 // check for root privileges if (getuid() == 0) { gtk_combo_box_set_active(GTK_COMBO_BOX(WID(combobox_priority)),priority); }else gtk_widget_set_sensitive(WID(combobox_priority), 0); #else gtk_combo_box_set_active(GTK_COMBO_BOX(WID(combobox_priority)),priority); #endif gtk_widget_show(dialog); if(useTray) { gtk_window_iconify(GTK_WINDOW(dialog)); UI_iconify(); } _lastTime=0; _lastFrame=0; _fps_average=0; tray=NULL; _total=1000; if(useTray) tray=new ADM_tray("Encoding"); }
void OverviewWidget::reset() { overviewView_->setCurrentFrame(0); setFps(30); scrollBarOrder(0); }
void Timeline::init() { setFps(25); _timer.timerFinished.connect(Timeline::incFrame).detach(); }
//============================================================== // Конструктор с параметрами //============================================================== SettingAnimation::SettingAnimation(int fps, int frameCount) { setFps(fps); setFrameCount(frameCount); }
uint8_t asfHeader::loadVideo(asfChunk *s) { uint32_t w,h,x; printf("--\n"); w=s->read32(); h=s->read32(); s->read8(); x=s->read16(); _isvideopresent=1; memset(&_mainaviheader,0,sizeof(_mainaviheader)); _mainaviheader.dwWidth=w; _mainaviheader.dwHeight=h; _video_bih.biWidth=w; _video_bih.biHeight=h; printf("Pic Width %04d\n",w); printf("Pic Height %04d\n",h); printf(" BMP size %04d (%04d)\n",x,(int)sizeof(ADM_BITMAPINFOHEADER)); s->read((uint8_t *)&_video_bih,sizeof(ADM_BITMAPINFOHEADER)); #ifdef ADM_BIG_ENDIAN Endian_BitMapInfo(&_video_bih); #endif _videostream.fccHandler=_video_bih.biCompression; printf("Codec : <%s> (%04x)\n", fourCC::tostring(_video_bih.biCompression),_video_bih.biCompression); if(fourCC::check(_video_bih.biCompression,(uint8_t *)"DVR ")) { // It is MS DVR, fail so that the mpeg2 indexer can take it from here _videostream.fccHandler=_video_bih.biCompression=fourCC::get((uint8_t *)"MPEG"); printf("This is MSDVR, not ASF\n"); return 0; } printBih(&_video_bih); #if 1 if(_video_bih.biSize>sizeof(ADM_BITMAPINFOHEADER)) { x=_video_bih.biSize; #else if(x>sizeof(ADM_BITMAPINFOHEADER)) { #endif _videoExtraLen=x-sizeof(ADM_BITMAPINFOHEADER); _videoExtraData=new uint8_t[_videoExtraLen]; s->read(_videoExtraData,_videoExtraLen); ADM_info("We have %d bytes of extra data for video.\n",(int)_videoExtraLen); }else { ADM_info("No extra data for video\n"); } uint64_t l=ftello(_fd); printf("Bytes left : %d\n",(int)(s->endPos()-l)); return 1; } /** \fn buildIndex \brief Scan the file to build an index Header Chunk Chunk Chunk Chunk Data chunk Chunk Chunk We skip the 1st one, and just read the header of the 2nd one */ uint8_t asfHeader::buildIndex(void) { uint32_t fSize; const chunky *id; uint32_t chunkFound; uint32_t r=5; uint32_t len; fseeko(_fd,0,SEEK_END); fSize=ftello(_fd); fseeko(_fd,0,SEEK_SET); asfChunk h(_fd); printf("[ASF] ********** Building index **********\n"); printf("[ASF] Searching data\n"); while(r--) { h.nextChunk(); // Skip headers id=h.chunkId(); h.dump(); if(id->id==ADM_CHUNK_DATA_CHUNK) break; h.skipChunk(); } if(id->id!=ADM_CHUNK_DATA_CHUNK) return 0; // Remove leftover from DATA_chunk // Unknown GUID 16 // Number of packets UINT64 8 // Unknown UINT8 1 // Unknown UINT8 1 // h.read32(); h.read32(); h.read32(); h.read32(); _nbPackets=(uint32_t) h.read64(); h.read16(); len=h.chunkLen-16-8-2-24; printf("[ASF] nbPacket : %u\n",_nbPackets); printf("[ASF] len to go : %u\n",len); printf("[ASF] scanning data\n"); _dataStartOffset=ftello(_fd); // Here we go asfPacket *aPacket=new asfPacket(_fd,_nbPackets,_packetSize, &readQueue,&storageQueue,_dataStartOffset); uint32_t packet=0; #define MAXIMAGE (_nbPackets) uint32_t sequence=0; uint32_t ceilImage=MAXIMAGE; nbImage=0; len=0; asfIndex indexEntry; memset(&indexEntry,0,sizeof(indexEntry)); bool first=true; DIA_workingBase *progressBar=createWorking("Indexing"); uint32_t fileSizeMB=(uint32_t)(fSize>>10); uint64_t lastDts[ASF_MAX_AUDIO_TRACK]; for(int i=0;i<ASF_MAX_AUDIO_TRACK;i++) { lastDts[i]=0; } while(packet<_nbPackets) { while(readQueue.size()) { asfBit *bit=NULL; // update UI uint32_t curPos=(uint32_t)(ftello(_fd)>>10); progressBar->update(curPos,fileSizeMB); bit=readQueue.front(); readQueue.pop_front(); // -- uint64_t dts=bit->dts; uint64_t pts=bit->pts; aprintf("** DTS=%s\n",ADM_us2plain(dts)); aprintf("** PDTS=%s\n",ADM_us2plain(pts)); if(bit->stream==_videoStreamId) { aprintf(">found video packet of size=%d off=%d seq %d, while curseq =%d, dts=%s", bit->len,bit->offset, bit->sequence,curSeq, ADM_us2plain(dts)); aprintf(" pts=%s\n",ADM_us2plain(pts)); if(bit->sequence!=sequence || first==true) { if(first==false) { indexEntry.frameLen=len; aprintf("Pushing video frame index=%d seq=%d pts=%s \n", _index.size(), indexEntry.segNb,ADM_us2plain(indexEntry.pts)); aprintf("dts=%s\n",ADM_us2plain(indexEntry.dts)); _index.append(indexEntry); } aprintf("New sequence\n"); if( ((sequence+1)&0xff)!=(bit->sequence&0xff)) { ADM_warning("!!!!!!!!!!!! non continuous sequence %u %u\n",sequence,bit->sequence); } indexEntry.frameLen=0; indexEntry.segNb=bit->sequence; indexEntry.packetNb=bit->packet; indexEntry.flags=bit->flags; indexEntry.dts=dts; indexEntry.pts=pts; if(first==false) { sequence=bit->sequence; readQueue.push_front(bit); // reuse it next time len=0; continue; }else { sequence=bit->sequence; first=false; // first packet } } len+=bit->len; } // End of video stream Id else // Audio ? { int found=0; for(int i=0;i<_nbAudioTrack && !found;i++) { if(bit->stream == _allAudioTracks[i].streamIndex) { if(bit->pts!=ADM_NO_PTS) { if(!lastDts[i] || (bit->pts>lastDts[i]+500000L)) // seek point every 500 ms { asfAudioSeekPoint seek; seek.pts=bit->pts; seek.packetNb=bit->packet; (audioSeekPoints[i]).append(seek); #if 1 if(!lastDts[i]) printf("Adding seek point for track %d at %s (packet=%d)\n", i,ADM_us2plain(bit->pts),(int)seek.packetNb); #endif lastDts[i]=bit->pts; aprintf("Adding seek point for track %d at %s (packet=%d)\n", i,ADM_us2plain(bit->pts),(int)seek.packetNb); } } found=1; } } if(!found) { printf("Unmapped stream %u\n",bit->stream); } } delete [] bit->data; bit->data=NULL; storageQueue.push_back(bit); } //working->update(packet,_nbPackets); packet++; aPacket->nextPacket(0xff); // All packets aPacket->skipPacket(); } delete progressBar; delete aPacket; //delete working; /* Compact index */ fseeko(_fd,_dataStartOffset,SEEK_SET); printf("[ASF] %u images found\n",nbImage); printf("[ASF] ******** End of buildindex *******\n"); nbImage=_index.size();; if(!nbImage) return 0; uint64_t shift=60*1000*1000; bool canShift=false; uint64_t tPts; tPts=_index[0].pts; ADM_info("First image pts: %s, dts: %s\n",ADM_us2plain(tPts), ADM_us2plain(_index[0].dts)); if(tPts != ADM_NO_PTS) { shift=tPts; ADM_info("Video shift = %s\n",ADM_us2plain(tPts)); canShift=true; }else canShift=false; for(int i=0;i<_nbAudioTrack;i++) { if(!audioSeekPoints[i].size()) { ADM_info("audio track : %d, no seek\n",i); canShift=false; continue; } tPts=audioSeekPoints[i][0].pts; ADM_info("audio track : %d, %s\n",i,ADM_us2plain(tPts)); if(tPts<shift) shift=tPts; } if(canShift) { ADM_info("Shifting a/v raw=%s\n",ADM_us2plain(shift)); }else { ADM_info("Can t shift\n"); shift=0; } _videostream.dwLength=_mainaviheader.dwTotalFrames=nbImage; _index[0].flags=AVI_KEY_FRAME; if(_index[0].pts==ADM_NO_PTS) _index[0].pts=_index[0].dts; // Update fps // In fact it is an average fps // _videostream.dwScale=1000; // check if we have a duration per frame for video... int n=frameDurationMapping.size(); int dex=-1; for(int i=0;i<n;i++) { if(frameDurationMapping[i].streamNb==_videoStreamId) dex=i; } if(dex!=-1) { ADM_info("Average fps provided\n"); setFps(frameDurationMapping[dex].usPerFrame); } else { ADM_info("Fps not provided, guessing it from nbFrame and duration\n"); uint32_t avgFps; if(_index[nbImage-1].pts!=ADM_NO_PTS && _index[0].pts!=ADM_NO_PTS) { float f=(_index[nbImage-1].pts-_index[0].pts); f/=nbImage; // average duration of 1 image in us setFps((uint64_t) f); }else { printf("[Asf] No pts, setting 30 fps hardcoded\n"); _videostream.dwRate=(uint32_t)30000;; } } if(shift) { double frames3=_videostream.dwScale; frames3/=_videostream.dwRate; frames3*=3*1000*1000; // ADM_info("3 frames time = %s\n",ADM_us2plain((uint64_t)frames3)); uint64_t frame64=(uint64_t)frames3; if(frame64<shift) shift=shift-frame64; else shift=0; shiftAudioVideoBy(shift); } return 1; }
// constructor, allocates the double ended queue and sets an initiaial reauirement // of 60 frames per second TSRFrameController::TSRFrameController() { setFps( 60 ); m_lDeltaTime = 0; }
BasicAnimator::BasicAnimator( QObject *parent ) : QAbstractAnimation( parent ), current_frame( 0 ) { setFps( 15 ); setLoopCount( -1 ); }
PropertyTimelineWidget::PropertyTimelineWidget(std::string name, PropertyTimeline* propertyTimeline, QWidget* parent) : QWidget(parent) , propertyTimeline_(propertyTimeline) , inInterpolationMenu_(0) , outInterpolationMenu_(0) { guiName_ = name; id_ = name; mainLayout_ = new QHBoxLayout(this); mainLayout_->setMargin(0); mainLayout_->setSpacing(0); currentFrameGraphicsItem_ = new CurrentFrameGraphicsItem(false, false); smoothItem_ = new QGraphicsEllipseItem(0, 0, 8, 8); smoothItem_->setBrush(QBrush(QColor(50,255,50))); smoothItem_->moveBy(10, -7); smoothItem_->setCursor(Qt::ArrowCursor); smoothTextItem_ = new QGraphicsSimpleTextItem("smoothness"); smoothTextItem_->moveBy(22, -10); smoothGroup_ = new QGraphicsItemGroup(); smoothGroup_->addToGroup(smoothItem_); smoothGroup_->addToGroup(smoothTextItem_); smoothGroup_->hide(); smoothGroup_->setZValue(5); propertyTimelineScene_ = new QGraphicsScene(this); propertyTimelineView_ = new PropertyTimelineView(propertyTimelineScene_); propertyTimelineView_->setStyleSheet("background:transparent"); propertyTimelineView_->setFixedHeight(40); connect(propertyTimelineView_, SIGNAL(mousePressedAt(QPointF, const QGraphicsItem*)), this, SLOT(interpolationSelectorPressed(QPointF, const QGraphicsItem*))); inInterpolationSelector_ = new QGraphicsPixmapItem(QPixmap(":/qt/icons/1leftarrow.png")); outInterpolationSelector_ = new QGraphicsPixmapItem(QPixmap(":/qt/icons/1rightarrow.png")); inInterpolationSelector_->setCursor(Qt::ArrowCursor); outInterpolationSelector_->setCursor(Qt::ArrowCursor); inInterpolationSelector_->setMatrix(QMatrix(0.5, 0, 0, 0.5, 1, 1), true); outInterpolationSelector_->setMatrix(QMatrix(0.5, 0, 0, 0.5, 1, 1), true); propertyTimelineScene_->addItem(smoothGroup_); propertyTimelineScene_->addItem(inInterpolationSelector_); propertyTimelineScene_->addItem(outInterpolationSelector_); currentFrameCounter_ = propertyTimelineScene_->addText("0"); inInterpolationSelector_->setPos(20, 20); outInterpolationSelector_->setPos(40, 20); inInterpolationSelector_->setZValue(2); outInterpolationSelector_->setZValue(2); activateTimelineButton_ = new QPushButton(QIcon(":/qt/icons/apply.png"), "", this); showFrameHUD(false); activateTimelineButton_->setToolTip(tr("Activate or deactivate timeline")); activateTimelineButton_->setStyleSheet("QToolButton { border: none; padding: 1px; }"); activateTimelineButton_->setFlat(true); activateTimelineButton_->setFocusPolicy(Qt::NoFocus); activateTimelineButton_->setCheckable(true); activateTimelineButton_->setMaximumWidth(16); activateTimelineButton_->setMaximumHeight(16); activateTimelineButton_->setChecked(propertyTimeline->getActiveOnRendering()); // note: this is duplicated in activateTimeline() below if (!propertyTimeline->getActiveOnRendering()) activateTimelineButton_->setIcon(QIcon(":/qt/icons/button_cancel.png")); else activateTimelineButton_->setIcon(QIcon(":/qt/icons/apply.png")); connect(activateTimelineButton_, SIGNAL(toggled(bool)), this, SLOT(activateTimeline(bool))); setFps(30.0f); mainLayout_->addWidget(propertyTimelineView_); mainLayout_->addWidget(activateTimelineButton_); QLabel* nameLabel = new QLabel(this); nameLabel->move(8, 18); nameLabel->lower(); nameLabel->setText(QString::fromStdString(name)); nameLabel->setMinimumWidth(300); nameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); nameLabel->setEnabled(false); setCurrentFrame(0); propertyTimelineScene_->addItem(currentFrameGraphicsItem_); inInterpolationSelector_->show(); outInterpolationSelector_->show(); showFrameHUD(false); currentFrameGraphicsItem_->setPos(0, 1); currentFrameGraphicsItem_->setZValue(0.5); fps_ = 30.0f; setDuration(AnimationEditor::getDuration()); }
void OverviewWidget::setDuration(int duration) { duration_ = duration; setFps(fps_); }