void DialogVideoPlayer::openImageFilePress(){ QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation),tr("Files (*.*)")); QFileInfo check_file(fileName); if (!fileName.isEmpty() && check_file.exists() && check_file.isFile()){ QString number = QString((int)segmentsM(currentSegment - 1, SEGCOL_ID)); pathsImages[number] = fileName; _participant->SetProjectSetting(Consts::SETTING_IMAGE_PATHS, QJsonDocument::fromVariant(pathsImages).toJson()); paintBackgroundImage(); } }
void DialogVideoPlayer::changeMovieMode() { stopPlaying(); if (!ui->checkBoxMovie->isChecked()) { paintBackgroundImage(); ui->labelTimeOffset->setEnabled(false); ui->spinBoxTimeOffset->setEnabled(false); } else { clearBackgroundImage(); ui->labelTimeOffset->setEnabled(true); ui->spinBoxTimeOffset->setEnabled(true); } }
/** * Draw the background */ void DocumentView::drawBackground() { PageType pt = page->getBackgroundType(); if (pt.isPdfPage()) { // Handled in PdfView } else if (pt.isImagePage()) { paintBackgroundImage(); } else { backgroundPainter->paint(pt, cr, page); } }
void DialogVideoPlayer::updatePlaybackState(int index, bool resetTimeSource) { bool trigger_fragment_mode = settingPlayMode == PlayModeFragment && (index >= ((currentFragment + 1) * samplesPerFragment) || index == -1); if (trigger_fragment_mode) { if (settingLoop) { updatePlaybackState(currentFragment * samplesPerFragment, true); } else { stopPlaying(); } return; } bool trigger_whole_file_mode = settingPlayMode == PlayModeWholeFile && (index >= (int)p_roughM->n_rows || index == -1); if (trigger_whole_file_mode) { if (settingLoop) { updatePlaybackState(0, true); } else { stopPlaying(); } return; } bool segment_in_bounds = currentSegment > 0 && currentSegment - 1 < (int)segmentsM.n_rows; bool trigger_segment_mode = segment_in_bounds && settingPlayMode == PlayModeSegment && (index >= segmentsM(currentSegment - 1, SEGCOL_END) || index == -1); if (trigger_segment_mode) { if (settingLoop) { updatePlaybackState(segmentsM(currentSegment - 1, SEGCOL_START), true); } else { stopPlaying(); } return; } // Display index currentIndex = index; currentTimeMS = p_roughM->at(qMax(0, currentIndex), 0 ); // Display time since start int milliseconds = currentTimeMS - firstSampleMS; int minutes = floor(milliseconds / 60000); milliseconds -= minutes * 60000; int seconds = floor(milliseconds / 1000); milliseconds -= seconds * 1000; ui->labelTime->setText(QString("Time (m:s:ms): %1:%2:%3").arg(minutes).arg(seconds).arg(milliseconds)); ui->spinBoxIndex->blockSignals(true); ui->spinBoxIndex->setValue(currentIndex); ui->spinBoxIndex->blockSignals(false); // Calculate current fragment int current_fragment = currentIndex > -1 ? (int)floor((double)currentIndex / samplesPerFragment) : -1; if (current_fragment != currentFragment) { currentFragment = current_fragment; paintTimeLine(); paintFixations(); } ui->spinBoxFragment->blockSignals(true); ui->spinBoxFragment->setValue(currentFragment); ui->spinBoxFragment->blockSignals(false); // Calculate current segment int current_segment = 0; // 0 means at start of file for (uword i = 0; i < segmentsM.n_rows -1; ++i) { if (currentIndex >= segmentsM(i, SEGCOL_START)) { current_segment = i; } } if (currentSegment != current_segment + 1) { currentSegment = current_segment + 1; if (!ui->checkBoxMovie->isChecked()) { paintBackgroundImage(); } } ui->spinBoxSegment->blockSignals(true); ui->spinBoxSegment->setValue(currentSegment); ui->spinBoxSegment->blockSignals(false); paintCurrentVisualizationFrame(); paintCurrentTimeLineLineFrame(); if (resetTimeSource) { if (ui->checkBoxMovie->isChecked()) { mediaPlayer->setPosition(currentTimeMS + movieOffsetMS - firstSampleMS); } else { clockStartTime = getMilliCount(); playStartSampleMS = p_roughM->at(qMax(0, currentIndex), 0 ); } } }