[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/collection/mediadevicecollection
From: Alejandro Daniel Wainzinger <aikawarazuni () gmail ! com>
Date: 2009-07-19 9:23:37
Message-ID: 1247995417.790307.23254.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 999101 by awainzinger:
Don't duplicate capacity code in collection.
M +4 -16 MediaDeviceCollection.cpp
M +12 -0 handler/MediaDeviceHandler.cpp
M +3 -0 handler/MediaDeviceHandler.h
--- trunk/extragear/multimedia/amarok/src/collection/mediadevicecollection/MediaDeviceCollection.cpp \
#999100:999101 @@ -140,19 +140,8 @@
void
MediaDeviceCollection::initCapacities()
{
- Solid::Device device = Solid::Device( m_udi );
- if( device.isValid() )
- {
- Solid::StorageAccess *storage = device.as<Solid::StorageAccess>();
- KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo( \
storage->filePath() );
- m_usedCapacity = info.used();
- m_totalCapacity = info.size();
- }
- else
- {
- m_usedCapacity = 0;
- m_totalCapacity = 0;
- }
+ m_usedCapacity = m_handler->usedcapacity();
+ m_totalCapacity = m_handler->totalcapacity();
}
QueryMaker*
@@ -263,9 +252,8 @@
float
MediaDeviceCollection::usedCapacity() const
{
- if( m_totalCapacity < 0 )
- const_cast<MediaDeviceCollection*>(this)->initCapacities();
- return m_usedCapacity;
+ if( m_totalCapacity >= 0 )
+ return m_usedCapacity;
}
float
--- trunk/extragear/multimedia/amarok/src/collection/mediadevicecollection/handler/MediaDeviceHandler.cpp \
#999100:999101 @@ -1041,6 +1041,18 @@
return ( m_rc->totalCapacity() - m_rc->usedCapacity() );
}
+float
+MediaDeviceHandler::usedcapacity() const
+{
+ return m_rc->usedCapacity();
+}
+
+float
+MediaDeviceHandler::totalcapacity() const
+{
+ return m_rc->totalCapacity();
+}
+
/** Observer Methods **/
void
MediaDeviceHandler::metadataChanged( TrackPtr track )
--- trunk/extragear/multimedia/amarok/src/collection/mediadevicecollection/handler/MediaDeviceHandler.h \
#999100:999101 @@ -188,6 +188,9 @@
virtual void prepareToPlay( Meta::MediaDeviceTrackPtr &track ) { Q_UNUSED( track \
) } // called by @param track
+ virtual float usedcapacity() const;
+ virtual float totalcapacity() const;
+
// HACK: Used for device-specific actions, such as initialize for iPod
virtual QList<PopupDropperAction *> collectionActions() { return \
QList<PopupDropperAction*> (); }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic