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
486527f1
Commit
486527f1
authored
Oct 02, 2009
by
Thomas Boquet
Browse files
handling cellSelected signal for preview
parent
a37958d3
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/GUI/Library/ListViewController.cpp
View file @
486527f1
...
...
@@ -20,11 +20,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "ListViewController.h"
#include <QPushButton>
#include "ListViewController.h"
#include "MediaCellView.h"
#include
<QPushButton>
#include
"Library.h"
ListViewController
::
ListViewController
(
StackViewController
*
nav
)
:
m_nav
(
nav
)
{
...
...
@@ -61,3 +61,8 @@ void ListViewController::addCell( QWidget* cell )
{
m_layout
->
addWidget
(
cell
);
}
void
ListViewController
::
cellSelected
(
const
QUuid
&
uuid
)
{
emit
selectedClipChanged
(
Library
::
getInstance
()
->
getClip
(
uuid
)
);
}
src/GUI/Library/ListViewController.h
View file @
486527f1
...
...
@@ -27,15 +27,19 @@
#include <QListView>
#include <QAbstractItemModel>
#include <QScrollArea>
#include <QUuid>
#include "ViewController.h"
#include "StackViewController.h"
#include "Clip.h"
class
ListViewController
:
public
ViewController
{
Q_OBJECT
public:
ListViewController
()
{}
ListViewController
(
StackViewController
*
nav
);
~
ListViewController
();
...
...
@@ -49,6 +53,12 @@ private:
QWidget
*
m_container
;
QVBoxLayout
*
m_layout
;
StackViewController
*
m_nav
;
public
slots
:
void
cellSelected
(
const
QUuid
&
);
signals:
void
selectedClipChanged
(
Clip
*
);
};
#endif // LISTVIEWCONTROLLER_H
src/GUI/Library/MediaCellView.cpp
View file @
486527f1
...
...
@@ -7,6 +7,7 @@ MediaCellView::MediaCellView( const QUuid& uuid, QWidget *parent ) :
QWidget
(
parent
),
m_ui
(
new
Ui
::
MediaCellView
),
m_uuid
(
uuid
)
{
m_ui
->
setupUi
(
this
);
setFocusPolicy
(
Qt
::
ClickFocus
);
}
MediaCellView
::~
MediaCellView
()
...
...
@@ -50,10 +51,18 @@ const QUuid& MediaCellView::uuid() const
void
MediaCellView
::
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
buttons
()
|
Qt
::
LeftButton
==
Qt
::
LeftButton
)
if
(
(
event
->
buttons
()
|
Qt
::
LeftButton
)
==
Qt
::
LeftButton
)
{
ClipProperty
*
mp
=
new
ClipProperty
(
Library
::
getInstance
()
->
getClip
(
m_uuid
),
this
);
mp
->
setModal
(
true
);
mp
->
show
();
}
}
void
MediaCellView
::
mousePressEvent
(
QMouseEvent
*
event
)
{
if
(
(
event
->
buttons
()
|
Qt
::
LeftButton
)
==
Qt
::
LeftButton
)
{
emit
cellSelected
(
m_uuid
);
}
}
src/GUI/Library/MediaCellView.h
View file @
486527f1
...
...
@@ -32,6 +32,12 @@ private:
protected:
void
mouseDoubleClickEvent
(
QMouseEvent
*
);
void
mousePressEvent
(
QMouseEvent
*
);
signals:
void
cellSelected
(
const
QUuid
&
uuid
);
};
#endif // MEDIACELLVIEW_H
src/GUI/Library/MediaLibraryWidget.cpp
View file @
486527f1
...
...
@@ -2,13 +2,18 @@
MediaLibraryWidget
::
MediaLibraryWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
StackViewController
*
nav
=
new
StackViewController
(
this
);
MediaListViewController
*
list
=
new
MediaListViewController
(
nav
);
m_
nav
=
new
StackViewController
(
this
);
MediaListViewController
*
list
=
new
MediaListViewController
(
m_
nav
);
nav
->
pushViewController
(
list
);
m_
nav
->
pushViewController
(
list
);
}
MediaLibraryWidget
::~
MediaLibraryWidget
()
{
}
const
ViewController
*
MediaLibraryWidget
::
getCurrentViewController
()
{
return
m_nav
->
getCurrentViewController
();
}
src/GUI/Library/MediaLibraryWidget.h
View file @
486527f1
...
...
@@ -14,6 +14,8 @@ public:
MediaLibraryWidget
(
QWidget
*
parent
=
0
);
virtual
~
MediaLibraryWidget
();
const
ViewController
*
getCurrentViewController
();
private:
StackViewController
*
m_nav
;
};
...
...
src/GUI/Library/MediaListViewController.cpp
View file @
486527f1
#include "MediaListViewController.h"
MediaListViewController
::
MediaListViewController
(
StackViewController
*
nav
)
:
ListViewController
(
nav
)
ListViewController
(
nav
)
,
m_nav
(
nav
)
{
connect
(
Library
::
getInstance
(),
SIGNAL
(
newMediaLoaded
(
Media
*
)
),
this
,
SLOT
(
newMediaLoaded
(
Media
*
)
)
);
}
...
...
@@ -15,6 +15,9 @@ void MediaListViewController::newMediaLoaded( Media* media )
{
MediaCellView
*
cell
=
new
MediaCellView
(
media
->
getUuid
()
);
connect
(
cell
,
SIGNAL
(
cellSelected
(
QUuid
)
),
this
,
SLOT
(
cellSelected
(
QUuid
)
)
);
cell
->
setThumbnail
(
media
->
getSnapshot
()
);
cell
->
setTitle
(
media
->
getFileName
()
);
addCell
(
cell
);
...
...
src/GUI/Library/MediaListViewController.h
View file @
486527f1
...
...
@@ -7,7 +7,7 @@
#include "Library.h"
#include "Media.h"
class
MediaListViewController
:
public
QObject
,
public
ListViewController
class
MediaListViewController
:
public
ListViewController
{
Q_OBJECT
...
...
@@ -15,6 +15,9 @@ public:
MediaListViewController
(
StackViewController
*
nav
);
virtual
~
MediaListViewController
();
private:
StackViewController
*
m_nav
;
public
slots
:
void
newMediaLoaded
(
Media
*
);
};
...
...
src/GUI/Library/StackViewController.cpp
View file @
486527f1
...
...
@@ -74,3 +74,8 @@ void StackViewController::previous()
{
popViewController
();
}
const
ViewController
*
StackViewController
::
getCurrentViewController
()
const
{
return
m_current
;
}
src/GUI/Library/StackViewController.h
View file @
486527f1
...
...
@@ -19,10 +19,10 @@ public:
StackViewController
(
QWidget
*
parent
=
0
);
~
StackViewController
();
void
pushViewController
(
ViewController
*
viewController
,
bool
animated
=
false
);
void
popViewController
(
bool
animated
=
false
)
;
void
pushViewController
(
ViewController
*
viewController
,
bool
animated
=
false
);
void
popViewController
(
bool
animated
=
false
);
const
ViewController
*
getCurrentViewController
()
const
;
private:
StackViewNavController
*
m_nav
;
...
...
src/GUI/Library/ViewController.h
View file @
486527f1
#ifndef VIEWCONTROLLER_H
#define VIEWCONTROLLER_H
#include <Q
Widge
t>
#include <Q
Objec
t>
class
ViewController
class
ViewController
:
public
QObject
{
Q_OBJECT
public:
ViewController
()
{}
//
ViewController() {}
virtual
~
ViewController
()
{}
...
...
src/GUI/MainWindow.cpp
View file @
486527f1
...
...
@@ -154,6 +154,12 @@ void MainWindow::setupLibrary()
connect
(
libraryWidget
->
getVideoListWidget
(),
SIGNAL
(
selectedClipChanged
(
Clip
*
)
),
m_clipPreview
->
getGenericRenderer
(),
SLOT
(
setClip
(
Clip
*
)
)
);
connect
(
mediaLibraryWidget
->
getCurrentViewController
(),
SIGNAL
(
selectedClipChanged
(
Clip
*
)
),
m_clipPreview
->
getGenericRenderer
(),
SLOT
(
setClip
(
Clip
*
)
)
);
connect
(
Library
::
getInstance
(),
SIGNAL
(
mediaRemoved
(
const
QUuid
&
)
),
m_clipPreview
->
getGenericRenderer
(),
SLOT
(
mediaUnloaded
(
QUuid
)
)
);
connect
(
libraryWidget
->
getVideoListWidget
(),
SIGNAL
(
itemDoubleClicked
(
QListWidgetItem
*
)
),
...
...
vlmc.pro
View file @
486527f1
...
...
@@ -131,7 +131,8 @@ HEADERS += src/GUI/MainWindow.h \
src
/
GUI
/
Library
/
ListViewController
.
h
\
src
/
GUI
/
Library
/
MediaCellView
.
h
\
src
/
GUI
/
Library
/
MediaLibraryWidget
.
h
\
src
/
GUI
/
Library
/
MediaListViewController
.
h
src
/
GUI
/
Library
/
MediaListViewController
.
h
\
src
/
GUI
/
Library
/
ViewController
.
h
FORMS
+=
src
/
GUI
/
ui
/
MainWindow
.
ui
\
src
/
GUI
/
ui
/
PreviewWidget
.
ui
\
src
/
GUI
/
ui
/
LanguagePreferences
.
ui
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment