Sunday, May 3. 2009Amarok Developer SprintThe Amarok developer sprint in Berlin is at full speed and the Amarokers are having an awesome time Tuesday started with me being late for my ride to Stuttgart due to a meeting. Finally at 4am on Friday Frederik, Sven and I arrived in Berlin. We had a nice chat with Nuno, Leo and Gerard. Czessi of kubuntu-de organized a really nice flat for us with comfy beds to fall asleep in. Friday morning we went to the KDAB office in Kreuzberg and where greeted with lots of music and generally everyone having a great day. May 1st is starting as a rather nice street festival here. After playing a first round of table football (note to self: need one at home! need one at home!) we split into two groups, one doing API review of the Amarok codebase and the other one planning the PR part of our world domination plans and talking promo, website and artwork. Todos for everyone Saturday was all about discussing ways to make Amarok’s user interface better. We had everything from “awesome but totally un-doable” to “yea this is pretty cool and might work”. Stay tuned for what will come out of this. Leinir and I did some card sorting to improve the context menu that pops up when right-clicking on a track in the playlist. It currently contains 11 items most of which are not the way they should be. Sebas was able to convince Frederik to join him in hacking on the networkmanager applet. We had delicious food around the corner again, Vietnamese and Indian this time. And of course we had a few good table football matches again Today started with making action items out of the discussions of the previous days, discussing bigger short and long-term plans and going through critical bug reports. After some really good Persian food, Leinir and I evaluated the data we got yesterday and came up with a very nice new context menu for the playlist. Others worked on implementing some of the action items we agreed on earlier like making it possible to remove the context view with a command line option (no option for now as we are in string-freeze). Night ended with a serious table foodball match which Leo, Sebas and Nuno totally rocked Conclusion: Berlin around the KDAB office and the office itself is the awesome. Thanks to KDAB for providing us with a great location and hosting. Thanks also to KDE eV for helping with funding. Stay tuned for some cool stuff Sunday, May 3. 2009
Amarok: Quick Status Report on ... Posted by Alejandro Wainzinger
in xevix at
07:02
Comments (0) Trackbacks (0) Amarok: Quick Status Report on Refactoring, Git Rocks
Between the business of school &c. I've been at work making Media Device code smaller and easier to write, as promised. Here is a preview of the difference in the amount of code required before, and in my git branch after. Let's just look at the MediaDeviceCollectionFactory subclass for Ipods, which keeps track of Ipods connected and talks to Solid.
Before: AMAROK_EXPORT_PLUGIN( IpodCollectionFactory ) IpodCollectionFactory::IpodCollectionFactory() : Amarok::CollectionFactory() { //nothing to do } IpodCollectionFactory::~IpodCollectionFactory() { DEBUG_BLOCK } void IpodCollectionFactory::init() { DEBUG_BLOCK // connect to the monitor // connect( this, SIGNAL( ipodDetected( const MediaDeviceInfo & ) ), // MediaDeviceMonitor::instance(), SIGNAL( deviceDetected( const MediaDeviceInfo & ) ) ); connect( MediaDeviceMonitor::instance(), SIGNAL( ipodReadyToConnect( const QString &, const QString & ) ), SLOT( ipodDetected( const QString &, const QString & ) ) ); // HACK: emitting old signal to avoid refactoring applet yet connect( this, SIGNAL( tellIpodDetected( const QString &, const QString & ) ), MediaDeviceMonitor::instance(), SIGNAL( ipodDetected( const QString &, const QString & ) ) ); connect( MediaDeviceMonitor::instance(), SIGNAL( ipodReadyToDisconnect( const QString & ) ), SLOT( deviceRemoved( const QString & ) ) ); connect( MediaDeviceMonitor::instance(), SIGNAL( deviceRemoved( const QString & ) ), SLOT( deviceRemoved( const QString & ) ) ); // HACK: Usability: Force auto-connection of device upon detection checkDevicesForIpod(); } void IpodCollectionFactory::ipodDetected( const QString &mountPoint, const QString &udi ) { DEBUG_BLOCK IpodCollection* coll = 0; if( !m_collectionMap.contains( udi ) ) { debug() << "New Ipod not seen before"; coll = new IpodCollection( mountPoint, udi ); if( coll ) { // TODO: connect to MediaDeviceMonitor signals connect( coll, SIGNAL( collectionDisconnected( const QString &) ), this, SLOT( slotCollectionDisconnected( const QString & ) ) ); m_collectionMap.insert( udi, coll ); emit newCollection( coll ); debug() << "emitting new ipod collection"; } } } void IpodCollectionFactory::deviceRemoved( const QString &udi ) { DEBUG_BLOCK if( m_collectionMap.contains( udi ) ) { IpodCollection* coll = m_collectionMap[ udi ]; if( coll ) { m_collectionMap.remove( udi ); // remove from map coll->deviceRemoved(); //collection will be deleted by collectionmanager } else warning() << "collection already null"; } else warning() << "removing non-existent device"; return; } void IpodCollectionFactory::slotCollectionDisconnected( const QString & udi) { m_collectionMap.remove( udi ); // remove from map } void IpodCollectionFactory::slotCollectionReady() { DEBUG_BLOCK IpodCollection collection = dynamic_cast if( collection ) { debug() << "emitting ipod collection newcollection"; emit newCollection( collection ); } } void IpodCollectionFactory::checkDevicesForIpod() { QStringList udiList = MediaDeviceMonitor::instance()->getDevices(); / foreach( const QString &udi, udiList ) { / if ipod device found, emit signal */ if( isIpod( udi ) ) { // HACK: Usability: Force auto-connection of device upon detection QString mountpoint = MediaDeviceCache::instance()->volumeMountPoint(udi); ipodDetected( mountpoint, udi ); //MediaDeviceInfo deviceinfo = new IpodDeviceInfo( mountpoint, udi ); //emit ipodDetected( deviceinfo ); // HACK: emit old signal to avoid refactor of applet yet emit tellIpodDetected( mountpoint, udi ); } } } bool IpodCollectionFactory::isIpod( const QString &udi ) const { DEBUG_BLOCK Solid::Device device; device = Solid::Device(udi); / going until we reach a vendor, e.g. Apple / while ( device.isValid() && device.vendor().isEmpty() ) { device = Solid::Device( device.parentUdi() ); } debug() << "Device udi: " << udi; debug() << "Device name: " <<>deviceName(udi); debug() << "Mount point: " <<>volumeMountPoint(udi); if ( device.isValid() ) { debug() << "vendor: " << device.vendor() << ", product: " << device.product(); } / if iPod found, return true */ return device.product() == "iPod"; } After: AMAROK_EXPORT_PLUGIN( IpodCollectionFactory ) IpodCollectionFactory::IpodCollectionFactory() : MediaDeviceCollectionFactory { //nothing to do } IpodCollectionFactory::~IpodCollectionFactory() { DEBUG_BLOCK } ---------------------------------------------------------------------------------------------- As you can see (excuse the bad formatting, blogger doesn't take kindly to source code), the amount of code required has been greatly reduced, and the other required classes are soon to follow. Also, things are going to be implemented more in the predictably correct classes now, and after refactoring is done and I've ported both Ipods and MTPs to it, I will write a small tutorial on how to go about implementing your own device. No, UMS will be done by me, heh, but it should be a piece of cake afterward to implement support for some of the other devices some of you miss from Amarok 1.4, so yay! Unfortunately I'm fairly busy with school too so this proceeds in big bumps every 4-7 days, might take a bit, but getting there. I'm going to Boston next weekend for the KDE GSoC meetup, which should be fun. If you're around, do say hello! |
Amarok LinksCalendarQuicksearchCategoriesSyndicate This BlogBlog Administration |

