Commit e54d6f67 authored by Clement CHAVANCE's avatar Clement CHAVANCE

added a basic dock widget manager

Added class DockWidgetManager, and replaced the call to QDockWidget in
class MainWindow
parent b8249e90
/*****************************************************************************
* main.cpp: VLMC main
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Clement CHAVANCE <chavance.c@gmail.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.
*****************************************************************************/
#include "DockWidgetManager.h"
DockWidgetManager::DockWidgetManager( QMainWindow* mainWin )
: m_mainWin(mainWin)
{
}
void DockWidgetManager::addDockedWidget( QWidget *widget,
const QString &qs_name,
Qt::DockWidgetAreas areas,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea)
{
QDockWidget* dock = new QDockWidget( tr( qs_name.toStdString().c_str() ), m_mainWin );
dock->setAllowedAreas( areas );
dock->setFeatures( features );
m_mainWin->addDockWidget( startArea, dock );
}
/*****************************************************************************
* main.cpp: VLMC main
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Clement CHAVANCE <chavance.c@gmail.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 DOCKWIDGETMANAGER_H
#define DOCKWIDGETMANAGER_H
#include <QObject>
#include <QMainWindow>
#include <QWidget>
#include <QDockWidget>
#include <QString>
class DockWidgetManager : public QObject
{
Q_OBJECT
public:
explicit DockWidgetManager( QMainWindow *mainWin );
void addDockedWidget( QWidget *widget,
const QString &qs_name,
Qt::DockWidgetAreas areas,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea );
private:
QMainWindow *m_mainWin;
};
#endif
......@@ -20,6 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QLabel>
#include <QSizePolicy>
#include <QPalette>
#include <QDockWidget>
#include "MainWindow.h"
......@@ -27,8 +30,8 @@ MainWindow::MainWindow( QWidget *parent ) :
QMainWindow( parent )
{
m_ui.setupUi( this );
//TODO : init all the dockable widget here
m_initializeDockWidgets();
m_dockManager = new DockWidgetManager( this );
m_initializeDockWidgets();
}
void MainWindow::changeEvent( QEvent *e )
......@@ -45,8 +48,16 @@ void MainWindow::changeEvent( QEvent *e )
void MainWindow::m_initializeDockWidgets( void )
{
QDockWidget* dock = new QDockWidget( tr("library"), this );
//Create the library widget
QWidget *central = new QWidget( this );
central->show();
setCentralWidget( central );
//First param is NULL for the moment. It will be replaced by the LibraryWidget
m_dockManager->addDockedWidget( 0, "library", Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures, Qt::RightDockWidgetArea );
m_dockManager->addDockedWidget( 0, "library2", Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures, Qt::RightDockWidgetArea );
//Create the library widget
}
//Private slots definition
......
......@@ -26,6 +26,7 @@
#include <QApplication>
#include "ui_MainWindow.h"
#include "LibraryWidget.h"
#include "DockWidgetManager.h"
class MainWindow : public QMainWindow
{
......@@ -43,6 +44,7 @@ private:
Ui::MainWindow m_ui;
DockWidgetManager *m_dockManager;
LibraryWidget* m_library;
......
......@@ -9,11 +9,13 @@ SOURCES += src/main.cpp \
src/gui/MainWindow.cpp \
src/gui/LibraryWidget.cpp \
src/gui/Timeline.cpp \
src/gui/DockWidgetManager.cpp \
src/LibVLCpp/VLCException.cpp \
src/LibVLCpp/VlmManager.cpp \
src/LibVLCpp/VLCInstance.cpp \
src/LibVLCpp/VlmMedia.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
src/gui/Timeline.h \
src/LibVLCpp/VLCpp.hpp \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment