]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/help.cpp
Qt: UpdateDialog: highlight security changes
[vlc] / modules / gui / qt4 / dialogs / help.cpp
index 1ee90002846296a548f2810529da5efda8bbb53f..31187b7ec897f25a5d905a219eb847d3fd4c04a2 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Help.cpp : Help and About dialogs
+ * help.cpp : Help and About dialogs
  ****************************************************************************
  * Copyright (C) 2007 the VideoLAN team
  * $Id$
@@ -43,7 +43,6 @@
 #include <QString>
 #include <QDialogButtonBox>
 #include <QEvent>
-#include <QFileDialog>
 #include <QDate>
 #include <QPushButton>
 
@@ -71,12 +70,12 @@ HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
     layout->addWidget( closeButtonBox );
 
     CONNECT( closeButtonBox, rejected(), this, close() );
-    readSettings( "Help", QSize( 500, 450 ) );
+    restoreWidgetPosition( "Help", QSize( 500, 450 ) );
 }
 
 HelpDialog::~HelpDialog()
 {
-    writeSettings( "Help" );
+    saveWidgetPosition( "Help" );
 }
 
 AboutDialog::AboutDialog( intf_thread_t *_p_intf)
@@ -115,10 +114,13 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf)
             + qfu( VLC_CompileBy() )+ " on " + qfu( VLC_CompileHost() ) +
             + " ("__DATE__" "__TIME__").\n"
             + qtr( "Compiler: " ) + qfu( VLC_Compiler() ) + ".\n"
-            + qtr( "You are using the Qt4 Interface.\n\n" )
+            + qtr( "You are using the Qt Interface.\n\n" )
             + qtr( "Copyright (C) " ) + COPYRIGHT_YEARS
             + qtr( " by the VideoLAN Team.\n" )
-            + "vlc@videolan.org, http://www.videolan.org" );
+            + "<a href=\"http://www.videolan.org\">http://www.videolan.org</a>" );
+
+    /* Be translators friendly: Convert to rich text */
+    ui.infoLabel->setText( ui.infoLabel->text().replace( "\n", "<br/>" ) );
 
     /* GPL License */
     ui.licenseEdit->setText( qfu( psz_license ) );
@@ -142,13 +144,18 @@ static void UpdateCallback( void *data, bool b_ret )
     QEvent* event;
 
     if( b_ret )
-        event = new QEvent( (QEvent::Type)UDOkEvent );
+        event = new QEvent( UpdateDialog::UDOkEvent );
     else
-        event = new QEvent( (QEvent::Type)UDErrorEvent );
+        event = new QEvent( UpdateDialog::UDErrorEvent );
 
     QApplication::postEvent( UDialog, event );
 }
 
+const QEvent::Type UpdateDialog::UDOkEvent =
+        (QEvent::Type)QEvent::registerEventType();
+const QEvent::Type UpdateDialog::UDErrorEvent =
+        (QEvent::Type)QEvent::registerEventType();
+
 UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
     /* build Ui */
@@ -177,9 +184,9 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
     b_checked = false;
 
     setMinimumSize( 300, 300 );
-    setMaximumSize( 400, 300 );
+    setMaximumSize( 500, 300 );
 
-    readSettings( "Update", QSize( 300, 250 ) );
+    restoreWidgetPosition( "Update", maximumSize() );
 
     /* Check for updates */
     UpdateOrDownload();
@@ -188,7 +195,7 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 UpdateDialog::~UpdateDialog()
 {
     update_Delete( p_update );
-    writeSettings( "Update" );
+    saveWidgetPosition( "Update" );
 }
 
 /* Check for updates */
@@ -201,10 +208,7 @@ void UpdateDialog::UpdateOrDownload()
     }
     else
     {
-        QString dest_dir = QFileDialog::getExistingDirectory( this,
-                                 qtr( I_OP_SEL_DIR ),
-                                 QVLCUserDir( VLC_DOWNLOAD_DIR ) );
-
+        QString dest_dir = QDir::tempPath();
         if( !dest_dir.isEmpty() )
         {
             dest_dir = toNativeSepNoSlash( dest_dir ) + DIR_SEP;
@@ -242,10 +246,19 @@ void UpdateDialog::updateNotify( bool b_result )
                 .arg( QString::number( p_release->i_major ) )
                 .arg( QString::number( p_release->i_minor ) )
                 .arg( QString::number( p_release->i_revision ) )
-                .arg( ( p_release->extra )?QString( p_release->extra ):"" );
+                .arg( p_release->i_extra == 0 ? "" : "." + QString::number( p_release->i_extra ) );
 
             ui.updateNotifyLabel->setText( message );
-            ui.updateNotifyTextEdit->setText( qfu( p_release->psz_desc ) );
+            message = qfu( p_release->psz_desc ).replace( "\n", "<br/>" );
+
+            /* Try to highlight releases featuring security changes */
+            int i_index = message.indexOf( "security", Qt::CaseInsensitive );
+            if ( i_index >= 0 )
+            {
+                message.insert( i_index + 8, "</font>" );
+                message.insert( i_index, "<font style=\"color:red\">" );
+            }
+            ui.updateNotifyTextEdit->setHtml( message );
 
             /* Force the dialog to be shown */
             this->show();