| 1 |
/* |
| 2 |
* Copyright (C) 2013 Canonical, Ltd. |
| 3 |
* |
| 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. |
| 7 |
* |
| 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. |
| 12 |
* |
| 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/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef MEDIAPLAYER_H |
| 18 |
#define MEDIAPLAYER_H |
| 19 |
|
| 20 |
#include <QApplication> |
| 21 |
#include <QQuickView> |
| 22 |
#include <QSettings> |
| 23 |
#include <QUrl> |
| 24 |
|
| 25 |
class MediaPlayer : public QApplication { |
| 26 |
Q_OBJECT |
| 27 |
Q_PROPERTY(QUrl playUri READ playUri WRITE setPlayUri NOTIFY playUriChanged) |
| 28 |
Q_PROPERTY(bool windowed READ windowed CONSTANT) |
| 29 |
|
| 30 |
public: |
| 31 |
MediaPlayer(int& argc, char** argv); |
| 32 |
virtual ~MediaPlayer(); |
| 33 |
|
| 34 |
bool setup(); |
| 35 |
QUrl playUri() { return m_playUri; } |
| 36 |
void setPlayUri(QUrl uri); |
| 37 |
bool windowed(); |
| 38 |
|
| 39 |
Q_INVOKABLE int getStoredPosition(); |
| 40 |
Q_INVOKABLE void storePosition(int duration); |
| 41 |
Q_INVOKABLE bool isAudio(const QString& file); |
| 42 |
|
| 43 |
signals: |
| 44 |
void playUriChanged(); |
| 45 |
|
| 46 |
public Q_SLOTS: |
| 47 |
void toggleFullscreen(); |
| 48 |
void leaveFullScreen(); |
| 49 |
void onWidthChanged(int); |
| 50 |
void onHeightChanged(int); |
| 51 |
QList<QUrl> copyFiles(const QList<QUrl>& urls); |
| 52 |
|
| 53 |
private: |
| 54 |
QQuickView* m_view; |
| 55 |
QSettings m_settings; |
| 56 |
QUrl m_playUri; |
| 57 |
bool m_windowed; |
| 58 |
}; |
| 59 |
|
| 60 |
#endif // MEDIAPLAYER_H |