mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-07 15:59:01 +00:00
Changed: #1301 Added project settings dialog.
This commit is contained in:
parent
cd72978299
commit
f02f5525aa
13 changed files with 429 additions and 99 deletions
|
@ -15,10 +15,12 @@ SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR landscape_editor_plugin.h
|
|||
list_zones_model.h
|
||||
list_zones_widget.h
|
||||
landscape_actions.h
|
||||
project_settings_dialog.h
|
||||
)
|
||||
|
||||
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS landscape_editor_window.ui
|
||||
list_zones_widget.ui
|
||||
project_settings_dialog.ui
|
||||
)
|
||||
|
||||
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS landscape_editor.qrc)
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
// Project includes
|
||||
#include "builder_zone.h"
|
||||
#include "list_zones_model.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
@ -25,20 +24,97 @@
|
|||
// Qt includes
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QProgressDialog>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
const int PixmapScale = 256;
|
||||
|
||||
PixmapDatabase::PixmapDatabase()
|
||||
{
|
||||
}
|
||||
|
||||
PixmapDatabase::~PixmapDatabase()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
bool PixmapDatabase::loadPixmaps(const QString &zonePath, NLLIGO::CZoneBank &zoneBank)
|
||||
{
|
||||
QProgressDialog *progressDialog = new QProgressDialog();
|
||||
progressDialog->show();
|
||||
|
||||
std::vector<std::string> listNames;
|
||||
zoneBank.getCategoryValues ("zone", listNames);
|
||||
progressDialog->setRange(0, listNames.size());
|
||||
for (uint i = 0; i < listNames.size(); ++i)
|
||||
{
|
||||
QApplication::processEvents();
|
||||
progressDialog->setValue(i);
|
||||
|
||||
NLLIGO::CZoneBankElement *zoneBankItem = zoneBank.getElementByZoneName (listNames[i]);
|
||||
|
||||
// Read the texture file
|
||||
QString zonePixmapName(listNames[i].c_str());
|
||||
uint8 sizeX = zoneBankItem->getSizeX();
|
||||
uint8 sizeY = zoneBankItem->getSizeY();
|
||||
|
||||
QPixmap *pixmap = new QPixmap(zonePath + zonePixmapName + ".png");
|
||||
if (pixmap->isNull())
|
||||
{
|
||||
// Generate filled pixmap
|
||||
}
|
||||
// All pixmaps must be have same size
|
||||
if (pixmap->width() != sizeX * PixmapScale)
|
||||
{
|
||||
QPixmap *scaledPixmap = new QPixmap(pixmap->scaled(sizeX * PixmapScale, sizeY * PixmapScale));
|
||||
delete pixmap;
|
||||
m_pixmapMap.insert(zonePixmapName, scaledPixmap);
|
||||
}
|
||||
else
|
||||
m_pixmapMap.insert(zonePixmapName, pixmap);
|
||||
}
|
||||
delete progressDialog;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PixmapDatabase::reset()
|
||||
{
|
||||
QStringList listNames(m_pixmapMap.keys());
|
||||
Q_FOREACH(QString name, listNames)
|
||||
{
|
||||
QPixmap *pixmap = m_pixmapMap.value(name);
|
||||
delete pixmap;
|
||||
}
|
||||
m_pixmapMap.clear();
|
||||
}
|
||||
|
||||
QStringList PixmapDatabase::listPixmaps() const
|
||||
{
|
||||
return m_pixmapMap.keys();
|
||||
}
|
||||
|
||||
QPixmap *PixmapDatabase::pixmap(const QString &zoneName) const
|
||||
{
|
||||
QPixmap *result = 0;
|
||||
if (!m_pixmapMap.contains(zoneName))
|
||||
nlwarning("QPixmap %s not found", zoneName.toStdString().c_str());
|
||||
else
|
||||
result = m_pixmapMap.value(zoneName);
|
||||
return result;
|
||||
}
|
||||
|
||||
ZoneBuilder::ZoneBuilder()
|
||||
: m_zoneListModel(0)
|
||||
: m_pixmapDatabase(0)
|
||||
{
|
||||
m_zoneListModel = new ListZonesModel();
|
||||
m_pixmapDatabase = new PixmapDatabase();
|
||||
m_lastPathName = "";
|
||||
}
|
||||
|
||||
ZoneBuilder::~ZoneBuilder()
|
||||
{
|
||||
delete m_zoneListModel;
|
||||
delete m_pixmapDatabase;
|
||||
}
|
||||
|
||||
bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
||||
|
@ -60,8 +136,8 @@ bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
|||
// Construct the DataBase from the ZoneBank
|
||||
QString zoneBitmapPath = pathName;
|
||||
zoneBitmapPath += "/zonebitmaps/";
|
||||
m_zoneListModel->resetModel();
|
||||
if (!m_zoneListModel->rebuildModel(zoneBitmapPath, m_zoneBank))
|
||||
m_pixmapDatabase->reset();
|
||||
if (!m_pixmapDatabase->loadPixmaps(zoneBitmapPath, m_zoneBank))
|
||||
{
|
||||
m_zoneBank.reset();
|
||||
return false;
|
||||
|
@ -91,9 +167,14 @@ bool ZoneBuilder::initZoneBank (const QString &pathName)
|
|||
return true;
|
||||
}
|
||||
|
||||
ListZonesModel *ZoneBuilder::zoneModel() const
|
||||
PixmapDatabase *ZoneBuilder::pixmapDatabase() const
|
||||
{
|
||||
return m_zoneListModel;
|
||||
return m_pixmapDatabase;
|
||||
}
|
||||
|
||||
QString ZoneBuilder::dataPath() const
|
||||
{
|
||||
return m_lastPathName;
|
||||
}
|
||||
|
||||
void ZoneBuilder::newZone (bool bDisplay)
|
||||
|
|
|
@ -29,16 +29,47 @@
|
|||
|
||||
// Qt includes
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QPixmap>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
class ListZonesModel;
|
||||
|
||||
/**
|
||||
@class PixmapDatabase
|
||||
@brief PixmapDatabase contains the image database
|
||||
@details
|
||||
*/
|
||||
class PixmapDatabase
|
||||
{
|
||||
public:
|
||||
PixmapDatabase();
|
||||
~PixmapDatabase();
|
||||
|
||||
/// Load all images(png) from zonePath, list images gets from zoneBank
|
||||
bool loadPixmaps(const QString &zonePath, NLLIGO::CZoneBank &zoneBank);
|
||||
|
||||
/// Unload all images
|
||||
void reset();
|
||||
|
||||
/// Get list names all loaded pixmaps
|
||||
QStringList listPixmaps() const;
|
||||
|
||||
/// Get original pixmap
|
||||
/// @return QPixmap* if the image is in the database ; otherwise returns 0.
|
||||
QPixmap *pixmap(const QString &zoneName) const;
|
||||
private:
|
||||
|
||||
QMap<QString, QPixmap*> m_pixmapMap;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class ZoneBuilder
|
||||
@brief ZoneBuilder contains all the shared data between the tools and the engine
|
||||
@details ZoneBank contains the macro zones that is composed of several zones plus a mask
|
||||
ZoneListModel contains the graphics for the zones
|
||||
PixmapDatabase contains the graphics for the zones
|
||||
*/
|
||||
class ZoneBuilder
|
||||
{
|
||||
|
@ -56,7 +87,11 @@ public:
|
|||
{
|
||||
return m_zoneBank;
|
||||
}
|
||||
ListZonesModel *zoneModel() const;
|
||||
|
||||
PixmapDatabase *pixmapDatabase() const;
|
||||
|
||||
QString dataPath() const;
|
||||
|
||||
private:
|
||||
|
||||
// Scan ./zoneligos dir and add all *.ligozone files to zoneBank
|
||||
|
@ -65,7 +100,7 @@ private:
|
|||
sint32 m_minX, m_maxX, m_minY, m_maxY;
|
||||
QString m_lastPathName;
|
||||
|
||||
ListZonesModel *m_zoneListModel;
|
||||
PixmapDatabase *m_pixmapDatabase;
|
||||
NLLIGO::CZoneBank m_zoneBank;
|
||||
std::vector<NLLIGO::CZoneBankElement*> m_currentSelection;
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// Project includes
|
||||
#include "landscape_editor_window.h"
|
||||
#include "landscape_editor_constants.h"
|
||||
#include "list_zones_model.h"
|
||||
#include "project_settings_dialog.h"
|
||||
|
||||
#include "../core/icore.h"
|
||||
#include "../core/imenu_manager.h"
|
||||
|
@ -43,15 +43,18 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
|
|||
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_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder);
|
||||
m_ui.zoneListWidget->updateUi();
|
||||
createMenus();
|
||||
createToolBars();
|
||||
readSettings();
|
||||
|
||||
connect(m_ui.projectSettingsAction, SIGNAL(triggered()), this, SLOT(openProjectSettings()));
|
||||
}
|
||||
|
||||
LandscapeEditorWindow::~LandscapeEditorWindow()
|
||||
{
|
||||
delete m_zoneBuilder;
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
|
@ -75,11 +78,37 @@ void LandscapeEditorWindow::open()
|
|||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void LandscapeEditorWindow::openProjectSettings()
|
||||
{
|
||||
ProjectSettingsDialog *dialog = new ProjectSettingsDialog(m_zoneBuilder->dataPath(), this);
|
||||
dialog->show();
|
||||
int ok = dialog->exec();
|
||||
if (ok == QDialog::Accepted)
|
||||
{
|
||||
m_zoneBuilder->init(dialog->dataPath(), false);
|
||||
m_ui.zoneListWidget->updateUi();
|
||||
}
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void LandscapeEditorWindow::createMenus()
|
||||
{
|
||||
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
|
||||
}
|
||||
|
||||
void LandscapeEditorWindow::createToolBars()
|
||||
{
|
||||
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
|
||||
//QAction *action = menuManager->action(Core::Constants::NEW);
|
||||
//m_ui.fileToolBar->addAction(action);
|
||||
QAction *action = menuManager->action(Core::Constants::OPEN);
|
||||
m_ui.fileToolBar->addAction(action);
|
||||
//action = menuManager->action(Core::Constants::SAVE);
|
||||
//m_ui.fileToolBar->addAction(action);
|
||||
//action = menuManager->action(Core::Constants::SAVE_AS);
|
||||
//m_ui.fileToolBar->addAction(action);
|
||||
}
|
||||
|
||||
void LandscapeEditorWindow::readSettings()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
|
|
|
@ -43,8 +43,11 @@ public Q_SLOTS:
|
|||
void open();
|
||||
|
||||
private Q_SLOTS:
|
||||
void openProjectSettings();
|
||||
|
||||
private:
|
||||
void createMenus();
|
||||
void createToolBars();
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<widget class="QToolBar" name="fileToolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
|
@ -44,6 +44,27 @@
|
|||
</attribute>
|
||||
<widget class="LandscapeEditor::ListZonesWidget" name="zoneListWidget"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="landToolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar_2</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="projectSettingsAction"/>
|
||||
</widget>
|
||||
<action name="projectSettingsAction">
|
||||
<property name="icon">
|
||||
<iconset resource="landscape_editor.qrc">
|
||||
<normaloff>:/icons/ic_nel_landscape_settings.png</normaloff>:/icons/ic_nel_landscape_settings.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Project settings</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
// Project includes
|
||||
#include "list_zones_model.h"
|
||||
#include "builder_zone.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
@ -27,15 +28,14 @@
|
|||
|
||||
// Qt includes
|
||||
#include <QApplication>
|
||||
#include <QSize>
|
||||
#include <QtGui/QProgressDialog>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
ListZonesModel::ListZonesModel(int pixmapSize, QObject *parent)
|
||||
ListZonesModel::ListZonesModel(int scaleRatio, QObject *parent)
|
||||
: QAbstractListModel(parent),
|
||||
m_pixmapSize(pixmapSize)
|
||||
m_scaleRatio(scaleRatio)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ ListZonesModel::~ListZonesModel()
|
|||
|
||||
int ListZonesModel::rowCount(const QModelIndex & /* parent */) const
|
||||
{
|
||||
return m_pixmapNameList.count();
|
||||
return m_listNames.count();
|
||||
}
|
||||
|
||||
int ListZonesModel::columnCount(const QModelIndex & /* parent */) const
|
||||
|
@ -65,11 +65,11 @@ QVariant ListZonesModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
else if (role == Qt::DisplayRole)
|
||||
{
|
||||
return m_pixmapNameList.at(index.row());
|
||||
return m_listNames.at(index.row());
|
||||
}
|
||||
else if (role == Qt::DecorationRole)
|
||||
{
|
||||
QPixmap *pixmap = getSmallPixmap(m_pixmapNameList.at(index.row()));
|
||||
QPixmap *pixmap = getPixmap(m_listNames.at(index.row()));
|
||||
return qVariantFromValue(*pixmap);
|
||||
}
|
||||
return QVariant();
|
||||
|
@ -84,73 +84,48 @@ QVariant ListZonesModel::headerData(int section,
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
void ListZonesModel::setSmallPixmapSize(int pixmapSize)
|
||||
void ListZonesModel::setScaleRatio(int scaleRatio)
|
||||
{
|
||||
m_pixmapSize = pixmapSize;
|
||||
m_scaleRatio = scaleRatio;
|
||||
}
|
||||
|
||||
void ListZonesModel::setListZones(QStringList &listZones)
|
||||
{
|
||||
beginResetModel();
|
||||
m_pixmapNameList.clear();
|
||||
m_pixmapNameList = listZones;
|
||||
m_listNames.clear();
|
||||
m_listNames = listZones;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void ListZonesModel::resetModel()
|
||||
{
|
||||
beginResetModel();
|
||||
Q_FOREACH(QString name, m_pixmapNameList)
|
||||
QStringList listNames(m_pixmapMap.keys());
|
||||
Q_FOREACH(QString name, listNames)
|
||||
{
|
||||
QPixmap *pixmap = m_pixmapMap.value(name);
|
||||
delete pixmap;
|
||||
QPixmap *smallPixmap = m_smallPixmapMap.value(name);
|
||||
delete smallPixmap;
|
||||
}
|
||||
m_pixmapMap.clear();
|
||||
m_pixmapNameList.clear();
|
||||
m_smallPixmapMap.clear();
|
||||
m_listNames.clear();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
bool ListZonesModel::rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zoneBank)
|
||||
void ListZonesModel::rebuildModel(PixmapDatabase *pixmapDatabase)
|
||||
{
|
||||
resetModel();
|
||||
|
||||
beginResetModel();
|
||||
m_zonePath = zonePath;
|
||||
QStringList listNames;
|
||||
listNames = pixmapDatabase->listPixmaps();
|
||||
|
||||
QProgressDialog *progressDialog = new QProgressDialog();
|
||||
progressDialog->show();
|
||||
|
||||
std::vector<std::string> zoneNames;
|
||||
zoneBank.getCategoryValues ("zone", zoneNames);
|
||||
progressDialog->setRange(0, zoneNames.size());
|
||||
for (uint i = 0; i < zoneNames.size(); ++i)
|
||||
Q_FOREACH(QString name, listNames)
|
||||
{
|
||||
QApplication::processEvents();
|
||||
progressDialog->setValue(i);
|
||||
|
||||
NLLIGO::CZoneBankElement *zoneBankItem = zoneBank.getElementByZoneName (zoneNames[i]);
|
||||
|
||||
// Read the texture file
|
||||
QString zonePixmapName(zoneNames[i].c_str());
|
||||
uint8 sizeX = zoneBankItem->getSizeX();
|
||||
uint8 sizeY = zoneBankItem->getSizeY();
|
||||
const std::vector<bool> &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);
|
||||
|
||||
QPixmap *pixmap = pixmapDatabase->pixmap(name);
|
||||
QPixmap *smallPixmap = new QPixmap(pixmap->scaled(pixmap->width() / m_scaleRatio, pixmap->height() / m_scaleRatio));
|
||||
m_pixmapMap.insert(name, smallPixmap);
|
||||
}
|
||||
endResetModel();
|
||||
delete progressDialog;
|
||||
return true;
|
||||
}
|
||||
|
||||
QPixmap *ListZonesModel::getPixmap(const QString &zoneName) const
|
||||
|
@ -163,15 +138,4 @@ QPixmap *ListZonesModel::getPixmap(const QString &zoneName) const
|
|||
return result;
|
||||
}
|
||||
|
||||
QPixmap *ListZonesModel::getSmallPixmap(const QString &zoneName) const
|
||||
{
|
||||
QPixmap *result = 0;
|
||||
if (!m_pixmapMap.contains(zoneName))
|
||||
nlwarning("QPixmap %s not found", zoneName.toStdString().c_str());
|
||||
else
|
||||
result = m_smallPixmapMap.value(zoneName);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
} /* namespace LandscapeEditor */
|
||||
|
|
|
@ -31,18 +31,18 @@
|
|||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
class PixmapDatabase;
|
||||
|
||||
/**
|
||||
@class ListZonesModel
|
||||
@brief ListZonesModel contains the image database for QGraphicsScene and
|
||||
small images for QListView
|
||||
@brief ListZonesModel contains the small images for QListView
|
||||
@details
|
||||
*/
|
||||
class ListZonesModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ListZonesModel(int pixmapSize = 64, QObject *parent = 0);
|
||||
ListZonesModel(int scaleRatio = 4, QObject *parent = 0);
|
||||
~ListZonesModel();
|
||||
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
|
@ -53,30 +53,25 @@ public:
|
|||
|
||||
/// Set size for small pixmaps
|
||||
/// Value should be set before calling rebuildModel
|
||||
void setSmallPixmapSize(int pixmapSize);
|
||||
void setScaleRatio(int scaleRatio);
|
||||
|
||||
/// Unload all images and reset model
|
||||
void resetModel();
|
||||
|
||||
/// Set current list zones which will be available in QListView
|
||||
void setListZones(QStringList &listZones);
|
||||
|
||||
/// Load all images(png) from zonePath, list images gets from zoneBank
|
||||
bool rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zoneBank);
|
||||
/// Build own pixmaps database(all images are scaled: width/scaleRatio, height/scaleRatio) from pixmapDatabase
|
||||
void rebuildModel(PixmapDatabase *pixmapDatabase);
|
||||
|
||||
/// Get original pixmap
|
||||
private:
|
||||
/// Get pixmap
|
||||
/// @return QPixmap* if the image is in the database ; otherwise returns 0.
|
||||
QPixmap *getPixmap(const QString &zoneName) const;
|
||||
|
||||
/// Get scaled pixmap (pixmapSize * zoneSize.sizeX, pixmapSize * zoneSize.sizeY)
|
||||
/// @return QPixmap* if the image is in the database ; otherwise returns 0.
|
||||
QPixmap *getSmallPixmap(const QString &zoneName) const;
|
||||
private:
|
||||
|
||||
QString m_zonePath;
|
||||
int m_pixmapSize;
|
||||
int m_scaleRatio;
|
||||
QMap<QString, QPixmap*> m_pixmapMap;
|
||||
QMap<QString, QPixmap*> m_smallPixmapMap;
|
||||
QList<QString> m_pixmapNameList;
|
||||
QStringList m_listNames;
|
||||
};
|
||||
|
||||
} /* namespace LandscapeEditor */
|
||||
|
|
|
@ -37,10 +37,14 @@ namespace LandscapeEditor
|
|||
|
||||
ListZonesWidget::ListZonesWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_listZonesModel(0),
|
||||
m_zoneBuilder(0)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
m_listZonesModel = new ListZonesModel(4, this);
|
||||
m_ui.listView->setModel(m_listZonesModel);
|
||||
|
||||
m_ui.addFilterButton_1->setChecked(false);
|
||||
m_ui.addFilterButton_2->setChecked(false);
|
||||
m_ui.addFilterButton_3->setChecked(false);
|
||||
|
@ -81,6 +85,10 @@ void ListZonesWidget::updateUi()
|
|||
m_ui.categoryTypeComboBox_2->clear();
|
||||
m_ui.categoryTypeComboBox_3->clear();
|
||||
m_ui.categoryTypeComboBox_4->clear();
|
||||
m_ui.categoryValueComboBox_1->clear();
|
||||
m_ui.categoryValueComboBox_2->clear();
|
||||
m_ui.categoryValueComboBox_3->clear();
|
||||
m_ui.categoryValueComboBox_4->clear();
|
||||
|
||||
m_ui.categoryTypeComboBox_1->addItems(listCategories);
|
||||
m_ui.categoryTypeComboBox_2->addItems(listCategories);
|
||||
|
@ -88,11 +96,8 @@ void ListZonesWidget::updateUi()
|
|||
m_ui.categoryTypeComboBox_4->addItems(listCategories);
|
||||
|
||||
disableSignals(false);
|
||||
}
|
||||
|
||||
void ListZonesWidget::setModel(QAbstractItemModel *model)
|
||||
{
|
||||
m_ui.listView->setModel(model);
|
||||
m_listZonesModel->rebuildModel(m_zoneBuilder->pixmapDatabase());
|
||||
}
|
||||
|
||||
void ListZonesWidget::setZoneBuilder(ZoneBuilder *zoneBuilder)
|
||||
|
@ -201,7 +206,8 @@ void ListZonesWidget::updateListZones()
|
|||
QStringList listSelection;
|
||||
for (size_t i = 0; i < currentSelection.size(); ++i)
|
||||
listSelection << currentSelection[i]->getName().c_str();
|
||||
m_zoneBuilder->zoneModel()->setListZones(listSelection);
|
||||
|
||||
m_listZonesModel->setListZones(listSelection);
|
||||
}
|
||||
|
||||
void ListZonesWidget::disableSignals(bool block)
|
||||
|
|
|
@ -28,10 +28,11 @@
|
|||
namespace LandscapeEditor
|
||||
{
|
||||
class ZoneBuilder;
|
||||
class ListZonesModel;
|
||||
|
||||
/**
|
||||
@class ZoneListWidget
|
||||
@brief ZoneListWidget
|
||||
@brief ZoneListWidget displays list available zones in accordance with the filter settings
|
||||
@details
|
||||
*/
|
||||
class ListZonesWidget: public QWidget
|
||||
|
@ -44,21 +45,19 @@ public:
|
|||
|
||||
void updateUi();
|
||||
void setZoneBuilder(ZoneBuilder *zoneBuilder);
|
||||
void setModel(QAbstractItemModel *model);
|
||||
|
||||
Q_SIGNALS:
|
||||
public Q_SLOTS:
|
||||
private 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);
|
||||
|
||||
ListZonesModel *m_listZonesModel;
|
||||
ZoneBuilder *m_zoneBuilder;
|
||||
Ui::ListZonesWidget m_ui;
|
||||
}; /* ZoneListWidget */
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Project includes
|
||||
#include "project_settings_dialog.h"
|
||||
#include "landscape_editor_constants.h"
|
||||
|
||||
#include "../core/icore.h"
|
||||
#include "../core/core_constants.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QFileDialog>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
ProjectSettingsDialog::ProjectSettingsDialog(const QString &dataPath, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.pathLineEdit->setText(dataPath);
|
||||
setFixedHeight(sizeHint().height());
|
||||
}
|
||||
|
||||
ProjectSettingsDialog::~ProjectSettingsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
QString ProjectSettingsDialog::dataPath() const
|
||||
{
|
||||
return m_ui.pathLineEdit->text();
|
||||
}
|
||||
|
||||
} /* namespace LandscapeEditor */
|
|
@ -0,0 +1,46 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PROJECT_SETTINGS_DIALOG_H
|
||||
#define PROJECT_SETTINGS_DIALOG_H
|
||||
|
||||
// Project includes
|
||||
#include "ui_project_settings_dialog.h"
|
||||
|
||||
// Qt includes
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
class ProjectSettingsDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProjectSettingsDialog(const QString &dataPath, QWidget *parent = 0);
|
||||
~ProjectSettingsDialog();
|
||||
|
||||
QString dataPath() const;
|
||||
|
||||
private:
|
||||
|
||||
Ui::ProjectSettingsDialog m_ui;
|
||||
}; /* class ProjectSettingsDialog */
|
||||
|
||||
} /* namespace LandscapeEditor */
|
||||
|
||||
#endif // PROJECT_SETTINGS_DIALOG_H
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectSettingsDialog</class>
|
||||
<widget class="QDialog" name="ProjectSettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>419</width>
|
||||
<height>93</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Project settings</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="landscape_editor.qrc">
|
||||
<normaloff>:/icons/ic_nel_landscape_settings.png</normaloff>:/icons/ic_nel_landscape_settings.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Data directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="pathLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectPathButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Context:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="contextComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="landscape_editor.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ProjectSettingsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ProjectSettingsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in a new issue