From 9f3fa2fa8677118d7d981be05db750f9ca2216e8 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Wed, 9 Mar 2016 11:31:15 +0100 Subject: [PATCH] Added settings for showing (or not) the eraser and highlighter preview circles --- src/core/UBSettings.cpp | 3 +++ src/core/UBSettings.h | 3 +++ src/domain/UBGraphicsScene.cpp | 35 ++++++++++++++++++---------------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 4c9aa3fc..b22f93c7 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -305,6 +305,9 @@ void UBSettings::init() boardMarkerLightBackgroundSelectedColors = new UBColorListSetting(this, "Board", "MarkerLightBackgroundSelectedColors", markerLightBackgroundSelectedColors, boardMarkerAlpha->get().toDouble()); boardMarkerDarkBackgroundSelectedColors = new UBColorListSetting(this, "Board", "MarkerDarkBackgroundSelectedColors", markerDarkBackgroundSelectedColors, boardMarkerAlpha->get().toDouble()); + showEraserPreviewCircle = new UBSetting(this, "Board", "ShowEraserPreviewCircle", true); + showMarkerPreviewCircle = new UBSetting(this, "Board", "ShowMarkerPreviewCircle", true); + webUseExternalBrowser = new UBSetting(this, "Web", "UseExternalBrowser", false); bool defaultShowPageImmediatelyOnMirroredScreen = true; diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index a8e6745d..ab28fcd2 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -282,6 +282,9 @@ class UBSettings : public QObject UBColorListSetting* boardMarkerDarkBackgroundColors; UBColorListSetting* boardMarkerDarkBackgroundSelectedColors; + UBSetting* showEraserPreviewCircle; + UBSetting* showMarkerPreviewCircle; + UBSetting* webUseExternalBrowser; UBSetting* webShowPageImmediatelyOnMirroredScreen; diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 4f98950a..f230c754 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -2529,16 +2529,17 @@ void UBGraphicsScene::setDocumentUpdated() void UBGraphicsScene::createEraiser() { - mEraser = new QGraphicsEllipseItem(); // mem : owned and destroyed by the scene - mEraser->setRect(QRect(0, 0, 0, 0)); - mEraser->setVisible(false); + if (UBSettings::settings()->showEraserPreviewCircle->get().toBool()) { + mEraser = new QGraphicsEllipseItem(); // mem : owned and destroyed by the scene + mEraser->setRect(QRect(0, 0, 0, 0)); + mEraser->setVisible(false); - mEraser->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - mEraser->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Eraiser)); //Necessary to set if we want z value to be assigned correctly - - mTools << mEraser; - addItem(mEraser); + mEraser->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + mEraser->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Eraiser)); //Necessary to set if we want z value to be assigned correctly + mTools << mEraser; + addItem(mEraser); + } } void UBGraphicsScene::createPointer() @@ -2559,18 +2560,20 @@ void UBGraphicsScene::createPointer() void UBGraphicsScene::createMarkerCircle() { - mMarkerCircle = new QGraphicsEllipseItem(); + if (UBSettings::settings()->showMarkerPreviewCircle->get().toBool()) { + mMarkerCircle = new QGraphicsEllipseItem(); - mMarkerCircle->setRect(QRect(0, 0, 0, 0)); - mMarkerCircle->setVisible(false); + mMarkerCircle->setRect(QRect(0, 0, 0, 0)); + mMarkerCircle->setVisible(false); - mMarkerCircle->setPen(Qt::DotLine); // TODO: set line color to black on white, or white on black + mMarkerCircle->setPen(Qt::DotLine); // TODO: set line color to black on white, or white on black - mMarkerCircle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - mMarkerCircle->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Eraiser)); + mMarkerCircle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + mMarkerCircle->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Eraiser)); - mTools << mMarkerCircle; - addItem(mMarkerCircle); + mTools << mMarkerCircle; + addItem(mMarkerCircle); + } } void UBGraphicsScene::setToolCursor(int tool)