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
Hide 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
...
...
@@ -585,9 +585,9 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
else
QGraphicsView
::
mouseMoveEvent
(
event
);
}
else
if
((
UBDrawingController
::
drawingController
()
->
isDrawingTool
())
&&
!
mMouseButtonIsPressed
)
&&
!
mMouseButtonIsPressed
)
{
QGraphicsView
::
mouseMoveEvent
(
event
);
QGraphicsView
::
mouseMoveEvent
(
event
);
}
else
if
(
currentTool
==
UBStylusTool
::
Text
||
currentTool
==
UBStylusTool
::
Capture
)
{
...
...
@@ -849,11 +849,12 @@ void UBBoardView::dropEvent (QDropEvent *event)
graphicsWidget
->
processDropEvent
(
event
);
event
->
acceptProposedAction
();
}
else
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTGMediaWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QListView
*>
(
event
->
source
())
)
{
}
else
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTGMediaWidget
*>
(
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,39 +8,37 @@
#include <QString>
#include <QPixmap>
//#include "UBDockPaletteWidget.h"
enum
UBFeatureElementType
{
FEATURE_CATEGORY
,
FEATURE_VIRTUALFOLDER
,
FEATURE_FOLDER
,
FEATURE_INTERACTIVE
,
FEATURE_INTERNAL
,
FEATURE_INTERNAL
,
FEATURE_ITEM
,
FEATURE_TRASH
,
FEATURE_FAVORITE
FEATURE_TRASH
,
FEATURE_FAVORITE
};
class
UBFeature
{
public
:
UBFeature
()
{;}
//UBFeature(const UBFeature &f);
//UBFeature(const UBFeature &f);
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
QString
&
realPath
,
UBFeatureElementType
type
=
FEATURE_CATEGORY
);
virtual
~
UBFeature
()
{;}
QString
getName
()
const
{
return
mName
;
}
QPixmap
getThumbnail
()
const
{
return
mThumbnail
;}
QString
getUrl
()
const
{
return
virtualPath
;
}
//QString getPath() const { return mPath; };
//QString getPath() const { return mPath; };
QString
getFullPath
()
const
{
return
mPath
;
}
UBFeatureElementType
getType
()
const
{
return
elementType
;
}
bool
isFolder
()
const
;
bool
isFolder
()
const
;
private
:
QString
virtualPath
;
QString
virtualPath
;
QPixmap
mThumbnail
;
QString
mName
;
QString
mPath
;
QString
mPath
;
UBFeatureElementType
elementType
;
};
Q_DECLARE_METATYPE
(
UBFeature
)
...
...
@@ -50,73 +48,73 @@ class UBFeaturesController : public QObject
{
Q_OBJECT
public
:
UBFeaturesController
(
QWidget
*
parentWidget
);
UBFeaturesController
(
QWidget
*
parentWidget
);
virtual
~
UBFeaturesController
();
QList
<
UBFeature
>*
getFeatures
()
const
{
return
featuresList
;
}
const
QString
&
getRootPath
()
const
{
return
rootPath
;
}
void
addItemToPage
(
const
UBFeature
&
item
);
const
UBFeature
&
getCurrentElement
()
const
{
return
currentElement
;
}
void
setCurrentElement
(
const
UBFeature
&
elem
)
{
currentElement
=
elem
;
}
const
UBFeature
&
getTrashElement
()
const
{
return
trashElement
;
}
UBFeature
moveItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
UBFeature
copyItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
void
deleteItem
(
const
QUrl
&
url
);
bool
isTrash
(
const
QUrl
&
url
);
UBFeature
newFolder
(
const
QString
&
name
);
UBFeature
addToFavorite
(
const
QUrl
&
path
);
void
removeFromFavorite
(
const
QUrl
&
path
);
static
QString
fileNameFromUrl
(
const
QUrl
&
url
);
static
QPixmap
thumbnailForFile
(
const
QString
&
path
);
void
addItemToPage
(
const
UBFeature
&
item
);
const
UBFeature
&
getCurrentElement
()
const
{
return
currentElement
;
}
void
setCurrentElement
(
const
UBFeature
&
elem
)
{
currentElement
=
elem
;
}
const
UBFeature
&
getTrashElement
()
const
{
return
trashElement
;
}
UBFeature
moveItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
UBFeature
copyItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
void
deleteItem
(
const
QUrl
&
url
);
bool
isTrash
(
const
QUrl
&
url
);
UBFeature
newFolder
(
const
QString
&
name
);
UBFeature
addToFavorite
(
const
QUrl
&
path
);
void
removeFromFavorite
(
const
QUrl
&
path
);
static
QString
fileNameFromUrl
(
const
QUrl
&
url
);
static
QPixmap
thumbnailForFile
(
const
QString
&
path
);
private
:
void
initDirectoryTree
();
void
fileSystemScan
(
const
QString
&
currPath
,
const
QString
&
currVirtualPath
);
static
QPixmap
createThumbnail
(
const
QString
&
path
);
//void addImageToCurrentPage( const QString &path );
void
loadFavoriteList
();
void
saveFavoriteList
();
void
initDirectoryTree
();
void
fileSystemScan
(
const
QString
&
currPath
,
const
QString
&
currVirtualPath
);
static
QPixmap
createThumbnail
(
const
QString
&
path
);
//void addImageToCurrentPage( const QString &path );
void
loadFavoriteList
();
void
saveFavoriteList
();
static
UBFeatureElementType
fileTypeFromUrl
(
const
QString
&
path
);
static
UBFeatureElementType
fileTypeFromUrl
(
const
QString
&
path
);
QList
<
UBFeature
>
*
featuresList
;
UBFeature
*
rootElement
;
QList
<
UBFeature
>
*
featuresList
;
UBFeature
*
rootElement
;
QString
mUserAudioDirectoryPath
;
QString
mUserAudioDirectoryPath
;
QString
mUserVideoDirectoryPath
;
QString
mUserPicturesDirectoryPath
;
QString
mUserInteractiveDirectoryPath
;
QString
mUserAnimationDirectoryPath
;
QString
libraryPath
;
QString
mLibAudioDirectoryPath
;
QString
libraryPath
;
QString
mLibAudioDirectoryPath
;
QString
mLibVideoDirectoryPath
;
QString
mLibPicturesDirectoryPath
;
QString
mLibInteractiveDirectoryPath
;
QString
mLibAnimationDirectoryPath
;
QString
mLibApplicationsDirectoryPath
;
QString
mLibShapesDirectoryPath
;
QString
trashDirectoryPath
;
QString
rootPath
;
QString
audiosPath
;
QString
moviesPath
;
QString
picturesPath
;
QString
appPath
;
QString
flashPath
;
QString
shapesPath
;
QString
interactPath
;
QString
trashPath
;
QString
favoritePath
;
int
mLastItemOffsetIndex
;
UBFeature
currentElement
;
UBFeature
trashElement
;
UBFeature
favoriteElement
;
QSet
<
QString
>
*
favoriteSet
;
QString
mLibApplicationsDirectoryPath
;
QString
mLibShapesDirectoryPath
;
QString
trashDirectoryPath
;
QString
rootPath
;
QString
audiosPath
;
QString
moviesPath
;
QString
picturesPath
;
QString
appPath
;
QString
flashPath
;
QString
shapesPath
;
QString
interactPath
;
QString
trashPath
;
QString
favoritePath
;
int
mLastItemOffsetIndex
;
UBFeature
currentElement
;
UBFeature
trashElement
;
UBFeature
favoriteElement
;
QSet
<
QString
>
*
favoriteSet
;
};
...
...
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
();
...
...
@@ -363,7 +368,7 @@ UBDocumentProxy* UBPersistenceManager::duplicateDocument(UBDocumentProxy* pDocum
void
UBPersistenceManager
::
deleteDocumentScenes
(
UBDocumentProxy
*
proxy
,
const
QList
<
int
>&
indexes
)
{
checkIfDocumentRepositoryExists
();
checkIfDocumentRepositoryExists
();
int
pageCount
=
UBPersistenceManager
::
persistenceManager
()
->
sceneCount
(
proxy
);
...
...
@@ -432,7 +437,7 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
QFile
::
remove
(
thumbFileName
);
mSceneCache
.
removeScene
(
proxy
,
index
);
mSceneCache
.
removeScene
(
proxy
,
index
);
proxy
->
decPageCount
();
...
...
@@ -482,7 +487,7 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in
proxy
->
incPageCount
();
emit
documentSceneCreated
(
proxy
,
index
+
1
);
emit
documentSceneCreated
(
proxy
,
index
+
1
);
}
...
...
@@ -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,11 +41,12 @@ 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
();
virtual
UBDocumentProxy
*
createDocument
(
const
QString
&
pGroupName
=
""
,
const
QString
&
pName
=
""
,
bool
withEmptyPage
=
true
);
virtual
UBDocumentProxy
*
createDocument
(
const
QString
&
pGroupName
=
""
,
const
QString
&
pName
=
""
,
bool
withEmptyPage
=
true
);
virtual
UBDocumentProxy
*
createDocumentFromDir
(
const
QString
&
pDocumentDirectory
,
const
QString
&
pGroupName
=
""
,
const
QString
&
pName
=
""
,
bool
withEmptyPage
=
false
);
virtual
UBDocumentProxy
*
persistDocumentMetadata
(
UBDocumentProxy
*
pDocumentProxy
);
...
...
@@ -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
;
...
...
@@ -129,7 +128,7 @@ void UBNavigatorPalette::changeCurrentPage()
if
(
NO_PAGESELECTED
!=
iPage
)
{
// Display the selected page
UBApplication
::
boardController
->
setActiveDocumentScene
(
mNavigator
->
currentDoc
(),
iPage
);
UBApplication
::
boardController
->
setActiveDocumentScene
(
mNavigator
->
currentDoc
(),
iPage
);
}
}
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
7ee53b07
...
...
@@ -862,15 +862,19 @@ void UBTeacherGuidePageZeroWidget::loadData()
void
UBTeacherGuidePageZeroWidget
::
persistData
()
{
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
activeDocument
();
documentProxy
->
setMetaData
(
UBSettings
::
sessionTitle
,
mpSessionTitle
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionAuthors
,
mpAuthors
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionGoals
,
mpGoals
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionKeywords
,
mpKeywords
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionGradeLevel
,
mpSchoolLevelBox
->
currentText
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionBranch
,
mpSchoolBranchBox
->
currentText
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionType
,
mpSchoolTypeBox
->
currentText
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionLicence
,
mpLicenceBox
->
currentText
());
// 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
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionGoals
,
mpGoals
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionKeywords
,
mpKeywords
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionGradeLevel
,
mpSchoolLevelBox
->
currentText
());
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