]> 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 da515b84fc3660e9f7d161272bf34faf26df6039..31187b7ec897f25a5d905a219eb847d3fd4c04a2 100644 (file)
@@ -70,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)
@@ -114,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" )
-            + "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 ) );
@@ -141,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 */
@@ -176,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();
@@ -187,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 */
@@ -241,7 +249,16 @@ void UpdateDialog::updateNotify( bool b_result )
                 .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();