MainWindow.cpp 3.05 KB
Newer Older
Ludovic Fauvet's avatar
Ludovic Fauvet committed
1
/*****************************************************************************
2
 * MainWindow.cpp: VLMC MainWindow
Ludovic Fauvet's avatar
Ludovic Fauvet committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *****************************************************************************
 * Copyright (C) 2008-2009 the VLMC team
 *
 * 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.
 *****************************************************************************/

23 24 25
#include <QLabel>
#include <QSizePolicy>
#include <QPalette>
Christophe Courtaut's avatar
Christophe Courtaut committed
26
#include <QDockWidget>
Ludovic Fauvet's avatar
Ludovic Fauvet committed
27
#include "MainWindow.h"
28
#include "Timeline.h"
Ludovic Fauvet's avatar
Ludovic Fauvet committed
29 30 31 32 33

MainWindow::MainWindow( QWidget *parent ) :
    QMainWindow( parent )
{
    m_ui.setupUi( this );
34
    DockWidgetManager::instance()->setMainWindow( this );
35
    m_initializeDockWidgets();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49
}

void MainWindow::changeEvent( QEvent *e )
{
    switch ( e->type() )
    {
    case QEvent::LanguageChange:
        m_ui.retranslateUi( this );
        break;
    default:
        break;
    }
}

50 51
void MainWindow::m_initializeDockWidgets( void )
{
52
    Timeline* timeline = new Timeline( this );
53
    timeline->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
54 55
    timeline->show();
    setCentralWidget( timeline );
56

57
    DockWidgetManager *dockManager = DockWidgetManager::instance();
58 59

    //First param is NULL for the moment. It will be replaced by the LibraryWidget
60
    dockManager->addDockedWidget( new LibraryWidget( this ),
61
                                  tr( "Media Library" ),
62 63
                                  Qt::AllDockWidgetAreas, 
                                  QDockWidget::AllDockWidgetFeatures,
64
                                  Qt::TopDockWidgetArea );
geoff's avatar
geoff committed
65 66 67 68 69 70 71

    dockManager->addDockedWidget( new PreviewWidget( this ),
                                  tr( "Preview" ),
                                  Qt::AllDockWidgetAreas,
                                  QDockWidget::AllDockWidgetFeatures,
                                  Qt::TopDockWidgetArea );

72 73 74 75 76
    //dockManager->addDockedWidget( 0,
    //                              "library2",
    //                              Qt::AllDockWidgetAreas,
    //                              QDockWidget::AllDockWidgetFeatures,
    //                              Qt::RightDockWidgetArea );
77 78

    //Create the library widget
79 80 81 82
}

//Private slots definition

Ludovic Fauvet's avatar
Ludovic Fauvet committed
83 84 85 86
void MainWindow::on_actionQuit_triggered()
{
    QApplication::quit();
}
87 88 89 90 91 92

void MainWindow::on_actionPreferences_triggered()
{
    Preferences* pref = new Preferences();\
    pref->show();
}