Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
afab4879
Commit
afab4879
authored
Jan 05, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnd try and first media viewer widget
parent
f2948758
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
8 deletions
+108
-8
UBBoardView.cpp
src/board/UBBoardView.cpp
+3
-1
UBMediaPlayer.cpp
src/gui/UBMediaPlayer.cpp
+4
-4
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+77
-2
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+24
-1
No files found.
src/board/UBBoardView.cpp
View file @
afab4879
...
...
@@ -33,6 +33,8 @@
#include "gui/UBToolWidget.h"
#include "gui/UBResources.h"
#include "gui/UBMainWindow.h"
#include "gui/UBTeacherBarWidget.h"
#include "board/UBBoardController.h"
...
...
@@ -725,7 +727,7 @@ void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
{
qDebug
()
<<
event
->
source
();
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
()))
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTeacherBarPreviewMedia
*>
(
event
->
source
())
)
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
event
->
acceptProposedAction
();
...
...
src/gui/UBMediaPlayer.cpp
View file @
afab4879
...
...
@@ -39,7 +39,7 @@ UBMediaPlayer::UBMediaPlayer() :
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
m_videoWidget
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
QSize
buttonSize
(
34
,
28
);
QSize
buttonSize
(
26
,
20
);
// QPushButton *openButton = new QPushButton(this);
...
...
@@ -67,7 +67,7 @@ UBMediaPlayer::UBMediaPlayer() :
slider
->
setMediaObject
(
&
m_MediaObject
);
QVBoxLayout
*
vLayout
=
new
QVBoxLayout
(
this
);
vLayout
->
setContentsMargins
(
8
,
8
,
8
,
8
);
vLayout
->
setContentsMargins
(
1
,
1
,
1
,
1
);
// QHBoxLayout *layout = new QHBoxLayout();
...
...
@@ -101,7 +101,7 @@ UBMediaPlayer::UBMediaPlayer() :
initVideoWindow
();
vLayout
->
addWidget
(
&
m_videoWindow
);
QVBoxLayout
*
buttonPanelLayout
=
new
QVBoxLayout
();
m_videoWindow
.
hide
();
//
m_videoWindow.hide();
// buttonPanelLayout->addLayout(layout);
// timeLabel = new QLabel(this);
...
...
@@ -224,7 +224,7 @@ void UBMediaPlayer::initVideoWindow()
videoLayout
->
addWidget
(
m_videoWidget
);
videoLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
m_videoWindow
.
setLayout
(
videoLayout
);
m_videoWindow
.
setMinimumSize
(
70
,
7
0
);
m_videoWindow
.
setMinimumSize
(
100
,
10
0
);
}
void
UBMediaPlayer
::
playPause
()
...
...
src/gui/UBTeacherBarWidget.cpp
View file @
afab4879
...
...
@@ -333,7 +333,6 @@ void UBTeacherBarWidget::loadContent()
}
}
// Media
// TODO : Add the media items here
mpDropMediaZone
->
reloadMedia
(
nextInfos
.
medias
);
// Links
...
...
@@ -352,6 +351,7 @@ void UBTeacherBarWidget::loadContent()
}
if
(
!
isEmpty
()){
mpPreview
->
mediaViewer
()
->
loadMedia
(
nextInfos
.
medias
);
mpStackWidget
->
setCurrentWidget
(
mpPreview
);
}
}
...
...
@@ -685,12 +685,14 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(QWidget *parent, const char
setLayout
(
mpLayout
);
mpEditButton
=
new
QPushButton
(
tr
(
"Edit infos"
),
this
);
mpEditLayout
=
new
Q
H
BoxLayout
();
mpEditLayout
=
new
Q
V
BoxLayout
();
mpEditLayout
->
addStretch
(
1
);
mpEditLayout
->
addWidget
(
mpEditButton
,
0
);
mpEditLayout
->
addStretch
(
1
);
mpEditLayout
->
addWidget
(
&
mMediaViewer
);
mpLayout
->
addLayout
(
mpEditLayout
);
connect
(
mpEditButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onEdit
()));
}
...
...
@@ -714,3 +716,76 @@ void UBTeacherBarPreviewWidget::onEdit()
{
emit
showEditMode
();
}
// ------------------------------------------------------------------------------------
UBTeacherBarPreviewMedia
::
UBTeacherBarPreviewMedia
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
{
setObjectName
(
name
);
setAcceptDrops
(
true
);
mWidget
=
new
UBWidgetList
(
parent
);
mWidget
->
setEmptyText
(
tr
(
"No media found"
));
mLayout
.
addWidget
(
mWidget
);
setLayout
(
&
mLayout
);
//TO TEST only
// QStringList mediaPathList;
// mediaPathList << "/home/claudio/Desktop/PIPPO.jpg";
// loadMedia(mediaPathList);
}
UBTeacherBarPreviewMedia
::~
UBTeacherBarPreviewMedia
()
{
if
(
mWidget
){
delete
mWidget
;
mWidget
=
NULL
;
}
}
// for test only
QString
tempString
;
void
UBTeacherBarPreviewMedia
::
loadMedia
(
QStringList
pMedias
)
{
foreach
(
QString
eachString
,
pMedias
){
if
(
!
eachString
.
isEmpty
()){
tempString
=
eachString
;
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
eachString
);
if
(
mimeType
.
contains
(
"image"
)){
QPixmap
pix
=
QPixmap
(
eachString
);
QLabel
*
label
=
new
QLabel
();
label
->
setPixmap
(
pix
);
label
->
setScaledContents
(
true
);
mWidget
->
addWidget
(
label
);
// mWidgetList << label;
}
else
if
(
mimeType
.
contains
(
"video"
)
||
mimeType
.
contains
(
"audio"
)){
UBMediaPlayer
*
mediaPlayer
=
new
UBMediaPlayer
();
mediaPlayer
->
setFile
(
eachString
);
mWidget
->
addWidget
(
mediaPlayer
);
// mWidgetList << mediaPlayer;
}
else
{
qWarning
()
<<
"pMediaPath"
<<
eachString
;
qWarning
()
<<
"bad idea to come here"
;
}
}
}
}
void
UBTeacherBarPreviewMedia
::
mousePressEvent
(
QMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
QMimeData
*
mimeData
=
new
QMimeData
;
QList
<
QUrl
>
urls
;
urls
<<
QUrl
::
fromLocalFile
(
tempString
);
mimeData
->
setUrls
(
urls
);
mimeData
->
setText
(
tempString
);
QDrag
*
drag
=
new
QDrag
(
this
);
drag
->
setMimeData
(
mimeData
);
drag
->
start
();
}
src/gui/UBTeacherBarWidget.h
View file @
afab4879
...
...
@@ -68,6 +68,27 @@ protected:
void
dragLeaveEvent
(
QDragLeaveEvent
*
pEvent
);
};
class
UBTeacherBarPreviewMedia
:
public
QWidget
{
Q_OBJECT
public
:
UBTeacherBarPreviewMedia
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarPreviewMedia"
);
~
UBTeacherBarPreviewMedia
();
void
loadMedia
(
QStringList
pMedias
);
private
:
UBWidgetList
*
mWidget
;
QVBoxLayout
mLayout
;
protected
:
void
mousePressEvent
(
QMouseEvent
*
event
);
public
slots
:
};
class
UBUrlWidget
:
public
QWidget
{
public
:
...
...
@@ -89,6 +110,7 @@ class UBTeacherBarPreviewWidget : public QWidget
public
:
UBTeacherBarPreviewWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarPreviewWidget"
);
~
UBTeacherBarPreviewWidget
();
UBTeacherBarPreviewMedia
*
mediaViewer
()
{
return
&
mMediaViewer
;}
signals
:
void
showEditMode
();
...
...
@@ -99,7 +121,8 @@ private slots:
private
:
QVBoxLayout
*
mpLayout
;
QPushButton
*
mpEditButton
;
QHBoxLayout
*
mpEditLayout
;
QVBoxLayout
*
mpEditLayout
;
UBTeacherBarPreviewMedia
mMediaViewer
;
};
class
UBTeacherBarWidget
:
public
UBDockPaletteWidget
...
...
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