UBSettings::pageDpi is not persisted anymore. Fixes issue #14

preferencesAboutTextFull
Craig Watson 9 years ago
parent 64371d08ae
commit a4cb76a7e2
  1. 18
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 4
      src/core/UBSettings.cpp
  3. 3
      src/core/UBSettings.h

@ -433,9 +433,9 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QStringRef pageDpi = mXmlReader.attributes().value("pageDpi"); QStringRef pageDpi = mXmlReader.attributes().value("pageDpi");
if (!pageDpi.isNull()) if (!pageDpi.isNull())
UBSettings::settings()->pageDpi->set(pageDpi.toString()); UBSettings::pageDpi = pageDpi.toInt();
else else
UBSettings::settings()->pageDpi->set(UBApplication::desktop()->physicalDpiX()); UBSettings::pageDpi = (UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY())/2;
bool darkBackground = false; bool darkBackground = false;
bool crossedBackground = false; bool crossedBackground = false;
@ -766,8 +766,8 @@ 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 " << currentDpi; qDebug() << "currentDpi (" << desktop->physicalDpiX() << " + " << desktop->physicalDpiY() << ")/2 = " << currentDpi;
qreal pdfScale = UBSettings::settings()->pageDpi->get().toReal()/currentDpi; qreal pdfScale = qreal(UBSettings::pageDpi)/currentDpi;
qDebug() << "pdfScale " << pdfScale; qDebug() << "pdfScale " << pdfScale;
pdfItem->setScale(pdfScale); pdfItem->setScale(pdfScale);
pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true); pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true);
@ -827,7 +827,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 = UBSettings::settings()->pageDpi->get().toReal()/currentDpi; qreal textSizeMultiplier = qreal(UBSettings::pageDpi)/currentDpi;
textDelegate->scaleTextSize(textSizeMultiplier); textDelegate->scaleTextSize(textSizeMultiplier);
} }
@ -1051,10 +1051,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement()
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
if (UBSettings::settings()->pageDpi->get() != 0) if (UBSettings::pageDpi == 0)
mXmlWriter.writeAttribute("pageDpi", (UBSettings::settings()->pageDpi->get()).toString()); UBSettings::pageDpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
else
mXmlWriter.writeAttribute("pageDpi", QString("%1").arg((desktop->physicalDpiX() + desktop->physicalDpiY()) / 2)); 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");

@ -110,6 +110,8 @@ const int UBSettings::longClickInterval = 1200;
const qreal UBSettings::minScreenRatio = 1.33; // 800/600 or 1024/768 const qreal UBSettings::minScreenRatio = 1.33; // 800/600 or 1024/768
int UBSettings::pageDpi = 0;
QStringList UBSettings::bitmapFileExtensions; QStringList UBSettings::bitmapFileExtensions;
QStringList UBSettings::vectoFileExtensions; QStringList UBSettings::vectoFileExtensions;
QStringList UBSettings::imageFileExtensions; QStringList UBSettings::imageFileExtensions;
@ -270,7 +272,7 @@ void UBSettings::init()
pageSize = new UBSetting(this, "Board", "DefaultPageSize", documentSizes.value(DocumentSizeRatio::Ratio4_3)); pageSize = new UBSetting(this, "Board", "DefaultPageSize", documentSizes.value(DocumentSizeRatio::Ratio4_3));
pageDpi = new UBSetting(this, "Board", "pageDpi", 0); pageDpi = (UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY())/ 2;
QStringList penLightBackgroundColors; QStringList penLightBackgroundColors;
penLightBackgroundColors << "#000000" << "#FF0000" <<"#004080" << "#008000" << "#FFDD00" << "#C87400" << "#800040" << "#008080" << "#5F2D0A" << "#FFFFFF"; penLightBackgroundColors << "#000000" << "#FF0000" <<"#004080" << "#008000" << "#FFDD00" << "#C87400" << "#800040" << "#008080" << "#5F2D0A" << "#FFFFFF";

@ -230,6 +230,8 @@ class UBSettings : public QObject
static QString appPingMessage; static QString appPingMessage;
static int pageDpi;
UBSetting* productWebUrl; UBSetting* productWebUrl;
QString softwareHomeUrl; QString softwareHomeUrl;
@ -364,7 +366,6 @@ class UBSettings : public QObject
UBSetting* communityCredentialsPersistence; UBSetting* communityCredentialsPersistence;
UBSetting* pageSize; UBSetting* pageSize;
UBSetting* pageDpi;
UBSetting* KeyboardLocale; UBSetting* KeyboardLocale;
UBSetting* swapControlAndDisplayScreens; UBSetting* swapControlAndDisplayScreens;

Loading…
Cancel
Save