Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); this->playStatus = false; this->pauseStatus = true; ui->videoSlider->setRange(0, 100); ui->listWidget->setVisible(false); ui->addFileButton->setVisible(false); connect(ui->playButton, SIGNAL(clicked()), this, SLOT(playOrPause())); connect(ui->videoSlider,SIGNAL(sliderMoved(int)),this, SLOT(seek(int))); connect(ui->openButton, SIGNAL(toggled(bool)), this,SLOT(openVideo(bool))); connect(ui->stopButton, SIGNAL(clicked()),this,SLOT(stop())); connect(ui->kuaijinButton, SIGNAL(clicked()), this, SLOT(kuaijin())); connect(ui->kuaituiButton,SIGNAL(clicked()), this,SLOT(kuaitui())); connect(ui->addFileButton,SIGNAL(clicked()), this, SLOT(addFileList())); connect(ui->listWidget,SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectFile())); connect(ui->prevButton, SIGNAL(clicked()), this,SLOT(prevVideo())); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextVideo())); connect(ui->muteButton, SIGNAL(toggled(bool)), this, SLOT(MuteOrNot(bool))); connect(ui->soundAddButton, SIGNAL(clicked()), this, SLOT(soundAdd())); connect(ui->soundSubButton, SIGNAL(clicked()), this, SLOT(soundSub())); timer = new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(get_time_pos())); timer->start(1000); }
void SmackerScene::update() { if (_playNextVideoFlag) { nextVideo(); _playNextVideoFlag = false; } Scene::update(); }
//-------------------------------------------------------------- void testApp::keyPressed (int key){ if(key =='e'){ mode = "edit"; ofSetWindowShape(1280, 900); reSort(); } if( key == 'p' ){ //startRender(); mode = "play-back"; whichVideo = 0; totalFrames = 0; framecounter = 0; nextVideo(); ofSetWindowShape(1024, 576); img.setUseTexture(false); img.allocate(1024, 576, OF_IMAGE_COLOR); } if( key == 'P' ){ //startRender(); mode = "play"; whichVideo = 0; totalFrames = 0; framecounter = 0; nextVideo(); ofSetWindowShape(1024, 576); img.setUseTexture(false); img.allocate(1024, 576, OF_IMAGE_COLOR); } if( key == 'r' ){ mode = "edit"; cout << "random shuffle"<<endl; ofRandomize(thumbs); } if( key == 'l' ){ loadOrder(); } if( key == 'm' ){ mode = "move"; ofSetWindowShape(1280, 900); reSort(); } }
void Playlist::videoPlayed() { playedVideos << index(playRow, 0); if (!nextVideo()) { playRow = -1; emit dataChanged(firstIndex, lastIndex); } }
//-------------------------------------------------------------- void testApp::draw(){ ofBackgroundGradient(ofColor(0,0,0), ofColor(50, 50, 50), OF_GRADIENT_CIRCULAR); ofSetColor(255); if( mode == "edit" || mode == "move" ){ if( mode == "move" ){ ofSetColor(20, 90, 30); ofRect(0,0,3000,3000); ofSetColor(255); } for(int i = 0; i < thumbs.size(); i++){ thumbs[i].draw(); } if( mode == "move" && bDown ){ ofSetColor(255, 190, 50); ofRect(thumbs[placedIndex].r.x - 5, thumbs[placedIndex].r.y, 4, 80); } ofSetColor(255); }else if( mode == "full" ){ fullVid.draw(0,0); ofRect(thumbs[selected].pos * ofGetWidth(), ofGetHeight()-10, 4, 10); }else{ vid.setAnchorPercent(0.5, 0.5); vid.draw(ofGetWidth()/2, ofGetHeight()/2, ofGetWidth(), ofGetWidth() * ( vid.getHeight() / vid.getWidth() )); if( vid.isFrameNew() ){ if( mode == "play" ){ img.grabScreen(0,0,ofGetWidth(),ofGetHeight()); img.saveImage("frames/" + ofToString(totalFrames) + ".jpg"); } totalFrames++; framecounter++; if( framecounter > NUM_FRAMES ){ nextVideo(); } } } }