MainWindow.h 6.22 KB
Newer Older
Ludovic Fauvet's avatar
Ludovic Fauvet committed
1
/*****************************************************************************
2
 * MainWindow.h: VLMC MainWindow
Ludovic Fauvet's avatar
Ludovic Fauvet committed
3
 *****************************************************************************
4
 * Copyright (C) 2008-2016 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
 *
 * 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

26
class QUndoView;
27
class QProgressBar;
28

Ludovic Fauvet's avatar
Ludovic Fauvet committed
29
#include <QApplication>
30
#include <QSlider>
31 32
#include <QToolButton>
#include <QButtonGroup>
33
#include <QDockWidget>
34

35
#include "vlmc.h"
36
#include "config.h"
37
#include "ui/MainWindow.h"
38

39
class   EffectsListView;
luyikei's avatar
luyikei committed
40
class   ClipLibraryView;
41
class   MediaLibraryView;
42
class   PreviewWidget;
43
class   Project;
44
class   ProjectWizard;
45
class   SettingsDialog;
46 47
class   Timeline;
class   WorkflowRenderer;
48

49 50
namespace Backend
{
luyikei's avatar
luyikei committed
51
class IBackend;
52 53
}

Ludovic Fauvet's avatar
Ludovic Fauvet committed
54 55 56
class MainWindow : public QMainWindow
{
    Q_OBJECT
Ludovic Fauvet's avatar
Ludovic Fauvet committed
57
    Q_DISABLE_COPY( MainWindow )
Ludovic Fauvet's avatar
Ludovic Fauvet committed
58 59

public:
luyikei's avatar
luyikei committed
60
    explicit MainWindow( Backend::IBackend* backend,
61
                         QWidget *parent = 0 );
62
    ~MainWindow();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
63

64
    void registerWidgetInWindowMenu( QDockWidget* widget );
65
    void        showWizard();
66

Ludovic Fauvet's avatar
Ludovic Fauvet committed
67 68 69
public slots:
    void        zoomIn();
    void        zoomOut();
luyikei's avatar
luyikei committed
70
    void        setScale( quint32 scale );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
71

Ludovic Fauvet's avatar
Ludovic Fauvet committed
72
protected:
73 74
    virtual void    changeEvent( QEvent *e );
    virtual void    closeEvent( QCloseEvent* e );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
75 76

private:
77
    void        initializeDockWidgets();
78
    void        checkFolders();
79
    void        createStatusBar();
80
    void        createGlobalPreferences();
81
    void        createProjectPreferences();
82
    void        clearTemporaryFiles();
83
    void        initVlmcPreferences();
84
    void        loadGlobalProxySettings();
85
    void        initToolbar();
86
    bool        saveSettings();
87
    void        setupLibrary();
88 89
    void        setupClipPreview();
    void        setupProjectPreview();
90 91
    void        setupEffectsList();
    void        setupUndoRedoWidget();
92
    void        retranslateUi();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
93
#ifdef WITH_CRASHBUTTON
94 95
    void        setupCrashTester();
#endif
96 97 98
    /**
     *  \brief  Will check if vlmc closed nicely or crashed.
     *          If so, the emergency backup will be opened.
99
     *  \return true if a project was restored. If so, the wizard should
100 101 102
     *          not be opened.
     */
    bool        restoreSession();
103

104 105
    /**
     *  \brief  Will check if there is any video on the Project Timeline.
luyikei's avatar
luyikei committed
106
     *  \return true, if ( Core::instance()->workflow()->getLengthFrame() > 0 )
107 108 109 110
     *          else false
     */
    bool        checkVideoLength();

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

120 121
    QDockWidget* dockWidget( QWidget* widget, Qt::DockWidgetArea startArea );

122 123 124
    Ui::MainWindow          m_ui;
    QSlider*                m_zoomSlider;
    Timeline*               m_timeline;
luyikei's avatar
luyikei committed
125
    Backend::IBackend*      m_backend;
126 127
    PreviewWidget*          m_clipPreview;
    PreviewWidget*          m_projectPreview;
128 129 130 131
    SettingsDialog*         m_globalPreferences;
    SettingsDialog*         m_DefaultProjectPreferences;
    SettingsDialog*         m_projectPreferences;
    ProjectWizard*          m_wizard;
luyikei's avatar
luyikei committed
132 133
    MediaLibraryView*       m_mediaLibrary;
    ClipLibraryView*        m_clipLibrary;
134 135
    EffectsListView*        m_effectsList;
    QUndoView*              m_undoView;
136 137
    QDockWidget*            m_dockedUndoView;
    QDockWidget*            m_dockedEffectsList;
luyikei's avatar
luyikei committed
138 139
    QDockWidget*            m_dockedClipLibrary;
    QDockWidget*            m_dockedMediaLibrary;
140 141
    QDockWidget*            m_dockedClipPreview;
    QDockWidget*            m_dockedProjectPreview;
142
    QProgressBar*           m_progressBar;
Ludovic Fauvet's avatar
Ludovic Fauvet committed
143 144

private slots:
145 146 147 148 149
    void                    on_actionFullscreen_triggered( bool checked );
    void                    on_actionQuit_triggered();
    void                    on_actionAbout_triggered();
    void                    on_actionPreferences_triggered();
    void                    on_actionRender_triggered();
150
    void                    on_actionShare_On_Internet_triggered();
151 152 153
    void                    on_actionNew_Project_triggered();
    void                    on_actionLoad_Project_triggered();
    void                    on_actionSave_triggered();
154
    void                    on_actionSave_As_triggered();
155 156
    void                    on_actionHelp_triggered();
    void                    on_actionProject_Preferences_triggered();
157 158
    void                    on_actionUndo_triggered();
    void                    on_actionRedo_triggered();
159
    void                    on_actionCrash_triggered();
160
    void                    toolButtonClicked( QAction *action );
161
    void                    updateRecentProjects();
162
    void                    projectNameChanged(const QString& projectName);
163
    void                    cleanStateChanged( bool isClean );
164 165
    void                    canUndoChanged( bool canUndo );
    void                    canRedoChanged( bool canRedo );
166 167
    void                    onOudatedBackupFile();
    void                    onBackupFileLoaded();
168
    void                    onProjectSaved();
169 170

signals:
171 172
    void                    selectionToolSelected();
    void                    cutToolSelected();
173
    void                    scaleChanged( quint32 scaleLevel );
174
};
Ludovic Fauvet's avatar
Ludovic Fauvet committed
175 176

#endif // MAINWINDOW_H