Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -417,7 +417,7 @@ void MapIndex::saveTile(const tile_index& tile, World* world, bool save_unloaded
|
||||
auto filepath = boost::filesystem::path (settings.value ("project/path").toString().toStdString())
|
||||
/ noggit::mpq::normalized_filename (mTiles[tile.z][tile.x].tile->filename);
|
||||
|
||||
QFile file(filepath.c_str());
|
||||
QFile file(filepath.string().c_str());
|
||||
file.open(QIODevice::WriteOnly);
|
||||
|
||||
mTiles[tile.z][tile.x].tile->initEmptyChunks();
|
||||
|
||||
@@ -49,32 +49,34 @@ namespace noggit
|
||||
|
||||
layout->addRow (flatten_type_group);
|
||||
|
||||
QGroupBox* settings_group(new QGroupBox("Settings"));
|
||||
auto settings_layout = new QFormLayout(settings_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);
|
||||
settings_layout->addRow("Radius:", _radius_spin);
|
||||
settings_layout->addRow(_radius_slider);
|
||||
settings_layout->addRow("Speed:", _speed_spin);
|
||||
settings_layout->addRow(_speed_slider);
|
||||
|
||||
layout->addRow(settings_group);
|
||||
|
||||
QGroupBox* flatten_blur_group = new QGroupBox("Flatten/Blur", this);
|
||||
auto flatten_blur_layout = new QGridLayout(flatten_blur_group);
|
||||
@@ -346,7 +348,7 @@ namespace noggit
|
||||
|
||||
QSize flatten_blur_tool::sizeHint() const
|
||||
{
|
||||
return QSize(215, height());
|
||||
return QSize(250, height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,18 +53,21 @@ namespace noggit
|
||||
{
|
||||
auto layout = new QFormLayout (this);
|
||||
|
||||
QGroupBox* radius_group = new QGroupBox("Radius");
|
||||
auto radius_layout = new QFormLayout(radius_group);
|
||||
|
||||
_radius_spin = new QDoubleSpinBox (this);
|
||||
_radius_spin->setRange (0.0f, 100.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, 100);
|
||||
_radius_slider->setSliderPosition (_radius);
|
||||
|
||||
layout->addRow (_radius_slider);
|
||||
radius_layout->addRow (_radius_slider);
|
||||
radius_layout->addRow(_radius_spin);
|
||||
layout->addRow(radius_group);
|
||||
|
||||
QGroupBox *copyBox = new QGroupBox("Copy options", this);
|
||||
auto copy_layout = new QFormLayout (copyBox);
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace noggit
|
||||
|
||||
QSize water::sizeHint() const
|
||||
{
|
||||
return QSize(215, height());
|
||||
return QSize(250, height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,170 +1,171 @@
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include <noggit/ui/ZoneIDBrowser.h>
|
||||
|
||||
#include <noggit/DBC.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <noggit/Misc.h>
|
||||
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace noggit
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
zone_id_browser::zone_id_browser(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, _area_tree(new QTreeWidget())
|
||||
, mapID(-1)
|
||||
{
|
||||
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);
|
||||
layout->addRow (_area_tree);
|
||||
|
||||
|
||||
connect ( _area_tree, &QTreeWidget::itemSelectionChanged
|
||||
, [this]
|
||||
{
|
||||
auto const& selected_items = _area_tree->selectedItems();
|
||||
if (selected_items.size())
|
||||
{
|
||||
emit selected (selected_items.back()->data(0, 1).toInt());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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 zone_id_browser::setMapID(int id)
|
||||
{
|
||||
mapID = id;
|
||||
|
||||
for (DBCFile::Iterator i = gMapDB.begin(); i != gMapDB.end(); ++i)
|
||||
{
|
||||
if (i->getInt(MapDB::MapID) == id)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << id << "-" << i->getString(MapDB::InternalName);
|
||||
_area_tree->setHeaderLabel(ss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
buildAreaList();
|
||||
}
|
||||
|
||||
void zone_id_browser::setZoneID(int id)
|
||||
{
|
||||
QSignalBlocker const block_area_tree(_area_tree);
|
||||
|
||||
if (_items.find(id) != _items.end())
|
||||
{
|
||||
_area_tree->selectionModel()->clear();
|
||||
auto* item = _items.at(id);
|
||||
|
||||
item->setSelected(true);
|
||||
|
||||
while ((item = item->parent()))
|
||||
{
|
||||
item->setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void zone_id_browser::buildAreaList()
|
||||
{
|
||||
QSignalBlocker const block_area_tree(_area_tree);
|
||||
_area_tree->clear();
|
||||
_area_tree->setColumnCount(1);
|
||||
_items.clear();
|
||||
|
||||
// Read out Area List.
|
||||
for (DBCFile::Iterator i = gAreaDB.begin(); i != gAreaDB.end(); ++i)
|
||||
{
|
||||
if (i->getInt(AreaDB::Continent) == mapID)
|
||||
{
|
||||
add_area(i->getInt(AreaDB::AreaID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void zone_id_browser::changeRadius(float change)
|
||||
{
|
||||
_radius_spin->setValue (_radius + change);
|
||||
}
|
||||
|
||||
QTreeWidgetItem* zone_id_browser::create_or_get_tree_widget_item(int area_id)
|
||||
{
|
||||
auto it = _items.find(area_id);
|
||||
|
||||
if (it != _items.end())
|
||||
{
|
||||
return _items.at(area_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << area_id << "-" << gAreaDB.getAreaName(area_id);
|
||||
item->setData(0, 1, QVariant(area_id));
|
||||
item->setText(0, QString(ss.str().c_str()));
|
||||
_items.emplace(area_id, item);
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem* zone_id_browser::add_area(int area_id)
|
||||
{
|
||||
QTreeWidgetItem* item = create_or_get_tree_widget_item(area_id);
|
||||
|
||||
std::uint32_t parent_area_id = gAreaDB.get_area_parent(area_id);
|
||||
|
||||
if (parent_area_id && parent_area_id != area_id)
|
||||
{
|
||||
QTreeWidgetItem* parent_item = add_area(parent_area_id);
|
||||
parent_item->addChild(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
_area_tree->addTopLevelItem(item);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include <noggit/ui/ZoneIDBrowser.h>
|
||||
|
||||
#include <noggit/DBC.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <noggit/Misc.h>
|
||||
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace noggit
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
zone_id_browser::zone_id_browser(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, _area_tree(new QTreeWidget())
|
||||
, mapID(-1)
|
||||
{
|
||||
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);
|
||||
layout->addRow (_area_tree);
|
||||
|
||||
setMinimumWidth(250);
|
||||
|
||||
connect ( _area_tree, &QTreeWidget::itemSelectionChanged
|
||||
, [this]
|
||||
{
|
||||
auto const& selected_items = _area_tree->selectedItems();
|
||||
if (selected_items.size())
|
||||
{
|
||||
emit selected (selected_items.back()->data(0, 1).toInt());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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 zone_id_browser::setMapID(int id)
|
||||
{
|
||||
mapID = id;
|
||||
|
||||
for (DBCFile::Iterator i = gMapDB.begin(); i != gMapDB.end(); ++i)
|
||||
{
|
||||
if (i->getInt(MapDB::MapID) == id)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << id << "-" << i->getString(MapDB::InternalName);
|
||||
_area_tree->setHeaderLabel(ss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
buildAreaList();
|
||||
}
|
||||
|
||||
void zone_id_browser::setZoneID(int id)
|
||||
{
|
||||
QSignalBlocker const block_area_tree(_area_tree);
|
||||
|
||||
if (_items.find(id) != _items.end())
|
||||
{
|
||||
_area_tree->selectionModel()->clear();
|
||||
auto* item = _items.at(id);
|
||||
|
||||
item->setSelected(true);
|
||||
|
||||
while ((item = item->parent()))
|
||||
{
|
||||
item->setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void zone_id_browser::buildAreaList()
|
||||
{
|
||||
QSignalBlocker const block_area_tree(_area_tree);
|
||||
_area_tree->clear();
|
||||
_area_tree->setColumnCount(1);
|
||||
_items.clear();
|
||||
|
||||
// Read out Area List.
|
||||
for (DBCFile::Iterator i = gAreaDB.begin(); i != gAreaDB.end(); ++i)
|
||||
{
|
||||
if (i->getInt(AreaDB::Continent) == mapID)
|
||||
{
|
||||
add_area(i->getInt(AreaDB::AreaID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void zone_id_browser::changeRadius(float change)
|
||||
{
|
||||
_radius_spin->setValue (_radius + change);
|
||||
}
|
||||
|
||||
QTreeWidgetItem* zone_id_browser::create_or_get_tree_widget_item(int area_id)
|
||||
{
|
||||
auto it = _items.find(area_id);
|
||||
|
||||
if (it != _items.end())
|
||||
{
|
||||
return _items.at(area_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << area_id << "-" << gAreaDB.getAreaName(area_id);
|
||||
item->setData(0, 1, QVariant(area_id));
|
||||
item->setText(0, QString(ss.str().c_str()));
|
||||
_items.emplace(area_id, item);
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem* zone_id_browser::add_area(int area_id)
|
||||
{
|
||||
QTreeWidgetItem* item = create_or_get_tree_widget_item(area_id);
|
||||
|
||||
std::uint32_t parent_area_id = gAreaDB.get_area_parent(area_id);
|
||||
|
||||
if (parent_area_id && parent_area_id != area_id)
|
||||
{
|
||||
QTreeWidgetItem* parent_item = add_area(parent_area_id);
|
||||
parent_item->addChild(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
_area_tree->addTopLevelItem(item);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,26 @@ namespace noggit
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::WindowText);
|
||||
}
|
||||
else if (state == QIcon::Off)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::Shadow);
|
||||
}
|
||||
else if (mode == QIcon::Disabled)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::ToolTipText);
|
||||
}
|
||||
else if (mode == QIcon::Active)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::BrightText);
|
||||
}
|
||||
else if (mode == QIcon::Selected)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::Midlight);
|
||||
}
|
||||
else if (state == QIcon::Off)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::ToolTipText);
|
||||
}
|
||||
else if (state == QIcon::On)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::Light);
|
||||
}
|
||||
|
||||
painter->setPen(color);
|
||||
|
||||
|
||||
@@ -40,15 +40,27 @@ namespace noggit
|
||||
QColor color;
|
||||
if (mode == QIcon::Normal)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::WindowText);
|
||||
}
|
||||
else if (state == QIcon::Off)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::Shadow);
|
||||
color = temp_btn->palette().color(QPalette::WindowText);
|
||||
}
|
||||
else if (mode == QIcon::Disabled)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::BrightText);
|
||||
color = temp_btn->palette().color(QPalette::ToolTipText);
|
||||
}
|
||||
else if (mode == QIcon::Active)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::BrightText);
|
||||
}
|
||||
else if (mode == QIcon::Selected)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::Highlight);
|
||||
}
|
||||
else if (state == QIcon::Off)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::ToolTipText);
|
||||
}
|
||||
else if (state == QIcon::On)
|
||||
{
|
||||
color = temp_btn->palette().color(QPalette::Light);
|
||||
}
|
||||
|
||||
painter->setPen(color);
|
||||
|
||||
@@ -27,7 +27,8 @@ namespace noggit
|
||||
, _cursor_pos(nullptr)
|
||||
, _vertex_mode(eVertexMode_Center)
|
||||
{
|
||||
|
||||
setMinimumWidth(250);
|
||||
setMaximumWidth(250);
|
||||
auto layout (new QFormLayout (this));
|
||||
|
||||
_type_button_group = new QButtonGroup (this);
|
||||
@@ -62,7 +63,7 @@ namespace noggit
|
||||
terrain_type_layout->addWidget (radio_gauss, 3, 0);
|
||||
terrain_type_layout->addWidget (radio_vertex, 3, 1);
|
||||
|
||||
layout->addWidget (terrain_type_group);
|
||||
layout->addRow (terrain_type_group);
|
||||
|
||||
_radius_spin = new QDoubleSpinBox (this);
|
||||
_radius_spin->setRange (0.0f, 1000.0f);
|
||||
@@ -83,14 +84,8 @@ namespace noggit
|
||||
_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);
|
||||
QGroupBox* settings_group(new QGroupBox ("Settings"));
|
||||
QFormLayout* settings_layout (new QFormLayout (settings_group));
|
||||
|
||||
_speed_spin = new QDoubleSpinBox (this);
|
||||
_speed_spin->setRange (0.0f, 10.0f);
|
||||
@@ -101,14 +96,15 @@ namespace noggit
|
||||
_speed_slider->setRange (0, 10 * 100);
|
||||
_speed_slider->setSingleStep (50);
|
||||
_speed_slider->setSliderPosition (_speed * 100);
|
||||
|
||||
settings_layout->addRow("Outer Radius:", _radius_spin);
|
||||
settings_layout->addRow(_radius_slider);
|
||||
settings_layout->addRow("Inner Radius:", _inner_radius_spin);
|
||||
settings_layout->addRow(_inner_radius_slider);
|
||||
settings_layout->addRow("Speed:", _speed_spin);
|
||||
settings_layout->addRow(_speed_slider);
|
||||
|
||||
|
||||
QGroupBox* _speed_box(new QGroupBox("Speed"));
|
||||
QFormLayout* speed_layout (new QFormLayout (_speed_box));
|
||||
speed_layout->addRow (_speed_spin);
|
||||
speed_layout->addRow (_speed_slider);
|
||||
|
||||
layout->addWidget (_speed_box);
|
||||
layout->addRow(settings_group);
|
||||
|
||||
_vertex_type_group = new QGroupBox ("Vertex edit");
|
||||
QVBoxLayout* vertex_layout (new QVBoxLayout (_vertex_type_group));
|
||||
@@ -145,7 +141,7 @@ namespace noggit
|
||||
|
||||
vertex_layout->addItem (vertex_angle_layout);
|
||||
|
||||
layout->addWidget (_vertex_type_group);
|
||||
layout->addRow(_vertex_type_group);
|
||||
_vertex_type_group->hide();
|
||||
|
||||
connect ( _type_button_group, qOverload<int> (&QButtonGroup::buttonClicked)
|
||||
@@ -231,8 +227,6 @@ namespace noggit
|
||||
}
|
||||
);
|
||||
|
||||
setMinimumWidth(250);
|
||||
setMaximumWidth(250);
|
||||
}
|
||||
|
||||
void terrain_tool::changeTerrain
|
||||
@@ -364,18 +358,16 @@ namespace noggit
|
||||
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());
|
||||
return QSize(250, height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user