Commit e0d590f4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

* Qt4 : Use a QTreeWidget instead of a ui to display stats. I hope in that way...

* Qt4 : Use a QTreeWidget instead of a ui to display stats. I hope in that way it will become easier to resize and easier to add stats...

Btw about Qt4 modules, http://wiki.videolan.org/QtIntfTODO and http://wiki.videolan.org/Simple_Preferences have been updated. Give it a look and help us...

parent 018248d1
......@@ -18,7 +18,6 @@ TOUI = \
ui/open_disk \
ui/open_net \
ui/open \
ui/input_stats \
ui/main_interface \
ui/sprefs_audio \
ui/sprefs_interface \
......@@ -174,7 +173,6 @@ EXTRA_DIST += \
ui/open_disk.ui \
ui/open_net.ui \
ui/open.ui \
ui/input_stats.ui \
ui/main_interface.ui \
ui/sprefs_audio.ui \
ui/sprefs_interface.ui \
......
......@@ -29,59 +29,14 @@
#include <QPushButton>
#include <QHeaderView>
#include <QList>
#include <QGridLayout>
/************************************************************************
* Single panels
************************************************************************/
InputStatsPanel::InputStatsPanel( QWidget *parent, intf_thread_t *_p_intf ) :
QWidget( parent ), p_intf( _p_intf )
{
ui.setupUi( this );
}
InputStatsPanel::~InputStatsPanel()
{
}
void InputStatsPanel::update( input_item_t *p_item )
{
vlc_mutex_lock( &p_item->p_stats->lock );
#define UPDATE( widget,format, calc... ) \
{ QString str; ui.widget->setText( str.sprintf( format, ## calc ) ); }
UPDATE( read_text, "%8.0f", (float)(p_item->p_stats->i_read_bytes)/1000);
UPDATE( input_bitrate_text, "%6.0f",
(float)(p_item->p_stats->f_input_bitrate * 8000 ));
UPDATE( demuxed_text, "%8.0f",
(float)(p_item->p_stats->i_demux_read_bytes)/1000 );
UPDATE( stream_bitrate_text, "%6.0f",
(float)(p_item->p_stats->f_demux_bitrate * 8000 ));
/* Video */
UPDATE( vdecoded_text, "%5i", p_item->p_stats->i_decoded_video );
UPDATE( vdisplayed_text, "%5i", p_item->p_stats->i_displayed_pictures );
UPDATE( vlost_frames, "%5i", p_item->p_stats->i_lost_pictures );
/* Sout */
UPDATE( sent_text, "%5i", p_item->p_stats->i_sent_packets );
UPDATE( sent_bytes_text, "%8.0f",
(float)(p_item->p_stats->i_sent_bytes)/1000 );
UPDATE( send_bitrate_text, "%6.0f",
(float)(p_item->p_stats->f_send_bitrate*8)*1000 );
/* Audio*/
UPDATE( adecoded_text, "%5i", p_item->p_stats->i_decoded_audio );
UPDATE( aplayed_text, "%5i", p_item->p_stats->i_played_abuffers );
UPDATE( alost_text, "%5i", p_item->p_stats->i_lost_abuffers );
vlc_mutex_unlock(& p_item->p_stats->lock );
}
void InputStatsPanel::clear()
{
}
/* First Panel - Meta Info */
MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) :
QWidget( parent ), p_intf( _p_intf )
......@@ -148,6 +103,110 @@ void MetaPanel::clear()
{
}
/* Second Panel - Stats */
InputStatsPanel::InputStatsPanel( QWidget *parent, intf_thread_t *_p_intf ) :
QWidget( parent ), p_intf( _p_intf )
{
QGridLayout *layout = new QGridLayout(this);
StatsTree = new QTreeWidget(this);
QList<QTreeWidgetItem *> items;
layout->addWidget(StatsTree, 0, 0 );
StatsTree->setColumnCount( 3 );
StatsTree->header()->hide();
#define CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ) { \
itemName = \
new QTreeWidgetItem((QStringList () << itemText << itemValue << unit )); \
itemName->setTextAlignment( 1 , Qt::AlignRight ) ; }
#define CREATE_CATEGORY( catName, itemText ) { \
CREATE_TREE_ITEM( catName, itemText , "", "" ); \
catName->setExpanded( true ); \
StatsTree->addTopLevelItem( catName ); }
#define CREATE_AND_ADD_TO_CAT( itemName, itemText, itemValue, catName, unit ) { \
CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ); \
catName->addChild( itemName ); }
CREATE_CATEGORY( input, "Input" );
CREATE_CATEGORY( video, "Video" );
CREATE_CATEGORY( streaming, "Streaming" );
CREATE_CATEGORY( audio, "Audio" );
CREATE_AND_ADD_TO_CAT( read_media_stat, "Read at media", "0", input , "kB") ;
CREATE_AND_ADD_TO_CAT( input_bitrate_stat, "Input bitrate", "0", input, "kb/s") ;
CREATE_AND_ADD_TO_CAT( demuxed_stat, "Demuxed", "0", input, "kB") ;
CREATE_AND_ADD_TO_CAT( stream_bitrate_stat, "Stream bitrate", "0", input, "kb/s") ;
CREATE_AND_ADD_TO_CAT( vdecoded_stat, "Decoded blocks", "0", video, "" ) ;
CREATE_AND_ADD_TO_CAT( vdisplayed_stat, "Displayed frames", "0", video, "") ;
CREATE_AND_ADD_TO_CAT( vlost_frames_stat, "Lost frames", "0", video, "") ;
CREATE_AND_ADD_TO_CAT( send_stat, "Sent packets", "0", streaming, "") ;
CREATE_AND_ADD_TO_CAT( send_bytes_stat, "Sent bytes", "0", streaming, "kB") ;
CREATE_AND_ADD_TO_CAT( send_bitrate_stat, "Sent bitrates", "0", streaming, "kb/s") ;
CREATE_AND_ADD_TO_CAT( adecoded_stat, "Decoded blocks", "0", audio, "") ;
CREATE_AND_ADD_TO_CAT( aplayed_stat, "Played buffers", "0", audio, "") ;
CREATE_AND_ADD_TO_CAT( alost_stat, "Lost buffers", "0", audio, "") ;
input->setExpanded( true );
video->setExpanded( true );
streaming->setExpanded( true );
audio->setExpanded( true );
StatsTree->resizeColumnToContents( 0 );
StatsTree->setColumnWidth( 1 , 100 );
}
InputStatsPanel::~InputStatsPanel()
{
}
void InputStatsPanel::update( input_item_t *p_item )
{
vlc_mutex_lock( &p_item->p_stats->lock );
#define UPDATE( widget, format, calc... ) \
{ QString str; widget->setText( 1 , str.sprintf( format, ## calc ) ); }
UPDATE( read_media_stat, "%8.0f", (float)(p_item->p_stats->i_read_bytes)/1000);
UPDATE( input_bitrate_stat, "%6.0f",
(float)(p_item->p_stats->f_input_bitrate * 8000 ));
UPDATE( demuxed_stat, "%8.0f",
(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 ));
/* 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 );
/* Sout */
UPDATE( send_stat, "%5i", p_item->p_stats->i_sent_packets );
UPDATE( send_bytes_stat, "%8.0f",
(float)(p_item->p_stats->i_sent_bytes)/1000 );
UPDATE( send_bitrate_stat, "%6.0f",
(float)(p_item->p_stats->f_send_bitrate*8)*1000 );
/* Audio*/
UPDATE( adecoded_stat, "%5i", p_item->p_stats->i_decoded_audio );
UPDATE( aplayed_stat, "%5i", p_item->p_stats->i_played_abuffers );
UPDATE( alost_stat, "%5i", p_item->p_stats->i_lost_abuffers );
vlc_mutex_unlock(& p_item->p_stats->lock );
}
void InputStatsPanel::clear()
{
}
/* Third panel - Stream info */
InfoPanel::InfoPanel( QWidget *parent, intf_thread_t *_p_intf ) :
QWidget( parent ), p_intf( _p_intf )
{
......
......@@ -5,7 +5,7 @@
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* Jean-Baptiste Kempf <jb@videolan.org>
* 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
......@@ -29,26 +29,11 @@
#include <QWidget>
#include <QTabWidget>
#include "ui/input_stats.h"
#include <QLabel>
class QTreeWidget;
class QTreeWidgetItem;
class InputStatsPanel: public QWidget
{
Q_OBJECT;
public:
InputStatsPanel( QWidget *, intf_thread_t * );
virtual ~InputStatsPanel();
private:
intf_thread_t *p_intf;
Ui::InputStats ui;
public slots:
void update( input_item_t * );
void clear();
};
class MetaPanel: public QWidget
{
Q_OBJECT;
......@@ -72,6 +57,42 @@ private:
QLabel *nowplaying_text;
QLabel *publisher_text;
public slots:
void update( input_item_t * );
void clear();
};
class InputStatsPanel: public QWidget
{
Q_OBJECT;
public:
InputStatsPanel( QWidget *, intf_thread_t * );
virtual ~InputStatsPanel();
private:
intf_thread_t *p_intf;
QTreeWidget *StatsTree;
QTreeWidgetItem *input;
QTreeWidgetItem *read_media_stat;
QTreeWidgetItem *input_bitrate_stat;
QTreeWidgetItem *demuxed_stat;
QTreeWidgetItem *stream_bitrate_stat;
QTreeWidgetItem *video;
QTreeWidgetItem *vdecoded_stat;
QTreeWidgetItem *vdisplayed_stat;
QTreeWidgetItem *vlost_frames_stat;
QTreeWidgetItem *streaming;
QTreeWidgetItem *send_stat;
QTreeWidgetItem *send_bytes_stat;
QTreeWidgetItem *send_bitrate_stat;
QTreeWidgetItem *audio;
QTreeWidgetItem *adecoded_stat;
QTreeWidgetItem *aplayed_stat;
QTreeWidgetItem *alost_stat;
public slots:
void update( input_item_t * );
......@@ -87,7 +108,6 @@ public:
private:
intf_thread_t *p_intf;
QTreeWidget *InfoTree;
public slots:
void update( input_item_t * );
void clear();
......
<ui version="4.0" >
<class>InputStats</class>
<widget class="QWidget" name="InputStats" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>486</width>
<height>302</height>
</rect>
</property>
<property name="windowTitle" >
<string>_("Form")</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>_("Audio")</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QLabel" name="aplayed_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>_("Played buffers")</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="alost_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>_("Lost buffers")</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="adecoded_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>_("Decoded blocks")</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>_("Video")</string>
</property>
<widget class="QLabel" name="label_4" >
<property name="geometry" >
<rect>
<x>11</x>
<y>62</y>
<width>133</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>_("Displayed frames")</string>
</property>
</widget>
<widget class="QLabel" name="label_6" >
<property name="geometry" >
<rect>
<x>11</x>
<y>96</y>
<width>133</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>_("Lost frames")</string>
</property>
</widget>
<widget class="QLabel" name="label_2" >
<property name="geometry" >
<rect>
<x>11</x>
<y>28</y>
<width>133</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>_("Decoded blocks")</string>
</property>
</widget>
<widget class="QLabel" name="vlost_frames" >
<property name="geometry" >
<rect>
<x>150</x>
<y>96</y>
<width>50</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="vdisplayed_text" >
<property name="geometry" >
<rect>
<x>150</x>
<y>62</y>
<width>50</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="vdecoded_text" >
<property name="geometry" >
<rect>
<x>150</x>
<y>28</y>
<width>50</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>_("Streaming")</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="2" >
<widget class="QLabel" name="sent_bytes_text_3" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>kb/s</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="send_bitrate_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="sent_bytes_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="sent_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLabel" name="sent_bytes_text_2" >
<property name="text" >
<string>kB</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_13" >
<property name="text" >
<string>_("Send bitrate")</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_12" >
<property name="text" >
<string>_("Sent bytes")</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_11" >
<property name="text" >
<string>_("Sent packets")</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_14" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>_("Input")</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLabel" name="read_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="input_bitrate_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QLabel" name="sent_bytes_text_6" >
<property name="text" >
<string>kb/s</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLabel" name="sent_bytes_text_5" >
<property name="text" >
<string>kb/s</string>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QLabel" name="sent_bytes_text_4" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>kB</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLabel" name="stream_bitrate_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="demuxed_text" >
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>_("Demuxed")</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>_("Stream bitrate")</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>_("Read at media")</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>_("Input bitrate")</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="sent_bytes_text_7" >
<property name="text" >
<string>kB</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment