extragear/multimedia/amarok/src
Martin Aumueller
aumueller at uni-koeln.de
Mon Jul 3 14:01:31 UTC 2006
Cool indeed: i also looked into this once but couldn't figure out how to do
it.
On Mon July 3 2006 15:53, Seb Ruiz wrote:
> SVN commit 557544 by seb:
>
> Cool new feature: dragging covers from the context browser shows the image,
> not the crappy default unknown mimetype icon! Caveat: Being unable to
> modify khtmlpartprivate variables has introduced a pretty irritating bug: a
> second drag is initiated once the first is finished. Looking at this.
>
>
> M +47 -5 htmlview.cpp
> M +5 -0 htmlview.h
>
>
> --- trunk/extragear/multimedia/amarok/src/htmlview.cpp #557543:557544
> @@ -1,4 +1,5 @@
> // (c) 2005 Christian Muehlhaeuser <chris at chris.de>
> +// (c) 2006 Seb Ruiz <me at sebruiz.net>
> // License: GNU General Public License V2
>
>
> @@ -68,11 +69,13 @@
> return QString::null; //FIXME: should actually return the
> default style sheet, then
>
> const QString pxSize = QString::number(
> ContextBrowser::instance()->fontMetrics().height() - 4 ); - const
> QString fontFamily = AmarokConfig::useCustomFonts() ?
> AmarokConfig::contextBrowserFont().family() :
> QApplication::font().family(); - const QString text =
> ContextBrowser::instance()->colorGroup().text().name(); - const
> QString link = ContextBrowser::instance()->colorGroup().link().name(); -
> const QString fg =
> ContextBrowser::instance()->colorGroup().highlightedText().name(); -
> const QString bg =
> ContextBrowser::instance()->colorGroup().highlight().name(); + const
> QString fontFamily = AmarokConfig::useCustomFonts() ? +
> AmarokConfig::contextBrowserFont().family() : +
> QApplication::font().family(); + const
> QString text = ContextBrowser::instance()->colorGroup().text().name(); +
> const QString link =
> ContextBrowser::instance()->colorGroup().link().name(); + const
> QString fg =
> ContextBrowser::instance()->colorGroup().highlightedText().name(); +
> const QString bg =
> ContextBrowser::instance()->colorGroup().highlight().name(); const QString
> base = ContextBrowser::instance()->colorGroup().base().name(); const
> QColor bgColor = ContextBrowser::instance()->colorGroup().highlight();
> QColor gradientColor = bgColor;
> @@ -253,5 +256,44 @@
> Playlist::instance()->insertMedia( url, Playlist::DirectPlay |
> Playlist::Unique ); }
>
> +#include "debug.h"
> +#include "qpixmap.h"
> +#include "qdragobject.h"
> +#include "kurldrag.h"
> +#include "collectiondb.h"
>
> +void HTMLView::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
> +{
> + QMouseEvent *mouse = event->qmouseEvent();
> +
> + QString url = event->url().string();
> +
> + if( mouse->state() & LeftButton && !url.isEmpty() &&
> url.startsWith("fetchcover") ) // clicking + {
> + KURL u = KURL::fromPathOrURL( url );
> + KURL::List list;
> + list << u;
> +
> + url = url.mid( 11 );
> +
> + QStringList params = QStringList::split( " @@@ ", url );
> + QString image = CollectionDB::instance()->albumImage( params[0],
> params[1] ); + QPixmap pix( image );
> +
> + KURLDrag *drag = new KURLDrag( list, PlaylistWindow::self() );
> +
> + drag->setPixmap( pix, QPoint( CollectionDB::DRAGPIXMAP_OFFSET_X,
> CollectionDB::DRAGPIXMAP_OFFSET_Y ) ); +
> + drag->dragCopy();
> +
> + /// khtmlPart wasn't very well designed. The only way to tell it
> that the drag finished, is to set a private + /// member,
> KHTMLPart::d->m_bMousePressed = false, which is of course impossible,
> because it is private. + /// TODO: GET AROUND IT!!!
> + return;
> + }
> +
> + // let KHTMLPart terminate
> + KHTMLPart::khtmlMouseMoveEvent( event );
> +}
> +
> #include "htmlview.moc"
> --- trunk/extragear/multimedia/amarok/src/htmlview.h #557543:557544
> @@ -1,10 +1,12 @@
> // (c) 2005 Christian Muehlhaeuser <chris at chris.de>
> +// (c) 2006 Seb Ruiz <me at sebruiz.net>
> // License: GNU General Public License V2
>
>
> #ifndef AMAROK_HTMLVIEW_H
> #define AMAROK_HTMLVIEW_H
>
> +#include <khtml_events.h>
> #include <khtml_part.h>
> #include <khtmlview.h>
>
> @@ -24,6 +26,9 @@
> static void paletteChange();
>
> private:
> + // for overloading the drag and drop image
> + void khtmlMouseMoveEvent( khtml::MouseMoveEvent *event );
> +
> static KTempFile *m_bgGradientImage;
> static KTempFile *m_headerGradientImage;
> static KTempFile *m_shadowGradientImage;
More information about the Amarok
mailing list