Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayerstate.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp new file mode 100644 index 0000000..9b5f70e --- a/dev/null +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -0,0 +1,78 @@ | |||
1 | |||
2 | |||
3 | |||
4 | #include <qpe/qpeapplication.h> | ||
5 | #include <qpe/qlibrary.h> | ||
6 | #include <qpe/config.h> | ||
7 | #include <qvaluelist.h> | ||
8 | #include <qobject.h> | ||
9 | #include <qdir.h> | ||
10 | #include <qpe/mediaplayerplugininterface.h> | ||
11 | #include "mediaplayerstate.h" | ||
12 | |||
13 | |||
14 | |||
15 | #ifdef QT_NO_COMPONENT | ||
16 | // Plugins which are compiled in when no plugin architecture available | ||
17 | #include "libmad/libmadpluginimpl.h" | ||
18 | #include "libmpeg3/libmpeg3pluginimpl.h" | ||
19 | #include "wavplugin/wavpluginimpl.h" | ||
20 | #endif | ||
21 | |||
22 | |||
23 | //#define MediaPlayerDebug(x) qDebug x | ||
24 | #define MediaPlayerDebug(x) | ||
25 | |||
26 | |||
27 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | ||
28 | : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) { | ||
29 | Config cfg( "OpiePlayer" ); | ||
30 | readConfig( cfg ); | ||
31 | } | ||
32 | |||
33 | |||
34 | MediaPlayerState::~MediaPlayerState() { | ||
35 | Config cfg( "OpiePlayer" ); | ||
36 | writeConfig( cfg ); | ||
37 | } | ||
38 | |||
39 | |||
40 | void MediaPlayerState::readConfig( Config& cfg ) { | ||
41 | cfg.setGroup("Options"); | ||
42 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); | ||
43 | isScaled = cfg.readBoolEntry( "Scaling" ); | ||
44 | isLooping = cfg.readBoolEntry( "Looping" ); | ||
45 | isShuffled = cfg.readBoolEntry( "Shuffle" ); | ||
46 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | ||
47 | usePlaylist = TRUE; | ||
48 | isPlaying = FALSE; | ||
49 | isPaused = FALSE; | ||
50 | curPosition = 0; | ||
51 | curLength = 0; | ||
52 | curView = 'l'; | ||
53 | } | ||
54 | |||
55 | |||
56 | void MediaPlayerState::writeConfig( Config& cfg ) const { | ||
57 | cfg.setGroup("Options"); | ||
58 | cfg.writeEntry("FullScreen", isFullscreen ); | ||
59 | cfg.writeEntry("Scaling", isScaled ); | ||
60 | cfg.writeEntry("Looping", isLooping ); | ||
61 | cfg.writeEntry("Shuffle", isShuffled ); | ||
62 | cfg.writeEntry("UsePlayList", usePlaylist ); | ||
63 | } | ||
64 | |||
65 | |||
66 | struct MediaPlayerPlugin { | ||
67 | #ifndef QT_NO_COMPONENT | ||
68 | QLibrary *library; | ||
69 | #endif | ||
70 | MediaPlayerPluginInterface *iface; | ||
71 | MediaPlayerDecoder *decoder; | ||
72 | MediaPlayerEncoder *encoder; | ||
73 | }; | ||
74 | |||
75 | |||
76 | static QValueList<MediaPlayerPlugin> pluginList; | ||
77 | |||
78 | |||