[vlc-devel] commit: Ext/Qt: Enhance more information dialog ( Jean-Philippe André )

git version control git at videolan.org
Wed Feb 3 17:21:55 CET 2010


vlc | branch: master | Jean-Philippe André <jpeg at aena.via.ecp.fr> | Mon Feb  1 12:59:33 2010 +0100| [a80e0157e2c39b8b2b380b27b1bb5e9d083ce8d5] | committer: Jean-Philippe André 

Ext/Qt: Enhance more information dialog

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a80e0157e2c39b8b2b380b27b1bb5e9d083ce8d5
---

 modules/gui/qt4/dialogs/plugins.cpp |   96 +++++++++++++++++++++++++++++++++++
 modules/gui/qt4/dialogs/plugins.hpp |   15 ++++++
 2 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index 6bee71c..cac958a 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -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;
+}
diff --git a/modules/gui/qt4/dialogs/plugins.hpp b/modules/gui/qt4/dialogs/plugins.hpp
index 4fdde95..2f97e9f 100644
--- a/modules/gui/qt4/dialogs/plugins.hpp
+++ b/modules/gui/qt4/dialogs/plugins.hpp
@@ -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
 




More information about the vlc-devel mailing list