]> git.sesse.net Git - vlc/commitdiff
Ext/Qt: Enhance more information dialog
authorJean-Philippe André <jpeg@aena.via.ecp.fr>
Mon, 1 Feb 2010 11:59:33 +0000 (12:59 +0100)
committerJean-Philippe André <jpeg@videolan.org>
Wed, 3 Feb 2010 16:13:59 +0000 (17:13 +0100)
modules/gui/qt4/dialogs/plugins.cpp
modules/gui/qt4/dialogs/plugins.hpp

index 6bee71c38e0d437bc1f0dd3d81b5343ad88fcf89..cac958a5d8e336d74f7a9f9408c84651d5b90933 100644 (file)
@@ -231,6 +231,25 @@ void ExtensionTab::keyPressEvent( QKeyEvent *keyEvent )
     keyEvent->ignore();
 }
 
+// Show more information
+void ExtensionTab::moreInformation()
+{
+    if( !extList->selectionModel() ||
+        extList->selectionModel()->selectedIndexes().isEmpty() )
+
+    {
+        return;
+    }
+
+    QModelIndex index = extList->selectionModel()->selectedIndexes().first();
+    ExtensionCopy *ext = (ExtensionCopy*) index.internalPointer();
+    if( !ext )
+        return;
+
+    ExtensionInfoDialog dlg( *ext, p_intf, this );
+    dlg.exec();
+}
+
 /* Safe copy of the extension_t struct */
 class ExtensionCopy
 {
@@ -421,3 +440,80 @@ QSize ExtensionItemDelegate::sizeHint( const QStyleOptionViewItem &option,
     else
         return QSize();
 }
+
+/* "More information" dialog */
+
+ExtensionInfoDialog::ExtensionInfoDialog( const ExtensionCopy& extension,
+                                          intf_thread_t *p_intf,
+                                          QWidget *parent )
+       : QVLCDialog( parent, p_intf ),
+         extension( new ExtensionCopy( extension ) )
+{
+    // Let's be a modal dialog
+    setWindowModality( Qt::WindowModal );
+
+    // Layout
+    QGridLayout *layout = new QGridLayout( this );
+
+    // Icon
+    QLabel *icon = new QLabel( this );
+    QPixmap pix( ":/logo/vlc48.png" );
+    icon->setPixmap( pix );
+    layout->addWidget( icon, 1, 0, 2, 1, Qt::AlignLeft );
+
+    // Title
+    QLabel *label = new QLabel( extension.title, this );
+    QFont font = label->font();
+    font.setBold( true );
+    font.setPointSizeF( font.pointSizeF() * 1.3f );
+    label->setFont( font );
+    layout->addWidget( label, 0, 0, 1, -1, Qt::AlignLeft );
+
+    // Version
+    label = new QLabel( this );
+    QString txt = qtr( "Version:" );
+    txt += extension.version;
+    label->setText( txt );
+    layout->addWidget( label, 1, 1, 1, 1, Qt::AlignLeft | Qt::AlignBottom );
+
+    // Author
+    label = new QLabel( this );
+    txt = qtr( "Author(s):" );
+    txt += extension.author;
+    label->setText( txt );
+    layout->addWidget( label, 2, 1, 1, 1, Qt::AlignLeft | Qt::AlignTop );
+
+    // Description
+    // FIXME: if( !extension.full_description.isEmpty() ) ...
+    QTextBrowser *text = new QTextBrowser( this );
+    text->setHtml( extension.description );
+    layout->addWidget( text, 4, 0, 1, -1, Qt::AlignJustify );
+
+    // URL
+    label = new QLabel( qtr( "Website:" ), this );
+    font = label->font();
+    font.setBold( true );
+    label->setFont( font );
+    layout->addWidget( label, 5, 0, 1, 1, Qt::AlignLeft );
+    label = new QLabel( extension.url, this );
+    label->setTextInteractionFlags( Qt::TextBrowserInteraction );
+    layout->addWidget( label, 5, 1, 1, 1, Qt::AlignLeft );
+
+    // Script file
+    label = new QLabel( qtr( "File:" ), this );
+    label->setFont( font );
+    layout->addWidget( label, 6, 0, 1, 1, Qt::AlignLeft );
+    QLineEdit *line = new QLineEdit( extension.name, this );
+    layout->addWidget( line, 6, 1, 1, 1, Qt::AlignLeft );
+
+    // Close button
+    QDialogButtonBox *group = new QDialogButtonBox( QDialogButtonBox::Close,
+                                                    Qt::Horizontal, this );
+    layout->addWidget( group, 7, 0, 1, -1 );
+    connect( group, SIGNAL(accepted()), this, SLOT(close()) );
+}
+
+ExtensionInfoDialog::~ExtensionInfoDialog()
+{
+    delete extension;
+}
index 4fdde95770a96c3f8287caeb0164c9ab73cf227a..2f97e9fea5c64aee34ab5a082bfc40634bd73be0 100644 (file)
@@ -95,6 +95,10 @@ private:
     ExtensionTab( intf_thread_t *p_intf );
     virtual ~ExtensionTab();
 
+private slots:
+    void moreInformation();
+
+private:
     QListView *extList;
     QPushButton *butMoreInfo;
 
@@ -150,5 +154,16 @@ private:
     intf_thread_t *p_intf;
 };
 
+class ExtensionInfoDialog : public QVLCDialog
+{
+public:
+    ExtensionInfoDialog( const ExtensionCopy& extension,
+                         intf_thread_t *p_intf, QWidget *parent );
+    virtual ~ExtensionInfoDialog();
+
+private:
+    ExtensionCopy *extension;
+};
+
 #endif