Changeset View
Changeset View
Standalone View
Standalone View
src/panels/information/informationpanelcontent.cpp
Show First 20 Lines • Show All 242 Lines • ▼ Show 20 Line(s) | 238 | } else { | |||
---|---|---|---|---|---|
243 | const bool isAnimatedImage = m_preview->isAnimatedImage(itemUrl.toLocalFile()); | 243 | const bool isAnimatedImage = m_preview->isAnimatedImage(itemUrl.toLocalFile()); | ||
244 | m_isVideo = !isAnimatedImage && mimeType.startsWith(QLatin1String("video/")); | 244 | m_isVideo = !isAnimatedImage && mimeType.startsWith(QLatin1String("video/")); | ||
245 | usePhonon = m_isVideo || mimeType.startsWith(QLatin1String("audio/")); | 245 | usePhonon = m_isVideo || mimeType.startsWith(QLatin1String("audio/")); | ||
246 | 246 | | |||
247 | if (usePhonon) { | 247 | if (usePhonon) { | ||
248 | // change the cursor of the preview | 248 | // change the cursor of the preview | ||
249 | m_preview->setCursor(Qt::PointingHandCursor); | 249 | m_preview->setCursor(Qt::PointingHandCursor); | ||
250 | m_preview->installEventFilter(m_phononWidget); | 250 | m_preview->installEventFilter(m_phononWidget); | ||
251 | m_phononWidget->show(); | ||||
251 | 252 | | |||
252 | // if the video is playing, has been paused or stopped | 253 | // if the video is playing, has been paused or stopped | ||
253 | // we don't need to update the preview/phonon widget states | 254 | // we don't need to update the preview/phonon widget states | ||
254 | // unless the previewed file has changed, | 255 | // unless the previewed file has changed, | ||
255 | // or the setting previewshown has changed | 256 | // or the setting previewshown has changed | ||
256 | if ((m_phononWidget->state() != Phonon::State::PlayingState && | 257 | if ((m_phononWidget->state() != Phonon::State::PlayingState && | ||
257 | m_phononWidget->state() != Phonon::State::PausedState && | 258 | m_phononWidget->state() != Phonon::State::PausedState && | ||
258 | m_phononWidget->state() != Phonon::State::StoppedState) || | 259 | m_phononWidget->state() != Phonon::State::StoppedState) || | ||
259 | m_item.targetUrl() != m_phononWidget->url() || | 260 | m_item.targetUrl() != m_phononWidget->url() || | ||
260 | (!m_preview->isVisible() &&! m_phononWidget->isVisible())) { | 261 | (!m_preview->isVisible() &&! m_phononWidget->isVisible())) { | ||
261 | 262 | | |||
262 | if (InformationPanelSettings::previewsAutoPlay() && m_isVideo) { | 263 | if (InformationPanelSettings::previewsAutoPlay() && m_isVideo) { | ||
263 | // hides the preview now to avoid flickering when the autoplay video starts | 264 | // hides the preview now to avoid flickering when the autoplay video starts | ||
264 | m_preview->hide(); | 265 | m_preview->hide(); | ||
265 | } else { | 266 | } else { | ||
266 | // the video won't play before the preview is displayed | 267 | // the video won't play before the preview is displayed | ||
267 | m_preview->show(); | 268 | m_preview->show(); | ||
268 | } | 269 | } | ||
269 | 270 | | |||
270 | m_phononWidget->show(); | | |||
271 | m_phononWidget->setUrl(m_item.targetUrl(), m_isVideo ? PhononWidget::MediaKind::Video : PhononWidget::MediaKind::Audio); | 271 | m_phononWidget->setUrl(m_item.targetUrl(), m_isVideo ? PhononWidget::MediaKind::Video : PhononWidget::MediaKind::Audio); | ||
272 | adjustWidgetSizes(parentWidget()->width()); | 272 | adjustWidgetSizes(parentWidget()->width()); | ||
273 | } | 273 | } | ||
274 | } else { | 274 | } else { | ||
275 | if (isAnimatedImage) { | 275 | if (isAnimatedImage) { | ||
276 | m_preview->setAnimatedImageFileName(itemUrl.toLocalFile()); | 276 | m_preview->setAnimatedImageFileName(itemUrl.toLocalFile()); | ||
277 | } | 277 | } | ||
278 | // When we don't need it, hide the phonon widget first to avoid flickering | 278 | // When we don't need it, hide the phonon widget first to avoid flickering | ||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |