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
5ce549f1
Commit
5ce549f1
authored
Jan 26, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the drag and drop from the teacherbar to the board
parent
d461e3a7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
33 deletions
+81
-33
UBBoardView.cpp
src/board/UBBoardView.cpp
+2
-1
UBDraggableMedia.cpp
src/customWidgets/UBDraggableMedia.cpp
+42
-0
UBDraggableMedia.h
src/customWidgets/UBDraggableMedia.h
+19
-0
UBMediaWidget.h
src/customWidgets/UBMediaWidget.h
+2
-2
customWidgets.pri
src/customWidgets/customWidgets.pri
+4
-2
UBTeacherBarPreviewWidget.cpp
src/gui/UBTeacherBarPreviewWidget.cpp
+5
-19
UBTeacherBarPreviewWidget.h
src/gui/UBTeacherBarPreviewWidget.h
+4
-8
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+3
-1
No files found.
src/board/UBBoardView.cpp
View file @
5ce549f1
...
...
@@ -47,6 +47,7 @@
#include "document/UBDocumentProxy.h"
#include "customWidgets/UBDraggableLabel.h"
#include "customWidgets/UBDraggableMedia.h"
#include "core/memcheck.h"
...
...
@@ -727,7 +728,7 @@ void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
{
qDebug
()
<<
event
->
source
();
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBDraggableMediaPlayer
*>
(
event
->
source
())
||
dynamic_cast
<
UBDraggableLabel
*>
(
event
->
source
()))
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBDraggableMediaPlayer
*>
(
event
->
source
())
||
dynamic_cast
<
UBDraggableLabel
*>
(
event
->
source
())
||
dynamic_cast
<
UBDraggableMedia
*>
(
event
->
source
())
)
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
event
->
acceptProposedAction
();
...
...
src/customWidgets/UBDraggableMedia.cpp
0 → 100644
View file @
5ce549f1
#include <QApplication>
#include <QUrl>
#include "UBDraggableMedia.h"
UBDraggableMedia
::
UBDraggableMedia
(
eMediaType
type
,
QWidget
*
parent
,
const
char
*
name
)
:
UBMediaWidget
(
type
,
parent
,
name
)
{
}
UBDraggableMedia
::~
UBDraggableMedia
()
{
}
void
UBDraggableMedia
::
mousePressEvent
(
QMouseEvent
*
ev
)
{
if
(
Qt
::
LeftButton
==
ev
->
button
()){
mDragStartPos
=
ev
->
pos
();
}
}
void
UBDraggableMedia
::
mouseMoveEvent
(
QMouseEvent
*
ev
)
{
if
(
!
(
ev
->
buttons
()
&
Qt
::
LeftButton
)){
return
;
}
if
((
ev
->
pos
()
-
mDragStartPos
).
manhattanLength
()
<
QApplication
::
startDragDistance
()){
return
;
}
QDrag
*
drag
=
new
QDrag
(
this
);
QMimeData
*
mimeData
=
new
QMimeData
;
QList
<
QUrl
>
urls
;
urls
<<
QUrl
(
mFilePath
);
mimeData
->
setText
(
mFilePath
);
mimeData
->
setUrls
(
urls
);
drag
->
setMimeData
(
mimeData
);
Qt
::
DropAction
dropAction
=
drag
->
exec
(
Qt
::
CopyAction
|
Qt
::
MoveAction
);
}
src/customWidgets/UBDraggableMedia.h
0 → 100644
View file @
5ce549f1
#ifndef UBDRAGGABLEMEDIA_H
#define UBDRAGGABLEMEDIA_H
#include "UBMediaWidget.h"
class
UBDraggableMedia
:
public
UBMediaWidget
{
public
:
UBDraggableMedia
(
eMediaType
type
=
eMediaType_Video
,
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDraggableMedia"
);
~
UBDraggableMedia
();
protected
:
void
mousePressEvent
(
QMouseEvent
*
ev
);
void
mouseMoveEvent
(
QMouseEvent
*
ev
);
private
:
QPoint
mDragStartPos
;
};
#endif // UBDRAGGABLEMEDIA_H
src/customWidgets/UBMediaWidget.h
View file @
5ce549f1
...
...
@@ -72,6 +72,8 @@ public:
protected
:
void
resizeEvent
(
QResizeEvent
*
ev
);
void
showEvent
(
QShowEvent
*
event
);
/** The current media file path */
QString
mFilePath
;
private
slots
:
void
onPlayStopClicked
();
...
...
@@ -85,8 +87,6 @@ private:
void
createMediaPlayer
();
void
adaptSizeToVideo
();
/** The current media file path */
QString
mFilePath
;
/** The current media type */
eMediaType
mType
;
/** The media object */
...
...
src/customWidgets/customWidgets.pri
View file @
5ce549f1
...
...
@@ -2,8 +2,10 @@
HEADERS += src/customWidgets/UBWidgetList.h \
src/customWidgets/UBDraggableLabel.h \
src/customWidgets/UBMediaWidget.h \
src/customWidgets/UBGlobals.h
src/customWidgets/UBGlobals.h \
src/customWidgets/UBDraggableMedia.h
SOURCES += src/customWidgets/UBWidgetList.cpp \
src/customWidgets/UBDraggableLabel.cpp \
src/customWidgets/UBMediaWidget.cpp
src/customWidgets/UBMediaWidget.cpp \
src/customWidgets/UBDraggableMedia.cpp
src/gui/UBTeacherBarPreviewWidget.cpp
View file @
5ce549f1
...
...
@@ -316,17 +316,13 @@ void UBTeacherBarPreviewWidget::generateMedias()
foreach
(
QString
mediaUrl
,
*
mpDataMgr
->
mediaUrls
()){
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
mediaUrl
);
if
(
mimeType
.
contains
(
"image"
)){
QPixmap
pix
=
QPixmap
(
mediaUrl
);
QLabel
*
label
=
new
QLabel
();
pix
.
scaledToWidth
(
label
->
width
());
label
->
resize
(
pix
.
width
(),
pix
.
height
());
label
->
setPixmap
(
pix
);
label
->
setScaledContents
(
true
);
mStoredWidgets
<<
label
;
mpContentContainer
->
addWidget
(
label
);
mpTmpLabel
=
new
UBDraggableLabel
();
mpTmpLabel
->
loadImage
(
mediaUrl
);
mStoredWidgets
<<
mpTmpLabel
;
mpContentContainer
->
addWidget
(
mpTmpLabel
);
}
else
if
(
mimeType
.
contains
(
"video"
)
||
mimeType
.
contains
(
"audio"
)){
UB
MediaWidget
*
mediaPlayer
=
new
UBMediaWidget
(
mimeType
.
contains
(
"audio"
)
?
eMediaType_Audio
:
eMediaType_Video
);
UB
DraggableMedia
*
mediaPlayer
=
new
UBDraggableMedia
(
mimeType
.
contains
(
"audio"
)
?
eMediaType_Audio
:
eMediaType_Video
);
mediaPlayer
->
setFile
(
mediaUrl
);
mStoredWidgets
<<
mediaPlayer
;
mpContentContainer
->
addWidget
(
mediaPlayer
);
...
...
@@ -365,13 +361,3 @@ void UBTeacherBarPreviewWidget::showEvent(QShowEvent* ev)
updateFields
();
}
// -----------------------------------------------------------------------------------------------------
UBDraggableMedia
::
UBDraggableMedia
(
eMediaType
type
,
QWidget
*
parent
,
const
char
*
name
)
:
UBMediaWidget
(
type
,
parent
,
name
)
{
}
UBDraggableMedia
::~
UBDraggableMedia
()
{
}
src/gui/UBTeacherBarPreviewWidget.h
View file @
5ce549f1
...
...
@@ -9,6 +9,8 @@
#include "core/UBPersistenceManager.h"
#include "customWidgets/UBWidgetList.h"
#include "customWidgets/UBMediaWidget.h"
#include "customWidgets/UBDraggableMedia.h"
#include "customWidgets/UBDraggableLabel.h"
#include "UBTeacherBarDataMgr.h"
class
UBTeacherBarPreviewMedia
:
public
QWidget
...
...
@@ -57,14 +59,6 @@ public:
~
UBTBPreviewSeparator
();
};
class
UBDraggableMedia
:
public
UBMediaWidget
{
public
:
UBDraggableMedia
(
eMediaType
type
=
eMediaType_Video
,
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDraggableMedia"
);
~
UBDraggableMedia
();
};
class
UBTeacherBarPreviewWidget
:
public
QWidget
{
Q_OBJECT
...
...
@@ -125,6 +119,8 @@ private:
QTextEdit
*
mpTmpComment
;
/** A temporary media object */
UBDraggableMedia
*
mTmpMedia
;
/** A temporary label object */
UBDraggableLabel
*
mpTmpLabel
;
};
#endif // UBTEACHERBARPREVIEWWIDGET_H
src/gui/UBTeacherBarWidget.cpp
View file @
5ce549f1
...
...
@@ -170,7 +170,9 @@ void UBTeacherBarWidget::onTBStateChanged(eTeacherBarState state)
case
eTeacherBarState_PagePreview
:
saveContent
();
mpPreview
->
clearFields
();
//mpPreview->updateFields();
if
(
mpPreview
->
isVisible
()){
mpPreview
->
updateFields
();
}
mpStackWidget
->
setCurrentWidget
(
mpPreview
);
break
;
}
...
...
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