Commit f3334510 authored by Christophe Courtaut's avatar Christophe Courtaut

Added Tiny Media Library with very few stuff in it

parent 3756956f
......@@ -49,6 +49,7 @@ void DockWidgetManager::addDockedWidget( QWidget *widget,
dock->setAllowedAreas( areas );
dock->setFeatures( features );
m_mainWin->addDockWidget( startArea, dock );
widget->show();
}
DockWidgetManager::DockWidgetManager()
......
/*****************************************************************************
* LibraryWidget.cpp: VLMC LibraryWidget
*****************************************************************************
* 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.
*****************************************************************************/
#include "LibraryWidget.h"
LibraryWidget::LibraryWidget( QWidget *parent ) : QWidget( parent )
{
m_ui.setupUi( this );
}
void LibraryWidget::on_pushButtonAddMedia_clicked()
{
QFileInfo* fileInfo = NULL;
QListWidgetItem* item;
qDebug() << m_ui.LibraryTabs->currentIndex();
switch( m_ui.LibraryTabs->currentIndex() )
{
case 0:
fileInfo = new QFileInfo( QFileDialog::getOpenFileName( this, tr( "Open Audios" ), "/home/kri5", tr( "Audio Files (*.mp3 *.oga *.flac *.aac *.wav)" )) );
m_ui.listWidgetAudio->addItem(new ListViewMediaItem( fileInfo ));
break;
case 1:
fileInfo = new QFileInfo( QFileDialog::getOpenFileName( this, tr( "Open Videos" ), "/home/kri5", tr( "Video Files (*.mov *.avi *.mkv)" )) );
m_ui.listWidgetVideo->addItem(new ListViewMediaItem( fileInfo ));
break;
case 2:
fileInfo = new QFileInfo( QFileDialog::getOpenFileName( this, tr( "Open Images" ), "/home/kri5", tr( "Video Files (*.gif *.png *.jpg)" )) );
m_ui.listWidgetImage->addItem(new ListViewMediaItem( fileInfo ));
break;
default:
break;
}
m_ui.listWidgetAll->addItem(new ListViewMediaItem( fileInfo ));
}
void LibraryWidget::on_LibraryTabs_currentChanged(int index)
{
if (index == 3)
{
m_ui.pushButtonAddMedia->setEnabled(false);
m_ui.pushButtonRemoveMedia->setEnabled(false);
}
else
{
m_ui.pushButtonAddMedia->setEnabled(true);
m_ui.pushButtonRemoveMedia->setEnabled(true);
}
}
ListViewMediaItem::ListViewMediaItem( QFileInfo* fInfo, QListWidget* parent, int type ) : QListWidgetItem( parent, type )
{
fileInfo = fInfo;
setText(fileInfo->baseName());
}
......@@ -25,19 +25,34 @@
#include <QTabWidget>
#include <QListWidget>
#include <QFileInfoList>
#include <QMessageBox>
#include <QFileDialog>
#include <QtDebug>
#include "ui_LibraryWidget.h"
class LibraryWidget
class LibraryWidget : public QWidget
{
public:
explicit LibraryWidget( QWidget *parent = 0 );
Q_OBJECT
public:
explicit LibraryWidget( QWidget *parent = 0 );
private:
QFileInfoList videoList;
Ui::LibraryWidget m_ui;
private:
QTabWidget *m_tabWidget;
private slots:
void on_LibraryTabs_currentChanged( int index );
void on_pushButtonAddMedia_clicked();
};
class TabList : public QListWidget
class ListViewMediaItem : public QListWidgetItem
{
TabList( QWidget *parent = 0 );
public:
ListViewMediaItem( QFileInfo* fileInfo, QListWidget* parent = 0, int type = Type);
QFileInfo* fileInfo;
};
#endif /* !LIBRARYWIDGET_H */
......@@ -56,16 +56,16 @@ void MainWindow::m_initializeDockWidgets( void )
DockWidgetManager *dockManager = DockWidgetManager::instance();
//First param is NULL for the moment. It will be replaced by the LibraryWidget
dockManager->addDockedWidget( 0,
dockManager->addDockedWidget( new LibraryWidget( this ),
"library",
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::RightDockWidgetArea );
dockManager->addDockedWidget( 0,
"library2",
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::RightDockWidgetArea );
//dockManager->addDockedWidget( 0,
// "library2",
// Qt::AllDockWidgetAreas,
// QDockWidget::AllDockWidgetFeatures,
// Qt::RightDockWidgetArea );
//Create the library widget
}
......
......@@ -45,7 +45,6 @@ private:
Ui::MainWindow m_ui;
LibraryWidget* m_library;
private slots:
void on_actionQuit_triggered();
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LibraryWidget</class>
<widget class="QWidget" name="LibraryWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>380</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pushButtonAddMedia">
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
</size>
</property>
<property name="text">
<string>Add Media</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>502</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" rowspan="4">
<widget class="QTabWidget" name="LibraryTabs">
<property name="tabPosition">
<enum>QTabWidget::East</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="movable">
<bool>false</bool>
</property>
<widget class="QWidget" name="tabAudio">
<attribute name="title">
<string>Audio</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="listWidgetAudio">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabVideo">
<attribute name="title">
<string>Videos</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listWidgetVideo">
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabImage">
<attribute name="title">
<string>Images</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QListWidget" name="listWidgetImage"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAll">
<attribute name="title">
<string>All</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QListWidget" name="listWidgetAll"/>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButtonRemoveMedia">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="text">
<string>Remove
Selected Media</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -28,7 +28,8 @@ HEADERS += src/gui/MainWindow.h \
src/LibVLCpp/VlmMedia.h \
src/gui/Timeline.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/Timeline.ui
src/gui/ui/Timeline.ui \
src/gui/ui/LibraryWidget.ui
RESOURCES +=
LIBS = -L/usr/local/lib \
-lvlc
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