MainWindow.h 5.93 KB
Newer Older
Ludovic Fauvet's avatar
Ludovic Fauvet committed
1
/*****************************************************************************
2
 * MainWindow.h: VLMC MainWindow
Ludovic Fauvet's avatar
Ludovic Fauvet committed
3
 *****************************************************************************
Ludovic Fauvet's avatar
Ludovic Fauvet committed
4
 * Copyright (C) 2008-2010 VideoLAN
Ludovic Fauvet's avatar
Ludovic Fauvet committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * Authors: Ludovic Fauvet <etix@l0cal.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 MAINWINDOW_H
#define MAINWINDOW_H

#include <QApplication>
27
#include <QSlider>
28 29
#include <QToolButton>
#include <QButtonGroup>
30

31
#include "vlmc.h"
32
#include "config.h"
Ludovic Fauvet's avatar
Ludovic Fauvet committed
33
#include "ui_MainWindow.h"
34

35 36 37 38 39 40 41 42 43
class   EffectsListView;
class   ImportController;
class   MediaLibrary;
class   PreviewWidget;
class   ProjectWizard;
class   Settings;
class   Timeline;
class   WorkflowFileRenderer;
class   WorkflowRenderer;
44

Ludovic Fauvet's avatar
Ludovic Fauvet committed
45 46 47
class MainWindow : public QMainWindow
{
    Q_OBJECT
Ludovic Fauvet's avatar
Ludovic Fauvet committed
48
    Q_DISABLE_COPY( MainWindow )
Ludovic Fauvet's avatar
Ludovic Fauvet committed
49 50 51

public:
    explicit MainWindow( QWidget *parent = 0 );
52
    ~MainWindow();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
53

54
    void registerWidgetInWindowMenu( QDockWidget* widget );
55
    void        showWizard();
56

Ludovic Fauvet's avatar
Ludovic Fauvet committed
57 58 59 60
public slots:
    void        zoomIn();
    void        zoomOut();

Ludovic Fauvet's avatar
Ludovic Fauvet committed
61
protected:
62 63
    virtual void    changeEvent( QEvent *e );
    virtual void    closeEvent( QCloseEvent* e );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
64 65

private:
66
    void        initializeDockWidgets();
67
    void        checkFolders();
68
    void        createStatusBar();
69
    void        createNotificationZone();
70
    void        createGlobalPreferences();
71
    void        createProjectPreferences();
72
    void        clearTemporaryFiles();
73
    void        initVlmcPreferences();
74
    void        loadVlmcPreferences( const QString& subPart );
75
    void        loadGlobalProxySettings();
76
    void        initToolbar();
77
    bool        saveSettings();
78 79 80 81 82
    void        setupLibrary();
    void        setupClipPreview();
    void        setupProjectPreview();
    void        setupEffectsList();
    void        setupUndoRedoWidget();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
83
#ifdef WITH_CRASHBUTTON
84 85
    void        setupCrashTester();
#endif
86 87 88
    /**
     *  \brief  Will check if vlmc closed nicely or crashed.
     *          If so, the emergency backup will be opened.
89
     *  \return true if a project was restored. If so, the wizard should
90 91 92
     *          not be opened.
     */
    bool        restoreSession();
93

94 95 96 97 98 99 100 101 102 103 104
    /**
     *  \brief  Will check if there is any video on the Project Timeline.
     *  \return true, if ( MainWorkflow::getInstance()->getLengthFrame() > 0 )
     *          else false
     */
    bool        checkVideoLength();

    /**
     *  \brief  Renders video by the parameters: outputFileName, width, height,
     *          fps, vbitrate, abitrate
     *          Also, displays a rendering dialog with snapshots and progress.
105
     *  \return true if video renders well or not cancelled by the user.
106
     */
107
    bool        renderVideo( const QString& outputFileName, quint32 width, quint32 height,
108 109
                             double fps, quint32 vbitrate, quint32 abitrate );

110 111 112 113
    /**
     *  \brief  Gets video parameters from RendererSettings Dialog
     *          exportType when set to true, renders video to user defined location
     *          and when set to false, renders video to temporary folder.
114
     *  \return same as renderVideo(),
115 116
     *          true if video renders well or not cancelled by the user.
     */
117 118
    bool        renderVideoSettings( bool exportType );

119 120 121
    Ui::MainWindow          m_ui;
    QSlider*                m_zoomSlider;
    Timeline*               m_timeline;
122 123
    PreviewWidget*          m_clipPreview;
    PreviewWidget*          m_projectPreview;
124 125
    WorkflowFileRenderer*   m_fileRenderer;
    WorkflowRenderer        *m_renderer;
126
    Settings*               m_globalPreferences;
127
    Settings*               m_DefaultProjectPreferences;
128
    Settings*               m_projectPreferences;
129
    ProjectWizard*          m_pWizard;
130
    ImportController*       m_importController;
131 132
    MediaLibrary            *m_mediaLibrary;
    EffectsListView         *m_effectsList;
Ludovic Fauvet's avatar
Ludovic Fauvet committed
133 134

private slots:
135 136 137 138 139
    void                    on_actionFullscreen_triggered( bool checked );
    void                    on_actionQuit_triggered();
    void                    on_actionAbout_triggered();
    void                    on_actionPreferences_triggered();
    void                    on_actionRender_triggered();
140
    void                    on_actionShare_On_Internet_triggered();
141 142 143
    void                    on_actionNew_Project_triggered();
    void                    on_actionLoad_Project_triggered();
    void                    on_actionSave_triggered();
144
    void                    on_actionSave_As_triggered();
145 146
    void                    on_actionHelp_triggered();
    void                    on_actionProject_Preferences_triggered();
147
    void                    on_actionClose_Project_triggered();
148 149
    void                    on_actionUndo_triggered();
    void                    on_actionRedo_triggered();
150
    void                    on_actionCrash_triggered();
151
    void                    on_actionImport_triggered();
152
    void                    toolButtonClicked( QAction *action );
153
    void                    projectUpdated( const QString& projectName, bool savedStatus );
154 155
    void                    canUndoChanged( bool canUndo );
    void                    canRedoChanged( bool canRedo );
156 157

signals:
158
    void                    toolChanged( ToolButtons );
159
};
Ludovic Fauvet's avatar
Ludovic Fauvet committed
160 161

#endif // MAINWINDOW_H