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
c9180ee0
Commit
c9180ee0
authored
May 02, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lesson pages, presentation mode media titles are draggables
parent
1234e3e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
17 deletions
+54
-17
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+13
-8
UBTeacherGuideWidget.h
src/gui/UBTeacherGuideWidget.h
+1
-1
UBTeacherGuideWidgetsTools.cpp
src/gui/UBTeacherGuideWidgetsTools.cpp
+24
-4
UBTeacherGuideWidgetsTools.h
src/gui/UBTeacherGuideWidgetsTools.h
+16
-4
No files found.
src/gui/UBTeacherGuideWidget.cpp
View file @
c9180ee0
...
...
@@ -68,7 +68,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpLayout
=
new
QVBoxLayout
(
this
);
mpPageNumberLabel
=
new
QLabel
(
this
);
mpPageNumberLabel
->
setAlignment
(
Qt
::
AlignRight
);
mpPageNumberLabel
->
setObjectName
(
"UBTG
Edition
PageNumberLabel"
);
mpPageNumberLabel
->
setObjectName
(
"UBTGPageNumberLabel"
);
mpLayout
->
addWidget
(
mpPageNumberLabel
);
// tree basic configuration
mpDocumentTitle
=
new
QLabel
(
this
);
...
...
@@ -195,7 +195,7 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getData()
children
<<
getChildrenList
(
mpAddALinkItem
);
result
<<
getPageAndCommentData
();
foreach
(
QTreeWidgetItem
*
widgetItem
,
children
){
tUBGEElementNode
*
node
=
dynamic_cast
<
iUBTGSav
abl
eData
*>
(
mpTreeWidget
->
itemWidget
(
widgetItem
,
0
))
->
saveData
();
tUBGEElementNode
*
node
=
dynamic_cast
<
iUBTGSaveData
*>
(
mpTreeWidget
->
itemWidget
(
widgetItem
,
0
))
->
saveData
();
if
(
node
)
result
<<
node
;
}
...
...
@@ -205,7 +205,7 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getData()
void
UBTeacherGuideEditionWidget
::
onAddItemClicked
(
QTreeWidgetItem
*
widget
,
int
column
)
{
int
addSubItemWidgetType
=
widget
->
data
(
column
,
Qt
::
UserRole
).
toInt
();
if
(
column
==
0
&&
addSubItemWidgetType
!=
eUBTGAddSubItemWidgetType_None
){
if
(
addSubItemWidgetType
!=
eUBTGAddSubItemWidgetType_None
){
QTreeWidgetItem
*
newWidgetItem
=
new
QTreeWidgetItem
(
widget
);
newWidgetItem
->
setData
(
column
,
Qt
::
UserRole
,
eUBTGAddSubItemWidgetType_None
);
newWidgetItem
->
setData
(
1
,
Qt
::
UserRole
,
eUBTGAddSubItemWidgetType_None
);
...
...
@@ -279,7 +279,7 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare
mpPageNumberLabel
=
new
QLabel
(
this
);
mpPageNumberLabel
->
setAlignment
(
Qt
::
AlignRight
);
mpPageNumberLabel
->
setObjectName
(
"UBTGP
resentationP
ageNumberLabel"
);
mpPageNumberLabel
->
setObjectName
(
"UBTGPageNumberLabel"
);
mpLayout
->
addWidget
(
mpPageNumberLabel
);
...
...
@@ -317,10 +317,11 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare
mpSeparator
->
setObjectName
(
"UBTGSepartor"
);
mpLayout
->
addWidget
(
mpSeparator
);
mpTreeWidget
=
new
QTreeWidget
(
this
);
mpTreeWidget
=
new
UBTGDraggableTreeItem
(
this
);
mpLayout
->
addWidget
(
mpTreeWidget
);
mpRootWidgetItem
=
mpTreeWidget
->
invisibleRootItem
();
mpTreeWidget
->
setDragEnabled
(
true
);
mpTreeWidget
->
setRootIsDecorated
(
false
);
mpTreeWidget
->
setIndentation
(
0
);
mpTreeWidget
->
setDropIndicatorShown
(
false
);
...
...
@@ -392,6 +393,7 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
else
if
(
element
->
type
==
"action"
){
QTreeWidgetItem
*
newWidgetItem
=
new
QTreeWidgetItem
(
mpRootWidgetItem
);
newWidgetItem
->
setText
(
0
,
element
->
attributes
.
value
(
"task"
));
newWidgetItem
->
setFlags
(
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
);
QString
colorString
=
element
->
attributes
.
value
(
"owner"
).
toInt
()
==
0
?
"red"
:
"green"
;
UBTGAdaptableText
*
textWidget
=
new
UBTGAdaptableText
(
newWidgetItem
,
0
);
textWidget
->
bottomMargin
(
14
);
...
...
@@ -409,6 +411,8 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
newWidgetItem
->
setText
(
0
,
element
->
attributes
.
value
(
"title"
));
newWidgetItem
->
setData
(
0
,
tUBTGTreeWidgetItemRole_HasAnAction
,
tUBTGActionAssociateOnClickItem_MEDIA
);
newWidgetItem
->
setData
(
0
,
Qt
::
FontRole
,
QVariant
(
QFont
(
QApplication
::
font
().
family
(),
11
)));
newWidgetItem
->
setData
(
0
,
TG_USER_ROLE_MIME_TYPE
,
element
->
attributes
.
value
(
"relativePath"
));
newWidgetItem
->
setFlags
(
Qt
::
ItemIsDragEnabled
|
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
);
mpRootWidgetItem
->
addChild
(
newWidgetItem
);
QTreeWidgetItem
*
mediaItem
=
new
QTreeWidgetItem
(
newWidgetItem
);
...
...
@@ -425,6 +429,7 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
newWidgetItem
->
setData
(
0
,
tUBTGTreeWidgetItemRole_HasAnAction
,
tUBTGActionAssociateOnClickItem_URL
);
newWidgetItem
->
setData
(
0
,
tUBTGTreeWidgetItemRole_HasAnUrl
,
QVariant
(
element
->
attributes
.
value
(
"url"
)));
newWidgetItem
->
setData
(
0
,
Qt
::
FontRole
,
QVariant
(
QFont
(
QApplication
::
font
().
family
(),
11
)));
newWidgetItem
->
setFlags
(
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
);
mpRootWidgetItem
->
addChild
(
newWidgetItem
);
}
}
...
...
@@ -498,7 +503,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons
mpLayout
=
new
QVBoxLayout
(
this
);
mpPageNumberLabel
=
new
QLabel
(
this
);
mpPageNumberLabel
->
setAlignment
(
Qt
::
AlignRight
);
mpPageNumberLabel
->
setObjectName
(
"UBTGP
resentationP
ageNumberLabel"
);
mpPageNumberLabel
->
setObjectName
(
"UBTGPageNumberLabel"
);
mpPageNumberLabel
->
setText
(
tr
(
"Page 0"
));
mpLayout
->
addWidget
(
mpPageNumberLabel
);
...
...
@@ -510,9 +515,9 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons
mpButtonTitleLayout
->
addWidget
(
mpModePushButton
);
connect
(
mpModePushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
switchToMode
()));
mpSessionTitle
=
new
UBTGAdaptableText
(
0
,
this
);
mpSessionTitle
=
new
UBTGAdaptableText
(
0
,
this
,
"UBTGSessionTitle"
);
mpSessionTitle
->
setPlaceHolderText
(
tr
(
"Type session title here ..."
));
mpSessionTitle
->
setObjectName
(
"UBTGEditionMode
SessionTitle"
);
//mpSessionTitle->setObjectName("UBTG
SessionTitle");
mpButtonTitleLayout
->
addWidget
(
mpSessionTitle
);
mpLayout
->
addLayout
(
mpButtonTitleLayout
);
...
...
src/gui/UBTeacherGuideWidget.h
View file @
c9180ee0
...
...
@@ -96,7 +96,7 @@ private:
QLabel
*
mpPageNumberLabel
;
QFrame
*
mpSeparator
;
QPushButton
*
mpModePushButton
;
QTreeWidget
*
mpTreeWidget
;
UBTGDraggableTreeItem
*
mpTreeWidget
;
QTreeWidgetItem
*
mpRootWidgetItem
;
QTreeWidgetItem
*
mpMediaSwitchItem
;
...
...
src/gui/UBTeacherGuideWidgetsTools.cpp
View file @
c9180ee0
...
...
@@ -103,15 +103,18 @@ tUBGEElementNode* UBTGActionWidget::saveData()
UBTGAdaptableText
::
UBTGAdaptableText
(
QTreeWidgetItem
*
widget
,
QWidget
*
parent
,
const
char
*
name
)
:
QTextEdit
(
parent
)
,
mBottomMargin
(
5
)
,
mpTreeWidgetItem
(
widget
)
,
mMinimumHeight
(
2
0
)
,
mMinimumHeight
(
0
)
,
mHasPlaceHolder
(
false
)
,
mIsUpdatingSize
(
false
)
{
setObjectName
(
name
);
setStyleSheet
(
"QWidget {background: white; border:1 solid #999999; border-radius : 10px; padding: 2px;}"
);
connect
(
this
,
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onTextChanged
()));
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
setVerticalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
mMinimumHeight
=
document
()
->
size
().
height
()
+
mBottomMargin
;
setMinimumHeight
(
mMinimumHeight
);
}
void
UBTGAdaptableText
::
setPlaceHolderText
(
QString
text
)
...
...
@@ -170,7 +173,6 @@ QString UBTGAdaptableText::text()
void
UBTGAdaptableText
::
onTextChanged
()
{
qreal
documentSize
=
document
()
->
size
().
height
();
if
(
height
()
==
documentSize
+
mBottomMargin
)
return
;
mIsUpdatingSize
=
true
;
...
...
@@ -478,7 +480,7 @@ void UBTGMediaWidget::updateSize()
}
/***************************************************************************
* class UBTGUrlW
di
get *
* class UBTGUrlW
id
get *
***************************************************************************/
UBTGUrlWidget
::
UBTGUrlWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpLayout
(
NULL
)
...
...
@@ -513,3 +515,21 @@ tUBGEElementNode* UBTGUrlWidget::saveData()
result
->
attributes
.
insert
(
"url"
,
mpUrl
->
text
());
return
result
;
}
/***************************************************************************
* class UBTGDraggableTreeItem *
***************************************************************************/
UBTGDraggableTreeItem
::
UBTGDraggableTreeItem
(
QWidget
*
parent
,
const
char
*
name
)
:
QTreeWidget
(
parent
)
{
setObjectName
(
name
);
}
QMimeData
*
UBTGDraggableTreeItem
::
mimeData
(
const
QList
<
QTreeWidgetItem
*>
items
)
const
{
QMimeData
*
result
=
new
QMimeData
();
QList
<
QUrl
>
urls
;
urls
<<
QUrl
(
items
.
at
(
0
)
->
data
(
0
,
TG_USER_ROLE_MIME_TYPE
).
toString
());
result
->
setUrls
(
urls
);
return
result
;
}
src/gui/UBTeacherGuideWidgetsTools.h
View file @
c9180ee0
...
...
@@ -29,6 +29,9 @@
#include "customWidgets/UBMediaWidget.h"
#define TG_USER_ROLE_MIME_TYPE (Qt::UserRole+50)
class
QTreeWidget
;
class
QVBoxLayout
;
class
QComboBox
;
...
...
@@ -44,7 +47,7 @@ typedef struct
}
tUBGEElementNode
;
class
iUBTGSav
abl
eData
class
iUBTGSaveData
{
public
:
virtual
tUBGEElementNode
*
saveData
()
=
0
;
...
...
@@ -62,7 +65,7 @@ signals:
public
slots
:
};
class
UBTGActionWidget
:
public
QWidget
,
public
iUBTGSav
abl
eData
class
UBTGActionWidget
:
public
QWidget
,
public
iUBTGSaveData
{
Q_OBJECT
...
...
@@ -127,7 +130,7 @@ private:
bool
mDragStarted
;
};
class
UBTGMediaWidget
:
public
QStackedWidget
,
public
iUBTGSav
abl
eData
class
UBTGMediaWidget
:
public
QStackedWidget
,
public
iUBTGSaveData
{
Q_OBJECT
public
:
...
...
@@ -162,7 +165,7 @@ private:
};
class
UBTGUrlWidget
:
public
QWidget
,
public
iUBTGSav
abl
eData
class
UBTGUrlWidget
:
public
QWidget
,
public
iUBTGSaveData
{
Q_OBJECT
public
:
...
...
@@ -175,5 +178,14 @@ private:
QLineEdit
*
mpUrl
;
};
class
UBTGDraggableTreeItem
:
public
QTreeWidget
{
Q_OBJECT
public
:
UBTGDraggableTreeItem
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTGDraggableTreeItem"
);
private
:
QMimeData
*
mimeData
(
const
QList
<
QTreeWidgetItem
*>
items
)
const
;
};
#endif // UBTEACHERGUIDEWIDGETSTOOLS_H
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