From ce8c7bee2f6b960df4f52913990b426f2ee62e22 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Tue, 10 Jan 2012 15:03:28 +0300 Subject: [PATCH] http://188.165.53.52/jira/browse/SANKORE-450 --- src/adaptors/UBMetadataDcSubsetAdaptor.cpp | 2 +- src/board/UBBoardController.cpp | 2 ++ src/core/UBSetting.cpp | 8 ++++++-- src/core/UBSettings.cpp | 12 ++++++------ src/core/UBSettings.h | 4 +++- src/document/UBDocumentProxy.cpp | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index a5dded62..2bd280d6 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -185,7 +185,7 @@ QMap UBMetadataDcSubsetAdaptor::load(QString pPath) if (width == 1024 && height == 768) // move from 1024/768 to 1280/960 { - docSize = UBSettings::settings()->defaultDocumentSize; + docSize = UBSettings::settings()->pageSize->get().toSize(); } metadata.insert(UBSettings::documentSize, QVariant(docSize)); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index f96d2d99..4c0f1acc 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1591,6 +1591,8 @@ void UBBoardController::setPageSize(QSize newSize) updatePageSizeState(); adjustDisplayViews(); mActiveDocument->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); + + UBSettings::settings()->pageSize->set(newSize); } } diff --git a/src/core/UBSetting.cpp b/src/core/UBSetting.cpp index 3a987ceb..7d634525 100644 --- a/src/core/UBSetting.cpp +++ b/src/core/UBSetting.cpp @@ -29,8 +29,12 @@ UBSetting::UBSetting(UBSettings* parent) : UBSetting::UBSetting(UBSettings* owner, const QString& pDomain, const QString& pKey, const QVariant& pDefaultValue) : - QObject(owner), mOwner(owner), mDomain(pDomain), mKey(pKey), mPath( - pDomain + "/" + pKey), mDefaultValue(pDefaultValue) + QObject(owner), + mOwner(owner), + mDomain(pDomain), + mKey(pKey), + mPath(pDomain + "/" + pKey), + mDefaultValue(pDefaultValue) { //NOOP } diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 0db96ae9..71e9c28e 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -188,6 +188,9 @@ void UBSettings::init() softwareHomeUrl = productWebUrl->get().toString(); + documentSizes.insert(DocumentSizeRatio::Ratio4_3, QSize(1280, 960)); // 1.33 + documentSizes.insert(DocumentSizeRatio::Ratio16_9, QSize((960 / 9 * 16), 960)); // 1.77 + appToolBarPositionedAtTop = new UBSetting(this, "App", "ToolBarPositionedAtTop", true); appToolBarDisplayText = new UBSetting(this, "App", "ToolBarDisplayText", true); appEnableAutomaticSoftwareUpdates = new UBSetting(this, "App", "EnableAutomaticSoftwareUpdates", true); @@ -216,6 +219,8 @@ void UBSettings::init() boardKeyboardPaletteKeyBtnSize = new UBSetting(this, "Board", "KeyboardPaletteKeyBtnSize", "16x16"); ValidateKeyboardPaletteKeyBtnSize(); + pageSize = new UBSetting(this, "Board", "DefaultPageSize", documentSizes.value(DocumentSizeRatio::Ratio4_3)); + QStringList penLightBackgroundColors; penLightBackgroundColors << "#000000" << "#FF0000" <<"#004080" << "#008000" << "#C87400" << "#800040" << "#008080" << "#5F2D0A"; boardPenLightBackgroundColors = new UBColorListSetting(this, "Board", "PenLightBackgroundColors", penLightBackgroundColors, 1.0); @@ -310,11 +315,6 @@ void UBSettings::init() boardShowToolsPalette = new UBSetting(this, "Board", "ShowToolsPalette", "false"); - documentSizes.insert(DocumentSizeRatio::Ratio4_3, QSize(1280, 960)); // 1.33 - documentSizes.insert(DocumentSizeRatio::Ratio16_9, QSize((960 / 9 * 16), 960)); // 1.77 - - defaultDocumentSize = documentSizes.value(DocumentSizeRatio::Ratio4_3); - svgViewBoxMargin = new UBSetting(this, "SVG", "ViewBoxMargin", "50"); pdfMargin = new UBSetting(this, "PDF", "Margin", "20"); @@ -371,7 +371,7 @@ QVariant UBSettings::value ( const QString & key, const QVariant & defaultValue) { sAppSettings->setValue(key, defaultValue); } - + return mUserSettings->value(key, sAppSettings->value(key, defaultValue)); } diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index dde60f13..bf19852c 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -266,7 +266,7 @@ class UBSettings : public QObject QMap documentSizes; - QSize defaultDocumentSize; + //QSize defaultDocumentSize; UBSetting* svgViewBoxMargin; UBSetting* pdfMargin; @@ -311,6 +311,8 @@ class UBSettings : public QObject UBSetting* communityUser; UBSetting* communityPsw; + UBSetting* pageSize; + /* static int navigPaletteWidth; static int libPaletteWidth; diff --git a/src/document/UBDocumentProxy.cpp b/src/document/UBDocumentProxy.cpp index 98c1c137..ae084d81 100644 --- a/src/document/UBDocumentProxy.cpp +++ b/src/document/UBDocumentProxy.cpp @@ -48,7 +48,7 @@ void UBDocumentProxy::init() setUuid(QUuid::createUuid()); - setDefaultDocumentSize(UBSettings::settings()->defaultDocumentSize); + setDefaultDocumentSize(UBSettings::settings()->pageSize->get().toSize()); } @@ -162,7 +162,7 @@ QSize UBDocumentProxy::defaultDocumentSize() const if (mMetaDatas.contains(UBSettings::documentSize)) return metaData(UBSettings::documentSize).toSize(); else - return UBSettings::settings()->defaultDocumentSize; + return UBSettings::settings()->pageSize->get().toSize(); } void UBDocumentProxy::setDefaultDocumentSize(QSize pSize)