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
01aa493e
Commit
01aa493e
authored
Feb 01, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the Teacher Bar Document Preview widget
parent
c8b054f4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
177 additions
and
20 deletions
+177
-20
UBMetadataDcSubsetAdaptor.cpp
src/adaptors/UBMetadataDcSubsetAdaptor.cpp
+2
-1
UBSettings.cpp
src/core/UBSettings.cpp
+1
-0
UBSettings.h
src/core/UBSettings.h
+1
-0
UBDocumentProxy.cpp
src/document/UBDocumentProxy.cpp
+9
-0
UBDocumentProxy.h
src/document/UBDocumentProxy.h
+1
-0
UBTBDocumentPreviewWidget.cpp
src/gui/UBTBDocumentPreviewWidget.cpp
+119
-15
UBTBDocumentPreviewWidget.h
src/gui/UBTBDocumentPreviewWidget.h
+27
-2
UBTeacherBarDataMgr.cpp
src/gui/UBTeacherBarDataMgr.cpp
+8
-2
UBTeacherBarDataMgr.h
src/gui/UBTeacherBarDataMgr.h
+9
-0
No files found.
src/adaptors/UBMetadataDcSubsetAdaptor.cpp
View file @
01aa493e
...
...
@@ -276,7 +276,6 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
qWarning
()
<<
"Document size not found, using default view size"
<<
docSize
;
metadata
.
insert
(
UBSettings
::
documentSize
,
QVariant
(
docSize
));
}
if
(
!
updatedAtFound
)
...
...
@@ -284,6 +283,8 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
metadata
.
insert
(
UBSettings
::
documentUpdatedAt
,
date
+
"T00:00:00Z"
);
}
metadata
.
insert
(
UBSettings
::
documentDate
,
QVariant
(
date
));
return
metadata
;
}
src/core/UBSettings.cpp
View file @
01aa493e
...
...
@@ -43,6 +43,7 @@ QString UBSettings::sessionKeywords = QString("sessionKeywords");
QString
UBSettings
::
sessionLevel
=
QString
(
"sessionLevel"
);
QString
UBSettings
::
sessionTopic
=
QString
(
"sessionTopic"
);
QString
UBSettings
::
sessionAuthors
=
QString
(
"sessionAuthors"
);
QString
UBSettings
::
documentDate
=
QString
(
"date"
);
QString
UBSettings
::
trashedDocumentGroupNamePrefix
=
QString
(
"_Trash:"
);
...
...
src/core/UBSettings.h
View file @
01aa493e
...
...
@@ -160,6 +160,7 @@ class UBSettings : public QObject
static
QString
sessionLevel
;
static
QString
sessionTopic
;
static
QString
sessionAuthors
;
static
QString
documentDate
;
static
QString
trashedDocumentGroupNamePrefix
;
...
...
src/document/UBDocumentProxy.cpp
View file @
01aa493e
...
...
@@ -295,6 +295,15 @@ QString UBDocumentProxy::sessionAuthors()
return
QString
();
}
QString
UBDocumentProxy
::
documentDate
()
{
if
(
mMetaDatas
.
contains
(
UBSettings
::
documentDate
)){
return
metaData
(
UBSettings
::
documentDate
).
toString
();
}
else
{
return
QString
();
}
}
bool
UBDocumentProxy
::
isModified
()
const
{
return
mIsModified
;
...
...
src/document/UBDocumentProxy.h
View file @
01aa493e
...
...
@@ -59,6 +59,7 @@ class UBDocumentProxy : public QObject
QString
sessionTopic
();
void
setSessionAuthor
(
const
QString
&
authors
);
QString
sessionAuthors
();
QString
documentDate
();
QSize
defaultDocumentSize
()
const
;
...
...
src/gui/UBTBDocumentPreviewWidget.cpp
View file @
01aa493e
...
...
@@ -4,27 +4,119 @@
UBTBDocumentPreviewWidget
::
UBTBDocumentPreviewWidget
(
UBTeacherBarDataMgr
*
pDataMgr
,
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpPageViewButton
(
NULL
)
,
mpEditButton
(
NULL
)
,
mpSessionLabel
(
NULL
)
,
mpSessionTitle
(
NULL
)
,
mpAuthorLabel
(
NULL
)
,
mpAuthors
(
NULL
)
,
mpCreationDate
(
NULL
)
,
mpTargetLabel
(
NULL
)
,
mpTarget
(
NULL
)
,
mpMetadataLabel
(
NULL
)
,
mpKeywordLabel
(
NULL
)
,
mpKeyword
(
NULL
)
,
mpLevelLabel
(
NULL
)
,
mpLevel
(
NULL
)
,
mpTopicLabel
(
NULL
)
,
mpTopic
(
NULL
)
,
mpLicense
(
NULL
)
,
mpContainer
(
NULL
)
{
setObjectName
(
name
);
mpDataMgr
=
pDataMgr
;
setLayout
(
&
mLayout
);
mLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
);
mpPageViewButton
=
new
QPushButton
(
tr
(
"Page View"
),
this
);
mpPageViewButton
->
setObjectName
(
"DockPaletteWidgetButton"
);
mPageLayout
.
addStretch
(
1
);
mPageLayout
.
addWidget
(
mpPageViewButton
,
0
);
mPageLayout
.
addStretch
(
1
);
mLayout
.
addLayout
(
&
mPageLayout
);
mpContainer
=
new
QWidget
(
this
);
mpContainer
->
setLayout
(
&
mContainerLayout
);
mpContainer
->
setObjectName
(
"UBTeacherBarPreviewWidget"
);
// Session Title
mpSessionLabel
=
new
QLabel
(
tr
(
"Session"
),
mpContainer
);
mpSessionLabel
->
setAlignment
(
Qt
::
AlignRight
);
mpSessionLabel
->
setObjectName
(
"UBTeacherBarPreviewSubtitle"
);
mContainerLayout
.
addWidget
(
mpSessionLabel
,
0
);
mpSessionTitle
=
new
QLabel
(
mpContainer
);
mpSessionTitle
->
setWordWrap
(
true
);
mpSessionTitle
->
setAlignment
(
Qt
::
AlignRight
);
mpSessionTitle
->
setObjectName
(
"UBTeacherBarPreviewTitle"
);
mContainerLayout
.
addWidget
(
mpSessionTitle
,
0
);
mContainerLayout
.
addWidget
(
&
mTitleSeparator
,
0
);
// Author(s)
mpAuthorLabel
=
new
QLabel
(
tr
(
"Author(s)"
),
mpContainer
);
mpAuthorLabel
->
setObjectName
(
"UBTeacherBarPreviewSubtitle"
);
mContainerLayout
.
addWidget
(
mpAuthorLabel
,
0
);
mpAuthors
=
new
QLabel
(
mpContainer
);
mpAuthors
->
setWordWrap
(
true
);
mpAuthors
->
setStyleSheet
(
"padding-left:5px;"
);
mContainerLayout
.
addWidget
(
mpAuthors
,
0
);
mContainerLayout
.
addWidget
(
&
mAuthorSeparator
,
0
);
// Dates
mpCreationDate
=
new
QLabel
(
tr
(
"Created on: "
),
mpContainer
);
mpCreationDate
->
setStyleSheet
(
"padding-left:5px;"
);
mContainerLayout
.
addWidget
(
mpCreationDate
);
mContainerLayout
.
addWidget
(
&
mDateSeparator
,
0
);
// Target
mpTargetLabel
=
new
QLabel
(
tr
(
"Target"
),
mpContainer
);
mpTargetLabel
->
setObjectName
(
"UBTeacherBarPreviewSubtitle"
);
mContainerLayout
.
addWidget
(
mpTargetLabel
,
0
);
mpTarget
=
new
QTextEdit
(
mpContainer
);
mpTarget
->
setReadOnly
(
true
);
mContainerLayout
.
addWidget
(
mpTarget
,
1
);
mContainerLayout
.
addWidget
(
&
mTargetSeparator
,
0
);
// Metadata
mpMetadataLabel
=
new
QLabel
(
tr
(
"Metadata"
),
mpContainer
);
mpMetadataLabel
->
setObjectName
(
"UBTeacherBarPreviewSubtitle"
);
mContainerLayout
.
addWidget
(
mpMetadataLabel
,
0
);
// Keyword
mpKeywordLabel
=
new
QLabel
(
tr
(
"<b>Keywords:</b>"
),
mpContainer
);
mpKeywordLabel
->
setStyleSheet
(
"padding-left:5px;"
);
mpKeyword
=
new
QLabel
(
mpContainer
);
mpKeyword
->
setWordWrap
(
true
);
mKeywordLayout
.
addWidget
(
mpKeywordLabel
,
0
);
mKeywordLayout
.
addWidget
(
mpKeyword
,
1
);
mContainerLayout
.
addLayout
(
&
mKeywordLayout
,
0
);
// Level
mpLevelLabel
=
new
QLabel
(
tr
(
"<b>Level:</b>"
),
mpContainer
);
mpLevelLabel
->
setStyleSheet
(
"padding-left:5px;"
);
mpLevel
=
new
QLabel
(
mpContainer
);
mpLevel
->
setWordWrap
(
true
);
mLevelLayout
.
addWidget
(
mpLevelLabel
,
0
);
mLevelLayout
.
addWidget
(
mpLevel
,
1
);
mContainerLayout
.
addLayout
(
&
mLevelLayout
,
0
);
// TODO : Add the elements here
// Topic
mpTopicLabel
=
new
QLabel
(
tr
(
"<b>Topic:</b>"
),
mpContainer
);
mpTopicLabel
->
setStyleSheet
(
"padding-left:5px;"
);
mpTopic
=
new
QLabel
(
mpContainer
);
mpTopic
->
setWordWrap
(
true
);
mTopicLayout
.
addWidget
(
mpTopicLabel
,
0
);
mTopicLayout
.
addWidget
(
mpTopic
,
1
);
mContainerLayout
.
addLayout
(
&
mTopicLayout
,
0
);
mContainerLayout
.
addWidget
(
&
mMetadataSeparator
,
0
);
// License
mpLicense
=
new
UBTBLicenseWidget
(
mpContainer
);
mContainerLayout
.
addWidget
(
mpLicense
,
0
);
mLayout
.
addWidget
(
mpContainer
,
1
);
mpPageViewButton
=
new
QPushButton
(
tr
(
"Page View"
),
this
);
mpPageViewButton
->
setObjectName
(
"DockPaletteWidgetButton"
);
mpEditButton
=
new
QPushButton
(
tr
(
"Edit"
),
this
);
mpEditButton
->
setObjectName
(
"DockPaletteWidgetButton"
);
mPreviewLayout
.
addStretch
(
1
);
mPreviewLayout
.
addWidget
(
mpEditButton
,
0
);
mPreviewLayout
.
addStretch
(
1
);
mLayout
.
addLayout
(
&
mPreviewLayout
);
mButtonsLayout
.
addWidget
(
mpPageViewButton
,
0
);
mButtonsLayout
.
addWidget
(
mpEditButton
,
0
);
mButtonsLayout
.
addStretch
(
1
);
mLayout
.
addLayout
(
&
mButtonsLayout
,
0
);
connect
(
mpPageViewButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onPageView
()));
connect
(
mpEditButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onEdit
()));
...
...
@@ -32,8 +124,7 @@ UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataM
UBTBDocumentPreviewWidget
::~
UBTBDocumentPreviewWidget
()
{
DELETEPTR
(
mpPageViewButton
);
DELETEPTR
(
mpEditButton
);
}
void
UBTBDocumentPreviewWidget
::
onEdit
()
...
...
@@ -48,10 +139,23 @@ void UBTBDocumentPreviewWidget::onPageView()
void
UBTBDocumentPreviewWidget
::
updateFields
()
{
mpSessionTitle
->
setText
(
mpDataMgr
->
sessionTitle
());
mpAuthors
->
setText
(
mpDataMgr
->
authors
());
mpCreationDate
->
setText
(
tr
(
"<b>Creation Date:</b> %0"
).
arg
(
mpDataMgr
->
creationDate
()));
mpTarget
->
setText
(
mpDataMgr
->
sessionTarget
());
mpLicense
->
setLicense
(
mpDataMgr
->
sessionLicence
());
mpKeyword
->
setText
(
mpDataMgr
->
keywords
());
mpLevel
->
setText
(
mpDataMgr
->
level
());
mpTopic
->
setText
(
mpDataMgr
->
topic
());
}
void
UBTBDocumentPreviewWidget
::
clearFields
()
{
mpSessionTitle
->
setText
(
""
);
mpAuthors
->
setText
(
""
);
mpCreationDate
->
setText
(
""
);
mpTarget
->
setText
(
""
);
mpKeyword
->
setText
(
""
);
mpLevel
->
setText
(
""
);
mpTopic
->
setText
(
""
);
}
src/gui/UBTBDocumentPreviewWidget.h
View file @
01aa493e
...
...
@@ -24,10 +24,35 @@ private slots:
private
:
QVBoxLayout
mLayout
;
QHBoxLayout
mPageLayout
;
QHBoxLayout
mPreviewLayout
;
QHBoxLayout
mButtonsLayout
;
QWidget
*
mpContainer
;
QVBoxLayout
mContainerLayout
;
QPushButton
*
mpPageViewButton
;
QPushButton
*
mpEditButton
;
QLabel
*
mpSessionLabel
;
QLabel
*
mpSessionTitle
;
UBTBSeparator
mTitleSeparator
;
QLabel
*
mpAuthorLabel
;
QLabel
*
mpAuthors
;
UBTBSeparator
mAuthorSeparator
;
QLabel
*
mpCreationDate
;
UBTBSeparator
mDateSeparator
;
QLabel
*
mpTargetLabel
;
QTextEdit
*
mpTarget
;
UBTBSeparator
mTargetSeparator
;
QLabel
*
mpMetadataLabel
;
QHBoxLayout
mKeywordLayout
;
QLabel
*
mpKeywordLabel
;
QLabel
*
mpKeyword
;
QHBoxLayout
mLevelLayout
;
QLabel
*
mpLevelLabel
;
QLabel
*
mpLevel
;
QHBoxLayout
mTopicLayout
;
QLabel
*
mpTopicLabel
;
QLabel
*
mpTopic
;
UBTBSeparator
mMetadataSeparator
;
UBTBLicenseWidget
*
mpLicense
;
UBTeacherBarDataMgr
*
mpDataMgr
;
};
...
...
src/gui/UBTeacherBarDataMgr.cpp
View file @
01aa493e
#include <QDate>
#include "UBTeacherBarDataMgr.h"
#include "core/UBApplication.h"
...
...
@@ -59,7 +61,6 @@ void UBTeacherBarDataMgr::saveContent()
documentProxy
->
setSessionTitle
(
mSessionTitle
);
documentProxy
->
setSessionTarget
(
mSessionTarget
);
documentProxy
->
setSessionLicence
(
QString
(
"%0"
).
arg
(
mSessionLicence
));
qDebug
()
<<
"Saving keywords: "
<<
mKeywords
;
documentProxy
->
setSessionKeywords
(
mKeywords
);
documentProxy
->
setSessionLevel
(
mLevel
);
documentProxy
->
setSessionTopic
(
mTopic
);
...
...
@@ -82,10 +83,15 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
mSessionTarget
=
documentProxy
->
sessionTarget
();
mSessionLicence
=
(
eLicense
)
documentProxy
->
sessionLicence
().
toInt
();
mKeywords
=
documentProxy
->
sessionKeywords
();
qDebug
()
<<
"Keywords loaded: "
<<
mKeywords
<<
" ("
<<
documentProxy
->
sessionKeywords
()
<<
")"
;
mLevel
=
documentProxy
->
sessionLevel
();
mTopic
=
documentProxy
->
sessionTopic
();
mAuthors
=
documentProxy
->
sessionAuthors
();
if
(
""
!=
documentProxy
->
documentDate
()){
mCreationDate
=
documentProxy
->
documentDate
();
}
else
{
mCreationDate
=
QDate
::
currentDate
().
toString
(
"yyyy-MM-dd"
);
}
}
// Page Title
...
...
src/gui/UBTeacherBarDataMgr.h
View file @
01aa493e
...
...
@@ -115,6 +115,13 @@ public:
void
setAuthors
(
const
QString
&
authors
){
mAuthors
=
authors
;}
QString
authors
(){
return
mAuthors
;}
// Creation Date
void
setCreationDate
(
const
QString
&
date
){
mCreationDate
=
date
;}
QString
creationDate
(){
return
mCreationDate
;}
// Last Modification
void
setLastModificationDate
(
const
QString
&
date
){
mLastModif
=
date
;}
QString
lastModificationDate
(){
return
mLastModif
;}
// Others
void
clearLists
();
...
...
@@ -131,6 +138,8 @@ private:
QString
mLevel
;
QString
mTopic
;
QString
mAuthors
;
QString
mCreationDate
;
QString
mLastModif
;
QVector
<
sAction
>
mActionList
;
QVector
<
sLink
>
mUrlList
;
...
...
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