[vlc-devel] [PATCH 02/16] qt prefrences: move media library options in separate tab

Prince Gupta guptaprince8832 at gmail.com
Tue Feb 23 10:05:52 UTC 2021


---
 modules/gui/qt/Makefile.am                    |   2 +
 modules/gui/qt/dialogs/.gitignore             |   1 +
 .../preferences/simple_preferences.cpp        |  46 ++++----
 .../preferences/simple_preferences.hpp        |   2 +
 .../dialogs/preferences/sprefs_interface.ui   |  61 -----------
 .../preferences/sprefs_medialibrary.ui        | 102 ++++++++++++++++++
 6 files changed, 133 insertions(+), 81 deletions(-)
 create mode 100644 modules/gui/qt/dialogs/preferences/sprefs_medialibrary.ui

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index a1cb9dfac5..ef87fc8164 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -394,6 +394,7 @@ nodist_libqt_plugin_la_SOURCES += \
 	gui/qt/dialogs/preferences/ui_sprefs_audio.h \
 	gui/qt/dialogs/preferences/ui_sprefs_input.h \
 	gui/qt/dialogs/preferences/ui_sprefs_interface.h \
+	gui/qt/dialogs/preferences/ui_sprefs_medialibrary.h \
 	gui/qt/dialogs/preferences/ui_sprefs_subtitles.h \
 	gui/qt/dialogs/preferences/ui_sprefs_video.h \
 	gui/qt/dialogs/sout/ui_profiles.h \
@@ -433,6 +434,7 @@ libqt_plugin_la_UI = \
 	gui/qt/dialogs/preferences/sprefs_audio.ui \
 	gui/qt/dialogs/preferences/sprefs_input.ui \
 	gui/qt/dialogs/preferences/sprefs_interface.ui \
+	gui/qt/dialogs/preferences/sprefs_medialibrary.ui \
 	gui/qt/dialogs/preferences/sprefs_subtitles.ui \
 	gui/qt/dialogs/preferences/sprefs_video.ui \
 	gui/qt/dialogs/sout/profiles.ui \
diff --git a/modules/gui/qt/dialogs/.gitignore b/modules/gui/qt/dialogs/.gitignore
index bc6f6815db..ad583965d2 100644
--- a/modules/gui/qt/dialogs/.gitignore
+++ b/modules/gui/qt/dialogs/.gitignore
@@ -13,6 +13,7 @@ messages/ui_messages_panel.h
 preferences/ui_sprefs_audio.h
 preferences/ui_sprefs_input.h
 preferences/ui_sprefs_interface.h
+preferences/ui_sprefs_medialibrary.h
 preferences/ui_sprefs_subtitles.h
 preferences/ui_sprefs_video.h
 sout/ui_profiles.h
diff --git a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
index c9b90778a6..d464632164 100644
--- a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
+++ b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
@@ -247,6 +247,8 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
                   cone_input_64, 4 );
     ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), qtr("Configure Hotkeys"),
                   cone_hotkeys_64, 5 );
+    ADD_CATEGORY( SPrefsMediaLibrary, qtr("Media Library"), qtr("Configure Media Library"),
+                  cone_medialibrary_64, 6 );
 
 #undef ADD_CATEGORY
 
@@ -732,25 +734,6 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
                     + qtr( "VLC skins website" )+ QString( "</a>." ) );
             ui.skinsLabel->setFont( italicFont );
 
-            if ( vlc_ml_instance_get( p_intf ) != NULL )
-            {
-                mlModel = new MlFoldersModel( this );
-                mlModel->setMl( vlc_ml_instance_get( p_intf ) );
-
-                mlTableView = ui.entryPointsTV;
-
-                mlTableView->setModel( mlModel );
-
-                connect( mlModel , &QAbstractItemModel::modelReset , this , &SPrefsPanel::MLdrawControls );
-
-                BUTTONACT( ui.addButton , MLaddNewEntryPoint() );
-
-                MLdrawControls( );
-
-            }else {
-                ui.mlGroupBox->hide( );
-            }
-
 #ifdef _WIN32
             BUTTONACT( ui.assoButton, assoDialog() );
 #else
@@ -943,9 +926,32 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             control->insertIntoExistingGrid( gLayout, line );
             controls.append( control );
 #endif
-
             break;
         }
+
+            START_SPREFS_CAT( MediaLibrary , qtr("Media Library Settings") );
+
+                if ( vlc_ml_instance_get( p_intf ) != NULL )
+                {
+                    mlModel = new MlFoldersModel( this );
+                    mlModel->setMl( vlc_ml_instance_get( p_intf ) );
+
+                    mlTableView = ui.entryPointsTV;
+
+                    mlTableView->setModel( mlModel );
+
+                    connect( mlModel , &QAbstractItemModel::modelReset , this , &SPrefsPanel::MLdrawControls );
+
+                    BUTTONACT( ui.addButton , MLaddNewEntryPoint() );
+
+                    MLdrawControls( );
+                }
+                else
+                {
+                    ui.mlGroupBox->hide( );
+                }
+
+            END_SPREFS_CAT;
     }
 
     panel_layout->addWidget( panel_label );
diff --git a/modules/gui/qt/dialogs/preferences/simple_preferences.hpp b/modules/gui/qt/dialogs/preferences/simple_preferences.hpp
index 32d7df9fc2..85b2b6e069 100644
--- a/modules/gui/qt/dialogs/preferences/simple_preferences.hpp
+++ b/modules/gui/qt/dialogs/preferences/simple_preferences.hpp
@@ -36,6 +36,7 @@
 #include "ui_sprefs_video.h"
 #include "ui_sprefs_subtitles.h"
 #include "ui_sprefs_interface.h"
+#include "ui_sprefs_medialibrary.h"
 
 #include <vlc_media_library.h>
 #include <QDialogButtonBox>
@@ -56,6 +57,7 @@ enum {
     SPrefsSubtitles,
     SPrefsInputAndCodecs,
     SPrefsHotkeys,
+    SPrefsMediaLibrary,
     SPrefsMax
 };
 #define SPrefsDefaultCat SPrefsInterface
diff --git a/modules/gui/qt/dialogs/preferences/sprefs_interface.ui b/modules/gui/qt/dialogs/preferences/sprefs_interface.ui
index cb43c06b49..1c505156c3 100644
--- a/modules/gui/qt/dialogs/preferences/sprefs_interface.ui
+++ b/modules/gui/qt/dialogs/preferences/sprefs_interface.ui
@@ -630,67 +630,6 @@
      </layout>
     </widget>
    </item>
-   <item>
-    <widget class="QGroupBox" name="mlGroupBox">
-     <property name="title">
-      <string>Media Library</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_5">
-      <item row="0" column="2">
-       <widget class="QPushButton" name="addButton">
-        <property name="maximumSize">
-         <size>
-          <width>16</width>
-          <height>16</height>
-         </size>
-        </property>
-        <property name="text">
-         <string>+</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <spacer name="horizontalSpacer_2">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="3" column="0" colspan="3">
-       <widget class="QTableView" name="entryPointsTV">
-        <property name="editTriggers">
-         <set>QAbstractItemView::AllEditTriggers</set>
-        </property>
-        <property name="alternatingRowColors">
-         <bool>true</bool>
-        </property>
-        <property name="showGrid">
-         <bool>false</bool>
-        </property>
-        <attribute name="horizontalHeaderVisible">
-         <bool>true</bool>
-        </attribute>
-        <attribute name="verticalHeaderVisible">
-         <bool>false</bool>
-        </attribute>
-       </widget>
-      </item>
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_2">
-        <property name="text">
-         <string>Folders scanned by the Media Library:</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
    <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
diff --git a/modules/gui/qt/dialogs/preferences/sprefs_medialibrary.ui b/modules/gui/qt/dialogs/preferences/sprefs_medialibrary.ui
new file mode 100644
index 0000000000..282f39f0d8
--- /dev/null
+++ b/modules/gui/qt/dialogs/preferences/sprefs_medialibrary.ui
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <author>Prince Gupta</author>
+ <class>SPrefsMediaLibrary</class>
+ <widget class="QWidget" name="SPrefsMediaLibrary">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>700</width>
+    <height>1069</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QGroupBox" name="mlGroupBox">
+     <property name="title">
+      <string>Folders</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_5">
+      <item row="0" column="2">
+       <widget class="QPushButton" name="addButton">
+        <property name="maximumSize">
+         <size>
+          <width>16</width>
+          <height>16</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>+</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0" colspan="3">
+       <widget class="QTableView" name="entryPointsTV">
+        <property name="editTriggers">
+         <set>QAbstractItemView::AllEditTriggers</set>
+        </property>
+        <property name="alternatingRowColors">
+         <bool>true</bool>
+        </property>
+        <property name="showGrid">
+         <bool>false</bool>
+        </property>
+        <attribute name="horizontalHeaderVisible">
+         <bool>true</bool>
+        </attribute>
+        <attribute name="verticalHeaderVisible">
+         <bool>false</bool>
+        </attribute>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>627</width>
+          <height>17</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Folders scanned by the Media Library:</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
-- 
2.25.1



More information about the vlc-devel mailing list