PhMediaPanel::PhMediaPanel(QWidget *parent) : QWidget(parent), ui(new Ui::PhMediaPanel), _clock(NULL), _firstFrame(0), _mediaLength(0) { ui->setupUi(this); //Buttons Init ui->_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); connect(ui->_playButton, SIGNAL(clicked()), this, SLOT(onPlayPause())); ui->_fastForwardButton->setIcon(style()->standardIcon(QStyle::SP_MediaSeekForward)); connect(ui->_fastForwardButton, SIGNAL(clicked()), this, SLOT(onFastForward())); ui->_fastRewindButton->setIcon(style()->standardIcon(QStyle::SP_MediaSeekBackward)); connect(ui->_fastRewindButton, SIGNAL(clicked()), this, SLOT(onRewind())); ui->_backButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward)); connect(ui->_backButton, SIGNAL(clicked()), this, SLOT(onBack())); ui->_nextFrameButton->setIcon(style()->standardIcon(QStyle::SP_ArrowForward)); connect(ui->_nextFrameButton, SIGNAL(clicked()), this, SLOT(onNextFrame())); ui->_previousFrameButton->setIcon(style()->standardIcon(QStyle::SP_ArrowBack)); connect(ui->_previousFrameButton, SIGNAL(clicked()), this, SLOT(onPreviousFrame())); connect(ui->_slider, SIGNAL(sliderMoved(int)), this, SLOT(onSliderChanged(int))); //Combobox Init ui->_rateSelectionBox->addItem("23.98 fps"); ui->_rateSelectionBox->addItem("24 fps"); ui->_rateSelectionBox->addItem("25 fps"); ui->_rateSelectionBox->addItem("29.97 fps"); connect(ui->_rateSelectionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onTCTypeComboChanged())); ui->_playButton->setDefault(true); }
medTimeLineToolBox::medTimeLineToolBox(QWidget *parent) : medToolBox(parent), d(new medTimeLineToolBoxPrivate) { QWidget *box = new QWidget (this); d->labelmin = new QLabel(this); d->labelmax = new QLabel(this); d->labelcurr = new QLabel(this); d->labelspeed = new QLabel(this); d->labelspeed->setText("Speed %: "); d->timeSlider = new QSlider (Qt::Horizontal, this); d->timeSlider->setRange (0, 100); d->timeSlider->setValue (0); d->timeSlider->setTracking( false ); d->timeSlider->setToolTip(tr("Follow The Sequence")); QStringList validDataTypes; validDataTypes << "itkDataImageChar4" << "itkDataImageUChar4" << "itkDataImageShort4" << "itkDataImageUShort4" << "itkDataImageInt4" << "itkDataImageUInt4" << "itkDataImageLong4" << "itkDataImageULong4" << "itkDataImageFloat4" << "itkDataImageDouble4" << "vtkDataMesh4D"; setValidDataTypes(validDataTypes); d->playIcon = QPixmap(":/icons/play.png"); d->playSequencesButton = new medButton(this,d->playIcon, tr("Play Sequence")); d->nextFrameButton = new medButton(this,":/icons/forward.png", tr("Next Frame")); d->previousFrameButton = new medButton(this,":/icons/backward.png", tr("Previous Frame")); d->stopButton = new medButton(this,":/icons/stop.png", tr("Stop Sequence")); d->timeLine = new QTimeLine(1000, this); d->timeLine->setLoopCount(0); d->timeLine->setCurveShape (QTimeLine::LinearCurve); d->spinBox = new QSpinBox(this); d->spinBox->setRange(1,5000); d->spinBox->setSingleStep(10); d->spinBox->setValue(100); d->spinBox->setToolTip(tr("Control the display speed")); connect(d->timeLine, SIGNAL(frameChanged(int)), d->timeSlider, SLOT(setValue(int))); QHBoxLayout *buttonLayout = new QHBoxLayout(); buttonLayout->addWidget( d->previousFrameButton,1,Qt::AlignHCenter); buttonLayout->addWidget (d->playSequencesButton,1,Qt::AlignHCenter); buttonLayout->addWidget( d->nextFrameButton,1,Qt::AlignHCenter); buttonLayout->addWidget( d->stopButton,1,Qt::AlignHCenter); QHBoxLayout *labelLayout = new QHBoxLayout(); labelLayout->addWidget( d->labelmin); labelLayout->addStretch(); labelLayout->addWidget( d->labelcurr); labelLayout->addStretch(); labelLayout->addWidget( d->labelmax); QHBoxLayout *topLayout = new QHBoxLayout(); topLayout->addStretch(); topLayout->addWidget(d->labelspeed); topLayout->addWidget(d->spinBox); QVBoxLayout* boxlayout = new QVBoxLayout (); boxlayout->addLayout(topLayout); boxlayout->addLayout( buttonLayout ); boxlayout->addWidget (d->timeSlider); boxlayout->addLayout(labelLayout); d->actionlist.insert(0,new QAction("1",this)); d->actionlist.insert(1,new QAction("5",this)); d->actionlist.insert(2,new QAction("10",this)); d->actionlist.insert(3,new QAction("25",this)); d->actionlist.insert(4,new QAction("50",this)); connect(d->timeSlider, SIGNAL(sliderMoved(int)), this, SLOT(onTimeChanged(int))); connect(d->timeSlider, SIGNAL(valueChanged(int)), this, SLOT(onTimeChanged(int))); connect(d->playSequencesButton, SIGNAL(triggered()), this, SLOT(onPlaySequences())); connect(d->nextFrameButton, SIGNAL(triggered()), this, SLOT(onNextFrame())); connect(d->previousFrameButton, SIGNAL(triggered()), this, SLOT(onPreviousFrame())); connect(d->spinBox, SIGNAL(valueChanged(int)),this, SLOT(onSpinBoxChanged(int))); connect(d->stopButton, SIGNAL(triggered()),this, SLOT(onStopButton())); this->setTitle(tr("Time Management")); box->setLayout (boxlayout); this->addWidget (box); d->minTime = 0.0; d->minTimeStep = 1.0; d->maxTime = 0.0; this->isViewAdded = false; this->hide(); }