2 * Copyright (C) 2013, 2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * Author: Michael Zanetti <michael.zanetti@canonical.com>
21Audio::Audio(QObject* parent):
23 m_playbackState(StoppedState),
26 qsrand(time(nullptr));
27 m_timer.setInterval(1000);
28 connect(&m_timer, &QTimer::timeout, this, &Audio::timerEvent);
31 Q_EMIT positionChanged(m_position);
33 m_duration = (qrand() % 20000) + 10000;
34 Q_EMIT durationChanged(m_duration);
37Audio::PlaybackState Audio::playbackState() const
39 return m_playbackState;
42int Audio::position() const
47int Audio::duration() const
52QString Audio::errorString() const
59 if (m_playbackState == PlayingState) {
60 m_playbackState = PausedState;
61 Q_EMIT playbackStateChanged(m_playbackState);
68 if (m_playbackState != PlayingState) {
69 m_playbackState = PlayingState;
70 Q_EMIT playbackStateChanged(m_playbackState);
78 if (m_playbackState != StoppedState) {
79 m_playbackState = StoppedState;
80 Q_EMIT playbackStateChanged(m_playbackState);
83 Q_EMIT positionChanged(m_position);
87void Audio::timerEvent()
89 if (m_position + 1000 < m_duration) {
91 Q_EMIT positionChanged(m_position);
97Audio::AudioRole Audio::audioRole() const
99 return Audio::multimedia;
102void Audio::setAudioRole(Audio::AudioRole audioRole)
107DeclarativePlaylist *Audio::playlist() const
112void Audio::setPlaylist(DeclarativePlaylist *playlist)
114 if (playlist == m_playlist)
117 m_playlist = playlist;
118 Q_EMIT playlistChanged();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list