From fede420573166cc2b82f7780f57648a6ab2f0487 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 9 Feb 2013 20:03:38 -0600 Subject: Fix FTBFS --- amarok/src/tracktooltip.cpp | 351 ++++++++++++++++++++++++++++++++++++++++++ amarok/src/tracktooltip.h | 65 ++++++++ amarok/src/tractdetooltip.cpp | 351 ------------------------------------------ amarok/src/tractdetooltip.h | 65 -------- 4 files changed, 416 insertions(+), 416 deletions(-) create mode 100644 amarok/src/tracktooltip.cpp create mode 100644 amarok/src/tracktooltip.h delete mode 100644 amarok/src/tractdetooltip.cpp delete mode 100644 amarok/src/tractdetooltip.h diff --git a/amarok/src/tracktooltip.cpp b/amarok/src/tracktooltip.cpp new file mode 100644 index 00000000..08cae102 --- /dev/null +++ b/amarok/src/tracktooltip.cpp @@ -0,0 +1,351 @@ +/* + 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. +*/ + +/* + tracktooltip.cpp + begin: Tue 10 Feb 2004 + copyright: (C) 2004 by Christian Muehlhaeuser + email: chris@chris.de + + copyright: (C) 2005 by Gábor Lehel + email: illissius@gmail.com +*/ + +#include "amarok.h" +#include "app.h" +#include "amarokconfig.h" +#include "debug.h" +#include "metabundle.h" +#include "moodbar.h" +#include "collectiondb.h" +#include "playlist.h" +#include "playlistitem.h" +#include "podcastbundle.h" +#include +#include + + +#include "tracktooltip.h" + + +TrackToolTip *TrackToolTip::instance() +{ + static TrackToolTip tip; + return &tip; +} + +TrackToolTip::TrackToolTip(): m_haspos( false ) +{ + connect( CollectionDB::instance(), TQT_SIGNAL( coverChanged( const TQString &, const TQString & ) ), + this, TQT_SLOT( slotCoverChanged( const TQString &, const TQString & ) ) ); + connect( CollectionDB::instance(), TQT_SIGNAL( imageFetched( const TQString & ) ), + this, TQT_SLOT( slotImageChanged( const TQString & ) ) ); + connect( Playlist::instance(), TQT_SIGNAL( columnsChanged() ), this, TQT_SLOT( slotUpdate() ) ); + connect( CollectionDB::instance(), TQT_SIGNAL( scoreChanged( const TQString&, float ) ), + this, TQT_SLOT( slotUpdate( const TQString& ) ) ); + connect( CollectionDB::instance(), TQT_SIGNAL( ratingChanged( const TQString&, int ) ), + this, TQT_SLOT( slotUpdate( const TQString& ) ) ); + // Only connect this once -- m_tags exists for the lifetime of this instance + connect( &m_tags.moodbar(), TQT_SIGNAL( jobEvent( int ) ), + TQT_SLOT( slotMoodbarEvent() ) ); + // This is so the moodbar can be re-rendered when AlterMood is changed + connect( App::instance(), TQT_SIGNAL( moodbarPrefs( bool, bool, int, bool ) ), + TQT_SLOT( slotMoodbarEvent() ) ); + clear(); +} + +void TrackToolTip::addToWidget( TQWidget *widget ) +{ + if( widget && !m_widgets.containsRef( widget ) ) + { + m_widgets.append( widget ); + Amarok::ToolTip::add( this, widget ); + } +} + +void TrackToolTip::removeFromWidget( TQWidget *widget ) +{ + if( widget && m_widgets.containsRef( widget ) ) + { + Amarok::ToolTip::remove( widget ); + m_widgets.removeRef( widget ); + } +} + + +#define MOODBAR_WIDTH 150 + +void TrackToolTip::setTrack( const MetaBundle &tags, bool force ) +{ + if( force || m_tags != tags || m_tags.url() != tags.url() ) + { + m_haspos = false; + m_tooltip = TQString(); + + TQStringList left, right; + const TQString tableRow = "%1:%2"; + + TQString filename = "", title = ""; //special case these, put the first one encountered on top + + Playlist *playlist = Playlist::instance(); + const int n = playlist->numVisibleColumns(); + for( int i = 0; i < n; ++i ) + { + const int column = playlist->mapToLogicalColumn( i ); + + if( column == PlaylistItem::Score ) + { + const float score = CollectionDB::instance()->getSongPercentage( tags.url().path() ); + if( score > 0.f ) + { + right << TQString::number( score, 'f', 2 ); // 2 digits after decimal point + left << playlist->columnText( column ); + } + } + else if( column == PlaylistItem::Rating ) + { + const int rating = CollectionDB::instance()->getSongRating( tags.url().path() ); + if( rating > 0 ) + { + TQString s; + for( int i = 0; i < rating / 2; ++i ) + s += TQString( "" ) + .arg( locate( "data", "amarok/images/star.png" ) ) + .arg( TQFontMetrics( TQToolTip::font() ).height() ) + .arg( TQFontMetrics( TQToolTip::font() ).height() ); + if( rating % 2 ) + s += TQString( "" ) + .arg( locate( "data", "amarok/images/smallstar.png" ) ) + .arg( TQFontMetrics( TQToolTip::font() ).height() ) + .arg( TQFontMetrics( TQToolTip::font() ).height() ); + right << s; + left << playlist->columnText( column ); + } + } + else if( column == PlaylistItem::Mood ) + { + if( !AmarokConfig::showMoodbar() ) + continue; + + m_tags.moodbar().load(); + + switch( tags.moodbar_const().state() ) + { + case Moodbar::JobQueued: + case Moodbar::JobRunning: + right << tags.prettyText( column ); + left << playlist->columnText( column ); + break; + + case Moodbar::Loaded: + { + // Ok so this is a hack, but it works quite well. + // Save an image in the user's home directory just so + // it can be referenced in an tag. Store which + // moodbar is saved in m_moodbarURL so we don't have + // to re-save it every second. + left << playlist->columnText( column ); + TQString filename = ::locateLocal( "data", + "amarok/mood_tooltip.png" ); + int height = TQFontMetrics( TQToolTip::font() ).height() - 2; + + if( m_moodbarURL != tags.url().url() ) + { + TQPixmap moodbar + = const_cast( tags ).moodbar().draw( + MOODBAR_WIDTH, height ); + moodbar.save( filename, "PNG", 100 ); + m_moodbarURL = tags.url().url(); + } + + right << TQString( "" ) + .arg( filename ).arg( height ).arg( MOODBAR_WIDTH ); + } + break; + + default: + // no tag + break; + } + } + else if( column == PlaylistItem::PlayCount ) + { + const int count = CollectionDB::instance()->getPlayCount( tags.url().path() ); + if( count > 0 ) + { + right << TQString::number( count ); + left << playlist->columnText( column ); + } + } + else if( column == PlaylistItem::LastPlayed ) + { + const uint lastPlayed = CollectionDB::instance()->getLastPlay( tags.url().path() ).toTime_t(); + right << Amarok::verboseTimeSince( lastPlayed ); + left << playlist->columnText( column ); + } + else if( column == PlaylistItem::Filename && title.isEmpty() ) + filename = tags.prettyText( column ); + else if( column == PlaylistItem::Title && filename.isEmpty() ) + title = tags.prettyText( column ); + else if( column != PlaylistItem::Length ) + { + const TQString tag = tags.prettyText( column ); + if( !tag.isEmpty() ) + { + right << tag; + left << playlist->columnText( column ); + } + } + } + + if( !filename.isEmpty() ) + { + right.prepend( filename ); + left.prepend( playlist->columnText( PlaylistItem::Filename ) ); + } + else if( !title.isEmpty() ) + { + right.prepend( title ); + left.prepend( playlist->columnText( PlaylistItem::Title ) ); + } + + if( tags.length() > 0 ) //special case this too, always on the bottom + { + m_haspos = true; + right << "%9 / " + tags.prettyLength(); + left << playlist->columnText( PlaylistItem::Length ); + } + + //NOTE it seems to be necessary to
each element indivdually + m_tooltip += "
Amarok
"; + + m_tooltip += "%1"; //the cover gets substituted in, in tooltip() + m_cover = CollectionDB::instance()->podcastImage( tags, true ); + if( m_cover.isEmpty() || m_cover.contains( "nocover" ) != -1 ) + { + m_cover = CollectionDB::instance()->albumImage( tags, true, 150 ); + if ( m_cover == CollectionDB::instance()->notAvailCover() ) + m_cover = TQString(); + } + + m_tooltip += ""; + m_tooltip += "
"; + + if (tags.title().isEmpty() || tags.artist().isEmpty()) + // no title or no artist, so we add prettyTitle + m_tooltip += TQString ("") + .arg(tags.veryNiceTitle()); + for( uint x = 0; x < left.count(); ++x ) + if ( !right[x].isEmpty() ) + m_tooltip += tableRow.arg( left[x] ).arg( right[x] ); + + m_tooltip += "
%1
"; + + m_tags = tags; + updateWidgets(); + } +} + +void TrackToolTip::setPos( int pos ) +{ + if( m_pos != pos ) + { + m_pos = pos; + updateWidgets(); + } +} + +void TrackToolTip::clear() +{ + m_pos = 0; + m_cover = TQString(); + m_tooltip = i18n( "Amarok - rediscover your music" ); + m_tags = MetaBundle(); + m_tags.setUrl( KURL() ); + + updateWidgets(); +} + +TQPair TrackToolTip::toolTipText( TQWidget*, const TQPoint& ) const +{ + return TQPair( tooltip(), TQRect() ); +} + +void TrackToolTip::slotCoverChanged( const TQString &artist, const TQString &album ) +{ + if( artist == m_tags.artist() && album == m_tags.album() ) + { + m_cover = CollectionDB::instance()->albumImage( m_tags, true, 150 ); + if( m_cover == CollectionDB::instance()->notAvailCover() ) + m_cover = TQString(); + + updateWidgets(); + } +} + +void TrackToolTip::slotImageChanged( const TQString &remoteURL ) +{ + PodcastEpisodeBundle peb; + if( CollectionDB::instance()->getPodcastEpisodeBundle( m_tags.url().url(), &peb ) ) + { + PodcastChannelBundle pcb; + if( CollectionDB::instance()->getPodcastChannelBundle( peb.parent().url(), &pcb ) ) + { + if( pcb.imageURL().url() == remoteURL ) + { + m_cover = CollectionDB::instance()->podcastImage( remoteURL ); + if( m_cover == CollectionDB::instance()->notAvailCover() ) + m_cover = TQString(); + + updateWidgets(); + } + + } + } +} + +void TrackToolTip::slotUpdate( const TQString &url ) +{ + if( url.isNull() || url == m_tags.url().path() ) + setTrack( m_tags, true ); +} + +void +TrackToolTip::slotMoodbarEvent( void ) +{ + // Clear this so the moodbar gets redrawn + m_moodbarURL = TQString(); + // Reset the moodbar in case AlterMood has changed + m_tags.moodbar().reset(); + + setTrack( m_tags, true ); +} + + +TQString TrackToolTip::tooltip() const +{ + TQString tip = m_tooltip;; + if( !m_tags.isEmpty() ) + { + if( !m_cover.isEmpty() ) + tip = tip.arg( TQString( "
" + "" + "
" ).arg( m_cover ) ); + else + tip = tip.arg(""); + if( m_haspos ) + tip = tip.arg( MetaBundle::prettyLength( m_pos / 1000, true ) ); + } + return tip; +} + +void TrackToolTip::updateWidgets() +{ + Amarok::ToolTip::updateTip(); +} + +#include "tracktooltip.moc" diff --git a/amarok/src/tracktooltip.h b/amarok/src/tracktooltip.h new file mode 100644 index 00000000..62543313 --- /dev/null +++ b/amarok/src/tracktooltip.h @@ -0,0 +1,65 @@ +/* + 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. +*/ + +/* + tracktooltip.h - Provides an interface to a plain TQWidget, which is independent of KDE (bypassed to X11) + begin: Tue 10 Feb 2004 + copyright: (C) 2004 by Christian Muehlhaeuser + email: chris@chris.de +*/ + +#ifndef TRACKTOOLTIP_H +#define TRACKTOOLTIP_H + +#include +#include +#include + +#include "tooltip.h" + +class TQWidget; + +class TrackToolTip: public TQObject, public Amarok::ToolTipClient +{ + Q_OBJECT + + + public: + TrackToolTip(); + static TrackToolTip* instance(); + + void addToWidget( TQWidget *widget ); + void removeFromWidget( TQWidget *widget ); + + void setTrack( const MetaBundle &tags, bool force = false ); + void setPos( int pos ); + void clear(); + + public: + virtual TQPair toolTipText( TQWidget*, const TQPoint& ) const; + + private slots: + void slotCoverChanged( const TQString &artist, const TQString &album ); + void slotImageChanged( const TQString &remoteURL ); + void slotUpdate( const TQString &url = TQString() ); + void slotMoodbarEvent( void ); + + private: + TQString tooltip() const; + void updateWidgets(); + + static TrackToolTip *s_instance; + TQPtrList m_widgets; + MetaBundle m_tags; + int m_pos; + TQString m_cover; + TQString m_tooltip; + bool m_haspos; + TQString m_moodbarURL; +}; + +#endif diff --git a/amarok/src/tractdetooltip.cpp b/amarok/src/tractdetooltip.cpp deleted file mode 100644 index 08cae102..00000000 --- a/amarok/src/tractdetooltip.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/* - 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. -*/ - -/* - tracktooltip.cpp - begin: Tue 10 Feb 2004 - copyright: (C) 2004 by Christian Muehlhaeuser - email: chris@chris.de - - copyright: (C) 2005 by Gábor Lehel - email: illissius@gmail.com -*/ - -#include "amarok.h" -#include "app.h" -#include "amarokconfig.h" -#include "debug.h" -#include "metabundle.h" -#include "moodbar.h" -#include "collectiondb.h" -#include "playlist.h" -#include "playlistitem.h" -#include "podcastbundle.h" -#include -#include - - -#include "tracktooltip.h" - - -TrackToolTip *TrackToolTip::instance() -{ - static TrackToolTip tip; - return &tip; -} - -TrackToolTip::TrackToolTip(): m_haspos( false ) -{ - connect( CollectionDB::instance(), TQT_SIGNAL( coverChanged( const TQString &, const TQString & ) ), - this, TQT_SLOT( slotCoverChanged( const TQString &, const TQString & ) ) ); - connect( CollectionDB::instance(), TQT_SIGNAL( imageFetched( const TQString & ) ), - this, TQT_SLOT( slotImageChanged( const TQString & ) ) ); - connect( Playlist::instance(), TQT_SIGNAL( columnsChanged() ), this, TQT_SLOT( slotUpdate() ) ); - connect( CollectionDB::instance(), TQT_SIGNAL( scoreChanged( const TQString&, float ) ), - this, TQT_SLOT( slotUpdate( const TQString& ) ) ); - connect( CollectionDB::instance(), TQT_SIGNAL( ratingChanged( const TQString&, int ) ), - this, TQT_SLOT( slotUpdate( const TQString& ) ) ); - // Only connect this once -- m_tags exists for the lifetime of this instance - connect( &m_tags.moodbar(), TQT_SIGNAL( jobEvent( int ) ), - TQT_SLOT( slotMoodbarEvent() ) ); - // This is so the moodbar can be re-rendered when AlterMood is changed - connect( App::instance(), TQT_SIGNAL( moodbarPrefs( bool, bool, int, bool ) ), - TQT_SLOT( slotMoodbarEvent() ) ); - clear(); -} - -void TrackToolTip::addToWidget( TQWidget *widget ) -{ - if( widget && !m_widgets.containsRef( widget ) ) - { - m_widgets.append( widget ); - Amarok::ToolTip::add( this, widget ); - } -} - -void TrackToolTip::removeFromWidget( TQWidget *widget ) -{ - if( widget && m_widgets.containsRef( widget ) ) - { - Amarok::ToolTip::remove( widget ); - m_widgets.removeRef( widget ); - } -} - - -#define MOODBAR_WIDTH 150 - -void TrackToolTip::setTrack( const MetaBundle &tags, bool force ) -{ - if( force || m_tags != tags || m_tags.url() != tags.url() ) - { - m_haspos = false; - m_tooltip = TQString(); - - TQStringList left, right; - const TQString tableRow = "%1:%2"; - - TQString filename = "", title = ""; //special case these, put the first one encountered on top - - Playlist *playlist = Playlist::instance(); - const int n = playlist->numVisibleColumns(); - for( int i = 0; i < n; ++i ) - { - const int column = playlist->mapToLogicalColumn( i ); - - if( column == PlaylistItem::Score ) - { - const float score = CollectionDB::instance()->getSongPercentage( tags.url().path() ); - if( score > 0.f ) - { - right << TQString::number( score, 'f', 2 ); // 2 digits after decimal point - left << playlist->columnText( column ); - } - } - else if( column == PlaylistItem::Rating ) - { - const int rating = CollectionDB::instance()->getSongRating( tags.url().path() ); - if( rating > 0 ) - { - TQString s; - for( int i = 0; i < rating / 2; ++i ) - s += TQString( "" ) - .arg( locate( "data", "amarok/images/star.png" ) ) - .arg( TQFontMetrics( TQToolTip::font() ).height() ) - .arg( TQFontMetrics( TQToolTip::font() ).height() ); - if( rating % 2 ) - s += TQString( "" ) - .arg( locate( "data", "amarok/images/smallstar.png" ) ) - .arg( TQFontMetrics( TQToolTip::font() ).height() ) - .arg( TQFontMetrics( TQToolTip::font() ).height() ); - right << s; - left << playlist->columnText( column ); - } - } - else if( column == PlaylistItem::Mood ) - { - if( !AmarokConfig::showMoodbar() ) - continue; - - m_tags.moodbar().load(); - - switch( tags.moodbar_const().state() ) - { - case Moodbar::JobQueued: - case Moodbar::JobRunning: - right << tags.prettyText( column ); - left << playlist->columnText( column ); - break; - - case Moodbar::Loaded: - { - // Ok so this is a hack, but it works quite well. - // Save an image in the user's home directory just so - // it can be referenced in an tag. Store which - // moodbar is saved in m_moodbarURL so we don't have - // to re-save it every second. - left << playlist->columnText( column ); - TQString filename = ::locateLocal( "data", - "amarok/mood_tooltip.png" ); - int height = TQFontMetrics( TQToolTip::font() ).height() - 2; - - if( m_moodbarURL != tags.url().url() ) - { - TQPixmap moodbar - = const_cast( tags ).moodbar().draw( - MOODBAR_WIDTH, height ); - moodbar.save( filename, "PNG", 100 ); - m_moodbarURL = tags.url().url(); - } - - right << TQString( "" ) - .arg( filename ).arg( height ).arg( MOODBAR_WIDTH ); - } - break; - - default: - // no tag - break; - } - } - else if( column == PlaylistItem::PlayCount ) - { - const int count = CollectionDB::instance()->getPlayCount( tags.url().path() ); - if( count > 0 ) - { - right << TQString::number( count ); - left << playlist->columnText( column ); - } - } - else if( column == PlaylistItem::LastPlayed ) - { - const uint lastPlayed = CollectionDB::instance()->getLastPlay( tags.url().path() ).toTime_t(); - right << Amarok::verboseTimeSince( lastPlayed ); - left << playlist->columnText( column ); - } - else if( column == PlaylistItem::Filename && title.isEmpty() ) - filename = tags.prettyText( column ); - else if( column == PlaylistItem::Title && filename.isEmpty() ) - title = tags.prettyText( column ); - else if( column != PlaylistItem::Length ) - { - const TQString tag = tags.prettyText( column ); - if( !tag.isEmpty() ) - { - right << tag; - left << playlist->columnText( column ); - } - } - } - - if( !filename.isEmpty() ) - { - right.prepend( filename ); - left.prepend( playlist->columnText( PlaylistItem::Filename ) ); - } - else if( !title.isEmpty() ) - { - right.prepend( title ); - left.prepend( playlist->columnText( PlaylistItem::Title ) ); - } - - if( tags.length() > 0 ) //special case this too, always on the bottom - { - m_haspos = true; - right << "%9 / " + tags.prettyLength(); - left << playlist->columnText( PlaylistItem::Length ); - } - - //NOTE it seems to be necessary to
each element indivdually - m_tooltip += "
Amarok
"; - - m_tooltip += "%1"; //the cover gets substituted in, in tooltip() - m_cover = CollectionDB::instance()->podcastImage( tags, true ); - if( m_cover.isEmpty() || m_cover.contains( "nocover" ) != -1 ) - { - m_cover = CollectionDB::instance()->albumImage( tags, true, 150 ); - if ( m_cover == CollectionDB::instance()->notAvailCover() ) - m_cover = TQString(); - } - - m_tooltip += ""; - m_tooltip += "
"; - - if (tags.title().isEmpty() || tags.artist().isEmpty()) - // no title or no artist, so we add prettyTitle - m_tooltip += TQString ("") - .arg(tags.veryNiceTitle()); - for( uint x = 0; x < left.count(); ++x ) - if ( !right[x].isEmpty() ) - m_tooltip += tableRow.arg( left[x] ).arg( right[x] ); - - m_tooltip += "
%1
"; - - m_tags = tags; - updateWidgets(); - } -} - -void TrackToolTip::setPos( int pos ) -{ - if( m_pos != pos ) - { - m_pos = pos; - updateWidgets(); - } -} - -void TrackToolTip::clear() -{ - m_pos = 0; - m_cover = TQString(); - m_tooltip = i18n( "Amarok - rediscover your music" ); - m_tags = MetaBundle(); - m_tags.setUrl( KURL() ); - - updateWidgets(); -} - -TQPair TrackToolTip::toolTipText( TQWidget*, const TQPoint& ) const -{ - return TQPair( tooltip(), TQRect() ); -} - -void TrackToolTip::slotCoverChanged( const TQString &artist, const TQString &album ) -{ - if( artist == m_tags.artist() && album == m_tags.album() ) - { - m_cover = CollectionDB::instance()->albumImage( m_tags, true, 150 ); - if( m_cover == CollectionDB::instance()->notAvailCover() ) - m_cover = TQString(); - - updateWidgets(); - } -} - -void TrackToolTip::slotImageChanged( const TQString &remoteURL ) -{ - PodcastEpisodeBundle peb; - if( CollectionDB::instance()->getPodcastEpisodeBundle( m_tags.url().url(), &peb ) ) - { - PodcastChannelBundle pcb; - if( CollectionDB::instance()->getPodcastChannelBundle( peb.parent().url(), &pcb ) ) - { - if( pcb.imageURL().url() == remoteURL ) - { - m_cover = CollectionDB::instance()->podcastImage( remoteURL ); - if( m_cover == CollectionDB::instance()->notAvailCover() ) - m_cover = TQString(); - - updateWidgets(); - } - - } - } -} - -void TrackToolTip::slotUpdate( const TQString &url ) -{ - if( url.isNull() || url == m_tags.url().path() ) - setTrack( m_tags, true ); -} - -void -TrackToolTip::slotMoodbarEvent( void ) -{ - // Clear this so the moodbar gets redrawn - m_moodbarURL = TQString(); - // Reset the moodbar in case AlterMood has changed - m_tags.moodbar().reset(); - - setTrack( m_tags, true ); -} - - -TQString TrackToolTip::tooltip() const -{ - TQString tip = m_tooltip;; - if( !m_tags.isEmpty() ) - { - if( !m_cover.isEmpty() ) - tip = tip.arg( TQString( "
" - "" - "
" ).arg( m_cover ) ); - else - tip = tip.arg(""); - if( m_haspos ) - tip = tip.arg( MetaBundle::prettyLength( m_pos / 1000, true ) ); - } - return tip; -} - -void TrackToolTip::updateWidgets() -{ - Amarok::ToolTip::updateTip(); -} - -#include "tracktooltip.moc" diff --git a/amarok/src/tractdetooltip.h b/amarok/src/tractdetooltip.h deleted file mode 100644 index 62543313..00000000 --- a/amarok/src/tractdetooltip.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - 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. -*/ - -/* - tracktooltip.h - Provides an interface to a plain TQWidget, which is independent of KDE (bypassed to X11) - begin: Tue 10 Feb 2004 - copyright: (C) 2004 by Christian Muehlhaeuser - email: chris@chris.de -*/ - -#ifndef TRACKTOOLTIP_H -#define TRACKTOOLTIP_H - -#include -#include -#include - -#include "tooltip.h" - -class TQWidget; - -class TrackToolTip: public TQObject, public Amarok::ToolTipClient -{ - Q_OBJECT - - - public: - TrackToolTip(); - static TrackToolTip* instance(); - - void addToWidget( TQWidget *widget ); - void removeFromWidget( TQWidget *widget ); - - void setTrack( const MetaBundle &tags, bool force = false ); - void setPos( int pos ); - void clear(); - - public: - virtual TQPair toolTipText( TQWidget*, const TQPoint& ) const; - - private slots: - void slotCoverChanged( const TQString &artist, const TQString &album ); - void slotImageChanged( const TQString &remoteURL ); - void slotUpdate( const TQString &url = TQString() ); - void slotMoodbarEvent( void ); - - private: - TQString tooltip() const; - void updateWidgets(); - - static TrackToolTip *s_instance; - TQPtrList m_widgets; - MetaBundle m_tags; - int m_pos; - TQString m_cover; - TQString m_tooltip; - bool m_haspos; - TQString m_moodbarURL; -}; - -#endif -- cgit v1.2.1