]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Qt4 - Windows registry manipulation. Create the good HKEY where there should be,...
[vlc] / modules / gui / qt4 / main_interface.cpp
index 5675a59b5383442fbd795215f989cf13a19b394a..672da8ec211027aad2ef560362e25210de067909 100644 (file)
@@ -22,6 +22,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include "qt4.hpp"
 #include "main_interface.hpp"
@@ -152,7 +155,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     b_remainingTime = false;
     timeLabel = new TimeLabel;
     timeLabel->setText( " --:--/--:-- " );
-    timeLabel->setAlignment( Qt::AlignRight );
+    timeLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
     nameLabel = new QLabel;
     nameLabel->setTextInteractionFlags( Qt::TextSelectableByMouse
                                       | Qt::TextSelectableByKeyboard );
@@ -194,7 +197,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     bool b_systrayAvailable = QSystemTrayIcon::isSystemTrayAvailable();
     if( config_GetInt( p_intf, "qt-start-minimized") )
     {
-        if( b_systrayAvailable ){
+        if( b_systrayAvailable )
+        {
             b_createSystray = true;
             hide(); //FIXME BUG HERE
         }
@@ -293,7 +297,15 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     move( settings->value( "pos", QPoint( 0, 0 ) ).toPoint() );
 
-    resize( settings->value( "size", QSize( 350, 60 ) ).toSize() );
+    QSize newSize = settings->value( "size", QSize( 350, 60 ) ).toSize();
+    if( newSize.isValid() )
+    {
+        resize( newSize );
+    }
+    else
+    {
+        msg_Warn( p_intf, "Invalid size in constructor" );
+    }
 
     int tgPlay = settings->value( "playlist-visible", 0 ).toInt();
     settings->endGroup();
@@ -309,6 +321,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
 MainInterface::~MainInterface()
 {
+    msg_Dbg( p_intf, "Destroying the main interface" );
+
     if( playlistWidget ) playlistWidget->savingSettings( settings );
     if( ExtendedDialog::exists() )
         ExtendedDialog::getInstance( p_intf )->savingSettings();
@@ -342,6 +356,7 @@ MainInterface::~MainInterface()
     p_intf->pf_request_window = NULL;
     p_intf->pf_release_window = NULL;
     p_intf->pf_control_window = NULL;
+    p_intf->p_sys->p_mi = NULL;
 }
 
 /*****************************
@@ -431,7 +446,7 @@ inline void MainInterface::privacy()
     /**
      * Ask for the network policy on FIRST STARTUP
      **/
-    if( config_GetInt( p_intf, "privacy-ask") )
+    if( config_GetInt( p_intf, "qt-privacy-ask") )
     {
         QList<ConfigControl *> controls;
         if( privacyDialog( controls ) == QDialog::Accepted )
@@ -443,7 +458,7 @@ inline void MainInterface::privacy()
                 c->doApply( p_intf );
             }
 
-            config_PutInt( p_intf,  "privacy-ask" , 0 );
+            config_PutInt( p_intf,  "qt-privacy-ask" , 0 );
             config_SaveConfigFile( p_intf, NULL );
         }
     }
@@ -463,11 +478,10 @@ int MainInterface::privacyDialog( QList<ConfigControl *> controls )
         "<p>The <i>VideoLAN Team</i> doesn't like when an application goes "
         "online without authorization.</p>\n "
         "<p><i>VLC media player</i> can request limited information on "
-        "Internet, espically to get CD Covers and songs metadata or to know "
+        "the Internet, especially to get CD covers and songs metadata or to know "
         "if updates are available.</p>\n"
         "<p><i>VLC media player</i> <b>DOES NOT</b> send or collect <b>ANY</b> "
-        "information, even anonymously about your "
-        "usage.</p>\n"
+        "information, even anonymously, about your usage.</p>\n"
         "<p>Therefore please check the following options, the default being "
         "almost no access on the web.</p>\n") );
     text->setWordWrap( true );
@@ -504,8 +518,9 @@ int MainInterface::privacyDialog( QList<ConfigControl *> controls )
 
     CONFIG_GENERIC( "album-art", IntegerList ); line++;
     CONFIG_GENERIC_NOBOOL( "fetch-meta", Bool ); line++;
+#ifdef UPDATE_CHECK
     CONFIG_GENERIC_NOBOOL( "qt-updates-notif", Bool );
-
+#endif
     QPushButton *ok = new QPushButton( qtr( "Ok" ) );
 
     gLayout->addWidget( ok, 2, 2 );
@@ -738,8 +753,11 @@ void MainInterface::togglePlaylist()
         settings->endGroup();
         settings->beginGroup( "playlist" );
         dockPL->move( settings->value( "pos", QPoint( 0,0 ) ).toPoint() );
-        dockPL->resize( settings->value( "size", QSize( 400, 300 ) ).toSize() );
+        QSize newSize = settings->value( "size", QSize( 400, 300 ) ).toSize();
+        if( newSize.isValid() )
+            dockPL->resize( newSize );
         settings->endGroup();
+
         dockPL->show();
         playlistVisible = true;
     }
@@ -876,8 +894,6 @@ void MainInterface::updateOnTimer()
         need_components_update = false;
     }
 #endif
-
-    controls->updateOnTimer();
 }
 
 /*****************************************************************************
@@ -1120,9 +1136,15 @@ void MainInterface::wheelEvent( QWheelEvent *e )
 void MainInterface::closeEvent( QCloseEvent *e )
 {
     hide();
-    vlc_object_kill( p_intf );
-    QApplication::closeAllWindows();
-    QApplication::quit();
+    THEDP->quit();
+}
+
+void MainInterface::toggleFullScreen( void )
+{
+    if( isFullScreen() )
+        showNormal();
+    else
+        showFullScreen();
 }
 
 /*****************************************************************************