From e65bbdf0ac89906d433ce544906e3b269906ffba Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Thu, 2 Jun 2011 23:31:21 +0300 Subject: [PATCH] Added: #1301 Added filter for list zones in landscape editor. --- .../plugins/landscape_editor/CMakeLists.txt | 7 +- .../plugins/landscape_editor/builder_zone.cpp | 7 +- .../plugins/landscape_editor/builder_zone.h | 6 +- ..._list_widget.cpp => landscape_actions.cpp} | 18 +- ...zone_list_widget.h => landscape_actions.h} | 28 +- .../landscape_editor_window.cpp | 12 +- .../landscape_editor_window.ui | 6 +- ...ne_list_model.cpp => list_zones_model.cpp} | 46 +- .../{zone_list_model.h => list_zones_model.h} | 18 +- .../landscape_editor/list_zones_widget.cpp | 219 ++++++++ .../landscape_editor/list_zones_widget.h | 68 +++ .../landscape_editor/list_zones_widget.ui | 478 ++++++++++++++++++ .../landscape_editor/zone_list_widget.ui | 266 ---------- 13 files changed, 827 insertions(+), 352 deletions(-) rename code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/{zone_list_widget.cpp => landscape_actions.cpp} (76%) rename code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/{zone_list_widget.h => landscape_actions.h} (68%) rename code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/{zone_list_model.cpp => list_zones_model.cpp} (73%) rename code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/{zone_list_model.h => list_zones_model.h} (86%) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/CMakeLists.txt index 2f7487fe7..714d1f125 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/CMakeLists.txt @@ -12,12 +12,13 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin. SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR landscape_editor_plugin.h landscape_editor_window.h landscape_scene.h - zone_list_model.h - zone_list_widget.h + list_zones_model.h + list_zones_widget.h + landscape_actions.h ) SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS landscape_editor_window.ui - zone_list_widget.ui + list_zones_widget.ui ) SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS landscape_editor.qrc) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp index d79770cf3..42242921e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp @@ -17,7 +17,7 @@ // Project includes #include "builder_zone.h" -#include "zone_list_model.h" +#include "list_zones_model.h" // NeL includes #include @@ -32,7 +32,7 @@ namespace LandscapeEditor ZoneBuilder::ZoneBuilder() : m_zoneListModel(0) { - m_zoneListModel = new ZoneListModel(); + m_zoneListModel = new ListZonesModel(); m_lastPathName = ""; } @@ -67,7 +67,6 @@ bool ZoneBuilder::init(const QString &pathName, bool makeAZone) return false; } } - if ((makeAZone) && (bRet)) newZone(); return bRet; @@ -92,7 +91,7 @@ bool ZoneBuilder::initZoneBank (const QString &pathName) return true; } -ZoneListModel *ZoneBuilder::zoneModel() const +ListZonesModel *ZoneBuilder::zoneModel() const { return m_zoneListModel; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.h index b578a2bb2..97c4d8d3a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.h @@ -32,7 +32,7 @@ namespace LandscapeEditor { -class ZoneListModel; +class ListZonesModel; /** @class ZoneBuilder @@ -56,7 +56,7 @@ public: { return m_zoneBank; } - ZoneListModel *zoneModel() const; + ListZonesModel *zoneModel() const; private: // Scan ./zoneligos dir and add all *.ligozone files to zoneBank @@ -65,7 +65,7 @@ private: sint32 m_minX, m_maxX, m_minY, m_maxY; QString m_lastPathName; - ZoneListModel *m_zoneListModel; + ListZonesModel *m_zoneListModel; NLLIGO::CZoneBank m_zoneBank; std::vector m_currentSelection; }; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.cpp similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.cpp index 423c2c50f..f0b86dd8e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.cpp @@ -16,7 +16,7 @@ // along with this program. If not, see . // Project includes -#include "zone_list_widget.h" +#include "landscape_actions.h" // NeL includes #include @@ -25,20 +25,4 @@ namespace LandscapeEditor { - -ZoneListWidget::ZoneListWidget(QWidget *parent) - : QWidget(parent) -{ - m_ui.setupUi(this); -} - -ZoneListWidget::~ZoneListWidget() -{ -} - -void ZoneListWidget::setModel(QAbstractItemModel *model) -{ - m_ui.listView->setModel(model); -} - } /* namespace LandscapeEditor */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.h similarity index 68% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.h index 5b90f81d6..fdcda5451 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.h @@ -15,11 +15,10 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#ifndef ZONE_LIST_WIDGET_H -#define ZONE_LIST_WIDGET_H +#ifndef LANDSCAPE_ACTIONS_H +#define LANDSCAPE_ACTIONS_H // Project includes -#include "ui_zone_list_widget.h" // NeL includes @@ -27,28 +26,7 @@ namespace LandscapeEditor { -/** -@class ZoneListWidget -@brief ZoneListWidget -@details -*/ -class ZoneListWidget: public QWidget -{ - Q_OBJECT - -public: - ZoneListWidget(QWidget *parent = 0); - ~ZoneListWidget(); - - void setModel(QAbstractItemModel *model); - -Q_SIGNALS: -public Q_SLOTS: -private Q_SLOTS: -private: - Ui::ZoneListWidget m_ui; -}; /* ZoneListWidget */ } /* namespace LandscapeEditor */ -#endif // ZONE_LIST_WIDGET_H +#endif // LANDSCAPE_ACTIONS_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp index c46278f38..eb9b8b8e8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp @@ -18,7 +18,7 @@ // Project includes #include "landscape_editor_window.h" #include "landscape_editor_constants.h" -#include "zone_list_model.h" +#include "list_zones_model.h" #include "../core/icore.h" #include "../core/imenu_manager.h" @@ -41,11 +41,11 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent) m_ui.setupUi(this); m_undoStack = new QUndoStack(this); - /* - m_zoneBuilder = new ZoneBuilder(); - m_zoneBuilder->init("e:/-nel-/install/continents/newbieland", false); - m_ui.zoneListWidget->setModel(m_zoneBuilder->zoneModel()); - */ + m_zoneBuilder = new ZoneBuilder(); + m_zoneBuilder->init("e:/-nel-/install/continents/newbieland", false); + m_ui.zoneListWidget->setModel(m_zoneBuilder->zoneModel()); + m_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder); + m_ui.zoneListWidget->updateUi(); createMenus(); readSettings(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui index ce6e905a3..ac16ad9fd 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui @@ -42,14 +42,14 @@ 2 - + - LandscapeEditor::ZoneListWidget + LandscapeEditor::ListZonesWidget QWidget -
zone_list_widget.h
+
list_zones_widget.h
1
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp similarity index 73% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_model.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp index 32dded570..ffcb7617b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp @@ -16,7 +16,7 @@ // along with this program. If not, see . // Project includes -#include "zone_list_model.h" +#include "list_zones_model.h" // NeL includes #include @@ -33,28 +33,28 @@ namespace LandscapeEditor { -ZoneListModel::ZoneListModel(int pixmapSize, QObject *parent) +ListZonesModel::ListZonesModel(int pixmapSize, QObject *parent) : QAbstractListModel(parent), m_pixmapSize(pixmapSize) { } -ZoneListModel::~ZoneListModel() +ListZonesModel::~ListZonesModel() { resetModel(); } -int ZoneListModel::rowCount(const QModelIndex & /* parent */) const +int ListZonesModel::rowCount(const QModelIndex & /* parent */) const { - return m_pixmapMap.count(); + return m_pixmapNameList.count(); } -int ZoneListModel::columnCount(const QModelIndex & /* parent */) const +int ListZonesModel::columnCount(const QModelIndex & /* parent */) const { return 1; } -QVariant ZoneListModel::data(const QModelIndex &index, int role) const +QVariant ListZonesModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); @@ -75,21 +75,29 @@ QVariant ZoneListModel::data(const QModelIndex &index, int role) const return QVariant(); } -QVariant ZoneListModel::headerData(int section, - Qt::Orientation /* orientation */, - int role) const +QVariant ListZonesModel::headerData(int section, + Qt::Orientation /* orientation */, + int role) const { if (role != Qt::DisplayRole) return QVariant(); return QVariant(); } -void ZoneListModel::setSmallPixmapSize(int pixmapSize) +void ListZonesModel::setSmallPixmapSize(int pixmapSize) { m_pixmapSize = pixmapSize; } -void ZoneListModel::resetModel() +void ListZonesModel::setListZones(QStringList &listZones) +{ + beginResetModel(); + m_pixmapNameList.clear(); + m_pixmapNameList = listZones; + endResetModel(); +} + +void ListZonesModel::resetModel() { beginResetModel(); Q_FOREACH(QString name, m_pixmapNameList) @@ -105,12 +113,13 @@ void ZoneListModel::resetModel() endResetModel(); } -bool ZoneListModel::rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zoneBank) +bool ListZonesModel::rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zoneBank) { beginResetModel(); m_zonePath = zonePath; QProgressDialog *progressDialog = new QProgressDialog(); + progressDialog->show(); std::vector zoneNames; zoneBank.getCategoryValues ("zone", zoneNames); @@ -129,19 +138,22 @@ bool ZoneListModel::rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zon const std::vector &rMask = zoneBankItem->getMask(); QPixmap *pixmap = new QPixmap(zonePath + zonePixmapName + ".png"); + if (pixmap->isNull()) + { + // Generate filled pixmap + } QPixmap *smallPixmap = new QPixmap(pixmap->scaled(m_pixmapSize * sizeX, m_pixmapSize * sizeY)); m_pixmapMap.insert(zonePixmapName, pixmap); m_smallPixmapMap.insert(zonePixmapName, smallPixmap); } - m_pixmapNameList = m_pixmapMap.keys(); endResetModel(); delete progressDialog; - return false; + return true; } -QPixmap *ZoneListModel::getPixmap(const QString &zoneName) const +QPixmap *ListZonesModel::getPixmap(const QString &zoneName) const { QPixmap *result = 0; if (!m_pixmapMap.contains(zoneName)) @@ -151,7 +163,7 @@ QPixmap *ZoneListModel::getPixmap(const QString &zoneName) const return result; } -QPixmap *ZoneListModel::getSmallPixmap(const QString &zoneName) const +QPixmap *ListZonesModel::getSmallPixmap(const QString &zoneName) const { QPixmap *result = 0; if (!m_pixmapMap.contains(zoneName)) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.h similarity index 86% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_model.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.h index 1bfb0f93f..16a28bf07 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_model.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.h @@ -15,8 +15,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#ifndef ZONE_LIST_MODEL_H -#define ZONE_LIST_MODEL_H +#ifndef LIST_ZONES_MODEL_H +#define LIST_ZONES_MODEL_H // Project includes @@ -33,17 +33,17 @@ namespace LandscapeEditor { /** -@class ZoneListModel -@brief ZoneListModel contains the image database for QGraphicsScene and +@class ListZonesModel +@brief ListZonesModel contains the image database for QGraphicsScene and small images for QListView @details */ -class ZoneListModel : public QAbstractListModel +class ListZonesModel : public QAbstractListModel { Q_OBJECT public: - ZoneListModel(int pixmapSize = 64, QObject *parent = 0); - ~ZoneListModel(); + ListZonesModel(int pixmapSize = 64, QObject *parent = 0); + ~ListZonesModel(); int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; @@ -58,6 +58,8 @@ public: /// Unload all images and reset model void resetModel(); + void setListZones(QStringList &listZones); + /// Load all images(png) from zonePath, list images gets from zoneBank bool rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zoneBank); @@ -79,4 +81,4 @@ private: } /* namespace LandscapeEditor */ -#endif // ZONE_LIST_MODEL_H +#endif // LIST_ZONES_MODEL_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp new file mode 100644 index 000000000..8dcb87383 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp @@ -0,0 +1,219 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// Project includes +#include "list_zones_widget.h" +#include "builder_zone.h" +#include "list_zones_model.h" + +// NeL includes +#include +#include +#include + +// STL includes +#include +#include + +// Qt includes +#include + +namespace LandscapeEditor +{ + +ListZonesWidget::ListZonesWidget(QWidget *parent) + : QWidget(parent), + m_zoneBuilder(0) +{ + m_ui.setupUi(this); + + m_ui.addFilterButton_1->setChecked(false); + m_ui.addFilterButton_2->setChecked(false); + m_ui.addFilterButton_3->setChecked(false); + + connect(m_ui.categoryTypeComboBox_1, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateFilters_1(QString))); + connect(m_ui.categoryTypeComboBox_2, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateFilters_2(QString))); + connect(m_ui.categoryTypeComboBox_3, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateFilters_3(QString))); + connect(m_ui.categoryTypeComboBox_4, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateFilters_4(QString))); + connect(m_ui.categoryValueComboBox_1, SIGNAL(currentIndexChanged(int)), this, SLOT(updateListZones())); + connect(m_ui.categoryValueComboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(updateListZones())); + connect(m_ui.categoryValueComboBox_3, SIGNAL(currentIndexChanged(int)), this, SLOT(updateListZones())); + connect(m_ui.categoryValueComboBox_4, SIGNAL(currentIndexChanged(int)), this, SLOT(updateListZones())); + connect(m_ui.logicComboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(updateListZones())); + connect(m_ui.logicComboBox_3, SIGNAL(currentIndexChanged(int)), this, SLOT(updateListZones())); + connect(m_ui.logicComboBox_4, SIGNAL(currentIndexChanged(int)), this, SLOT(updateListZones())); +} + +ListZonesWidget::~ListZonesWidget() +{ +} + +void ListZonesWidget::updateUi() +{ + if (m_zoneBuilder == 0) + return; + + disableSignals(true); + std::vector listCategoryType; + m_zoneBuilder->getZoneBank().getCategoriesType(listCategoryType); + + QStringList listCategories; + + listCategories << STRING_UNUSED; + for (size_t i = 0; i < listCategoryType.size(); ++i) + listCategories << QString(listCategoryType[i].c_str()); + + m_ui.categoryTypeComboBox_1->clear(); + m_ui.categoryTypeComboBox_2->clear(); + m_ui.categoryTypeComboBox_3->clear(); + m_ui.categoryTypeComboBox_4->clear(); + + m_ui.categoryTypeComboBox_1->addItems(listCategories); + m_ui.categoryTypeComboBox_2->addItems(listCategories); + m_ui.categoryTypeComboBox_3->addItems(listCategories); + m_ui.categoryTypeComboBox_4->addItems(listCategories); + + disableSignals(false); +} + +void ListZonesWidget::setModel(QAbstractItemModel *model) +{ + m_ui.listView->setModel(model); +} + +void ListZonesWidget::setZoneBuilder(ZoneBuilder *zoneBuilder) +{ + m_zoneBuilder = zoneBuilder; +} + +void ListZonesWidget::updateFilters_1(const QString &value) +{ + disableSignals(true); + std::vector allCategoryValues; + m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + m_ui.categoryValueComboBox_1->clear(); + for(size_t i = 0; i < allCategoryValues.size(); ++i) + m_ui.categoryValueComboBox_1->addItem(QString(allCategoryValues[i].c_str())); + + disableSignals(false); + updateListZones(); +} + +void ListZonesWidget::updateFilters_2(const QString &value) +{ + disableSignals(true); + std::vector allCategoryValues; + m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + + m_ui.categoryValueComboBox_2->clear(); + for(size_t i = 0; i < allCategoryValues.size(); ++i) + m_ui.categoryValueComboBox_2->addItem(QString(allCategoryValues[i].c_str())); + + disableSignals(false); + updateListZones(); +} + +void ListZonesWidget::updateFilters_3(const QString &value) +{ + disableSignals(true); + std::vector allCategoryValues; + m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + + m_ui.categoryValueComboBox_3->clear(); + for(size_t i = 0; i < allCategoryValues.size(); ++i) + m_ui.categoryValueComboBox_3->addItem(QString(allCategoryValues[i].c_str())); + + disableSignals(false); + updateListZones(); +} + +void ListZonesWidget::updateFilters_4(const QString &value) +{ + disableSignals(true); + std::vector allCategoryValues; + m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + + m_ui.categoryValueComboBox_4->clear(); + for(size_t i = 0; i < allCategoryValues.size(); ++i) + m_ui.categoryValueComboBox_4->addItem(QString(allCategoryValues[i].c_str())); + + disableSignals(false); + updateListZones(); +} + +void ListZonesWidget::updateListZones() +{ + // Execute the filter + NLLIGO::CZoneBank &zoneBank = m_zoneBuilder->getZoneBank(); + zoneBank.resetSelection (); + + if(m_ui.categoryTypeComboBox_1->currentIndex() > 0 ) + zoneBank.addOrSwitch (m_ui.categoryTypeComboBox_1->currentText().toStdString() + , m_ui.categoryValueComboBox_1->currentText().toStdString()); + + if(m_ui.categoryTypeComboBox_2->currentIndex() > 0 ) + { + if (m_ui.logicComboBox_2->currentIndex() == 0) // AND switch wanted + zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_2->currentText().toStdString() + ,m_ui.categoryValueComboBox_2->currentText().toStdString()); + else // OR switch wanted + zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_2->currentText().toStdString() + ,m_ui.categoryValueComboBox_2->currentText().toStdString()); + } + + if(m_ui.categoryTypeComboBox_3->currentIndex() > 0 ) + { + if (m_ui.logicComboBox_3->currentIndex() == 0) // AND switch wanted + zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_3->currentText().toStdString() + ,m_ui.categoryValueComboBox_3->currentText().toStdString()); + else // OR switch wanted + zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_3->currentText().toStdString() + ,m_ui.categoryValueComboBox_3->currentText().toStdString()); + } + + if(m_ui.categoryTypeComboBox_4->currentIndex() > 0 ) + { + if (m_ui.logicComboBox_4->currentIndex() == 0) // AND switch wanted + zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_4->currentText().toStdString() + ,m_ui.categoryValueComboBox_4->currentText().toStdString()); + else // OR switch wanted + zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_4->currentText().toStdString() + ,m_ui.categoryValueComboBox_4->currentText().toStdString()); + } + + std::vector currentSelection; + zoneBank.getSelection (currentSelection); + + QStringList listSelection; + for (size_t i = 0; i < currentSelection.size(); ++i) + listSelection << currentSelection[i]->getName().c_str(); + m_zoneBuilder->zoneModel()->setListZones(listSelection); +} + +void ListZonesWidget::disableSignals(bool block) +{ + m_ui.categoryTypeComboBox_1->blockSignals(block); + m_ui.categoryTypeComboBox_2->blockSignals(block); + m_ui.categoryTypeComboBox_3->blockSignals(block); + m_ui.categoryTypeComboBox_4->blockSignals(block); + m_ui.categoryValueComboBox_1->blockSignals(block); + m_ui.categoryValueComboBox_2->blockSignals(block); + m_ui.categoryValueComboBox_3->blockSignals(block); + m_ui.categoryValueComboBox_4->blockSignals(block); +} + +} /* namespace LandscapeEditor */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.h new file mode 100644 index 000000000..fed0134cf --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.h @@ -0,0 +1,68 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef LIST_ZONES_WIDGET_H +#define LIST_ZONES_WIDGET_H + +// Project includes +#include "ui_list_zones_widget.h" + +// NeL includes + +// Qt includes + +namespace LandscapeEditor +{ +class ZoneBuilder; + +/** +@class ZoneListWidget +@brief ZoneListWidget +@details +*/ +class ListZonesWidget: public QWidget +{ + Q_OBJECT + +public: + ListZonesWidget(QWidget *parent = 0); + ~ListZonesWidget(); + + void updateUi(); + void setZoneBuilder(ZoneBuilder *zoneBuilder); + void setModel(QAbstractItemModel *model); + +Q_SIGNALS: +public Q_SLOTS: + void updateFilters_1(const QString &value); + void updateFilters_2(const QString &value); + void updateFilters_3(const QString &value); + void updateFilters_4(const QString &value); + +private Q_SLOTS: + void updateListZones(); + +private: + void disableSignals(bool block); + + ZoneBuilder *m_zoneBuilder; + Ui::ListZonesWidget m_ui; +}; /* ZoneListWidget */ + +} /* namespace LandscapeEditor */ + +#endif // LIST_ZONES_WIDGET_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.ui new file mode 100644 index 000000000..585371cb7 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.ui @@ -0,0 +1,478 @@ + + + ListZonesWidget + + + + 0 + 0 + 359 + 579 + + + + Form + + + + 3 + + + 3 + + + + + Filter + + + + 6 + + + 3 + + + + + + + + + + + + Random + + + + + Fyll cycle + + + + + + + + true + + + + + + + true + + + + + + + true + + + + And + + + + + Or + + + + + + + + true + + + + + + + true + + + + + + + true + + + + And + + + + + Or + + + + + + + + true + + + + + + + true + + + + + + + true + + + + And + + + + + Or + + + + + + + + ... + + + + :/core/icons/ic_nel_add_item.png + :/core/icons/ic_nel_delete_item.png:/core/icons/ic_nel_add_item.png + + + true + + + true + + + + + + + ... + + + + :/core/icons/ic_nel_add_item.png + :/core/icons/ic_nel_delete_item.png:/core/icons/ic_nel_add_item.png + + + true + + + true + + + + + + + ... + + + + :/core/icons/ic_nel_add_item.png + :/core/icons/ic_nel_delete_item.png:/core/icons/ic_nel_add_item.png + + + true + + + true + + + + + + + + + + Placement + + + + 6 + + + 3 + + + + + + + + + + + 90° + + + + + 180° + + + + + 170° + + + + + Random + + + + + Full cycle + + + + + + + + + NoFlip + + + + + Flip + + + + + Random + + + + + Fyll cycle + + + + + + + + Force + + + + + + + Not propogate + + + + + + + + + + + + + + + + + addFilterButton_1 + toggled(bool) + categoryTypeComboBox_2 + setVisible(bool) + + + 20 + 36 + + + 81 + 53 + + + + + addFilterButton_1 + toggled(bool) + categoryValueComboBox_2 + setVisible(bool) + + + 24 + 32 + + + 181 + 50 + + + + + addFilterButton_1 + toggled(bool) + logicComboBox_2 + setVisible(bool) + + + 20 + 31 + + + 301 + 55 + + + + + addFilterButton_2 + toggled(bool) + categoryTypeComboBox_3 + setVisible(bool) + + + 27 + 62 + + + 57 + 75 + + + + + addFilterButton_2 + toggled(bool) + categoryValueComboBox_3 + setVisible(bool) + + + 23 + 58 + + + 156 + 76 + + + + + addFilterButton_2 + toggled(bool) + logicComboBox_3 + setVisible(bool) + + + 23 + 53 + + + 255 + 77 + + + + + addFilterButton_3 + toggled(bool) + categoryTypeComboBox_4 + setVisible(bool) + + + 32 + 94 + + + 44 + 104 + + + + + addFilterButton_3 + toggled(bool) + categoryValueComboBox_4 + setVisible(bool) + + + 32 + 94 + + + 207 + 103 + + + + + addFilterButton_3 + toggled(bool) + logicComboBox_4 + setVisible(bool) + + + 21 + 81 + + + 278 + 104 + + + + + addFilterButton_2 + toggled(bool) + addFilterButton_3 + setVisible(bool) + + + 15 + 59 + + + 16 + 80 + + + + + addFilterButton_1 + toggled(bool) + addFilterButton_2 + setVisible(bool) + + + 13 + 35 + + + 17 + 60 + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.ui deleted file mode 100644 index 725e6cf83..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_list_widget.ui +++ /dev/null @@ -1,266 +0,0 @@ - - - ZoneListWidget - - - - 0 - 0 - 359 - 579 - - - - Form - - - - 3 - - - 3 - - - - - Filter - - - - 6 - - - 3 - - - - - - <Unused> - - - - - - - - - - - - Random - - - - - Fyll cycle - - - - - - - - true - - - - <Unused> - - - - - - - - true - - - - - - - true - - - - And - - - - - Or - - - - - - - - false - - - - <Unused> - - - - - - - - false - - - - - - - false - - - - And - - - - - Or - - - - - - - - false - - - - <Unused> - - - - - - - - false - - - - - - - false - - - - And - - - - - Or - - - - - - - - - - - Placement - - - - 6 - - - 3 - - - - - - - - - - - 90° - - - - - 180° - - - - - 170° - - - - - Random - - - - - Full cycle - - - - - - - - - NoFlip - - - - - Flip - - - - - Random - - - - - Fyll cycle - - - - - - - - Force - - - - - - - Not propogate - - - - - - - - - - - - - -