author | brad <brad> | 2004-04-05 09:08:56 (UTC) |
---|---|---|
committer | brad <brad> | 2004-04-05 09:08:56 (UTC) |
commit | 5a07a653948bfbfa5091a182ad62939c01624e38 (patch) (side-by-side diff) | |
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,120 +1,121 @@ /* Copyright (C) 2002 Simon Hausmann <simon@lst.de> (C) 2002 Max Reiss <harlekin@handhelds.org> (C) 2002 L. Potter <ljp@llornkcor.com> (C) 2002 Holger Freyther <zecke@handhelds.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "skin.h" #include "singleton.h" +#include <opie2/odebug.h> #include <qcache.h> #include <qtimer.h> #include <qpe/config.h> #include <assert.h> struct SkinData { typedef QMap<QString, QImage> ButtonMaskImageMap; QPixmap backgroundPixmap; QImage buttonUpImage; QImage buttonDownImage; QImage buttonMask; ButtonMaskImageMap buttonMasks; }; class SkinCache : public Singleton<SkinCache> { public: SkinCache(); SkinData *lookupAndTake( const QString &skinPath, const QString &fileNameInfix ); void store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ); private: typedef QCache<SkinData> DataCache; typedef QCache<QPixmap> BackgroundPixmapCache; template <class CacheType> void store( const QCache<CacheType> &cache, const QString &key, CacheType *data ); DataCache m_cache; BackgroundPixmapCache m_backgroundPixmapCache; }; Skin::Skin( const QString &name, const QString &fileNameInfix ) : m_fileNameInfix( fileNameInfix ) { init( name ); } Skin::Skin( const QString &fileNameInfix ) : m_fileNameInfix( fileNameInfix ) { init( defaultSkinName() ); } Skin::~Skin() { if ( m_isCachable ) SkinCache::self().store( m_skinPath, m_fileNameInfix, d ); else delete d; } void Skin::init( const QString &name ) { m_isCachable = true; m_skinPath = "opieplayer2/skins/" + name; d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix ); } QPixmap Skin::backgroundPixmap() const { if ( d->backgroundPixmap.isNull() ) d->backgroundPixmap = loadImage( QString( "%1/background" ).arg( m_skinPath ) ); return d->backgroundPixmap; } QImage Skin::buttonUpImage() const { if ( d->buttonUpImage.isNull() ) d->buttonUpImage = loadImage( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ); return d->buttonUpImage; } QImage Skin::buttonDownImage() const { if ( d->buttonDownImage.isNull() ) d->buttonDownImage = loadImage( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ); return d->buttonDownImage; } QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const { if ( !d->buttonMask.isNull() ) return d->buttonMask; QSize buttonAreaSize = buttonUpImage().size(); d->buttonMask = QImage( buttonAreaSize, 8, 255 ); d->buttonMask.fill( 0 ); 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,117 +1,118 @@ /* This file is part of the KDE project Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "threadutil.h" +#include <opie2/odebug.h> #include <qsocketnotifier.h> #include <pthread.h> #include <assert.h> #include <unistd.h> #include <errno.h> using namespace ThreadUtil; struct Mutex::Data { Data() { pthread_mutex_init( &mutex, 0 ); } ~Data() { pthread_mutex_destroy( &mutex ); } pthread_mutex_t mutex; }; Mutex::Mutex() : d( new Data ) { } Mutex::~Mutex() { delete d; } void Mutex::lock() { pthread_mutex_lock( &d->mutex ); } void Mutex::unlock() { pthread_mutex_unlock( &d->mutex ); } bool Mutex::tryLock() { return pthread_mutex_trylock( &d->mutex ) == 0; } bool Mutex::isLocked() { if ( !tryLock() ) return true; unlock(); return false; } struct WaitCondition::Data { Data() { int result = pthread_cond_init( &waitCondition, 0 ); assert( result == 0 ); } ~Data() { pthread_cond_destroy( &waitCondition ); } pthread_cond_t waitCondition; }; WaitCondition::WaitCondition() : d( new Data ) { } WaitCondition::~WaitCondition() { delete d; } bool WaitCondition::wait() { Mutex m; m.lock(); return wait( m ); } bool WaitCondition::wait( Mutex &mutex ) { return pthread_cond_wait( &d->waitCondition, &mutex.d->mutex ); } void WaitCondition::wakeOne() { |