MediaLibrary.h 2.79 KB
Newer Older
1 2 3 4 5
/*****************************************************************************
 * MediaLibrary.h: VLMC media library's ui
 *****************************************************************************
 * Copyright (C) 2008-2010 VideoLAN
 *
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
6
 * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 *
 * 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 MEDIALIBRARY_H
#define MEDIALIBRARY_H

#include <QWidget>

#include "ui_MediaLibrary.h"
class   Clip;
30
class   MediaListView;
31
class   ViewController;
32 33 34 35 36 37 38

class MediaLibrary : public QWidget
{
    Q_OBJECT
    Q_DISABLE_COPY( MediaLibrary );

    public:
39
        typedef bool    (*Filter)( const Clip*, const QString& filter );
40 41
        explicit MediaLibrary( QWidget *parent = 0);

42 43
    protected:
        void        dragEnterEvent( QDragEnterEvent *event );
44 45
        void        dragMoveEvent( QDragMoveEvent *event );
        void        dragLeaveEvent( QDragLeaveEvent *event );
46
        void        dropEvent( QDropEvent *event );
47
        void        changeEvent( QEvent *e );
48

49 50 51 52 53 54 55 56 57 58 59
    private:
        /**
         *  \return     The appropriate filter function
         *
         *  This will evaluate the currently selected filter, and return the appropriate
         *  function.
         */
        Filter              currentFilter();

    //Filters list :
        static bool         filterByName( const Clip *clip, const QString &filter );
60
        static bool         filterByTags( const Clip *clip, const QString &filter );
61

62 63
    private:
        Ui::MediaLibrary    *m_ui;
64
        MediaListView       *m_mediaListView;
65

66 67
    private slots:
        void                filterUpdated( const QString &filter );
68 69 70 71 72 73
        /**
         *  \brief          Used to update the filters when the view is changed.
         *
         *  A view is changed when the user goes through the clips hierarchy.
         */
        void                viewChanged( ViewController* view );
74
        void                filterTypeChanged();
75

76 77 78 79 80 81
    signals:
        void                importRequired();
        void                clipSelected( Clip* );
};

#endif // MEDIALIBRARY_H