* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "qt4.hpp"
#include "components/info_panels.hpp"
+#include "components/interface_widgets.hpp"
+
+#include <assert.h>
+#include <vlc_url.h>
#include <QTreeWidget>
-#include <QListView>
-#include <QPushButton>
#include <QHeaderView>
#include <QList>
#include <QStringList>
#include <QLineEdit>
#include <QLabel>
#include <QSpinBox>
-#include <QTabWidget>
/************************************************************************
* Single panels
/* Title, artist and album*/
ADD_META( VLC_META_TITLE, title_text ); /* OK */
ADD_META( VLC_META_ARTIST, artist_text ); /* OK */
- ADD_META( VLC_META_COLLECTION, collection_text ); /* OK */
+ ADD_META( VLC_META_ALBUM, collection_text ); /* OK */
/* Genre Name */
/* TODO List id3genres.h is not includable yet ? */
genre_text = new QLineEdit;
metaLayout->addWidget( new QLabel( qtr( VLC_META_GENRE ) + " :" ), line, 0 );
- metaLayout->addWidget( genre_text, line, 1, 1, 4 );
+ metaLayout->addWidget( genre_text, line, 1, 1, 3 );
/* Number - on the same line */
- metaLayout->addWidget( new QLabel( qtr( "Track Number" ) + " :" ),
+ metaLayout->addWidget( new QLabel( qtr( VLC_META_TRACK_NUMBER ) + " :" ),
line, 5, 1, 2 );
seqnum_text = new QLineEdit;
seqnum_text->setInputMask("0000");
metaLayout->addWidget( rating_text, line, 6, 1, 1 );
*/
/* Language on the same line */
- metaLayout->addWidget( new QLabel( qfu( VLC_META_LANGUAGE ) + " :" ), line, 7, 1, 2 );
+ metaLayout->addWidget( new QLabel( qfu( VLC_META_LANGUAGE ) + " :" ), line, 5, 1, 2 );
language_text = new QLineEdit;
language_text->setReadOnly( true );
- metaLayout->addWidget( language_text, line, 9, 1, 1 );
+ metaLayout->addWidget( language_text, line, 7, 1, 3 );
line++;
/* ART_URL */
- art_cover = new QLabel( "" );
- art_cover->setMinimumHeight( 128 );
- art_cover->setMinimumWidth( 128 );
- art_cover->setMaximumHeight( 128 );
- art_cover->setMaximumWidth( 128 );
- art_cover->setScaledContents( true );
- art_cover->setPixmap( QPixmap( ":/noart.png" ) );
- metaLayout->addWidget( art_cover, line, 8, 4, 2 );
+ art_cover = new CoverArtLabel( this, p_intf );
+ metaLayout->addWidget( art_cover, line, 8, 4, 2, Qt::AlignRight );
/* Settings is unused */
/* l->addWidget( new QLabel( qtr( VLC_META_SETTING ) + " :" ), line, 5 );
nowplaying_text->setReadOnly( true );
ADD_META_2( VLC_META_PUBLISHER, publisher_text );
ADD_META_2( VLC_META_COPYRIGHT, copyright_text );
- ADD_META_2( "Comments", description_text );
+ ADD_META_2( N_("Comments"), description_text );
/* useless metadata */
/* ADD_META( TRACKID ) Useless ? */
/* ADD_URI - DO not show it, done outside */
+ metaLayout->setColumnStretch( 1, 2 );
+ metaLayout->setColumnMinimumWidth ( 1, 80 );
#undef ADD_META
#undef ADD_META_2
b_inEditMode = false;
}
-MetaPanel::~MetaPanel(){}
-
/**
* Update all the MetaData and art on an "item-changed" event
**/
void MetaPanel::update( input_item_t *p_item )
{
+ if( !p_item )
+ {
+ clear();
+ return;
+ }
+
/* Don't update if you are in edit mode */
if( b_inEditMode ) return;
else p_input = p_item;
free( psz_meta );
/* Name / Title */
- psz_meta = input_item_GetTitle( p_item );
- char *psz_name = input_item_GetName( p_item );
- if( !EMPTY_STR( psz_meta ) )
+ psz_meta = input_item_GetTitleFbName( p_item );
+ if( psz_meta )
+ {
title_text->setText( qfu( psz_meta ) );
- else if( !EMPTY_STR( psz_name ) )
- title_text->setText( qfu( psz_name ) );
- else title_text->setText( "" );
- free( psz_meta );
- free( psz_name );
+ free( psz_meta );
+ }
+ else
+ title_text->setText( "" );
/* URL / URI */
psz_meta = input_item_GetURL( p_item );
if( !EMPTY_STR( psz_meta ) )
- {
- emit uriSet( QString( psz_meta ) );
- free( psz_meta );
- }
+ emit uriSet( qfu( psz_meta ) );
else
{
free( psz_meta );
psz_meta = input_item_GetURI( p_item );
if( !EMPTY_STR( psz_meta ) )
- emit uriSet( QString( psz_meta ) );
+ emit uriSet( qfu( psz_meta ) );
}
+ free( psz_meta );
/* Other classic though */
UPDATE_META( Artist, artist_text );
UPDATE_META( NowPlaying, nowplaying_text );
UPDATE_META( Publisher, publisher_text );
// UPDATE_META( Setting, setting_text );
-// UPDATE_META( EncodedBy, encodedby_text );
+//FIXME this is wrong if has Publisher and EncodedBy fields
+ UPDATE_META( EncodedBy, publisher_text );
UPDATE_META( Date, date_text );
UPDATE_META( TrackNum, seqnum_text );
#undef UPDATE_META_INT
#undef UPDATE_META
- /* Art Urls */
- psz_meta = input_item_GetArtURL( p_item );
- if( psz_meta && !strncmp( psz_meta, "file://", 7 ) )
- {
- QString artUrl = qfu( psz_meta ).replace( "file://",QString("" ) );
- art_cover->setPixmap( QPixmap( artUrl ) );
- }
- else
- art_cover->setPixmap( QPixmap( ":/noart.png" ) );
- free( psz_meta );
+ // If a artURL is available as a local file, directly display it !
+
+ QString file;
+ char *psz_art = input_item_GetArtURL( p_item );
+ if( psz_art && !strncmp( psz_art, "file://", 7 ) &&
+ decode_URI( psz_art + 7 ) )
+#ifdef WIN32
+ file = qfu( psz_art + 8 ); // Remove extra / on Win32 URI.
+#else
+ file = qfu( psz_art + 7 );
+#endif
+ free( psz_art );
+
+ art_cover->showArtUpdate( file );
+
}
/**
**/
void MetaPanel::saveMeta()
{
- playlist_t *p_playlist;
-
- meta_export_t p_export;
- p_export.p_item = p_input;
-
if( p_input == NULL )
return;
- /* we can write meta data only in a file */
- vlc_mutex_lock( &p_input->lock );
- int i_type = p_input->i_type;
- vlc_mutex_unlock( &p_input->lock );
- if( i_type == ITEM_TYPE_FILE )
- {
- char *psz_uri_orig = input_item_GetURI( p_input );
- char *psz_uri = psz_uri_orig;
- if( !strncmp( psz_uri, "file://", 7 ) )
- psz_uri += 7; /* strlen("file://") = 7 */
-
- p_export.psz_file = strndup( psz_uri, PATH_MAX );
- free( psz_uri_orig );
- }
- else
- return;
-
/* now we read the modified meta data */
input_item_SetTitle( p_input, qtu( title_text->text() ) );
input_item_SetArtist( p_input, qtu( artist_text->text() ) );
input_item_SetPublisher( p_input, qtu( publisher_text->text() ) );
input_item_SetDescription( p_input, qtu( description_text->text() ) );
- p_playlist = pl_Yield( p_intf );
- PL_LOCK;
- p_playlist->p_private = &p_export;
-
- module_t *p_mod = module_Need( p_playlist, "meta writer", NULL, 0 );
- if( p_mod )
- module_Unneed( p_playlist, p_mod );
- PL_UNLOCK;
- pl_Release( p_playlist );
+ playlist_t *p_playlist = pl_Hold( p_intf );
+ input_item_WriteMeta( VLC_OBJECT(p_playlist), p_input );
+ pl_Release( p_intf );
/* Reset the status of the mode. No need to emit any signal because parent
is the only caller */
language_text->clear();
nowplaying_text->clear();
publisher_text->clear();
- art_cover;
setEditMode( false );
+ emit uriSet( "" );
}
/**
QGridLayout *layout = new QGridLayout(this);
QLabel *topLabel = new QLabel( qtr( "Extra metadata and other information"
- " are shown in this list.\n" ) );
+ " are shown in this panel.\n" ) );
topLabel->setWordWrap( true );
layout->addWidget( topLabel, 0, 0 );
extraMetaTree = new QTreeWidget( this );
extraMetaTree->setAlternatingRowColors( true );
extraMetaTree->setColumnCount( 2 );
+ extraMetaTree->resizeColumnToContents( 0 );
extraMetaTree->header()->hide();
/* QStringList headerList = ( QStringList() << qtr( "Type" )
* << qtr( "Value" ) );
**/
void ExtraMetaPanel::update( input_item_t *p_item )
{
+ if( !p_item )
+ {
+ clear();
+ return;
+ }
+
+ QList<QTreeWidgetItem *> items;
+
+ extraMetaTree->clear();
+
vlc_mutex_lock( &p_item->lock );
vlc_meta_t *p_meta = p_item->p_meta;
if( !p_meta )
+ {
+ vlc_mutex_unlock( &p_item->lock );
return;
- QStringList tempItem;
+ }
- QList<QTreeWidgetItem *> items;
vlc_dictionary_t * p_dict = &p_meta->extra_tags;
char ** ppsz_allkey = vlc_dictionary_all_keys( p_dict );
- for (int i = 0; ppsz_allkey[i] ; i++ )
+
+ for( int i = 0; ppsz_allkey[i] ; i++ )
{
const char * psz_value = (const char *)vlc_dictionary_value_for_key(
p_dict, ppsz_allkey[i] );
+ QStringList tempItem;
tempItem.append( qfu( ppsz_allkey[i] ) + " : ");
tempItem.append( qfu( psz_value ) );
items.append( new QTreeWidgetItem ( extraMetaTree, tempItem ) );
}
vlc_mutex_unlock( &p_item->lock );
free( ppsz_allkey );
+
extraMetaTree->addTopLevelItems( items );
+ extraMetaTree->resizeColumnToContents( 0 );
}
/**
QList<QTreeWidgetItem *> items;
QLabel *topLabel = new QLabel( qtr( "Information about what your media or"
- " stream is made of.\n Muxer, Audio and Video Codecs, Subtitles "
+ " stream is made of.\nMuxer, Audio and Video Codecs, Subtitles "
"are shown." ) );
topLabel->setWordWrap( true );
layout->addWidget( topLabel, 0, 0 );
layout->addWidget(InfoTree, 1, 0 );
}
-InfoPanel::~InfoPanel()
-{
-}
-
/**
* Update the Codecs information on parent->update()
**/
void InfoPanel::update( input_item_t *p_item)
{
+ if( !p_item )
+ {
+ clear();
+ return;
+ }
+
InfoTree->clear();
QTreeWidgetItem *current_item = NULL;
QTreeWidgetItem *child_item = NULL;
QList<QTreeWidgetItem *> items;
- QLabel *topLabel = new QLabel( qtr( "Various statistics about the current"
- " media or stream.\n Played and streamed info are shown." ) );
+ QLabel *topLabel = new QLabel( qtr( "Statistics about the currently "
+ "playing media or stream." ) );
topLabel->setWordWrap( true );
layout->addWidget( topLabel, 0, 0 );
CREATE_AND_ADD_TO_CAT( demuxed_stat, qtr("Demuxed"), "0", input, "kB") ;
CREATE_AND_ADD_TO_CAT( stream_bitrate_stat, qtr("Stream bitrate"),
"0", input, "kb/s" );
+ CREATE_AND_ADD_TO_CAT( corrupted_stat, qtr("Corrupted"),
+ "0", input, "" );
+ CREATE_AND_ADD_TO_CAT( discontinuity_stat, qtr("Discontinuities"),
+ "0", input, "" );
CREATE_AND_ADD_TO_CAT( vdecoded_stat, qtr("Decoded blocks"),
"0", video, "" );
"0", video, "" );
CREATE_AND_ADD_TO_CAT( vlost_frames_stat, qtr("Lost frames"),
"0", video, "" );
- CREATE_AND_ADD_TO_CAT( vfps_stat, qtr("FPS"), "0", video, "" );
CREATE_AND_ADD_TO_CAT( send_stat, qtr("Sent packets"), "0", streaming, "" );
CREATE_AND_ADD_TO_CAT( send_bytes_stat, qtr("Sent bytes"),
"0", streaming, "kB" );
- CREATE_AND_ADD_TO_CAT( send_bitrate_stat, qtr("Sent bitrates"),
+ CREATE_AND_ADD_TO_CAT( send_bitrate_stat, qtr("Sent bitrate"),
"0", streaming, "kb/s" );
CREATE_AND_ADD_TO_CAT( adecoded_stat, qtr("Decoded blocks"),
"0", audio, "" );
CREATE_AND_ADD_TO_CAT( alost_stat, qtr("Lost buffers"), "0", audio, "" );
+#undef CREATE_AND_ADD_TO_CAT
+#undef CREATE_CATEGORY
+#undef CREATE_TREE_ITEM
+
input->setExpanded( true );
video->setExpanded( true );
streaming->setExpanded( true );
audio->setExpanded( true );
StatsTree->resizeColumnToContents( 0 );
- StatsTree->setColumnWidth( 1 , 100 );
+ StatsTree->setColumnWidth( 1 , 200 );
layout->addWidget(StatsTree, 1, 0 );
}
-InputStatsPanel::~InputStatsPanel()
-{
-}
-
/**
* Update the Statistics
**/
void InputStatsPanel::update( input_item_t *p_item )
{
+ assert( p_item );
vlc_mutex_lock( &p_item->p_stats->lock );
#define UPDATE( widget, format, calc... ) \
(float)(p_item->p_stats->i_demux_read_bytes)/1000 );
UPDATE( stream_bitrate_stat, "%6.0f",
(float)(p_item->p_stats->f_demux_bitrate * 8000 ));
+ UPDATE( corrupted_stat, "%5i", p_item->p_stats->i_demux_corrupted );
+ UPDATE( discontinuity_stat, "%5i", p_item->p_stats->i_demux_discontinuity );
/* Video */
UPDATE( vdecoded_stat, "%5i", p_item->p_stats->i_decoded_video );
UPDATE( vdisplayed_stat, "%5i", p_item->p_stats->i_displayed_pictures );
UPDATE( vlost_frames_stat, "%5i", p_item->p_stats->i_lost_pictures );
-/* UPDATE( vfps_stat, "%5f", p_item->p_stats->i_lost_pictures );
-input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps */
/* Sout */
UPDATE( send_stat, "%5i", p_item->p_stats->i_sent_packets );
UPDATE( aplayed_stat, "%5i", p_item->p_stats->i_played_abuffers );
UPDATE( alost_stat, "%5i", p_item->p_stats->i_lost_abuffers );
+#undef UPDATE
+
vlc_mutex_unlock(& p_item->p_stats->lock );
}
void InputStatsPanel::clear()
{
}
+