]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/help.cpp
Fix MacOSX update checking - inverted behavior
[vlc] / modules / gui / qt4 / dialogs / help.cpp
index 1ac16970358fbd77c69205ba9da844e50e858a59..c6ced9b08dc723933f377e319b4c706728e699be 100644 (file)
 
 HelpDialog *HelpDialog::instance = NULL;
 
-HelpDialog::HelpDialog( QWidget *parent, intf_thread_t *_p_intf )
-           : QVLCDialog( parent, _p_intf )
+HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
+
 {
     setWindowTitle( qtr( "Help" ) );
+    setMinimumSize( 250, 300 );
 
     QGridLayout *layout = new QGridLayout( this );
     QTextBrowser *helpBrowser = new QTextBrowser( this );
@@ -68,19 +69,23 @@ HelpDialog::HelpDialog( QWidget *parent, intf_thread_t *_p_intf )
     layout->addWidget( closeButton, 1, 3 );
 
     BUTTONACT( closeButton, close() );
+    readSettings( "Help", QSize( 400, 450 ) );
 }
 
 HelpDialog::~HelpDialog()
 {
+    writeSettings( "Help" );
 }
+
 void HelpDialog::close()
 {
-    this->toggleVisible();
+    toggleVisible();
 }
 
 AboutDialog *AboutDialog::instance = NULL;
 
-AboutDialog::AboutDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
+AboutDialog::AboutDialog( QWidget *parent, intf_thread_t *_p_intf)
+            : QVLCDialog( parent, _p_intf )
 {
     setWindowTitle( qtr( "About" ) );
     resize( 600, 500 );
@@ -117,10 +122,10 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
             + qfu( VLC_CompileBy() )+ "@" + qfu( VLC_CompileHost() ) + "."
             + qfu( VLC_CompileDomain() ) + ".\n"
             + "Compiler: " + qfu( VLC_Compiler() ) + ".\n"
-            + qtr( "Based on SVN revision: " ) + qfu( VLC_Changeset() ) + ".\n"
+            + qtr( "Based on Git commit: " ) + qfu( VLC_Changeset() ) + ".\n"
             + qtr( "You are using the Qt4 Interface.\n\n" )
             + qtr( "Copyright (c) " COPYRIGHT_YEARS " by the VideoLAN Team.\n" )
-            + "vlc@videolan.org, http://www.videolan.org" ); 
+            + "vlc@videolan.org, http://www.videolan.org" );
     infoLabel->setWordWrap( infoLabel );
 
     QLabel *iconVLC2 = new QLabel;
@@ -168,9 +173,10 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
 AboutDialog::~AboutDialog()
 {
 }
+
 void AboutDialog::close()
 {
-    this->toggleVisible();
+    toggleVisible();
 }
 
 #ifdef UPDATE_CHECK
@@ -179,7 +185,7 @@ void AboutDialog::close()
  * UpdateDialog
  *****************************************************************************/
 /* callback to get information from the core */
-static void UpdateCallback( void *data, vlc_bool_t b_ret )
+static void UpdateCallback( void *data, bool b_ret )
 {
     UpdateDialog* UDialog = (UpdateDialog *)data;
     QEvent* event;
@@ -197,7 +203,6 @@ UpdateDialog *UpdateDialog::instance = NULL;
 UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
     setWindowTitle( qtr( "Update" ) );
-    resize( 120, 80 );
 
     QGridLayout *layout = new QGridLayout( this );
 
@@ -208,7 +213,7 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
     buttonBox->addButton( updateButton, QDialogButtonBox::ActionRole );
     buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
 
-    updateLabel = new QLabel( qtr( "Checking for the update..." ) );
+    updateLabel = new QLabel( qtr( "Checking for an update..." ) );
     updateLabel->setWordWrap( true );
 
     layout->addWidget( updateLabel, 0, 0 );
@@ -218,9 +223,11 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
     BUTTONACT( closeButton, close() );
 
     /* Create the update structure */
-    initUpdate();
+    p_update = update_New( p_intf );
     b_checked = false;
 
+    readSettings( "Update", QSize( 120, 80 ) );
+
     /* Check for updates */
     UpdateOrDownload();
 }
@@ -228,6 +235,7 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 UpdateDialog::~UpdateDialog()
 {
     update_Delete( p_update );
+    writeSettings( "Update" );
 }
 
 void UpdateDialog::close()
@@ -241,13 +249,15 @@ void UpdateDialog::UpdateOrDownload()
     if( !b_checked )
     {
         updateButton->setEnabled( false );
+        msg_Dbg( p_intf, "Launching an update request" );
         update_Check( p_update, UpdateCallback, this );
     }
     else
     {
         updateButton->setEnabled( false );
-        QString dest_dir = QFileDialog::getExistingDirectory( this, qtr( "Select a directory ..." ),
-                                                              qfu( p_update->p_libvlc->psz_homedir ) );
+        QString dest_dir = QFileDialog::getExistingDirectory( this,
+                                 qtr( "Select a directory ..." ),
+                                 qfu( p_update->p_libvlc->psz_homedir ) );
 
         if( dest_dir != "" )
         {
@@ -274,26 +284,23 @@ void UpdateDialog::updateNotify( bool b_result )
     /* The update finish without errors */
     if( b_result )
     {
-        if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer )
+        if( update_NeedUpgrade( p_update ) )
         {
             b_checked = true;
             updateButton->setText( "Download" );
-            updateLabel->setText( qtr( "There is a new version of vlc :\n" ) + qfu( p_update->release.psz_desc )  );
+            updateLabel->setText( qtr( "There is a new version of VLC :\n" )
+                                + qfu( p_update->release.psz_desc )  );
         }
         else
-            updateLabel->setText( qtr( "You have the latest version of vlc" ) );
+            updateLabel->setText( qtr( "You have the latest version of VLC" ) );
     }
     else
-        updateLabel->setText( qtr( "An error occure while checking for updates" ) );
+        updateLabel->setText(
+                        qtr( "An error occurred while checking for updates" ) );
 
     adjustSize();
     updateButton->setEnabled( true );
 }
 
-/* Initialise the p_update struct */
-void UpdateDialog::initUpdate()
-{
-    p_update = update_New( p_intf );
-}
-
 #endif
+