MediaLibrary.h 2.88 KB
Newer Older
1 2 3
/*****************************************************************************
 * MediaLibrary.h: VLMC media library's ui
 *****************************************************************************
4
 * Copyright (C) 2008-2014 VideoLAN
5
 *
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   MediaContainer;
32
class   ViewController;
33 34 35 36 37 38 39

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

    public:
40
        typedef bool    (*Filter)( const Clip*, const QString& filter );
41
        explicit MediaLibrary( QWidget *parent = 0);
42 43
        void        setMediaContainer( MediaContainer* container );

44

45 46
    protected:
        void        dragEnterEvent( QDragEnterEvent *event );
47 48
        void        dragMoveEvent( QDragMoveEvent *event );
        void        dragLeaveEvent( QDragLeaveEvent *event );
49
        void        dropEvent( QDropEvent *event );
50
        void        changeEvent( QEvent *e );
51

52 53 54 55 56 57 58 59 60 61 62
    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 );
63
        static bool         filterByTags( const Clip *clip, const QString &filter );
64

65 66
    private:
        Ui::MediaLibrary    *m_ui;
67
        MediaListView       *m_mediaListView;
68

69 70
    private slots:
        void                filterUpdated( const QString &filter );
71 72 73 74 75 76
        /**
         *  \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 );
77
        void                filterTypeChanged();
78

79 80 81 82 83 84
    signals:
        void                importRequired();
        void                clipSelected( Clip* );
};

#endif // MEDIALIBRARY_H