@ -334,7 +334,7 @@ QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex)
UBGraphicsScene * UBSvgSubsetAdaptor : : loadScene ( UBDocumentProxy * proxy , const QByteArray & pArray )
UBGraphicsScene * UBSvgSubsetAdaptor : : loadScene ( UBDocumentProxy * proxy , const QByteArray & pArray )
{
{
UBSvgSubsetReader reader ( proxy , UBTextTools : : cleanHtmlCData ( QString ( pArray ) ) . toUtf8 ( ) ) ;
UBSvgSubsetReader reader ( proxy , UBTextTools : : cleanHtmlCData ( QString ( pArray ) ) . toUtf8 ( ) ) ;
return reader . loadScene ( ) ;
return reader . loadScene ( proxy ) ;
}
}
UBSvgSubsetAdaptor : : UBSvgSubsetReader : : UBSvgSubsetReader ( UBDocumentProxy * pProxy , const QByteArray & pXmlData )
UBSvgSubsetAdaptor : : UBSvgSubsetReader : : UBSvgSubsetReader ( UBDocumentProxy * pProxy , const QByteArray & pXmlData )
@ -347,7 +347,7 @@ UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy
}
}
UBGraphicsScene * UBSvgSubsetAdaptor : : UBSvgSubsetReader : : loadScene ( )
UBGraphicsScene * UBSvgSubsetAdaptor : : UBSvgSubsetReader : : loadScene ( UBDocumentProxy * proxy )
{
{
qDebug ( ) < < " loadScene() : starting reading... " ;
qDebug ( ) < < " loadScene() : starting reading... " ;
QTime time ;
QTime time ;
@ -435,9 +435,9 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QStringRef pageDpi = mXmlReader . attributes ( ) . value ( " pageDpi " ) ;
QStringRef pageDpi = mXmlReader . attributes ( ) . value ( " pageDpi " ) ;
if ( ! pageDpi . isNull ( ) )
if ( ! pageDpi . isNull ( ) )
UBSettings : : pageDpi = pageDpi . toInt ( ) ;
proxy - > setPageDpi ( pageDpi . toInt ( ) ) ;
else
else
UBSettings : : pageDpi = ( UBApplication : : desktop ( ) - > physicalDpiX ( ) + UBApplication : : desktop ( ) - > physicalDpiY ( ) ) / 2 ;
proxy - > setPageDpi ( ( UBApplication : : desktop ( ) - > physicalDpiX ( ) + UBApplication : : desktop ( ) - > physicalDpiY ( ) ) / 2 ) ;
bool darkBackground = false ;
bool darkBackground = false ;
bool crossedBackground = false ;
bool crossedBackground = false ;
@ -769,7 +769,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QDesktopWidget * desktop = UBApplication : : desktop ( ) ;
QDesktopWidget * desktop = UBApplication : : desktop ( ) ;
qreal currentDpi = ( desktop - > physicalDpiX ( ) + desktop - > physicalDpiY ( ) ) / 2 ;
qreal currentDpi = ( desktop - > physicalDpiX ( ) + desktop - > physicalDpiY ( ) ) / 2 ;
qDebug ( ) < < " currentDpi ( " < < desktop - > physicalDpiX ( ) < < " + " < < desktop - > physicalDpiY ( ) < < " )/2 = " < < currentDpi ;
qDebug ( ) < < " currentDpi ( " < < desktop - > physicalDpiX ( ) < < " + " < < desktop - > physicalDpiY ( ) < < " )/2 = " < < currentDpi ;
qreal pdfScale = qreal ( UBSettings : : pageDpi ) / currentDpi ;
qreal pdfScale = qreal ( proxy - > pageDpi ( ) ) / currentDpi ;
qDebug ( ) < < " pdfScale " < < pdfScale ;
qDebug ( ) < < " pdfScale " < < pdfScale ;
pdfItem - > setScale ( pdfScale ) ;
pdfItem - > setScale ( pdfScale ) ;
pdfItem - > setFlag ( QGraphicsItem : : ItemIsMovable , true ) ;
pdfItem - > setFlag ( QGraphicsItem : : ItemIsMovable , true ) ;
@ -829,7 +829,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{
{
QDesktopWidget * desktop = UBApplication : : desktop ( ) ;
QDesktopWidget * desktop = UBApplication : : desktop ( ) ;
qreal currentDpi = ( desktop - > physicalDpiX ( ) + desktop - > physicalDpiY ( ) ) / 2 ;
qreal currentDpi = ( desktop - > physicalDpiX ( ) + desktop - > physicalDpiY ( ) ) / 2 ;
qreal textSizeMultiplier = qreal ( UBSettings : : pageDpi ) / currentDpi ;
qreal textSizeMultiplier = qreal ( proxy - > pageDpi ( ) ) / currentDpi ;
//textDelegate->scaleTextSize(textSizeMultiplier);
//textDelegate->scaleTextSize(textSizeMultiplier);
}
}
@ -1013,7 +1013,7 @@ QGraphicsItem *UBSvgSubsetAdaptor::UBSvgSubsetReader::readElementFromGroup()
void UBSvgSubsetAdaptor : : persistScene ( UBDocumentProxy * proxy , UBGraphicsScene * pScene , const int pageIndex )
void UBSvgSubsetAdaptor : : persistScene ( UBDocumentProxy * proxy , UBGraphicsScene * pScene , const int pageIndex )
{
{
UBSvgSubsetWriter writer ( proxy , pScene , pageIndex ) ;
UBSvgSubsetWriter writer ( proxy , pScene , pageIndex ) ;
writer . persistScene ( pageIndex ) ;
writer . persistScene ( proxy , p ageIndex ) ;
}
}
@ -1027,7 +1027,7 @@ UBSvgSubsetAdaptor::UBSvgSubsetWriter::UBSvgSubsetWriter(UBDocumentProxy* proxy,
}
}
void UBSvgSubsetAdaptor : : UBSvgSubsetWriter : : writeSvgElement ( )
void UBSvgSubsetAdaptor : : UBSvgSubsetWriter : : writeSvgElement ( UBDocumentProxy * proxy )
{
{
mXmlWriter . writeStartElement ( " svg " ) ;
mXmlWriter . writeStartElement ( " svg " ) ;
@ -1053,10 +1053,11 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement()
QDesktopWidget * desktop = UBApplication : : desktop ( ) ;
QDesktopWidget * desktop = UBApplication : : desktop ( ) ;
if ( UBSettings : : pageDpi = = 0 )
if ( proxy - > pageDpi ( ) = = 0 )
UBSettings : : pageDpi = ( desktop - > physicalDpiX ( ) + desktop - > physicalDpiY ( ) ) / 2 ;
proxy - > setPageDpi ( ( desktop - > physicalDpiX ( ) + desktop - > physicalDpiY ( ) ) / 2 ) ;
mXmlWriter . writeAttribute ( " pageDpi " , QString : : number ( proxy - > pageDpi ( ) ) ) ;
mXmlWriter . writeAttribute ( " pageDpi " , QString : : number ( UBSettings : : pageDpi ) ) ;
mXmlWriter . writeStartElement ( " rect " ) ;
mXmlWriter . writeStartElement ( " rect " ) ;
mXmlWriter . writeAttribute ( " fill " , mScene - > isDarkBackground ( ) ? " black " : " white " ) ;
mXmlWriter . writeAttribute ( " fill " , mScene - > isDarkBackground ( ) ? " black " : " white " ) ;
@ -1068,7 +1069,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement()
mXmlWriter . writeEndElement ( ) ;
mXmlWriter . writeEndElement ( ) ;
}
}
bool UBSvgSubsetAdaptor : : UBSvgSubsetWriter : : persistScene ( int pageIndex )
bool UBSvgSubsetAdaptor : : UBSvgSubsetWriter : : persistScene ( UBDocumentProxy * proxy , int pageIndex )
{
{
Q_UNUSED ( pageIndex ) ;
Q_UNUSED ( pageIndex ) ;
@ -1089,7 +1090,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
mXmlWriter . writeNamespace ( UBSettings : : uniboardDocumentNamespaceUri , " ub " ) ;
mXmlWriter . writeNamespace ( UBSettings : : uniboardDocumentNamespaceUri , " ub " ) ;
mXmlWriter . writeNamespace ( nsXHtml , " xhtml " ) ;
mXmlWriter . writeNamespace ( nsXHtml , " xhtml " ) ;
writeSvgElement ( ) ;
writeSvgElement ( proxy ) ;
// Get the items from the scene
// Get the items from the scene
QList < QGraphicsItem * > items = mScene - > items ( ) ;
QList < QGraphicsItem * > items = mScene - > items ( ) ;