Merge branch 'master' of https://gitlab.com/sshumakov3/noggit-red
This commit is contained in:
@@ -208,10 +208,6 @@ Noggit::Noggit(int argc, char *argv[])
|
||||
: fullscreen(false)
|
||||
, doAntiAliasing(true)
|
||||
{
|
||||
QPixmap pixmap = QPixmap(":splash");
|
||||
QSplashScreen splash(pixmap);
|
||||
splash.show();
|
||||
|
||||
InitLogging();
|
||||
assert (argc >= 1); (void) argc;
|
||||
initPath(argv);
|
||||
@@ -251,10 +247,8 @@ Noggit::Noggit(int argc, char *argv[])
|
||||
settings.setValue ("project/game_path", path.absolutePath());
|
||||
settings.setValue ("project/path", QString::fromStdString(project_path));
|
||||
|
||||
splash.showMessage("Loading game files...");
|
||||
loadMPQs(); // listfiles are not available straight away! They are async! Do not rely on anything at this point!
|
||||
|
||||
splash.showMessage("Reading databases...");
|
||||
OpenDBs();
|
||||
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
@@ -348,6 +342,10 @@ int main(int argc, char *argv[])
|
||||
qapp.setApplicationName ("Noggit");
|
||||
qapp.setOrganizationName ("Noggit");
|
||||
|
||||
QPixmap pixmap = QPixmap(":splash");
|
||||
QSplashScreen splash(pixmap);
|
||||
splash.show();
|
||||
|
||||
Noggit app (argc, argv);
|
||||
|
||||
return qapp.exec();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include "MinimapCreator.hpp"
|
||||
#include "font_awesome.hpp"
|
||||
|
||||
#include <noggit/MapView.h>
|
||||
#include <noggit/World.h>
|
||||
@@ -54,7 +55,6 @@ namespace noggit
|
||||
_minimap_widget->camera(mapView->getCamera());
|
||||
|
||||
// Right side
|
||||
|
||||
auto layout_right = new QFormLayout (this);
|
||||
layout->addLayout(layout_right);
|
||||
|
||||
@@ -129,16 +129,100 @@ namespace noggit
|
||||
_progress_bar->setRange(0, 4096);
|
||||
generate_layout->addRow (_progress_bar);
|
||||
|
||||
// Generate
|
||||
// Filter
|
||||
auto filter_widget = new QWidget(this);
|
||||
auto filter_layout = new QFormLayout(filter_widget);
|
||||
|
||||
settings_tabs->addTab(filter_widget, "Filter");
|
||||
|
||||
_m2_model_filter_include = new QListWidget(filter_widget);
|
||||
filter_layout->addRow(_m2_model_filter_include);
|
||||
auto m2_include_box = new QGroupBox("Render options", filter_widget);
|
||||
filter_layout->addRow(m2_include_box);
|
||||
|
||||
auto m2_include_box_layout = new QFormLayout (m2_include_box);
|
||||
|
||||
_m2_model_filter_include = new QListWidget(m2_include_box);
|
||||
_render_settings.m2_model_filter_include = _m2_model_filter_include;
|
||||
|
||||
m2_include_box_layout->addRow(_m2_model_filter_include);
|
||||
|
||||
auto m2_include_box_layout_btns = new QHBoxLayout(m2_include_box);
|
||||
m2_include_box_layout->addRow(m2_include_box_layout_btns);
|
||||
|
||||
auto add_btn = new QPushButton(m2_include_box);
|
||||
add_btn->setIcon(font_awesome_icon(font_awesome::plus));
|
||||
m2_include_box_layout_btns->addWidget(add_btn);
|
||||
|
||||
auto remove_btn = new QPushButton(m2_include_box);
|
||||
remove_btn->setIcon(font_awesome_icon(font_awesome::timescircle));
|
||||
m2_include_box_layout_btns->addWidget(remove_btn);
|
||||
|
||||
|
||||
// Connections
|
||||
|
||||
// Filter buttons
|
||||
|
||||
connect(add_btn, &QPushButton::clicked,
|
||||
[=]()
|
||||
{
|
||||
if (!world->has_selection())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& selection : world->current_selection())
|
||||
{
|
||||
if (selection.which() == eEntry_MapChunk)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string path;
|
||||
|
||||
if (selection.which() == eEntry_Model)
|
||||
{
|
||||
path = boost::get<selected_model_type>(selection)->model->filename;
|
||||
includeM2Model(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
connect(remove_btn, &QPushButton::clicked,
|
||||
[=]()
|
||||
{
|
||||
for (auto item : _m2_model_filter_include->selectedItems())
|
||||
{
|
||||
auto item_ = _m2_model_filter_include->takeItem(_m2_model_filter_include->row(item));
|
||||
delete item_;
|
||||
}
|
||||
|
||||
if (!world->has_selection())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& selection : world->current_selection())
|
||||
{
|
||||
if (selection.which() == eEntry_MapChunk)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string path;
|
||||
|
||||
if (selection.which() == eEntry_Model)
|
||||
{
|
||||
path = boost::get<selected_model_type>(selection)->model->filename;
|
||||
unincludeM2Model(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (double v)
|
||||
{
|
||||
@@ -292,14 +376,46 @@ namespace noggit
|
||||
|
||||
void MinimapCreator::includeM2Model(std::string filename)
|
||||
{
|
||||
bool already_added = false;
|
||||
|
||||
for (int i = 0; i < _m2_model_filter_include->count(); ++i)
|
||||
{
|
||||
if (!reinterpret_cast<MinimapM2ModelFilterEntry*>(_m2_model_filter_include->itemWidget(
|
||||
_m2_model_filter_include->item(i)))->getFileName().toStdString().compare(filename))
|
||||
{
|
||||
already_added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (already_added)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto item = new QListWidgetItem();
|
||||
_m2_model_filter_include->addItem(item);
|
||||
auto entry_wgt = new MinimapM2ModelFilterEntry(this);
|
||||
// entry_wgt->set
|
||||
entry_wgt->setFileName(filename);
|
||||
item->setSizeHint(entry_wgt->minimumSizeHint());
|
||||
_m2_model_filter_include->setItemWidget(item, entry_wgt);
|
||||
}
|
||||
|
||||
void MinimapCreator::unincludeM2Model(std::string filename)
|
||||
{
|
||||
|
||||
for (int i = 0; i < _m2_model_filter_include->count(); ++i )
|
||||
{
|
||||
if (!reinterpret_cast<MinimapM2ModelFilterEntry*>(_m2_model_filter_include->itemWidget(
|
||||
_m2_model_filter_include->item(i)))->getFileName().toStdString().compare(filename))
|
||||
{
|
||||
auto item = _m2_model_filter_include->takeItem(i);
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MinimapM2ModelFilterEntry::MinimapM2ModelFilterEntry(MinimapCreator* parent) : QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace noggit
|
||||
void progressUpdate(int value) { _progress_bar->setValue(value); };
|
||||
|
||||
void includeM2Model(std::string filename);
|
||||
void unincludeM2Model(std::string filename);
|
||||
|
||||
private:
|
||||
float _radius = 0.01f;
|
||||
@@ -99,6 +100,7 @@ namespace noggit
|
||||
MinimapM2ModelFilterEntry(MinimapCreator* parent = nullptr);
|
||||
|
||||
QString getFileName() { return _filename->text(); };
|
||||
void setFileName(const std::string& filename) { _filename->setText(QString(filename.c_str())); };
|
||||
float getSizeCategory() { return static_cast<float>(_size_category_spin->value()); };
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user