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
7ee53b07
Commit
7ee53b07
authored
May 05, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first page handling code
parent
f85bb2d5
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
162 additions
and
113 deletions
+162
-113
style.qss
resources/style.qss
+8
-7
UBImportImage.cpp
src/adaptors/UBImportImage.cpp
+0
-1
UBImportPDF.cpp
src/adaptors/UBImportPDF.cpp
+0
-1
UBThumbnailAdaptor.cpp
src/adaptors/UBThumbnailAdaptor.cpp
+9
-11
UBDocumentPublisher.cpp
src/adaptors/publishing/UBDocumentPublisher.cpp
+7
-5
UBBoardController.cpp
src/board/UBBoardController.cpp
+8
-1
UBBoardController.h
src/board/UBBoardController.h
+2
-0
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+2
-2
UBBoardView.cpp
src/board/UBBoardView.cpp
+8
-7
UBFeaturesController.h
src/board/UBFeaturesController.h
+57
-59
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+39
-5
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+5
-1
UBDocumentNavigator.cpp
src/gui/UBDocumentNavigator.cpp
+1
-1
UBNavigatorPalette.cpp
src/gui/UBNavigatorPalette.cpp
+2
-3
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+13
-9
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+1
-0
No files found.
resources/style.qss
View file @
7ee53b07
...
...
@@ -227,19 +227,13 @@ QLabel#UBTGPresentationDocumentTitle
font-weight:bold;
}
QLabel#UBTG
Edition
PageNumberLabel
QLabel#UBTGPageNumberLabel
{
color: black;
font-size : 12px;
font-weight:bold;
}
QLabel#UBTGPresentationPageNumberLabel
{
color: black;
font-size : 12px;
}
UBTGAdaptableText#UBTGEditionPageTitle,
UBTGAdaptableText#UBTGEditionComment
{
...
...
@@ -266,3 +260,10 @@ QFrame#UBTGSeparator
{
background-color: #cccccc;
}
UBTGAdaptableText {
background-color: white;
border:1 solid #999999;
border-radius : 10px;
padding: 2px;
}
src/adaptors/UBImportImage.cpp
View file @
7ee53b07
...
...
@@ -14,7 +14,6 @@
*/
#include "UBImportImage.h"
#include "UBSvgSubsetAdaptor.h"
#include "document/UBDocumentProxy.h"
...
...
src/adaptors/UBImportPDF.cpp
View file @
7ee53b07
...
...
@@ -14,7 +14,6 @@
*/
#include "UBImportPDF.h"
#include "UBSvgSubsetAdaptor.h"
#include "document/UBDocumentProxy.h"
...
...
src/adaptors/UBThumbnailAdaptor.cpp
View file @
7ee53b07
...
...
@@ -23,6 +23,8 @@
#include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "board/UBBoardController.h"
#include "document/UBDocumentProxy.h"
#include "domain/UBGraphicsScene.h"
...
...
@@ -42,8 +44,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
int
existingPageCount
=
proxy
->
pageCount
();
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
existingPageCount
);
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
existingPageCount
);
QFile
thumbFile
(
thumbFileName
);
...
...
@@ -80,8 +81,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
while
(
moreToProcess
)
{
pageCount
++
;
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageCount
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageCount
);
QFile
file
(
fileName
);
if
(
file
.
exists
())
{
...
...
@@ -108,8 +108,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
return
QPixmap
();
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
existingPageCount
);
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
existingPageCount
);
QFile
thumbFile
(
thumbFileName
);
...
...
@@ -140,8 +139,8 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
}
//end compatibility with older format
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
index
+
1
);
// QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index + 1);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
index
)
);
QFile
file
(
fileName
);
if
(
file
.
exists
())
...
...
@@ -160,7 +159,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
void
UBThumbnailAdaptor
::
persistScene
(
const
QString
&
pDocPath
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
)
{
QString
fileName
=
pDocPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
+
1
);
QString
fileName
=
pDocPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QFile
thumbFile
(
fileName
);
...
...
@@ -206,8 +205,7 @@ void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene*
QUrl
UBThumbnailAdaptor
::
thumbnailUrl
(
UBDocumentProxy
*
proxy
,
int
pageIndex
)
{
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
+
1
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
));
return
QUrl
::
fromLocalFile
(
fileName
);
}
src/adaptors/publishing/UBDocumentPublisher.cpp
View file @
7ee53b07
...
...
@@ -28,6 +28,8 @@
#include "core/UBPersistenceManager.h"
#include "core/UBApplicationController.h"
#include "board/UBBoardController.h"
#include "gui/UBMainWindow.h"
#include "document/UBDocumentProxy.h"
...
...
@@ -131,7 +133,7 @@ void UBDocumentPublisher::buildUbwFile()
// remove all useless files
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishingDocument
->
pageCount
();
pageIndex
++
)
{
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
+
1
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QFile
::
remove
(
filename
);
}
...
...
@@ -187,11 +189,11 @@ void UBDocumentPublisher::rasterizeScenes()
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishingDocument
->
pageCount
();
pageIndex
++
)
{
UBApplication
::
showMessage
(
tr
(
"Converting page %1/%2 ..."
).
arg
(
pageIndex
+
1
).
arg
(
mPublishingDocument
->
pageCount
()),
true
);
UBApplication
::
showMessage
(
tr
(
"Converting page %1/%2 ..."
).
arg
(
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
).
arg
(
mPublishingDocument
->
pageCount
()),
true
);
UBSvgSubsetRasterizer
rasterizer
(
mPublishingDocument
,
pageIndex
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.jpg"
,
pageIndex
+
1
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.jpg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
rasterizer
.
rasterizeToFile
(
filename
);
...
...
@@ -250,12 +252,12 @@ void UBDocumentPublisher::upgradeDocumentForPublishing()
UBGraphicsW3CWidgetItem
*
widgetItem
=
dynamic_cast
<
UBGraphicsW3CWidgetItem
*>
(
item
);
if
(
widgetItem
){
generateWidgetPropertyScript
(
widgetItem
,
pageIndex
+
1
);
generateWidgetPropertyScript
(
widgetItem
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
widgets
<<
widgetItem
;
}
}
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.json"
,
pageIndex
+
1
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.json"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QFile
jsonFile
(
filename
);
if
(
jsonFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
...
...
src/board/UBBoardController.cpp
View file @
7ee53b07
...
...
@@ -151,11 +151,18 @@ UBBoardController::~UBBoardController()
int
UBBoardController
::
currentPage
()
{
if
(
!
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
return
mActiveSceneIndex
;
return
mActiveSceneIndex
+
1
;
}
int
UBBoardController
::
pageFromSceneIndex
(
int
sceneIndex
)
{
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
return
sceneIndex
;
return
sceneIndex
+
1
;
}
void
UBBoardController
::
setupViews
()
{
mControlContainer
=
new
QWidget
(
mMainWindow
->
centralWidget
());
...
...
src/board/UBBoardController.h
View file @
7ee53b07
...
...
@@ -59,6 +59,8 @@ class UBBoardController : public QObject
int
currentPage
();
int
pageFromSceneIndex
(
int
sceneIndex
);
UBDocumentProxy
*
activeDocument
()
{
return
mActiveDocument
;
...
...
src/board/UBBoardPaletteManager.cpp
View file @
7ee53b07
...
...
@@ -153,7 +153,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mRightPalette
=
new
UBRightPalette
(
mContainer
);
// RIGHT palette widgets
mpFeaturesWidget
=
new
UBFeaturesWidget
();
mRightPalette
->
registerWidget
(
mpFeaturesWidget
);
mRightPalette
->
addTab
(
mpFeaturesWidget
);
...
...
@@ -534,7 +534,7 @@ void UBBoardPaletteManager::activeSceneChanged()
if
(
mpPageNavigWidget
)
{
mpPageNavigWidget
->
setPageNumber
(
pageIndex
+
1
,
activeScene
->
document
()
->
pageCount
());
mpPageNavigWidget
->
setPageNumber
(
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
,
activeScene
->
document
()
->
pageCount
());
}
if
(
mZoomPalette
)
...
...
src/board/UBBoardView.cpp
View file @
7ee53b07
...
...
@@ -853,7 +853,8 @@ void UBBoardView::dropEvent (QDropEvent *event)
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTGMediaWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QListView
*>
(
event
->
source
())
)
{
||
dynamic_cast
<
QListView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTGDraggableTreeItem
*>
(
event
->
source
()))
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
event
->
acceptProposedAction
();
...
...
src/board/UBFeaturesController.h
View file @
7ee53b07
...
...
@@ -8,8 +8,6 @@
#include <QString>
#include <QPixmap>
//#include "UBDockPaletteWidget.h"
enum
UBFeatureElementType
{
FEATURE_CATEGORY
,
...
...
src/core/UBPersistenceManager.cpp
View file @
7ee53b07
...
...
@@ -32,6 +32,10 @@
#include "adaptors/UBThumbnailAdaptor.h"
#include "adaptors/UBMetadataDcSubsetAdaptor.h"
#include "board/UBBoardController.h"
#include "interfaces/IDataStorage.h"
#include "core/memcheck.h"
const
QString
UBPersistenceManager
::
imageDirectory
=
"images"
;
// added to UBPersistenceManager::mAllDirectories
...
...
@@ -39,6 +43,7 @@ const QString UBPersistenceManager::objectDirectory = "objects"; // added to UBP
const
QString
UBPersistenceManager
::
widgetDirectory
=
"widgets"
;
// added to UBPersistenceManager::mAllDirectories
const
QString
UBPersistenceManager
::
videoDirectory
=
"videos"
;
// added to UBPersistenceManager::mAllDirectories
const
QString
UBPersistenceManager
::
audioDirectory
=
"audios"
;
// added to
const
QString
UBPersistenceManager
::
teacherGuideDirectory
=
"teacherGuideObjects"
;
UBPersistenceManager
*
UBPersistenceManager
::
sSingleton
=
0
;
...
...
@@ -52,6 +57,7 @@ UBPersistenceManager::UBPersistenceManager(QObject *pParent)
mDocumentSubDirectories
<<
widgetDirectory
;
mDocumentSubDirectories
<<
videoDirectory
;
mDocumentSubDirectories
<<
audioDirectory
;
mDocumentSubDirectories
<<
teacherGuideDirectory
;
documentProxies
=
allDocumentProxies
();
emit
proxyListChanged
();
...
...
@@ -83,7 +89,6 @@ UBPersistenceManager::~UBPersistenceManager()
}
}
QList
<
QPointer
<
UBDocumentProxy
>
>
UBPersistenceManager
::
allDocumentProxies
()
{
mDocumentRepositoryPath
=
UBSettings
::
userDocumentDirectory
();
...
...
@@ -668,7 +673,7 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath)
while
(
moreToProcess
)
{
QString
fileName
=
pPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
+
1
);
QString
fileName
=
pPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QFile
file
(
fileName
);
...
...
@@ -828,6 +833,35 @@ void UBPersistenceManager::purgeEmptyDocuments()
}
}
QString
UBPersistenceManager
::
teacherGuideAbsoluteObjectPath
(
UBDocumentProxy
*
pDocumentProxy
)
{
return
pDocumentProxy
->
persistencePath
()
+
"/"
+
teacherGuideDirectory
;
}
QString
UBPersistenceManager
::
addObjectToTeacherGuideDirectory
(
UBDocumentProxy
*
pDocumentProxy
,
QString
pPath
)
{
QFileInfo
fi
(
pPath
.
replace
(
"file://"
,
""
));
QString
uuid
=
QUuid
::
createUuid
();
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
)
return
""
;
QString
fileName
=
UBPersistenceManager
::
teacherGuideDirectory
+
"/"
+
uuid
+
"."
+
fi
.
suffix
();
QString
destPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
fileName
;
if
(
!
QFile
::
exists
(
destPath
)){
QDir
dir
;
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
teacherGuideDirectory
);
QFile
source
(
pPath
);
source
.
copy
(
destPath
);
}
return
destPath
;
}
QString
UBPersistenceManager
::
addVideoFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
)
{
...
...
src/core/UBPersistenceManager.h
View file @
7ee53b07
...
...
@@ -41,6 +41,7 @@ class UBPersistenceManager : public QObject
static
const
QString
videoDirectory
;
static
const
QString
audioDirectory
;
static
const
QString
widgetDirectory
;
static
const
QString
teacherGuideDirectory
;
static
UBPersistenceManager
*
persistenceManager
();
static
void
destroy
();
...
...
@@ -80,6 +81,9 @@ class UBPersistenceManager : public QObject
virtual
QString
generateUniqueDocumentPath
();
QString
teacherGuideAbsoluteObjectPath
(
UBDocumentProxy
*
pDocumentProxy
);
QString
addObjectToTeacherGuideDirectory
(
UBDocumentProxy
*
proxy
,
QString
pPath
);
virtual
void
addDirectoryContentToDocument
(
const
QString
&
documentRootFolder
,
UBDocumentProxy
*
pDocument
);
virtual
void
upgradeDocumentIfNeeded
(
UBDocumentProxy
*
pDocumentProxy
);
...
...
src/gui/UBDocumentNavigator.cpp
View file @
7ee53b07
...
...
@@ -113,7 +113,7 @@ void UBDocumentNavigator::generateThumbnails()
{
QPixmap
pix
=
thumbs
.
at
(
i
);
QGraphicsPixmapItem
*
pixmapItem
=
new
UBSceneThumbnailNavigPixmap
(
pix
,
mCrntDoc
,
i
);
UBThumbnailTextItem
*
labelItem
=
new
UBThumbnailTextItem
(
tr
(
"Page %0"
).
arg
(
i
+
1
));
UBThumbnailTextItem
*
labelItem
=
new
UBThumbnailTextItem
(
tr
(
"Page %0"
).
arg
(
UBApplication
::
boardController
->
pageFromSceneIndex
(
i
)
));
UBImgTextThumbnailElement
thumbWithText
(
pixmapItem
,
labelItem
);
thumbWithText
.
setBorder
(
border
());
...
...
src/gui/UBNavigatorPalette.cpp
View file @
7ee53b07
...
...
@@ -33,8 +33,7 @@ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):
{
setOrientation
(
eUBDockOrientation_Left
);
setMaximumWidth
(
300
);
//mCollapsedIcon = QPixmap(":images/pages_open.png");
//mIcon = QPixmap(":images/pages_close.png");
resize
(
UBSettings
::
settings
()
->
navigPaletteWidth
->
get
().
toInt
(),
height
());
mLastWidth
=
300
;
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
7ee53b07
...
...
@@ -862,6 +862,9 @@ void UBTeacherGuidePageZeroWidget::loadData()
void
UBTeacherGuidePageZeroWidget
::
persistData
()
{
// check necessary because at document closing hide event is send after boardcontroller set
// to NULL
if
(
UBApplication
::
boardController
){
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
activeDocument
();
documentProxy
->
setMetaData
(
UBSettings
::
sessionTitle
,
mpSessionTitle
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionAuthors
,
mpAuthors
->
text
());
...
...
@@ -871,6 +874,7 @@ void UBTeacherGuidePageZeroWidget::persistData()
documentProxy
->
setMetaData
(
UBSettings
::
sessionBranch
,
mpSchoolBranchBox
->
currentText
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionType
,
mpSchoolTypeBox
->
currentText
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionLicence
,
mpLicenceBox
->
currentText
());
}
}
void
UBTeacherGuidePageZeroWidget
::
updateSceneTitle
()
...
...
src/gui/UBThumbnailWidget.cpp
View file @
7ee53b07
...
...
@@ -855,6 +855,7 @@ void UBSceneThumbnailNavigPixmap::deletePage()
void
UBSceneThumbnailNavigPixmap
::
moveUpPage
()
{
UBApplication
::
documentController
->
moveSceneToIndex
(
proxy
(),
sceneIndex
(),
sceneIndex
()
-
1
);
}
...
...
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