Disable axes and intermediate lines by default, capture axes

preferencesAboutTextFull
letsfindaway 3 years ago
parent 8060ff1b4e
commit e0c5832200
  1. 9
      src/core/UBSettings.cpp
  2. 3
      src/core/UBSettings.h
  3. 1
      src/domain/UBGraphicsScene.cpp
  4. 32
      src/gui/UBBackgroundPalette.cpp
  5. 3
      src/tools/UBToolsManager.cpp
  6. 5
      src/tools/UBToolsManager.h

@ -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);

@ -426,6 +426,9 @@ class UBSettings : public QObject
UBSetting* magnifierDrawingMode;
UBSetting* autoSaveInterval;
UBSetting* enableToolAxes;
UBSetting* enableIntermediateLines;
public slots:
void setPenWidthIndex(int index);

@ -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));

@ -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);
}

@ -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";

@ -83,6 +83,11 @@ class UBToolsManager : public QObject
return UBToolDescriptor();
}
void addTool(const UBToolDescriptor& tool)
{
mDescriptors << tool;
}
UBToolDescriptor ruler;
UBToolDescriptor axes;
UBToolDescriptor protractor;

Loading…
Cancel
Save