Workspace.h 2.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*****************************************************************************
 * Workspace.h: Workspace management
 *****************************************************************************
 * Copyright (C) 2008-2010 VideoLAN
 *
 * Authors: Hugo Beauzee-Luyssen <hugo@vlmc.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 WORKSPACE_H
#define WORKSPACE_H

26 27 28
#include "Singleton.hpp"

#include "ErrorHandler.h"
29

30
#include <QMutex>
31
#include <QObject>
32 33
#include <QQueue>

34 35 36
class   Clip;
class   Media;

37 38
class   QFileInfo;

39
class Workspace : public QObject, public Singleton<Workspace>, public ErrorHandler
40 41 42 43 44 45
{
    Q_OBJECT

    public:
        static const QString        workspacePrefix;

46 47 48
        static bool                 isInProjectDir( const QString &path );
        static bool                 isInProjectDir( const QFileInfo &fInfo );
        static bool                 isInProjectDir( const Media *media );
49
        static QString              pathInProjectDir( const Media* media );
50

51
        bool                        copyToWorkspace( Media* media );
52
        void                        copyAllToWorkspace();
53 54
    private:
        Workspace();
55 56 57 58 59 60
        ~Workspace();
        void                        startCopyWorker( Media *media );
    private:
        QQueue<Media*>              m_mediasToCopy;
        QMutex                      *m_mediasToCopyMutex;
        bool                        m_copyInProgress;
61 62

    public slots:
63
        void                        clipLoaded( Clip* clip );
64
    private slots:
65
        void                        copyTerminated( Media* media, QString dest );
66 67 68 69 70

    friend class    Singleton<Workspace>;
};

#endif // WORKSPACE_H