add setting to not use the new secondary toolbars (user request)

This commit is contained in:
T1ti
2023-07-17 05:06:22 +02:00
parent a73947433e
commit e24a940ee8
8 changed files with 152 additions and 6 deletions

View File

@@ -242,6 +242,8 @@ void MapView::set_editing_mode(editing_mode mode)
_world->renderer()->getTerrainParamsUniformBlock()->draw_selection_overlay = false;
_minimap->use_selection(nullptr);
bool use_classic_ui = _settings->value("classicUI", true).toBool();
switch (mode)
{
case editing_mode::ground:
@@ -255,9 +257,20 @@ void MapView::set_editing_mode(editing_mode mode)
{
texturingTool->updateMaskImage();
}
if (_left_sec_toolbar->showUnpaintableChunk())
if (use_classic_ui)
{
_world->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = true;
if (texturingTool->show_unpaintable_chunks())
{
_world->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = true;
}
}
else
{
if (_left_sec_toolbar->showUnpaintableChunk())
{
_world->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = true;
}
}
break;
case editing_mode::mccv:
@@ -2266,6 +2279,7 @@ void MapView::setupHotkeys()
, [&]
{
_left_sec_toolbar->nextFlattenMode(this);
flattenTool->nextFlattenMode();
}
, [&] { return terrainMode == editing_mode::flatten_blur && !NOGGIT_CUR_ACTION; }
);
@@ -4485,6 +4499,8 @@ void MapView::draw_map()
{
doSelection(true);
}
bool classic_ui = _settings->value("classicUI", true).toBool();
bool show_unpaintable = classic_ui ? texturingTool->show_unpaintable_chunks() : _left_sec_toolbar->showUnpaintableChunk();
_world->renderer()->draw (
model_view()
@@ -4494,7 +4510,7 @@ void MapView::draw_map()
, terrainMode == editing_mode::mccv ? shaderTool->shaderColor() : cursor_color
, _cursorType
, radius
, _left_sec_toolbar->showUnpaintableChunk()
, show_unpaintable
, _left_sec_toolbar->drawOnlyInsideSphereLight()
, _left_sec_toolbar->drawWireframeSphereLight()
, _left_sec_toolbar->getAlphaSphereLight()

View File

@@ -4,6 +4,7 @@
#include <noggit/World.h>
#include <util/qt/overload.hpp>
#include <QtCore/QSettings>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QGridLayout>
@@ -78,6 +79,29 @@ namespace Noggit
layout->addWidget(settings_group);
QGroupBox* flatten_blur_group = new QGroupBox("Flatten/Blur", this);
flatten_blur_group->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
auto flatten_blur_layout = new QGridLayout(flatten_blur_group);
flatten_blur_layout->addWidget(_lock_up_checkbox = new QCheckBox(this), 0, 0);
flatten_blur_layout->addWidget(_lock_down_checkbox = new QCheckBox(this), 0, 1);
_lock_up_checkbox->setChecked(_flatten_mode.raise);
_lock_up_checkbox->setText("Raise");
_lock_up_checkbox->setToolTip("Raise the terrain when using the tool");
_lock_down_checkbox->setChecked(_flatten_mode.lower);
_lock_down_checkbox->setText("Lower");
_lock_down_checkbox->setToolTip("Lower the terrain when using the tool");
QSettings settings;
bool use_classic_ui = settings.value("classicUI", true).toBool();
if (use_classic_ui)
flatten_blur_group->show();
else
flatten_blur_group->hide();
layout->addWidget(flatten_blur_group);
QGroupBox* flatten_only_group = new QGroupBox("Flatten only", this);
auto flatten_only_layout = new QVBoxLayout(flatten_only_group);
@@ -142,6 +166,20 @@ namespace Noggit
}
);
connect(_lock_up_checkbox, &QCheckBox::stateChanged
, [&](int state)
{
_flatten_mode.raise = state;
}
);
connect(_lock_down_checkbox, &QCheckBox::stateChanged
, [&](int state)
{
_flatten_mode.lower = state;
}
);
connect ( _angle_slider, &QSlider::valueChanged
, [&] (int v)
{
@@ -230,6 +268,16 @@ namespace Noggit
}
}
void flatten_blur_tool::nextFlattenMode()
{
_flatten_mode.next();
QSignalBlocker const up_lock(_lock_up_checkbox);
QSignalBlocker const down_lock(_lock_down_checkbox);
_lock_up_checkbox->setChecked(_flatten_mode.raise);
_lock_down_checkbox->setChecked(_flatten_mode.lower);
}
void flatten_blur_tool::nextFlattenType()
{
_flatten_type = ( ++_flatten_type ) % eFlattenType_Count;

View File

@@ -27,6 +27,7 @@ namespace Noggit
void blur (World* world, glm::vec3 const& cursor_pos, float dt);
void nextFlattenType();
void nextFlattenMode();
void toggleFlattenAngle();
void toggleFlattenLock();
void lockPos (glm::vec3 const& cursor_pos);

View File

@@ -31,6 +31,7 @@ namespace Noggit
)
: QWidget(parent)
, _brush_level(255)
, _show_unpaintable_chunks(false)
, _spray_size(1.0f)
, _spray_pressure(2.0f)
, _anim_prop(true)
@@ -106,6 +107,16 @@ namespace Noggit
_brush_level_spin->setSingleStep(5);
slider_layout_right->addWidget(_brush_level_spin);
_show_unpaintable_chunks_cb = new QCheckBox("Show unpaintable chunks", tool_widget);
_show_unpaintable_chunks_cb->setChecked(false);
tool_layout->addWidget(_show_unpaintable_chunks_cb);
connect(_show_unpaintable_chunks_cb, &QCheckBox::toggled, [=](bool checked)
{
_map_view->getWorld()->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = checked;
_map_view->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
});
// spray
_spray_mode_group = new QGroupBox("Spray", tool_widget);
_spray_mode_group->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
@@ -235,6 +246,13 @@ namespace Noggit
}
);
connect(_show_unpaintable_chunks_cb, &QCheckBox::stateChanged
, [&](int state)
{
_show_unpaintable_chunks = state;
}
);
connect ( _spray_size_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
@@ -474,6 +492,11 @@ namespace Noggit
}
}
bool texturing_tool::show_unpaintable_chunks() const
{
return _show_unpaintable_chunks && _texturing_mode == texturing_mode::paint;
}
void texturing_tool::paint (World* world, glm::vec3 const& pos, float dt, scoped_blp_texture_reference texture)
{
if (TabletManager::instance()->isActive())
@@ -579,6 +602,7 @@ namespace Noggit
json["radius"] = _radius_slider->rawValue();
json["brush_level"] = _brush_level_spin->value();
json["texturing_mode"] = static_cast<int>(_texturing_mode);
json["show_unpaintable_chunks"] = _show_unpaintable_chunks_cb->isChecked();
json["anim"] = _anim_prop.get();
json["anim_speed"] = static_cast<int>(_anim_speed_prop.get());
@@ -613,6 +637,7 @@ namespace Noggit
_brush_level_spin->setValue(json["brush_level"].toInt());
tabs->setCurrentIndex(json["texturing_mode"].toInt());
_show_unpaintable_chunks_cb->setChecked(json["show_unpaintable_chunks"].toBool());
_anim_prop.set(json["anim"].toBool());
_anim_speed_prop.set(json["anim_speed"].toInt());

View File

@@ -45,6 +45,7 @@ namespace Noggit
float brush_radius() const;
float hardness() const;
bool show_unpaintable_chunks() const;
void set_brush_level (float level);
@@ -105,6 +106,7 @@ namespace Noggit
Brush _spray_brush;
int _brush_level;
bool _show_unpaintable_chunks;
float _spray_size;
float _spray_pressure;
@@ -123,6 +125,8 @@ namespace Noggit
Noggit::Ui::Tools::UiCommon::ExtendedSlider* _pressure_slider;
QSpinBox* _brush_level_spin;
QCheckBox* _show_unpaintable_chunks_cb;
QGroupBox* _spray_mode_group;
QWidget* _spray_content;
QCheckBox* _inner_radius_cb;

View File

@@ -4,6 +4,7 @@
#include <noggit/ui/tools/ActionHistoryNavigator/ActionHistoryNavigator.hpp>
#include <noggit/ui/FontAwesome.hpp>
#include <QSlider>
#include <QtCore/QSettings>
using namespace Noggit::Ui;
using namespace Noggit::Ui::Tools::ViewToolbar::Ui;
@@ -326,6 +327,9 @@ void ViewToolbar::setCurrentMode(MapView* mapView, editing_mode mode)
mapView->getLeftSecondaryToolbar()->hide();
current_mode = mode;
QSettings settings;
bool use_classic_ui = settings.value("classicUI", false).toBool();
switch (current_mode)
{
case editing_mode::ground:
@@ -334,14 +338,20 @@ void ViewToolbar::setCurrentMode(MapView* mapView, editing_mode mode)
if (_flatten_secondary_tool.size() > 0)
{
setupWidget(_flatten_secondary_tool);
mapView->getLeftSecondaryToolbar()->show();
if (!use_classic_ui)
mapView->getLeftSecondaryToolbar()->show();
else
mapView->getLeftSecondaryToolbar()->hide();
}
break;
case editing_mode::paint:
if (_texture_secondary_tool.size() > 0)
{
setupWidget(_texture_secondary_tool);
mapView->getLeftSecondaryToolbar()->show();
if (!use_classic_ui)
mapView->getLeftSecondaryToolbar()->show();
else
mapView->getLeftSecondaryToolbar()->hide();
}
break;
case editing_mode::object:

View File

@@ -194,6 +194,7 @@ namespace Noggit
ui->_uid_cb->setChecked(_settings->value("uid_startup_check", true).toBool());
ui->_systemWindowFrame->setChecked(_settings->value("systemWindowFrame", true).toBool());
ui->_nativeMenubar->setChecked(_settings->value("nativeMenubar", true).toBool());
ui->_classic_ui->setChecked(_settings->value("classicUI", false).toBool());
ui->_additional_file_loading_log->setChecked(
_settings->value("additional_file_loading_log", false).toBool());
ui->_keyboard_locale->setCurrentText(_settings->value("keyboard_locale", "QWERTY").toString());
@@ -278,6 +279,7 @@ namespace Noggit
_settings->setValue("keyboard_locale", ui->_keyboard_locale->currentText());
_settings->setValue("systemWindowFrame", ui->_systemWindowFrame->isChecked());
_settings->setValue("nativeMenubar", ui->_nativeMenubar->isChecked());
_settings->setValue("classicUI", ui->_classic_ui->isChecked());
#ifdef USE_MYSQL_UID_STORAGE
_settings->setValue ("project/mysql/enabled", ui->MySQL_box->isChecked());

View File

@@ -274,7 +274,7 @@
<item>
<widget class="QRadioButton" name="_systemWindowFrame">
<property name="toolTip">
<string>Turns on default system window frame instead of Noggit's styled one. Requires restart.</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Turns on default system window frame instead of Noggit's styled one. Requires restart.&lt;/p&gt;&lt;p&gt;Warning: Can cause crash.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>System window frame</string>
@@ -318,6 +318,46 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="_classic_ui">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Disable the new secondary toolbars and moves the settings back to the tool panels.&lt;/p&gt;&lt;p&gt; Requires restart.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Classic UI</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_23">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>