Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1b45cf65 by Wassim Lalaoui at 2026-02-19T14:15:32+00:00
qt: fix duplicate path in firstwizard and mleditor

- - - - -
3f0de1dc by Wassim Lalaoui at 2026-02-19T14:15:32+00:00
qt: don't index default folders when user cancel first run wizard

- - - - -


3 changed files:

- modules/gui/qt/dialogs/firstrun/firstrunwizard.cpp
- modules/gui/qt/widgets/native/mlfolderseditor.cpp
- modules/gui/qt/widgets/native/mlfolderseditor.hpp


Changes:

=====================================
modules/gui/qt/dialogs/firstrun/firstrunwizard.cpp
=====================================
@@ -188,7 +188,7 @@ void FirstRunWizard::MLaddNewFolder()
     QUrl newEntryPoint = QFileDialog::getExistingDirectoryUrl( this, 
qtr("Choose a folder to add to the Media Library"),
                                                                QUrl( 
QDir::homePath() ));
 
-    if( !newEntryPoint.isEmpty() )
+    if( !newEntryPoint.isEmpty() && !mlFoldersEditor->contains( newEntryPoint 
) )
         mlFoldersEditor->add( newEntryPoint );
 }
 
@@ -311,7 +311,6 @@ void FirstRunWizard::initializePage( int id )
  * Processes the default options on rejection of the FirstRun Wizard.
  * The default options are:
  * - Yes to metadata
- * - Default folders in the Media Library
  * - System/Auto colour scheme
  * - Modern VLC layout
  */
@@ -330,13 +329,6 @@ void FirstRunWizard::reject()
     config_PutInt( "qt-titlebar", 0 );
     p_intf->p_mi->setPinVideoControls( 0 );
 
-    /* Folders Page settings */
-    if ( mlFoldersEditor )
-    {
-        addDefaults();
-        mlFoldersEditor->commit();
-    }
-
     if( p_intf->p_mi->getMediaLibrary() )
         p_intf->p_mi->getMediaLibrary()->reload();
 
@@ -362,7 +354,8 @@ void FirstRunWizard::addDefaults()
         if( folder == nullptr )
             continue;
         auto folderMrl = vlc::wrap_cptr( vlc_path2uri( folder.get(), nullptr ) 
);
-        mlFoldersEditor->add( QUrl( folderMrl.get() ) );
+        if ( !mlFoldersEditor->contains( QUrl( folderMrl.get() ) ) )
+            mlFoldersEditor->add( QUrl( folderMrl.get() ) );
     }
 
     mlDefaults = true;


=====================================
modules/gui/qt/widgets/native/mlfolderseditor.cpp
=====================================
@@ -66,6 +66,21 @@ void MLFoldersEditor::add(const QUrl &mrl)
     newRow(mrl);
 }
 
+bool MLFoldersEditor::contains(const QUrl &url)
+{
+    for ( const auto &newEntry : m_newEntries )
+    {
+        if ( newEntry.isLocalFile() && url.isLocalFile() )
+        {
+            if ( newEntry.matches( url, QUrl::StripTrailingSlash | 
QUrl::NormalizePathSegments ))
+                return true;
+        }
+        else if ( newEntry.matches( url, QUrl::NormalizePathSegments ))
+            return true;
+    }
+    return false;
+}
+
 void MLFoldersEditor::commit()
 {
     for ( const auto &removeEntry : m_removeEntries )


=====================================
modules/gui/qt/widgets/native/mlfolderseditor.hpp
=====================================
@@ -41,6 +41,9 @@ public:
     void setMLFoldersModel( MLFoldersBaseModel *foldersModel );
     void add( const QUrl &mrl );
 
+    // verifies if one URL in m_newEntries matches with the argument
+    bool contains(const QUrl &url);
+
     // call 'commit' to apply changes
     void commit();
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/654bbd7ba7caf01ead90e4e398a0e6159a930bd7...3f0de1dcae129decd49a0fea7c29cb8dab9271b4

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/654bbd7ba7caf01ead90e4e398a0e6159a930bd7...3f0de1dcae129decd49a0fea7c29cb8dab9271b4
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to