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
af82e62a
Commit
af82e62a
authored
Sep 13, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved gui for teacherguide
parent
0462d175
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
16 deletions
+36
-16
UBTeacherGuideWidgetsTools.cpp
src/gui/UBTeacherGuideWidgetsTools.cpp
+34
-16
UBTeacherGuideWidgetsTools.h
src/gui/UBTeacherGuideWidgetsTools.h
+2
-0
No files found.
src/gui/UBTeacherGuideWidgetsTools.cpp
View file @
af82e62a
...
@@ -86,7 +86,6 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con
...
@@ -86,7 +86,6 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con
mpTask
=
new
UBTGAdaptableText
(
widget
,
this
);
mpTask
=
new
UBTGAdaptableText
(
widget
,
this
);
mpTask
->
setPlaceHolderText
(
tr
(
"Type task here ..."
));
mpTask
->
setPlaceHolderText
(
tr
(
"Type task here ..."
));
mpTask
->
setAcceptRichText
(
true
);
mpTask
->
setAcceptRichText
(
true
);
mpTask
->
setTextColor
(
QColor
().
green
());
mpTask
->
setObjectName
(
"ActionWidgetTaskTextEdit"
);
mpTask
->
setObjectName
(
"ActionWidgetTaskTextEdit"
);
mpLayout
->
addWidget
(
mpOwner
);
mpLayout
->
addWidget
(
mpOwner
);
mpLayout
->
addWidget
(
mpTask
);
mpLayout
->
addWidget
(
mpTask
);
...
@@ -147,7 +146,6 @@ void UBTGAdaptableText::setPlaceHolderText(QString text)
...
@@ -147,7 +146,6 @@ void UBTGAdaptableText::setPlaceHolderText(QString text)
// the space addition is to make this string unique and check against it to know
// the space addition is to make this string unique and check against it to know
// if we are talking about a typed string or the placeholder string
// if we are talking about a typed string or the placeholder string
mPlaceHolderText
=
text
+
" "
;
mPlaceHolderText
=
text
+
" "
;
setTextColor
(
QColor
(
Qt
::
lightGray
));
setPlainText
(
mPlaceHolderText
);
setPlainText
(
mPlaceHolderText
);
}
}
...
@@ -230,9 +228,12 @@ void UBTGAdaptableText::bottomMargin(int newValue)
...
@@ -230,9 +228,12 @@ void UBTGAdaptableText::bottomMargin(int newValue)
onTextChanged
();
onTextChanged
();
}
}
void
UBTGAdaptableText
::
focusInEvent
(
QFocusEvent
*
e
){
void
UBTGAdaptableText
::
focusInEvent
(
QFocusEvent
*
e
)
{
qDebug
()
<<
"pippa"
;
if
(
isReadOnly
()){
if
(
isReadOnly
()){
e
->
ignore
();
e
->
ignore
();
qDebug
()
<<
"ignored"
;
}
}
managePlaceholder
(
true
);
managePlaceholder
(
true
);
QTextEdit
::
focusInEvent
(
e
);
QTextEdit
::
focusInEvent
(
e
);
...
@@ -246,11 +247,13 @@ void UBTGAdaptableText::focusOutEvent(QFocusEvent* e){
...
@@ -246,11 +247,13 @@ void UBTGAdaptableText::focusOutEvent(QFocusEvent* e){
void
UBTGAdaptableText
::
managePlaceholder
(
bool
focus
){
void
UBTGAdaptableText
::
managePlaceholder
(
bool
focus
){
if
(
focus
){
if
(
focus
){
if
(
toPlainText
()
==
mPlaceHolderText
){
if
(
toPlainText
()
==
mPlaceHolderText
){
qDebug
()
<<
"Place holder found"
;
setTextColor
(
QColor
(
Qt
::
black
));
setTextColor
(
QColor
(
Qt
::
black
));
setPlainText
(
""
);
setPlainText
(
""
);
}
}
setCursorToTheEnd
();
setCursorToTheEnd
();
}
else
{
}
else
{
if
(
toPlainText
().
isEmpty
()){
if
(
toPlainText
().
isEmpty
()){
setTextColor
(
QColor
(
Qt
::
lightGray
));
setTextColor
(
QColor
(
Qt
::
lightGray
));
setPlainText
(
mPlaceHolderText
);
setPlainText
(
mPlaceHolderText
);
...
@@ -323,6 +326,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
...
@@ -323,6 +326,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
,
mpDropMeWidget
(
NULL
)
,
mpDropMeWidget
(
NULL
)
,
mpWorkWidget
(
NULL
)
,
mpWorkWidget
(
NULL
)
,
mpLayout
(
NULL
)
,
mpLayout
(
NULL
)
,
mpMediaLayout
(
NULL
)
,
mpTitle
(
NULL
)
,
mpTitle
(
NULL
)
,
mpMediaLabelWidget
(
NULL
)
,
mpMediaLabelWidget
(
NULL
)
,
mpMediaWidget
(
NULL
)
,
mpMediaWidget
(
NULL
)
...
@@ -330,6 +334,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
...
@@ -330,6 +334,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
,
mMediaPath
(
QString
(
""
))
,
mMediaPath
(
QString
(
""
))
,
mIsPresentationMode
(
false
)
,
mIsPresentationMode
(
false
)
,
mIsInitializationMode
(
false
)
,
mIsInitializationMode
(
false
)
,
mMediaWidgetHeight
(
150
)
{
{
setObjectName
(
name
);
setObjectName
(
name
);
mpDropMeWidget
=
new
QLabel
();
mpDropMeWidget
=
new
QLabel
();
...
@@ -347,6 +352,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
...
@@ -347,6 +352,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
,
mpDropMeWidget
(
NULL
)
,
mpDropMeWidget
(
NULL
)
,
mpWorkWidget
(
NULL
)
,
mpWorkWidget
(
NULL
)
,
mpLayout
(
NULL
)
,
mpLayout
(
NULL
)
,
mpMediaLayout
(
NULL
)
,
mpTitle
(
NULL
)
,
mpTitle
(
NULL
)
,
mpMediaLabelWidget
(
NULL
)
,
mpMediaLabelWidget
(
NULL
)
,
mpMediaWidget
(
NULL
)
,
mpMediaWidget
(
NULL
)
...
@@ -354,6 +360,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
...
@@ -354,6 +360,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
,
mIsPresentationMode
(
true
)
,
mIsPresentationMode
(
true
)
,
mMediaType
(
""
)
,
mMediaType
(
""
)
,
mIsInitializationMode
(
false
)
,
mIsInitializationMode
(
false
)
,
mMediaWidgetHeight
(
150
)
{
{
setObjectName
(
name
);
setObjectName
(
name
);
mMediaPath
=
UBApplication
::
boardController
->
selectedDocument
()
->
persistencePath
()
+
"/"
+
mediaPath
;
mMediaPath
=
UBApplication
::
boardController
->
selectedDocument
()
->
persistencePath
()
+
"/"
+
mediaPath
;
...
@@ -368,6 +375,7 @@ UBTGMediaWidget::~UBTGMediaWidget()
...
@@ -368,6 +375,7 @@ UBTGMediaWidget::~UBTGMediaWidget()
DELETEPTR
(
mpMediaLabelWidget
);
DELETEPTR
(
mpMediaLabelWidget
);
DELETEPTR
(
mpMediaWidget
);
DELETEPTR
(
mpMediaWidget
);
DELETEPTR
(
mpWebView
);
DELETEPTR
(
mpWebView
);
DELETEPTR
(
mpMediaLayout
);
DELETEPTR
(
mpLayout
);
DELETEPTR
(
mpLayout
);
removeWidget
(
mpDropMeWidget
);
removeWidget
(
mpDropMeWidget
);
...
@@ -456,9 +464,8 @@ void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType)
...
@@ -456,9 +464,8 @@ void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType)
mpMediaLabelWidget
=
new
QLabel
();
mpMediaLabelWidget
=
new
QLabel
();
QPixmap
pixmap
=
QPixmap
(
mMediaPath
);
QPixmap
pixmap
=
QPixmap
(
mMediaPath
);
pixmap
=
pixmap
.
scaledTo
Width
(
mpTreeWidgetItem
->
treeWidget
()
->
size
().
width
()
);
pixmap
=
pixmap
.
scaledTo
Height
(
mMediaWidgetHeight
);
mpMediaLabelWidget
->
setPixmap
(
pixmap
);
mpMediaLabelWidget
->
setPixmap
(
pixmap
);
mpMediaLabelWidget
->
setScaledContents
(
true
);
}
}
else
if
(
mimeType
.
contains
(
"widget"
)
&&
!
forceFlashMediaType
){
else
if
(
mimeType
.
contains
(
"widget"
)
&&
!
forceFlashMediaType
){
mMediaType
=
"w3c"
;
mMediaType
=
"w3c"
;
...
@@ -508,31 +515,43 @@ void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType)
...
@@ -508,31 +515,43 @@ void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType)
if
(
setMedia
){
if
(
setMedia
){
setAcceptDrops
(
false
);
setAcceptDrops
(
false
);
mpWorkWidget
=
new
QWidget
(
this
);
mpWorkWidget
=
new
QWidget
(
this
);
mpLayout
=
new
QVBoxLayout
(
mpWorkWidget
);
if
(
!
mIsPresentationMode
){
if
(
!
mIsPresentationMode
){
mpLayout
=
new
QVBoxLayout
(
mpWorkWidget
);
mpTitle
=
new
UBTGAdaptableText
(
mpTreeWidgetItem
,
mpWorkWidget
);
mpTitle
=
new
UBTGAdaptableText
(
mpTreeWidgetItem
,
mpWorkWidget
);
mpTitle
->
setPlaceHolderText
(
tr
(
"Type title here..."
));
mpTitle
->
setPlaceHolderText
(
tr
(
"Type title here..."
));
mpLayout
->
addWidget
(
mpTitle
);
mpLayout
->
addWidget
(
mpTitle
);
mpMediaLayout
=
new
QHBoxLayout
;
mpLayout
->
addLayout
(
mpMediaLayout
);
mpWorkWidget
->
setLayout
(
mpLayout
);
}
}
else
{
mpMediaLayout
=
new
QHBoxLayout
(
mpWorkWidget
);
mpWorkWidget
->
setLayout
(
mpMediaLayout
);
}
mpMediaLayout
->
addStretch
(
1
);
if
(
mpMediaLabelWidget
){
if
(
mpMediaLabelWidget
){
mpMediaLabelWidget
->
set
MaximumHeight
(
width
()
);
mpMediaLabelWidget
->
set
FixedHeight
(
mMediaWidgetHeight
);
mpMediaLabelWidget
->
setParent
(
mpWorkWidget
);
mpMediaLabelWidget
->
setParent
(
mpWorkWidget
);
mpLayout
->
addWidget
(
mpMediaLabelWidget
);
mp
Media
Layout
->
addWidget
(
mpMediaLabelWidget
);
}
}
else
if
(
mpMediaWidget
){
else
if
(
mpMediaWidget
){
mpMediaWidget
->
set
MaximumHeight
(
width
()
);
mpMediaWidget
->
set
FixedHeight
(
mMediaWidgetHeight
);
mpMediaWidget
->
setParent
(
mpWorkWidget
);
mpMediaWidget
->
setParent
(
mpWorkWidget
);
mpLayout
->
addWidget
(
mpMediaWidget
);
mp
Media
Layout
->
addWidget
(
mpMediaWidget
);
}
}
else
if
(
mpWebView
){
else
if
(
mpWebView
){
mpWebView
->
set
MaximumHeight
(
width
()
);
mpWebView
->
set
FixedHeight
(
mMediaWidgetHeight
);
mpWebView
->
setParent
(
mpWorkWidget
);
mpWebView
->
setParent
(
mpWorkWidget
);
mpLayout
->
addWidget
(
mpWebView
);
mp
Media
Layout
->
addWidget
(
mpWebView
);
mpWebView
->
show
();
mpWebView
->
show
();
}
}
mp
WorkWidget
->
setLayout
(
mpLayout
);
mp
MediaLayout
->
addStretch
(
1
);
addWidget
(
mpWorkWidget
);
addWidget
(
mpWorkWidget
);
setCurrentWidget
(
mpWorkWidget
);
setCurrentWidget
(
mpWorkWidget
);
mpWorkWidget
->
show
();
}
}
}
}
...
@@ -566,7 +585,6 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
...
@@ -566,7 +585,6 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
if
(
!
mIsPresentationMode
)
if
(
!
mIsPresentationMode
)
event
->
ignore
();
event
->
ignore
();
else
{
else
{
QDrag
*
drag
=
new
QDrag
(
this
);
QDrag
*
drag
=
new
QDrag
(
this
);
QMimeData
*
mimeData
=
new
QMimeData
();
QMimeData
*
mimeData
=
new
QMimeData
();
QList
<
QUrl
>
urlList
;
QList
<
QUrl
>
urlList
;
...
...
src/gui/UBTeacherGuideWidgetsTools.h
View file @
af82e62a
...
@@ -166,6 +166,7 @@ private:
...
@@ -166,6 +166,7 @@ private:
QLabel
*
mpDropMeWidget
;
QLabel
*
mpDropMeWidget
;
QWidget
*
mpWorkWidget
;
QWidget
*
mpWorkWidget
;
QVBoxLayout
*
mpLayout
;
QVBoxLayout
*
mpLayout
;
QHBoxLayout
*
mpMediaLayout
;
UBTGAdaptableText
*
mpTitle
;
UBTGAdaptableText
*
mpTitle
;
QLabel
*
mpMediaLabelWidget
;
QLabel
*
mpMediaLabelWidget
;
UBMediaWidget
*
mpMediaWidget
;
UBMediaWidget
*
mpMediaWidget
;
...
@@ -174,6 +175,7 @@ private:
...
@@ -174,6 +175,7 @@ private:
bool
mIsPresentationMode
;
bool
mIsPresentationMode
;
QString
mMediaType
;
QString
mMediaType
;
bool
mIsInitializationMode
;
bool
mIsInitializationMode
;
int
mMediaWidgetHeight
;
};
};
...
...
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