CONNECT( seqtot_text, textEdited( QString ), this, enterEditMode() );
CONNECT( date_text, textEdited( QString ), this, enterEditMode() );
+ CONNECT( THEMIM->getIM(), artChanged( QString ), this, enterEditMode() );
/* CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/
/* We are not yet in Edit Mode */
#include <QTimer>
#include <QSlider>
#include <QBitmap>
+#include <QUrl>
#ifdef Q_WS_X11
# include <X11/Xlib.h>
CONNECT( action, triggered(), this, askForUpdate() );
addAction( action );
+ action = new QAction( qtr( "Cover art from file" ), this );
+ CONNECT( action, triggered(), this, setArtFromFile() );
+ addAction( action );
+
showArtUpdate( "" );
}
THEMIM->getIM()->requestArtUpdate( p_item );
}
+void CoverArtLabel::setArtFromFile()
+{
+ if( !p_item )
+ return;
+
+ QString filePath = QFileDialog::getOpenFileName( this, qtr( "Choose Image" ),
+ p_intf->p_sys->filepath, qtr( "Image Files (*.gif *.jpg *.jpeg *.png)" ) );
+
+ if( filePath.isEmpty() )
+ return;
+
+ QString fileUrl = QUrl::fromLocalFile( filePath ).toString();
+
+ THEMIM->getIM()->setArt( p_item, fileUrl );
+}
+
TimeLabel::TimeLabel( intf_thread_t *_p_intf, TimeLabel::Display _displayType )
: ClickableQLabel(), p_intf( _p_intf ), bufTimer( new QTimer(this) ),
buffering( false ), showBuffering(false), bufVal( -1 ), displayType( _displayType )
void showArtUpdate( const QString& );
void showArtUpdate( input_item_t * );
void askForUpdate();
+ void setArtFromFile();
};
#endif
#include <vlc_aout_intf.h>
#include <QApplication>
+#include <QFile>
#include <assert.h>
emit artChanged( artUrl );
}
+void InputManager::setArt( input_item_t *p_item, QString fileUrl )
+{
+ if( hasInput() )
+ {
+ char *psz_cachedir = config_GetUserDir( VLC_CACHE_DIR );
+ QString old_url = THEMIM->getIM()->decodeArtURL( p_item );
+
+ if( old_url.startsWith( QString::fromUtf8( psz_cachedir ) ) )
+ QFile( old_url ).remove(); /* Purge cached artwork */
+
+ free( psz_cachedir );
+
+ input_item_SetArtURL( p_item , fileUrl.toUtf8().constData() );
+ UpdateArt();
+ }
+}
+
inline void InputManager::UpdateStats()
{
assert( p_input );
bool hasVideo() { return hasInput() && b_video; }
bool hasVisualisation();
void requestArtUpdate( input_item_t *p_item );
+ void setArt( input_item_t *p_item, QString fileUrl );
QString getName() { return oldName; }
static const QString decodeArtURL( input_item_t *p_item );