Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/videomonitorwidget.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 67 | if (b) { | |||
---|---|---|---|---|---|
72 | _playPB->setIcon(QIcon::fromTheme("media-playback-pause", style()->standardIcon(QStyle::SP_MediaPause))); | 72 | _playPB->setIcon(QIcon::fromTheme("media-playback-pause", style()->standardIcon(QStyle::SP_MediaPause))); | ||
73 | _mediaplayer.play(); | 73 | _mediaplayer.play(); | ||
74 | } else { | 74 | } else { | ||
75 | _mediaplayer.pause(); | 75 | _mediaplayer.pause(); | ||
76 | _playPB->setIcon(QIcon::fromTheme("media-playback-start", style()->standardIcon(QStyle::SP_MediaPlay))); | 76 | _playPB->setIcon(QIcon::fromTheme("media-playback-start", style()->standardIcon(QStyle::SP_MediaPlay))); | ||
77 | } | 77 | } | ||
78 | _videoWidget->setVisible(b); | 78 | _videoWidget->setVisible(b); | ||
79 | }); | 79 | }); | ||
80 | 80 | using ErrorSignal = void (QMediaPlayer::*)(QMediaPlayer::Error); | |||
81 | typedef void (QMediaPlayer::*ErrorSignal)(QMediaPlayer::Error); | | |||
82 | connect(&_mediaplayer, static_cast<ErrorSignal>(&QMediaPlayer::error), | 81 | connect(&_mediaplayer, static_cast<ErrorSignal>(&QMediaPlayer::error), | ||
83 | this, &VideoMonitorWidget::handleError); | 82 | this, &VideoMonitorWidget::handleError); | ||
84 | } | 83 | } | ||
85 | 84 | | |||
86 | void VideoMonitorWidget::handleError() | 85 | void VideoMonitorWidget::handleError() | ||
87 | { | 86 | { | ||
88 | const QString errorString = _mediaplayer.errorString(); | 87 | const QString errorString = _mediaplayer.errorString(); | ||
89 | QString message = "Error: "; | 88 | QString message = "Error: "; | ||
90 | if (errorString.isEmpty()) { | 89 | if (errorString.isEmpty()) { | ||
91 | message += " #" + QString::number(int(_mediaplayer.error())); | 90 | message += " #" + QString::number(int(_mediaplayer.error())); | ||
92 | } else { | 91 | } else { | ||
93 | message += errorString; | 92 | message += errorString; | ||
94 | } | 93 | } | ||
95 | _errorlabel->setText(message); | 94 | _errorlabel->setText(message); | ||
96 | } | 95 | } |