MainWindow.h 5.83 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 55
    void registerWidgetInWindowMenu( QDockWidget* widget );

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

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

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

91 92 93 94 95 96 97 98 99 100 101
    /**
     *  \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.
102
     *  \return true if video renders well or not cancelled by the user.
103
     */
104
    bool        renderVideo( const QString& outputFileName, quint32 width, quint32 height,
105 106
                             double fps, quint32 vbitrate, quint32 abitrate );

107 108 109 110
    /**
     *  \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.
111
     *  \return same as renderVideo(),
112 113
     *          true if video renders well or not cancelled by the user.
     */
114 115
    bool        renderVideoSettings( bool exportType );

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

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

signals:
155
    void                    toolChanged( ToolButtons );
156
};
Ludovic Fauvet's avatar
Ludovic Fauvet committed
157 158

#endif // MAINWINDOW_H