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
4e884672
Commit
4e884672
authored
Jul 20, 2012
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
622b4d95
076e074e
Changes
35
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
7441 additions
and
7408 deletions
+7441
-7408
UBCFFSubsetAdaptor.cpp
src/adaptors/UBCFFSubsetAdaptor.cpp
+2
-2
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+3
-1
UBThumbnailAdaptor.cpp
src/adaptors/UBThumbnailAdaptor.cpp
+230
-186
UBThumbnailAdaptor.h
src/adaptors/UBThumbnailAdaptor.h
+42
-39
UBDocumentPublisher.cpp
src/adaptors/publishing/UBDocumentPublisher.cpp
+823
-825
UBDocumentPublisher.h
src/adaptors/publishing/UBDocumentPublisher.h
+133
-128
UBWidgetUniboardAPI.cpp
src/api/UBWidgetUniboardAPI.cpp
+1
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+2262
-2247
UBBoardController.h
src/board/UBBoardController.h
+13
-17
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+2
-4
UBLibraryController.cpp
src/board/UBLibraryController.cpp
+1
-1
UBApplication.cpp
src/core/UBApplication.cpp
+0
-2
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+1
-2
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+2
-2
UBDocumentContainer.cpp
src/document/UBDocumentContainer.cpp
+127
-0
UBDocumentContainer.h
src/document/UBDocumentContainer.h
+67
-0
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+1659
-1697
UBDocumentController.h
src/document/UBDocumentController.h
+142
-145
UBDocumentProxy.cpp
src/document/UBDocumentProxy.cpp
+232
-232
UBDocumentProxy.h
src/document/UBDocumentProxy.h
+99
-95
document.pri
src/document/document.pri
+3
-1
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+2
-2
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+2
-1
UBDocumentNavigator.cpp
src/gui/UBDocumentNavigator.cpp
+273
-384
UBDocumentNavigator.h
src/gui/UBDocumentNavigator.h
+72
-84
UBDocumentThumbnailWidget.cpp
src/gui/UBDocumentThumbnailWidget.cpp
+315
-316
UBDocumentTreeWidget.cpp
src/gui/UBDocumentTreeWidget.cpp
+457
-455
UBNavigatorPalette.cpp
src/gui/UBNavigatorPalette.cpp
+144
-167
UBNavigatorPalette.h
src/gui/UBNavigatorPalette.h
+64
-66
UBPageNavigationWidget.cpp
src/gui/UBPageNavigationWidget.cpp
+173
-206
UBPageNavigationWidget.h
src/gui/UBPageNavigationWidget.h
+71
-75
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+7
-7
UBTeacherGuideWidgetsTools.cpp
src/gui/UBTeacherGuideWidgetsTools.cpp
+4
-4
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+9
-10
UBThumbnailWidget.h
src/gui/UBThumbnailWidget.h
+4
-4
No files found.
src/adaptors/UBCFFSubsetAdaptor.cpp
View file @
4e884672
...
...
@@ -1078,7 +1078,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::persistCurrentScene()
{
if
(
mCurrentScene
!=
0
&&
mCurrentScene
->
isModified
())
{
UBThumbnailAdaptor
::
persistScene
(
mProxy
->
persistencePath
()
,
mCurrentScene
,
mProxy
->
pageCount
()
-
1
);
UBThumbnailAdaptor
::
persistScene
(
mProxy
,
mCurrentScene
,
mProxy
->
pageCount
()
-
1
);
UBSvgSubsetAdaptor
::
persistScene
(
mProxy
,
mCurrentScene
,
mProxy
->
pageCount
()
-
1
);
mCurrentScene
->
setModified
(
false
);
...
...
@@ -1102,7 +1102,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::persistScenes()
UBSvgSubsetAdaptor
::
persistScene
(
mProxy
,
mCurrentScene
,
i
);
UBGraphicsScene
*
tmpScene
=
UBSvgSubsetAdaptor
::
loadScene
(
mProxy
,
i
);
tmpScene
->
setModified
(
true
);
UBThumbnailAdaptor
::
persistScene
(
mProxy
->
persistencePath
()
,
tmpScene
,
i
);
UBThumbnailAdaptor
::
persistScene
(
mProxy
,
tmpScene
,
i
);
delete
tmpScene
;
mCurrentScene
->
setModified
(
false
);
...
...
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
4e884672
...
...
@@ -56,6 +56,8 @@
#include "interfaces/IDataStorage.h"
#include "document/UBDocumentContainer.h"
#include "pdf/PDFRenderer.h"
#include "core/memcheck.h"
...
...
@@ -313,7 +315,7 @@ QString UBSvgSubsetAdaptor::readTeacherGuideNode(int sceneIndex)
{
QString
result
;
QString
fileName
=
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sceneIndex
);
QString
fileName
=
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sceneIndex
);
QFile
file
(
fileName
);
file
.
open
(
QIODevice
::
ReadOnly
);
QByteArray
fileByteArray
=
file
.
readAll
();
...
...
src/adaptors/UBThumbnailAdaptor.cpp
View file @
4e884672
...
...
@@ -58,7 +58,7 @@ void UBThumbnailAdaptor::generateMissingThumbnails(UBDocumentProxy* proxy)
if
(
displayMessage
&&
thumbCount
==
1
)
UBApplication
::
showMessage
(
tr
(
"Generating preview thumbnails ..."
));
persistScene
(
proxy
->
persistencePath
(),
scene
,
iPageNo
);
persistScene
(
proxy
,
scene
,
iPageNo
);
}
if
(
displayMessage
&&
thumbCount
>
0
)
...
...
@@ -68,10 +68,48 @@ void UBThumbnailAdaptor::generateMissingThumbnails(UBDocumentProxy* proxy)
}
}
const
QPixmap
*
UBThumbnailAdaptor
::
get
(
UBDocumentProxy
*
proxy
,
int
pageIndex
)
{
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
);
QFile
file
(
fileName
);
if
(
!
file
.
exists
())
{
generateMissingThumbnails
(
proxy
);
}
QPixmap
*
pix
=
new
QPixmap
();
if
(
file
.
exists
())
{
//Warning. Works only with modified Qt
#ifdef Q_WS_X11
pix
->
load
(
fileName
,
0
,
Qt
::
AutoColor
);
#else
pix
->
load
(
fileName
,
0
,
Qt
::
AutoColor
,
false
);
#endif
}
return
pix
;
}
void
UBThumbnailAdaptor
::
load
(
UBDocumentProxy
*
proxy
,
QList
<
const
QPixmap
*>&
list
)
{
generateMissingThumbnails
(
proxy
);
foreach
(
const
QPixmap
*
pm
,
list
)
delete
pm
;
list
.
clear
();
for
(
int
i
=
0
;
i
<
proxy
->
pageCount
();
i
++
)
list
.
append
(
get
(
proxy
,
i
));
}
/*
QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
{
QList<QPixmap> thumbnails;
qDebug() << "Loadinf thumbnails for " << proxy->name();
if (!proxy || proxy->persistencePath().isEmpty())
return thumbnails;
...
...
@@ -107,6 +145,8 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
{
qDebug() << "Loadinf thumbnails for " << proxy->name();
int existingPageCount = proxy->pageCount();
if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index > existingPageCount)
...
...
@@ -131,10 +171,14 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
}
return QPixmap();
}
*/
void
UBThumbnailAdaptor
::
persistScene
(
const
QString
&
pDocPath
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
)
void
UBThumbnailAdaptor
::
persistScene
(
UBDocumentProxy
*
proxy
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
)
{
QString
fileName
=
pDocPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
);
qDebug
()
<<
"Persiste scene on path "
<<
proxy
->
persistencePath
()
<<
", index "
<<
pageIndex
;
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
);
QFile
thumbFile
(
fileName
);
...
...
src/adaptors/UBThumbnailAdaptor.h
View file @
4e884672
...
...
@@ -25,15 +25,18 @@ class UBThumbnailAdaptor //static class
{
Q_DECLARE_TR_FUNCTIONS
(
UBThumbnailAdaptor
)
private
:
UBThumbnailAdaptor
()
{}
public
:
static
void
persistScene
(
const
QString
&
pDocPath
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
=
false
);
static
QUrl
thumbnailUrl
(
UBDocumentProxy
*
proxy
,
int
pageIndex
);
static
void
persistScene
(
UBDocumentProxy
*
proxy
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
=
false
);
static
const
QPixmap
*
get
(
UBDocumentProxy
*
proxy
,
int
index
);
static
void
load
(
UBDocumentProxy
*
proxy
,
QList
<
const
QPixmap
*>&
list
);
private
:
static
void
generateMissingThumbnails
(
UBDocumentProxy
*
proxy
);
static
QList
<
QPixmap
>
load
(
UBDocumentProxy
*
proxy
);
static
QPixmap
load
(
UBDocumentProxy
*
proxy
,
int
index
);
static
QUrl
thumbnailUrl
(
UBDocumentProxy
*
proxy
,
int
pageIndex
);
UBThumbnailAdaptor
()
{}
};
#endif // UBTHUMBNAILADAPTOR_H
src/adaptors/publishing/UBDocumentPublisher.cpp
View file @
4e884672
...
...
@@ -33,6 +33,7 @@
#include "gui/UBMainWindow.h"
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentContainer.h"
#include "domain/UBGraphicsWidgetItem.h"
...
...
@@ -57,7 +58,6 @@ THIRD_PARTY_WARNINGS_ENABLE
UBDocumentPublisher
::
UBDocumentPublisher
(
UBDocumentProxy
*
pDocument
,
QObject
*
parent
)
:
QObject
(
parent
)
,
mSourceDocument
(
pDocument
)
,
mPublishingDocument
(
0
)
,
mUsername
(
""
)
,
mPassword
(
""
)
,
bLoginCookieSet
(
false
)
...
...
@@ -69,10 +69,6 @@ UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *pa
UBDocumentPublisher
::~
UBDocumentPublisher
()
{
if
(
mPublishingDocument
){
delete
mPublishingDocument
;
mPublishingDocument
=
NULL
;
}
}
...
...
@@ -115,8 +111,8 @@ void UBDocumentPublisher::buildUbwFile()
{
QUuid
publishingUuid
=
QUuid
::
createUuid
();
mPublishing
Document
=
new
UBDocumentProxy
(
tmpDir
);
mPublishing
Document
->
setPageCount
(
mSourceDocument
->
pageCount
());
mPublishing
Path
=
tmpDir
;
mPublishing
Size
=
mSourceDocument
->
pageCount
();
rasterizeScenes
();
...
...
@@ -124,24 +120,24 @@ void UBDocumentPublisher::buildUbwFile()
UBExportFullPDF
pdfExporter
;
pdfExporter
.
setVerbode
(
false
);
pdfExporter
.
persistsDocument
(
mSourceDocument
,
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBStringUtils
::
toCanonicalUuid
(
publishingUuid
)
+
".pdf"
);
pdfExporter
.
persistsDocument
(
mSourceDocument
,
mPublishing
Path
+
"/"
+
UBStringUtils
::
toCanonicalUuid
(
publishingUuid
)
+
".pdf"
);
UBExportDocument
ubzExporter
;
ubzExporter
.
setVerbode
(
false
);
ubzExporter
.
persistsDocument
(
mSourceDocument
,
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBStringUtils
::
toCanonicalUuid
(
publishingUuid
)
+
".ubz"
);
ubzExporter
.
persistsDocument
(
mSourceDocument
,
mPublishing
Path
+
"/"
+
UBStringUtils
::
toCanonicalUuid
(
publishingUuid
)
+
".ubz"
);
// remove all useless files
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishing
Document
->
pageCount
();
pageIndex
++
)
{
QString
filename
=
mPublishing
Document
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
);
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishing
Size
;
pageIndex
++
)
{
QString
filename
=
mPublishing
Path
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
);
QFile
::
remove
(
filename
);
}
UBFileSystemUtils
::
deleteDir
(
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
imageDirectory
);
UBFileSystemUtils
::
deleteDir
(
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
objectDirectory
);
UBFileSystemUtils
::
deleteDir
(
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
videoDirectory
);
UBFileSystemUtils
::
deleteDir
(
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
audioDirectory
);
UBFileSystemUtils
::
deleteDir
(
mPublishing
Path
+
"/"
+
UBPersistenceManager
::
imageDirectory
);
UBFileSystemUtils
::
deleteDir
(
mPublishing
Path
+
"/"
+
UBPersistenceManager
::
objectDirectory
);
UBFileSystemUtils
::
deleteDir
(
mPublishing
Path
+
"/"
+
UBPersistenceManager
::
videoDirectory
);
UBFileSystemUtils
::
deleteDir
(
mPublishing
Path
+
"/"
+
UBPersistenceManager
::
audioDirectory
);
mTmpZipFile
=
UBFileSystemUtils
::
defaultTempDirPath
()
+
"/"
+
UBStringUtils
::
toCanonicalUuid
(
QUuid
::
createUuid
())
+
".ubw~"
;
...
...
@@ -156,7 +152,7 @@ void UBDocumentPublisher::buildUbwFile()
QuaZipFile
outFile
(
&
zip
);
if
(
!
UBFileSystemUtils
::
compressDirInZip
(
mPublishing
Document
->
persistencePath
(),
""
,
&
outFile
,
true
))
if
(
!
UBFileSystemUtils
::
compressDirInZip
(
mPublishing
Path
,
""
,
&
outFile
,
true
))
{
qWarning
(
"Export failed. compressDirInZip failed ..."
);
zip
.
close
();
...
...
@@ -187,13 +183,14 @@ void UBDocumentPublisher::buildUbwFile()
void
UBDocumentPublisher
::
rasterizeScenes
()
{
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishing
Document
->
pageCount
();
pageIndex
++
)
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishing
Size
;
pageIndex
++
)
{
UBApplication
::
showMessage
(
tr
(
"Converting page %1/%2 ..."
).
arg
(
UB
Application
::
boardController
->
pageFromSceneIndex
(
pageIndex
)).
arg
(
mPublishingDocument
->
pageCount
()),
true
);
UBApplication
::
showMessage
(
tr
(
"Converting page %1/%2 ..."
).
arg
(
UB
DocumentContainer
::
pageFromSceneIndex
(
pageIndex
)).
arg
(
mPublishingSize
),
true
);
UBSvgSubsetRasterizer
rasterizer
(
mPublishingDocument
,
pageIndex
);
UBDocumentProxy
publishingDocument
(
mPublishingPath
);
UBSvgSubsetRasterizer
rasterizer
(
&
publishingDocument
,
pageIndex
);
QString
filename
=
mPublishing
Document
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.jpg"
,
pageIndex
);
QString
filename
=
mPublishing
Path
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.jpg"
,
pageIndex
);
rasterizer
.
rasterizeToFile
(
filename
);
...
...
@@ -203,7 +200,7 @@ void UBDocumentPublisher::rasterizeScenes()
void
UBDocumentPublisher
::
updateGoogleMapApiKey
()
{
QDir
widgestDir
(
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
widgetDirectory
);
QDir
widgestDir
(
mPublishing
Path
+
"/"
+
UBPersistenceManager
::
widgetDirectory
);
QString
uniboardWebGoogleMapApiKey
=
UBSettings
::
settings
()
->
uniboardWebGoogleMapApiKey
->
get
().
toString
();
...
...
@@ -242,9 +239,10 @@ void UBDocumentPublisher::updateGoogleMapApiKey()
void
UBDocumentPublisher
::
upgradeDocumentForPublishing
()
{
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishing
Document
->
pageCount
();
pageIndex
++
)
for
(
int
pageIndex
=
0
;
pageIndex
<
mPublishing
Size
;
pageIndex
++
)
{
UBGraphicsScene
*
scene
=
UBSvgSubsetAdaptor
::
loadScene
(
mPublishingDocument
,
pageIndex
);
UBDocumentProxy
publishingDocument
(
mPublishingPath
);
UBGraphicsScene
*
scene
=
UBSvgSubsetAdaptor
::
loadScene
(
&
publishingDocument
,
pageIndex
);
QList
<
UBGraphicsW3CWidgetItem
*>
widgets
;
...
...
@@ -252,12 +250,12 @@ void UBDocumentPublisher::upgradeDocumentForPublishing()
UBGraphicsW3CWidgetItem
*
widgetItem
=
dynamic_cast
<
UBGraphicsW3CWidgetItem
*>
(
item
);
if
(
widgetItem
){
generateWidgetPropertyScript
(
widgetItem
,
UB
Application
::
boardController
->
pageFromSceneIndex
(
pageIndex
));
generateWidgetPropertyScript
(
widgetItem
,
UB
DocumentContainer
::
pageFromSceneIndex
(
pageIndex
));
widgets
<<
widgetItem
;
}
}
QString
filename
=
mPublishing
Document
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.json"
,
pageIndex
);
QString
filename
=
mPublishing
Path
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.json"
,
pageIndex
);
QFile
jsonFile
(
filename
);
if
(
jsonFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
...
...
@@ -369,7 +367,7 @@ void UBDocumentPublisher::generateWidgetPropertyScript(UBGraphicsW3CWidgetItem *
if
(
!
startFileName
.
startsWith
(
"http://"
))
{
QString
startFilePath
=
mPublishing
Document
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
widgetDirectory
+
"/"
+
widgetItem
->
uuid
().
toString
()
+
".wgt/"
+
startFileName
;
QString
startFilePath
=
mPublishing
Path
+
"/"
+
UBPersistenceManager
::
widgetDirectory
+
"/"
+
widgetItem
->
uuid
().
toString
()
+
".wgt/"
+
startFileName
;
QFile
startFile
(
startFilePath
);
...
...
@@ -434,7 +432,7 @@ void UBDocumentPublisher::generateWidgetPropertyScript(UBGraphicsW3CWidgetItem *
lines
<<
" widget.preferences.clear = function() {}"
;
lines
<<
" var uniboard = {};"
;
lines
<<
" uniboard.pageCount = "
+
QString
(
"%1"
).
arg
(
mPublishing
Document
->
pageCount
())
+
";"
;
lines
<<
" uniboard.pageCount = "
+
QString
(
"%1"
).
arg
(
mPublishing
Size
)
+
";"
;
lines
<<
" uniboard.currentPageNumber = "
+
QString
(
"%1"
).
arg
(
pageNumber
)
+
";"
;
lines
<<
" uniboard.uuid = '"
+
UBStringUtils
::
toCanonicalUuid
(
widgetItem
->
uuid
())
+
"'"
;
lines
<<
" uniboard.lang = navigator.language;"
;
...
...
src/adaptors/publishing/UBDocumentPublisher.h
View file @
4e884672
...
...
@@ -106,7 +106,12 @@ private slots:
private
:
UBDocumentProxy
*
mSourceDocument
;
UBDocumentProxy
*
mPublishingDocument
;
//UBDocumentProxy *mPublishingDocument;
QString
mPublishingPath
;
int
mPublishingSize
;
void
init
();
void
sendUbw
(
QString
username
,
QString
password
);
QString
getBase64Of
(
QString
stringToEncode
);
...
...
src/api/UBWidgetUniboardAPI.cpp
View file @
4e884672
...
...
@@ -346,7 +346,7 @@ QString UBWidgetUniboardAPI::pageThumbnail(const int pageNumber)
if
(
UBApplication
::
boardController
->
activeScene
()
!=
mScene
)
return
""
;
UBDocumentProxy
*
doc
=
UBApplication
::
boardController
->
active
Document
();
UBDocumentProxy
*
doc
=
UBApplication
::
boardController
->
selected
Document
();
if
(
!
doc
)
return
""
;
...
...
src/board/UBBoardController.cpp
View file @
4e884672
This diff is collapsed.
Click to expand it.
src/board/UBBoardController.h
View file @
4e884672
...
...
@@ -19,6 +19,7 @@
#include <QtGui>
#include <QObject>
#include "document/UBDocumentContainer.h"
class
UBMainWindow
;
class
UBApplication
;
...
...
@@ -40,7 +41,7 @@ class UBGraphicsWidgetItem;
class
UBBoardPaletteManager
;
class
UBBoardController
:
public
QObject
class
UBBoardController
:
public
UBDocumentContainer
{
Q_OBJECT
...
...
@@ -50,7 +51,7 @@ class UBBoardController : public QObject
void
init
();
void
setupLayout
();
UBDocumentProxy
*
activeDocument
()
const
;
UBGraphicsScene
*
activeScene
()
const
;
int
activeSceneIndex
()
const
;
QSize
displayViewport
();
...
...
@@ -60,14 +61,6 @@ class UBBoardController : public QObject
int
currentPage
();
int
pageFromSceneIndex
(
int
sceneIndex
);
int
sceneIndexFromPage
(
int
page
);
UBDocumentProxy
*
activeDocument
()
{
return
mActiveDocument
;
}
QWidget
*
controlContainer
()
{
return
mControlContainer
;
...
...
@@ -158,10 +151,17 @@ class UBBoardController : public QObject
void
displayMetaData
(
QMap
<
QString
,
QString
>
metadatas
);
void
ClearUndoStack
();
void
emitScrollSignal
()
{
emit
scrollToSelectedPage
();
}
void
setActiveDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
int
pSceneIndex
=
0
,
bool
forceReload
=
false
);
void
setActiveDocumentScene
(
int
pSceneIndex
);
void
moveSceneToIndex
(
int
source
,
int
target
);
void
duplicateScene
(
int
index
);
void
deleteScene
(
int
index
);
bool
cacheIsVisible
()
{
return
mCacheWidgetIsEnabled
;}
public
slots
:
void
setActiveDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
int
pSceneIndex
=
0
);
void
showDocumentsDialog
();
void
showKeyboard
(
bool
show
);
void
togglePodcast
(
bool
checked
);
...
...
@@ -222,14 +222,12 @@ class UBBoardController : public QObject
void
freezeW3CWidget
(
QGraphicsItem
*
item
,
bool
freeze
);
void
startScript
();
void
stopScript
();
bool
cacheIsVisible
();
signals
:
void
newPageAdded
();
void
activeSceneWillBePersisted
();
void
activeSceneWillChange
();
void
activeSceneChanged
();
void
activeDocumentChanged
();
void
zoomChanged
(
qreal
pZoomFactor
);
void
systemScaleFactorChanged
(
qreal
pSystemScaleFactor
);
void
penColorChanged
();
...
...
@@ -238,10 +236,9 @@ class UBBoardController : public QObject
void
cacheEnabled
();
void
cacheDisabled
();
void
pageChanged
();
void
setDocOnPageNavigator
(
UBDocumentProxy
*
doc
);
void
documentReorganized
(
int
index
);
void
displayMetadata
(
QMap
<
QString
,
QString
>
metadata
);
void
scrollToSelectedPage
(
);
void
pageSelectionChanged
(
int
index
);
protected
:
void
setupViews
();
...
...
@@ -263,7 +260,6 @@ class UBBoardController : public QObject
void
adjustDisplayViews
();
UBMainWindow
*
mMainWindow
;
UBDocumentProxy
*
mActiveDocument
;
UBGraphicsScene
*
mActiveScene
;
int
mActiveSceneIndex
;
UBBoardPaletteManager
*
mPaletteManager
;
...
...
src/board/UBBoardPaletteManager.cpp
View file @
4e884672
...
...
@@ -134,8 +134,6 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
//------------------------------------------------//
// Create the widgets for the dock palettes
mpPageNavigWidget
=
new
UBPageNavigationWidget
();
#ifdef USE_WEB_WIDGET
mpLibWidget
=
new
UBLibWidget
();
#endif
...
...
@@ -352,7 +350,7 @@ void UBBoardPaletteManager::pagePaletteButtonReleased()
QList
<
QAction
*>
pageActions
;
pageActions
<<
UBApplication
::
mainWindow
->
actionNewPage
;
UBBoardController
*
boardController
=
UBApplication
::
boardController
;
if
(
UBApplication
::
documentController
->
pageCanBeDuplicated
(
boardController
->
pageFromSceneIndex
(
boardController
->
activeSceneIndex
())))
if
(
UBApplication
::
documentController
->
pageCanBeDuplicated
(
UBDocumentContainer
::
pageFromSceneIndex
(
boardController
->
activeSceneIndex
())))
pageActions
<<
UBApplication
::
mainWindow
->
actionDuplicatePage
;
pageActions
<<
UBApplication
::
mainWindow
->
actionImportPage
;
...
...
@@ -568,7 +566,7 @@ void UBBoardPaletteManager::activeSceneChanged()
if
(
mpPageNavigWidget
)
{
mpPageNavigWidget
->
setPageNumber
(
UB
Application
::
boardController
->
pageFromSceneIndex
(
pageIndex
),
activeScene
->
document
()
->
pageCount
());
mpPageNavigWidget
->
setPageNumber
(
UB
DocumentContainer
::
pageFromSceneIndex
(
pageIndex
),
activeScene
->
document
()
->
pageCount
());
}
if
(
mZoomPalette
)
...
...
src/board/UBLibraryController.cpp
View file @
4e884672
...
...
@@ -562,7 +562,7 @@ void UBLibraryController::removeBackground()
UBGraphicsScene
*
UBLibraryController
::
activeScene
()
{
if
(
mBoardController
->
active
Document
())
if
(
mBoardController
->
selected
Document
())
return
mBoardController
->
activeScene
();
return
0
;
...
...
src/core/UBApplication.cpp
View file @
4e884672
...
...
@@ -317,8 +317,6 @@ int UBApplication::exec(const QString& pFileToImport)
connect
(
mainWindow
->
actionHideApplication
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showMinimized
()));
#endif
connect
(
documentController
,
SIGNAL
(
movedToIndex
(
int
)),
boardController
,
SIGNAL
(
documentReorganized
(
int
)));
mPreferencesController
=
new
UBPreferencesController
(
mainWindow
);
connect
(
mainWindow
->
actionPreferences
,
SIGNAL
(
triggered
()),
mPreferencesController
,
SLOT
(
show
()));
...
...
src/core/UBApplicationController.cpp
View file @
4e884672
...
...
@@ -340,8 +340,7 @@ void UBApplicationController::showBoard()
int
selectedSceneIndex
=
UBApplication
::
documentController
->
getSelectedItemIndex
();
if
(
selectedSceneIndex
!=
-
1
)
{
UBApplication
::
boardController
->
setActiveDocumentScene
(
UBApplication
::
documentController
->
getCurrentDocument
(),
selectedSceneIndex
);
UBApplication
::
boardController
->
emitScrollSignal
();
UBApplication
::
boardController
->
setActiveDocumentScene
(
UBApplication
::
documentController
->
selectedDocument
(),
selectedSceneIndex
,
true
);
}
}
...
...
src/core/UBPersistenceManager.cpp
View file @
4e884672
...
...
@@ -608,10 +608,10 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
if
(
pScene
->
isModified
())
{
UBThumbnailAdaptor
::
persistScene
(
pDocumentProxy
->
persistencePath
(),
pScene
,
pSceneIndex
);
UBSvgSubsetAdaptor
::
persistScene
(
pDocumentProxy
,
pScene
,
pSceneIndex
);
UBThumbnailAdaptor
::
persistScene
(
pDocumentProxy
,
pScene
,
pSceneIndex
);
pScene
->
setModified
(
false
);
}
...
...
src/document/UBDocumentContainer.cpp
0 → 100644
View file @
4e884672
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBDocumentContainer.h"
#include "adaptors/UBThumbnailAdaptor.h"
#include "core/UBPersistenceManager.h"
#include "core/memcheck.h"
UBDocumentContainer
::
UBDocumentContainer
(
QObject
*
parent
)
:
QObject
(
parent
)
,
mCurrentDocument
(
NULL
)
{}
UBDocumentContainer
::~
UBDocumentContainer
()
{
foreach
(
const
QPixmap
*
pm
,
mDocumentThumbs
)
delete
pm
;
}
void
UBDocumentContainer
::
setDocument
(
UBDocumentProxy
*
document
,
bool
forceReload
)
{
if
(
mCurrentDocument
!=
document
||
forceReload
)
{
mCurrentDocument
=
document
;
reloadThumbnails
();
emit
documentSet
(
mCurrentDocument
);
}
}
void
UBDocumentContainer
::
duplicatePages
(
QList
<
int
>&
pageIndexes
)
{
int
offset
=
0
;
foreach
(
int
sceneIndex
,
pageIndexes
)
{
UBPersistenceManager
::
persistenceManager
()
->
duplicateDocumentScene
(
mCurrentDocument
,
sceneIndex
+
offset
);
insertThumbPage
(
sceneIndex
+
offset
);
offset
++
;
}
emit
documentThumbnailsUpdated
(
this
);
}
void
UBDocumentContainer
::
movePageToIndex
(
int
source
,
int
target
)
{
UBPersistenceManager
::
persistenceManager
()
->
moveSceneToIndex
(
mCurrentDocument
,
source
,
target
);
deleteThumbPage
(
source
);
insertThumbPage
(
target
);
emit
documentThumbnailsUpdated
(
this
);
}
void
UBDocumentContainer
::
deletePages
(
QList
<
int
>&
pageIndexes
)
{
UBPersistenceManager
::
persistenceManager
()
->
deleteDocumentScenes
(
mCurrentDocument
,
pageIndexes
);
int
offset
=
0
;
foreach
(
int
index
,
pageIndexes
)
{
deleteThumbPage
(
index
-
offset
);
offset
++
;
}
emit
documentThumbnailsUpdated
(
this
);
}
void
UBDocumentContainer
::
addPage
(
int
index
)
{
UBPersistenceManager
::
persistenceManager
()
->
createDocumentSceneAt
(
mCurrentDocument
,
index
);
insertThumbPage
(
index
);
emit
documentThumbnailsUpdated
(
this
);
}
void
UBDocumentContainer
::
updatePage
(
int
index
)
{
updateThumbPage
(
index
);
emit
documentThumbnailsUpdated
(
this
);
}
void
UBDocumentContainer
::
deleteThumbPage
(
int
index
)
{
mDocumentThumbs
.
removeAt
(
index
);
emit
documentPageDeleted
(
index
);
}
void
UBDocumentContainer
::
updateThumbPage
(
int
index
)
{
mDocumentThumbs
[
index
]
=
UBThumbnailAdaptor
::
get
(
mCurrentDocument
,
index
);
emit
documentPageUpdated
(
index
);
}
void
UBDocumentContainer
::
insertThumbPage
(
int
index
)
{
mDocumentThumbs
.
insert
(
index
,
UBThumbnailAdaptor
::
get
(
mCurrentDocument
,
index
));
emit
documentPageAdded
(
index
);
}
void
UBDocumentContainer
::
reloadThumbnails
()
{
if
(
mCurrentDocument
)
{
UBThumbnailAdaptor
::
load
(
mCurrentDocument
,
mDocumentThumbs
);
emit
documentThumbnailsUpdated
(
this
);
}
}
int
UBDocumentContainer
::
pageFromSceneIndex
(
int
sceneIndex
)
{
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
return
sceneIndex
;
return
sceneIndex
+
1
;
}
int
UBDocumentContainer
::
sceneIndexFromPage
(
int
page
)
{
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
return
page
;
return
page
-
1
;
}
src/document/UBDocumentContainer.h
0 → 100644
View file @
4e884672
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBDOCUMENTCONTAINER_H_
#define UBDOCUMENTCONTAINER_H_
#include <QtGui>
#include "UBDocumentProxy.h"
class
UBDocumentContainer
:
public
QObject
{
Q_OBJECT
public
:
UBDocumentContainer
(
QObject
*
parent
=
0
);
virtual
~
UBDocumentContainer
();
void
setDocument
(
UBDocumentProxy
*
document
,
bool
forceReload
=
false
);
UBDocumentProxy
*
selectedDocument
(){
return
mCurrentDocument
;}
int
pageCount
(){
return
mDocumentThumbs
.
size
();}
const
QPixmap
*
pageAt
(
int
index
){
return
mDocumentThumbs
[
index
];}
static
int
pageFromSceneIndex
(
int
sceneIndex
);
static
int
sceneIndexFromPage
(
int
sceneIndex
);
void
duplicatePages
(
QList
<
int
>&
pageIndexes
);
void
movePageToIndex
(
int
source
,
int
target
);
void
deletePages
(
QList
<
int
>&
pageIndexes
);
void
addPage
(
int
index
);
void
updatePage
(
int
index
);
private
:
void
deleteThumbPage
(
int
index
);
void
updateThumbPage
(
int
index
);
void
insertThumbPage
(
int
index
);
UBDocumentProxy
*
mCurrentDocument
;
QList
<
const
QPixmap
*>
mDocumentThumbs
;
protected
:
void
reloadThumbnails
();
signals
:
void
documentSet
(
UBDocumentProxy
*
document
);
void
documentPageAdded
(
int
index
);
void
documentPageDeleted
(
int
index
);
void
documentPageUpdated
(
int
index
);
void
documentThumbnailsUpdated
(
UBDocumentContainer
*
source
);
};
#endif
/* UBDOCUMENTPROXY_H_ */
src/document/UBDocumentController.cpp
View file @
4e884672
This diff is collapsed.
Click to expand it.
src/document/UBDocumentController.h
View file @
4e884672
...
...
@@ -17,6 +17,7 @@
#define UBDOCUMENTCONTROLLER_H_
#include <QtGui>
#include "document/UBDocumentContainer.h"
namespace
Ui
{
...
...
@@ -35,7 +36,7 @@ class UBDocumentProxyTreeItem;
class
UBMainWindow
;
class
UBDocumentToolsPalette
;
class
UBDocumentController
:
public
QObject
class
UBDocumentController
:
public
UBDocumentContainer
{
Q_OBJECT
;
...
...
@@ -47,7 +48,6 @@ class UBDocumentController : public QObject
QWidget
*
controlView
();
UBDocumentProxyTreeItem
*
findDocument
(
UBDocumentProxy
*
proxy
);
bool
addFileToDocument
(
UBDocumentProxy
*
document
);
UBDocumentProxy
*
getCurrentDocument
()
{
return
mCurrentDocument
;
};
void
deletePages
(
QList
<
QGraphicsItem
*>
itemsToDelete
);
int
getSelectedItemIndex
();
...
...
@@ -57,9 +57,9 @@ class UBDocumentController : public QObject
bool
pageCanBeDeleted
(
int
page
);
signals
:
void
refreshThumbnails
();
//void refreshThumbnails();
void
exportDone
();
void
movedToIndex
(
int
index
);
//void movedToIndex(int index);
public
slots
:
void
createNewDocument
();
...
...
@@ -80,14 +80,13 @@ class UBDocumentController : public QObject
void
copy
();
void
paste
();
void
focusChanged
(
QWidget
*
old
,
QWidget
*
current
);
void
reloadThumbs
();
//void reloadThumbs();
protected
:
virtual
void
setupViews
();
virtual
void
setupToolbar
();
void
setupPalettes
();
bool
isOKToOpenDocument
(
UBDocumentProxy
*
proxy
);
UBGraphicsScene
*
activeScene
();
UBDocumentProxy
*
selectedDocumentProxy
();
UBDocumentProxyTreeItem
*
selectedDocumentProxyTreeItem
();
UBDocumentGroupTreeItem
*
selectedDocumentGroupTreeItem
();
...
...
@@ -114,14 +113,11 @@ class UBDocumentController : public QObject
UBDocumentToolsPalette
*
mToolsPalette
;
bool
mToolsPalettePositionned
;
UBDocumentGroupTreeItem
*
mTrashTi
;
UBDocumentProxy
*
mCurrentDocument
;
QList
<
QPixmap
>
mDocumentThumbs
;
private
slots
:
void
documentZoomSliderValueChanged
(
int
value
);
void
loadDocumentProxies
();
void
itemSelectionChanged
();
void
refreshDocumentThumbnailsView
();
void
exportDocument
();
void
itemChanged
(
QTreeWidgetItem
*
item
,
int
column
);
void
thumbnailViewResized
();
...
...
@@ -138,6 +134,7 @@ class UBDocumentController : public QObject
void
addFileToDocument
();
void
addImages
();
void
refreshDocumentThumbnailsView
(
UBDocumentContainer
*
source
);
};
...
...
src/document/UBDocumentProxy.cpp
View file @
4e884672
src/document/UBDocumentProxy.h
View file @
4e884672
...
...
@@ -26,7 +26,9 @@ class UBGraphicsScene;
class
UBDocumentProxy
:
public
QObject
{
Q_OBJECT
;
Q_OBJECT
friend
class
UBPersistenceManager
;
public
:
...
...
@@ -60,6 +62,8 @@ class UBDocumentProxy : public QObject
bool
isModified
()
const
;
int
pageCount
();
protected
:
void
setPageCount
(
int
pPageCount
);
int
incPageCount
();
int
decPageCount
();
...
...
src/document/document.pri
View file @
4e884672
HEADERS += src/document/UBDocumentController.h \
src/document/UBDocumentContainer.h \
src/document/UBDocumentProxy.h
SOURCES += src/document/UBDocumentController.cpp \
src/document/UBDocumentContainer.cpp \
src/document/UBDocumentProxy.cpp
\ No newline at end of file
src/domain/UBGraphicsMediaItem.cpp
View file @
4e884672
...
...
@@ -142,8 +142,8 @@ void UBGraphicsMediaItem::clearSource()
{
QString
path
=
mediaFileUrl
().
toLocalFile
();
//if path is absolute clean duplicated path string
if
(
!
path
.
contains
(
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()))
path
=
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()
+
"/"
+
path
;
if
(
!
path
.
contains
(
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()))
path
=
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()
+
"/"
+
path
;
if
(
!
UBFileSystemUtils
::
deleteFile
(
path
))
qDebug
()
<<
"cannot delete file: "
<<
path
;
...
...
src/frameworks/UBFileSystemUtils.cpp
View file @
4e884672
...
...
@@ -20,6 +20,7 @@
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "document/UBDocumentContainer.h"
#include "globals/UBGlobals.h"
...
...
@@ -334,7 +335,7 @@ QString UBFileSystemUtils::normalizeFilePath(const QString& pFilePath)
QString
UBFileSystemUtils
::
digitFileFormat
(
const
QString
&
s
,
int
digit
)
{
int
pageDigit
=
UB
Application
::
boardController
->
pageFromSceneIndex
(
digit
);
int
pageDigit
=
UB
DocumentContainer
::
pageFromSceneIndex
(
digit
);
return
s
.
arg
(
pageDigit
,
3
,
10
,
QLatin1Char
(
'0'
));
}
...
...
src/gui/UBDocumentNavigator.cpp
View file @
4e884672
This diff is collapsed.
Click to expand it.
src/gui/UBDocumentNavigator.h
View file @
4e884672
...
...
@@ -22,6 +22,7 @@
#include <QThread>
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentContainer.h"
#include "UBThumbnailWidget.h"
#define NO_PAGESELECTED -1
...
...
@@ -33,42 +34,31 @@ public:
UBDocumentNavigator
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"documentNavigator"
);
~
UBDocumentNavigator
();
void
setDocument
(
UBDocumentProxy
*
document
);
void
setNbColumns
(
int
nbColumns
);
int
nbColumns
();
void
setThumbnailMinWidth
(
int
width
);
int
thumbnailMinWidth
();
int
selectedPageNumber
();
UBDocumentProxy
*
currentDoc
();
signals
:
void
changeCurrentPage
();
public
slots
:
void
onMovedToIndex
(
int
index
);
void
onScrollToSelectedPage
()
{
centerOn
(
mCrntItem
);
}
void
onScrollToSelectedPage
(
int
index
);
// { if (mCrntItem) centerOn(mCrntItem); }
void
generateThumbnails
(
UBDocumentContainer
*
source
);
void
updateSpecificThumbnail
(
int
iPage
);
protected
:
virtual
void
resizeEvent
(
QResizeEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
private
slots
:
void
addNewPage
();
void
onSelectionChanged
();
void
generateThumbnails
();
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
private
:
void
refreshScene
();
void
updateSpecificThumbnail
(
int
iPage
);
int
border
();
/** The scene */
QGraphicsScene
*
mScene
;
/** The current selected item */
UBSceneThumbnailNavigPixmap
*
mCrntItem
;
/** The current document */
UBDocumentProxy
*
mCrntDoc
;
//UBSceneThumbnailNavigPixmap* mCrntItem;
/** The list of current thumbnails with labels*/
QList
<
UBImgTextThumbnailElement
>
mThumbsWithLabels
;
/** The current number of columns */
...
...
@@ -77,8 +67,6 @@ private:
int
mThumbnailWidth
;
/** The current thumbnails minimum width */
int
mThumbnailMinWidth
;
/** A flag indicating that a thumbnail refresh is in progress */
bool
bNavig
;
};
#endif // UBDOCUMENTNAVIGATOR_H
src/gui/UBDocumentThumbnailWidget.cpp
View file @
4e884672
...
...
@@ -68,7 +68,7 @@ void UBDocumentThumbnailWidget::mouseMoveEvent(QMouseEvent *event)
if
(
sceneItem
)
{
int
pageIndex
=
UB
Application
::
boardController
->
pageFromSceneIndex
(
sceneItem
->
sceneIndex
());
int
pageIndex
=
UB
DocumentContainer
::
pageFromSceneIndex
(
sceneItem
->
sceneIndex
());
if
(
pageIndex
!=
0
){
QDrag
*
drag
=
new
QDrag
(
this
);
QList
<
UBMimeDataItem
>
mimeDataItems
;
...
...
@@ -153,7 +153,7 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
int
pageIndex
=
-
1
;
if
(
mClosestDropItem
){
pageIndex
=
UB
Application
::
boardController
->
pageFromSceneIndex
(
mClosestDropItem
->
sceneIndex
());
pageIndex
=
UB
DocumentContainer
::
pageFromSceneIndex
(
mClosestDropItem
->
sceneIndex
());
if
(
pageIndex
==
0
){
event
->
acceptProposedAction
();
return
;
...
...
@@ -173,7 +173,7 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
{
mClosestDropItem
=
item
;
minDistance
=
distance
;
pageIndex
=
UB
Application
::
boardController
->
pageFromSceneIndex
(
mClosestDropItem
->
sceneIndex
());
pageIndex
=
UB
DocumentContainer
::
pageFromSceneIndex
(
mClosestDropItem
->
sceneIndex
());
}
}
}
...
...
@@ -221,7 +221,7 @@ void UBDocumentThumbnailWidget::dropEvent(QDropEvent *event)
if
(
mClosestDropItem
)
{
int
targetIndex
=
mDropIsRight
?
mGraphicItems
.
indexOf
(
mClosestDropItem
)
+
1
:
mGraphicItems
.
indexOf
(
mClosestDropItem
);
if
(
UB
Application
::
boardController
->
pageFromSceneIndex
(
targetIndex
)
==
0
){
if
(
UB
DocumentContainer
::
pageFromSceneIndex
(
targetIndex
)
==
0
){
event
->
ignore
();
return
;
}
...
...
@@ -279,7 +279,6 @@ void UBDocumentThumbnailWidget::deleteDropCaret()
}
}
void
UBDocumentThumbnailWidget
::
setGraphicsItems
(
const
QList
<
QGraphicsItem
*>&
pGraphicsItems
,
const
QList
<
QUrl
>&
pItemPaths
,
const
QStringList
pLabels
,
const
QString
&
pMimeType
)
...
...
src/gui/UBDocumentTreeWidget.cpp
View file @
4e884672
...
...
@@ -200,7 +200,9 @@ void UBDocumentTreeWidget::focusInEvent(QFocusEvent *event)
{
Q_UNUSED
(
event
);
itemSelectionChanged
();
// Tolik
//itemSelectionChanged();
QTreeWidget
::
focusInEvent
(
event
);
}
...
...
src/gui/UBNavigatorPalette.cpp
View file @
4e884672
...
...
@@ -63,7 +63,6 @@ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):
mTimeFormat
=
mTimeFormat
.
remove
(
":s"
);
mTimerID
=
startTimer
(
1000
);
connect
(
mNavigator
,
SIGNAL
(
changeCurrentPage
()),
this
,
SLOT
(
changeCurrentPage
()));
}
/**
...
...
@@ -104,34 +103,12 @@ UBNavigatorPalette::~UBNavigatorPalette()
* \brief Set the current document in the navigator
* @param document as the given document
*/
void
UBNavigatorPalette
::
setDocument
(
UBDocumentProxy
*
document
)
{
if
(
mNavigator
->
currentDoc
()
!=
document
)
{
mNavigator
->
setDocument
(
document
);
}
}
/**
* \brief Change the current page
*/
void
UBNavigatorPalette
::
changeCurrentPage
()
{
// Get the index of the page to display
int
iPage
=
mNavigator
->
selectedPageNumber
();
if
(
NO_PAGESELECTED
!=
iPage
)
{
// Display the selected page
UBApplication
::
boardController
->
setActiveDocumentScene
(
mNavigator
->
currentDoc
(),
iPage
);
}
}
/**
* \brief Refresh the thumbnails widget
*/
void
UBNavigatorPalette
::
refresh
()
{
mNavigator
->
setDocument
(
UBApplication
::
boardController
->
activeDocument
());
}
/**
...
...
src/gui/UBNavigatorPalette.h
View file @
4e884672
...
...
@@ -58,8 +58,6 @@ private:
QString
mTimeFormat
;
int
mTimerID
;
private
slots
:
void
changeCurrentPage
();
};
...
...
src/gui/UBPageNavigationWidget.cpp
View file @
4e884672
...
...
@@ -17,6 +17,8 @@
#include "board/UBBoardController.h"
#include "document/UBDocumentContainer.h"
#include "globals/UBGlobals.h"
#include "core/memcheck.h"
...
...
@@ -72,8 +74,8 @@ UBPageNavigationWidget::UBPageNavigationWidget(QWidget *parent, const char *name
mTimeFormat
=
mTimeFormat
.
remove
(
":s"
);
mTimerID
=
startTimer
(
1000
);
connect
(
mNavigator
,
SIGNAL
(
changeCurrentPage
()),
this
,
SLOT
(
changeCurrentPage
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
setDocOnPageNavigator
(
UBDocumentProxy
*
)),
this
,
SLOT
(
onSetDocOnPageNavigator
(
UBDocumentProxy
*
)));
//connect(mNavigator, SIGNAL(changeCurrentPage()), this, SLOT(changeCurrentPage()));
//connect(UBApplication::boardController, SIGNAL(setDocOnPageNavigator(UBDocumentProxy*)), this, SLOT(onSetDocOnPageNavigator(UBDocumentProxy*)));
}
/**
...
...
@@ -110,41 +112,14 @@ UBPageNavigationWidget::~UBPageNavigationWidget()
}
}
/**
* \brief Set the current document in the navigator
* @param document as the given document
*/
void
UBPageNavigationWidget
::
setDocument
(
UBDocumentProxy
*
document
)
{
if
(
mNavigator
->
currentDoc
()
!=
document
)
{
mNavigator
->
setDocument
(
document
);
}
}
/**
* \brief Change the current page
*/
void
UBPageNavigationWidget
::
changeCurrentPage
()
{
// Get the index of the page to display
int
iPage
=
mNavigator
->
selectedPageNumber
();
if
(
NO_PAGESELECTED
!=
iPage
)
{
// Display the selected page
UBApplication
::
boardController
->
setActiveDocumentScene
(
mNavigator
->
currentDoc
(),
iPage
);
// emit here the signal to indicate that page change
UBApplication
::
boardController
->
notifyPageChanged
();
}
}
/**
* \brief Refresh the thumbnails widget
*/
void
UBPageNavigationWidget
::
refresh
()
{
mNavigator
->
setDocument
(
UBApplication
::
boardController
->
activeDocument
());
// TOLIK!!!
// mNavigator->setDocument(UBApplication::boardController->activeDocument());
}
/**
...
...
@@ -175,7 +150,7 @@ void UBPageNavigationWidget::updateTime()
*/
void
UBPageNavigationWidget
::
setPageNumber
(
int
current
,
int
total
)
{
mPageNbr
->
setText
(
QString
(
"%1 / %2"
).
arg
(
current
).
arg
(
UB
Application
::
boardController
->
sceneIndexFromPage
(
total
)));
mPageNbr
->
setText
(
QString
(
"%1 / %2"
).
arg
(
current
).
arg
(
UB
DocumentContainer
::
sceneIndexFromPage
(
total
)));
}
/**
...
...
@@ -196,11 +171,3 @@ int UBPageNavigationWidget::border()
return
15
;
}
/**
* \brief Set the current document
* @param doc as the current document
*/
void
UBPageNavigationWidget
::
onSetDocOnPageNavigator
(
UBDocumentProxy
*
doc
)
{
setDocument
(
doc
);
}
src/gui/UBPageNavigationWidget.h
View file @
4e884672
...
...
@@ -33,7 +33,7 @@ class UBPageNavigationWidget : public UBDockPaletteWidget
public
:
UBPageNavigationWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBPageNavigationWidget"
);
~
UBPageNavigationWidget
();
void
setDocument
(
UBDocumentProxy
*
document
);
//void setDocument(UBDocumentProxy* document);
void
refresh
();
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
...
...
@@ -50,8 +50,6 @@ public slots:
protected
:
virtual
void
timerEvent
(
QTimerEvent
*
event
);
private
slots
:
void
onSetDocOnPageNavigator
(
UBDocumentProxy
*
doc
);
private
:
void
updateTime
();
...
...
@@ -68,8 +66,6 @@ private:
QString
mTimeFormat
;
int
mTimerID
;
private
slots
:
void
changeCurrentPage
();
};
#endif // UBPAGENAVIGATIONWIDGET_H
src/gui/UBTeacherGuideWidget.cpp
View file @
4e884672
...
...
@@ -245,7 +245,7 @@ void UBTeacherGuideEditionWidget::onActiveSceneChanged()
cleanData
();
load
(
UBSvgSubsetAdaptor
::
readTeacherGuideNode
(
UBApplication
::
boardController
->
activeSceneIndex
()));
mpPageNumberLabel
->
setText
(
tr
(
"Page: %0"
).
arg
(
currentPage
));
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
active
Document
();
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
selected
Document
();
if
(
mpDocumentTitle
)
mpDocumentTitle
->
setText
(
documentProxy
->
metaData
(
UBSettings
::
sessionTitle
).
toString
());
}
...
...
@@ -483,7 +483,7 @@ void UBTeacherGuidePresentationWidget::onActiveSceneChanged()
{
cleanData
();
mpPageNumberLabel
->
setText
(
tr
(
"Page: %0"
).
arg
(
UBApplication
::
boardController
->
currentPage
()));
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
active
Document
();
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
selected
Document
();
if
(
mpDocumentTitle
)
mpDocumentTitle
->
setText
(
documentProxy
->
metaData
(
UBSettings
::
sessionTitle
).
toString
());
}
...
...
@@ -535,9 +535,9 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
newWidgetItem
->
setData
(
0
,
Qt
::
FontRole
,
QVariant
(
QFont
(
QApplication
::
font
().
family
(),
11
)));
QString
mimeTypeString
;
#ifdef Q_WS_WIN
mimeTypeString
=
QUrl
::
fromLocalFile
(
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()
+
"/"
+
element
->
attributes
.
value
(
"relativePath"
)).
toString
();
mimeTypeString
=
QUrl
::
fromLocalFile
(
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()
+
"/"
+
element
->
attributes
.
value
(
"relativePath"
)).
toString
();
#else
mimeTypeString
=
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()
+
"/"
+
element
->
attributes
.
value
(
"relativePath"
);
mimeTypeString
=
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()
+
"/"
+
element
->
attributes
.
value
(
"relativePath"
);
#endif
newWidgetItem
->
setData
(
0
,
TG_USER_ROLE_MIME_TYPE
,
mimeTypeString
);
newWidgetItem
->
setFlags
(
Qt
::
ItemIsDragEnabled
|
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
);
...
...
@@ -882,7 +882,7 @@ void UBTeacherGuidePageZeroWidget::onSchoolLevelChanged(QString schoolLevel)
void
UBTeacherGuidePageZeroWidget
::
onActiveSceneChanged
()
{
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
active
Document
();
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
selected
Document
();
if
(
documentProxy
&&
UBApplication
::
boardController
->
currentPage
()
==
0
){
QDateTime
creationDate
=
documentProxy
->
documentDate
();
mpCreationLabel
->
setText
(
tr
(
"Created the:
\n
"
)
+
creationDate
.
toString
(
Qt
::
DefaultLocaleShortDate
));
...
...
@@ -901,7 +901,7 @@ void UBTeacherGuidePageZeroWidget::hideEvent ( QHideEvent * event )
void
UBTeacherGuidePageZeroWidget
::
loadData
()
{
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
active
Document
();
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
selected
Document
();
mpSessionTitle
->
setText
(
documentProxy
->
metaData
(
UBSettings
::
sessionTitle
).
toString
());
mpAuthors
->
setText
(
documentProxy
->
metaData
(
UBSettings
::
sessionAuthors
).
toString
());
mpObjectives
->
setText
(
documentProxy
->
metaData
(
UBSettings
::
sessionObjectives
).
toString
());
...
...
@@ -925,7 +925,7 @@ 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
->
active
Document
();
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
selected
Document
();
documentProxy
->
setMetaData
(
UBSettings
::
sessionTitle
,
mpSessionTitle
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionAuthors
,
mpAuthors
->
text
());
documentProxy
->
setMetaData
(
UBSettings
::
sessionObjectives
,
mpObjectives
->
text
());
...
...
src/gui/UBTeacherGuideWidgetsTools.cpp
View file @
4e884672
...
...
@@ -316,7 +316,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
,
mIsInitializationMode
(
false
)
{
setObjectName
(
name
);
mMediaPath
=
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()
+
"/"
+
mediaPath
;
mMediaPath
=
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()
+
"/"
+
mediaPath
;
setAcceptDrops
(
false
);
createWorkWidget
();
setFixedHeight
(
200
);
...
...
@@ -340,7 +340,7 @@ void UBTGMediaWidget::initializeWithDom(QDomElement element)
{
mIsInitializationMode
=
true
;
setAcceptDrops
(
false
);
mMediaPath
=
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()
+
"/"
+
element
.
attribute
(
"relativePath"
);
mMediaPath
=
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()
+
"/"
+
element
.
attribute
(
"relativePath"
);
qDebug
()
<<
mMediaPath
;
createWorkWidget
();
setFixedHeight
(
200
);
...
...
@@ -377,7 +377,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData()
return
0
;
tUBGEElementNode
*
result
=
new
tUBGEElementNode
();
QString
relativePath
=
mMediaPath
;
relativePath
=
relativePath
.
replace
(
UBApplication
::
boardController
->
active
Document
()
->
persistencePath
()
+
"/"
,
""
);
relativePath
=
relativePath
.
replace
(
UBApplication
::
boardController
->
selected
Document
()
->
persistencePath
()
+
"/"
,
""
);
result
->
name
=
"media"
;
result
->
attributes
.
insert
(
"title"
,
mpTitle
->
text
());
result
->
attributes
.
insert
(
"relativePath"
,
relativePath
);
...
...
@@ -394,7 +394,7 @@ void UBTGMediaWidget::createWorkWidget()
{
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
mMediaPath
);
bool
setMedia
=
true
;
UBDocumentProxy
*
proxyDocument
=
UBApplication
::
boardController
->
active
Document
();
UBDocumentProxy
*
proxyDocument
=
UBApplication
::
boardController
->
selected
Document
();
if
(
mimeType
.
contains
(
"audio"
)
||
mimeType
.
contains
(
"video"
)){
mMediaType
=
mimeType
.
contains
(
"audio"
)
?
"audio"
:
"movie"
;
mpMediaWidget
=
new
UBMediaWidget
(
mimeType
.
contains
(
"audio"
)
?
eMediaType_Audio
:
eMediaType_Video
);
...
...
src/gui/UBThumbnailWidget.cpp
View file @
4e884672
...
...
@@ -211,7 +211,7 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
UBSceneThumbnailPixmap
*
sceneItem
=
dynamic_cast
<
UBSceneThumbnailPixmap
*>
(
itemAt
(
mMousePressPos
));
if
(
sceneItem
){
int
pageIndex
=
UB
Application
::
boardController
->
pageFromSceneIndex
(
sceneItem
->
sceneIndex
());
int
pageIndex
=
UB
DocumentContainer
::
pageFromSceneIndex
(
sceneItem
->
sceneIndex
());
if
(
pageIndex
==
0
){
event
->
ignore
();
return
;
...
...
@@ -761,7 +761,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD
,
bCanMoveDown
(
false
)
,
bCanDuplicate
(
false
)
{
if
(
0
<=
UB
Application
::
boardController
->
pageFromSceneIndex
(
pSceneIndex
)){
if
(
0
<=
UB
DocumentContainer
::
pageFromSceneIndex
(
pSceneIndex
)){
setAcceptsHoverEvents
(
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
}
...
...
@@ -839,7 +839,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
bCanDuplicate
=
false
;
if
(
proxy
()){
int
pageIndex
=
UB
Application
::
boardController
->
pageFromSceneIndex
(
sceneIndex
());
int
pageIndex
=
UB
DocumentContainer
::
pageFromSceneIndex
(
sceneIndex
());
UBDocumentController
*
documentController
=
UBApplication
::
documentController
;
bCanDelete
=
documentController
->
pageCanBeDeleted
(
pageIndex
);
bCanMoveUp
=
documentController
->
pageCanBeMovedUp
(
pageIndex
);
...
...
@@ -853,25 +853,24 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
void
UBSceneThumbnailNavigPixmap
::
deletePage
()
{
QList
<
QGraphicsItem
*>
itemsToDelete
;
itemsToDelete
<<
this
;
UBApplication
::
documentController
->
deletePages
(
itemsToDelete
);
UBApplication
::
boardController
->
deleteScene
(
sceneIndex
());
}
void
UBSceneThumbnailNavigPixmap
::
duplicatePage
()
{
UBApplication
::
boardController
->
duplicateScene
();
UBApplication
::
boardController
->
duplicateScene
(
sceneIndex
()
);
}
void
UBSceneThumbnailNavigPixmap
::
moveUpPage
()
{
UBApplication
::
documentController
->
moveSceneToIndex
(
proxy
(),
sceneIndex
(),
sceneIndex
()
-
1
);
if
(
sceneIndex
()
!=
0
)
UBApplication
::
boardController
->
moveSceneToIndex
(
sceneIndex
(),
sceneIndex
()
-
1
);
}
void
UBSceneThumbnailNavigPixmap
::
moveDownPage
()
{
UBApplication
::
documentController
->
moveSceneToIndex
(
proxy
(),
sceneIndex
(),
sceneIndex
()
+
1
);
if
(
sceneIndex
()
<
UBApplication
::
boardController
->
selectedDocument
()
->
pageCount
()
-
1
)
UBApplication
::
boardController
->
moveSceneToIndex
(
sceneIndex
(),
sceneIndex
()
+
1
);
}
void
UBImgTextThumbnailElement
::
Place
(
int
row
,
int
col
,
qreal
width
,
qreal
height
)
...
...
src/gui/UBThumbnailWidget.h
View file @
4e884672
...
...
@@ -400,19 +400,19 @@ class UBThumbnailTextItem : public QGraphicsTextItem
class
UBImgTextThumbnailElement
{
private
:
QGraphicsItem
*
thumbnail
;
UBSceneThumbnailNavigPixmap
*
thumbnail
;
UBThumbnailTextItem
*
caption
;
int
border
;
public
:
UBImgTextThumbnailElement
(
QGraphicsItem
*
thumb
,
UBThumbnailTextItem
*
text
)
:
border
(
0
)
UBImgTextThumbnailElement
(
UBSceneThumbnailNavigPixmap
*
thumb
,
UBThumbnailTextItem
*
text
)
:
border
(
0
)
{
this
->
thumbnail
=
thumb
;
this
->
caption
=
text
;
}
QGraphicsItem
*
getThumbnail
()
const
{
return
this
->
thumbnail
;
}
void
setThumbnail
(
QGraphicsItem
*
newGItem
)
{
this
->
thumbnail
=
newGItem
;
}
UBSceneThumbnailNavigPixmap
*
getThumbnail
()
const
{
return
this
->
thumbnail
;
}
void
setThumbnail
(
UBSceneThumbnailNavigPixmap
*
newGItem
)
{
this
->
thumbnail
=
newGItem
;
}
UBThumbnailTextItem
*
getCaption
()
const
{
return
this
->
caption
;
}
void
setCaption
(
UBThumbnailTextItem
*
newcaption
)
{
this
->
caption
=
newcaption
;
}
...
...
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