| 290 | } |
| 291 | |
| 292 | void PlaybackController::currentSelectedItemsChanged(playlistItem *item1, |
| 293 | playlistItem *item2, |
| 294 | bool chageByPlayback) |
| 295 | { |
| 296 | QSettings settings; |
| 297 | auto continuePlayback = settings.value("ContinuePlaybackOnSequenceSelection", false).toBool(); |
| 298 | |
| 299 | if (this->playing() && !chageByPlayback && !continuePlayback) |
| 300 | this->pausePlayback(); |
| 301 | |
| 302 | this->currentItem[0] = item1; |
| 303 | this->currentItem[1] = item2; |
| 304 | |
| 305 | if (!this->anyItemIndexedByFrame()) |
| 306 | { |
| 307 | this->enableControls(false); |
| 308 | |
| 309 | // Save the last valid frame index. Now the frame index is invalid. |
| 310 | if (this->currentFrameIdx != -1) |
| 311 | this->lastValidFrameIdx = this->currentFrameIdx; |
| 312 | this->currentFrameIdx = -1; |
| 313 | |
| 314 | if (item1 && !item1->properties().isIndexedByFrame()) |
| 315 | { |
| 316 | const auto sliderMax = item1->properties().duration * 10; |
| 317 | this->updateFrameSliderAndSpinBoxWithoutSignals(0, sliderMax); |
| 318 | } |
| 319 | |
| 320 | if (item1 && (chageByPlayback || (continuePlayback && this->playing())) && |
| 321 | this->playbackMode != PlaybackMode::WaitingForCache) |
| 322 | // Update the timer |
| 323 | this->startOrUpdateTimer(); |
| 324 | |
| 325 | DEBUG_PLAYBACK("PlaybackController::currentSelectedItemsChanged No indexed items - " |
| 326 | "currentFrameIdx %d lastValidFrameIdx %d slider %d-%d", |
| 327 | this->currentFrameIdx, |
| 328 | this->lastValidFrameIdx, |
| 329 | this->frameSlider->minimum(), |
| 330 | this->frameSlider->maximum()); |
| 331 | |
| 332 | // Also update the view to display the new frame |
| 333 | this->splitViewPrimary->update(true); |
| 334 | this->splitViewSeparate->update(); |
| 335 | } |
| 336 | else if (this->playing() && (chageByPlayback || continuePlayback)) |
| 337 | { |
| 338 | if (this->playbackMode != PlaybackMode::WaitingForCache) |
| 339 | // Update the timer |
| 340 | this->startOrUpdateTimer(); |
| 341 | |
| 342 | this->updateFrameRange(); |
| 343 | |
| 344 | if (!chageByPlayback && continuePlayback && |
| 345 | this->currentFrameIdx >= this->ui.frameSlider->maximum()) |
| 346 | // The user changed this but we want playback to continue. Unfortunately the new selected |
| 347 | // sequence does not have as many frames as the previous one. So we start playback at the |
| 348 | // start. |
| 349 | this->setCurrentFrameAndUpdate(this->ui.frameSlider->minimum()); |
nothing calls this directly
no test coverage detected