QDialogButtonBox *box = new QDialogButtonBox;
QPushButton *okButton = new QPushButton( qtr( "&Close" ), this );
- box->addButton( okButton, QDialogButtonBox::AcceptRole );
+ box->addButton( okButton, QDialogButtonBox::RejectRole );
layout->addWidget( box );
BUTTONACT( okButton, close() );
- readSettings( "PluginsDialog", QSize( 435, 280 ) );
+ restoreWidgetPosition( "PluginsDialog", QSize( 435, 280 ) );
}
PluginDialog::~PluginDialog()
{
- writeSettings( "PluginsDialog" );
+ saveWidgetPosition( "PluginsDialog" );
}
/* Plugins tab */
-PluginTab::PluginTab( intf_thread_t *p_intf )
- : QVLCFrame( p_intf )
+PluginTab::PluginTab( intf_thread_t *p_intf_ )
+ : QVLCFrame( p_intf_ )
{
QGridLayout *layout = new QGridLayout( this );
this, search( const QString& ) );
setMinimumSize( 500, 300 );
- readSettings( "Plugins", QSize( 540, 400 ) );
+ restoreWidgetPosition( "Plugins", QSize( 540, 400 ) );
}
inline void PluginTab::FillTree()
{
- module_t **p_list = module_list_get( NULL );
- module_t *p_module;
+ size_t count;
+ module_t **p_list = module_list_get( &count );
- for( unsigned int i = 0; (p_module = p_list[i] ) != NULL; i++ )
+ for( unsigned int i = 0; i < count; i++ )
{
+ module_t *p_module = p_list[i];
+
QStringList qs_item;
qs_item << qfu( module_get_name( p_module, true ) )
<< qfu( module_get_capability( p_module ) )
PluginTab::~PluginTab()
{
- writeSettings( "Plugins" );
+ saveWidgetPosition( "Plugins" );
getSettings()->setValue( "Plugins/Header-State",
treePlugins->header()->saveState() );
}
bool PluginTreeItem::operator< ( const QTreeWidgetItem & other ) const
{
int col = treeWidget()->sortColumn();
- if( col == 2 )
+ if( col == PluginTab::SCORE )
return text( col ).toInt() < other.text( col ).toInt();
+ else if ( col == PluginTab::CAPABILITY )
+ {
+ if ( text( PluginTab::CAPABILITY ) == other.text( PluginTab::CAPABILITY ) )
+ return text( PluginTab::NAME ) < other.text( PluginTab::NAME );
+ else
+ return text( PluginTab::CAPABILITY ) < other.text( PluginTab::CAPABILITY );
+ }
return text( col ) < other.text( col );
}
/* Extensions tab */
-ExtensionTab::ExtensionTab( intf_thread_t *p_intf )
- : QVLCFrame( p_intf )
+ExtensionTab::ExtensionTab( intf_thread_t *p_intf_ )
+ : QVLCFrame( p_intf_ )
{
// Layout
QVBoxLayout *layout = new QVBoxLayout( this );
url = qfu( p_ext->psz_url );
icon = loadPixmapFromData( p_ext->p_icondata, p_ext->i_icondata_size );
}
- ~ExtensionCopy() {}
+ ~ExtensionCopy() { delete icon; }
QString name, title, description, shortdesc, author, version, url;
QPixmap *icon;
switch( role )
{
+ case Qt::DisplayRole:
+ return ((ExtensionCopy *)index.internalPointer())->title;
+ case Qt::DecorationRole:
+ return *((ExtensionCopy *)index.internalPointer())->icon;
+ case DescriptionRole:
+ return ((ExtensionCopy *)index.internalPointer())->shortdesc;
default:
return QVariant();
}
const QStyleOptionViewItem &option,
const QModelIndex &index ) const
{
- ExtensionCopy *ext = ( ExtensionCopy* ) index.internalPointer();
- assert( ext != NULL );
-
int width = option.rect.width();
// Pixmap: buffer where to draw
QFontMetrics metrics = option.fontMetrics;
// Icon
- if( ext->icon != NULL )
+ QPixmap icon = index.data( Qt::DecorationRole ).value<QPixmap>();
+ if( !icon.isNull() )
{
pixpaint->drawPixmap( 7, 7, 2*metrics.height(), 2*metrics.height(),
- *ext->icon );
+ icon );
}
// Title: bold
pixpaint->drawText( QRect( 17 + 2 * metrics.height(), 7,
width - 40 - 2 * metrics.height(),
metrics.height() ),
- Qt::AlignLeft, ext->title );
+ Qt::AlignLeft, index.data( Qt::DisplayRole ).toString() );
// Short description: normal
font.setBold( false );
pixpaint->drawText( QRect( 17 + 2 * metrics.height(),
7 + metrics.height(), width - 40,
metrics.height() ),
- Qt::AlignLeft, ext->shortdesc );
+ Qt::AlignLeft, index.data( ExtensionListModel::DescriptionRole ).toString() );
// Flush paint operations
delete pixpaint;
ExtensionInfoDialog::ExtensionInfoDialog( const ExtensionCopy& extension,
intf_thread_t *p_intf,
QWidget *parent )
- : QVLCDialog( parent, p_intf ),
- extension( new ExtensionCopy( extension ) )
+ : QVLCDialog( parent, p_intf )
{
// Let's be a modal dialog
setWindowModality( Qt::WindowModal );
// URL
label = new QLabel( "<b>" + qtr( "Website" ) + ":</b>", this );
layout->addWidget( label, 5, 0, 1, 2 );
- QString txt = "<a href=\"";
- txt += extension.url;
- txt += "\">";
- txt += extension.url;
- txt += "</a>";
- label = new QLabel( txt, this );
- label->setText( txt );
+ label = new QLabel( QString("<a href=\"%1\">%2</a>")
+ .arg( extension.url ).arg( extension.url )
+ , this );
label->setOpenExternalLinks( true );
layout->addWidget( label, 5, 2, 1, -1 );
label = new QLabel( "<b>" + qtr( "File" ) + ":</b>", this );
layout->addWidget( label, 6, 0, 1, 2 );
QLineEdit *line = new QLineEdit( extension.name, this );
+ line->setReadOnly( true );
layout->addWidget( line, 6, 2, 1, -1 );
// Close button
QDialogButtonBox *group = new QDialogButtonBox( this );
QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
- group->addButton( closeButton, QDialogButtonBox::AcceptRole );
+ group->addButton( closeButton, QDialogButtonBox::RejectRole );
BUTTONACT( closeButton, close() );
layout->addWidget( group, 7, 0, 1, -1 );
setMinimumSize( 450, 350 );
}
-ExtensionInfoDialog::~ExtensionInfoDialog()
-{
- delete extension;
-}
-
static QPixmap *loadPixmapFromData( char *data, int size )
{
if( !data || size <= 0 )