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
03fef88c
Commit
03fef88c
authored
Jan 06, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backup
parent
afab4879
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
27 deletions
+133
-27
UBWidgetList.cpp
src/customWidgets/UBWidgetList.cpp
+2
-0
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+111
-24
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+20
-3
No files found.
src/customWidgets/UBWidgetList.cpp
View file @
03fef88c
...
...
@@ -12,6 +12,8 @@ UBWidgetList::UBWidgetList(QWidget* parent, eWidgetListOrientation orientation,
mpContainer
=
new
QWidget
(
this
);
mpEmptyLabel
=
new
QLabel
(
this
);
mpEmptyLabel
->
setObjectName
(
"emptyString"
);
mpEmptyLabel
->
setWordWrap
(
true
);
mpEmptyLabel
->
setAlignment
(
Qt
::
AlignCenter
);
if
(
eWidgetListOrientation_Vertical
==
orientation
){
setVerticalScrollBarPolicy
(
Qt
::
ScrollBarAsNeeded
);
...
...
src/gui/UBTeacherBarWidget.cpp
View file @
03fef88c
...
...
@@ -278,11 +278,11 @@ void UBTeacherBarWidget::saveContent()
infos
.
title
=
mpTitle
->
text
();
// Duration
if
(
mpDuration1
->
isChecked
()){
infos
.
Duration
=
0
;
infos
.
Duration
=
eDuration_Quarter
;
}
else
if
(
mpDuration2
->
isChecked
()){
infos
.
Duration
=
1
;
infos
.
Duration
=
eDuration_Half
;
}
else
{
infos
.
Duration
=
2
;
infos
.
Duration
=
eDuration_ThreeQuarter
;
}
// Actions
for
(
int
i
=
0
;
i
<
mActionList
.
size
();
i
++
){
...
...
@@ -312,11 +312,11 @@ void UBTeacherBarWidget::loadContent()
mpTitle
->
setText
(
nextInfos
.
title
);
// Duration
switch
(
nextInfos
.
Duration
){
case
0
:
mpDuration1
->
setChecked
(
true
);
case
eDuration_Quarter
:
mpDuration1
->
setChecked
(
true
);
break
;
case
1
:
mpDuration2
->
setChecked
(
true
);
case
eDuration_Half
:
mpDuration2
->
setChecked
(
true
);
break
;
case
2
:
mpDuration3
->
setChecked
(
true
);
case
eDuration_ThreeQuarter
:
mpDuration3
->
setChecked
(
true
);
break
;
default
:
mpDuration1
->
setChecked
(
true
);
break
;
...
...
@@ -351,8 +351,18 @@ void UBTeacherBarWidget::loadContent()
}
if
(
!
isEmpty
()){
// Update the fields of the preview widget
mpPreview
->
setTitle
(
mpTitle
->
text
());
mpPreview
->
mediaViewer
()
->
loadMedia
(
nextInfos
.
medias
);
mpStackWidget
->
setCurrentWidget
(
mpPreview
);
if
(
mpDuration1
->
isChecked
()){
mpPreview
->
setDuration
(
eDuration_Quarter
);
}
else
if
(
mpDuration2
->
isChecked
()){
mpPreview
->
setDuration
(
eDuration_Half
);
}
else
{
mpPreview
->
setDuration
(
eDuration_ThreeQuarter
);
}
}
}
...
...
@@ -675,22 +685,60 @@ void UBUrlWidget::setUrl(const QString &url)
// ------------------------------------------------------------------------------------
UBTeacherBarPreviewWidget
::
UBTeacherBarPreviewWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpLayout
(
NULL
)
,
mpEditButton
(
NULL
)
,
mpEditLayout
(
NULL
)
,
mpTitle
(
NULL
)
,
mpDuration
(
NULL
)
,
mpActionsLabel
(
NULL
)
,
mpMediaLabel
(
NULL
)
,
mpCommentsLabel
(
NULL
)
{
setObjectName
(
name
);
mpLayout
=
new
QVBoxLayout
(
this
);
setLayout
(
mpLayout
);
setLayout
(
&
mLayout
);
setAttribute
(
Qt
::
WA_StyledBackground
,
true
);
setStyleSheet
(
UBApplication
::
globalStyleSheet
());
// Build the Preview widget
// Title + duration
mpTitle
=
new
QLabel
(
this
);
mpTitle
->
setObjectName
(
"UBTeacherBarPreviewTitle"
);
mpTitle
->
setWordWrap
(
true
);
mpTitle
->
setAlignment
(
Qt
::
AlignCenter
);
mpDuration
=
new
QLabel
(
this
);
mTitleDurationLayout
.
addWidget
(
mpTitle
,
0
);
mTitleDurationLayout
.
addWidget
(
mpDuration
,
1
);
mLayout
.
addLayout
(
&
mTitleDurationLayout
,
0
);
// Actions
mpActionsLabel
=
new
QLabel
(
tr
(
"Actions"
),
this
);
mActionLabelLayout
.
addWidget
(
mpActionsLabel
,
0
);
mActionLabelLayout
.
addStretch
(
1
);
mLayout
.
addLayout
(
&
mActionLabelLayout
);
// Media
mpMediaLabel
=
new
QLabel
(
tr
(
"Medias"
),
this
);
mMediaLabelLayout
.
addWidget
(
mpMediaLabel
,
0
);
mMediaLabelLayout
.
addStretch
(
1
);
mLayout
.
addLayout
(
&
mMediaLabelLayout
);
mLayout
.
addWidget
(
&
mMediaViewer
,
0
);
// Temporary stretch
mLayout
.
addStretch
(
1
);
// Comments
mpCommentsLabel
=
new
QLabel
(
tr
(
"Comments"
),
this
);
mCommentsLabelLayout
.
addWidget
(
mpCommentsLabel
,
0
);
mCommentsLabelLayout
.
addStretch
(
1
);
mLayout
.
addLayout
(
&
mCommentsLabelLayout
);
// Edit button
mpEditButton
=
new
QPushButton
(
tr
(
"Edit infos"
),
this
);
mpEditLayout
=
new
QVBoxLayout
();
mpEditLayout
->
addStretch
(
1
);
mpEditLayout
->
addWidget
(
mpEditButton
,
0
);
mpEditLayout
->
addStretch
(
1
);
mpEditLayout
->
addWidget
(
&
mMediaViewer
);
mpLayout
->
addLayout
(
mpEditLayout
);
mpEditButton
->
setObjectName
(
"DockPaletteWidgetButton"
);
mEditLayout
.
addStretch
(
1
);
mEditLayout
.
addWidget
(
mpEditButton
,
0
);
mEditLayout
.
addStretch
(
1
);
mLayout
.
addLayout
(
&
mEditLayout
,
0
);
connect
(
mpEditButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onEdit
()));
...
...
@@ -698,18 +746,30 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(QWidget *parent, const char
UBTeacherBarPreviewWidget
::~
UBTeacherBarPreviewWidget
()
{
if
(
NULL
!=
mpTitle
){
delete
mpTitle
;
mpTitle
=
NULL
;
}
if
(
NULL
!=
mpDuration
){
delete
mpDuration
;
mpDuration
=
NULL
;
}
if
(
NULL
!=
mpActionsLabel
){
delete
mpActionsLabel
;
mpActionsLabel
=
NULL
;
}
if
(
NULL
!=
mpMediaLabel
){
delete
mpMediaLabel
;
mpMediaLabel
=
NULL
;
}
if
(
NULL
!=
mpCommentsLabel
){
delete
mpCommentsLabel
;
mpCommentsLabel
=
NULL
;
}
if
(
NULL
!=
mpEditButton
){
delete
mpEditButton
;
mpEditButton
=
NULL
;
}
if
(
NULL
!=
mpEditLayout
){
delete
mpEditLayout
;
mpEditLayout
=
NULL
;
}
if
(
NULL
!=
mpLayout
){
delete
mpLayout
;
mpLayout
=
NULL
;
}
}
void
UBTeacherBarPreviewWidget
::
onEdit
()
...
...
@@ -717,6 +777,33 @@ void UBTeacherBarPreviewWidget::onEdit()
emit
showEditMode
();
}
void
UBTeacherBarPreviewWidget
::
setTitle
(
const
QString
&
title
)
{
if
(
NULL
!=
mpTitle
){
mpTitle
->
setText
(
title
);
}
}
void
UBTeacherBarPreviewWidget
::
setDuration
(
eDuration
duration
)
{
if
(
NULL
!=
mpDuration
){
QPixmap
p
;
switch
(
duration
){
case
eDuration_Quarter
:
p
=
QPixmap
(
":images/duration1.png"
);
break
;
case
eDuration_Half
:
p
=
QPixmap
(
":images/duration2.png"
);
break
;
case
eDuration_ThreeQuarter
:
p
=
QPixmap
(
":images/duration3.png"
);
break
;
default
:
break
;
}
mpDuration
->
setPixmap
(
p
.
scaledToHeight
(
16
,
Qt
::
SmoothTransformation
));
}
}
// ------------------------------------------------------------------------------------
UBTeacherBarPreviewMedia
::
UBTeacherBarPreviewMedia
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
...
...
src/gui/UBTeacherBarWidget.h
View file @
03fef88c
...
...
@@ -21,6 +21,12 @@ class UBMediaPlayer;
#define LABEL_MINWIDHT 80
typedef
enum
{
eDuration_Quarter
,
eDuration_Half
,
eDuration_ThreeQuarter
}
eDuration
;
class
UBTeacherStudentAction
:
public
QWidget
{
Q_OBJECT
...
...
@@ -111,6 +117,8 @@ public:
UBTeacherBarPreviewWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarPreviewWidget"
);
~
UBTeacherBarPreviewWidget
();
UBTeacherBarPreviewMedia
*
mediaViewer
()
{
return
&
mMediaViewer
;}
void
setTitle
(
const
QString
&
title
);
void
setDuration
(
eDuration
duration
);
signals
:
void
showEditMode
();
...
...
@@ -119,10 +127,19 @@ private slots:
void
onEdit
();
private
:
QVBoxLayout
*
mpLayout
;
QPushButton
*
mpEditButton
;
QVBoxLayout
*
mpEditLayout
;
QVBoxLayout
mLayout
;
QHBoxLayout
mEditLayout
;
QHBoxLayout
mTitleDurationLayout
;
QHBoxLayout
mActionLabelLayout
;
QHBoxLayout
mMediaLabelLayout
;
QHBoxLayout
mCommentsLabelLayout
;
UBTeacherBarPreviewMedia
mMediaViewer
;
QPushButton
*
mpEditButton
;
QLabel
*
mpTitle
;
QLabel
*
mpDuration
;
QLabel
*
mpActionsLabel
;
QLabel
*
mpMediaLabel
;
QLabel
*
mpCommentsLabel
;
};
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