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
08f9384b
Commit
08f9384b
authored
Jan 06, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handling drop from preview mode
parent
afab4879
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
47 deletions
+126
-47
UBBoardView.cpp
src/board/UBBoardView.cpp
+5
-5
UBDisplayManager.cpp
src/core/UBDisplayManager.cpp
+1
-1
UBDraggableLabel.cpp
src/customWidgets/UBDraggableLabel.cpp
+39
-0
UBDraggableLabel.h
src/customWidgets/UBDraggableLabel.h
+23
-0
customWidgets.pri
src/customWidgets/customWidgets.pri
+6
-2
UBMediaPlayer.cpp
src/gui/UBMediaPlayer.cpp
+28
-0
UBMediaPlayer.h
src/gui/UBMediaPlayer.h
+12
-0
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+11
-33
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+1
-6
No files found.
src/board/UBBoardView.cpp
View file @
08f9384b
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "UBDrawingController.h"
#include "UBDrawingController.h"
#include "frameworks/UBGeometryUtils.h"
#include "frameworks/UBGeometryUtils.h"
#include "frameworks/UBPlatformUtils.h"
#include "core/UBSettings.h"
#include "core/UBSettings.h"
#include "core/UBMimeData.h"
#include "core/UBMimeData.h"
...
@@ -33,8 +34,8 @@
...
@@ -33,8 +34,8 @@
#include "gui/UBToolWidget.h"
#include "gui/UBToolWidget.h"
#include "gui/UBResources.h"
#include "gui/UBResources.h"
#include "gui/UBMainWindow.h"
#include "gui/UBMainWindow.h"
#include "gui/UB
TeacherBarWidget
.h"
#include "gui/UB
MediaPlayer
.h"
#include "gui/UBThumbnailWidget.h"
#include "board/UBBoardController.h"
#include "board/UBBoardController.h"
...
@@ -44,9 +45,8 @@
...
@@ -44,9 +45,8 @@
#include "domain/UBItem.h"
#include "domain/UBItem.h"
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentProxy.h"
#include "../gui/UBThumbnailWidget.h"
#include "
frameworks/UBPlatformUtils
.h"
#include "
customWidgets/UBDraggableLabel
.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
...
@@ -727,7 +727,7 @@ void
...
@@ -727,7 +727,7 @@ void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
{
{
qDebug
()
<<
event
->
source
();
qDebug
()
<<
event
->
source
();
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UB
TeacherBarPreviewMedia
*>
(
event
->
source
()))
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UB
DraggableMediaPlayer
*>
(
event
->
source
())
||
dynamic_cast
<
UBDraggableLabel
*>
(
event
->
source
()))
{
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
event
->
acceptProposedAction
();
event
->
acceptProposedAction
();
...
...
src/core/UBDisplayManager.cpp
View file @
08f9384b
...
@@ -48,7 +48,7 @@ UBDisplayManager::UBDisplayManager(QObject *parent)
...
@@ -48,7 +48,7 @@ UBDisplayManager::UBDisplayManager(QObject *parent)
void
UBDisplayManager
::
initScreenIndexes
()
void
UBDisplayManager
::
initScreenIndexes
()
{
{
int
screenCount
=
numScreens
();
int
screenCount
=
1
;
//
numScreens();
mScreenIndexesRoles
.
clear
();
mScreenIndexesRoles
.
clear
();
...
...
src/customWidgets/UBDraggableLabel.cpp
0 → 100644
View file @
08f9384b
#include <QMimeData>
#include <QDrag>
#include <QUrl>
#include "UBDraggableLabel.h"
UBDraggableLabel
::
UBDraggableLabel
(
QWidget
*
parent
)
:
QLabel
(
parent
)
{
}
UBDraggableLabel
::~
UBDraggableLabel
()
{
//NOOP
}
void
UBDraggableLabel
::
loadImage
(
QString
imagePath
)
{
mSourcePath
=
imagePath
;
QPixmap
pix
=
QPixmap
(
mSourcePath
);
setPixmap
(
pix
);
setScaledContents
(
true
);
}
void
UBDraggableLabel
::
mousePressEvent
(
QMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
QMimeData
*
mimeData
=
new
QMimeData
;
QList
<
QUrl
>
urls
;
urls
<<
QUrl
::
fromLocalFile
(
mSourcePath
);
mimeData
->
setUrls
(
urls
);
mimeData
->
setText
(
mSourcePath
);
QDrag
*
drag
=
new
QDrag
(
this
);
drag
->
setMimeData
(
mimeData
);
drag
->
start
();
}
src/customWidgets/UBDraggableLabel.h
0 → 100644
View file @
08f9384b
#ifndef UBDRAGGABLELABEL_H
#define UBDRAGGABLELABEL_H
#include <QLabel>
class
UBDraggableLabel
:
public
QLabel
{
Q_OBJECT
public
:
UBDraggableLabel
(
QWidget
*
parent
=
0
);
~
UBDraggableLabel
();
void
loadImage
(
QString
imagePath
);
signals
:
public
slots
:
protected
:
QString
mSourcePath
;
void
mousePressEvent
(
QMouseEvent
*
event
);
};
#endif // UBDRAGGABLELABEL_H
src/customWidgets/customWidgets.pri
View file @
08f9384b
HEADERS += src/customWidgets/UBWidgetList.h
HEADERS += src/customWidgets/UBWidgetList.h \
src/customWidgets/UBDraggableLabel.h
SOURCES += src/customWidgets/UBWidgetList.cpp
SOURCES += src/customWidgets/UBWidgetList.cpp \
src/customWidgets/UBDraggableLabel.cpp
src/gui/UBMediaPlayer.cpp
View file @
08f9384b
...
@@ -343,3 +343,31 @@ void UBMediaPlayer::hasVideoChanged(bool bHasVideo)
...
@@ -343,3 +343,31 @@ void UBMediaPlayer::hasVideoChanged(bool bHasVideo)
// info->setVisible(!bHasVideo);
// info->setVisible(!bHasVideo);
m_videoWindow
.
setVisible
(
bHasVideo
);
m_videoWindow
.
setVisible
(
bHasVideo
);
}
}
//*************************************************************************
UBDraggableMediaPlayer
::
UBDraggableMediaPlayer
()
:
UBMediaPlayer
()
{
// setAcceptDrops(true);
}
void
UBDraggableMediaPlayer
::
setFile
(
const
QString
&
text
)
{
mSourcePath
=
text
;
UBMediaPlayer
::
setFile
(
text
);
}
void
UBDraggableMediaPlayer
::
mousePressEvent
(
QMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
QMimeData
*
mimeData
=
new
QMimeData
;
QList
<
QUrl
>
urls
;
urls
<<
QUrl
::
fromLocalFile
(
mSourcePath
);
mimeData
->
setUrls
(
urls
);
mimeData
->
setText
(
mSourcePath
);
QDrag
*
drag
=
new
QDrag
(
this
);
drag
->
setMimeData
(
mimeData
);
drag
->
start
();
}
src/gui/UBMediaPlayer.h
View file @
08f9384b
...
@@ -89,4 +89,16 @@ private:
...
@@ -89,4 +89,16 @@ private:
Phonon
::
Path
m_audioOutputPath
;
Phonon
::
Path
m_audioOutputPath
;
};
};
class
UBDraggableMediaPlayer
:
public
UBMediaPlayer
{
Q_OBJECT
public
:
UBDraggableMediaPlayer
();
void
setFile
(
const
QString
&
text
);
protected
:
QString
mSourcePath
;
void
mousePressEvent
(
QMouseEvent
*
event
);
};
#endif // UBUBMediaPlayer_H
#endif // UBUBMediaPlayer_H
src/gui/UBTeacherBarWidget.cpp
View file @
08f9384b
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
#include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "customWidgets/UBDraggableLabel.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
UBTeacherBarWidget
::
UBTeacherBarWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
UBTeacherBarWidget
::
UBTeacherBarWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
...
@@ -583,7 +585,6 @@ void UBTeacherBarDropMediaZone::reloadMedia(QStringList pList)
...
@@ -583,7 +585,6 @@ void UBTeacherBarDropMediaZone::reloadMedia(QStringList pList)
foreach
(
QString
eachString
,
pList
){
foreach
(
QString
eachString
,
pList
){
addMedia
(
eachString
);
addMedia
(
eachString
);
}
}
}
}
void
UBTeacherBarDropMediaZone
::
dropEvent
(
QDropEvent
*
pEvent
)
void
UBTeacherBarDropMediaZone
::
dropEvent
(
QDropEvent
*
pEvent
)
...
@@ -722,15 +723,11 @@ void UBTeacherBarPreviewWidget::onEdit()
...
@@ -722,15 +723,11 @@ void UBTeacherBarPreviewWidget::onEdit()
UBTeacherBarPreviewMedia
::
UBTeacherBarPreviewMedia
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
UBTeacherBarPreviewMedia
::
UBTeacherBarPreviewMedia
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
{
{
setObjectName
(
name
);
setObjectName
(
name
);
setAcceptDrops
(
true
);
mWidget
=
new
UBWidgetList
(
parent
);
mWidget
=
new
UBWidgetList
(
parent
);
mWidget
->
setEmptyText
(
tr
(
"No media found"
));
mWidget
->
setEmptyText
(
tr
(
"No media found"
));
mLayout
.
addWidget
(
mWidget
);
mLayout
.
addWidget
(
mWidget
);
setLayout
(
&
mLayout
);
setLayout
(
&
mLayout
);
//TO TEST only
mWidgetList
.
clear
();
// QStringList mediaPathList;
// mediaPathList << "/home/claudio/Desktop/PIPPO.jpg";
// loadMedia(mediaPathList);
}
}
UBTeacherBarPreviewMedia
::~
UBTeacherBarPreviewMedia
()
UBTeacherBarPreviewMedia
::~
UBTeacherBarPreviewMedia
()
...
@@ -743,28 +740,25 @@ UBTeacherBarPreviewMedia::~UBTeacherBarPreviewMedia()
...
@@ -743,28 +740,25 @@ UBTeacherBarPreviewMedia::~UBTeacherBarPreviewMedia()
}
}
// for test only
QString
tempString
;
void
UBTeacherBarPreviewMedia
::
loadMedia
(
QStringList
pMedias
)
void
UBTeacherBarPreviewMedia
::
loadMedia
(
QStringList
pMedias
)
{
{
foreach
(
QWidget
*
eachWidget
,
mWidgetList
.
keys
())
delete
eachWidget
;
mWidgetList
.
clear
();
foreach
(
QString
eachString
,
pMedias
){
foreach
(
QString
eachString
,
pMedias
){
if
(
!
eachString
.
isEmpty
()){
if
(
!
eachString
.
isEmpty
()){
tempString
=
eachString
;
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
eachString
);
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
eachString
);
if
(
mimeType
.
contains
(
"image"
)){
if
(
mimeType
.
contains
(
"image"
)){
QPixmap
pix
=
QPixmap
(
eachString
);
UBDraggableLabel
*
label
=
new
UBDraggableLabel
();
QLabel
*
label
=
new
QLabel
();
label
->
loadImage
(
eachString
);
label
->
setPixmap
(
pix
);
label
->
setScaledContents
(
true
);
mWidget
->
addWidget
(
label
);
mWidget
->
addWidget
(
label
);
// mWidgetList << label
;
mWidgetList
[
label
]
=
eachString
;
}
}
else
if
(
mimeType
.
contains
(
"video"
)
||
mimeType
.
contains
(
"audio"
)){
else
if
(
mimeType
.
contains
(
"video"
)
||
mimeType
.
contains
(
"audio"
)){
UB
MediaPlayer
*
mediaPlayer
=
new
UB
MediaPlayer
();
UB
DraggableMediaPlayer
*
mediaPlayer
=
new
UBDraggable
MediaPlayer
();
mediaPlayer
->
setFile
(
eachString
);
mediaPlayer
->
setFile
(
eachString
);
mWidget
->
addWidget
(
mediaPlayer
);
mWidget
->
addWidget
(
mediaPlayer
);
// mWidgetList << mediaPlayer
;
mWidgetList
[
mediaPlayer
]
=
eachString
;
}
}
else
{
else
{
qWarning
()
<<
"pMediaPath"
<<
eachString
;
qWarning
()
<<
"pMediaPath"
<<
eachString
;
...
@@ -773,19 +767,3 @@ void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
...
@@ -773,19 +767,3 @@ void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
}
}
}
}
}
}
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 @
08f9384b
...
@@ -81,12 +81,7 @@ public:
...
@@ -81,12 +81,7 @@ public:
private
:
private
:
UBWidgetList
*
mWidget
;
UBWidgetList
*
mWidget
;
QVBoxLayout
mLayout
;
QVBoxLayout
mLayout
;
QMap
<
QWidget
*
,
QString
>
mWidgetList
;
protected
:
void
mousePressEvent
(
QMouseEvent
*
event
);
public
slots
:
};
};
class
UBUrlWidget
:
public
QWidget
class
UBUrlWidget
:
public
QWidget
...
...
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