diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 535e57ff..6548b81b 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -428,6 +428,15 @@ void UBSettings::init() communityPsw = new UBSetting(this, "Community", "Password", ""); communityCredentialsPersistence = new UBSetting(this,"Community", "CredentialsPersistence",false); + enableToolAxes = new UBSetting(this, "Board", "EnableToolAxes", false); + enableIntermediateLines = new UBSetting(this, "Board", "EnableIntermediateLines", false); + + if (enableToolAxes->get().toBool()) + { + // add axes tool id to list + UBToolsManager::manager()->addTool(UBToolsManager::manager()->axes); + } + QStringList uris = UBToolsManager::manager()->allToolIDs(); favoritesNativeToolUris = new UBSetting(this, "App", "FavoriteToolURIs", uris); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index 665d2749..653eb6dc 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -426,6 +426,9 @@ class UBSettings : public QObject UBSetting* magnifierDrawingMode; UBSetting* autoSaveInterval; + UBSetting* enableToolAxes; + UBSetting* enableIntermediateLines; + public slots: void setPenWidthIndex(int index); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index e66a0efa..4e0faf77 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -2205,7 +2205,6 @@ void UBGraphicsScene::addRuler(QPointF center) void UBGraphicsScene::addAxes(QPointF center) { UBGraphicsAxes* axes = new UBGraphicsAxes(); // mem : owned and destroyed by the scene - mTools << axes; axes->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); diff --git a/src/gui/UBBackgroundPalette.cpp b/src/gui/UBBackgroundPalette.cpp index 6569e2f6..d7218154 100644 --- a/src/gui/UBBackgroundPalette.cpp +++ b/src/gui/UBBackgroundPalette.cpp @@ -56,22 +56,31 @@ void UBBackgroundPalette::init() connect(UBApplication::mainWindow->actionDefaultGridSize, SIGNAL(triggered()), this, SLOT(defaultBackgroundGridSize())); - mDrawIntermediateLinesCheckBox = createPaletteButton(UBApplication::mainWindow->actionDrawIntermediateGridLines, this); - mDrawIntermediateLinesCheckBox->setFixedSize(24,24); - mDrawIntermediateLinesCheckBox->setCheckable(true); - mActions << UBApplication::mainWindow->actionDrawIntermediateGridLines; - mButtons.removeLast(); // don't add to button group + bool enableIntermediateLines = UBSettings::settings()->enableIntermediateLines->get().toBool(); - connect(UBApplication::mainWindow->actionDrawIntermediateGridLines, SIGNAL(toggled(bool)), this, SLOT(toggleIntermediateLines(bool))); + if (enableIntermediateLines) + { + mDrawIntermediateLinesCheckBox = createPaletteButton(UBApplication::mainWindow->actionDrawIntermediateGridLines, this); + mDrawIntermediateLinesCheckBox->setFixedSize(24,24); + mDrawIntermediateLinesCheckBox->setCheckable(true); + mActions << UBApplication::mainWindow->actionDrawIntermediateGridLines; + mButtons.removeLast(); // don't add to button group + + connect(UBApplication::mainWindow->actionDrawIntermediateGridLines, SIGNAL(toggled(bool)), this, SLOT(toggleIntermediateLines(bool))); + } mBottomLayout->addSpacing(16); mBottomLayout->addWidget(mSliderLabel); mBottomLayout->addWidget(mSlider); mBottomLayout->addWidget(mResetDefaultGridSizeButton); mBottomLayout->addSpacing(16); - mBottomLayout->addWidget(mIntermediateLinesLabel); - mBottomLayout->addWidget(mDrawIntermediateLinesCheckBox); - mBottomLayout->addSpacing(16); + + if (enableIntermediateLines) + { + mBottomLayout->addWidget(mIntermediateLinesLabel); + mBottomLayout->addWidget(mDrawIntermediateLinesCheckBox); + mBottomLayout->addSpacing(16); + } updateLayout(); } @@ -149,7 +158,10 @@ void UBBackgroundPalette::showEvent(QShowEvent* event) connect(mSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int))); - mDrawIntermediateLinesCheckBox->setChecked(UBApplication::boardController->activeScene()->intermediateLines()); + if (UBSettings::settings()->enableIntermediateLines->get().toBool()) + { + mDrawIntermediateLinesCheckBox->setChecked(UBApplication::boardController->activeScene()->intermediateLines()); + } QWidget::showEvent(event); } diff --git a/src/tools/UBToolsManager.cpp b/src/tools/UBToolsManager.cpp index d041a0b4..74a9eb66 100644 --- a/src/tools/UBToolsManager.cpp +++ b/src/tools/UBToolsManager.cpp @@ -73,7 +73,8 @@ UBToolsManager::UBToolsManager(QObject *parent) axes.label = tr("Axes"); axes.version = "1.0"; mToolsIcon.insert(axes.id, ":/images/toolPalette/axesTool.png"); - mDescriptors << axes; +// disabled by default, added later in UBSettings:init if enabled +// mDescriptors << axes; compass.id = "openboardtool://compass"; diff --git a/src/tools/UBToolsManager.h b/src/tools/UBToolsManager.h index 5783080b..9f1dc594 100644 --- a/src/tools/UBToolsManager.h +++ b/src/tools/UBToolsManager.h @@ -83,6 +83,11 @@ class UBToolsManager : public QObject return UBToolDescriptor(); } + void addTool(const UBToolDescriptor& tool) + { + mDescriptors << tool; + } + UBToolDescriptor ruler; UBToolDescriptor axes; UBToolDescriptor protractor;