mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-26 02:40:54 +00:00
Added: #1301 Added pixmap database
This commit is contained in:
parent
06e79a3308
commit
3ccfad6d6b
16 changed files with 962 additions and 3 deletions
|
@ -11,9 +11,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
|
||||
)
|
||||
|
||||
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS landscape_editor_window.ui
|
||||
zone_list_widget.ui
|
||||
)
|
||||
|
||||
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS landscape_editor.qrc)
|
||||
|
@ -37,7 +41,7 @@ ADD_LIBRARY(ovqt_plugin_landscape_editor MODULE ${SRC}
|
|||
${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS}
|
||||
${OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_landscape_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_landscape_editor ovqt_plugin_core nelmisc nel3d nelgeorges nelligo ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_landscape_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Landscape Editor")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_landscape_editor)
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
// 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 "builder_zone.h"
|
||||
#include "zone_list_model.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
ZoneBuilder::ZoneBuilder()
|
||||
: m_zoneListModel(0)
|
||||
{
|
||||
m_zoneListModel = new ZoneListModel();
|
||||
m_lastPathName = "";
|
||||
}
|
||||
|
||||
ZoneBuilder::~ZoneBuilder()
|
||||
{
|
||||
delete m_zoneListModel;
|
||||
}
|
||||
|
||||
bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
||||
{
|
||||
bool bRet = true;
|
||||
if (pathName != m_lastPathName)
|
||||
{
|
||||
m_lastPathName = pathName;
|
||||
QString zoneBankPath = pathName;
|
||||
zoneBankPath += "/zoneligos/";
|
||||
|
||||
// Init the ZoneBank
|
||||
m_zoneBank.reset ();
|
||||
if (!initZoneBank (zoneBankPath))
|
||||
{
|
||||
m_zoneBank.reset ();
|
||||
return false;
|
||||
}
|
||||
// Construct the DataBase from the ZoneBank
|
||||
QString zoneBitmapPath = pathName;
|
||||
zoneBitmapPath += "/zonebitmaps/";
|
||||
m_zoneListModel->resetModel();
|
||||
if (!m_zoneListModel->rebuildModel(zoneBitmapPath, m_zoneBank))
|
||||
{
|
||||
m_zoneBank.reset();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((makeAZone) && (bRet))
|
||||
newZone();
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool ZoneBuilder::initZoneBank (const QString &pathName)
|
||||
{
|
||||
QDir *dir = new QDir(pathName);
|
||||
QStringList filters;
|
||||
filters << "*.ligozone";
|
||||
|
||||
// Find all ligozone files in dir
|
||||
QStringList listFiles = dir->entryList(filters, QDir::Files);
|
||||
|
||||
std::string error;
|
||||
Q_FOREACH(QString file, listFiles)
|
||||
{
|
||||
//nlinfo(file.toStdString().c_str());
|
||||
if (!m_zoneBank.addElement((pathName + file).toStdString(), error))
|
||||
QMessageBox::critical(0, QObject::tr("Landscape editor"), QString(error.c_str()), QMessageBox::Ok);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ZoneListModel *ZoneBuilder::zoneModel() const
|
||||
{
|
||||
return m_zoneListModel;
|
||||
}
|
||||
|
||||
void ZoneBuilder::newZone (bool bDisplay)
|
||||
{
|
||||
}
|
||||
|
||||
} /* namespace LandscapeEditor */
|
|
@ -0,0 +1,75 @@
|
|||
// 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 BUILDER_ZONE_H
|
||||
#define BUILDER_ZONE_H
|
||||
|
||||
// Project includes
|
||||
|
||||
// NeL includes
|
||||
#include <nel/ligo/zone_bank.h>
|
||||
|
||||
// STL includes
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
class ZoneListModel;
|
||||
|
||||
/**
|
||||
@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
|
||||
*/
|
||||
class ZoneBuilder
|
||||
{
|
||||
public:
|
||||
ZoneBuilder();
|
||||
~ZoneBuilder();
|
||||
|
||||
// Init zoneBank and init zone pixmap database
|
||||
bool init(const QString &pathName, bool bMakeAZone);
|
||||
|
||||
void newZone(bool bDisplay=true);
|
||||
|
||||
// Accessors
|
||||
NLLIGO::CZoneBank &getZoneBank()
|
||||
{
|
||||
return m_zoneBank;
|
||||
}
|
||||
ZoneListModel *zoneModel() const;
|
||||
private:
|
||||
|
||||
// Scan ./zoneligos dir and add all *.ligozone files to zoneBank
|
||||
bool initZoneBank (const QString &path);
|
||||
|
||||
sint32 m_minX, m_maxX, m_minY, m_maxY;
|
||||
QString m_lastPathName;
|
||||
|
||||
ZoneListModel *m_zoneListModel;
|
||||
NLLIGO::CZoneBank m_zoneBank;
|
||||
std::vector<NLLIGO::CZoneBankElement*> m_currentSelection;
|
||||
};
|
||||
|
||||
} /* namespace LandscapeEditor */
|
||||
|
||||
#endif // BUILDER_ZONE_H
|
|
@ -0,0 +1,28 @@
|
|||
// 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 "builder_zone_region.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
// Qt includes
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
} /* namespace LandscapeEditor */
|
|
@ -0,0 +1,33 @@
|
|||
// 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 BUILDER_ZONE_REGION_H
|
||||
#define BUILDER_ZONE_REGION_H
|
||||
|
||||
// Project includes
|
||||
|
||||
// NeL includes
|
||||
#include <nel/ligo/zone_bank.h>
|
||||
|
||||
// Qt includes
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
} /* namespace LandscapeEditor */
|
||||
|
||||
#endif // BUILDER_ZONE_REGION_H
|
|
@ -91,7 +91,7 @@ public:
|
|||
}
|
||||
virtual QIcon icon() const
|
||||
{
|
||||
return QIcon();
|
||||
return QIcon(Constants::ICON_LANDSCAPE_ITEM);
|
||||
}
|
||||
|
||||
virtual void open();
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
// Project includes
|
||||
#include "landscape_editor_window.h"
|
||||
#include "landscape_editor_constants.h"
|
||||
#include "zone_list_model.h"
|
||||
|
||||
#include "../core/icore.h"
|
||||
#include "../core/imenu_manager.h"
|
||||
|
@ -40,7 +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());
|
||||
*/
|
||||
createMenus();
|
||||
readSettings();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
// Project includes
|
||||
#include "ui_landscape_editor_window.h"
|
||||
#include "builder_zone.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtGui/QUndoStack>
|
||||
|
@ -47,6 +48,7 @@ private:
|
|||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
ZoneBuilder *m_zoneBuilder;
|
||||
QUndoStack *m_undoStack;
|
||||
Ui::LandscapeEditorWindow m_ui;
|
||||
}; /* class LandscapeEditorWindow */
|
||||
|
|
|
@ -35,7 +35,24 @@
|
|||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="dockWidget">
|
||||
<property name="windowTitle">
|
||||
<string>Zones</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="LandscapeEditor::ZoneListWidget" name="zoneListWidget"/>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LandscapeEditor::ZoneListWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>zone_list_widget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="landscape_editor.qrc"/>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
// 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 "landscape_scene.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
// Qt includes
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
LandscapeScene::LandscapeScene(QObject *parent)
|
||||
: QGraphicsScene(parent)
|
||||
{
|
||||
}
|
||||
|
||||
LandscapeScene::~LandscapeScene()
|
||||
{
|
||||
}
|
||||
|
||||
} /* namespace LandscapeEditor */
|
|
@ -0,0 +1,42 @@
|
|||
// 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 LANDSCAPE_SCENE_H
|
||||
#define LANDSCAPE_SCENE_H
|
||||
|
||||
// Project includes
|
||||
|
||||
// NeL includes
|
||||
|
||||
// Qt includes
|
||||
#include <QGraphicsScene>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
class LandscapeScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LandscapeScene(QObject *parent = 0);
|
||||
virtual ~LandscapeScene();
|
||||
};
|
||||
|
||||
} /* namespace LandscapeEditor */
|
||||
|
||||
#endif // LANDSCAPE_SCENE_H
|
|
@ -0,0 +1,165 @@
|
|||
// 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 "zone_list_model.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
// STL includes
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Qt includes
|
||||
#include <QApplication>
|
||||
#include <QSize>
|
||||
#include <QtGui/QProgressDialog>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
ZoneListModel::ZoneListModel(int pixmapSize, QObject *parent)
|
||||
: QAbstractListModel(parent),
|
||||
m_pixmapSize(pixmapSize)
|
||||
{
|
||||
|
||||
}
|
||||
ZoneListModel::~ZoneListModel()
|
||||
{
|
||||
resetModel();
|
||||
}
|
||||
|
||||
int ZoneListModel::rowCount(const QModelIndex & /* parent */) const
|
||||
{
|
||||
return m_pixmapMap.count();
|
||||
}
|
||||
|
||||
int ZoneListModel::columnCount(const QModelIndex & /* parent */) const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
QVariant ZoneListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
return int(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
}
|
||||
else if (role == Qt::DisplayRole)
|
||||
{
|
||||
return m_pixmapNameList.at(index.row());
|
||||
}
|
||||
else if (role == Qt::DecorationRole)
|
||||
{
|
||||
QPixmap *pixmap = getSmallPixmap(m_pixmapNameList.at(index.row()));
|
||||
return qVariantFromValue(*pixmap);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant ZoneListModel::headerData(int section,
|
||||
Qt::Orientation /* orientation */,
|
||||
int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void ZoneListModel::setSmallPixmapSize(int pixmapSize)
|
||||
{
|
||||
m_pixmapSize = pixmapSize;
|
||||
}
|
||||
|
||||
void ZoneListModel::resetModel()
|
||||
{
|
||||
beginResetModel();
|
||||
Q_FOREACH(QString name, m_pixmapNameList)
|
||||
{
|
||||
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();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
bool ZoneListModel::rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zoneBank)
|
||||
{
|
||||
beginResetModel();
|
||||
m_zonePath = zonePath;
|
||||
|
||||
QProgressDialog *progressDialog = new QProgressDialog();
|
||||
|
||||
std::vector<std::string> zoneNames;
|
||||
zoneBank.getCategoryValues ("zone", zoneNames);
|
||||
progressDialog->setRange(0, zoneNames.size());
|
||||
for (uint i = 0; i < zoneNames.size(); ++i)
|
||||
{
|
||||
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");
|
||||
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;
|
||||
}
|
||||
|
||||
QPixmap *ZoneListModel::getPixmap(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;
|
||||
}
|
||||
|
||||
QPixmap *ZoneListModel::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 */
|
|
@ -0,0 +1,82 @@
|
|||
// 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 ZONE_LIST_MODEL_H
|
||||
#define ZONE_LIST_MODEL_H
|
||||
|
||||
// Project includes
|
||||
|
||||
// NeL includes
|
||||
#include <nel/ligo/zone_bank.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QAbstractListModel>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
|
||||
/**
|
||||
@class ZoneListModel
|
||||
@brief ZoneListModel contains the image database for QGraphicsScene and
|
||||
small images for QListView
|
||||
@details
|
||||
*/
|
||||
class ZoneListModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ZoneListModel(int pixmapSize = 64, QObject *parent = 0);
|
||||
~ZoneListModel();
|
||||
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role) const;
|
||||
|
||||
/// Set size for small pixmaps
|
||||
/// Value should be set before calling rebuildModel
|
||||
void setSmallPixmapSize(int pixmapSize);
|
||||
|
||||
/// Unload all images and reset model
|
||||
void resetModel();
|
||||
|
||||
/// Load all images(png) from zonePath, list images gets from zoneBank
|
||||
bool rebuildModel(const QString &zonePath, NLLIGO::CZoneBank &zoneBank);
|
||||
|
||||
/// Get original 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;
|
||||
QMap<QString, QPixmap*> m_pixmapMap;
|
||||
QMap<QString, QPixmap*> m_smallPixmapMap;
|
||||
QList<QString> m_pixmapNameList;
|
||||
};
|
||||
|
||||
} /* namespace LandscapeEditor */
|
||||
|
||||
#endif // ZONE_LIST_MODEL_H
|
|
@ -0,0 +1,44 @@
|
|||
// 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 "zone_list_widget.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
// Qt includes
|
||||
|
||||
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 */
|
|
@ -0,0 +1,54 @@
|
|||
// 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 ZONE_LIST_WIDGET_H
|
||||
#define ZONE_LIST_WIDGET_H
|
||||
|
||||
// Project includes
|
||||
#include "ui_zone_list_widget.h"
|
||||
|
||||
// NeL includes
|
||||
|
||||
// Qt includes
|
||||
|
||||
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
|
|
@ -0,0 +1,266 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ZoneListWidget</class>
|
||||
<widget class="QWidget" name="ZoneListWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>359</width>
|
||||
<height>579</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string><Unused></string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_7"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboBox_11">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Random</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fyll cycle</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="comboBox_6">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string><Unused></string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_8">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="comboBox_12">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>And</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Or</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QComboBox" name="comboBox_4">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string><Unused></string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBox_9">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="comboBox_13">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>And</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Or</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QComboBox" name="comboBox_5">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string><Unused></string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBox_10">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="comboBox_14">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>And</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Or</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Placement</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0°</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>90°</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>180°</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>170°</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Random</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Full cycle</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>NoFlip</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flip</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Random</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fyll cycle</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Force</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="text">
|
||||
<string>Not propogate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QListView" name="listView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue