From c2cddc91e42768b67f93be0a51f5d9c1491248fd Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Fri, 18 May 2018 11:32:42 +0300 Subject: [PATCH] Brush maximum size to a custom setting --- apps/opencs/model/prefs/state.cpp | 2 ++ apps/opencs/view/widget/scenetooltexturebrush.cpp | 8 ++++++-- apps/opencs/view/widget/scenetooltexturebrush.hpp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 99cbd98db..6f64da72e 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -242,6 +242,8 @@ void CSMPrefs::State::declare() addValues (landeditOutsideCell); declareEnum ("outside-visible-landedit", "Handling land edit outside of visible cells", showAndLandEdit). addValues (landeditOutsideVisibleCell); + declareInt ("texturebrush-maximumsize", "Maximum texture brush size", 50). + setMin (1); declareCategory ("Key Bindings"); diff --git a/apps/opencs/view/widget/scenetooltexturebrush.cpp b/apps/opencs/view/widget/scenetooltexturebrush.cpp index 003ab12fd..76727a7a9 100644 --- a/apps/opencs/view/widget/scenetooltexturebrush.cpp +++ b/apps/opencs/view/widget/scenetooltexturebrush.cpp @@ -21,7 +21,9 @@ #include #include "scenetool.hpp" + #include "../../model/doc/document.hpp" +#include "../../model/prefs/state.hpp" #include "../../model/world/data.hpp" #include "../../model/world/idtable.hpp" #include "../../model/world/landtexture.hpp" @@ -33,11 +35,11 @@ CSVWidget::BrushSizeControls::BrushSizeControls(const QString &title, QWidget *p mBrushSizeSlider = new QSlider(Qt::Horizontal); mBrushSizeSlider->setTickPosition(QSlider::TicksBothSides); mBrushSizeSlider->setTickInterval(10); - mBrushSizeSlider->setRange(1, 50); + mBrushSizeSlider->setRange(1, CSMPrefs::get()["3D Scene Editing"]["texturebrush-maximumsize"].toInt()); mBrushSizeSlider->setSingleStep(1); mBrushSizeSpinBox = new QSpinBox; - mBrushSizeSpinBox->setRange(1, 50); + mBrushSizeSpinBox->setRange(1, CSMPrefs::get()["3D Scene Editing"]["texturebrush-maximumsize"].toInt()); mBrushSizeSpinBox->setSingleStep(1); mLayoutSliderSize = new QHBoxLayout; @@ -273,6 +275,8 @@ void CSVWidget::SceneToolTextureBrush::clicked (const QModelIndex& index) void CSVWidget::SceneToolTextureBrush::activate () { QPoint position = QCursor::pos(); + mTextureBrushWindow->mSizeSliders->mBrushSizeSlider->setRange(1, CSMPrefs::get()["3D Scene Editing"]["texturebrush-maximumsize"].toInt()); + mTextureBrushWindow->mSizeSliders->mBrushSizeSpinBox->setRange(1, CSMPrefs::get()["3D Scene Editing"]["texturebrush-maximumsize"].toInt()); mTextureBrushWindow->move (position); mTextureBrushWindow->show(); } diff --git a/apps/opencs/view/widget/scenetooltexturebrush.hpp b/apps/opencs/view/widget/scenetooltexturebrush.hpp index 1c0e0a334..33a6dc2de 100644 --- a/apps/opencs/view/widget/scenetooltexturebrush.hpp +++ b/apps/opencs/view/widget/scenetooltexturebrush.hpp @@ -30,9 +30,9 @@ namespace CSVWidget public: BrushSizeControls(const QString &title, QWidget *parent); QSlider *mBrushSizeSlider; + QSpinBox *mBrushSizeSpinBox; private: - QSpinBox *mBrushSizeSpinBox; QHBoxLayout *mLayoutSliderSize; };