Qt: allow SQL-ML configuration
[vlc/vlc-skelet.git] / modules / gui / qt4 / dialogs / ml_configuration.hpp
blob5cefc6d17ab8e486e8276246d051ef5f400221b1
1 /*****************************************************************************
2 * ml_configuration.hpp: ML's configuration dialog (folder view)
3 *****************************************************************************
4 * Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
5 * $Id$
7 * Authors: Antoine Lejeune <phytos@videolan.org>
8 * Jean-Philippe André <jpeg@videolan.org>
9 * Rémi Duraffort <ivoire@videolan.org>
10 * Adrien Maglo <magsoft@videolan.org>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
28 #ifndef _MEDIA_LIBRARY_CONFIG_H
29 #define _MEDIA_LIBRARY_CONFIG_H
31 #ifdef HAVE_CONFIG_H
32 # include <config.h>
33 #endif
35 #ifdef MEDIA_LIBRARY
37 #include <vlc_common.h>
38 #include <vlc_media_library.h>
40 #include "util/qvlcframe.hpp"
42 #include <QDirModel>
43 #include <QCheckBox>
44 #include <QDialogButtonBox>
45 #include <QPushButton>
47 /** Classes in this header */
48 class MLDirModel;
49 class MLConfDialog;
51 /** *************************************************************************
52 * \brief Model representing the filesystem and whose items are checkable
53 ****************************************************************************/
54 class MLDirModel : public QDirModel
56 Q_OBJECT;
58 public:
59 MLDirModel( const QStringList &nameFilters, QDir::Filters filters,
60 QDir::SortFlags sort, QObject *parent = 0 )
61 : QDirModel( nameFilters, filters, sort, parent ) {};
63 virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
64 virtual QVariant data( const QModelIndex &index, int role ) const;
65 virtual bool setData( const QModelIndex &index, const QVariant &value,
66 int role = Qt::EditRole );
67 int columnCount( const QModelIndex &parent = QModelIndex() ) const;
68 void reset( bool, vlc_array_t *);
70 QStringList monitoredDirs;
72 private:
73 bool b_recursive;
74 QMap<QString, Qt::CheckState> itemCheckState;
75 intf_thread_t *p_intf;
76 media_library_t* p_ml;
78 public slots:
79 void setRecursivity( bool );
82 /** *************************************************************************
83 * \brief Configuration dialog for the media library
84 ****************************************************************************/
85 class MLConfDialog : public QVLCDialog
87 Q_OBJECT;
88 public:
89 MLConfDialog( QWidget *, intf_thread_t * );
91 private:
92 void init();
94 vlc_array_t *p_monitored_dirs;
95 media_library_t *p_ml;
96 intf_thread_t *p_intf;
98 MLDirModel *model;
99 QCheckBox *recursivity;
101 static MLConfDialog *instance;
103 private slots:
104 void save();
105 void cancel();
106 void reset();
107 void close() { save(); };
110 #endif
111 #endif