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
abd1c8cb
Commit
abd1c8cb
authored
May 09, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issue with handling zero pages
parent
46b33afa
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
56 deletions
+62
-56
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+5
-5
UBThumbnailAdaptor.cpp
src/adaptors/UBThumbnailAdaptor.cpp
+4
-5
UBDocumentPublisher.cpp
src/adaptors/publishing/UBDocumentPublisher.cpp
+3
-3
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+27
-27
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+2
-1
UBDocumentController.h
src/document/UBDocumentController.h
+0
-3
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+7
-1
UBDocumentNavigator.cpp
src/gui/UBDocumentNavigator.cpp
+1
-0
UBDocumentTreeWidget.cpp
src/gui/UBDocumentTreeWidget.cpp
+2
-2
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+0
-3
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+11
-6
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
abd1c8cb
...
...
@@ -143,7 +143,7 @@ void UBSvgSubsetAdaptor::upgradeScene(UBDocumentProxy* proxy, const int pageInde
QDomDocument
UBSvgSubsetAdaptor
::
loadSceneDocument
(
UBDocumentProxy
*
proxy
,
const
int
pPageIndex
)
{
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pPageIndex
)
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pPageIndex
);
QFile
file
(
fileName
);
QDomDocument
doc
(
"page"
);
...
...
@@ -166,7 +166,7 @@ QDomDocument UBSvgSubsetAdaptor::loadSceneDocument(UBDocumentProxy* proxy, const
void
UBSvgSubsetAdaptor
::
setSceneUuid
(
UBDocumentProxy
*
proxy
,
const
int
pageIndex
,
QUuid
pUuid
)
{
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
);
QFile
file
(
fileName
);
...
...
@@ -234,7 +234,7 @@ QString UBSvgSubsetAdaptor::uniboardDocumentNamespaceUriFromVersion(int mFileVer
UBGraphicsScene
*
UBSvgSubsetAdaptor
::
loadScene
(
UBDocumentProxy
*
proxy
,
const
int
pageIndex
)
{
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
);
QFile
file
(
fileName
);
...
...
@@ -260,7 +260,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const int
QUuid
UBSvgSubsetAdaptor
::
sceneUuid
(
UBDocumentProxy
*
proxy
,
const
int
pageIndex
)
{
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
);
QFile
file
(
fileName
);
...
...
@@ -1213,7 +1213,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
}
mXmlWriter
.
writeEndDocument
();
QString
fileName
=
mDocumentPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
mPageIndex
)
);
QString
fileName
=
mDocumentPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
mPageIndex
);
QFile
file
(
fileName
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
...
...
src/adaptors/UBThumbnailAdaptor.cpp
View file @
abd1c8cb
...
...
@@ -44,7 +44,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
int
existingPageCount
=
proxy
->
pageCount
();
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
UBApplication
::
boardController
->
sceneIndexFromPage
(
existingPageCount
)
);
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
existingPageCount
);
QFile
thumbFile
(
thumbFileName
);
...
...
@@ -139,8 +139,7 @@ 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"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
index
));
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
index
);
QFile
file
(
fileName
);
if
(
file
.
exists
())
...
...
@@ -159,7 +158,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"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
fileName
=
pDocPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
);
QFile
thumbFile
(
fileName
);
...
...
@@ -205,7 +204,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"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
);
return
QUrl
::
fromLocalFile
(
fileName
);
}
src/adaptors/publishing/UBDocumentPublisher.cpp
View file @
abd1c8cb
...
...
@@ -133,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"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
);
QFile
::
remove
(
filename
);
}
...
...
@@ -193,7 +193,7 @@ void UBDocumentPublisher::rasterizeScenes()
UBSvgSubsetRasterizer
rasterizer
(
mPublishingDocument
,
pageIndex
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.jpg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.jpg"
,
pageIndex
);
rasterizer
.
rasterizeToFile
(
filename
);
...
...
@@ -257,7 +257,7 @@ void UBDocumentPublisher::upgradeDocumentForPublishing()
}
}
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.json"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
filename
=
mPublishingDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.json"
,
pageIndex
);
QFile
jsonFile
(
filename
);
if
(
jsonFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
...
...
src/core/UBPersistenceManager.cpp
View file @
abd1c8cb
...
...
@@ -427,13 +427,11 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
foreach
(
int
index
,
compactedIndexes
)
{
QString
svgFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
index
+
1
);
QString
svgFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
index
);
QFile
::
remove
(
svgFileName
);
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
index
+
1
);
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
index
);
QFile
::
remove
(
thumbFileName
);
...
...
@@ -496,9 +494,7 @@ UBGraphicsScene* UBPersistenceManager::createDocumentSceneAt(UBDocumentProxy* pr
int
count
=
sceneCount
(
proxy
);
for
(
int
i
=
count
-
1
;
i
>=
index
;
i
--
)
{
renamePage
(
proxy
,
i
,
i
+
1
);
}
mSceneCache
.
shiftUpScenes
(
proxy
,
index
,
count
-
1
);
...
...
@@ -548,11 +544,11 @@ void UBPersistenceManager::moveSceneToIndex(UBDocumentProxy* proxy, int source,
if
(
source
==
target
)
return
;
QFile
svgTmp
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
source
+
1
));
svgTmp
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.tmp"
,
target
+
1
));
QFile
svgTmp
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
source
));
svgTmp
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.tmp"
,
target
));
QFile
thumbTmp
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
source
+
1
));
thumbTmp
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.tmp"
,
target
+
1
));
QFile
thumbTmp
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
source
));
thumbTmp
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.tmp"
,
target
));
if
(
source
<
target
)
{
...
...
@@ -569,11 +565,11 @@ void UBPersistenceManager::moveSceneToIndex(UBDocumentProxy* proxy, int source,
}
}
QFile
svg
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.tmp"
,
target
+
1
));
svg
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
target
+
1
));
QFile
svg
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.tmp"
,
target
));
svg
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
target
));
QFile
thumb
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.tmp"
,
target
+
1
));
thumb
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
target
+
1
));
QFile
thumb
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.tmp"
,
target
));
thumb
.
rename
(
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
target
));
mSceneCache
.
moveScene
(
proxy
,
source
,
target
);
...
...
@@ -586,10 +582,14 @@ UBGraphicsScene* UBPersistenceManager::loadDocumentScene(UBDocumentProxy* proxy,
if
(
mSceneCache
.
contains
(
proxy
,
sceneIndex
))
{
//qDebug() << "scene" << sceneIndex << "retrieved from cache ...";
//updating teacher guide node
//TODO Claudio find a way to store extra information like teacher guid
UBSvgSubsetAdaptor
::
loadScene
(
proxy
,
sceneIndex
);
return
mSceneCache
.
value
(
proxy
,
sceneIndex
);
}
else
{
qDebug
()
<<
"scene"
<<
sceneIndex
<<
"retrieved from file ..."
;
UBGraphicsScene
*
scene
=
UBSvgSubsetAdaptor
::
loadScene
(
proxy
,
sceneIndex
);
if
(
scene
)
...
...
@@ -641,23 +641,23 @@ UBDocumentProxy* UBPersistenceManager::persistDocumentMetadata(UBDocumentProxy*
void
UBPersistenceManager
::
renamePage
(
UBDocumentProxy
*
pDocumentProxy
,
const
int
sourceIndex
,
const
int
targetIndex
)
{
QFile
svg
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sourceIndex
+
1
));
svg
.
rename
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
targetIndex
+
1
));
QFile
svg
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sourceIndex
));
svg
.
rename
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
targetIndex
));
QFile
thumb
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceIndex
+
1
));
thumb
.
rename
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
targetIndex
+
1
));
QFile
thumb
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceIndex
));
thumb
.
rename
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
targetIndex
));
}
void
UBPersistenceManager
::
copyPage
(
UBDocumentProxy
*
pDocumentProxy
,
const
int
sourceIndex
,
const
int
targetIndex
)
{
QFile
svg
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sourceIndex
+
1
));
svg
.
copy
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
targetIndex
+
1
));
QFile
svg
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sourceIndex
));
svg
.
copy
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
targetIndex
));
UBSvgSubsetAdaptor
::
setSceneUuid
(
pDocumentProxy
,
targetIndex
,
QUuid
::
createUuid
());
QFile
thumb
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceIndex
+
1
));
thumb
.
copy
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
targetIndex
+
1
));
QFile
thumb
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceIndex
));
thumb
.
copy
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
targetIndex
));
}
...
...
@@ -673,7 +673,7 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath)
while
(
moreToProcess
)
{
QString
fileName
=
pPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
UBApplication
::
boardController
->
pageFromSceneIndex
(
pageIndex
)
);
QString
fileName
=
pPath
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
pageIndex
);
QFile
file
(
fileName
);
...
...
@@ -721,13 +721,13 @@ void UBPersistenceManager::addDirectoryContentToDocument(const QString& document
{
int
targetIndex
=
targetPageCount
+
sourceIndex
;
QFile
svg
(
documentRootFolder
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sourceIndex
+
1
));
svg
.
copy
(
pDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
targetIndex
+
1
));
QFile
svg
(
documentRootFolder
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
sourceIndex
));
svg
.
copy
(
pDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
targetIndex
));
UBSvgSubsetAdaptor
::
setSceneUuid
(
pDocument
,
targetIndex
,
QUuid
::
createUuid
());
QFile
thumb
(
documentRootFolder
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceIndex
+
1
));
thumb
.
copy
(
pDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
targetIndex
+
1
));
QFile
thumb
(
documentRootFolder
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceIndex
));
thumb
.
copy
(
pDocument
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
targetIndex
));
}
foreach
(
QString
dir
,
mDocumentSubDirectories
)
...
...
src/document/UBDocumentController.cpp
View file @
abd1c8cb
...
...
@@ -162,6 +162,7 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr
mDocumentUI
->
documentTreeWidget
->
scrollToItem
(
selected
);
mDocumentThumbs
=
UBThumbnailAdaptor
::
load
(
selectedDocumentProxy
());
qDebug
()
<<
mDocumentThumbs
.
size
();
refreshDocumentThumbnailsView
();
mSelectionType
=
Document
;
...
...
src/document/UBDocumentController.h
View file @
abd1c8cb
...
...
@@ -111,9 +111,6 @@ class UBDocumentController : public QObject
UBDocumentProxy
*
mCurrentDocument
;
QList
<
QPixmap
>
mDocumentThumbs
;
// UBKeyboardPalette *mKeyboardPalette;
private
slots
:
void
documentZoomSliderValueChanged
(
int
value
);
void
loadDocumentProxies
();
...
...
src/frameworks/UBFileSystemUtils.cpp
View file @
abd1c8cb
...
...
@@ -16,6 +16,11 @@
#include "UBFileSystemUtils.h"
#include <QtGui>
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
...
...
@@ -313,7 +318,8 @@ QString UBFileSystemUtils::normalizeFilePath(const QString& pFilePath)
QString
UBFileSystemUtils
::
digitFileFormat
(
const
QString
&
s
,
int
digit
)
{
return
s
.
arg
(
digit
,
3
,
10
,
QLatin1Char
(
'0'
));
int
pageDigit
=
UBApplication
::
boardController
->
pageFromSceneIndex
(
digit
);
return
s
.
arg
(
pageDigit
,
3
,
10
,
QLatin1Char
(
'0'
));
}
...
...
src/gui/UBDocumentNavigator.cpp
View file @
abd1c8cb
...
...
@@ -56,6 +56,7 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra
setFrameShadow
(
QFrame
::
Plain
);
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
this
,
SLOT
(
addNewPage
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
setDocOnPageNavigator
(
UBDocumentProxy
*
)),
this
,
SLOT
(
generateThumbnails
()));
connect
(
mScene
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
onSelectionChanged
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
documentReorganized
(
int
)),
this
,
SLOT
(
onMovedToIndex
(
int
)));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
scrollToSelectedPage
()),
this
,
SLOT
(
onScrollToSelectedPage
()));
...
...
src/gui/UBDocumentTreeWidget.cpp
View file @
abd1c8cb
...
...
@@ -327,7 +327,7 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
//due to incorrect generation of thumbnails of invisible scene I've used direct copying of thumbnail files
//it's not universal and good way but it's faster
QString
from
=
sourceItem
.
documentProxy
()
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceItem
.
sceneIndex
()
+
1
);
QString
from
=
sourceItem
.
documentProxy
()
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
sourceItem
.
sceneIndex
());
QString
to
=
targetDocProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
targetDocProxy
->
pageCount
());
QFile
::
remove
(
to
);
QFile
::
copy
(
from
,
to
);
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
abd1c8cb
...
...
@@ -155,8 +155,6 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget()
void
UBTeacherGuideEditionWidget
::
showEvent
(
QShowEvent
*
event
)
{
// mpPageTitle->setFocus();
// mpComment->setFocus();
setFocus
();
QWidget
::
showEvent
(
event
);
}
...
...
@@ -240,7 +238,6 @@ void UBTeacherGuideEditionWidget::onActiveSceneChanged()
int
currentPage
=
UBApplication
::
boardController
->
currentPage
();
if
(
currentPage
>
0
){
cleanData
();
qDebug
()
<<
"active scene changed current page "
<<
currentPage
<<
" "
<<
UBSvgSubsetAdaptor
::
sTeacherGuideNode
;
load
(
UBSvgSubsetAdaptor
::
sTeacherGuideNode
);
mpPageNumberLabel
->
setText
(
tr
(
"Page: %0"
).
arg
(
currentPage
));
UBDocumentProxy
*
documentProxy
=
UBApplication
::
boardController
->
activeDocument
();
...
...
src/gui/UBThumbnailWidget.cpp
View file @
abd1c8cb
...
...
@@ -18,6 +18,8 @@
#include "UBThumbnailWidget.h"
#include "UBRubberBand.h"
#include "board/UBBoardController.h"
#include "core/UBSettings.h"
#include "core/UBApplication.h"
...
...
@@ -749,8 +751,10 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD
,
bCanMoveUp
(
false
)
,
bCanMoveDown
(
false
)
{
if
(
UBApplication
::
boardController
->
pageFromSceneIndex
(
pSceneIndex
)){
setAcceptsHoverEvents
(
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
}
}
UBSceneThumbnailNavigPixmap
::~
UBSceneThumbnailNavigPixmap
()
...
...
@@ -822,7 +826,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
bCanMoveDown
=
false
;
UBDocumentProxy
*
p
=
proxy
();
if
(
NULL
!=
p
)
if
(
NULL
!=
p
&&
UBApplication
::
boardController
->
pageFromSceneIndex
(
sceneIndex
())
)
{
int
iNbPages
=
p
->
pageCount
();
if
(
1
<
iNbPages
)
...
...
@@ -838,6 +842,8 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
}
}
}
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
and
sceneIndex
()
<=
1
)
bCanMoveUp
=
false
;
if
(
bCanDelete
||
bCanMoveUp
||
bCanMoveDown
)
{
...
...
@@ -855,7 +861,6 @@ 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