Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
d5e0f64e
Commit
d5e0f64e
authored
Jan 14, 2010
by
Geoffroy Lacarriere
Browse files
Refactor of the import menu.
All the medias are managed by the library now.
parent
6c83ef95
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/Gui/import/ImportController.cpp
View file @
d5e0f64e
...
...
@@ -22,12 +22,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QTime>
#include "ImportController.h"
#include "ui_ImportController.h"
#include "ClipRenderer.h"
#include "ImportController.h"
#include "Library.h"
#include "QPalette"
#include <QPalette>
#include <QTime>
ImportController
::
ImportController
(
QWidget
*
parent
)
:
QDialog
(
parent
),
...
...
@@ -36,30 +38,25 @@ ImportController::ImportController(QWidget *parent) :
m_controllerSwitched
(
false
)
{
m_ui
->
setupUi
(
this
);
m_model
=
new
ImportModel
();
m_preview
=
new
PreviewWidget
(
new
ClipRenderer
,
m_ui
->
previewContainer
);
m_stackNav
=
new
StackViewController
(
m_ui
->
stackViewContainer
,
false
);
m_mediaListController
=
new
ImportMediaListController
(
m_stackNav
);
m_tag
=
new
TagWidget
(
m_ui
->
tagContainer
,
6
);
m_filesModel
=
new
QDirModel
();
m_stackNav
->
pushViewController
(
m_mediaListController
);
QStringList
filters
;
//Video
filters
<<
"*.mov"
<<
"*.avi"
<<
"*.mkv"
<<
"*.mpg"
<<
"*.mpeg"
<<
"*.wmv"
<<
"*.mp4"
<<
"*.ogg"
<<
"*.ogv"
;
//Audio
filters
<<
"*.mov"
<<
"*.avi"
<<
"*.mkv"
<<
"*.mpg"
<<
"*.mpeg"
<<
"*.wmv"
<<
"*.mp4"
<<
"*.ogg"
<<
"*.ogv"
;
filters
<<
"*.mp3"
<<
"*.oga"
<<
"*.flac"
<<
"*.aac"
<<
"*.wav"
;
//Picture
filters
<<
"*.gif"
<<
"*.png"
<<
"*.jpg"
;
m_filesModel
->
setFilter
(
QDir
::
AllDirs
|
QDir
::
Files
|
QDir
::
Readable
|
QDir
::
NoDotAndDotDot
);
m_filesModel
->
setFilter
(
QDir
::
AllDirs
|
QDir
::
Files
|
QDir
::
Readable
|
QDir
::
NoDotAndDotDot
);
m_filesModel
->
sort
(
2
,
Qt
::
AscendingOrder
);
m_filesModel
->
sort
(
0
,
Qt
::
AscendingOrder
);
m_filesModel
->
setNameFilters
(
filters
);
m_model
->
setFilter
(
filters
);
Library
::
getInstance
()
->
setFilter
(
filters
);
m_ui
->
treeView
->
setModel
(
m_filesModel
);
m_ui
->
treeView
->
setRootIndex
(
m_filesModel
->
index
(
QDir
::
rootPath
()
)
);
m_ui
->
treeView
->
setCurrentIndex
(
m_filesModel
->
index
(
QDir
::
homePath
()
)
);
...
...
@@ -73,36 +70,47 @@ ImportController::ImportController(QWidget *parent) :
m_fsWatcher
->
addPath
(
QDir
::
homePath
()
);
m_currentlyWatchedDir
=
QDir
::
homePath
();
connect
(
m_fsWatcher
,
SIGNAL
(
directoryChanged
(
QString
)
),
m_filesModel
,
SLOT
(
refresh
()
)
);
connect
(
m_ui
->
treeView
,
SIGNAL
(
clicked
(
QModelIndex
)
),
this
,
SLOT
(
treeViewClicked
(
QModelIndex
)
)
);
connect
(
m_ui
->
treeView
,
SIGNAL
(
doubleClicked
(
QModelIndex
)
),
this
,
SLOT
(
treeViewDoubleClicked
(
QModelIndex
)
)
);
connect
(
m_ui
->
forwardButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
forwardButtonClicked
()
)
);
connect
(
m_model
,
SIGNAL
(
newMediaLoaded
(
Media
*
)
),
this
,
SLOT
(
newMediaLoaded
(
Media
*
)
)
);
connect
(
m_model
,
SIGNAL
(
updateMediaRequested
(
Media
*
)
),
this
,
SLOT
(
updateMediaRequested
(
Media
*
)
)
);
connect
(
this
,
SIGNAL
(
mediaSelected
(
Media
*
)
),
m_preview
->
getGenericRenderer
(),
SLOT
(
setMedia
(
Media
*
)
)
);
connect
(
this
,
SIGNAL
(
mediaSelected
(
Media
*
)
),
m_tag
,
SLOT
(
mediaSelected
(
Media
*
)
)
);
//Media
connect
(
m_mediaListController
,
SIGNAL
(
mediaSelected
(
QUuid
)
),
this
,
SLOT
(
mediaSelection
(
QUuid
)
)
);
connect
(
m_mediaListController
,
SIGNAL
(
mediaDeleted
(
QUuid
)
),
this
,
SLOT
(
mediaDeletion
(
QUuid
)
)
);
//Clips
connect
(
m_mediaListController
,
SIGNAL
(
showClipListAsked
(
const
QUuid
&
)
),
this
,
SLOT
(
showClipList
(
const
QUuid
&
)
)
);
connect
(
m_preview
,
SIGNAL
(
addClip
(
Clip
*
)
),
m_mediaListController
,
SLOT
(
clipAdded
(
Clip
*
)
)
);
//StackViewController
connect
(
m_stackNav
,
SIGNAL
(
previousButtonPushed
()
),
this
,
SLOT
(
restoreContext
()
)
);
connect
(
m_fsWatcher
,
SIGNAL
(
directoryChanged
(
QString
)
),
m_filesModel
,
SLOT
(
refresh
()
)
);
connect
(
m_ui
->
treeView
,
SIGNAL
(
clicked
(
QModelIndex
)
),
this
,
SLOT
(
treeViewClicked
(
QModelIndex
)
)
);
connect
(
m_ui
->
treeView
,
SIGNAL
(
doubleClicked
(
QModelIndex
)
),
this
,
SLOT
(
treeViewDoubleClicked
(
QModelIndex
)
)
);
connect
(
m_ui
->
forwardButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
forwardButtonClicked
()
)
);
connect
(
Library
::
getInstance
(),
SIGNAL
(
newMediaLoaded
(
const
QUuid
&
)
),
this
,
SLOT
(
newMediaLoaded
(
const
QUuid
&
)
)
);
connect
(
Library
::
getInstance
(),
SIGNAL
(
updateMediaRequested
(
const
QUuid
&
)
),
this
,
SLOT
(
updateMediaRequested
(
const
QUuid
&
)
)
);
connect
(
this
,
SIGNAL
(
mediaSelected
(
Media
*
)
),
m_preview
->
getGenericRenderer
(),
SLOT
(
setMedia
(
Media
*
)
)
);
connect
(
this
,
SIGNAL
(
mediaSelected
(
Media
*
)
),
m_tag
,
SLOT
(
mediaSelected
(
Media
*
)
)
);
connect
(
m_mediaListController
,
SIGNAL
(
mediaSelected
(
const
QUuid
&
)
),
this
,
SLOT
(
mediaSelection
(
const
QUuid
&
)
)
);
connect
(
m_mediaListController
,
SIGNAL
(
mediaDeleted
(
const
QUuid
&
)
),
this
,
SLOT
(
mediaDeletion
(
const
QUuid
&
)
)
);
connect
(
m_mediaListController
,
SIGNAL
(
showClipListAsked
(
const
QUuid
&
)
),
this
,
SLOT
(
showClipList
(
const
QUuid
&
)
)
);
connect
(
m_preview
,
SIGNAL
(
addClip
(
Clip
*
)
),
m_mediaListController
,
SLOT
(
clipAdded
(
Clip
*
)
)
);
//StackViewController
connect
(
m_stackNav
,
SIGNAL
(
previousButtonPushed
()
),
this
,
SLOT
(
restoreContext
()
)
);
}
ImportController
::~
ImportController
()
{
delete
m_ui
;
delete
m_model
;
delete
m_stackNav
;
delete
m_tag
;
}
void
ImportController
::
changeEvent
(
QEvent
*
e
)
void
ImportController
::
changeEvent
(
QEvent
*
e
)
{
QDialog
::
changeEvent
(
e
);
switch
(
e
->
type
()
)
...
...
@@ -115,42 +123,39 @@ void ImportController::changeEvent( QEvent *e )
}
}
void
ImportController
::
newMediaLoaded
(
Media
*
media
)
{
m_mediaListController
->
addMedia
(
media
);
}
void
ImportController
::
mediaSelection
(
const
QUuid
&
uuid
)
void
ImportController
::
mediaSelection
(
const
QUuid
&
uuid
)
{
if
(
m_mediaListController
->
contains
(
uuid
)
)
{
if
(
!
m_currentUuid
.
isNull
()
&&
m_mediaListController
->
contains
(
m_currentUuid
)
)
m_mediaListController
->
getC
ell
(
m_currentUuid
)
->
setPalette
(
palette
()
);
QPalette
p
=
m_mediaListController
->
getC
ell
(
uuid
)
->
palette
();
m_mediaListController
->
c
ell
(
m_currentUuid
)
->
setPalette
(
this
->
palette
()
);
QPalette
p
=
m_mediaListController
->
c
ell
(
uuid
)
->
palette
();
p
.
setColor
(
QPalette
::
Window
,
QColor
(
Qt
::
darkBlue
)
);
m_mediaListController
->
getC
ell
(
uuid
)
->
setPalette
(
p
);
m_mediaListController
->
c
ell
(
uuid
)
->
setPalette
(
p
);
setUIMetaData
(
m_model
->
get
Media
(
uuid
)
);
setUIMetaData
(
Library
::
getInstance
()
->
temporary
Media
(
uuid
)
);
if
(
uuid
!=
NULL
&&
uuid
!=
m_currentUuid
)
m_preview
->
stop
();
m_currentUuid
=
uuid
;
emit
mediaSelected
(
m_model
->
get
Media
(
uuid
)
);
emit
mediaSelected
(
Library
::
getInstance
()
->
temporary
Media
(
uuid
)
);
}
}
void
ImportController
::
clipSelection
(
const
QUuid
&
uuid
)
void
ImportController
::
clipSelection
(
const
QUuid
&
uuid
)
{
if
(
!
m_currentUuid
.
isNull
()
&&
!
m_controllerSwitched
)
m_clipListController
->
getC
ell
(
m_currentUuid
)
->
setPalette
(
palette
()
);
m_clipListController
->
c
ell
(
m_currentUuid
)
->
setPalette
(
palette
()
);
else
m_controllerSwitched
=
false
;
QPalette
p
=
m_clipListController
->
getC
ell
(
uuid
)
->
palette
();
QPalette
p
=
m_clipListController
->
c
ell
(
uuid
)
->
palette
();
p
.
setColor
(
QPalette
::
Window
,
QColor
(
Qt
::
darkBlue
)
);
m_clipListController
->
getC
ell
(
uuid
)
->
setPalette
(
p
);
m_clipListController
->
c
ell
(
uuid
)
->
setPalette
(
p
);
Clip
*
clip
;
foreach
(
QUuid
id
,
m_model
->
getM
edias
()
->
keys
()
)
foreach
(
QUuid
id
,
Library
::
getInstance
()
->
m
edias
()
->
keys
()
)
{
Media
*
media
=
m_model
->
getM
edias
()
->
value
(
id
);
Media
*
media
=
Library
::
getInstance
()
->
m
edias
()
->
value
(
id
);
if
(
(
clip
=
media
->
clip
(
uuid
)
)
!=
0
)
break
;
}
...
...
@@ -161,17 +166,30 @@ void ImportController::clipSelection( const QUuid& uuid )
m_currentUuid
=
uuid
;
}
void
ImportController
::
updateMediaRequested
(
Media
*
media
)
void
ImportController
::
newMediaLoaded
(
const
QUuid
&
uuid
)
{
if
(
m_mediaListController
->
contains
(
media
->
getUuid
()
)
)
{
ImportMediaCellView
*
cell
=
m_mediaListController
->
getCell
(
media
->
getUuid
()
);
cell
->
setThumbnail
(
media
->
getSnapshot
()
);
cell
->
setLength
(
media
->
getLengthMS
()
);
}
Media
*
media
=
Library
::
getInstance
()
->
temporaryMedia
(
uuid
);
if
(
media
==
NULL
)
return
;
m_mediaListController
->
addMedia
(
media
);
}
void
ImportController
::
setUIMetaData
(
Media
*
media
)
void
ImportController
::
updateMediaRequested
(
const
QUuid
&
uuid
)
{
Media
*
media
=
Library
::
getInstance
()
->
temporaryMedia
(
uuid
);
if
(
media
==
NULL
)
return
;
ImportMediaCellView
*
cell
=
m_mediaListController
->
cell
(
media
->
getUuid
()
);
if
(
cell
==
NULL
)
return
;
cell
->
setThumbnail
(
media
->
getSnapshot
()
);
cell
->
setLength
(
media
->
getLengthMS
()
);
}
void
ImportController
::
setUIMetaData
(
Media
*
media
)
{
if
(
media
!=
NULL
)
{
...
...
@@ -185,7 +203,7 @@ void ImportController::setUIMetaData( Media* media )
setWindowTitle
(
media
->
getFileInfo
()
->
fileName
()
+
" "
+
tr
(
"properties"
)
);
//Resolution
m_ui
->
resolutionValueLabel
->
setText
(
QString
::
number
(
media
->
getWidth
()
)
+
" x "
+
QString
::
number
(
media
->
getHeight
()
)
);
+
" x "
+
QString
::
number
(
media
->
getHeight
()
)
);
//FPS
m_ui
->
fpsValueLabel
->
setText
(
QString
::
number
(
media
->
getFps
()
)
);
}
...
...
@@ -198,31 +216,33 @@ void ImportController::setUIMetaData( Media* media )
}
}
void
ImportController
::
setUIMetaData
(
Clip
*
clip
)
void
ImportController
::
setUIMetaData
(
Clip
*
clip
)
{
//compute clip length
QTime
time
;
qint64
length
=
clip
->
getLengthSecond
();
time
=
time
.
addSecs
(
length
);
qDebug
()
<<
time
;
m_ui
->
durationValueLabel
->
setText
(
time
.
toString
(
"hh:mm:ss"
)
);
//Filename || title
m_ui
->
nameValueLabel
->
setText
(
clip
->
getParent
()
->
getFileInfo
()
->
fileName
()
);
m_ui
->
nameValueLabel
->
setWordWrap
(
true
);
setWindowTitle
(
clip
->
getParent
()
->
getFileInfo
()
->
fileName
()
+
" "
+
tr
(
"properties"
)
);
//Resolution
setWindowTitle
(
clip
->
getParent
()
->
getFileInfo
()
->
fileName
()
+
" "
+
tr
(
"properties"
)
);
m_ui
->
resolutionValueLabel
->
setText
(
QString
::
number
(
clip
->
getParent
()
->
getWidth
()
)
+
" x "
+
QString
::
number
(
clip
->
getParent
()
->
getHeight
()
)
);
//FPS
m_ui
->
fpsValueLabel
->
setText
(
QString
::
number
(
clip
->
getParent
()
->
getFps
()
)
);
}
void
ImportController
::
forwardButtonClicked
()
void
ImportController
::
forwardButtonClicked
()
{
m_model
->
loadFile
(
m_filesModel
->
fileInfo
(
m_ui
->
treeView
->
selectionModel
()
->
currentIndex
()
).
filePath
()
);
QModelIndex
index
=
m_ui
->
treeView
->
selectionModel
()
->
currentIndex
();
QString
filePath
=
m_filesModel
->
fileInfo
(
index
).
filePath
();
Library
::
getInstance
()
->
loadFile
(
filePath
);
}
void
ImportController
::
treeViewClicked
(
const
QModelIndex
&
index
)
void
ImportController
::
treeViewClicked
(
const
QModelIndex
&
index
)
{
if
(
m_filesModel
->
isDir
(
index
)
)
{
...
...
@@ -233,35 +253,36 @@ void ImportController::treeViewClicked( const QModelIndex& index )
m_ui
->
forwardButton
->
setEnabled
(
true
);
}
void
ImportController
::
treeViewDoubleClicked
(
const
QModelIndex
&
index
)
void
ImportController
::
treeViewDoubleClicked
(
const
QModelIndex
&
index
)
{
if
(
!
m_filesModel
->
isDir
(
index
)
)
forwardButtonClicked
();
}
void
ImportController
::
reject
()
void
ImportController
::
reject
()
{
m_preview
->
stop
();
m_model
->
removeAllMedias
();
m_mediaListController
->
cleanAll
();
Library
::
getInstance
()
->
deleteTemporaryMedias
();
done
(
Rejected
);
}
void
ImportController
::
accept
()
void
ImportController
::
accept
()
{
QUuid
id
;
foreach
(
id
,
m_model
->
getMedias
()
->
keys
()
)
{
Media
*
media
=
m_model
->
getMedias
()
->
value
(
id
);
Library
::
getInstance
()
->
addMedia
(
media
);
}
m_mediaListController
->
cleanAll
();
Library
::
getInstance
()
->
importDone
();
m_preview
->
stop
();
done
(
Accepted
);
}
void
ImportController
::
mediaDeletion
(
const
QUuid
&
uuid
)
void
ImportController
::
mediaDeletion
(
const
QUuid
&
uuid
)
{
Library
::
getInstance
()
->
deleteMedia
(
uuid
);
m_mediaListController
->
removeMedia
(
uuid
);
m_model
->
removeMedia
(
uuid
);
if
(
uuid
==
m_currentUuid
)
{
...
...
@@ -271,29 +292,31 @@ void ImportController::mediaDeletion( const QUuid& uuid )
}
}
void
ImportController
::
clipDeletion
(
const
QUuid
&
uuid
)
void
ImportController
::
clipDeletion
(
const
QUuid
&
uuid
)
{
m_clipListController
->
removeClip
(
uuid
);
QUuid
id
;
foreach
(
id
,
m_model
->
get
Medias
()
->
keys
()
)
foreach
(
id
,
Library
::
getInstance
()
->
temporary
Medias
()
->
keys
()
)
{
Media
*
media
=
m_model
->
getMedias
()
->
value
(
id
);
if
(
media
->
clip
(
uuid
)
)
{
Media
*
media
=
Library
::
getInstance
()
->
temporaryMedias
()
->
value
(
id
);
if
(
media
!=
NULL
&&
media
->
clip
(
uuid
)
)
media
->
removeClip
(
uuid
);
}
}
}
void
ImportController
::
showClipList
(
const
QUuid
&
uuid
)
void
ImportController
::
showClipList
(
const
QUuid
&
uuid
)
{
Media
*
media
=
m_model
->
getMedia
(
uuid
);
if
(
media
->
clips
()
->
size
()
==
0
)
Media
*
media
=
Library
::
getInstance
()
->
temporaryMedia
(
uuid
);
if
(
media
==
NULL
||
media
->
clips
()
->
size
()
==
0
)
return
;
m_clipListController
=
new
ImportMediaListController
(
m_stackNav
);
connect
(
m_clipListController
,
SIGNAL
(
clipSelected
(
const
QUuid
&
)
),
this
,
SLOT
(
clipSelection
(
const
QUuid
&
)
)
);
connect
(
m_clipListController
,
SIGNAL
(
clipDeleted
(
const
QUuid
&
)
),
this
,
SLOT
(
clipDeletion
(
const
QUuid
&
)
)
);
connect
(
m_clipListController
,
SIGNAL
(
clipSelected
(
const
QUuid
&
)
),
this
,
SLOT
(
clipSelection
(
const
QUuid
&
)
)
);
connect
(
m_clipListController
,
SIGNAL
(
clipDeleted
(
const
QUuid
&
)
),
this
,
SLOT
(
clipDeletion
(
const
QUuid
&
)
)
);
m_clipListController
->
addClipsFromMedia
(
media
);
if
(
!
m_currentUuid
.
isNull
()
)
m_savedUuid
=
m_currentUuid
;
...
...
@@ -301,12 +324,16 @@ void ImportController::showClipList( const QUuid& uuid )
m_stackNav
->
pushViewController
(
m_clipListController
);
}
void
ImportController
::
restoreContext
()
void
ImportController
::
restoreContext
()
{
if
(
m_clipListController
->
getN
bDeletions
()
!=
0
)
if
(
m_clipListController
->
n
bDeletions
()
!=
0
)
{
if
(
!
m_savedUuid
.
isNull
()
)
m_mediaListController
->
getCell
(
m_savedUuid
)
->
decrementClipCount
(
m_clipListController
->
getNbDeletions
()
);
if
(
!
m_savedUuid
.
isNull
()
&&
m_mediaListController
->
cell
(
m_savedUuid
)
!=
NULL
)
{
ImportMediaCellView
*
cell
=
m_mediaListController
->
cell
(
m_savedUuid
);
cell
->
decrementClipCount
(
m_clipListController
->
nbDeletions
()
);
}
}
if
(
!
m_savedUuid
.
isNull
()
)
m_currentUuid
=
m_savedUuid
;
...
...
src/Gui/import/ImportController.h
View file @
d5e0f64e
...
...
@@ -22,26 +22,34 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/** \file
* This file ImportController contains class declaration/definition.
* It's the the controler of the import menu widget of vlmc.
*/
#ifndef IMPORTCONTROLLER_H
#define IMPORTCONTROLLER_H
#include <QDialog>
#include <QDirModel>
#include <QFileSystemWatcher>
#include "Media.h"
#include "Clip.h"
#include "ImportModel.h"
#include "ImportMediaListController.h"
#include "Media.h"
#include "PreviewWidget.h"
#include "StackViewController.h"
#include "TagWidget.h"
#include "ImportMediaListController.h"
#include <QDialog>
#include <QDirModel>
#include <QFileSystemWatcher>
namespace
Ui
{
class
ImportController
;
}
/**
* \class ImportController
* \brief Controller of the import menu
*/
class
ImportController
:
public
QDialog
{
Q_OBJECT
...
...
@@ -58,7 +66,6 @@ class ImportController : public QDialog
private:
Ui
::
ImportController
*
m_ui
;
PreviewWidget
*
m_preview
;
ImportModel
*
m_model
;
StackViewController
*
m_stackNav
;
TagWidget
*
m_tag
;
ImportMediaListController
*
m_mediaListController
;
...
...
@@ -71,8 +78,8 @@ class ImportController : public QDialog
bool
m_controllerSwitched
;
public
slots
:
void
newMediaLoaded
(
Media
*
media
);
void
updateMediaRequested
(
Media
*
media
);
void
newMediaLoaded
(
const
QUuid
&
uuid
);
void
updateMediaRequested
(
const
QUuid
&
uuid
);
void
accept
();
void
reject
();
void
mediaSelection
(
const
QUuid
&
uuid
);
...
...
src/Gui/import/ImportMediaListController.cpp
View file @
d5e0f64e
...
...
@@ -25,7 +25,8 @@
#include "ImportMediaListController.h"
#include <QDebug>
ImportMediaListController
::
ImportMediaListController
(
StackViewController
*
nav
)
:
ListViewController
(
nav
),
m_nav
(
nav
),
m_clipDeleted
(
0
)
ImportMediaListController
::
ImportMediaListController
(
StackViewController
*
nav
)
:
ListViewController
(
nav
),
m_nav
(
nav
),
m_clipDeleted
(
0
)
{
m_mediaCellList
=
new
QHash
<
QUuid
,
ImportMediaCellView
*>
();
}
...
...
@@ -35,48 +36,61 @@ ImportMediaListController::~ImportMediaListController()
delete
m_mediaCellList
;
}
void
ImportMediaListController
::
addMedia
(
Media
*
media
)
void
ImportMediaListController
::
addMedia
(
Media
*
media
)
{
ImportMediaCellView
*
cell
=
new
ImportMediaCellView
(
media
->
getUuid
()
);
connect
(
cell
,
SIGNAL
(
cellSelected
(
const
QUuid
&
)
),
this
,
SIGNAL
(
mediaSelected
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
cellDeleted
(
const
QUuid
&
)
),
this
,
SIGNAL
(
mediaDeleted
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
arrowClicked
(
const
QUuid
&
)
),
this
,
SIGNAL
(
showClipListAsked
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
cellSelected
(
const
QUuid
&
)
),
this
,
SIGNAL
(
mediaSelected
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
cellDeleted
(
const
QUuid
&
)
),
this
,
SIGNAL
(
mediaDeleted
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
arrowClicked
(
const
QUuid
&
)
),
this
,
SIGNAL
(
showClipListAsked
(
const
QUuid
&
)
)
);
cell
->
setTitle
(
media
->
getFileName
()
);
cell
->
setThumbnail
(
media
->
getSnapshot
()
);
addCell
(
cell
);
m_mediaCellList
->
insert
(
media
->
getUuid
(),
cell
);
qDebug
()
<<
"addMedia: "
<<
media
->
getUuid
();
}
void
ImportMediaListController
::
metaDataComputed
(
Media
*
media
)
void
ImportMediaListController
::
metaDataComputed
(
Media
*
media
)
{
m_mediaCellList
->
value
(
media
->
getUuid
()
)
->
setThumbnail
(
media
->
getSnapshot
()
);
}
ImportMediaCellView
*
ImportMediaListController
::
getCell
(
QUuid
uuid
)
const
ImportMediaCellView
*
ImportMediaListController
::
cell
(
QUuid
uuid
)
const
{
if
(
m_mediaCellList
->
contains
(
uuid
)
)
return
m_mediaCellList
->
value
(
uuid
);
return
NULL
;
}
bool
ImportMediaListController
::
contains
(
QUuid
uuid
)
bool
ImportMediaListController
::
contains
(
QUuid
uuid
)
{
return
m_mediaCellList
->
contains
(
uuid
);
}
void
ImportMediaListController
::
removeMedia
(
const
QUuid
&
uuid
)
void
ImportMediaListController
::
removeMedia
(
const
QUuid
&
uuid
)
{
const
QUuid
saveUuid
=
uuid
;
removeCell
(
m_mediaCellList
->
value
(
uuid
)
);
m_mediaCellList
->
remove
(
u
uid
);
m_mediaCellList
->
remove
(
saveU
uid
);
}
void
ImportMediaListController
::
addClip
(
Clip
*
clip
)
void
ImportMediaListController
::
addClip
(
Clip
*
clip
)
{
ImportMediaCellView
*
cell
=
new
ImportMediaCellView
(
clip
->
getUuid
()
);
connect
(
cell
,
SIGNAL
(
cellSelected
(
const
QUuid
&
)
),
this
,
SIGNAL
(
clipSelected
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
cellDeleted
(
const
QUuid
&
)
),
this
,
SLOT
(
clipDeletion
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
cellSelected
(
const
QUuid
&
)
),
this
,
SIGNAL
(
clipSelected
(
const
QUuid
&
)
)
);
connect
(
cell
,
SIGNAL
(
cellDeleted
(
const
QUuid
&
)
),
this
,
SLOT
(
clipDeletion
(
const
QUuid
&
)
)
);
QString
size
;
...
...
@@ -90,39 +104,43 @@ void ImportMediaListController::addClip( Clip* clip )
m_mediaCellList
->
insert
(
clip
->
getUuid
(),
cell
);
}
void
ImportMediaListController
::
removeClip
(
const
QUuid
&
uuid
)
void
ImportMediaListController
::
removeClip
(
const
QUuid
&
uuid
)
{
removeCell
(
m_mediaCellList
->
value
(
uuid
)
);
m_mediaCellList
->
remove
(
uuid
);
}
void
ImportMediaListController
::
cleanAll
()
void
ImportMediaListController
::
cleanAll
()
{
QUuid
uuid
;
MediaCellView
*
cell
;
foreach
(
uuid
,
m_mediaCellList
->
keys
()
)
{
cell
=
m_mediaCellList
->
value
(
uuid
);
m_layout
->
removeWidget
(
cell
);
delete
cell
;
removeCell
(
cell
);
}
m_mediaCellList
->
clear
();
}
void
ImportMediaListController
::
addClipsFromMedia
(
Media
*
media
)
void
ImportMediaListController
::
addClipsFromMedia
(
Media
*
media
)
{
QUuid
uuid
;
foreach
(
uuid
,
media
->
clips
()
->
keys
()
)
addClip
(
media
->
clips
()
->
value
(
uuid
)
);
}
void
ImportMediaListController
::
clipDeletion
(
const
QUuid
&
uuid
)
void
ImportMediaListController
::
clipDeletion
(
const
QUuid
&
uuid
)
{
m_clipDeleted
+=
1
;
emit
clipDeleted
(
uuid
);
}
void
ImportMediaListController
::
clipAdded
(
Clip
*
clip
)
void
ImportMediaListController
::
clipAdded
(
Clip
*
clip
)
{
if
(
clip
->
getParent
()
==
0
)
return
;
...
...
@@ -131,8 +149,8 @@ void ImportMediaListController::clipAdded( Clip* clip )
m_mediaCellList
->
value
(
uuid
)
->
incrementClipCount
();
}
int
ImportMediaListController
::
getNbDeletions
()
const
const
QHash
<
QUuid
,
ImportMediaCellView
*>*
ImportMediaListController
::
mediaCellList
()
const
{
return
m_
clipDeleted
;
return
m_
mediaCellList
;
}
src/Gui/import/ImportMediaListController.h
View file @
d5e0f64e
...
...
@@ -45,10 +45,10 @@ class ImportMediaListController : public ListViewController
void
cleanAll
();
void
addClipsFromMedia
(
Media
*
media
);
const
QHash
<
QUuid
,
ImportMediaCellView
*>*
getM
ediaCellList
()
const
{
return
m_mediaCellList
;
}