Update theme to project folder, fix widgets width and height, fix texturing b&w slider

This commit is contained in:
Balkron
2020-10-30 03:57:47 +05:00
parent b8854c3839
commit 2d3c96bcd3
48 changed files with 3332 additions and 2053 deletions

View File

@@ -1,351 +1,352 @@
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#include <noggit/ui/FlattenTool.hpp>
#include <noggit/World.h>
#include <util/qt/overload.hpp>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QRadioButton>
namespace noggit
{
namespace ui
{
flatten_blur_tool::flatten_blur_tool(QWidget* parent)
: QWidget(parent)
, _radius(10.0f)
, _speed(2.0f)
, _angle(45.0f)
, _orientation(0.0f)
, _flatten_type(eFlattenType_Linear)
, _flatten_mode(true, true)
{
setMinimumWidth(sizeHint().width());
auto layout (new QFormLayout (this));
_type_button_box = new QButtonGroup (this);
QRadioButton* radio_flat = new QRadioButton ("Flat");
QRadioButton* radio_linear = new QRadioButton ("Linear");
QRadioButton* radio_smooth = new QRadioButton ("Smooth");
QRadioButton* radio_origin = new QRadioButton ("Origin");
_type_button_box->addButton (radio_flat, (int)eFlattenType_Flat);
_type_button_box->addButton (radio_linear, (int)eFlattenType_Linear);
_type_button_box->addButton (radio_smooth, (int)eFlattenType_Smooth);
_type_button_box->addButton (radio_origin, (int)eFlattenType_Origin);
radio_linear->toggle();
QGroupBox* flatten_type_group (new QGroupBox ("Type", this));
QGridLayout* flatten_type_layout (new QGridLayout (flatten_type_group));
flatten_type_layout->addWidget (radio_flat, 0, 0);
flatten_type_layout->addWidget (radio_linear, 0, 1);
flatten_type_layout->addWidget (radio_smooth, 1, 0);
flatten_type_layout->addWidget (radio_origin, 1, 1);
layout->addRow (flatten_type_group);
_radius_spin = new QDoubleSpinBox (this);
_radius_spin->setRange (0.0f, 1000.0f);
_radius_spin->setDecimals (2);
_radius_spin->setValue (_radius);
layout->addRow ("Radius:", _radius_spin);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_radius_slider->setRange (0, 1000);
_radius_slider->setSliderPosition (_radius);
layout->addRow (_radius_slider);
_speed_spin = new QDoubleSpinBox (this);
_speed_spin->setRange (0.0f, 10.0f);
_speed_spin->setDecimals (2);
_speed_spin->setValue (_speed);
layout->addRow ("Speed:", _speed_spin);
_speed_slider = new QSlider (Qt::Orientation::Horizontal, this);
_speed_slider->setRange (0, 10 * 100);
_speed_slider->setSingleStep (50);
_speed_slider->setSliderPosition (_speed * 100);
layout->addRow(_speed_slider);
QGroupBox* flatten_blur_group = new QGroupBox("Flatten/Blur", this);
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");
layout->addRow(flatten_blur_group);
QGroupBox* flatten_only_group = new QGroupBox("Flatten only", this);
auto flatten_only_layout = new QFormLayout(flatten_only_group);
_angle_group = new QGroupBox("Angled mode", this);
_angle_group->setCheckable(true);
_angle_group->setChecked(false);
QGridLayout* angle_layout(new QGridLayout(_angle_group));
angle_layout->addWidget(_orientation_dial = new QDial(this), 0, 0);
_orientation_dial->setRange(0, 360);
_orientation_dial->setWrapping(true);
_orientation_dial->setSliderPosition(_orientation - 90); // to get ingame orientation
_orientation_dial->setToolTip("Orientation");
_orientation_dial->setSingleStep(10);
_angle_slider = new QSlider(this);
_angle_slider->setRange(0, 89);
_angle_slider->setSliderPosition(_angle);
_angle_slider->setToolTip("Angle");
_angle_slider->setMinimumHeight(80);
angle_layout->addWidget(_angle_slider, 0, 1);
flatten_only_layout->addRow(_angle_group);
_lock_group = new QGroupBox("Lock mode", this);
_lock_group->setCheckable(true);
_lock_group->setChecked(false);
QFormLayout* lock_layout(new QFormLayout(_lock_group));
lock_layout->addRow("X:", _lock_x = new QDoubleSpinBox(this));
lock_layout->addRow("Z:", _lock_z = new QDoubleSpinBox(this));
lock_layout->addRow("H:", _lock_h = new QDoubleSpinBox(this));
_lock_x->setRange(0.0, 34133.0);
_lock_x->setDecimals(3);
_lock_z->setRange(0.0, 34133.0);
_lock_z->setDecimals(3);
_lock_h->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
_lock_h->setDecimals(3);
_lock_h->setMinimumWidth(30);
flatten_only_layout->addRow(_lock_group);
layout->addRow(flatten_only_group);
connect ( _type_button_box, qOverload<int> (&QButtonGroup::buttonClicked)
, [&] (int id)
{
_flatten_type = id;
}
);
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_radius = v;
QSignalBlocker const blocker(_radius_slider);
_radius_slider->setSliderPosition ((int)std::round (v));
}
);
connect ( _radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_radius = v;
QSignalBlocker const blocker(_radius_spin);
_radius_spin->setValue(v);
}
);
connect ( _speed_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_speed = v;
QSignalBlocker const blocker(_speed_slider);
_speed_slider->setSliderPosition ((int)std::round (v * 100.0f));
}
);
connect ( _speed_slider, &QSlider::valueChanged
, [&] (int v)
{
_speed = v / 100.0f;
QSignalBlocker const blocker(_speed_spin);
_speed_spin->setValue (_speed);
}
);
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)
{
_angle = v;
}
);
connect ( _orientation_dial, &QDial::valueChanged
, [this] (int v)
{
setOrientation(v + 90.0f);
}
);
connect ( _lock_x, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_lock_pos.x = v;
}
);
connect ( _lock_h, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_lock_pos.y = v;
}
);
connect ( _lock_z, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_lock_pos.z = v;
}
);
}
void flatten_blur_tool::flatten (World* world, math::vector_3d const& cursor_pos, float dt)
{
world->flattenTerrain ( cursor_pos
, 1.f - pow (0.5f, dt *_speed)
, _radius
, _flatten_type
, _flatten_mode
, use_ref_pos() ? _lock_pos : cursor_pos
, math::degrees (angled_mode() ? _angle : 0.0f)
, math::degrees (angled_mode() ? _orientation : 0.0f)
);
}
void flatten_blur_tool::blur (World* world, math::vector_3d const& cursor_pos, float dt)
{
world->blurTerrain ( cursor_pos
, 1.f - pow (0.5f, dt * _speed)
, _radius
, _flatten_type
, _flatten_mode
);
}
void flatten_blur_tool::nextFlattenType()
{
_flatten_type = ( ++_flatten_type ) % eFlattenType_Count;
_type_button_box->button (_flatten_type)->toggle();
}
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::toggleFlattenAngle()
{
_angle_group->setChecked(!angled_mode());
}
void flatten_blur_tool::toggleFlattenLock()
{
_lock_group->setChecked(!use_ref_pos());
}
void flatten_blur_tool::lockPos (math::vector_3d const& cursor_pos)
{
_lock_pos = cursor_pos;
_lock_x->setValue (_lock_pos.x);
_lock_h->setValue (_lock_pos.y);
_lock_z->setValue (_lock_pos.z);
if (!use_ref_pos())
{
toggleFlattenLock();
}
}
void flatten_blur_tool::changeRadius(float change)
{
_radius_spin->setValue (_radius + change);
}
void flatten_blur_tool::changeSpeed(float change)
{
_speed_spin->setValue(_speed + change);
}
void flatten_blur_tool::setSpeed(float speed)
{
_speed_spin->setValue(speed);
}
void flatten_blur_tool::changeOrientation(float change)
{
setOrientation(_orientation + change);
}
void flatten_blur_tool::setOrientation (float orientation)
{
QSignalBlocker const blocker (_orientation_dial);
_orientation = orientation;
while (_orientation >= 360.0f)
{
_orientation -= 360.0f;
}
while (_orientation < 0.0f)
{
_orientation += 360.0f;
}
_orientation_dial->setSliderPosition(_orientation - 90.0f);
}
void flatten_blur_tool::changeAngle(float change)
{
_angle = std::min(89.0f, std::max(0.0f, _angle + change));
_angle_slider->setSliderPosition(_angle);
}
void flatten_blur_tool::changeHeight(float change)
{
_lock_h->setValue(_lock_pos.y + change);
}
void flatten_blur_tool::setRadius(float radius)
{
_radius_spin->setValue(radius);
}
QSize flatten_blur_tool::sizeHint() const
{
return QSize(215, height());
}
}
}
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#include <noggit/ui/FlattenTool.hpp>
#include <noggit/World.h>
#include <util/qt/overload.hpp>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QRadioButton>
namespace noggit
{
namespace ui
{
flatten_blur_tool::flatten_blur_tool(QWidget* parent)
: QWidget(parent)
, _radius(10.0f)
, _speed(2.0f)
, _angle(45.0f)
, _orientation(0.0f)
, _flatten_type(eFlattenType_Linear)
, _flatten_mode(true, true)
{
setMinimumWidth(250);
setMaximumWidth(250);
auto layout (new QFormLayout (this));
_type_button_box = new QButtonGroup (this);
QRadioButton* radio_flat = new QRadioButton ("Flat");
QRadioButton* radio_linear = new QRadioButton ("Linear");
QRadioButton* radio_smooth = new QRadioButton ("Smooth");
QRadioButton* radio_origin = new QRadioButton ("Origin");
_type_button_box->addButton (radio_flat, (int)eFlattenType_Flat);
_type_button_box->addButton (radio_linear, (int)eFlattenType_Linear);
_type_button_box->addButton (radio_smooth, (int)eFlattenType_Smooth);
_type_button_box->addButton (radio_origin, (int)eFlattenType_Origin);
radio_linear->toggle();
QGroupBox* flatten_type_group (new QGroupBox ("Type", this));
QGridLayout* flatten_type_layout (new QGridLayout (flatten_type_group));
flatten_type_layout->addWidget (radio_flat, 0, 0);
flatten_type_layout->addWidget (radio_linear, 0, 1);
flatten_type_layout->addWidget (radio_smooth, 1, 0);
flatten_type_layout->addWidget (radio_origin, 1, 1);
layout->addRow (flatten_type_group);
_radius_spin = new QDoubleSpinBox (this);
_radius_spin->setRange (0.0f, 1000.0f);
_radius_spin->setDecimals (2);
_radius_spin->setValue (_radius);
layout->addRow ("Radius:", _radius_spin);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_radius_slider->setRange (0, 1000);
_radius_slider->setSliderPosition (_radius);
layout->addRow (_radius_slider);
_speed_spin = new QDoubleSpinBox (this);
_speed_spin->setRange (0.0f, 10.0f);
_speed_spin->setDecimals (2);
_speed_spin->setValue (_speed);
layout->addRow ("Speed:", _speed_spin);
_speed_slider = new QSlider (Qt::Orientation::Horizontal, this);
_speed_slider->setRange (0, 10 * 100);
_speed_slider->setSingleStep (50);
_speed_slider->setSliderPosition (_speed * 100);
layout->addRow(_speed_slider);
QGroupBox* flatten_blur_group = new QGroupBox("Flatten/Blur", this);
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");
layout->addRow(flatten_blur_group);
QGroupBox* flatten_only_group = new QGroupBox("Flatten only", this);
auto flatten_only_layout = new QFormLayout(flatten_only_group);
_angle_group = new QGroupBox("Angled mode", this);
_angle_group->setCheckable(true);
_angle_group->setChecked(false);
QGridLayout* angle_layout(new QGridLayout(_angle_group));
angle_layout->addWidget(_orientation_dial = new QDial(this), 0, 0);
_orientation_dial->setRange(0, 360);
_orientation_dial->setWrapping(true);
_orientation_dial->setSliderPosition(_orientation - 90); // to get ingame orientation
_orientation_dial->setToolTip("Orientation");
_orientation_dial->setSingleStep(10);
_angle_slider = new QSlider(this);
_angle_slider->setRange(0, 89);
_angle_slider->setSliderPosition(_angle);
_angle_slider->setToolTip("Angle");
_angle_slider->setMinimumHeight(80);
angle_layout->addWidget(_angle_slider, 0, 1);
flatten_only_layout->addRow(_angle_group);
_lock_group = new QGroupBox("Lock mode", this);
_lock_group->setCheckable(true);
_lock_group->setChecked(false);
QFormLayout* lock_layout(new QFormLayout(_lock_group));
lock_layout->addRow("X:", _lock_x = new QDoubleSpinBox(this));
lock_layout->addRow("Z:", _lock_z = new QDoubleSpinBox(this));
lock_layout->addRow("H:", _lock_h = new QDoubleSpinBox(this));
_lock_x->setRange(0.0, 34133.0);
_lock_x->setDecimals(3);
_lock_z->setRange(0.0, 34133.0);
_lock_z->setDecimals(3);
_lock_h->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
_lock_h->setDecimals(3);
_lock_h->setMinimumWidth(30);
flatten_only_layout->addRow(_lock_group);
layout->addRow(flatten_only_group);
connect ( _type_button_box, qOverload<int> (&QButtonGroup::buttonClicked)
, [&] (int id)
{
_flatten_type = id;
}
);
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_radius = v;
QSignalBlocker const blocker(_radius_slider);
_radius_slider->setSliderPosition ((int)std::round (v));
}
);
connect ( _radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_radius = v;
QSignalBlocker const blocker(_radius_spin);
_radius_spin->setValue(v);
}
);
connect ( _speed_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_speed = v;
QSignalBlocker const blocker(_speed_slider);
_speed_slider->setSliderPosition ((int)std::round (v * 100.0f));
}
);
connect ( _speed_slider, &QSlider::valueChanged
, [&] (int v)
{
_speed = v / 100.0f;
QSignalBlocker const blocker(_speed_spin);
_speed_spin->setValue (_speed);
}
);
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)
{
_angle = v;
}
);
connect ( _orientation_dial, &QDial::valueChanged
, [this] (int v)
{
setOrientation(v + 90.0f);
}
);
connect ( _lock_x, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_lock_pos.x = v;
}
);
connect ( _lock_h, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_lock_pos.y = v;
}
);
connect ( _lock_z, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_lock_pos.z = v;
}
);
}
void flatten_blur_tool::flatten (World* world, math::vector_3d const& cursor_pos, float dt)
{
world->flattenTerrain ( cursor_pos
, 1.f - pow (0.5f, dt *_speed)
, _radius
, _flatten_type
, _flatten_mode
, use_ref_pos() ? _lock_pos : cursor_pos
, math::degrees (angled_mode() ? _angle : 0.0f)
, math::degrees (angled_mode() ? _orientation : 0.0f)
);
}
void flatten_blur_tool::blur (World* world, math::vector_3d const& cursor_pos, float dt)
{
world->blurTerrain ( cursor_pos
, 1.f - pow (0.5f, dt * _speed)
, _radius
, _flatten_type
, _flatten_mode
);
}
void flatten_blur_tool::nextFlattenType()
{
_flatten_type = ( ++_flatten_type ) % eFlattenType_Count;
_type_button_box->button (_flatten_type)->toggle();
}
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::toggleFlattenAngle()
{
_angle_group->setChecked(!angled_mode());
}
void flatten_blur_tool::toggleFlattenLock()
{
_lock_group->setChecked(!use_ref_pos());
}
void flatten_blur_tool::lockPos (math::vector_3d const& cursor_pos)
{
_lock_pos = cursor_pos;
_lock_x->setValue (_lock_pos.x);
_lock_h->setValue (_lock_pos.y);
_lock_z->setValue (_lock_pos.z);
if (!use_ref_pos())
{
toggleFlattenLock();
}
}
void flatten_blur_tool::changeRadius(float change)
{
_radius_spin->setValue (_radius + change);
}
void flatten_blur_tool::changeSpeed(float change)
{
_speed_spin->setValue(_speed + change);
}
void flatten_blur_tool::setSpeed(float speed)
{
_speed_spin->setValue(speed);
}
void flatten_blur_tool::changeOrientation(float change)
{
setOrientation(_orientation + change);
}
void flatten_blur_tool::setOrientation (float orientation)
{
QSignalBlocker const blocker (_orientation_dial);
_orientation = orientation;
while (_orientation >= 360.0f)
{
_orientation -= 360.0f;
}
while (_orientation < 0.0f)
{
_orientation += 360.0f;
}
_orientation_dial->setSliderPosition(_orientation - 90.0f);
}
void flatten_blur_tool::changeAngle(float change)
{
_angle = std::min(89.0f, std::max(0.0f, _angle + change));
_angle_slider->setSliderPosition(_angle);
}
void flatten_blur_tool::changeHeight(float change)
{
_lock_h->setValue(_lock_pos.y + change);
}
void flatten_blur_tool::setRadius(float radius)
{
_radius_spin->setValue(radius);
}
QSize flatten_blur_tool::sizeHint() const
{
return QSize(215, height());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,53 +1,56 @@
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#include "hole_tool.hpp"
#include <cmath>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QFormLayout>
namespace noggit
{
namespace ui
{
hole_tool::hole_tool(QWidget* parent) : QWidget(parent)
{
auto layout = new QFormLayout(this);
_radius_spin = new QDoubleSpinBox (this);
_radius_spin->setRange (0.0f, 250.0f);
_radius_spin->setDecimals (2);
_radius_spin->setValue (_radius);
layout->addRow ("Radius:", _radius_spin);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_radius_slider->setRange (0, 250);
_radius_slider->setSliderPosition (_radius);
layout->addRow (_radius_slider);
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_radius = v;
QSignalBlocker const blocker(_radius_slider);
_radius_slider->setSliderPosition ((int)std::round (v));
}
);
connect ( _radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_radius = v;
QSignalBlocker const blocker(_radius_spin);
_radius_spin->setValue(v);
}
);
}
void hole_tool::changeRadius(float change)
{
_radius_spin->setValue (_radius + change);
}
}
}
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#include "hole_tool.hpp"
#include <cmath>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QFormLayout>
namespace noggit
{
namespace ui
{
hole_tool::hole_tool(QWidget* parent) : QWidget(parent)
{
auto layout = new QFormLayout(this);
_radius_spin = new QDoubleSpinBox (this);
_radius_spin->setRange (0.0f, 250.0f);
_radius_spin->setDecimals (2);
_radius_spin->setValue (_radius);
layout->addRow ("Radius:", _radius_spin);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_radius_slider->setRange (0, 250);
_radius_slider->setSliderPosition (_radius);
layout->addRow (_radius_slider);
setMinimumWidth(250);
setMaximumWidth(250);
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_radius = v;
QSignalBlocker const blocker(_radius_slider);
_radius_slider->setSliderPosition ((int)std::round (v));
}
);
connect ( _radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_radius = v;
QSignalBlocker const blocker(_radius_spin);
_radius_spin->setValue(v);
}
);
}
void hole_tool::changeRadius(float change)
{
_radius_spin->setValue (_radius + change);
}
}
}

View File

@@ -177,8 +177,8 @@ namespace noggit
connect (color_wheel, &color_widgets::ColorWheel::colorChanged, color_picker, &color_widgets::ColorSelector::setColor);
setMinimumWidth(sizeHint().width());
setMinimumWidth(250);
setMaximumWidth(250);
}
void shader_tool::changeShader

View File

@@ -0,0 +1,635 @@
$light = #504d55;
$half_light = #383440;
$base = #2e2b35;
$half_dark = #28252e;
$dark = #24222a;
$highlight = #be3b29;
$hover = #ffffff;
$text = #d7d7d7;
$disabled = #7f7f7f;
QWidget {
background: $base;
border: none;
color: $text;
outline: 0;
}
QWidget:disabled {
color: $disabled;
outline: none;
}
QDockWidget::title {
background: $base;
padding-left: 12px;
}
QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid $base;
background: $light;
}
QMenu {
background-color: $base; /* sets background of the menu */
border: none;
}
QMenu::item {
/* sets background of menu item. set this to something non-transparent
if you want menu color and menu item color to be different */
background-color: transparent;
}
QMenu::item:selected { /* when user selects item using mouse or keyboard */
background-color: $light;
}
QMenu::separator {
height: 1px;
background: $light;
}
QMenuBar {
background-color: $base;
}
QMenuBar::item {
padding: 1px 10px;
}
QMenuBar::item:selected { /* when selected using mouse or keyboard */
background: $light;
}
QMenuBar::item:pressed {
background: $half_dark;
}
QToolBar {
background: $base;
spacing: 3px; /* spacing between items in the tool bar */
min-height: 42px;
min-width: 42px;
}
QToolBar::separator {
background: $half_light;
width: 2px;
}
QToolBar::handle:horizontal {
border-left: 2px solid $half_light;
border-right: 2px solid $half_light;
width: 2px;
background: $half_dark;
margin-left: 4px;
margin-right: 4px;
}
QToolBar::handle:vertical {
border-top: 2px solid $half_light;
border-bottom: 2px solid $half_light;
height: 2px;
background: $half_dark;
margin-top: 4px;
margin-bottom: 4px;
}
QLineEdit {
color: $text;
padding: 0 8px;
background: $half_dark;
selection-background-color: $highlight;
}
QLineEdit:read-only {
background: $base;
}
QFrame {
background: $half_dark;
}
QLabel {
background: transparent;
padding: 2px 4px;
}
QGroupBox QLabel:disabled {
color: $disabled;
position: absolute;
top: 0px;
left: 0px;
}
QGroupBox::indicator {
width: 14px;
height: 14px;
margin-top: 1px;
}
QGroupBox::indicator:unchecked {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_unchecked.png);
}
QGroupBox::indicator:unchecked:hover {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_unchecked_hover.png);
}
QGroupBox::indicator:checked {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_checked.png);
}
QGroupBox::indicator:checked:hover {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_checked_hover.png);
}
QGroupBox {
font-weight: bold;
border: 1px solid $half_light;
padding-top: 22px;
padding-left: 12px;
padding-right: 12px;
padding-bottom: 4px;
outline: none;
}
QGroupBox::title {
background: none;
border-bottom: 1px solid $highlight;
border-top: 1px solid $half_light;
color: $text;
subcontrol-origin: margin;
subcontrol-position: top center;
padding: 4px 0px;
spacing: 8px;
}
QTabBar::tab {
background: $half_light;
border: 1px solid $base;
border-bottom: none;
padding: 4px 10px;
min-width: 55px;
}
QTabBar::tab:left, QTabBar::tab:right {
min-width: 15px;
min-height: 35px;
padding: 4px 6px;
}
QTabBar::tab:left:selected {
border: none;
border-left: 3px solid $highlight;
}
QTabBar::tab:left:selected:hover {
border: none;
border-left: 3px solid $highlight;
}
QTabBar::tab:left:hover {
border: none;
border-left: 1px solid $highlight;
}
QTabBar::tab:right:selected {
border: none;
border-right: 3px solid $highlight;
}
QTabBar::tab:right:selected:hover {
border: none;
border-right: 3px solid $highlight;
}
QTabBar::tab:right:hover {
border: none;
border-right: 1px solid $highlight;
}
QTabBar::tab:hover {
background: $light;
border-top: 1px solid $highlight;
}
QTabBar::tab:selected {
background: $base;
border-top: 3px solid $highlight;
}
QCheckBox {
spacing: 8px;
}
QCheckBox:hover {
color: $hover;
}
QCheckBox::indicator {
width: 16px;
height: 16px;
}
QCheckBox::indicator:unchecked {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_unchecked.png);
}
QCheckBox::indicator:unchecked:hover {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_unchecked_hover.png);
}
QCheckBox::indicator:unchecked:disabled {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_unchecked_disabled.png);
}
QCheckBox::indicator:checked {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_checked.png);
}
QCheckBox::indicator:checked:hover {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_checked_hover.png);
}
QCheckBox::indicator:checked:disabled {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_checked_disabled.png);
}
QCheckBox::indicator:indeterminate {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_checkbox_checked.png);
}
QRadioButton {
spacing: 8px;
}
QRadioButton::indicator {
width: 16px;
height: 16px;
}
QRadioButton:hover {
color: $hover;
}
QRadioButton::indicator::unchecked {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_radiobutton_unchecked.png);
}
QRadioButton::indicator:unchecked:hover {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_radiobutton_unchecked_hover.png);
}
QRadioButton::indicator:unchecked:disabled {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_radiobutton_unchecked_disabled.png);
}
QRadioButton::indicator:checked {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_radiobutton_checked.png);
}
QRadioButton::indicator:checked:hover {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_radiobutton_checked_hover.png);
}
QRadioButton::indicator:checked:disabled {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_radiobutton_checked_disabled.png);
}
QScrollBar:horizontal {
background: $half_dark;
height: 16px;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal, QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: $half_dark;
}
QScrollBar::handle:horizontal {
background: $light;
border: 1px solid $half_light;
border-radius: 8px;
min-width: 20px;
}
QScrollBar:vertical {
background: $half_dark;
width: 16px;
}
QScrollBar::handle:vertical {
background: $light;
border: 1px solid $half_light;
border-radius: 8px;
min-height: 20px;
}
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {
width: 0px;
}
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
height: 0px;
}
QToolButton {
background-color: $base;
border: 1px solid transparent;
padding: 0px;
width: 30px;
height: 30px;
color: $text;
}
QToolButton:hover {
background-color: $half_light;
border: 1px solid $light;
}
QToolButton:pressed {
background-color: $half_dark;
border: 1px solid $half_light;
}
QToolButton:selected {
background-color: $half_dark;
border: 1px solid $half_light;
}
QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
min-width: 60px;
padding-right: 26px; /* make way for the popup button */
padding-left: 4px;
padding-top: 2px;
padding-bottom: 2px;
}
/* the subcontrols below are used only in the MenuButtonPopup mode */
QToolButton::menu-button {
border: 1px solid $half_light;
width: 20px;
}
QToolButton::menu-button:hover {
border: 1px solid $light;
}
QDialogButtonBox QPushButton {
padding: 6px 26px;
}
/*QDialogButtonBox {
min-width: 250px;
min-height: 35px;
}*/
QPushButton {
background-color: $half_light;
border: 1px solid $light;
border-radius: 1px;
padding: 6px 6px;
}
QPushButton:hover {
background-color: $light;
}
QPushButton:pressed {
background-color: $half_dark;
}
QPushButton:disabled {
background-color: $half_dark;
color: $light;
}
QAbstractSpinBox {
padding-right: 15px; /* make room for the arrows */
background: $half_dark;
}
QAbstractSpinBox::up-button {
subcontrol-origin: border;
subcontrol-position: top right; /* position at the top right corner */
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/spinup.png) 1;
}
QAbstractSpinBox::up-button:pressed, QAbstractSpinBox::up-button:off {
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/spinup_pressed.png) 1;
}
QAbstractSpinBox::up-button:disabled {
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/spinup_disabled.png) 1;
}
QAbstractSpinBox::up-arrow {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/up_arrow.png);
}
QAbstractSpinBox::up-arrow:disabled, QAbstractSpinBox::up-arrow:off { /* off state when value is max */
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/down_arrow_disabled.png);
}
QAbstractSpinBox::down-button {
subcontrol-origin: border;
subcontrol-position: bottom right; /* position at bottom right corner */
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/spindown.png) 1;
}
QAbstractSpinBox::down-button:pressed, QAbstractSpinBox::down-button:off {
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/spindown_pressed.png) 1;
}
QAbstractSpinBox::down-button:disabled {
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/spindown_disabled.png) 1;
}
QAbstractSpinBox::down-arrow {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/down_arrow.png);
}
QAbstractSpinBox::down-arrow:disabled, QAbstractSpinBox::down-arrow:off { /* off state when value in min */
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/up_arrow_disabled.png);
}
QComboBox {
border: none;
padding: 3px 18px 3px 6px;
min-width: 6em;
}
QComboBox:editable {
background: $half_dark;
}
QComboBox:!editable, QComboBox::drop-down:editable {
background: $half_light;
}
/* QComboBox gets the "on" state when the popup is open */
QComboBox:!editable:on, QComboBox::drop-down:editable:on {
background: $light;
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 18px;
border: none;
}
QComboBox::down-arrow {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/down_arrow.png);
}
QSlider::groove:horizontal {
height: 6px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: $half_dark;
border: 1px solid $half_light;
}
QSlider::handle:horizontal {
background: $highlight;
width: 7px;
margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 2px;
border: 1px solid $half_dark;
}
QSlider::add-page:horizontal {
background: $half_dark;
border: 1px solid $half_light;
}
QSlider::sub-page:horizontal {
background-color: qlineargradient(x0:0, y0:0, x1:1, y1:0, stop:0 $highlight, stop:1 $base);
border: 1px solid $half_light;
}
QSlider::groove:vertical {
width: 6px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: $half_dark;
border: 1px solid $half_light;
}
QSlider::handle:vertical {
background: $highlight;
height: 7px;
margin: 0 -5px; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 2px;
border: 1px solid $half_dark;
}
QSlider::add-page:vertical {
background: $half_dark;
border: 1px solid $half_light;
}
QSlider::sub-page:vertical {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 $base, stop:1 $highlight);
border: 1px solid $half_light;
}
QStatusBar {
background: $base;
}
QStatusBar::item {
border-left: 1px solid $half_light;
}
QTableView {
color: $disabled;
background-color: $half_dark;
selection-color: $text;
selection-background-color: $half_light;
gridline-color: $light;
}
QTableView QTableCornerButton::section {
background: $half_light;
border-style: solid;
border-bottom: 1px solid $light;
border-right: 1px solid $light;
}
QHeaderView::section {
background-color: $half_light;
color: white;
padding: 0px 4px;
border-style: solid;
border-right: 1px solid $light;
border-bottom: 1px solid $light;
}
QHeaderView::section:checked
{
background-color: $light;
}
/* style the sort indicator */
QHeaderView::down-arrow {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/down_arrow.png);
}
QHeaderView::up-arrow {
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/up_arrow.png);
}
QProgressBar {
border: 1px solid $half_light;
border-radius: 2px;
text-align: center;
background-color: $half_dark;
}
QProgressBar::chunk {
background-color: $highlight;
width: 1px;
}
QTreeView::branch:has-siblings:!adjoins-item {
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/vline.png) 0;
}
QTreeView::branch:has-siblings:adjoins-item {
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_branch_more.png) 0;
}
QTreeView::branch:!has-children:!has-siblings:adjoins-item {
border-image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_branch_end.png) 0;
}
QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings {
border-image: none;
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_branch_closed.png);
}
QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings {
border-image: none;
image: url(C:/Work/NoggitRed/binaries/bin/Release/themes/dark/images/icon_branch_open.png);
}
/*======================================*/
QListView {
border: none;
outline: none;
}
QListView::item {
background-color: $half_dark;
min-height: 18px;
}
QListView::item:alternate {
background: $dark;
}
QListView::item:selected {
background: $highlight;
}
/*=======================================*/
color_widgets--ColorSelector {
min-width: 100px;
max-height: 30px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,621 @@
QWidget {
background: #2e2b35;
border: none;
color: #d7d7d7;
outline: 0;
}
QWidget:disabled {
color: #7f7f7f;
outline: none;
}
QDockWidget::title {
background: #2e2b35;
padding-left: 12px;
}
QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid #2e2b35;
background: #504d55;
}
QMenu {
background-color: #2e2b35; /* sets background of the menu */
border: none;
}
QMenu::item {
/* sets background of menu item. set this to something non-transparent
if you want menu color and menu item color to be different */
background-color: transparent;
}
QMenu::item:selected { /* when user selects item using mouse or keyboard */
background-color: #504d55;
}
QMenu::separator {
height: 1px;
background: #504d55;
}
QMenuBar {
background-color: #2e2b35;
}
QMenuBar::item {
padding: 1px 10px;
}
QMenuBar::item:selected { /* when selected using mouse or keyboard */
background: #504d55;
}
QMenuBar::item:pressed {
background: #28252e;
}
QToolBar {
background: #2e2b35;
spacing: 3px; /* spacing between items in the tool bar */
min-height: 42px;
min-width: 42px;
}
QToolBar::separator {
background: #383440;
width: 2px;
}
QToolBar::handle:horizontal {
border-left: 2px solid #383440;
border-right: 2px solid #383440;
width: 2px;
background: #28252e;
margin-left: 4px;
margin-right: 4px;
}
QToolBar::handle:vertical {
border-top: 2px solid #383440;
border-bottom: 2px solid #383440;
height: 2px;
background: #28252e;
margin-top: 4px;
margin-bottom: 4px;
}
QLineEdit {
color: #d7d7d7;
padding: 0 8px;
background: #28252e;
selection-background-color: #be3b29;
}
QLineEdit:read-only {
background: #2e2b35;
}
QFrame {
background: #28252e;
}
QLabel {
background: transparent;
padding: 2px 4px;
}
QGroupBox QLabel:disabled {
color: #7f7f7f;
position: absolute;
top: 0px;
left: 0px;
}
QGroupBox::indicator {
width: 14px;
height: 14px;
margin-top: 1px;
}
QGroupBox::indicator:unchecked {
image: url(themes/dark/images/icon_checkbox_unchecked.png);
}
QGroupBox::indicator:unchecked:hover {
image: url(themes/dark/images/icon_checkbox_unchecked_hover.png);
}
QGroupBox::indicator:checked {
image: url(themes/dark/images/icon_checkbox_checked.png);
}
QGroupBox::indicator:checked:hover {
image: url(themes/dark/images/icon_checkbox_checked_hover.png);
}
QGroupBox {
font-weight: bold;
border: 1px solid #383440;
padding-top: 22px;
padding-left: 12px;
padding-right: 12px;
padding-bottom: 4px;
outline: none;
}
QGroupBox::title {
background: none;
border-bottom: 1px solid #be3b29;
border-top: 1px solid #383440;
color: #d7d7d7;
subcontrol-origin: margin;
subcontrol-position: top center;
padding: 4px 0px;
spacing: 8px;
}
QTabBar::tab {
background: #383440;
border: 1px solid #2e2b35;
border-bottom: none;
padding: 4px 10px;
min-width: 55px;
}
QTabBar::tab:left, QTabBar::tab:right {
min-width: 15px;
min-height: 35px;
padding: 4px 6px;
}
QTabBar::tab:left:selected {
border: none;
border-left: 3px solid #be3b29;
}
QTabBar::tab:left:selected:hover {
border: none;
border-left: 3px solid #be3b29;
}
QTabBar::tab:left:hover {
border: none;
border-left: 1px solid #be3b29;
}
QTabBar::tab:right:selected {
border: none;
border-right: 3px solid #be3b29;
}
QTabBar::tab:right:selected:hover {
border: none;
border-right: 3px solid #be3b29;
}
QTabBar::tab:right:hover {
border: none;
border-right: 1px solid #be3b29;
}
QTabBar::tab:hover {
background: #504d55;
border-top: 1px solid #be3b29;
}
QTabBar::tab:selected {
background: #2e2b35;
border-top: 3px solid #be3b29;
}
QCheckBox {
spacing: 8px;
}
QCheckBox:hover {
color: #ffffff;
}
QCheckBox::indicator {
width: 16px;
height: 16px;
}
QCheckBox::indicator:unchecked {
image: url(themes/dark/images/icon_checkbox_unchecked.png);
}
QCheckBox::indicator:unchecked:hover {
image: url(themes/dark/images/icon_checkbox_unchecked_hover.png);
}
QCheckBox::indicator:unchecked:disabled {
image: url(themes/dark/images/icon_checkbox_unchecked_disabled.png);
}
QCheckBox::indicator:checked {
image: url(themes/dark/images/icon_checkbox_checked.png);
}
QCheckBox::indicator:checked:hover {
image: url(themes/dark/images/icon_checkbox_checked_hover.png);
}
QCheckBox::indicator:checked:disabled {
image: url(themes/dark/images/icon_checkbox_checked_disabled.png);
}
QCheckBox::indicator:indeterminate {
image: url(themes/dark/images/icon_checkbox_checked.png);
}
QRadioButton {
spacing: 8px;
}
QRadioButton::indicator {
width: 16px;
height: 16px;
}
QRadioButton:hover {
color: #ffffff;
}
QRadioButton::indicator::unchecked {
image: url(themes/dark/images/icon_radiobutton_unchecked.png);
}
QRadioButton::indicator:unchecked:hover {
image: url(themes/dark/images/icon_radiobutton_unchecked_hover.png);
}
QRadioButton::indicator:unchecked:disabled {
image: url(themes/dark/images/icon_radiobutton_unchecked_disabled.png);
}
QRadioButton::indicator:checked {
image: url(themes/dark/images/icon_radiobutton_checked.png);
}
QRadioButton::indicator:checked:hover {
image: url(themes/dark/images/icon_radiobutton_checked_hover.png);
}
QRadioButton::indicator:checked:disabled {
image: url(themes/dark/images/icon_radiobutton_checked_disabled.png);
}
QScrollBar:horizontal {
background: #28252e;
height: 16px;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal, QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: #28252e;
}
QScrollBar::handle:horizontal {
background: #504d55;
border: 1px solid #383440;
border-radius: 8px;
min-width: 20px;
}
QScrollBar:vertical {
background: #28252e;
width: 16px;
}
QScrollBar::handle:vertical {
background: #504d55;
border: 1px solid #383440;
border-radius: 8px;
min-height: 20px;
}
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {
width: 0px;
}
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
height: 0px;
}
QToolButton {
background-color: #2e2b35;
border: 1px solid transparent;
padding: 0px;
width: 30px;
height: 30px;
color: #d7d7d7;
}
QToolButton:hover {
background-color: #383440;
border: 1px solid #504d55;
}
QToolButton:pressed {
background-color: #28252e;
border: 1px solid #383440;
}
QToolButton:selected {
background-color: #28252e;
border: 1px solid #383440;
}
QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
min-width: 60px;
padding-right: 26px; /* make way for the popup button */
padding-left: 4px;
padding-top: 2px;
padding-bottom: 2px;
}
/* the subcontrols below are used only in the MenuButtonPopup mode */
QToolButton::menu-button {
border: 1px solid #383440;
width: 20px;
}
QToolButton::menu-button:hover {
border: 1px solid #504d55;
}
QDialogButtonBox QPushButton {
padding: 6px 26px;
}
/*QDialogButtonBox {
min-width: 250px;
min-height: 35px;
}*/
QPushButton {
background-color: #383440;
border: 1px solid #504d55;
border-radius: 1px;
padding: 6px 6px;
}
QPushButton:hover {
background-color: #504d55;
}
QPushButton:pressed {
background-color: #28252e;
}
QPushButton:disabled {
background-color: #28252e;
color: #504d55;
}
QAbstractSpinBox {
padding-right: 15px; /* make room for the arrows */
background: #28252e;
}
QAbstractSpinBox::up-button {
subcontrol-origin: border;
subcontrol-position: top right; /* position at the top right corner */
border-image: url(themes/dark/images/spinup.png) 1;
}
QAbstractSpinBox::up-button:pressed, QAbstractSpinBox::up-button:off {
border-image: url(themes/dark/images/spinup_pressed.png) 1;
}
QAbstractSpinBox::up-button:disabled {
border-image: url(themes/dark/images/spinup_disabled.png) 1;
}
QAbstractSpinBox::up-arrow {
image: url(themes/dark/images/up_arrow.png);
}
QAbstractSpinBox::up-arrow:disabled, QAbstractSpinBox::up-arrow:off { /* off state when value is max */
image: url(themes/dark/images/down_arrow_disabled.png);
}
QAbstractSpinBox::down-button {
subcontrol-origin: border;
subcontrol-position: bottom right; /* position at bottom right corner */
border-image: url(themes/dark/images/spindown.png) 1;
}
QAbstractSpinBox::down-button:pressed, QAbstractSpinBox::down-button:off {
border-image: url(themes/dark/images/spindown_pressed.png) 1;
}
QAbstractSpinBox::down-button:disabled {
border-image: url(themes/dark/images/spindown_disabled.png) 1;
}
QAbstractSpinBox::down-arrow {
image: url(themes/dark/images/down_arrow.png);
}
QAbstractSpinBox::down-arrow:disabled, QAbstractSpinBox::down-arrow:off { /* off state when value in min */
image: url(themes/dark/images/up_arrow_disabled.png);
}
QComboBox {
border: none;
padding: 3px 18px 3px 6px;
min-width: 6em;
}
QComboBox:editable {
background: #28252e;
}
QComboBox:!editable, QComboBox::drop-down:editable {
background: #383440;
}
/* QComboBox gets the "on" state when the popup is open */
QComboBox:!editable:on, QComboBox::drop-down:editable:on {
background: #504d55;
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 18px;
border: none;
}
QComboBox::down-arrow {
image: url(themes/dark/images/down_arrow.png);
}
QSlider::groove:horizontal {
height: 6px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: #28252e;
border: 1px solid #383440;
}
QSlider::handle:horizontal {
background: #be3b29;
width: 7px;
margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 2px;
border: 1px solid #28252e;
}
QSlider::add-page:horizontal {
background: #28252e;
border: 1px solid #383440;
}
QSlider::sub-page:horizontal {
background-color: qlineargradient(x0:0, y0:0, x1:1, y1:0, stop:0 #be3b29, stop:1 #2e2b35);
border: 1px solid #383440;
}
QSlider::groove:vertical {
width: 6px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: #28252e;
border: 1px solid #383440;
}
QSlider::handle:vertical {
background: #be3b29;
height: 7px;
margin: 0 -5px; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 2px;
border: 1px solid #28252e;
}
QSlider::add-page:vertical {
background: #28252e;
border: 1px solid #383440;
}
QSlider::sub-page:vertical {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #2e2b35, stop:1 #be3b29);
border: 1px solid #383440;
}
QStatusBar {
background: #2e2b35;
}
QStatusBar::item {
border-left: 1px solid #383440;
}
QTableView {
color: #7f7f7f;
background-color: #28252e;
selection-color: #d7d7d7;
selection-background-color: #383440;
gridline-color: #504d55;
}
QTableView QTableCornerButton::section {
background: #383440;
border-style: solid;
border-bottom: 1px solid #504d55;
border-right: 1px solid #504d55;
}
QHeaderView::section {
background-color: #383440;
color: white;
padding: 0px 4px;
border-style: solid;
border-right: 1px solid #504d55;
border-bottom: 1px solid #504d55;
}
QHeaderView::section:checked
{
background-color: #504d55;
}
/* style the sort indicator */
QHeaderView::down-arrow {
image: url(themes/dark/images/down_arrow.png);
}
QHeaderView::up-arrow {
image: url(themes/dark/images/up_arrow.png);
}
QProgressBar {
border: 1px solid #383440;
border-radius: 2px;
text-align: center;
background-color: #28252e;
}
QProgressBar::chunk {
background-color: #be3b29;
width: 1px;
}
QTreeView::branch:has-siblings:!adjoins-item {
border-image: url(themes/dark/images/vline.png) 0;
}
QTreeView::branch:has-siblings:adjoins-item {
border-image: url(themes/dark/images/icon_branch_more.png) 0;
}
QTreeView::branch:!has-children:!has-siblings:adjoins-item {
border-image: url(themes/dark/images/icon_branch_end.png) 0;
}
QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings {
border-image: none;
image: url(themes/dark/images/icon_branch_closed.png);
}
QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings {
border-image: none;
image: url(themes/dark/images/icon_branch_open.png);
}
/*======================================*/
QListView {
border: none;
outline: none;
}
QListView::item {
background-color: #28252e;
min-height: 18px;
}
QListView::item:alternate {
background: #24222a;
}
QListView::item:selected {
background: #be3b29;
}
/*=======================================*/
color_widgets--ColorSelector {
min-width: 100px;
max-height: 30px;
}

View File

@@ -1,380 +1,381 @@
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#include <noggit/ui/terrain_tool.hpp>
#include <noggit/tool_enums.hpp>
#include <noggit/World.h>
#include <util/qt/overload.hpp>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QVBoxLayout>
namespace noggit
{
namespace ui
{
terrain_tool::terrain_tool(QWidget* parent)
: QWidget(parent)
, _edit_type (eTerrainType_Linear)
, _radius(15.0f)
, _speed(2.0f)
, _inner_radius(0.0f)
, _vertex_angle (0.0f)
, _vertex_orientation (0.0f)
, _cursor_pos(nullptr)
, _vertex_mode(eVertexMode_Center)
{
auto layout (new QFormLayout (this));
_type_button_group = new QButtonGroup (this);
QRadioButton* radio_flat = new QRadioButton ("Flat");
QRadioButton* radio_linear = new QRadioButton ("Linear");
QRadioButton* radio_smooth = new QRadioButton ("Smooth");
QRadioButton* radio_polynomial = new QRadioButton ("Polynomial");
QRadioButton* radio_trigo = new QRadioButton ("Trigonom");
QRadioButton* radio_quadra = new QRadioButton ("Quadratic");
QRadioButton* radio_gauss = new QRadioButton ("Gaussian");
QRadioButton* radio_vertex = new QRadioButton ("Vertex");
_type_button_group->addButton (radio_flat, (int)eTerrainType_Flat);
_type_button_group->addButton (radio_linear, (int)eTerrainType_Linear);
_type_button_group->addButton (radio_smooth, (int)eTerrainType_Smooth);
_type_button_group->addButton (radio_polynomial, (int)eTerrainType_Polynom);
_type_button_group->addButton (radio_trigo, (int)eTerrainType_Trigo);
_type_button_group->addButton (radio_quadra, (int)eTerrainType_Quadra);
_type_button_group->addButton (radio_gauss, (int)eTerrainType_Gaussian);
_type_button_group->addButton (radio_vertex, (int)eTerrainType_Vertex);
radio_linear->toggle();
QGroupBox* terrain_type_group (new QGroupBox ("Type"));
QGridLayout* terrain_type_layout (new QGridLayout (terrain_type_group));
terrain_type_layout->addWidget (radio_flat, 0, 0);
terrain_type_layout->addWidget (radio_linear, 0, 1);
terrain_type_layout->addWidget (radio_smooth, 1, 0);
terrain_type_layout->addWidget (radio_polynomial, 1, 1);
terrain_type_layout->addWidget (radio_trigo, 2, 0);
terrain_type_layout->addWidget (radio_quadra, 2, 1);
terrain_type_layout->addWidget (radio_gauss, 3, 0);
terrain_type_layout->addWidget (radio_vertex, 3, 1);
layout->addWidget (terrain_type_group);
_radius_spin = new QDoubleSpinBox (this);
_radius_spin->setRange (0.0f, 1000.0f);
_radius_spin->setDecimals (2);
_radius_spin->setValue (_radius);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_radius_slider->setRange (0, 1000);
_radius_slider->setSliderPosition ((int)std::round (_radius));
_inner_radius_spin = new QDoubleSpinBox (this);
_inner_radius_spin->setRange (0.0f, 1.0f);
_inner_radius_spin->setDecimals (2);
_inner_radius_spin->setValue (_inner_radius);
_inner_radius_spin->setSingleStep(0.05f);
_inner_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_inner_radius_slider->setRange (0, 100);
_inner_radius_slider->setSliderPosition ((int)std::round (_inner_radius * 100));
QGroupBox* radius_group (new QGroupBox ("Radius"));
QFormLayout* radius_layout (new QFormLayout (radius_group));
radius_layout->addRow ("Outer:", _radius_spin);
radius_layout->addRow (_radius_slider);
radius_layout->addRow ("Inner:", _inner_radius_spin);
radius_layout->addRow (_inner_radius_slider);
layout->addWidget (radius_group);
_speed_spin = new QDoubleSpinBox (this);
_speed_spin->setRange (0.0f, 10.0f);
_speed_spin->setDecimals (2);
_speed_spin->setValue (_speed);
_speed_slider = new QSlider (Qt::Orientation::Horizontal, this);
_speed_slider->setRange (0, 10 * 100);
_speed_slider->setSingleStep (50);
_speed_slider->setSliderPosition (_speed * 100);
_speed_box = new QGroupBox (this);
QFormLayout* speed_layout (new QFormLayout (_speed_box));
speed_layout->addRow ("Speed:", _speed_spin);
speed_layout->addRow (_speed_slider);
layout->addWidget (_speed_box);
_vertex_type_group = new QGroupBox ("Vertex edit");
QVBoxLayout* vertex_layout (new QVBoxLayout (_vertex_type_group));
_vertex_button_group = new QButtonGroup (this);
QRadioButton* radio_mouse = new QRadioButton ("Cursor", _vertex_type_group);
QRadioButton* radio_center = new QRadioButton ("Selection center", _vertex_type_group);
radio_mouse->setToolTip ("Orient vertices using the cursor pos as reference");
radio_center->setToolTip ("Orient vertices using the selection center as reference");
_vertex_button_group->addButton (radio_mouse, (int)eVertexMode_Mouse);
_vertex_button_group->addButton (radio_center, (int)eVertexMode_Center);
radio_center->toggle();
QHBoxLayout* vertex_type_layout (new QHBoxLayout);
vertex_type_layout->addWidget (radio_mouse);
vertex_type_layout->addWidget (radio_center);
vertex_layout->addItem (vertex_type_layout);
QHBoxLayout* vertex_angle_layout (new QHBoxLayout);
vertex_angle_layout->addWidget (_orientation_dial = new QDial (_vertex_type_group));
_orientation_dial->setRange(0, 360);
_orientation_dial->setWrapping(true);
_orientation_dial->setSliderPosition(_vertex_orientation._ - 90); // to get ingame orientation
_orientation_dial->setToolTip("Orientation");
_orientation_dial->setSingleStep(10);
vertex_angle_layout->addWidget (_angle_slider = new QSlider (_vertex_type_group));
_angle_slider->setRange(-89, 89);
_angle_slider->setSliderPosition(_vertex_angle._);
_angle_slider->setToolTip("Angle");
vertex_layout->addItem (vertex_angle_layout);
layout->addWidget (_vertex_type_group);
_vertex_type_group->hide();
connect ( _type_button_group, qOverload<int> (&QButtonGroup::buttonClicked)
, [&] (int id)
{
_edit_type = static_cast<eTerrainType> (id);
updateVertexGroup();
}
);
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_radius = v;
QSignalBlocker const blocker(_radius_slider);
_radius_slider->setSliderPosition ((int)std::round (v));
}
);
connect ( _radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_radius = v;
QSignalBlocker const blocker(_radius_spin);
_radius_spin->setValue(v);
}
);
connect ( _inner_radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_inner_radius = v;
QSignalBlocker const blocker(_inner_radius_slider);
_inner_radius_slider->setSliderPosition ((int)std::round (v * 100));
}
);
connect ( _inner_radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_inner_radius = v / 100.0f;
QSignalBlocker const blocker(_inner_radius_spin);
_inner_radius_spin->setValue(_inner_radius);
}
);
connect ( _speed_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_speed = v;
QSignalBlocker const blocker(_speed_slider);
_speed_slider->setSliderPosition ((int)std::round (v * 100.0f));
}
);
connect ( _speed_slider, &QSlider::valueChanged
, [&] (int v)
{
_speed = v / 100.0f;
QSignalBlocker const blocker(_speed_spin);
_speed_spin->setValue (_speed);
}
);
connect ( _vertex_button_group, qOverload<int> (&QButtonGroup::buttonClicked)
, [&] (int id)
{
_vertex_mode = id;
}
);
connect ( _angle_slider, &QSlider::valueChanged
, [this] (int v)
{
setAngle (v);
}
);
connect ( _orientation_dial, &QDial::valueChanged
, [this] (int v)
{
setOrientation (v + 90.0f);
}
);
setMinimumWidth(sizeHint().width());
}
void terrain_tool::changeTerrain
(World* world, math::vector_3d const& pos, float dt)
{
if(_edit_type != eTerrainType_Vertex)
{
world->changeTerrain(pos, dt*_speed, _radius, _edit_type, _inner_radius);
}
else
{
// < 0 ==> control is pressed
if (dt >= 0.0f)
{
world->selectVertices(pos, _radius);
}
else
{
if (world->deselectVertices(pos, _radius))
{
_vertex_angle = math::degrees (0.0f);
_vertex_orientation = math::degrees (0.0f);
world->clearVertexSelection();
}
}
}
}
void terrain_tool::moveVertices (World* world, float dt)
{
world->moveVertices(dt * _speed);
}
void terrain_tool::flattenVertices (World* world)
{
if (_edit_type == eTerrainType_Vertex)
{
world->flattenVertices (world->vertexCenter().y);
}
}
void terrain_tool::nextType()
{
_edit_type = static_cast<eTerrainType> ((static_cast<int> (_edit_type) + 1) % eTerrainType_Count);
_type_button_group->button (_edit_type)->toggle();
updateVertexGroup();
}
void terrain_tool::setRadius(float radius)
{
_radius_spin->setValue(radius);
}
void terrain_tool::changeRadius(float change)
{
setRadius (_radius + change);
}
void terrain_tool::changeInnerRadius(float change)
{
_inner_radius_spin->setValue(_inner_radius + change);
}
void terrain_tool::changeSpeed(float change)
{
_speed_spin->setValue(_speed + change);
}
void terrain_tool::setSpeed(float speed)
{
_speed_spin->setValue(speed);
}
void terrain_tool::changeOrientation (float change)
{
setOrientation (_vertex_orientation._ + change);
}
void terrain_tool::setOrientation (float orientation)
{
if (_edit_type == eTerrainType_Vertex)
{
QSignalBlocker const blocker (_orientation_dial);
while (orientation >= 360.0f)
{
orientation -= 360.0f;
}
while (orientation < 0.0f)
{
orientation += 360.0f;
}
_vertex_orientation = math::degrees (orientation);
_orientation_dial->setSliderPosition (_vertex_orientation._ - 90.0f);
emit updateVertices(_vertex_mode, _vertex_angle, _vertex_orientation);
}
}
void terrain_tool::setOrientRelativeTo (World* world, math::vector_3d const& pos)
{
if (_edit_type == eTerrainType_Vertex)
{
math::vector_3d const& center = world->vertexCenter();
_vertex_orientation = math::radians (std::atan2(center.z - pos.z, center.x - pos.x));
emit updateVertices(_vertex_mode, _vertex_angle, _vertex_orientation);
}
}
void terrain_tool::changeAngle (float change)
{
setAngle (_vertex_angle._ + change);
}
void terrain_tool::setAngle (float angle)
{
if (_edit_type == eTerrainType_Vertex)
{
QSignalBlocker const blocker (_angle_slider);
_vertex_angle = math::degrees (std::max(-89.0f, std::min(89.0f, angle)));
_angle_slider->setSliderPosition (_vertex_angle._);
emit updateVertices(_vertex_mode, _vertex_angle, _vertex_orientation);
}
}
void terrain_tool::updateVertexGroup()
{
if (_edit_type != eTerrainType_Vertex)
{
_vertex_type_group->hide();
_speed_box->show();
}
else
{
_vertex_type_group->show();
_speed_box->hide();
}
}
QSize terrain_tool::sizeHint() const
{
return QSize(215, height());
}
}
}
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
#include <noggit/ui/terrain_tool.hpp>
#include <noggit/tool_enums.hpp>
#include <noggit/World.h>
#include <util/qt/overload.hpp>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QVBoxLayout>
namespace noggit
{
namespace ui
{
terrain_tool::terrain_tool(QWidget* parent)
: QWidget(parent)
, _edit_type (eTerrainType_Linear)
, _radius(15.0f)
, _speed(2.0f)
, _inner_radius(0.0f)
, _vertex_angle (0.0f)
, _vertex_orientation (0.0f)
, _cursor_pos(nullptr)
, _vertex_mode(eVertexMode_Center)
{
auto layout (new QFormLayout (this));
_type_button_group = new QButtonGroup (this);
QRadioButton* radio_flat = new QRadioButton ("Flat");
QRadioButton* radio_linear = new QRadioButton ("Linear");
QRadioButton* radio_smooth = new QRadioButton ("Smooth");
QRadioButton* radio_polynomial = new QRadioButton ("Polynomial");
QRadioButton* radio_trigo = new QRadioButton ("Trigonom");
QRadioButton* radio_quadra = new QRadioButton ("Quadratic");
QRadioButton* radio_gauss = new QRadioButton ("Gaussian");
QRadioButton* radio_vertex = new QRadioButton ("Vertex");
_type_button_group->addButton (radio_flat, (int)eTerrainType_Flat);
_type_button_group->addButton (radio_linear, (int)eTerrainType_Linear);
_type_button_group->addButton (radio_smooth, (int)eTerrainType_Smooth);
_type_button_group->addButton (radio_polynomial, (int)eTerrainType_Polynom);
_type_button_group->addButton (radio_trigo, (int)eTerrainType_Trigo);
_type_button_group->addButton (radio_quadra, (int)eTerrainType_Quadra);
_type_button_group->addButton (radio_gauss, (int)eTerrainType_Gaussian);
_type_button_group->addButton (radio_vertex, (int)eTerrainType_Vertex);
radio_linear->toggle();
QGroupBox* terrain_type_group (new QGroupBox ("Type"));
QGridLayout* terrain_type_layout (new QGridLayout (terrain_type_group));
terrain_type_layout->addWidget (radio_flat, 0, 0);
terrain_type_layout->addWidget (radio_linear, 0, 1);
terrain_type_layout->addWidget (radio_smooth, 1, 0);
terrain_type_layout->addWidget (radio_polynomial, 1, 1);
terrain_type_layout->addWidget (radio_trigo, 2, 0);
terrain_type_layout->addWidget (radio_quadra, 2, 1);
terrain_type_layout->addWidget (radio_gauss, 3, 0);
terrain_type_layout->addWidget (radio_vertex, 3, 1);
layout->addWidget (terrain_type_group);
_radius_spin = new QDoubleSpinBox (this);
_radius_spin->setRange (0.0f, 1000.0f);
_radius_spin->setDecimals (2);
_radius_spin->setValue (_radius);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_radius_slider->setRange (0, 1000);
_radius_slider->setSliderPosition ((int)std::round (_radius));
_inner_radius_spin = new QDoubleSpinBox (this);
_inner_radius_spin->setRange (0.0f, 1.0f);
_inner_radius_spin->setDecimals (2);
_inner_radius_spin->setValue (_inner_radius);
_inner_radius_spin->setSingleStep(0.05f);
_inner_radius_slider = new QSlider (Qt::Orientation::Horizontal, this);
_inner_radius_slider->setRange (0, 100);
_inner_radius_slider->setSliderPosition ((int)std::round (_inner_radius * 100));
QGroupBox* radius_group (new QGroupBox ("Radius"));
QFormLayout* radius_layout (new QFormLayout (radius_group));
radius_layout->addRow ("Outer:", _radius_spin);
radius_layout->addRow (_radius_slider);
radius_layout->addRow ("Inner:", _inner_radius_spin);
radius_layout->addRow (_inner_radius_slider);
layout->addWidget (radius_group);
_speed_spin = new QDoubleSpinBox (this);
_speed_spin->setRange (0.0f, 10.0f);
_speed_spin->setDecimals (2);
_speed_spin->setValue (_speed);
_speed_slider = new QSlider (Qt::Orientation::Horizontal, this);
_speed_slider->setRange (0, 10 * 100);
_speed_slider->setSingleStep (50);
_speed_slider->setSliderPosition (_speed * 100);
_speed_box = new QGroupBox (this);
QFormLayout* speed_layout (new QFormLayout (_speed_box));
speed_layout->addRow ("Speed:", _speed_spin);
speed_layout->addRow (_speed_slider);
layout->addWidget (_speed_box);
_vertex_type_group = new QGroupBox ("Vertex edit");
QVBoxLayout* vertex_layout (new QVBoxLayout (_vertex_type_group));
_vertex_button_group = new QButtonGroup (this);
QRadioButton* radio_mouse = new QRadioButton ("Cursor", _vertex_type_group);
QRadioButton* radio_center = new QRadioButton ("Selection center", _vertex_type_group);
radio_mouse->setToolTip ("Orient vertices using the cursor pos as reference");
radio_center->setToolTip ("Orient vertices using the selection center as reference");
_vertex_button_group->addButton (radio_mouse, (int)eVertexMode_Mouse);
_vertex_button_group->addButton (radio_center, (int)eVertexMode_Center);
radio_center->toggle();
QHBoxLayout* vertex_type_layout (new QHBoxLayout);
vertex_type_layout->addWidget (radio_mouse);
vertex_type_layout->addWidget (radio_center);
vertex_layout->addItem (vertex_type_layout);
QHBoxLayout* vertex_angle_layout (new QHBoxLayout);
vertex_angle_layout->addWidget (_orientation_dial = new QDial (_vertex_type_group));
_orientation_dial->setRange(0, 360);
_orientation_dial->setWrapping(true);
_orientation_dial->setSliderPosition(_vertex_orientation._ - 90); // to get ingame orientation
_orientation_dial->setToolTip("Orientation");
_orientation_dial->setSingleStep(10);
vertex_angle_layout->addWidget (_angle_slider = new QSlider (_vertex_type_group));
_angle_slider->setRange(-89, 89);
_angle_slider->setSliderPosition(_vertex_angle._);
_angle_slider->setToolTip("Angle");
vertex_layout->addItem (vertex_angle_layout);
layout->addWidget (_vertex_type_group);
_vertex_type_group->hide();
connect ( _type_button_group, qOverload<int> (&QButtonGroup::buttonClicked)
, [&] (int id)
{
_edit_type = static_cast<eTerrainType> (id);
updateVertexGroup();
}
);
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_radius = v;
QSignalBlocker const blocker(_radius_slider);
_radius_slider->setSliderPosition ((int)std::round (v));
}
);
connect ( _radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_radius = v;
QSignalBlocker const blocker(_radius_spin);
_radius_spin->setValue(v);
}
);
connect ( _inner_radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_inner_radius = v;
QSignalBlocker const blocker(_inner_radius_slider);
_inner_radius_slider->setSliderPosition ((int)std::round (v * 100));
}
);
connect ( _inner_radius_slider, &QSlider::valueChanged
, [&] (int v)
{
_inner_radius = v / 100.0f;
QSignalBlocker const blocker(_inner_radius_spin);
_inner_radius_spin->setValue(_inner_radius);
}
);
connect ( _speed_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
_speed = v;
QSignalBlocker const blocker(_speed_slider);
_speed_slider->setSliderPosition ((int)std::round (v * 100.0f));
}
);
connect ( _speed_slider, &QSlider::valueChanged
, [&] (int v)
{
_speed = v / 100.0f;
QSignalBlocker const blocker(_speed_spin);
_speed_spin->setValue (_speed);
}
);
connect ( _vertex_button_group, qOverload<int> (&QButtonGroup::buttonClicked)
, [&] (int id)
{
_vertex_mode = id;
}
);
connect ( _angle_slider, &QSlider::valueChanged
, [this] (int v)
{
setAngle (v);
}
);
connect ( _orientation_dial, &QDial::valueChanged
, [this] (int v)
{
setOrientation (v + 90.0f);
}
);
setMinimumWidth(250);
setMaximumWidth(250);
}
void terrain_tool::changeTerrain
(World* world, math::vector_3d const& pos, float dt)
{
if(_edit_type != eTerrainType_Vertex)
{
world->changeTerrain(pos, dt*_speed, _radius, _edit_type, _inner_radius);
}
else
{
// < 0 ==> control is pressed
if (dt >= 0.0f)
{
world->selectVertices(pos, _radius);
}
else
{
if (world->deselectVertices(pos, _radius))
{
_vertex_angle = math::degrees (0.0f);
_vertex_orientation = math::degrees (0.0f);
world->clearVertexSelection();
}
}
}
}
void terrain_tool::moveVertices (World* world, float dt)
{
world->moveVertices(dt * _speed);
}
void terrain_tool::flattenVertices (World* world)
{
if (_edit_type == eTerrainType_Vertex)
{
world->flattenVertices (world->vertexCenter().y);
}
}
void terrain_tool::nextType()
{
_edit_type = static_cast<eTerrainType> ((static_cast<int> (_edit_type) + 1) % eTerrainType_Count);
_type_button_group->button (_edit_type)->toggle();
updateVertexGroup();
}
void terrain_tool::setRadius(float radius)
{
_radius_spin->setValue(radius);
}
void terrain_tool::changeRadius(float change)
{
setRadius (_radius + change);
}
void terrain_tool::changeInnerRadius(float change)
{
_inner_radius_spin->setValue(_inner_radius + change);
}
void terrain_tool::changeSpeed(float change)
{
_speed_spin->setValue(_speed + change);
}
void terrain_tool::setSpeed(float speed)
{
_speed_spin->setValue(speed);
}
void terrain_tool::changeOrientation (float change)
{
setOrientation (_vertex_orientation._ + change);
}
void terrain_tool::setOrientation (float orientation)
{
if (_edit_type == eTerrainType_Vertex)
{
QSignalBlocker const blocker (_orientation_dial);
while (orientation >= 360.0f)
{
orientation -= 360.0f;
}
while (orientation < 0.0f)
{
orientation += 360.0f;
}
_vertex_orientation = math::degrees (orientation);
_orientation_dial->setSliderPosition (_vertex_orientation._ - 90.0f);
emit updateVertices(_vertex_mode, _vertex_angle, _vertex_orientation);
}
}
void terrain_tool::setOrientRelativeTo (World* world, math::vector_3d const& pos)
{
if (_edit_type == eTerrainType_Vertex)
{
math::vector_3d const& center = world->vertexCenter();
_vertex_orientation = math::radians (std::atan2(center.z - pos.z, center.x - pos.x));
emit updateVertices(_vertex_mode, _vertex_angle, _vertex_orientation);
}
}
void terrain_tool::changeAngle (float change)
{
setAngle (_vertex_angle._ + change);
}
void terrain_tool::setAngle (float angle)
{
if (_edit_type == eTerrainType_Vertex)
{
QSignalBlocker const blocker (_angle_slider);
_vertex_angle = math::degrees (std::max(-89.0f, std::min(89.0f, angle)));
_angle_slider->setSliderPosition (_vertex_angle._);
emit updateVertices(_vertex_mode, _vertex_angle, _vertex_orientation);
}
}
void terrain_tool::updateVertexGroup()
{
if (_edit_type != eTerrainType_Vertex)
{
_vertex_type_group->hide();
_speed_box->show();
}
else
{
_vertex_type_group->show();
_speed_box->hide();
}
}
QSize terrain_tool::sizeHint() const
{
return QSize(215, height());
}
}
}

File diff suppressed because it is too large Load Diff