Commit b6d883f4 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

ClipMetadataDisplayer: Trying to improve UI

parent ce3eb320
......@@ -181,6 +181,7 @@ ELSE(NOT WITH_GUI)
Gui/timeline/TracksRuler.cpp
Gui/timeline/TracksScene.cpp
Gui/timeline/TracksView.cpp
Gui/widgets/ElidableLabel.cpp
Gui/widgets/TrackControls.cpp
Gui/wizard/GeneralPage.cpp
Gui/wizard/OpenPage.cpp
......@@ -239,6 +240,7 @@ ELSE(NOT WITH_GUI)
Gui/timeline/TracksScene.h
Gui/timeline/TracksView.h
Gui/UndoStack.h
Gui/widgets/ElidableLabel.h
Gui/widgets/TrackControls.h
Gui/wizard/GeneralPage.h
Gui/wizard/OpenPage.h
......
......@@ -55,7 +55,7 @@ ClipMetadataDisplayer::metadataUpdated( const Media *media )
m_ui->nbVideoTracksValueLabel->setText( QString::number( media->nbVideoTracks() ) );
m_ui->nbAudioTracksValueLabel->setText( QString::number( media->nbAudioTracks() ) );
//Path:
m_ui->pathValueLabel->setText( media->fileInfo()->filePath() );
m_ui->pathValueLabel->setText( media->fileInfo()->absoluteFilePath() );
}
void
......
......@@ -28,20 +28,25 @@
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameValueLabel">
<property name="text">
<string>unnamed</string>
<string>Name</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="durationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Duration</string>
</property>
......@@ -49,6 +54,15 @@
</item>
<item row="2" column="1">
<widget class="QLabel" name="durationValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>---</string>
</property>
......@@ -57,7 +71,7 @@
<item row="3" column="0">
<widget class="QLabel" name="resolutionLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -70,11 +84,14 @@
<item row="3" column="1">
<widget class="QLabel" name="resolutionValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>---</string>
</property>
......@@ -83,7 +100,7 @@
<item row="4" column="0">
<widget class="QLabel" name="fpsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -95,6 +112,15 @@
</item>
<item row="4" column="1">
<widget class="QLabel" name="fpsValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>---</string>
</property>
......@@ -102,6 +128,12 @@
</item>
<item row="5" column="0">
<widget class="QLabel" name="nbVideoTracks">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Number of video tracks</string>
</property>
......@@ -109,6 +141,12 @@
</item>
<item row="6" column="0">
<widget class="QLabel" name="nbAudioTracks">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Number of audio tracks</string>
</property>
......@@ -116,6 +154,15 @@
</item>
<item row="6" column="1">
<widget class="QLabel" name="nbAudioTracksValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>0</string>
</property>
......@@ -123,6 +170,15 @@
</item>
<item row="5" column="1">
<widget class="QLabel" name="nbVideoTracksValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>0</string>
</property>
......@@ -130,13 +186,44 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="pathLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Path</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>unnamed</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="pathValueLabel">
<widget class="ElidableLabel" name="pathValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>---</string>
</property>
......@@ -160,6 +247,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ElidableLabel</class>
<extends>QLabel</extends>
<header>ElidableLabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
/*****************************************************************************
* ElidableLabel.cpp: Provide a QLabel with elidable text in it.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "ElidableLabel.h"
#include <QResizeEvent>
ElidableLabel::ElidableLabel( QWidget *parent ) : QLabel( parent ),
m_elideMode( Qt::ElideMiddle )
{
}
ElidableLabel::ElidableLabel( const QString &text, QWidget *parent ) :
QLabel( text, parent ),
m_elideMode( Qt::ElideMiddle ),
m_text( text )
{
setToolTip( text );
}
void
ElidableLabel::resizeEvent( QResizeEvent *event )
{
QFontMetrics fm( fontMetrics() );
QString str = fm.elidedText( m_text, m_elideMode, event->size().width() );
QLabel::setText( str );
QLabel::resizeEvent( event );
}
Qt::TextElideMode
ElidableLabel::elideMode() const
{
return m_elideMode;
}
void
ElidableLabel::setElideMode( Qt::TextElideMode mode )
{
m_elideMode = mode;
}
QSize
ElidableLabel::minimumSizeHint() const
{
const QFontMetrics &fm = fontMetrics();
QSize size( fm.width("..."), fm.height() );
return size;
}
QSize
ElidableLabel::sizeHint() const
{
const QFontMetrics& fm = fontMetrics();
QSize size( fm.width( m_text ), fm.height());
return size;
}
void
ElidableLabel::setText( const QString &text )
{
m_text = text;
setToolTip( text );
QLabel::setText( text );
}
/*****************************************************************************
* ElidableLabel.h: Provide a QLabel with elidable text in it.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef ELIDABLELABEL_H
#define ELIDABLELABEL_H
#include <QLabel>
class ElidableLabel : public QLabel
{
Q_OBJECT
public:
ElidableLabel( QWidget* parent );
ElidableLabel( const QString& text, QWidget* parent );
Qt::TextElideMode elideMode() const;
void setElideMode( Qt::TextElideMode mode );
virtual QSize minimumSizeHint() const;
virtual QSize sizeHint() const;
void setText( const QString &text );
protected:
virtual void resizeEvent( QResizeEvent *event );
private:
Qt::TextElideMode m_elideMode;
QString m_text;
};
#endif // ELIDABLELABEL_H
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