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
1054bdff
Commit
1054bdff
authored
Aug 20, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
034503dd
c60d4992
Changes
42
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
524 additions
and
457 deletions
+524
-457
buildDebianPackage
buildDebianPackage
+8
-1
style.qss
resources/style.qss
+2
-3
UBCFFSubsetAdaptor.cpp
src/adaptors/UBCFFSubsetAdaptor.cpp
+25
-4
UBImportAdaptor.cpp
src/adaptors/UBImportAdaptor.cpp
+18
-2
UBImportAdaptor.h
src/adaptors/UBImportAdaptor.h
+29
-3
UBImportCFF.cpp
src/adaptors/UBImportCFF.cpp
+3
-3
UBImportCFF.h
src/adaptors/UBImportCFF.h
+2
-5
UBImportDocument.cpp
src/adaptors/UBImportDocument.cpp
+3
-3
UBImportDocument.h
src/adaptors/UBImportDocument.h
+2
-2
UBImportImage.cpp
src/adaptors/UBImportImage.cpp
+30
-15
UBImportImage.h
src/adaptors/UBImportImage.h
+4
-2
UBImportPDF.cpp
src/adaptors/UBImportPDF.cpp
+19
-40
UBImportPDF.h
src/adaptors/UBImportPDF.h
+4
-2
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+7
-0
UBThumbnailAdaptor.cpp
src/adaptors/UBThumbnailAdaptor.cpp
+0
-3
UBWidgetUniboardAPI.cpp
src/api/UBWidgetUniboardAPI.cpp
+10
-12
UBWidgetUniboardAPI.h
src/api/UBWidgetUniboardAPI.h
+2
-2
UBBoardController.cpp
src/board/UBBoardController.cpp
+64
-11
UBBoardView.cpp
src/board/UBBoardView.cpp
+10
-43
UBDocumentManager.cpp
src/core/UBDocumentManager.cpp
+107
-100
UBDocumentManager.h
src/core/UBDocumentManager.h
+1
-3
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+47
-135
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+2
-6
UBDocumentContainer.cpp
src/document/UBDocumentContainer.cpp
+7
-1
UBDocumentContainer.h
src/document/UBDocumentContainer.h
+1
-1
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+10
-8
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+7
-0
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+2
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+5
-0
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+23
-0
UBGraphicsTextItemDelegate.h
src/domain/UBGraphicsTextItemDelegate.h
+2
-0
UBGraphicsWebView.cpp
src/domain/UBGraphicsWebView.cpp
+0
-8
UBGraphicsWebView.h
src/domain/UBGraphicsWebView.h
+0
-1
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+27
-27
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+3
-2
UBDockPalette.cpp
src/gui/UBDockPalette.cpp
+12
-1
UBDockPalette.h
src/gui/UBDockPalette.h
+3
-0
UBLeftPalette.cpp
src/gui/UBLeftPalette.cpp
+8
-0
UBLeftPalette.h
src/gui/UBLeftPalette.h
+3
-0
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+0
-1
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+11
-6
UBToolWidget.cpp
src/gui/UBToolWidget.cpp
+1
-1
No files found.
buildDebianPackage
View file @
1054bdff
...
@@ -107,7 +107,11 @@ buildWithStandardQt(){
...
@@ -107,7 +107,11 @@ buildWithStandardQt(){
STANDARD_QT_USED
=
true
STANDARD_QT_USED
=
true
QMAKE_PATH
=
$STANDARD_QT
QMAKE_PATH
=
$STANDARD_QT
LRELEASES
=
`
which lrelease
`
LRELEASES
=
`
which lrelease
`
QT_PATH
=
"/usr/lib/
`
arch
`
-linux-gnu"
if
[
"
`
arch
`
"
==
"i686"
]
;
then
QT_PATH
=
"/usr/lib/i386-linux-gnu"
else
QT_PATH
=
"/usr/lib/
`
arch
`
-linux-gnu"
fi
PLUGINS_PATH
=
"
$QT_PATH
/qt4/plugins"
PLUGINS_PATH
=
"
$QT_PATH
/qt4/plugins"
fi
fi
fi
fi
...
@@ -189,6 +193,9 @@ cp -R resources/linux/qtlinux/* $PRODUCT_PATH/
...
@@ -189,6 +193,9 @@ cp -R resources/linux/qtlinux/* $PRODUCT_PATH/
notifyProgress
"QT"
"Coping plugins and library ..."
notifyProgress
"QT"
"Coping plugins and library ..."
cp
-R
$PLUGINS_PATH
$PRODUCT_PATH
/
cp
-R
$PLUGINS_PATH
$PRODUCT_PATH
/
# copying customization
cp
-R
resources/customizations
$PRODUCT_PATH
/
if
[
$STANDARD_QT_USED
==
false
]
;
then
if
[
$STANDARD_QT_USED
==
false
]
;
then
#copying custom qt library
#copying custom qt library
mkdir
-p
$QT_LIBRARY_DEST_PATH
mkdir
-p
$QT_LIBRARY_DEST_PATH
...
...
resources/style.qss
View file @
1054bdff
...
@@ -70,11 +70,10 @@ QLabel#UBTGMediaDropMeLabel
...
@@ -70,11 +70,10 @@ QLabel#UBTGMediaDropMeLabel
padding: 2px;
padding: 2px;
}
}
QTextEdit,
QLineEdit,
QComboBox#DockPaletteWidgetComboBox QAbstractItemView
QComboBox#DockPaletteWidgetComboBox QAbstractItemView
{
{
background-color: white;
color: black;
selection-background-color: lightgreen;
selection-background-color: lightgreen;
selection-color: black;
selection-color: black;
}
}
...
...
src/adaptors/UBCFFSubsetAdaptor.cpp
View file @
1054bdff
...
@@ -869,8 +869,18 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele
...
@@ -869,8 +869,18 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele
QUuid
uuid
=
QUuid
::
createUuid
();
QUuid
uuid
=
QUuid
::
createUuid
();
concreteUrl
=
QUrl
::
fromLocalFile
(
UBPersistenceManager
::
persistenceManager
()
QString
destFile
;
->
addAudioFileToDocument
(
mCurrentScene
->
document
(),
concreteUrl
.
toLocalFile
(),
uuid
));
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
mCurrentScene
->
document
(),
concreteUrl
.
toLocalFile
(),
UBPersistenceManager
::
audioDirectory
,
uuid
,
destFile
);
if
(
!
b
)
{
return
false
;
}
concreteUrl
=
QUrl
::
fromLocalFile
(
destFile
);
UBGraphicsMediaItem
*
audioItem
=
mCurrentScene
->
addAudio
(
concreteUrl
,
false
);
UBGraphicsMediaItem
*
audioItem
=
mCurrentScene
->
addAudio
(
concreteUrl
,
false
);
QTransform
transform
;
QTransform
transform
;
...
@@ -912,8 +922,19 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele
...
@@ -912,8 +922,19 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele
QUuid
uuid
=
QUuid
::
createUuid
();
QUuid
uuid
=
QUuid
::
createUuid
();
concreteUrl
=
QUrl
::
fromLocalFile
(
UBPersistenceManager
::
persistenceManager
()
->
addVideoFileToDocument
(
mCurrentScene
->
document
(),
concreteUrl
.
toLocalFile
(),
uuid
));
QString
destFile
;
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
mCurrentScene
->
document
(),
concreteUrl
.
toLocalFile
(),
UBPersistenceManager
::
videoDirectory
,
uuid
,
destFile
);
if
(
!
b
)
{
return
false
;
}
concreteUrl
=
QUrl
::
fromLocalFile
(
destFile
);
UBGraphicsMediaItem
*
videoItem
=
mCurrentScene
->
addVideo
(
concreteUrl
,
false
);
UBGraphicsMediaItem
*
videoItem
=
mCurrentScene
->
addVideo
(
concreteUrl
,
false
);
QTransform
transform
;
QTransform
transform
;
...
...
src/adaptors/UBImportAdaptor.cpp
View file @
1054bdff
...
@@ -22,8 +22,9 @@
...
@@ -22,8 +22,9 @@
#include "core/memcheck.h"
#include "core/memcheck.h"
UBImportAdaptor
::
UBImportAdaptor
(
QObject
*
parent
)
UBImportAdaptor
::
UBImportAdaptor
(
bool
_documentBased
,
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
),
documentBased
(
_documentBased
)
{
{
// NOOP
// NOOP
}
}
...
@@ -33,6 +34,20 @@ UBImportAdaptor::~UBImportAdaptor()
...
@@ -33,6 +34,20 @@ UBImportAdaptor::~UBImportAdaptor()
// NOOP
// NOOP
}
}
UBPageBasedImportAdaptor
::
UBPageBasedImportAdaptor
(
QObject
*
parent
)
:
UBImportAdaptor
(
false
,
parent
)
{
// NOOP
}
UBDocumentBasedImportAdaptor
::
UBDocumentBasedImportAdaptor
(
QObject
*
parent
)
:
UBImportAdaptor
(
true
,
parent
)
{
// NOOP
}
/*
UBDocumentProxy* UBImportAdaptor::importFile(const QFile& pFile, const QString& pGroup)
UBDocumentProxy* UBImportAdaptor::importFile(const QFile& pFile, const QString& pGroup)
{
{
QString documentName = QFileInfo(pFile.fileName()).completeBaseName();
QString documentName = QFileInfo(pFile.fileName()).completeBaseName();
...
@@ -53,3 +68,4 @@ UBDocumentProxy* UBImportAdaptor::importFile(const QFile& pFile, const QString&
...
@@ -53,3 +68,4 @@ UBDocumentProxy* UBImportAdaptor::importFile(const QFile& pFile, const QString&
return newDocument;
return newDocument;
}
}
*/
\ No newline at end of file
src/adaptors/UBImportAdaptor.h
View file @
1054bdff
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
#include <QtGui>
#include <QtGui>
class
UBGraphicsItem
;
class
UBGraphicsScene
;
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBImportAdaptor
:
public
QObject
class
UBImportAdaptor
:
public
QObject
...
@@ -25,15 +27,39 @@ class UBImportAdaptor : public QObject
...
@@ -25,15 +27,39 @@ class UBImportAdaptor : public QObject
Q_OBJECT
;
Q_OBJECT
;
protected
:
protected
:
UBImportAdaptor
(
QObject
*
parent
=
0
);
UBImportAdaptor
(
bool
_documentBased
,
QObject
*
parent
=
0
);
virtual
~
UBImportAdaptor
();
virtual
~
UBImportAdaptor
();
public
:
public
:
virtual
QStringList
supportedExtentions
()
=
0
;
virtual
QStringList
supportedExtentions
()
=
0
;
virtual
QString
importFileFilter
()
=
0
;
virtual
QString
importFileFilter
()
=
0
;
virtual
UBDocumentProxy
*
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
);
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
=
0
;
bool
isDocumentBased
(){
return
documentBased
;}
private
:
bool
documentBased
;
};
class
UBPageBasedImportAdaptor
:
public
UBImportAdaptor
{
protected
:
UBPageBasedImportAdaptor
(
QObject
*
parent
=
0
);
public
:
virtual
QList
<
UBGraphicsItem
*>
import
(
const
QUuid
&
uuid
,
const
QString
&
filePath
)
=
0
;
virtual
void
placeImportedItemToScene
(
UBGraphicsScene
*
scene
,
UBGraphicsItem
*
item
)
=
0
;
virtual
const
QString
&
folderToCopy
()
=
0
;
};
};
class
UBDocumentBasedImportAdaptor
:
public
UBImportAdaptor
{
protected
:
UBDocumentBasedImportAdaptor
(
QObject
*
parent
=
0
);
public
:
virtual
UBDocumentProxy
*
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
)
=
0
;
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
=
0
;
};
#endif
/* UBIMPORTADAPTOR_H_ */
#endif
/* UBIMPORTADAPTOR_H_ */
src/adaptors/UBImportCFF.cpp
View file @
1054bdff
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
*/
*/
#include <QDir>
#include <QDir>
#include <QList>
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "core/UBPersistenceManager.h"
...
@@ -38,7 +39,7 @@ THIRD_PARTY_WARNINGS_ENABLE
...
@@ -38,7 +39,7 @@ THIRD_PARTY_WARNINGS_ENABLE
#include "core/memcheck.h"
#include "core/memcheck.h"
UBImportCFF
::
UBImportCFF
(
QObject
*
parent
)
UBImportCFF
::
UBImportCFF
(
QObject
*
parent
)
:
UBImportAdaptor
(
parent
)
:
UB
DocumentBased
ImportAdaptor
(
parent
)
{
{
// NOOP
// NOOP
}
}
...
@@ -77,7 +78,6 @@ QString UBImportCFF::importFileFilter()
...
@@ -77,7 +78,6 @@ QString UBImportCFF::importFileFilter()
return
filter
;
return
filter
;
}
}
bool
UBImportCFF
::
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
bool
UBImportCFF
::
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
{
{
QFileInfo
fi
(
pFile
);
QFileInfo
fi
(
pFile
);
...
@@ -220,6 +220,7 @@ QString UBImportCFF::expandFileToDir(const QFile& pZipFile, const QString& pDir)
...
@@ -220,6 +220,7 @@ QString UBImportCFF::expandFileToDir(const QFile& pZipFile, const QString& pDir)
return
documentRootFolder
;
return
documentRootFolder
;
}
}
UBDocumentProxy
*
UBImportCFF
::
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
)
UBDocumentProxy
*
UBImportCFF
::
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
)
{
{
Q_UNUSED
(
pGroup
);
// group is defined in the imported file
Q_UNUSED
(
pGroup
);
// group is defined in the imported file
...
@@ -277,4 +278,3 @@ UBDocumentProxy* UBImportCFF::importFile(const QFile& pFile, const QString& pGro
...
@@ -277,4 +278,3 @@ UBDocumentProxy* UBImportCFF::importFile(const QFile& pFile, const QString& pGro
return
newDocument
;
return
newDocument
;
}
}
}
}
src/adaptors/UBImportCFF.h
View file @
1054bdff
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBImportCFF
:
public
UBImportAdaptor
class
UBImportCFF
:
public
UB
DocumentBased
ImportAdaptor
{
{
Q_OBJECT
;
Q_OBJECT
;
...
@@ -33,13 +33,10 @@ class UBImportCFF : public UBImportAdaptor
...
@@ -33,13 +33,10 @@ class UBImportCFF : public UBImportAdaptor
virtual
QString
importFileFilter
();
virtual
QString
importFileFilter
();
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
);
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
);
//base class method override
virtual
UBDocumentProxy
*
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
);
virtual
UBDocumentProxy
*
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
);
private
:
private
:
QString
expandFileToDir
(
const
QFile
&
pZipFile
,
const
QString
&
pDir
);
virtual
QString
expandFileToDir
(
const
QFile
&
pZipFile
,
const
QString
&
pDir
);
};
};
#endif // UBIMPORTCFF_H
#endif // UBIMPORTCFF_H
src/adaptors/UBImportDocument.cpp
View file @
1054bdff
...
@@ -33,7 +33,7 @@ THIRD_PARTY_WARNINGS_ENABLE
...
@@ -33,7 +33,7 @@ THIRD_PARTY_WARNINGS_ENABLE
#include "core/memcheck.h"
#include "core/memcheck.h"
UBImportDocument
::
UBImportDocument
(
QObject
*
parent
)
UBImportDocument
::
UBImportDocument
(
QObject
*
parent
)
:
UBImportAdaptor
(
parent
)
:
UB
DocumentBased
ImportAdaptor
(
parent
)
{
{
// NOOP
// NOOP
}
}
...
@@ -173,7 +173,6 @@ QString UBImportDocument::expandFileToDir(const QFile& pZipFile, const QString&
...
@@ -173,7 +173,6 @@ QString UBImportDocument::expandFileToDir(const QFile& pZipFile, const QString&
return
documentRootFolder
;
return
documentRootFolder
;
}
}
UBDocumentProxy
*
UBImportDocument
::
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
)
UBDocumentProxy
*
UBImportDocument
::
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
)
{
{
Q_UNUSED
(
pGroup
);
// group is defined in the imported file
Q_UNUSED
(
pGroup
);
// group is defined in the imported file
...
@@ -197,7 +196,6 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
...
@@ -197,7 +196,6 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
}
}
}
}
bool
UBImportDocument
::
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
bool
UBImportDocument
::
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
{
{
QFileInfo
fi
(
pFile
);
QFileInfo
fi
(
pFile
);
...
@@ -215,3 +213,5 @@ bool UBImportDocument::addFileToDocument(UBDocumentProxy* pDocument, const QFile
...
@@ -215,3 +213,5 @@ bool UBImportDocument::addFileToDocument(UBDocumentProxy* pDocument, const QFile
return
true
;
return
true
;
}
}
src/adaptors/UBImportDocument.h
View file @
1054bdff
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBImportDocument
:
public
UBImportAdaptor
class
UBImportDocument
:
public
UB
DocumentBased
ImportAdaptor
{
{
Q_OBJECT
;
Q_OBJECT
;
...
@@ -37,7 +37,7 @@ class UBImportDocument : public UBImportAdaptor
...
@@ -37,7 +37,7 @@ class UBImportDocument : public UBImportAdaptor
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
);
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
);
private
:
private
:
virtual
QString
expandFileToDir
(
const
QFile
&
pZipFile
,
const
QString
&
pDir
);
QString
expandFileToDir
(
const
QFile
&
pZipFile
,
const
QString
&
pDir
);
};
};
#endif
/* UBIMPORTDOCUMENT_H_ */
#endif
/* UBIMPORTDOCUMENT_H_ */
src/adaptors/UBImportImage.cpp
View file @
1054bdff
...
@@ -21,14 +21,14 @@
...
@@ -21,14 +21,14 @@
#include "core/UBPersistenceManager.h"
#include "core/UBPersistenceManager.h"
#include "core/UBDocumentManager.h"
#include "core/UBDocumentManager.h"
#include "domain/UBGraphicsP
DF
Item.h"
#include "domain/UBGraphicsP
ixmap
Item.h"
#include "pdf/PDFRenderer.h"
#include "pdf/PDFRenderer.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
UBImportImage
::
UBImportImage
(
QObject
*
parent
)
UBImportImage
::
UBImportImage
(
QObject
*
parent
)
:
UBImportAdaptor
(
parent
)
:
UB
PageBased
ImportAdaptor
(
parent
)
{
{
// NOOP
// NOOP
}
}
...
@@ -74,18 +74,33 @@ QString UBImportImage::importFileFilter()
...
@@ -74,18 +74,33 @@ QString UBImportImage::importFileFilter()
return
filter
;
return
filter
;
}
}
QList
<
UBGraphicsItem
*>
UBImportImage
::
import
(
const
QUuid
&
uuid
,
const
QString
&
filePath
)
bool
UBImportImage
::
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
{
QList
<
UBGraphicsItem
*>
result
;
QPixmap
pix
(
filePath
);
if
(
pix
.
isNull
())
return
result
;
UBGraphicsPixmapItem
*
pixmapItem
=
new
UBGraphicsPixmapItem
();
pixmapItem
->
setPixmap
(
pix
);
result
<<
pixmapItem
;
return
result
;
}
void
UBImportImage
::
placeImportedItemToScene
(
UBGraphicsScene
*
scene
,
UBGraphicsItem
*
item
)
{
UBGraphicsPixmapItem
*
pixmapItem
=
(
UBGraphicsPixmapItem
*
)
item
;
UBGraphicsPixmapItem
*
sceneItem
=
scene
->
addPixmap
(
pixmapItem
->
pixmap
(),
NULL
,
QPointF
(
0
,
0
));
scene
->
setAsBackgroundObject
(
sceneItem
,
true
);
// Only stored pixmap, should be deleted now
delete
pixmapItem
;
}
const
QString
&
UBImportImage
::
folderToCopy
()
{
{
int
res
=
UBDocumentManager
::
documentManager
()
->
addImageAsPageToDocument
(
QStringList
(
QFileInfo
(
pFile
).
absoluteFilePath
()),
pDocument
);
static
QString
f
(
""
);
if
(
res
==
0
)
return
f
;
{
UBApplication
::
showMessage
(
tr
(
"Image import failed."
));
return
false
;
}
else
{
UBApplication
::
showMessage
(
tr
(
"Image import successful."
));
return
true
;
}
}
}
src/adaptors/UBImportImage.h
View file @
1054bdff
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBImportImage
:
public
UBImportAdaptor
class
UBImportImage
:
public
UB
PageBased
ImportAdaptor
{
{
Q_OBJECT
;
Q_OBJECT
;
...
@@ -32,7 +32,9 @@ class UBImportImage : public UBImportAdaptor
...
@@ -32,7 +32,9 @@ class UBImportImage : public UBImportAdaptor
virtual
QStringList
supportedExtentions
();
virtual
QStringList
supportedExtentions
();
virtual
QString
importFileFilter
();
virtual
QString
importFileFilter
();
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
);
virtual
QList
<
UBGraphicsItem
*>
import
(
const
QUuid
&
uuid
,
const
QString
&
filePath
);
virtual
void
placeImportedItemToScene
(
UBGraphicsScene
*
scene
,
UBGraphicsItem
*
item
);
virtual
const
QString
&
folderToCopy
();
};
};
#endif
/* UBIMPORTIMAGE_H_ */
#endif
/* UBIMPORTIMAGE_H_ */
src/adaptors/UBImportPDF.cpp
View file @
1054bdff
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "core/memcheck.h"
#include "core/memcheck.h"
UBImportPDF
::
UBImportPDF
(
QObject
*
parent
)
UBImportPDF
::
UBImportPDF
(
QObject
*
parent
)
:
UBImportAdaptor
(
parent
)
:
UB
PageBased
ImportAdaptor
(
parent
)
{
{
QDesktopWidget
*
desktop
=
UBApplication
::
desktop
();
QDesktopWidget
*
desktop
=
UBApplication
::
desktop
();
this
->
dpi
=
(
desktop
->
physicalDpiX
()
+
desktop
->
physicalDpiY
())
/
2
;
this
->
dpi
=
(
desktop
->
physicalDpiX
()
+
desktop
->
physicalDpiY
())
/
2
;
...
@@ -52,63 +52,42 @@ QString UBImportPDF::importFileFilter()
...
@@ -52,63 +52,42 @@ QString UBImportPDF::importFileFilter()
}
}
bool
UBImportPDF
::
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
QList
<
UBGraphicsItem
*>
UBImportPDF
::
import
(
const
QUuid
&
uuid
,
const
QString
&
filePath
)
{
{
Q
String
documentName
=
QFileInfo
(
pFile
.
fileName
()).
completeBaseName
()
;
Q
List
<
UBGraphicsItem
*>
result
;
QUuid
uuid
=
QUuid
::
createUuid
();
PDFRenderer
*
pdfRenderer
=
PDFRenderer
::
rendererForUuid
(
uuid
,
filePath
,
true
);
// renderer is automatically deleted when not used anymore
QString
filepath
=
UBPersistenceManager
::
persistenceManager
()
->
addPdfFileToDocument
(
pDocument
,
pFile
.
fileName
(),
uuid
);
PDFRenderer
*
pdfRenderer
=
PDFRenderer
::
rendererForUuid
(
uuid
,
pDocument
->
persistencePath
()
+
"/"
+
filepath
,
true
);
// renderer is automatically deleted when not used anymore
if
(
!
pdfRenderer
->
isValid
())
if
(
!
pdfRenderer
->
isValid
())
{
{
UBApplication
::
showMessage
(
tr
(
"PDF import failed."
));
UBApplication
::
showMessage
(
tr
(
"PDF import failed."
));
return
false
;
return
result
;
}
}
pdfRenderer
->
setDPI
(
this
->
dpi
);
pdfRenderer
->
setDPI
(
this
->
dpi
);
int
documentPageCount
=
pDocument
->
pageCount
();
if
(
documentPageCount
==
1
&&
UBPersistenceManager
::
persistenceManager
()
->
loadDocumentScene
(
pDocument
,
0
)
->
isEmpty
())
{
documentPageCount
=
0
;
}
int
pdfPageCount
=
pdfRenderer
->
pageCount
();
int
pdfPageCount
=
pdfRenderer
->
pageCount
();
for
(
int
pdfPageNumber
=
1
;
pdfPageNumber
<=
pdfPageCount
;
pdfPageNumber
++
)
for
(
int
pdfPageNumber
=
1
;
pdfPageNumber
<=
pdfPageCount
;
pdfPageNumber
++
)
{
{
int
pageIndex
=
documentPageCount
+
pdfPageNumber
;
UBApplication
::
showMessage
(
tr
(
"Importing page %1 of %2"
).
arg
(
pdfPageNumber
).
arg
(
pdfPageCount
),
true
);
UBApplication
::
showMessage
(
tr
(
"Importing page %1 of %2"
).
arg
(
pdfPageNumber
).
arg
(
pdfPageCount
),
true
);
UBGraphicsScene
*
scene
=
0
;
result
<<
new
UBGraphicsPDFItem
(
pdfRenderer
,
pdfPageNumber
);
// deleted by the scene
}
if
(
pageIndex
==
0
)
return
result
;
{
}
scene
=
UBPersistenceManager
::
persistenceManager
()
->
loadDocumentScene
(
pDocument
,
pageIndex
);
}
else
{
scene
=
UBPersistenceManager
::
persistenceManager
()
->
createDocumentSceneAt
(
pDocument
,
pageIndex
);
}
scene
->
setBackground
(
false
,
false
);
UBGraphicsPDFItem
*
pdfItem
=
new
UBGraphicsPDFItem
(
pdfRenderer
,
pdfPageNumber
);
// deleted by the scene
scene
->
addItem
(
pdfItem
);
pdfItem
->
setPos
(
-
pdfItem
->
boundingRect
().
width
()
/
2
,
-
pdfItem
->
boundingRect
().
height
()
/
2
);
scene
->
setAsBackgroundObject
(
pdfItem
,
false
,
false
);
scene
->
setNominalSize
(
pdfItem
->
boundingRect
().
width
(),
pdfItem
->
boundingRect
().
height
());
void
UBImportPDF
::
placeImportedItemToScene
(
UBGraphicsScene
*
scene
,
UBGraphicsItem
*
item
)
{
UBGraphicsPDFItem
*
pdfItem
=
(
UBGraphicsPDFItem
*
)
item
;
pdfItem
->
setPos
(
-
pdfItem
->
boundingRect
().
width
()
/
2
,
-
pdfItem
->
boundingRect
().
height
()
/
2
);
UBPersistenceManager
::
persistenceManager
()
->
persistDocumentScene
(
pDocument
,
scene
,
pageIndex
);
scene
->
setAsBackgroundObject
(
pdfItem
,
false
,
false
);
}
UBApplication
::
showMessage
(
tr
(
"PDF import successful."
));
scene
->
setNominalSize
(
pdfItem
->
boundingRect
().
width
(),
pdfItem
->
boundingRect
().
height
());
}
return
true
;
const
QString
&
UBImportPDF
::
folderToCopy
()
{
return
UBPersistenceManager
::
objectDirectory
;
}
}
src/adaptors/UBImportPDF.h
View file @
1054bdff
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBImportPDF
:
public
UBImportAdaptor
class
UBImportPDF
:
public
UB
PageBased
ImportAdaptor
{
{
Q_OBJECT
;
Q_OBJECT
;
...
@@ -32,7 +32,9 @@ class UBImportPDF : public UBImportAdaptor
...
@@ -32,7 +32,9 @@ class UBImportPDF : public UBImportAdaptor
virtual
QStringList
supportedExtentions
();
virtual
QStringList
supportedExtentions
();
virtual
QString
importFileFilter
();
virtual
QString
importFileFilter
();
virtual
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
);
virtual
QList
<
UBGraphicsItem
*>
import
(
const
QUuid
&
uuid
,
const
QString
&
filePath
);
virtual
void
placeImportedItemToScene
(
UBGraphicsScene
*
scene
,
UBGraphicsItem
*
item
);
virtual
const
QString
&
folderToCopy
();
private
:
private
:
int
dpi
;
int
dpi
;
...
...
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
1054bdff
...
@@ -1194,6 +1194,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
...
@@ -1194,6 +1194,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
UBGraphicsStrokesGroup
*
strokesGroupItem
=
qgraphicsitem_cast
<
UBGraphicsStrokesGroup
*>
(
item
);
UBGraphicsStrokesGroup
*
strokesGroupItem
=
qgraphicsitem_cast
<
UBGraphicsStrokesGroup
*>
(
item
);
if
(
strokesGroupItem
&&
strokesGroupItem
->
isVisible
()){
if
(
strokesGroupItem
&&
strokesGroupItem
->
isVisible
()){
mXmlWriter
.
writeStartElement
(
"g"
);
mXmlWriter
.
writeStartElement
(
"g"
);
mXmlWriter
.
writeAttribute
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"uuid"
,
UBStringUtils
::
toCanonicalUuid
(
strokesGroupItem
->
uuid
()));
QMatrix
matrix
=
item
->
sceneMatrix
();
QMatrix
matrix
=
item
->
sceneMatrix
();
if
(
!
matrix
.
isIdentity
()){
if
(
!
matrix
.
isIdentity
()){
mXmlWriter
.
writeAttribute
(
"transform"
,
toSvgTransform
(
matrix
));
mXmlWriter
.
writeAttribute
(
"transform"
,
toSvgTransform
(
matrix
));
...
@@ -2769,6 +2770,12 @@ UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg()
...
@@ -2769,6 +2770,12 @@ UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg()
}
}
}
}
QTextCursor
curCursor
=
textItem
->
textCursor
();
QTextCharFormat
format
;
format
.
setFont
(
font
);
curCursor
.
mergeCharFormat
(
format
);
textItem
->
setTextCursor
(
curCursor
);
textItem
->
setFont
(
font
);
textItem
->
setFont
(
font
);
QStringRef
fill
=
mXmlReader
.
attributes
().
value
(
"color"
);
QStringRef
fill
=
mXmlReader
.
attributes
().
value
(
"color"
);
...
...
src/adaptors/UBThumbnailAdaptor.cpp
View file @
1054bdff
...
@@ -117,9 +117,6 @@ void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& lis
...
@@ -117,9 +117,6 @@ void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& lis
void
UBThumbnailAdaptor
::
persistScene
(
UBDocumentProxy
*
proxy
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
)
void
UBThumbnailAdaptor
::
persistScene
(
UBDocumentProxy
*
proxy
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
)
{
{
qDebug
()
<<
"Persist scene on path "
<<
proxy
->
persistencePath
()
<<
", index "
<<
pageIndex
;
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
pageIndex
);
QFile
thumbFile
(
fileName
);
QFile
thumbFile
(
fileName
);
...
...
src/api/UBWidgetUniboardAPI.cpp
View file @
1054bdff
...
@@ -476,7 +476,7 @@ void UBWidgetUniboardAPI::enableDropOnWidget(bool enable)
...
@@ -476,7 +476,7 @@ void UBWidgetUniboardAPI::enableDropOnWidget(bool enable)
}
}
}
}
void
UBWidgetUniboardAPI
::
ProcessDropEvent
(
QDropEvent
*
event
)
void
UBWidgetUniboardAPI
::
ProcessDropEvent
(
Q
GraphicsSceneDrag
DropEvent
*
event
)
{
{
const
QMimeData
*
pMimeData
=
event
->
mimeData
();
const
QMimeData
*
pMimeData
=
event
->
mimeData
();
...
@@ -485,11 +485,12 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event)
...
@@ -485,11 +485,12 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event)
bool
downloaded
=
false
;
bool
downloaded
=
false
;
QGraphicsView
*
tmpView
=
mGraphicsWidget
->
scene
()
->
views
().
at
(
0
);
QGraphicsView
*
tmpView
=
mGraphicsWidget
->
scene
()
->
views
().
at
(
0
);
QPoint
dropPoint
(
mGraphicsWidget
->
mapFromScene
(
tmpView
->
mapToScene
(
event
->
pos
())).
toPoint
());
QPoint
dropPoint
(
mGraphicsWidget
->
mapFromScene
(
tmpView
->
mapToScene
(
event
->
pos
().
toPoint
())).
toPoint
());
Qt
::
DropActions
dropActions
=
event
->
dropAction
();
Qt
::
DropActions
dropActions
=
event
->
possibleActions
();
Qt
::
MouseButtons
dropMouseButtons
=
event
->
mouseButtons
();
Qt
::
MouseButtons
dropMouseButtons
=
event
->
buttons
();
Qt
::
KeyboardModifiers
dropModifiers
=
event
->
keyboardModifiers
();
Qt
::
KeyboardModifiers
dropModifiers
=
event
->
modifiers
();
QMimeData
dropMimeData
;
QMimeData
*
dropMimeData
=
new
QMimeData
;
qDebug
()
<<
event
->
possibleActions
();
if
(
pMimeData
->
hasHtml
())
{
//Dropping element from web browser
if
(
pMimeData
->
hasHtml
())
{
//Dropping element from web browser
...
@@ -510,7 +511,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event)
...
@@ -510,7 +511,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event)
desc
.
name
=
QFileInfo
(
url
).
fileName
();
desc
.
name
=
QFileInfo
(
url
).
fileName
();
desc
.
totalSize
=
0
;
// The total size will be retrieved during the download
desc
.
totalSize
=
0
;
// The total size will be retrieved during the download
desc
.
dropPoint
=
event
->
pos
();
//Passing pure event point. No modifications
desc
.
dropPoint
=
event
->
pos
()
.
toPoint
()
;
//Passing pure event point. No modifications
desc
.
dropActions
=
dropActions
;
desc
.
dropActions
=
dropActions
;
desc
.
dropMouseButtons
=
dropMouseButtons
;
desc
.
dropMouseButtons
=
dropMouseButtons
;
desc
.
dropModifiers
=
dropModifiers
;
desc
.
dropModifiers
=
dropModifiers
;
...
@@ -542,12 +543,9 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event)
...
@@ -542,12 +543,9 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event)
}
}
qDebug
()
<<
destFileName
;
qDebug
()
<<
destFileName
;
QString
mimeText
=
createMimeText
(
downloaded
,
contentType
,
destFileName
);
QString
mimeText
=
createMimeText
(
downloaded
,
contentType
,
destFileName
);
dropMimeData
.
setData
(
tMimeText
,
mimeText
.
toAscii
());
dropMimeData
->
setData
(
tMimeText
,
mimeText
.
toAscii
());
QDropEvent
readyEvent
(
dropPoint
,
dropActions
,
&
dropMimeData
,
dropMouseButtons
,
dropModifiers
);
event
->
setMimeData
(
dropMimeData
);
//sending event to destination either it had been downloaded or not
QApplication
::
sendEvent
(
mGraphicsWidget
,
&
readyEvent
);
readyEvent
.
acceptProposedAction
();
}
}
void
UBWidgetUniboardAPI
::
onDownloadFinished
(
bool
pSuccess
,
sDownloadFileDesc
desc
,
QByteArray
pData
)
void
UBWidgetUniboardAPI
::
onDownloadFinished
(
bool
pSuccess
,
sDownloadFileDesc
desc
,
QByteArray
pData
)
...
...
src/api/UBWidgetUniboardAPI.h
View file @
1054bdff
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#define UBWIDGETAPI_H
#define UBWIDGETAPI_H
#include <QtCore>
#include <QtCore>
#include <QDropEvent>
#include <Q
GraphicsSceneDrag
DropEvent>
#include "UBW3CWidgetAPI.h"
#include "UBW3CWidgetAPI.h"
#include "core/UBDownloadManager.h"
#include "core/UBDownloadManager.h"
...
@@ -246,7 +246,7 @@ class UBWidgetUniboardAPI : public QObject
...
@@ -246,7 +246,7 @@ class UBWidgetUniboardAPI : public QObject
* When an object is dropped on a widget, this one send us the informations to download it locally.
* When an object is dropped on a widget, this one send us the informations to download it locally.
* this method download the object on the widget directory and return the path of the downloaded object
* this method download the object on the widget directory and return the path of the downloaded object
*/
*/
void
ProcessDropEvent
(
QDropEvent
*
);
void
ProcessDropEvent
(
Q
GraphicsSceneDrag
DropEvent
*
);
bool
isDropableData
(
const
QMimeData
*
pMimeData
)
const
;
bool
isDropableData
(
const
QMimeData
*
pMimeData
)
const
;
private
slots
:
private
slots
:
...
...
src/board/UBBoardController.cpp
View file @
1054bdff
...
@@ -628,6 +628,7 @@ void UBBoardController::deleteScene(int nIndex)
...
@@ -628,6 +628,7 @@ void UBBoardController::deleteScene(int nIndex)
{
{
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
persistCurrentScene
();
persistCurrentScene
();
showMessage
(
tr
(
"Delete page %1 from document"
).
arg
(
nIndex
),
true
);
QList
<
int
>
scIndexes
;
QList
<
int
>
scIndexes
;
scIndexes
<<
nIndex
;
scIndexes
<<
nIndex
;
...
@@ -638,6 +639,7 @@ void UBBoardController::deleteScene(int nIndex)
...
@@ -638,6 +639,7 @@ void UBBoardController::deleteScene(int nIndex)
if
(
nIndex
>=
pageCount
())
if
(
nIndex
>=
pageCount
())
nIndex
=
pageCount
()
-
1
;
nIndex
=
pageCount
()
-
1
;
setActiveDocumentScene
(
nIndex
);
setActiveDocumentScene
(
nIndex
);
showMessage
(
tr
(
"Page %1 deleted"
).
arg
(
nIndex
));
QApplication
::
restoreOverrideCursor
();
QApplication
::
restoreOverrideCursor
();
}
}
}
}
...
@@ -1074,8 +1076,20 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
...
@@ -1074,8 +1076,20 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
{
{
QUuid
uuid
=
QUuid
::
createUuid
();
QUuid
uuid
=
QUuid
::
createUuid
();
QUrl
url
=
QUrl
::
fromLocalFile
(
UBPersistenceManager
::
persistenceManager
()
QString
destFile
;
->
addVideoFileToDocument
(
selectedDocument
(),
sourceUrl
,
pData
,
uuid
));
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
selectedDocument
(),
""
,
UBPersistenceManager
::
videoDirectory
,
uuid
,
destFile
,
&
pData
);
if
(
!
b
)
{
showMessage
(
tr
(
"Add file operation failed: file copying error"
));
return
NULL
;
}
QUrl
url
=
QUrl
::
fromLocalFile
(
destFile
);
mediaVideoItem
=
mActiveScene
->
addMedia
(
url
,
false
,
pPos
);
mediaVideoItem
=
mActiveScene
->
addMedia
(
url
,
false
,
pPos
);
...
@@ -1105,8 +1119,20 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
...
@@ -1105,8 +1119,20 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
{
{
QUuid
uuid
=
QUuid
::
createUuid
();
QUuid
uuid
=
QUuid
::
createUuid
();
QUrl
url
=
QUrl
::
fromLocalFile
(
UBPersistenceManager
::
persistenceManager
()
QString
destFile
;
->
addAudioFileToDocument
(
selectedDocument
(),
sourceUrl
,
pData
,
uuid
));
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
selectedDocument
(),
""
,
UBPersistenceManager
::
audioDirectory
,
uuid
,
destFile
,
&
pData
);
if
(
!
b
)
{
showMessage
(
tr
(
"Add file operation failed: file copying error"
));
return
NULL
;
}
QUrl
url
=
QUrl
::
fromLocalFile
(
destFile
);
audioMediaItem
=
mActiveScene
->
addMedia
(
url
,
false
,
pPos
);
audioMediaItem
=
mActiveScene
->
addMedia
(
url
,
false
,
pPos
);
...
@@ -1186,15 +1212,18 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
...
@@ -1186,15 +1212,18 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
qDebug
()
<<
"sourceurl : "
+
sourceUrl
.
toString
();
qDebug
()
<<
"sourceurl : "
+
sourceUrl
.
toString
();
int
result
=
0
;
int
result
=
0
;
if
(
!
sourceUrl
.
isEmpty
()){
if
(
!
sourceUrl
.
isEmpty
()){
QFile
sourceFile
(
sourceUrl
.
toLocalFile
());
QStringList
fileNames
;
result
=
UBDocumentManager
::
documentManager
()
->
addFileToDocument
(
selectedDocument
(),
sourceFile
);
fileNames
<<
sourceUrl
.
toLocalFile
();
result
=
UBDocumentManager
::
documentManager
()
->
addFilesToDocument
(
selectedDocument
(),
fileNames
);
}
}
else
if
(
pData
.
size
()){
else
if
(
pData
.
size
()){
QTemporaryFile
pdfFile
(
"XXXXXX.pdf"
);
QTemporaryFile
pdfFile
(
"XXXXXX.pdf"
);
if
(
pdfFile
.
open
())
if
(
pdfFile
.
open
())
{
{
pdfFile
.
write
(
pData
);
pdfFile
.
write
(
pData
);
result
=
UBDocumentManager
::
documentManager
()
->
addFileToDocument
(
selectedDocument
(),
pdfFile
);
QStringList
fileNames
;
fileNames
<<
pdfFile
.
fileName
();
result
=
UBDocumentManager
::
documentManager
()
->
addFilesToDocument
(
selectedDocument
(),
fileNames
);
pdfFile
.
close
();
pdfFile
.
close
();
}
}
}
}
...
@@ -1904,7 +1933,18 @@ UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool st
...
@@ -1904,7 +1933,18 @@ UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool st
QUuid
uuid
=
QUuid
::
createUuid
();
QUuid
uuid
=
QUuid
::
createUuid
();
QUrl
concreteUrl
=
pSourceUrl
;
QUrl
concreteUrl
=
pSourceUrl
;
concreteUrl
=
QUrl
::
fromLocalFile
(
UBPersistenceManager
::
persistenceManager
()
->
addVideoFileToDocument
(
selectedDocument
(),
pSourceUrl
.
toLocalFile
(),
uuid
));
QString
destFile
;
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
selectedDocument
(),
pSourceUrl
.
toLocalFile
(),
UBPersistenceManager
::
videoDirectory
,
uuid
,
destFile
);
if
(
!
b
)
{
showMessage
(
tr
(
"Add file operation failed: file copying error"
));
return
NULL
;
}
concreteUrl
=
QUrl
::
fromLocalFile
(
destFile
);
UBGraphicsMediaItem
*
vi
=
mActiveScene
->
addMedia
(
concreteUrl
,
startPlay
,
pos
);
UBGraphicsMediaItem
*
vi
=
mActiveScene
->
addMedia
(
concreteUrl
,
startPlay
,
pos
);
selectedDocument
()
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
selectedDocument
()
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
...
@@ -1923,7 +1963,18 @@ UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool st
...
@@ -1923,7 +1963,18 @@ UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool st
QUuid
uuid
=
QUuid
::
createUuid
();
QUuid
uuid
=
QUuid
::
createUuid
();
QUrl
concreteUrl
=
pSourceUrl
;
QUrl
concreteUrl
=
pSourceUrl
;
concreteUrl
=
QUrl
::
fromLocalFile
(
UBPersistenceManager
::
persistenceManager
()
->
addAudioFileToDocument
(
selectedDocument
(),
pSourceUrl
.
toLocalFile
(),
uuid
));
QString
destFile
;
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
selectedDocument
(),
pSourceUrl
.
toLocalFile
(),
UBPersistenceManager
::
audioDirectory
,
uuid
,
destFile
);
if
(
!
b
)
{
showMessage
(
tr
(
"Add file operation failed: file copying error"
));
return
NULL
;
}
concreteUrl
=
QUrl
::
fromLocalFile
(
destFile
);
UBGraphicsMediaItem
*
ai
=
mActiveScene
->
addMedia
(
concreteUrl
,
startPlay
,
pos
);
UBGraphicsMediaItem
*
ai
=
mActiveScene
->
addMedia
(
concreteUrl
,
startPlay
,
pos
);
selectedDocument
()
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
selectedDocument
()
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
...
@@ -1942,9 +1993,11 @@ UBGraphicsWidgetItem *UBBoardController::addW3cWidget(const QUrl &pUrl, const QP
...
@@ -1942,9 +1993,11 @@ UBGraphicsWidgetItem *UBBoardController::addW3cWidget(const QUrl &pUrl, const QP
UBGraphicsWidgetItem
*
w3cWidgetItem
=
0
;
UBGraphicsWidgetItem
*
w3cWidgetItem
=
0
;
QUuid
uuid
=
QUuid
::
createUuid
();
QUuid
uuid
=
QUuid
::
createUuid
();
QUrl
newUrl
=
pUrl
;
newUrl
=
QUrl
::
fromLocalFile
(
UBPersistenceManager
::
persistenceManager
()
->
addGraphicsWidgteToDocument
(
selectedDocument
(),
pUrl
.
toLocalFile
(),
uuid
));
QString
destPath
;
if
(
!
UBPersistenceManager
::
persistenceManager
()
->
addGraphicsWidgteToDocument
(
selectedDocument
(),
pUrl
.
toLocalFile
(),
uuid
,
destPath
))
return
NULL
;
QUrl
newUrl
=
QUrl
::
fromLocalFile
(
destPath
);
w3cWidgetItem
=
mActiveScene
->
addW3CWidget
(
newUrl
,
pos
);
w3cWidgetItem
=
mActiveScene
->
addW3CWidget
(
newUrl
,
pos
);
...
...
src/board/UBBoardView.cpp
View file @
1054bdff
...
@@ -989,7 +989,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -989,7 +989,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
{
if
(
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
if
(
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBToolWidget
::
Type
!=
movingItem
->
type
())
UBToolWidget
::
Type
!=
movingItem
->
type
()
&&
QGraphicsWidget
::
Type
!=
movingItem
->
type
())
{
{
bReleaseIsNeed
=
false
;
bReleaseIsNeed
=
false
;
if
(
movingItem
->
isSelected
()
&&
mMultipleSelectionIsEnabled
)
if
(
movingItem
->
isSelected
()
&&
mMultipleSelectionIsEnabled
)
...
@@ -1202,56 +1203,22 @@ UBBoardView::drawItems (QPainter *painter, int numItems,
...
@@ -1202,56 +1203,22 @@ UBBoardView::drawItems (QPainter *painter, int numItems,
}
}
void
UBBoardView
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
void
UBBoardView
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
{
{
QGraphicsItem
*
graphicsItemAtPos
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
QGraphicsView
::
dragMoveEvent
(
event
);
UBGraphicsWidgetItem
*
graphicsWidget
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
graphicsItemAtPos
);
event
->
acceptProposedAction
();
if
(
graphicsWidget
)
{
if
(
graphicsWidget
->
acceptDrops
())
{
if
(
!
mOkOnWidget
)
{
if
(
!
graphicsWidget
->
isDropableData
(
event
->
mimeData
()))
{
mOkOnWidget
=
false
;
event
->
ignore
();
return
;
}
else
{
mOkOnWidget
=
true
;
}
}
QPoint
newPoint
(
graphicsWidget
->
mapFromScene
(
mapToScene
(
event
->
pos
())).
toPoint
());
QDragMoveEvent
newEvent
(
newPoint
,
event
->
dropAction
(),
event
->
mimeData
(),
event
->
mouseButtons
(),
event
->
keyboardModifiers
());
QApplication
::
sendEvent
(
graphicsWidget
,
&
newEvent
);
}
else
{
mOkOnWidget
=
false
;
event
->
ignore
();
}
}
else
{
event
->
acceptProposedAction
();
mOkOnWidget
=
false
;
}
}
}
void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
{
{
mOkOnWidget
=
false
;
if
(
!
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
()))
{
QGraphicsItem
*
graphicsItemAtPos
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
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
()))
{
UBGraphicsWidgetItem
*
graphicsWidget
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
graphicsItemAtPos
);
if
(
graphicsWidget
&&
graphicsWidget
->
acceptDrops
())
{
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
())
||
dynamic_cast
<
UBTGDraggableTreeItem
*>
(
event
->
source
()))
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
event
->
acceptProposedAction
();
event
->
acceptProposedAction
();
}
}
}
else
QGraphicsView
::
dropEvent
(
event
);
}
}
void
void
...
...
src/core/UBDocumentManager.cpp
View file @
1054bdff
...
@@ -128,36 +128,124 @@ UBDocumentProxy* UBDocumentManager::importFile(const QFile& pFile, const QString
...
@@ -128,36 +128,124 @@ UBDocumentProxy* UBDocumentManager::importFile(const QFile& pFile, const QString
{
{
QFileInfo
fileInfo
(
pFile
);
QFileInfo
fileInfo
(
pFile
);
UBDocumentProxy
*
document
=
0
;
foreach
(
UBImportAdaptor
*
adaptor
,
mImportAdaptors
)
foreach
(
UBImportAdaptor
*
importAdaptor
,
mImportAdaptors
)
{
{
if
(
importA
daptor
->
supportedExtentions
().
lastIndexOf
(
fileInfo
.
suffix
().
toLower
())
!=
-
1
)
if
(
a
daptor
->
supportedExtentions
().
lastIndexOf
(
fileInfo
.
suffix
().
toLower
())
!=
-
1
)
{
{
UBDocumentProxy
*
document
;
UBApplication
::
setDisabled
(
true
);
UBApplication
::
setDisabled
(
true
);
document
=
importAdaptor
->
importFile
(
pFile
,
pGroup
);
if
(
adaptor
->
isDocumentBased
())
{
UBDocumentBasedImportAdaptor
*
importAdaptor
=
(
UBDocumentBasedImportAdaptor
*
)
adaptor
;
document
=
importAdaptor
->
importFile
(
pFile
,
pGroup
);
}
else
{
UBPageBasedImportAdaptor
*
importAdaptor
=
(
UBPageBasedImportAdaptor
*
)
adaptor
;
// Document import procedure.....
QString
documentName
=
QFileInfo
(
pFile
.
fileName
()).
completeBaseName
();
document
=
UBPersistenceManager
::
persistenceManager
()
->
createDocument
(
pGroup
,
documentName
);
QUuid
uuid
=
QUuid
::
createUuid
();
QString
filepath
=
pFile
.
fileName
();
if
(
importAdaptor
->
folderToCopy
()
!=
""
)
{
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
document
,
pFile
.
fileName
(),
importAdaptor
->
folderToCopy
()
,
uuid
,
filepath
);
if
(
!
b
)
{
UBPersistenceManager
::
persistenceManager
()
->
deleteDocument
(
document
);
UBApplication
::
setDisabled
(
false
);
return
NULL
;
}
}
QList
<
UBGraphicsItem
*>
pages
=
importAdaptor
->
import
(
uuid
,
filepath
);
int
nPage
=
0
;
foreach
(
UBGraphicsItem
*
page
,
pages
)
{
UBApplication
::
showMessage
(
tr
(
"Inserting page %1 of %2"
).
arg
(
++
nPage
).
arg
(
pages
.
size
()),
true
);
int
pageIndex
=
document
->
pageCount
();
UBGraphicsScene
*
scene
=
UBPersistenceManager
::
persistenceManager
()
->
createDocumentSceneAt
(
document
,
pageIndex
);
importAdaptor
->
placeImportedItemToScene
(
scene
,
page
);
UBPersistenceManager
::
persistenceManager
()
->
persistDocumentScene
(
document
,
scene
,
pageIndex
);
}
UBPersistenceManager
::
persistenceManager
()
->
persistDocumentMetadata
(
document
);
UBApplication
::
showMessage
(
tr
(
"Import successful."
));
}
UBApplication
::
setDisabled
(
false
);
UBApplication
::
setDisabled
(
false
);
return
document
;
}
}
}
return
document
;
}
return
NULL
;
}
}
bool
UBDocumentManager
::
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
)
int
UBDocumentManager
::
addFilesToDocument
(
UBDocumentProxy
*
document
,
QStringList
fileNames
)
{
{
QFileInfo
fileInfo
(
pFile
)
;
int
nImportedDocuments
=
0
;
foreach
(
UBImportAdaptor
*
importAdaptor
,
mImportAdaptor
s
)
foreach
(
const
QString
&
fileName
,
fileName
s
)
{
{
if
(
importAdaptor
->
supportedExtentions
().
lastIndexOf
(
fileInfo
.
suffix
().
toLower
())
!=
-
1
)
UBApplication
::
showMessage
(
tr
(
"Importing file"
).
arg
(
fileName
));
QFile
file
(
fileName
);
QFileInfo
fileInfo
(
file
);
foreach
(
UBImportAdaptor
*
adaptor
,
mImportAdaptors
)
{
{
UBApplication
::
setDisabled
(
true
);
if
(
adaptor
->
supportedExtentions
().
lastIndexOf
(
fileInfo
.
suffix
().
toLower
())
!=
-
1
)
bool
result
=
importAdaptor
->
addFileToDocument
(
pDocument
,
pFile
);
{
UBApplication
::
setDisabled
(
false
);
UBApplication
::
setDisabled
(
true
);
return
result
;
if
(
adaptor
->
isDocumentBased
())
{
UBDocumentBasedImportAdaptor
*
importAdaptor
=
(
UBDocumentBasedImportAdaptor
*
)
adaptor
;
if
(
importAdaptor
->
addFileToDocument
(
document
,
file
))
nImportedDocuments
++
;
}
else
{
UBPageBasedImportAdaptor
*
importAdaptor
=
(
UBPageBasedImportAdaptor
*
)
adaptor
;
QUuid
uuid
=
QUuid
::
createUuid
();
QString
filepath
=
file
.
fileName
();
if
(
importAdaptor
->
folderToCopy
()
!=
""
)
{
bool
b
=
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
document
,
file
.
fileName
(),
importAdaptor
->
folderToCopy
()
,
uuid
,
filepath
);
if
(
!
b
)
{
continue
;
}
}
QList
<
UBGraphicsItem
*>
pages
=
importAdaptor
->
import
(
uuid
,
filepath
);
int
nPage
=
0
;
foreach
(
UBGraphicsItem
*
page
,
pages
)
{
UBApplication
::
showMessage
(
tr
(
"Inserting page %1 of %2"
).
arg
(
++
nPage
).
arg
(
pages
.
size
()),
true
);
int
pageIndex
=
document
->
pageCount
();
UBGraphicsScene
*
scene
=
UBPersistenceManager
::
persistenceManager
()
->
createDocumentSceneAt
(
document
,
pageIndex
);
importAdaptor
->
placeImportedItemToScene
(
scene
,
page
);
UBPersistenceManager
::
persistenceManager
()
->
persistDocumentScene
(
document
,
scene
,
pageIndex
);
}
UBPersistenceManager
::
persistenceManager
()
->
persistDocumentMetadata
(
document
);
UBApplication
::
showMessage
(
tr
(
"Import of file %1 successful."
).
arg
(
file
.
fileName
()));
nImportedDocuments
++
;
}
UBApplication
::
setDisabled
(
false
);
}
}
}
}
}
return
false
;
return
nImportedDocuments
;
}
}
...
@@ -167,14 +255,14 @@ int UBDocumentManager::addImageDirToDocument(const QDir& pDir, UBDocumentProxy*
...
@@ -167,14 +255,14 @@ int UBDocumentManager::addImageDirToDocument(const QDir& pDir, UBDocumentProxy*
filenames
=
UBStringUtils
::
sortByLastDigit
(
filenames
);
filenames
=
UBStringUtils
::
sortByLastDigit
(
filenames
);
QStringList
f
ullPathFilen
ames
;
QStringList
f
ileN
ames
;
foreach
(
QString
f
,
filenames
)
foreach
(
QString
f
,
filenames
)
{
{
f
ullPathFilen
ames
<<
pDir
.
absolutePath
()
+
"/"
+
f
;
f
ileN
ames
<<
pDir
.
absolutePath
()
+
"/"
+
f
;
}
}
return
add
ImageAsPageToDocument
(
fullPathFilenames
,
pDocument
);
return
add
FilesToDocument
(
pDocument
,
fileNames
);
}
}
...
@@ -209,87 +297,6 @@ QList<UBExportAdaptor*> UBDocumentManager::supportedExportAdaptors()
...
@@ -209,87 +297,6 @@ QList<UBExportAdaptor*> UBDocumentManager::supportedExportAdaptors()
return
mExportAdaptors
;
return
mExportAdaptors
;
}
}
int
UBDocumentManager
::
addImageAsPageToDocument
(
const
QStringList
&
filenames
,
UBDocumentProxy
*
pDocument
)
{
int
result
=
0
;
if
(
filenames
.
size
()
>
0
)
{
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
QApplication
::
processEvents
();
int
pageIndex
=
pDocument
->
pageCount
();
if
(
pageIndex
==
1
&&
UBPersistenceManager
::
persistenceManager
()
->
loadDocumentScene
(
pDocument
,
0
)
->
isEmpty
())
{
pageIndex
=
0
;
}
int
expectedPageCount
=
filenames
.
size
();
for
(
int
i
=
0
;
i
<
filenames
.
size
();
i
++
)
{
UBApplication
::
showMessage
(
tr
(
"Importing page %1 of %2"
).
arg
(
i
+
1
).
arg
(
expectedPageCount
));
UBGraphicsScene
*
scene
=
0
;
QString
fullPath
=
filenames
.
at
(
i
);
QGraphicsItem
*
gi
=
0
;
if
(
pageIndex
==
0
)
{
scene
=
UBPersistenceManager
::
persistenceManager
()
->
loadDocumentScene
(
pDocument
,
pageIndex
);
}
else
{
scene
=
UBPersistenceManager
::
persistenceManager
()
->
createDocumentSceneAt
(
pDocument
,
pageIndex
);
}
scene
->
setBackground
(
false
,
false
);
if
(
fullPath
.
endsWith
(
".svg"
)
||
fullPath
.
endsWith
(
".svgz"
))
{
gi
=
scene
->
addSvg
(
QUrl
::
fromLocalFile
(
fullPath
),
QPointF
(
0
,
0
));
}
else
{
QPixmap
pix
(
fullPath
);
if
(
pix
.
isNull
())
{
UBApplication
::
showMessage
(
tr
(
"Erronous image data, skipping file %1"
).
arg
(
filenames
.
at
(
i
)));
expectedPageCount
--
;
continue
;
}
else
{
gi
=
scene
->
addPixmap
(
pix
,
NULL
,
QPointF
(
0
,
0
));
}
}
if
(
gi
)
{
scene
->
setAsBackgroundObject
(
gi
,
true
);
UBPersistenceManager
::
persistenceManager
()
->
persistDocumentScene
(
pDocument
,
scene
,
pageIndex
);
pageIndex
++
;
}
}
result
=
expectedPageCount
;
QApplication
::
restoreOverrideCursor
();
}
return
result
;
}
void
UBDocumentManager
::
emitDocumentUpdated
(
UBDocumentProxy
*
pDocument
)
void
UBDocumentManager
::
emitDocumentUpdated
(
UBDocumentProxy
*
pDocument
)
{
{
...
...
src/core/UBDocumentManager.h
View file @
1054bdff
...
@@ -36,13 +36,11 @@ class UBDocumentManager : public QObject
...
@@ -36,13 +36,11 @@ class UBDocumentManager : public QObject
UBDocumentProxy
*
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
);
UBDocumentProxy
*
importFile
(
const
QFile
&
pFile
,
const
QString
&
pGroup
);
bool
addFileToDocument
(
UBDocumentProxy
*
pDocument
,
const
QFile
&
pFile
);
int
addFilesToDocument
(
UBDocumentProxy
*
pDocument
,
QStringList
fileNames
);
UBDocumentProxy
*
importDir
(
const
QDir
&
pDir
,
const
QString
&
pGroup
);
UBDocumentProxy
*
importDir
(
const
QDir
&
pDir
,
const
QString
&
pGroup
);
int
addImageDirToDocument
(
const
QDir
&
pDir
,
UBDocumentProxy
*
pDocument
);
int
addImageDirToDocument
(
const
QDir
&
pDir
,
UBDocumentProxy
*
pDocument
);
int
addImageAsPageToDocument
(
const
QStringList
&
images
,
UBDocumentProxy
*
document
);
QList
<
UBExportAdaptor
*>
supportedExportAdaptors
();
QList
<
UBExportAdaptor
*>
supportedExportAdaptors
();
void
emitDocumentUpdated
(
UBDocumentProxy
*
pDocument
);
void
emitDocumentUpdated
(
UBDocumentProxy
*
pDocument
);
...
...
src/core/UBPersistenceManager.cpp
View file @
1054bdff
...
@@ -878,170 +878,82 @@ QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy*
...
@@ -878,170 +878,82 @@ QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy*
return
destPath
;
return
destPath
;
}
}
bool
UBPersistenceManager
::
addFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
UBPersistenceManager
::
addVideoFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
)
QString
path
,
const
QString
&
subdir
,
QUuid
objectUuid
,
QString
&
destinationPath
,
QByteArray
*
data
)
{
{
QFileInfo
fi
(
path
);
QFileInfo
fi
(
path
);
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
||
objectUuid
.
isNull
())
return
""
;
QString
fileName
=
UBPersistenceManager
::
videoDirectory
+
"/"
+
objectUuid
.
toString
()
+
"."
+
fi
.
suffix
();
QString
destPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
fileName
;
if
(
!
QFile
::
exists
(
destPath
))
{
QDir
dir
;
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
videoDirectory
);
QFile
source
(
path
);
source
.
copy
(
destPath
);
}
return
destPath
;
}
QString
UBPersistenceManager
::
addVideoFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QUrl
sourceUrl
,
QByteArray
pPayload
,
QUuid
objectUuid
)
{
if
(
!
pDocumentProxy
||
objectUuid
.
isNull
())
if
(
!
pDocumentProxy
||
objectUuid
.
isNull
())
return
""
;
return
false
;
if
(
data
==
NULL
&&
!
fi
.
exists
())
return
false
;
QString
urlPath
=
sourceUrl
.
path
();
QString
fileName
=
subdir
+
"/"
+
objectUuid
.
toString
()
+
"."
+
fi
.
suffix
();
int
lastDot
=
urlPath
.
lastIndexOf
(
"."
);
QString
suffix
=
urlPath
.
right
(
urlPath
.
length
()
-
lastDot
-
1
);
QString
fileName
=
UBPersistenceManager
::
videoDirectory
+
"/"
+
objectUuid
.
toString
()
+
"."
+
suffix
;
destinationPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
fileName
;
QString
destPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
fileName
;
if
(
!
QFile
::
exists
(
destPath
))
if
(
!
QFile
::
exists
(
dest
ination
Path
))
{
{
QDir
dir
;
QDir
dir
;
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
videoDirectory
);
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
subdir
);
if
(
!
QFile
::
exists
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
subdir
))
return
false
;
QFile
newFile
(
destPath
);
if
(
data
==
NULL
)
if
(
newFile
.
open
(
QIODevice
::
WriteOnly
))
{
{
newFile
.
write
(
pPayload
);
QFile
source
(
path
);
newFile
.
flush
();
return
source
.
copy
(
destinationPath
);
newFile
.
close
();
}
}
}
else
return
destPath
;
}
QString
UBPersistenceManager
::
addAudioFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
)
{
QFileInfo
fi
(
path
);
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
||
objectUuid
.
isNull
())
return
""
;
QString
fileName
=
UBPersistenceManager
::
audioDirectory
+
"/"
+
objectUuid
.
toString
()
+
"."
+
fi
.
suffix
();
QString
destPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
fileName
;
if
(
!
QFile
::
exists
(
destPath
))
{
QDir
dir
;
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
audioDirectory
);
QFile
source
(
path
);
source
.
copy
(
destPath
);
}
return
destPath
;
}
QString
UBPersistenceManager
::
addAudioFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QUrl
sourceUrl
,
QByteArray
pPayload
,
QUuid
objectUuid
)
{
if
(
!
pDocumentProxy
||
objectUuid
.
isNull
())
return
""
;
QString
urlPath
=
sourceUrl
.
path
();
int
lastDot
=
urlPath
.
lastIndexOf
(
"."
);
QString
suffix
=
urlPath
.
right
(
urlPath
.
length
()
-
lastDot
-
1
);
QString
fileName
=
UBPersistenceManager
::
audioDirectory
+
"/"
+
objectUuid
.
toString
()
+
"."
+
suffix
;
QString
destPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
fileName
;
if
(
!
QFile
::
exists
(
destPath
))
{
QDir
dir
;
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
audioDirectory
);
QFile
newFile
(
destPath
);
if
(
newFile
.
open
(
QIODevice
::
WriteOnly
))
{
{
newFile
.
write
(
pPayload
);
QFile
newFile
(
destinationPath
);
newFile
.
flush
();
newFile
.
close
();
if
(
newFile
.
open
(
QIODevice
::
WriteOnly
))
{
qint64
n
=
newFile
.
write
(
*
data
);
newFile
.
flush
();
newFile
.
close
();
return
n
==
data
->
size
();
}
else
{
return
false
;
}
}
}
}
}
else
//return fileName;
return
destPath
;
}
QString
UBPersistenceManager
::
addPdfFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
)
{
QFileInfo
fi
(
path
);
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
||
objectUuid
.
isNull
())
return
""
;
QString
fileName
=
UBPersistenceManager
::
objectDirectory
+
"/"
+
objectUuid
.
toString
()
+
"."
+
fi
.
suffix
();
QString
destPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
fileName
;
if
(
!
QFile
::
exists
(
destPath
))
{
{
QDir
dir
;
return
false
;
dir
.
mkpath
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
objectDirectory
);
QFile
source
(
path
);
source
.
copy
(
destPath
);
}
}
return
fileName
;
}
}
QString
UBPersistenceManager
::
addGraphicsWidgteToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
)
bool
UBPersistenceManager
::
addGraphicsWidgteToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
,
QString
&
destinationPath
)
{
{
QFileInfo
fi
(
path
);
QFileInfo
fi
(
path
);
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
||
objectUuid
.
isNull
())
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
||
objectUuid
.
isNull
())
return
""
;
return
false
;
QString
widgetRootDir
=
path
;
QString
widgetRootDir
=
path
;
QString
extension
=
QFileInfo
(
widgetRootDir
).
suffix
();
QString
extension
=
QFileInfo
(
widgetRootDir
).
suffix
();
QString
widgetTargetDir
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
widgetDirectory
+
"/"
+
objectUuid
.
toString
()
+
"."
+
extension
;
destinationPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
widgetDirectory
+
"/"
+
objectUuid
.
toString
()
+
"."
+
extension
;
if
(
!
QFile
::
exists
(
widgetTargetDir
))
{
if
(
!
QFile
::
exists
(
destinationPath
))
{
QDir
dir
;
QDir
dir
;
dir
.
mkpath
(
widgetTargetDir
);
if
(
!
dir
.
mkpath
(
destinationPath
))
UBFileSystemUtils
::
copyDir
(
widgetRootDir
,
widgetTargetDir
);
return
false
;
return
UBFileSystemUtils
::
copyDir
(
widgetRootDir
,
destinationPath
);
}
}
else
if
(
!
QFile
::
exists
(
widgetTargetDir
))
return
false
;
widgetTargetDir
=
QString
();
return
widgetTargetDir
;
}
}
...
...
src/core/UBPersistenceManager.h
View file @
1054bdff
...
@@ -100,12 +100,8 @@ class UBPersistenceManager : public QObject
...
@@ -100,12 +100,8 @@ class UBPersistenceManager : public QObject
virtual
bool
isEmpty
(
UBDocumentProxy
*
pDocumentProxy
);
virtual
bool
isEmpty
(
UBDocumentProxy
*
pDocumentProxy
);
virtual
void
purgeEmptyDocuments
();
virtual
void
purgeEmptyDocuments
();
virtual
QString
addVideoFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
);
bool
addGraphicsWidgteToDocument
(
UBDocumentProxy
*
mDocumentProxy
,
QString
path
,
QUuid
objectUuid
,
QString
&
destinationPath
);
virtual
QString
addVideoFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QUrl
sourceUrl
,
QByteArray
pPayload
,
QUuid
objectUuid
);
bool
addFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
const
QString
&
subdir
,
QUuid
objectUuid
,
QString
&
destinationPath
,
QByteArray
*
data
=
NULL
);
virtual
QString
addAudioFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
);
virtual
QString
addAudioFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QUrl
sourceUrl
,
QByteArray
pPayload
,
QUuid
objectUuid
);
virtual
QString
addPdfFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
);
virtual
QString
addGraphicsWidgteToDocument
(
UBDocumentProxy
*
mDocumentProxy
,
QString
path
,
QUuid
objectUuid
);
bool
mayHaveVideo
(
UBDocumentProxy
*
pDocumentProxy
);
bool
mayHaveVideo
(
UBDocumentProxy
*
pDocumentProxy
);
bool
mayHaveAudio
(
UBDocumentProxy
*
pDocumentProxy
);
bool
mayHaveAudio
(
UBDocumentProxy
*
pDocumentProxy
);
...
...
src/document/UBDocumentContainer.cpp
View file @
1054bdff
...
@@ -52,12 +52,18 @@ void UBDocumentContainer::duplicatePages(QList<int>& pageIndexes)
...
@@ -52,12 +52,18 @@ void UBDocumentContainer::duplicatePages(QList<int>& pageIndexes)
emit
documentThumbnailsUpdated
(
this
);
emit
documentThumbnailsUpdated
(
this
);
}
}
void
UBDocumentContainer
::
movePageToIndex
(
int
source
,
int
target
)
bool
UBDocumentContainer
::
movePageToIndex
(
int
source
,
int
target
)
{
{
if
(
source
==
0
)
{
// Title page - cant be moved
return
false
;
}
UBPersistenceManager
::
persistenceManager
()
->
moveSceneToIndex
(
mCurrentDocument
,
source
,
target
);
UBPersistenceManager
::
persistenceManager
()
->
moveSceneToIndex
(
mCurrentDocument
,
source
,
target
);
deleteThumbPage
(
source
);
deleteThumbPage
(
source
);
insertThumbPage
(
target
);
insertThumbPage
(
target
);
emit
documentThumbnailsUpdated
(
this
);
emit
documentThumbnailsUpdated
(
this
);
return
true
;
}
}
void
UBDocumentContainer
::
deletePages
(
QList
<
int
>&
pageIndexes
)
void
UBDocumentContainer
::
deletePages
(
QList
<
int
>&
pageIndexes
)
...
...
src/document/UBDocumentContainer.h
View file @
1054bdff
...
@@ -37,7 +37,7 @@ class UBDocumentContainer : public QObject
...
@@ -37,7 +37,7 @@ class UBDocumentContainer : public QObject
static
int
sceneIndexFromPage
(
int
sceneIndex
);
static
int
sceneIndexFromPage
(
int
sceneIndex
);
void
duplicatePages
(
QList
<
int
>&
pageIndexes
);
void
duplicatePages
(
QList
<
int
>&
pageIndexes
);
void
movePageToIndex
(
int
source
,
int
target
);
bool
movePageToIndex
(
int
source
,
int
target
);
void
deletePages
(
QList
<
int
>&
pageIndexes
);
void
deletePages
(
QList
<
int
>&
pageIndexes
);
void
addPage
(
int
index
);
void
addPage
(
int
index
);
void
updatePage
(
int
index
);
void
updatePage
(
int
index
);
...
...
src/document/UBDocumentController.cpp
View file @
1054bdff
...
@@ -1006,11 +1006,12 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
...
@@ -1006,11 +1006,12 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
if
(
filePath
.
length
()
>
0
)
if
(
filePath
.
length
()
>
0
)
{
{
QApplication
::
processEvents
();
QApplication
::
processEvents
();
QFile
selectedFile
(
filePath
);
showMessage
(
tr
(
"Importing file %1..."
).
arg
(
fileInfo
.
baseName
()),
true
);
showMessage
(
tr
(
"Importing file %1..."
).
arg
(
fileInfo
.
baseName
()),
true
);
success
=
UBDocumentManager
::
documentManager
()
->
addFileToDocument
(
document
,
selectedFile
);
QStringList
fileNames
;
fileNames
<<
filePath
;
success
=
UBDocumentManager
::
documentManager
()
->
addFilesToDocument
(
document
,
fileNames
);
if
(
success
)
if
(
success
)
{
{
...
@@ -1031,12 +1032,13 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
...
@@ -1031,12 +1032,13 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
void
UBDocumentController
::
moveSceneToIndex
(
UBDocumentProxy
*
proxy
,
int
source
,
int
target
)
void
UBDocumentController
::
moveSceneToIndex
(
UBDocumentProxy
*
proxy
,
int
source
,
int
target
)
{
{
UBDocumentContainer
::
movePageToIndex
(
source
,
target
);
if
(
UBDocumentContainer
::
movePageToIndex
(
source
,
target
))
{
proxy
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
proxy
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
UBMetadataDcSubsetAdaptor
::
persist
(
proxy
);
UBMetadataDcSubsetAdaptor
::
persist
(
proxy
);
mDocumentUI
->
thumbnailWidget
->
hightlightItem
(
target
);
mDocumentUI
->
thumbnailWidget
->
hightlightItem
(
target
);
}
}
}
...
@@ -1438,7 +1440,7 @@ void UBDocumentController::addImages()
...
@@ -1438,7 +1440,7 @@ void UBDocumentController::addImages()
UBSettings
::
settings
()
->
lastImportFolderPath
->
set
(
QVariant
(
firstImage
.
absoluteDir
().
absolutePath
()));
UBSettings
::
settings
()
->
lastImportFolderPath
->
set
(
QVariant
(
firstImage
.
absoluteDir
().
absolutePath
()));
int
importedImageNumber
int
importedImageNumber
=
UBDocumentManager
::
documentManager
()
->
addImageAsPageToDocument
(
images
,
document
);
=
UBDocumentManager
::
documentManager
()
->
addFilesToDocument
(
document
,
images
);
if
(
importedImageNumber
==
0
)
if
(
importedImageNumber
==
0
)
{
{
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
1054bdff
...
@@ -115,6 +115,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
...
@@ -115,6 +115,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
,
mToolBarUsed
(
useToolBar
)
,
mToolBarUsed
(
useToolBar
)
{
{
// NOOP
// NOOP
connect
(
UBApplication
::
boardController
,
SIGNAL
(
zoomChanged
(
qreal
)),
this
,
SLOT
(
onZoomChanged
()));
}
}
void
UBGraphicsItemDelegate
::
init
()
void
UBGraphicsItemDelegate
::
init
()
...
@@ -535,6 +536,12 @@ void UBGraphicsItemDelegate::commitUndoStep()
...
@@ -535,6 +536,12 @@ void UBGraphicsItemDelegate::commitUndoStep()
}
}
}
}
void
UBGraphicsItemDelegate
::
onZoomChanged
()
{
mAntiScaleRatio
=
1
/
(
UBApplication
::
boardController
->
systemScaleFactor
()
*
UBApplication
::
boardController
->
currentZoom
());
positionHandles
();
}
void
UBGraphicsItemDelegate
::
buildButtons
()
void
UBGraphicsItemDelegate
::
buildButtons
()
{
{
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
1054bdff
...
@@ -259,6 +259,8 @@ class UBGraphicsItemDelegate : public QObject
...
@@ -259,6 +259,8 @@ class UBGraphicsItemDelegate : public QObject
void
increaseZlevelTop
();
void
increaseZlevelTop
();
void
increaseZlevelBottom
();
void
increaseZlevelBottom
();
void
onZoomChanged
();
protected
:
protected
:
virtual
void
buildButtons
();
virtual
void
buildButtons
();
virtual
void
decorateMenu
(
QMenu
*
menu
);
virtual
void
decorateMenu
(
QMenu
*
menu
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
1054bdff
...
@@ -317,6 +317,11 @@ void UBGraphicsScene::selectionChangedProcessing()
...
@@ -317,6 +317,11 @@ void UBGraphicsScene::selectionChangedProcessing()
void
UBGraphicsScene
::
updateGroupButtonState
()
void
UBGraphicsScene
::
updateGroupButtonState
()
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
UBStylusTool
::
Selector
!=
currentTool
)
return
;
QAction
*
groupAction
=
UBApplication
::
mainWindow
->
actionGroupItems
;
QAction
*
groupAction
=
UBApplication
::
mainWindow
->
actionGroupItems
;
QList
<
QGraphicsItem
*>
selItems
=
selectedItems
();
QList
<
QGraphicsItem
*>
selItems
=
selectedItems
();
int
selCount
=
selItems
.
count
();
int
selCount
=
selItems
.
count
();
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
1054bdff
...
@@ -322,6 +322,12 @@ void UBGraphicsTextItemDelegate::positionHandles()
...
@@ -322,6 +322,12 @@ void UBGraphicsTextItemDelegate::positionHandles()
void
UBGraphicsTextItemDelegate
::
ChangeTextSize
(
qreal
factor
,
textChangeMode
changeMode
)
void
UBGraphicsTextItemDelegate
::
ChangeTextSize
(
qreal
factor
,
textChangeMode
changeMode
)
{
{
if
(
scaleSize
==
changeMode
)
{
if
(
1
==
factor
)
return
;
}
else
if
(
0
==
factor
)
if
(
0
==
factor
)
return
;
return
;
...
@@ -403,3 +409,20 @@ void UBGraphicsTextItemDelegate::scaleTextSize(qreal multiplyer)
...
@@ -403,3 +409,20 @@ void UBGraphicsTextItemDelegate::scaleTextSize(qreal multiplyer)
{
{
ChangeTextSize
(
multiplyer
,
scaleSize
);
ChangeTextSize
(
multiplyer
,
scaleSize
);
}
}
QVariant
UBGraphicsTextItemDelegate
::
itemChange
(
QGraphicsItem
::
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
if
(
change
==
QGraphicsItem
::
ItemSelectedChange
)
{
if
(
delegated
()
->
isSelected
())
{
QTextCursor
c
=
delegated
()
->
textCursor
();
if
(
c
.
hasSelection
())
{
c
.
clearSelection
();
delegated
()
->
setTextCursor
(
c
);
}
}
}
return
UBGraphicsItemDelegate
::
itemChange
(
change
,
value
);
}
src/domain/UBGraphicsTextItemDelegate.h
View file @
1054bdff
...
@@ -40,6 +40,8 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
...
@@ -40,6 +40,8 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
virtual
~
UBGraphicsTextItemDelegate
();
virtual
~
UBGraphicsTextItemDelegate
();
bool
isEditable
();
bool
isEditable
();
void
scaleTextSize
(
qreal
multiplyer
);
void
scaleTextSize
(
qreal
multiplyer
);
virtual
QVariant
itemChange
(
QGraphicsItem
::
GraphicsItemChange
change
,
const
QVariant
&
value
);
public
slots
:
public
slots
:
void
contentsChanged
();
void
contentsChanged
();
...
...
src/domain/UBGraphicsWebView.cpp
View file @
1054bdff
...
@@ -150,11 +150,3 @@ void UBGraphicsWebView::remove()
...
@@ -150,11 +150,3 @@ void UBGraphicsWebView::remove()
if
(
mDelegate
)
if
(
mDelegate
)
mDelegate
->
remove
(
true
);
mDelegate
->
remove
(
true
);
}
}
bool
UBGraphicsWebView
::
event
(
QEvent
*
event
)
{
if
(
event
->
type
()
==
QEvent
::
ShortcutOverride
)
event
->
accept
();
return
QGraphicsWebView
::
event
(
event
);
}
src/domain/UBGraphicsWebView.h
View file @
1054bdff
...
@@ -54,7 +54,6 @@ class UBGraphicsWebView: public QGraphicsWebView, public UBItem, public UBResiza
...
@@ -54,7 +54,6 @@ class UBGraphicsWebView: public QGraphicsWebView, public UBItem, public UBResiza
virtual
void
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
);
virtual
void
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
bool
event
(
QEvent
*
event
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
};
};
...
...
src/domain/UBGraphicsWidgetItem.cpp
View file @
1054bdff
...
@@ -97,7 +97,6 @@ UBGraphicsWidgetItem::~UBGraphicsWidgetItem()
...
@@ -97,7 +97,6 @@ UBGraphicsWidgetItem::~UBGraphicsWidgetItem()
void
UBGraphicsWidgetItem
::
initialize
()
void
UBGraphicsWidgetItem
::
initialize
()
{
{
installEventFilter
(
this
);
UBGraphicsWebView
::
setMinimumSize
(
nominalSize
());
UBGraphicsWebView
::
setMinimumSize
(
nominalSize
());
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
// Necessary to set if we want z value to be assigned correctly
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
// Necessary to set if we want z value to be assigned correctly
...
@@ -277,9 +276,9 @@ void UBGraphicsWidgetItem::removeScript()
...
@@ -277,9 +276,9 @@ void UBGraphicsWidgetItem::removeScript()
page
()
->
mainFrame
()
->
evaluateJavaScript
(
"if(widget && widget.onremove) { widget.onremove();}"
);
page
()
->
mainFrame
()
->
evaluateJavaScript
(
"if(widget && widget.onremove) { widget.onremove();}"
);
}
}
void
UBGraphicsWidgetItem
::
processDropEvent
(
QDropEvent
*
event
)
void
UBGraphicsWidgetItem
::
processDropEvent
(
Q
GraphicsSceneDrag
DropEvent
*
event
)
{
{
return
mUniboardAPI
->
ProcessDropEvent
(
event
);
mUniboardAPI
->
ProcessDropEvent
(
event
);
}
}
bool
UBGraphicsWidgetItem
::
isDropableData
(
const
QMimeData
*
data
)
const
bool
UBGraphicsWidgetItem
::
isDropableData
(
const
QMimeData
*
data
)
const
{
{
...
@@ -486,6 +485,31 @@ void UBGraphicsWidgetItem::unFreeze()
...
@@ -486,6 +485,31 @@ void UBGraphicsWidgetItem::unFreeze()
mIsFrozen
=
false
;
mIsFrozen
=
false
;
}
}
bool
UBGraphicsWidgetItem
::
event
(
QEvent
*
event
)
{
if
(
mShouldMoveWidget
&&
event
->
type
()
==
QEvent
::
MouseMove
)
{
QMouseEvent
*
mouseMoveEvent
=
static_cast
<
QMouseEvent
*>
(
event
);
if
(
mouseMoveEvent
->
buttons
()
&
Qt
::
LeftButton
)
{
QPointF
scenePos
=
mapToScene
(
mouseMoveEvent
->
pos
());
QPointF
newPos
=
pos
()
+
scenePos
-
mLastMousePos
;
setPos
(
newPos
);
mLastMousePos
=
scenePos
;
event
->
accept
();
return
true
;
}
}
else
if
(
event
->
type
()
==
QEvent
::
ShortcutOverride
)
event
->
accept
();
return
UBGraphicsWebView
::
event
(
event
);
}
void
UBGraphicsWidgetItem
::
dropEvent
(
QGraphicsSceneDragDropEvent
*
event
)
{
processDropEvent
(
event
);
QGraphicsWebView
::
dropEvent
(
event
);
}
void
UBGraphicsWidgetItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
UBGraphicsWidgetItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
{
UBGraphicsWebView
::
mousePressEvent
(
event
);
UBGraphicsWebView
::
mousePressEvent
(
event
);
...
@@ -522,30 +546,6 @@ void UBGraphicsWidgetItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
...
@@ -522,30 +546,6 @@ void UBGraphicsWidgetItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
UBGraphicsWebView
::
hoverMoveEvent
(
event
);
UBGraphicsWebView
::
hoverMoveEvent
(
event
);
}
}
bool
UBGraphicsWidgetItem
::
eventFilter
(
QObject
*
obj
,
QEvent
*
event
)
{
if
(
mShouldMoveWidget
&&
obj
==
this
&&
event
->
type
()
==
QEvent
::
MouseMove
)
{
QMouseEvent
*
mouseMoveEvent
=
static_cast
<
QMouseEvent
*>
(
event
);
if
(
mouseMoveEvent
->
buttons
()
&
Qt
::
LeftButton
)
{
QPointF
scenePos
=
mapToScene
(
mouseMoveEvent
->
pos
());
QPointF
newPos
=
pos
()
+
scenePos
-
mLastMousePos
;
setPos
(
newPos
);
mLastMousePos
=
scenePos
;
event
->
accept
();
return
true
;
}
}
/* standard event processing */
return
QObject
::
eventFilter
(
obj
,
event
);
}
void
UBGraphicsWidgetItem
::
sendJSEnterEvent
()
void
UBGraphicsWidgetItem
::
sendJSEnterEvent
()
{
{
if
(
page
()
&&
page
()
->
mainFrame
())
if
(
page
()
&&
page
()
->
mainFrame
())
...
...
src/domain/UBGraphicsWidgetItem.h
View file @
1054bdff
...
@@ -76,7 +76,7 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
...
@@ -76,7 +76,7 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
virtual
void
remove
();
virtual
void
remove
();
void
removeScript
();
void
removeScript
();
void
processDropEvent
(
QDropEvent
*
event
);
void
processDropEvent
(
Q
GraphicsSceneDrag
DropEvent
*
event
);
bool
isDropableData
(
const
QMimeData
*
data
)
const
;
bool
isDropableData
(
const
QMimeData
*
data
)
const
;
virtual
QUrl
getOwnFolder
()
const
;
virtual
QUrl
getOwnFolder
()
const
;
...
@@ -136,12 +136,13 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
...
@@ -136,12 +136,13 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
QMap
<
QString
,
QString
>
mDatastore
;
QMap
<
QString
,
QString
>
mDatastore
;
QMap
<
QString
,
QString
>
mPreferences
;
QMap
<
QString
,
QString
>
mPreferences
;
virtual
bool
event
(
QEvent
*
event
);
virtual
void
dropEvent
(
QGraphicsSceneDragDropEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
bool
eventFilter
(
QObject
*
obj
,
QEvent
*
event
);
virtual
void
sendJSEnterEvent
();
virtual
void
sendJSEnterEvent
();
virtual
void
sendJSLeaveEvent
();
virtual
void
sendJSLeaveEvent
();
virtual
void
injectInlineJavaScript
();
virtual
void
injectInlineJavaScript
();
...
...
src/gui/UBDockPalette.cpp
View file @
1054bdff
...
@@ -17,12 +17,16 @@
...
@@ -17,12 +17,16 @@
#include <QPainterPath>
#include <QPainterPath>
#include "UBDockPalette.h"
#include "UBDockPalette.h"
#include "core/UBSettings.h"
#include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBPlatformUtils.h"
#include "core/UBSettings.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBPreferencesController.h"
#include "core/UBPreferencesController.h"
#include "core/UBDownloadManager.h"
#include "core/UBDownloadManager.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
/**
/**
...
@@ -79,6 +83,8 @@ UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, co
...
@@ -79,6 +83,8 @@ UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, co
onToolbarPosUpdated
();
onToolbarPosUpdated
();
connect
(
UBSettings
::
settings
()
->
appToolBarPositionedAtTop
,
SIGNAL
(
changed
(
QVariant
)),
this
,
SLOT
(
onToolbarPosUpdated
()));
connect
(
UBSettings
::
settings
()
->
appToolBarPositionedAtTop
,
SIGNAL
(
changed
(
QVariant
)),
this
,
SLOT
(
onToolbarPosUpdated
()));
connect
(
UBDownloadManager
::
downloadManager
(),
SIGNAL
(
allDownloadsFinished
()),
this
,
SLOT
(
onAllDownloadsFinished
()));
connect
(
UBDownloadManager
::
downloadManager
(),
SIGNAL
(
allDownloadsFinished
()),
this
,
SLOT
(
onAllDownloadsFinished
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
documentSet
(
UBDocumentProxy
*
)),
this
,
SLOT
(
onDocumentSet
(
UBDocumentProxy
*
)));
}
}
/**
/**
...
@@ -98,6 +104,11 @@ UBDockPalette::~UBDockPalette()
...
@@ -98,6 +104,11 @@ UBDockPalette::~UBDockPalette()
}
}
}
}
void
UBDockPalette
::
onDocumentSet
(
UBDocumentProxy
*
documentProxy
)
{
Q_UNUSED
(
documentProxy
);
}
/**
/**
* \brief Get the current orientation
* \brief Get the current orientation
* @return the current orientation
* @return the current orientation
...
...
src/gui/UBDockPalette.h
View file @
1054bdff
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
#ifndef UBDOCKPALETTE_H
#ifndef UBDOCKPALETTE_H
#define UBDOCKPALETTE_H
#define UBDOCKPALETTE_H
class
UBDocumentProxy
;
#include <QWidget>
#include <QWidget>
#include <QMouseEvent>
#include <QMouseEvent>
#include <QBrush>
#include <QBrush>
...
@@ -131,6 +133,7 @@ public slots:
...
@@ -131,6 +133,7 @@ public slots:
void
onShowTabWidget
(
UBDockPaletteWidget
*
widget
);
void
onShowTabWidget
(
UBDockPaletteWidget
*
widget
);
void
onHideTabWidget
(
UBDockPaletteWidget
*
widget
);
void
onHideTabWidget
(
UBDockPaletteWidget
*
widget
);
void
onAllDownloadsFinished
();
void
onAllDownloadsFinished
();
virtual
void
onDocumentSet
(
UBDocumentProxy
*
documentProxy
);
protected
:
protected
:
virtual
int
border
();
virtual
int
border
();
...
...
src/gui/UBLeftPalette.cpp
View file @
1054bdff
...
@@ -51,6 +51,14 @@ UBLeftPalette::~UBLeftPalette()
...
@@ -51,6 +51,14 @@ UBLeftPalette::~UBLeftPalette()
}
}
void
UBLeftPalette
::
onDocumentSet
(
UBDocumentProxy
*
documentProxy
)
{
//This is necessary to force the teacher guide to be showed in priority each time a document is set
if
(
documentProxy
&&
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
mLastOpenedTabForMode
.
insert
(
eUBDockPaletteWidget_BOARD
,
1
);
}
/**
/**
* \brief Update the maximum width
* \brief Update the maximum width
*/
*/
...
...
src/gui/UBLeftPalette.h
View file @
1054bdff
...
@@ -25,6 +25,9 @@ public:
...
@@ -25,6 +25,9 @@ public:
bool
switchMode
(
eUBDockPaletteWidgetMode
mode
);
bool
switchMode
(
eUBDockPaletteWidgetMode
mode
);
public
slots
:
void
onDocumentSet
(
UBDocumentProxy
*
documentProxy
);
protected
:
protected
:
void
updateMaxWidth
();
void
updateMaxWidth
();
void
resizeEvent
(
QResizeEvent
*
event
);
void
resizeEvent
(
QResizeEvent
*
event
);
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
1054bdff
...
@@ -1149,7 +1149,6 @@ void UBTeacherGuideWidget::onActiveSceneChanged()
...
@@ -1149,7 +1149,6 @@ void UBTeacherGuideWidget::onActiveSceneChanged()
mpPageZeroWidget
->
switchToMode
(
tUBTGZeroPageMode_EDITION
);
mpPageZeroWidget
->
switchToMode
(
tUBTGZeroPageMode_EDITION
);
setCurrentWidget
(
mpPageZeroWidget
);
setCurrentWidget
(
mpPageZeroWidget
);
}
}
else
{
else
{
if
(
mpEditionWidget
->
isModified
()){
if
(
mpEditionWidget
->
isModified
()){
...
...
src/gui/UBThumbnailWidget.cpp
View file @
1054bdff
...
@@ -210,13 +210,18 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
...
@@ -210,13 +210,18 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
mMousePressPos
=
event
->
pos
();
mMousePressPos
=
event
->
pos
();
UBSceneThumbnailPixmap
*
sceneItem
=
dynamic_cast
<
UBSceneThumbnailPixmap
*>
(
itemAt
(
mMousePressPos
));
UBSceneThumbnailPixmap
*
sceneItem
=
dynamic_cast
<
UBSceneThumbnailPixmap
*>
(
itemAt
(
mMousePressPos
));
if
(
sceneItem
){
if
(
sceneItem
==
NULL
)
int
pageIndex
=
UBDocumentContainer
::
pageFromSceneIndex
(
sceneItem
->
sceneIndex
());
{
if
(
pageIndex
==
0
){
event
->
ignore
();
event
->
ignore
();
return
;
return
;
}
}
}
//if(sceneItem){
// int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex());
// if(pageIndex == 0){
// event->ignore();
// return;
// }
//}
mMousePressScenePos
=
mapToScene
(
mMousePressPos
);
mMousePressScenePos
=
mapToScene
(
mMousePressPos
);
QGraphicsItem
*
underlyingItem
=
itemAt
(
mMousePressPos
);
QGraphicsItem
*
underlyingItem
=
itemAt
(
mMousePressPos
);
...
...
src/gui/UBToolWidget.cpp
View file @
1054bdff
...
@@ -76,7 +76,7 @@ void UBToolWidget::initialize()
...
@@ -76,7 +76,7 @@ void UBToolWidget::initialize()
if
(
!
sUnpinPixmap
)
if
(
!
sUnpinPixmap
)
sUnpinPixmap
=
new
QPixmap
(
":/images/unpin.svg"
);
sUnpinPixmap
=
new
QPixmap
(
":/images/unpin.svg"
);
QGraphicsLinearLayout
*
graphicsLayout
=
new
QGraphicsLinearLayout
(
Qt
::
Vertical
);
QGraphicsLinearLayout
*
graphicsLayout
=
new
QGraphicsLinearLayout
(
Qt
::
Vertical
,
this
);
mFrameWidth
=
UBSettings
::
settings
()
->
objectFrameWidth
;
mFrameWidth
=
UBSettings
::
settings
()
->
objectFrameWidth
;
mContentMargin
=
sClosePixmap
->
width
()
/
2
+
mFrameWidth
;
mContentMargin
=
sClosePixmap
->
width
()
/
2
+
mFrameWidth
;
...
...
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