author | brad <brad> | 2004-04-05 09:08:56 (UTC) |
---|---|---|
committer | brad <brad> | 2004-04-05 09:08:56 (UTC) |
commit | 5a07a653948bfbfa5091a182ad62939c01624e38 (patch) (unidiff) | |
tree | 40b3feb25502fb2e8dff5f1879e4ac656a09c5ef | |
parent | c1bed3e1103b56236f77273cd586c1c3645702da (diff) | |
download | opie-5a07a653948bfbfa5091a182ad62939c01624e38.zip opie-5a07a653948bfbfa5091a182ad62939c01624e38.tar.gz opie-5a07a653948bfbfa5091a182ad62939c01624e38.tar.bz2 |
odebug include added
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/threadutil.cpp | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index 84f5f87..5d8929e 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp | |||
@@ -1,88 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <simon@lst.de> | 2 | Copyright (C) 2002 Simon Hausmann <simon@lst.de> |
3 | (C) 2002 Max Reiss <harlekin@handhelds.org> | 3 | (C) 2002 Max Reiss <harlekin@handhelds.org> |
4 | (C) 2002 L. Potter <ljp@llornkcor.com> | 4 | (C) 2002 L. Potter <ljp@llornkcor.com> |
5 | (C) 2002 Holger Freyther <zecke@handhelds.org> | 5 | (C) 2002 Holger Freyther <zecke@handhelds.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or | 7 | This program is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU General Public | 8 | modify it under the terms of the GNU General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | General Public License for more details. | 15 | General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; see the file COPYING. If not, write to | 18 | along with this program; see the file COPYING. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "skin.h" | 23 | #include "skin.h" |
24 | #include "singleton.h" | 24 | #include "singleton.h" |
25 | #include <opie2/odebug.h> | ||
25 | 26 | ||
26 | #include <qcache.h> | 27 | #include <qcache.h> |
27 | #include <qtimer.h> | 28 | #include <qtimer.h> |
28 | 29 | ||
29 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
30 | 31 | ||
31 | #include <assert.h> | 32 | #include <assert.h> |
32 | 33 | ||
33 | struct SkinData | 34 | struct SkinData |
34 | { | 35 | { |
35 | typedef QMap<QString, QImage> ButtonMaskImageMap; | 36 | typedef QMap<QString, QImage> ButtonMaskImageMap; |
36 | 37 | ||
37 | QPixmap backgroundPixmap; | 38 | QPixmap backgroundPixmap; |
38 | QImage buttonUpImage; | 39 | QImage buttonUpImage; |
39 | QImage buttonDownImage; | 40 | QImage buttonDownImage; |
40 | QImage buttonMask; | 41 | QImage buttonMask; |
41 | ButtonMaskImageMap buttonMasks; | 42 | ButtonMaskImageMap buttonMasks; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | class SkinCache : public Singleton<SkinCache> | 45 | class SkinCache : public Singleton<SkinCache> |
45 | { | 46 | { |
46 | public: | 47 | public: |
47 | SkinCache(); | 48 | SkinCache(); |
48 | 49 | ||
49 | SkinData *lookupAndTake( const QString &skinPath, const QString &fileNameInfix ); | 50 | SkinData *lookupAndTake( const QString &skinPath, const QString &fileNameInfix ); |
50 | 51 | ||
51 | void store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ); | 52 | void store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ); |
52 | 53 | ||
53 | private: | 54 | private: |
54 | typedef QCache<SkinData> DataCache; | 55 | typedef QCache<SkinData> DataCache; |
55 | typedef QCache<QPixmap> BackgroundPixmapCache; | 56 | typedef QCache<QPixmap> BackgroundPixmapCache; |
56 | 57 | ||
57 | template <class CacheType> | 58 | template <class CacheType> |
58 | void store( const QCache<CacheType> &cache, const QString &key, CacheType *data ); | 59 | void store( const QCache<CacheType> &cache, const QString &key, CacheType *data ); |
59 | 60 | ||
60 | DataCache m_cache; | 61 | DataCache m_cache; |
61 | BackgroundPixmapCache m_backgroundPixmapCache; | 62 | BackgroundPixmapCache m_backgroundPixmapCache; |
62 | }; | 63 | }; |
63 | 64 | ||
64 | Skin::Skin( const QString &name, const QString &fileNameInfix ) | 65 | Skin::Skin( const QString &name, const QString &fileNameInfix ) |
65 | : m_fileNameInfix( fileNameInfix ) | 66 | : m_fileNameInfix( fileNameInfix ) |
66 | { | 67 | { |
67 | init( name ); | 68 | init( name ); |
68 | } | 69 | } |
69 | 70 | ||
70 | Skin::Skin( const QString &fileNameInfix ) | 71 | Skin::Skin( const QString &fileNameInfix ) |
71 | : m_fileNameInfix( fileNameInfix ) | 72 | : m_fileNameInfix( fileNameInfix ) |
72 | { | 73 | { |
73 | init( defaultSkinName() ); | 74 | init( defaultSkinName() ); |
74 | } | 75 | } |
75 | 76 | ||
76 | Skin::~Skin() | 77 | Skin::~Skin() |
77 | { | 78 | { |
78 | if ( m_isCachable ) | 79 | if ( m_isCachable ) |
79 | SkinCache::self().store( m_skinPath, m_fileNameInfix, d ); | 80 | SkinCache::self().store( m_skinPath, m_fileNameInfix, d ); |
80 | else | 81 | else |
81 | delete d; | 82 | delete d; |
82 | } | 83 | } |
83 | 84 | ||
84 | void Skin::init( const QString &name ) | 85 | void Skin::init( const QString &name ) |
85 | { | 86 | { |
86 | m_isCachable = true; | 87 | m_isCachable = true; |
87 | m_skinPath = "opieplayer2/skins/" + name; | 88 | m_skinPath = "opieplayer2/skins/" + name; |
88 | d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix ); | 89 | d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix ); |
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp index d8b8abe..6ed9853 100644 --- a/noncore/multimedia/opieplayer2/threadutil.cpp +++ b/noncore/multimedia/opieplayer2/threadutil.cpp | |||
@@ -1,85 +1,86 @@ | |||
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "threadutil.h" | 20 | #include "threadutil.h" |
21 | 21 | ||
22 | #include <opie2/odebug.h> | ||
22 | #include <qsocketnotifier.h> | 23 | #include <qsocketnotifier.h> |
23 | 24 | ||
24 | #include <pthread.h> | 25 | #include <pthread.h> |
25 | #include <assert.h> | 26 | #include <assert.h> |
26 | #include <unistd.h> | 27 | #include <unistd.h> |
27 | #include <errno.h> | 28 | #include <errno.h> |
28 | 29 | ||
29 | using namespace ThreadUtil; | 30 | using namespace ThreadUtil; |
30 | 31 | ||
31 | struct Mutex::Data | 32 | struct Mutex::Data |
32 | { | 33 | { |
33 | Data() | 34 | Data() |
34 | { | 35 | { |
35 | pthread_mutex_init( &mutex, 0 ); | 36 | pthread_mutex_init( &mutex, 0 ); |
36 | } | 37 | } |
37 | ~Data() | 38 | ~Data() |
38 | { | 39 | { |
39 | pthread_mutex_destroy( &mutex ); | 40 | pthread_mutex_destroy( &mutex ); |
40 | } | 41 | } |
41 | 42 | ||
42 | pthread_mutex_t mutex; | 43 | pthread_mutex_t mutex; |
43 | }; | 44 | }; |
44 | 45 | ||
45 | Mutex::Mutex() | 46 | Mutex::Mutex() |
46 | : d( new Data ) | 47 | : d( new Data ) |
47 | { | 48 | { |
48 | } | 49 | } |
49 | 50 | ||
50 | Mutex::~Mutex() | 51 | Mutex::~Mutex() |
51 | { | 52 | { |
52 | delete d; | 53 | delete d; |
53 | } | 54 | } |
54 | 55 | ||
55 | void Mutex::lock() | 56 | void Mutex::lock() |
56 | { | 57 | { |
57 | pthread_mutex_lock( &d->mutex ); | 58 | pthread_mutex_lock( &d->mutex ); |
58 | } | 59 | } |
59 | 60 | ||
60 | void Mutex::unlock() | 61 | void Mutex::unlock() |
61 | { | 62 | { |
62 | pthread_mutex_unlock( &d->mutex ); | 63 | pthread_mutex_unlock( &d->mutex ); |
63 | } | 64 | } |
64 | 65 | ||
65 | bool Mutex::tryLock() | 66 | bool Mutex::tryLock() |
66 | { | 67 | { |
67 | return pthread_mutex_trylock( &d->mutex ) == 0; | 68 | return pthread_mutex_trylock( &d->mutex ) == 0; |
68 | } | 69 | } |
69 | 70 | ||
70 | bool Mutex::isLocked() | 71 | bool Mutex::isLocked() |
71 | { | 72 | { |
72 | if ( !tryLock() ) | 73 | if ( !tryLock() ) |
73 | return true; | 74 | return true; |
74 | 75 | ||
75 | unlock(); | 76 | unlock(); |
76 | return false; | 77 | return false; |
77 | } | 78 | } |
78 | 79 | ||
79 | struct WaitCondition::Data | 80 | struct WaitCondition::Data |
80 | { | 81 | { |
81 | Data() | 82 | Data() |
82 | { | 83 | { |
83 | int result = pthread_cond_init( &waitCondition, 0 ); | 84 | int result = pthread_cond_init( &waitCondition, 0 ); |
84 | assert( result == 0 ); | 85 | assert( result == 0 ); |
85 | } | 86 | } |