<div dir="ltr">This is resend as well.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 5 Aug 2019 at 14:53, Abel Tesfaye <<a href="mailto:abeltesfaye45@gmail.com">abeltesfaye45@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Abel Tesfaye <<a href="mailto:Abeltesfaye45@gmail.com" target="_blank">Abeltesfaye45@gmail.com</a>><br>
<br>
---<br>
.../gui/qt/components/simple_preferences.cpp | 96 +++++++++++++++++++<br>
.../gui/qt/components/simple_preferences.hpp | 13 +++<br>
modules/gui/qt/ui/sprefs_interface.ui | 66 ++++++++++++-<br>
3 files changed, 171 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp<br>
index 6f8afa01c5..f80c48cc1b 100644<br>
--- a/modules/gui/qt/components/simple_preferences.cpp<br>
+++ b/modules/gui/qt/components/simple_preferences.cpp<br>
@@ -47,6 +47,17 @@<br>
#include <QScreen><br>
#include <QtAlgorithms><br>
#include <QDir><br>
+<br>
+#include <QSpinBox><br>
+#include <QCheckBox><br>
+#include <QLabel><br>
+#include <QPushButton><br>
+#include <QGridLayout><br>
+#include <QWidget><br>
+#include <QHBoxLayout><br>
+#include <QDialog><br>
+#include <QBoxLayout><br>
+<br>
#include <assert.h><br>
#include <math.h><br>
<br>
@@ -719,6 +730,24 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,<br>
+ qtr( "VLC skins website" )+ QString( "</a>." ) );<br>
ui.skinsLabel->setFont( italicFont );<br>
<br>
+ if ( vlc_ml_instance_get( p_intf ) != NULL )<br>
+ {<br>
+ mlModel = new MlFoldersModel( vlc_ml_instance_get( p_intf ) , this );<br>
+<br>
+ mlTableView = ui.entryPointsTV;<br>
+<br>
+ mlTableView->setModel( mlModel );<br>
+<br>
+ connect( mlModel , &QAbstractItemModel::modelReset , this , &SPrefsPanel::MLdrawControls );<br>
+<br>
+ BUTTONACT( ui.addButton , MLaddNewEntryPoint() );<br>
+<br>
+ MLdrawControls( );<br>
+<br>
+ }else {<br>
+ ui.mlGroupBox->hide( );<br>
+ }<br>
+<br>
#ifdef _WIN32<br>
BUTTONACT( ui.assoButton, assoDialog() );<br>
#else<br>
@@ -1475,3 +1504,70 @@ void SPrefsPanel::saveAsso()<br>
<br>
#endif /* _WIN32 */<br>
<br>
+void SPrefsPanel::MLaddNewEntryPoint( ){<br>
+ QUrl newEntryPoints = QFileDialog::getExistingDirectoryUrl( this , qtr("Please choose an entry point folder") ,<br>
+ QUrl( QDir::homePath( ) ) );<br>
+<br>
+ if(! newEntryPoints.isEmpty() )<br>
+ mlModel->add( newEntryPoints );<br>
+}<br>
+<br>
+QWidget *SPrefsPanel::MLgenerateWidget( QModelIndex index , MlFoldersModel *mlf , QWidget *parent){<br>
+ if ( index.column() == 0 ){<br>
+<br>
+ QWidget *wid = new QWidget( parent );<br>
+<br>
+ QBoxLayout* layout = new QBoxLayout( QBoxLayout::LeftToRight , wid );<br>
+<br>
+ QCheckBox*cb = new QCheckBox( wid );<br>
+ cb->setFixedSize( 16 , 16 );<br>
+<br>
+ //cb->setChecked(mlf->data(index, MlFoldersModel::CustomCheckBoxRole).toBool()); //TODO: disable banning till un-banning works<br>
+ cb->setEnabled( false );<br>
+<br>
+ layout->addWidget( cb , Qt::AlignCenter );<br>
+ wid->setLayout( layout );<br>
+<br>
+ connect( cb , &QPushButton::clicked, [=]( ) {<br>
+ mlf->setData( index , cb->isChecked() , MlFoldersModel::CustomCheckBoxRole);<br>
+ } );<br>
+ return wid;<br>
+ }<br>
+ else if ( index.column( ) == 2 ){<br>
+ QWidget *wid = new QWidget( parent );<br>
+<br>
+ QBoxLayout* layout = new QBoxLayout( QBoxLayout::LeftToRight , wid );<br>
+<br>
+ QPushButton *pb = new QPushButton( "-" , wid );<br>
+ pb->setFixedSize( 16 , 16 );<br>
+<br>
+ layout->addWidget( pb , Qt::AlignCenter );<br>
+ wid->setLayout( layout );<br>
+<br>
+<br>
+ connect( pb , &QPushButton::clicked , [=]() {<br>
+ mlf->setData( index , {} , MlFoldersModel::CustomRemoveRole);<br>
+ } );<br>
+<br>
+ return wid;<br>
+ }<br>
+<br>
+ return nullptr;<br>
+}<br>
+<br>
+void SPrefsPanel::MLdrawControls( ) {<br>
+ for ( int col = 0 ; col < mlModel->columnCount( ) ; col++ )<br>
+ for (int row = 0 ; row < mlModel->rowCount() ; row++ )<br>
+ {<br>
+ QModelIndex index = mlModel->index ( row , col );<br>
+ mlTableView->setIndexWidget ( index, MLgenerateWidget ( index, mlModel,<br>
+ mlTableView ) );<br>
+ }<br>
+<br>
+ mlTableView->resizeColumnsToContents( );<br>
+ mlTableView->horizontalHeader()->setMinimumSectionSize( 100 );<br>
+ mlTableView->horizontalHeader()->setSectionResizeMode( 1 , QHeaderView::Stretch );<br>
+<br>
+ mlTableView->horizontalHeader()->setFixedHeight( 24 );<br>
+}<br>
+<br>
diff --git a/modules/gui/qt/components/simple_preferences.hpp b/modules/gui/qt/components/simple_preferences.hpp<br>
index e249cfadc8..b8a9286c7e 100644<br>
--- a/modules/gui/qt/components/simple_preferences.hpp<br>
+++ b/modules/gui/qt/components/simple_preferences.hpp<br>
@@ -36,6 +36,12 @@<br>
#include "ui_sprefs_subtitles.h"<br>
#include "ui_sprefs_interface.h"<br>
<br>
+#include <vlc_media_library.h><br>
+#include <QDialogButtonBox><br>
+#include <QTableView><br>
+#include <QFileDialog><br>
+#include "components/mediacenter/ml_folders_model.hpp"<br>
+<br>
#ifdef _WIN32<br>
# include "util/registry.hpp"<br>
#endif<br>
@@ -107,6 +113,9 @@ private:<br>
<br>
char *lang;<br>
<br>
+ MlFoldersModel *mlModel;<br>
+ QTableView * mlTableView;<br>
+<br>
#ifdef _WIN32<br>
QList<QTreeWidgetItem *> listAsso;<br>
bool addType( const char * psz_ext, QTreeWidgetItem*, QTreeWidgetItem*, QVLCRegistry* );<br>
@@ -124,6 +133,10 @@ private slots:<br>
void updateCheckBoxes( QTreeWidgetItem*, int );<br>
void saveAsso();<br>
#endif<br>
+ void MLaddNewEntryPoint( );<br>
+ QWidget * MLgenerateWidget( QModelIndex index , MlFoldersModel *mlf , QWidget *parent );<br>
+ void MLdrawControls( );<br>
+<br>
void configML();<br>
void changeStyle( QString );<br>
};<br>
diff --git a/modules/gui/qt/ui/sprefs_interface.ui b/modules/gui/qt/ui/sprefs_interface.ui<br>
index da2faf548c..9e187f767e 100644<br>
--- a/modules/gui/qt/ui/sprefs_interface.ui<br>
+++ b/modules/gui/qt/ui/sprefs_interface.ui<br>
@@ -8,7 +8,7 @@<br>
<x>0</x><br>
<y>0</y><br>
<width>700</width><br>
- <height>785</height><br>
+ <height>1069</height><br>
</rect><br>
</property><br>
<property name="sizePolicy"><br>
@@ -577,9 +577,6 @@<br>
<property name="text"><br>
<string>File extensions association</string><br>
</property><br>
- <property name="buddy"><br>
- <cstring>assoButton</cstring><br>
- </property><br>
</widget><br>
</item><br>
<item row="2" column="1"><br>
@@ -633,6 +630,67 @@<br>
</layout><br>
</widget><br>
</item><br>
+ <item><br>
+ <widget class="QGroupBox" name="mlGroupBox"><br>
+ <property name="title"><br>
+ <string>Media Library</string><br>
+ </property><br>
+ <layout class="QGridLayout" name="gridLayout_5"><br>
+ <item row="0" column="2"><br>
+ <widget class="QPushButton" name="addButton"><br>
+ <property name="maximumSize"><br>
+ <size><br>
+ <width>16</width><br>
+ <height>16</height><br>
+ </size><br>
+ </property><br>
+ <property name="text"><br>
+ <string>+</string><br>
+ </property><br>
+ </widget><br>
+ </item><br>
+ <item row="0" column="1"><br>
+ <spacer name="horizontalSpacer_2"><br>
+ <property name="orientation"><br>
+ <enum>Qt::Horizontal</enum><br>
+ </property><br>
+ <property name="sizeHint" stdset="0"><br>
+ <size><br>
+ <width>40</width><br>
+ <height>20</height><br>
+ </size><br>
+ </property><br>
+ </spacer><br>
+ </item><br>
+ <item row="3" column="0" colspan="3"><br>
+ <widget class="QTableView" name="entryPointsTV"><br>
+ <property name="editTriggers"><br>
+ <set>QAbstractItemView::AllEditTriggers</set><br>
+ </property><br>
+ <property name="alternatingRowColors"><br>
+ <bool>true</bool><br>
+ </property><br>
+ <property name="showGrid"><br>
+ <bool>false</bool><br>
+ </property><br>
+ <attribute name="horizontalHeaderVisible"><br>
+ <bool>true</bool><br>
+ </attribute><br>
+ <attribute name="verticalHeaderVisible"><br>
+ <bool>false</bool><br>
+ </attribute><br>
+ </widget><br>
+ </item><br>
+ <item row="0" column="0"><br>
+ <widget class="QLabel" name="label_2"><br>
+ <property name="text"><br>
+ <string>Folders scanned by the Media Library:</string><br>
+ </property><br>
+ </widget><br>
+ </item><br>
+ </layout><br>
+ </widget><br>
+ </item><br>
<item><br>
<spacer name="verticalSpacer"><br>
<property name="orientation"><br>
-- <br>
2.21.0<br>
<br>
</blockquote></div>