]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/firstrun.cpp
Qt: use __MIN when applicable
[vlc] / modules / gui / qt4 / dialogs / firstrun.cpp
index afaf98c93f91a6d97b445ae635d6f1ecc63b6a2a..4e3487f3ef0726c65c353d040a5e96aee9f85c35 100644 (file)
 
 #include "dialogs/firstrun.hpp"
 
-#include "components/preferences_widgets.hpp"
-
 #include <QGridLayout>
 #include <QGroupBox>
+#include <QCheckBox>
+#include <QLabel>
+#include <QDialogButtonBox>
+#include <QPushButton>
 #include <QSettings>
 
 FirstRun::FirstRun( QWidget *_p, intf_thread_t *_p_intf  )
@@ -39,23 +41,28 @@ FirstRun::FirstRun( QWidget *_p, intf_thread_t *_p_intf  )
 #endif
 }
 
+#define ALBUM_ART_WHEN_ASKED 0
+#define ALBUM_ART_ALL 2
+
 void FirstRun::save()
 {
-    QList<ConfigControl *>::Iterator i;
-    for( i = controlsList.begin() ; i != controlsList.end() ; i++ )
-    {
-        ConfigControl *c = qobject_cast<ConfigControl *>(*i);
-        c->doApply( p_intf );
-    }
+    config_PutInt( p_intf,  "album-art", checkbox->isChecked() ? ALBUM_ART_ALL: ALBUM_ART_WHEN_ASKED );
+#ifdef UPDATE_CHECK
+    config_PutInt( p_intf,  "qt-updates-notif", checkbox2->isChecked() );
+#endif
     config_PutInt( p_intf,  "qt-privacy-ask", 0 );
+
+    /* FIXME Should not save here. This will not work as expected if another
+     * plugin overwrote items of its own. */
+#warning FIXME
     /* We have to save here because the user may not launch Prefs */
-    config_SaveConfigFile( p_intf, NULL );
+    config_SaveConfigFile( p_intf );
     close();
 }
 
 void FirstRun::buildPrivDialog()
 {
-    setWindowTitle( qtr( "Privacy and Network Policies" ) );
+    setWindowTitle( qtr( "Privacy and Network Access Policy" ) );
     setWindowRole( "vlc-privacy" );
     setWindowModality( Qt::ApplicationModal );
     setWindowFlags( Qt::Dialog );
@@ -63,59 +70,49 @@ void FirstRun::buildPrivDialog()
 
     QGridLayout *gLayout = new QGridLayout( this );
 
-    QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Warning" ) );
+    QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Access Policy" ) );
     QGridLayout *blablaLayout = new QGridLayout( blabla );
     QLabel *text = new QLabel( qtr(
-        "<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 retreive limited information from "
-        "the Internet in order to get CD covers or to check "
-        "for available updates.</p>\n"
-        "<p><i>VLC media player</i> <b>DOES NOT</b> send or collect <b>ANY</b> "
+        "<p><i>VLC media player</i> does <b>not</b> send or collect any "
         "information, even anonymously, about your usage.</p>\n"
-        "<p>Therefore please select from the following options, the default being "
-        "almost no access to the web.</p>\n") );
+        "<p>However, it can connect to the Internet "
+        "in order to display <b>medias information</b> "
+#ifdef UPDATE_CHECK
+        "or to check for available <b>updates</b>"
+#endif
+        ".</p>\n"
+        "<p><i>VideoLAN</i> (the authors) requires you to express your consent "
+        "before allowing this software to access the Internet.</p>\n"
+        "<p>According to your choices, please check or uncheck the following options:</p>\n"
+        ) );
     text->setWordWrap( true );
     text->setTextFormat( Qt::RichText );
 
     blablaLayout->addWidget( text, 0, 0 ) ;
 
-    QGroupBox *options = new QGroupBox;
+    QGroupBox *options = new QGroupBox( qtr( "Network Access Policy" ) );
     QGridLayout *optionsLayout = new QGridLayout( options );
 
     gLayout->addWidget( blabla, 0, 0, 1, 3 );
     gLayout->addWidget( options, 1, 0, 1, 3 );
-    module_config_t *p_config;
-    ConfigControl *control;
     int line = 0;
 
-#define CONFIG_GENERIC( option, type )                            \
-    p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
-    if( p_config )                                                \
-    {                                                             \
-        control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
-                p_config, options, false, optionsLayout, line );  \
-        controlsList.append( control );                              \
-    }
-
-#define CONFIG_GENERIC_NOBOOL( option, type )                     \
-    p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
-    if( p_config )                                                \
-    {                                                             \
-        control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
-                p_config, options, optionsLayout, line );         \
-        controlsList.append( control );                              \
-    }
-
-    CONFIG_GENERIC( "album-art", IntegerList ); line++;
+    checkbox = new QCheckBox( qtr( "Allow downloading media information" ) );
+    checkbox->setChecked( true );
+    optionsLayout->addWidget( checkbox, line++, 0 );
+
 #ifdef UPDATE_CHECK
-    CONFIG_GENERIC_NOBOOL( "qt-updates-notif", Bool ); line++;
+    checkbox2 = new QCheckBox( qtr( "Allow checking for VLC updates" ) );
+    checkbox2->setChecked( true );
+    optionsLayout->addWidget( checkbox2, line++, 0 );
 #endif
 
-    QPushButton *ok = new QPushButton( qtr( "OK" ) );
+    QDialogButtonBox *buttonsBox = new QDialogButtonBox( this );
+    buttonsBox->addButton( qtr( "Save and Continue" ), QDialogButtonBox::AcceptRole );
 
-    gLayout->addWidget( ok, 2, 2 );
+    gLayout->addWidget( buttonsBox, 2, 0, 2, 3 );
 
-    CONNECT( ok, clicked(), this, save() );
+    CONNECT( buttonsBox, accepted(), this, save() );
+    buttonsBox->setFocus();
 }