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
0045204c
Commit
0045204c
authored
Jan 04, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first draft
parent
f5931f0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
87 deletions
+28
-87
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+24
-79
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+4
-8
No files found.
src/gui/UBTeacherBarWidget.cpp
View file @
0045204c
#include "UBTeacherBarWidget.h"
#include "UBTeacherBarWidget.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "UBMainWindow.h"
#include "document/UBDocumentController.h"
...
...
@@ -10,6 +11,10 @@
#include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
#include "gui/UBMediaPlayer.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
UBTeacherBarWidget
::
UBTeacherBarWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
...
...
@@ -326,110 +331,50 @@ QTextEdit* UBTeacherStudentAction::student()
return
mpStudent
;
}
#include "gui/UBMediaPlayer.h"
#include "gui/UBVideoPlayer.h"
#include "frameworks/UBFileSystemUtils.h"
UBTeacherBarDropMediaZone
::
UBTeacherBarDropMediaZone
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpTitleLabel
(
NULL
)
,
mpImageTab
(
NULL
)
,
mpTabWidget
(
NULL
)
,
mpLayout
(
NULL
)
UBTeacherBarDropMediaZone
::
UBTeacherBarDropMediaZone
(
QWidget
*
parent
,
const
char
*
name
)
:
UBWidgetList
(
parent
)
{
setObjectName
(
name
);
setAcceptDrops
(
true
);
setAttribute
(
Qt
::
WA_StyledBackground
,
true
);
setStyleSheet
(
UBApplication
::
globalStyleSheet
());
// Create the GUI
mpLayout
=
new
QVBoxLayout
(
this
);
setLayout
(
mpLayout
);
mpImageTab
=
new
QLabel
();
mpVideoTab
=
new
UBMediaPlayer
();
mpAudioTab
=
new
UBMediaPlayer
();
mpTitleLabel
=
new
QLabel
(
tr
(
"Drop media here"
));
mpLayout
->
addWidget
(
mpTitleLabel
);
mpTabWidget
=
new
QTabWidget
();
mpTabWidget
->
setMinimumHeight
(
120
);
mpTabWidget
->
addTab
(
mpImageTab
,
QIcon
(
":images/toolbar/extraTool.png"
),
""
);
mpTabWidget
->
addTab
(
mpVideoTab
,
QIcon
(
":images/libpalette/movieIcon.svg"
),
""
);
mpTabWidget
->
addTab
(
mpAudioTab
,
QIcon
(
":images/libpalette/soundIcon.svg"
),
""
);
mpLayout
->
addWidget
(
mpTabWidget
);
setEmptyText
(
tr
(
"Drag media here ..."
));
}
UBTeacherBarDropMediaZone
::~
UBTeacherBarDropMediaZone
()
{
if
(
NULL
!=
mpTitleLabel
)
{
delete
mpTitleLabel
;
mpTitleLabel
=
NULL
;
}
if
(
NULL
!=
mpImageTab
)
{
delete
mpImageTab
;
mpImageTab
=
NULL
;
}
if
(
NULL
!=
mpVideoTab
)
{
delete
mpVideoTab
;
mpVideoTab
=
NULL
;
}
if
(
NULL
!=
mpAudioTab
)
{
delete
mpAudioTab
;
mpAudioTab
=
NULL
;
}
if
(
NULL
!=
mpTabWidget
)
{
delete
mpTabWidget
;
mpTabWidget
=
NULL
;
}
if
(
NULL
!=
mpLayout
)
{
delete
mpLayout
;
mpLayout
=
NULL
;
}
qDeleteAll
(
mWidgetList
);
}
void
UBTeacherBarDropMediaZone
::
dragEnterEvent
(
QDragEnterEvent
*
pEvent
)
{
setBackgroundRole
(
QPalette
::
Highlight
);
pEvent
->
acceptProposedAction
();
}
void
UBTeacherBarDropMediaZone
::
dragLeaveEvent
(
QDragLeaveEvent
*
pEvent
)
{
setBackgroundRole
(
QPalette
::
Dark
);
pEvent
->
accept
();
}
void
UBTeacherBarDropMediaZone
::
dropEvent
(
QDropEvent
*
pEvent
)
{
setBackgroundRole
(
QPalette
::
Dark
);
if
(
pEvent
->
mimeData
()
->
hasHtml
())
qDebug
()
<<
pEvent
->
mimeData
()
->
html
();
if
(
pEvent
->
mimeData
()
->
hasUrls
())
qDebug
()
<<
pEvent
->
mimeData
()
->
urls
();
if
(
pEvent
->
mimeData
()
->
hasText
())
qDebug
()
<<
pEvent
->
mimeData
()
->
text
();
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
if
(
mimeType
.
contains
(
"image"
)){
QPixmap
pix
=
QPixmap
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
mpImageTab
->
setPixmap
(
pix
);
mpTabWidget
->
setCurrentWidget
(
mpImageTab
);
}
else
if
(
mimeType
.
contains
(
"video"
)){
mpVideoTab
->
setFile
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
mpVideoTab
->
playPause
();
mpTabWidget
->
setCurrentWidget
(
mpVideoTab
);
}
else
if
(
mimeType
.
contains
(
"audio"
)){
mpVideoTab
->
setFile
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
mpVideoTab
->
playPause
();
mpTabWidget
->
setCurrentWidget
(
mpAudioTab
);
float
ratio
=
(
float
)
width
()
/
(
float
)
pix
.
width
();
pix
.
transformed
(
QTransform
::
scale
((
float
)
pix
.
width
()
/
ratio
,(
float
)
pix
.
height
()
/
ratio
));
QLabel
*
label
=
new
QLabel
();
label
->
setPixmap
(
pix
);
label
->
setScaledContents
(
true
);
addWidget
(
label
);
mWidgetList
<<
label
;
}
else
if
(
mimeType
.
contains
(
"video"
)
||
mimeType
.
contains
(
"audio"
)){
UBMediaPlayer
*
mediaPlayer
=
new
UBMediaPlayer
();
mediaPlayer
->
setFile
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
mediaPlayer
->
playPause
();
addWidget
(
mediaPlayer
);
mWidgetList
<<
mediaPlayer
;
}
else
{
qWarning
()
<<
"bad idea to come here"
;
...
...
src/gui/UBTeacherBarWidget.h
View file @
0045204c
...
...
@@ -2,7 +2,6 @@
#define UBTEACHERBARWIDGET_H
class
UBMediaPlayer
;
class
UBVideoPlayer
;
#include <QWidget>
#include <QVBoxLayout>
...
...
@@ -14,6 +13,8 @@ class UBVideoPlayer;
#include <QTabWidget>
#include <QButtonGroup>
#include "customWidgets/UBWidgetList.h"
#include "UBDockPaletteWidget.h"
#define LABEL_MINWIDHT 80
...
...
@@ -45,7 +46,7 @@ private:
};
class
UBTeacherBarDropMediaZone
:
public
QWidge
t
class
UBTeacherBarDropMediaZone
:
public
UBWidgetLis
t
{
Q_OBJECT
...
...
@@ -54,12 +55,7 @@ public:
~
UBTeacherBarDropMediaZone
();
private
:
QLabel
*
mpTitleLabel
;
QLabel
*
mpImageTab
;
UBMediaPlayer
*
mpVideoTab
;
UBMediaPlayer
*
mpAudioTab
;
QTabWidget
*
mpTabWidget
;
QVBoxLayout
*
mpLayout
;
QList
<
QWidget
*>
mWidgetList
;
protected
:
void
dragEnterEvent
(
QDragEnterEvent
*
pEvent
);
...
...
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