mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-07 03:56:28 +02:00
Extensions: info panel, fix layout and use shortdesc
This commit is contained in:
parent
5918f43bef
commit
6e6ee4eac6
@ -258,6 +258,11 @@ public:
|
|||||||
{
|
{
|
||||||
name = qfu( p_ext->psz_name );
|
name = qfu( p_ext->psz_name );
|
||||||
description = qfu( p_ext->psz_description );
|
description = qfu( p_ext->psz_description );
|
||||||
|
shortdesc = qfu( p_ext->psz_shortdescription );
|
||||||
|
if( description.isEmpty() )
|
||||||
|
description = shortdesc;
|
||||||
|
if( shortdesc.isEmpty() && !description.isEmpty() )
|
||||||
|
shortdesc = description;
|
||||||
title = qfu( p_ext->psz_title );
|
title = qfu( p_ext->psz_title );
|
||||||
author = qfu( p_ext->psz_author );
|
author = qfu( p_ext->psz_author );
|
||||||
version = qfu( p_ext->psz_version );
|
version = qfu( p_ext->psz_version );
|
||||||
@ -265,7 +270,7 @@ public:
|
|||||||
}
|
}
|
||||||
~ExtensionCopy() {}
|
~ExtensionCopy() {}
|
||||||
|
|
||||||
QString name, title, description, author, version, url;
|
QString name, title, description, shortdesc, author, version, url;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Extensions list model for the QListView */
|
/* Extensions list model for the QListView */
|
||||||
@ -403,23 +408,27 @@ void ExtensionItemDelegate::paint( QPainter *painter,
|
|||||||
pen.setBrush( option.palette.text() );
|
pen.setBrush( option.palette.text() );
|
||||||
}
|
}
|
||||||
pixpaint->setPen( pen );
|
pixpaint->setPen( pen );
|
||||||
|
QFontMetrics metrics = option.fontMetrics;
|
||||||
|
|
||||||
|
/// @todo Add extension's icon
|
||||||
|
|
||||||
// Title: bold
|
// Title: bold
|
||||||
font.setBold( true );
|
font.setBold( true );
|
||||||
pixpaint->setFont( font );
|
pixpaint->setFont( font );
|
||||||
pixpaint->drawText( QRect( 10, 5, width - 70, 20 ),
|
pixpaint->drawText( QRect( 10, 7, width - 70, metrics.height() ),
|
||||||
Qt::AlignLeft, ext->title );
|
Qt::AlignLeft, ext->title );
|
||||||
|
|
||||||
// Short description: normal
|
// Short description: normal
|
||||||
font.setBold( false );
|
font.setBold( false );
|
||||||
pixpaint->setFont( font );
|
pixpaint->setFont( font );
|
||||||
pixpaint->drawText( QRect( 10, 30, width - 40, 20 ),
|
pixpaint->drawText( QRect( 10, 7 + metrics.height(), width - 40,
|
||||||
Qt::AlignLeft, ext->description );
|
metrics.height() ),
|
||||||
|
Qt::AlignLeft, ext->shortdesc );
|
||||||
|
|
||||||
// Version: italic
|
// Version: italic
|
||||||
font.setItalic( true );
|
font.setItalic( true );
|
||||||
pixpaint->setFont( font );
|
pixpaint->setFont( font );
|
||||||
pixpaint->drawText( QRect( width - 50, 5, 20, 20 ),
|
pixpaint->drawText( QRect( width - 40, 7, 20, metrics.height() ),
|
||||||
Qt::AlignLeft, ext->version );
|
Qt::AlignLeft, ext->version );
|
||||||
|
|
||||||
// Flush paint operations
|
// Flush paint operations
|
||||||
@ -435,7 +444,7 @@ QSize ExtensionItemDelegate::sizeHint( const QStyleOptionViewItem &option,
|
|||||||
if (index.isValid() && index.column() == 0)
|
if (index.isValid() && index.column() == 0)
|
||||||
{
|
{
|
||||||
QFontMetrics metrics = option.fontMetrics;
|
QFontMetrics metrics = option.fontMetrics;
|
||||||
return QSize( 200, 20 + 2 * metrics.height() );
|
return QSize( 200, 14 + 2 * metrics.height() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return QSize();
|
return QSize();
|
||||||
@ -452,14 +461,18 @@ ExtensionInfoDialog::ExtensionInfoDialog( const ExtensionCopy& extension,
|
|||||||
// Let's be a modal dialog
|
// Let's be a modal dialog
|
||||||
setWindowModality( Qt::WindowModal );
|
setWindowModality( Qt::WindowModal );
|
||||||
|
|
||||||
|
// Window title
|
||||||
|
setWindowTitle( qtr( "About" ) + " " + extension.title );
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
QGridLayout *layout = new QGridLayout( this );
|
QGridLayout *layout = new QGridLayout( this );
|
||||||
|
|
||||||
// Icon
|
// Icon
|
||||||
|
/// @todo Use the extension's icon, when extensions will support icons :)
|
||||||
QLabel *icon = new QLabel( this );
|
QLabel *icon = new QLabel( this );
|
||||||
QPixmap pix( ":/logo/vlc48.png" );
|
QPixmap pix( ":/logo/vlc48.png" );
|
||||||
icon->setPixmap( pix );
|
icon->setPixmap( pix );
|
||||||
layout->addWidget( icon, 1, 0, 2, 1, Qt::AlignLeft );
|
layout->addWidget( icon, 1, 0, 2, 1 );
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
QLabel *label = new QLabel( extension.title, this );
|
QLabel *label = new QLabel( extension.title, this );
|
||||||
@ -467,50 +480,55 @@ ExtensionInfoDialog::ExtensionInfoDialog( const ExtensionCopy& extension,
|
|||||||
font.setBold( true );
|
font.setBold( true );
|
||||||
font.setPointSizeF( font.pointSizeF() * 1.3f );
|
font.setPointSizeF( font.pointSizeF() * 1.3f );
|
||||||
label->setFont( font );
|
label->setFont( font );
|
||||||
layout->addWidget( label, 0, 0, 1, -1, Qt::AlignLeft );
|
layout->addWidget( label, 0, 0, 1, -1 );
|
||||||
|
|
||||||
// Version
|
// Version
|
||||||
label = new QLabel( this );
|
label = new QLabel( "<b>" + qtr( "Version" ) + ":</b>", this );
|
||||||
QString txt = qtr( "Version:" );
|
layout->addWidget( label, 1, 1, 1, 1 );
|
||||||
txt += extension.version;
|
label = new QLabel( extension.version, this );
|
||||||
label->setText( txt );
|
layout->addWidget( label, 1, 2, 1, 1 );
|
||||||
layout->addWidget( label, 1, 1, 1, 1, Qt::AlignLeft | Qt::AlignBottom );
|
|
||||||
|
|
||||||
// Author
|
// Author
|
||||||
label = new QLabel( this );
|
label = new QLabel( "<b>" + qtr( "Author" ) + ":</b>", this );
|
||||||
txt = qtr( "Author(s):" );
|
layout->addWidget( label, 2, 1, 1, 1 );
|
||||||
txt += extension.author;
|
label = new QLabel( extension.author, this );
|
||||||
label->setText( txt );
|
layout->addWidget( label, 2, 2, 1, 1 );
|
||||||
layout->addWidget( label, 2, 1, 1, 1, Qt::AlignLeft | Qt::AlignTop );
|
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
// FIXME: if( !extension.full_description.isEmpty() ) ...
|
// FIXME: if( !extension.full_description.isEmpty() ) ...
|
||||||
QTextBrowser *text = new QTextBrowser( this );
|
QTextBrowser *text = new QTextBrowser( this );
|
||||||
text->setHtml( extension.description );
|
text->setHtml( extension.description );
|
||||||
layout->addWidget( text, 4, 0, 1, -1, Qt::AlignJustify );
|
text->setOpenExternalLinks( true );
|
||||||
|
layout->addWidget( text, 4, 0, 1, -1 );
|
||||||
|
|
||||||
// URL
|
// URL
|
||||||
label = new QLabel( qtr( "Website:" ), this );
|
label = new QLabel( "<b>" + qtr( "Website" ) + ":</b>", this );
|
||||||
font = label->font();
|
layout->addWidget( label, 5, 0, 1, 1 );
|
||||||
font.setBold( true );
|
QString txt = "<a href=\"";
|
||||||
label->setFont( font );
|
txt += extension.url;
|
||||||
layout->addWidget( label, 5, 0, 1, 1, Qt::AlignLeft );
|
txt += "\">";
|
||||||
label = new QLabel( extension.url, this );
|
txt += extension.url;
|
||||||
label->setTextInteractionFlags( Qt::TextBrowserInteraction );
|
txt += "</a>";
|
||||||
layout->addWidget( label, 5, 1, 1, 1, Qt::AlignLeft );
|
label = new QLabel( txt, this );
|
||||||
|
label->setText( txt );
|
||||||
|
label->setOpenExternalLinks( true );
|
||||||
|
layout->addWidget( label, 5, 1, 1, -1 );
|
||||||
|
|
||||||
// Script file
|
// Script file
|
||||||
label = new QLabel( qtr( "File:" ), this );
|
label = new QLabel( "<b>" + qtr( "File" ) + ":</b>", this );
|
||||||
label->setFont( font );
|
layout->addWidget( label, 6, 0, 1, 1 );
|
||||||
layout->addWidget( label, 6, 0, 1, 1, Qt::AlignLeft );
|
|
||||||
QLineEdit *line = new QLineEdit( extension.name, this );
|
QLineEdit *line = new QLineEdit( extension.name, this );
|
||||||
layout->addWidget( line, 6, 1, 1, 1, Qt::AlignLeft );
|
layout->addWidget( line, 6, 1, 1, -1 );
|
||||||
|
|
||||||
// Close button
|
// Close button
|
||||||
QDialogButtonBox *group = new QDialogButtonBox( QDialogButtonBox::Close,
|
QDialogButtonBox *group = new QDialogButtonBox( QDialogButtonBox::Close,
|
||||||
Qt::Horizontal, this );
|
Qt::Horizontal, this );
|
||||||
layout->addWidget( group, 7, 0, 1, -1 );
|
layout->addWidget( group, 7, 0, 1, -1 );
|
||||||
connect( group, SIGNAL(accepted()), this, SLOT(close()) );
|
connect( group, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()) );
|
||||||
|
|
||||||
|
// Fix layout
|
||||||
|
layout->setColumnStretch( 2, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionInfoDialog::~ExtensionInfoDialog()
|
ExtensionInfoDialog::~ExtensionInfoDialog()
|
||||||
|
Loading…
Reference in New Issue
Block a user