Commit 2f353e18 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt4: prune SQL media library code

refs c2c113e3
parent 532b001b
......@@ -49,7 +49,6 @@ libqt4_plugin_la_SOURCES = \
dialogs/bookmarks.cpp dialogs/bookmarks.hpp \
dialogs/preferences.cpp dialogs/preferences.hpp \
dialogs/mediainfo.cpp dialogs/mediainfo.hpp \
dialogs/ml_configuration.cpp dialogs/ml_configuration.hpp \
dialogs/epg.cpp dialogs/epg.hpp \
dialogs/extended.cpp dialogs/extended.hpp \
dialogs/messages.cpp dialogs/messages.hpp \
......@@ -85,8 +84,6 @@ libqt4_plugin_la_SOURCES = \
components/epg/EPGView.cpp components/epg/EPGView.hpp \
components/epg/EPGWidget.cpp components/epg/EPGWidget.hpp \
components/playlist/views.cpp components/playlist/views.hpp \
components/playlist/ml_item.cpp components/playlist/ml_item.hpp \
components/playlist/ml_model.cpp components/playlist/ml_model.hpp \
components/playlist/vlc_model.cpp components/playlist/vlc_model.hpp \
components/playlist/playlist_model.cpp \
components/playlist/playlist_model.hpp \
......@@ -169,7 +166,6 @@ nodist_libqt4_plugin_la_SOURCES = \
dialogs/firstrun.moc.cpp \
dialogs/extensions.moc.cpp \
dialogs/fingerprintdialog.moc.cpp \
dialogs/ml_configuration.moc.cpp \
components/extended_panels.moc.cpp \
components/info_panels.moc.cpp \
components/info_widgets.moc.cpp \
......@@ -190,7 +186,6 @@ nodist_libqt4_plugin_la_SOURCES = \
components/playlist/playlist.moc.cpp \
components/playlist/standardpanel.moc.cpp \
components/playlist/selector.moc.cpp \
components/playlist/ml_model.moc.cpp \
components/sout/profile_selector.moc.cpp \
components/sout/sout_widgets.moc.cpp \
util/animators.moc.cpp \
......
This diff is collapsed.
/*****************************************************************************
* ml_item.hpp: the SQL media library's result item
*****************************************************************************
* Copyright (C) 2008-2011 the VideoLAN Team and AUTHORS
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
* Jean-Philippe André <jpeg@videolan.org>
* Rémi Duraffort <ivoire@videolan.org>
* Adrien Maglo <magsoft@videolan.org>
* Srikanth Raju <srikiraju#gmail#com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _MEDIA_LIBRARY_MLITEM_H
#define _MEDIA_LIBRARY_MLITEM_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef SQL_MEDIA_LIBRARY
#include <vlc_common.h>
#include <vlc_interface.h>
#include <vlc_media_library.h>
#include "playlist_item.hpp"
#include "ml_model.hpp"
#include "qt4.hpp"
class MLModel;
class MLItem : public AbstractPLItem
{
friend class MLModel;
public:
MLItem( intf_thread_t *_p_intf,
ml_media_t *p_media, MLItem *p_parent );
virtual ~MLItem();
bool operator<( MLItem* item );
private:
/* AbstractPLItem */
int id( int type );
input_item_t *inputItem();
AbstractPLItem* child( int row ) const;
virtual QUrl getURI() const;
virtual QString getTitle() const;
/* Local */
QVariant data( ml_select_e meta ) const;
bool setData( ml_select_e meta, const QVariant &data );
// Media structure connections
ml_media_t* getMedia() const;
ml_media_t* media;
media_library_t* p_ml;
};
#endif
#endif
This diff is collapsed.
/*****************************************************************************
* ml_model.hpp SQL ML model
*****************************************************************************
* Copyright (C) 2008-2011 the VideoLAN Team and AUTHORS
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
* Jean-Philippe André <jpeg@videolan.org>
* Rémi Duraffort <ivoire@videolan.org>
* Adrien Maglo <magsoft@videolan.org>
* Srikanth Raju <srikiraju#gmail#com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _MEDIA_LIBRARY_MLMODEL_H
#define _MEDIA_LIBRARY_MLMODEL_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef SQL_MEDIA_LIBRARY
#include <vlc_common.h>
#include <vlc_interface.h>
#include <vlc_media_library.h>
#include "components/playlist/vlc_model.hpp"
#include "ml_item.hpp"
#include "qt4.hpp"
#include <QMutex>
#include <QEvent>
class MLItem;
/** *************************************************************************
* \brief ML Events class because we don't want direct callbacks
****************************************************************************/
class MLEvent : public QEvent
{
public:
static const QEvent::Type MediaAdded_Type;
static const QEvent::Type MediaRemoved_Type;
static const QEvent::Type MediaUpdated_Type;
MLEvent( QEvent::Type type, media_library_t *_p_ml, int32_t _ml_media_id ) :
QEvent( type ), ml_media_id( _ml_media_id ), p_ml( _p_ml ) {};
int32_t ml_media_id;
media_library_t * p_ml; /* store instance */
};
/** *************************************************************************
* \brief Tree model for the result list
****************************************************************************/
class MLModel : public VLCModel
{
Q_OBJECT;
public:
// Basic QAbstractItemModel implementation
MLModel( intf_thread_t *_p_intf, QObject *parent = NULL );
virtual ~MLModel();
QVariant data( const QModelIndex &idx, const int role = Qt::DisplayRole ) const;
bool setData( const QModelIndex &idx, const QVariant &value,
int role = Qt::EditRole );
QModelIndex index( int row, int column,
const QModelIndex & parent = QModelIndex() ) const;
int rowCount( const QModelIndex & parent = QModelIndex() ) const;
QModelIndex parent( const QModelIndex& ) const;
Qt::ItemFlags flags( const QModelIndex& ) const;
QMimeData* mimeData( const QModelIndexList & indexes ) const;
virtual bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() );
virtual void sort( const int column, Qt::SortOrder order = Qt::AscendingOrder );
// Custom functions
bool isEditable( const QModelIndex& ) const;
ml_select_e columnType( int column ) const;
virtual bool event( QEvent * e );
QModelIndex getIndexByMLID( int id ) const;
/* VLCModelSubInterface */
virtual void rebuild( playlist_item_t * p = NULL );
virtual void doDelete( QModelIndexList selected );
virtual void createNode( QModelIndex, QString ) {};
virtual void removeAll();
virtual QModelIndex rootIndex() const;
virtual void filter( const QString& search_text, const QModelIndex & root, bool b_recursive );
virtual QModelIndex currentIndex() const;
virtual QModelIndex indexByPLID( const int i_plid, const int c ) const;
virtual QModelIndex indexByInputItemID( const int i_inputitem_id, const int c ) const;
virtual bool isTree() const;
virtual bool canEdit() const;
virtual bool action( QAction *action, const QModelIndexList &indexes );
virtual bool isSupportedAction( actions action, const QModelIndex & ) const;
/* VLCModelSubInterface virtual slots */
virtual void activateItem( const QModelIndex &index );
protected:
/* VLCModel subclassing */
bool isParent( const QModelIndex &index, const QModelIndex &current) const;
bool isLeaf( const QModelIndex &index ) const;
private:
/* custom */
int insertMedia( ml_media_t *p_media, int row = -1 );
int insertResultArray( vlc_array_t *p_result_array, int row = -1 );
QList< MLItem* > items;
media_library_t* p_ml;
};
#endif
#endif
......@@ -30,7 +30,6 @@
#include "components/playlist/standardpanel.hpp" /* MainView */
#include "components/playlist/selector.hpp" /* PLSelector */
#include "components/playlist/playlist_model.hpp" /* PLModel */
#include "components/playlist/ml_model.hpp" /* MLModel */
#include "components/interface_widgets.hpp" /* CoverArtLabel */
#include "util/searchlineedit.hpp"
......@@ -100,11 +99,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
model->setModel( VLCProxyModel::PL_MODEL, plmodel );
model->switchToModel( VLCProxyModel::PL_MODEL );
#ifdef SQL_MEDIA_LIBRARY
MLModel *mlmodel = new MLModel( p_intf, model );
model->setModel( VLCProxyModel::SQLML_MODEL, mlmodel );
#endif
mainView = new StandardPLPanel( this, p_intf, p_root, selector, model );
/* Location Bar */
......
......@@ -240,12 +240,6 @@ void PLSelector::createItems()
ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) );
ml->treeItem()->setData( 0, Qt::DecorationRole, QIcon( ":/sidebar/library" ) );
#ifdef SQL_MEDIA_LIBRARY
/* SQL ML */
ml = addItem( SQL_ML_TYPE, "SQL Media Library" )->treeItem();
ml->treeItem()->setData( 0, Qt::DecorationRole, QIcon( ":/sidebar/library" ) );
#endif
/* SD nodes */
QTreeWidgetItem *mycomp = addItem( CATEGORY_TYPE, N_("My Computer"), false, true )->treeItem();
QTreeWidgetItem *devices = addItem( CATEGORY_TYPE, N_("Devices"), false, true )->treeItem();
......@@ -377,14 +371,6 @@ void PLSelector::setSource( QTreeWidgetItem *item )
item->setData( 0, CAP_SEARCH_ROLE, true );
}
}
#ifdef SQL_MEDIA_LIBRARY
else if( i_type == SQL_ML_TYPE )
{
emit categoryActivated( NULL, true );
curItem = item;
return;
}
#endif
curItem = item;
......
......@@ -30,7 +30,6 @@
#include "components/playlist/vlc_model.hpp" /* VLCModel */
#include "components/playlist/playlist_model.hpp" /* PLModel */
#include "components/playlist/ml_model.hpp" /* MLModel */
#include "components/playlist/views.hpp" /* 3 views */
#include "components/playlist/selector.hpp" /* PLSelector */
#include "util/animators.hpp" /* PixmapAnimator */
......@@ -478,21 +477,9 @@ void StandardPLPanel::searchDelayed( const QString& searchText )
/* This activated by the selector selection */
void StandardPLPanel::setRootItem( playlist_item_t *p_item, bool b )
{
#ifdef SQL_MEDIA_LIBRARY
if( b )
{
msg_Dbg( p_intf, "Setting the SQL ML" );
if ( model->switchToModel( VLCProxyModel::SQLML_MODEL ) )
currentView->setModel( model );
}
else
#else
Q_UNUSED( b );
#endif
{
if ( model->switchToModel( VLCProxyModel::PL_MODEL ) )
model->rebuild( p_item );
}
if ( model->switchToModel( VLCProxyModel::PL_MODEL ) )
model->rebuild( p_item );
}
void StandardPLPanel::browseInto( const QModelIndex &index )
......
......@@ -29,7 +29,6 @@
#include "components/simple_preferences.hpp"
#include "components/preferences_widgets.hpp"
#include "dialogs/ml_configuration.hpp"
#include <vlc_config_cat.h>
#include <vlc_configuration.h>
......@@ -749,11 +748,6 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#else
ui.osGroupBox->hide();
#endif
#ifdef SQL_MEDIA_LIBRARY
BUTTONACT( ui.sqlMLbtn, configML() );
#else
ui.sqlMLbtn->hide();
#endif
/* interface */
char *psz_intf = config_GetPsz( p_intf, "intf" );
......
This diff is collapsed.
/*****************************************************************************
* ml_configuration.hpp: SQL ML's configuration dialog (folder view)
*****************************************************************************
* Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
* Jean-Philippe André <jpeg@videolan.org>
* Rémi Duraffort <ivoire@videolan.org>
* Adrien Maglo <magsoft@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _MEDIA_LIBRARY_CONFIG_H
#define _MEDIA_LIBRARY_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef SQL_MEDIA_LIBRARY
#include <vlc_common.h>
#include <vlc_media_library.h>
#include "util/qvlcframe.hpp"
#include <QDirModel>
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QPushButton>
/** Classes in this header */
class MLDirModel;
class MLConfDialog;
/** *************************************************************************
* \brief Model representing the filesystem and whose items are checkable
****************************************************************************/
class MLDirModel : public QDirModel
{
Q_OBJECT;
public:
MLDirModel( const QStringList &nameFilters, QDir::Filters filters,
QDir::SortFlags sort, QObject *parent = 0 )
: QDirModel( nameFilters, filters, sort, parent ) {};
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
virtual QVariant data( const QModelIndex &index, int role ) const;
virtual bool setData( const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole );
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
void reset( bool, vlc_array_t *);
QStringList monitoredDirs;
private:
bool b_recursive;
QMap<QString, Qt::CheckState> itemCheckState;
intf_thread_t *p_intf;
media_library_t* p_ml;
public slots:
void setRecursivity( bool );
};
/** *************************************************************************
* \brief Configuration dialog for the media library
****************************************************************************/
class MLConfDialog : public QVLCDialog
{
Q_OBJECT;
public:
MLConfDialog( QWidget *, intf_thread_t * );
private:
void init();
vlc_array_t *p_monitored_dirs;
media_library_t *p_ml;
intf_thread_t *p_intf;
MLDirModel *model;
QCheckBox *recursivity;
QCheckBox *synchronous;
static MLConfDialog *instance;
private slots:
void save();
void cancel();
void reset();
void close() { save(); };
};
#endif
#endif
......@@ -8,7 +8,7 @@
<x>0</x>
<y>0</y>
<width>686</width>
<height>656</height>
<height>667</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -318,16 +318,7 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item row="1" column="1">
......@@ -432,48 +423,41 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="treePlaylist">
<item row="0" column="0">
<widget class="QCheckBox" name="OneInterfaceMode">
<property name="text">
<string>Display playlist tree</string>
<string>Allow only one instance</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="EnqueueOneInterfaceMode">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="oneInstanceFromFile">
<property name="text">
<string>Enqueue items into playlist in one instance mode</string>
<string>Use only one instance when started from file manager</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="playPauseBox">
<item row="2" column="0">
<widget class="QCheckBox" name="treePlaylist">
<property name="text">
<string>Pause on the last frame of a video</string>
<string>Display playlist tree</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="OneInterfaceMode">
<item row="2" column="1">
<widget class="QCheckBox" name="playPauseBox">
<property name="text">
<string>Allow only one instance</string>
<string>Pause on the last frame of a video</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="artFetcher"/>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="sqlMLbtn">
<property name="text">
<string>Configure Media Library</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="oneInstanceFromFile">
<item row="0" column="1">
<widget class="QCheckBox" name="EnqueueOneInterfaceMode">
<property name="text">
<string>Use only one instance when started from file manager</string>
<string>Enqueue items into playlist in one instance mode</string>
</property>
</widget>
</item>
......@@ -678,7 +662,6 @@
<tabstop>treePlaylist</tabstop>
<tabstop>playPauseBox</tabstop>
<tabstop>artFetcher</tabstop>
<tabstop>sqlMLbtn</tabstop>
<tabstop>updatesBox</tabstop>
<tabstop>updatesDays</tabstop>
<tabstop>saveRecentlyPlayed</tabstop>
......
......@@ -30,7 +30,6 @@
*/
#include "pictureflow.hpp"
#include "components/playlist/ml_model.hpp"
#include <QApplication>
#include <QImage>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment