mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
Changed: #1301 Removed a hard coded value.
--HG-- branch : gsoc2011-worldeditorqt
This commit is contained in:
parent
13ddd2d01b
commit
018fcac076
4 changed files with 25 additions and 14 deletions
|
@ -49,9 +49,10 @@ ZoneBuilder::~ZoneBuilder()
|
||||||
delete m_pixmapDatabase;
|
delete m_pixmapDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
bool ZoneBuilder::init(const QString &pathName, bool displayProgress)
|
||||||
{
|
{
|
||||||
bool bRet = true;
|
if (pathName.isEmpty())
|
||||||
|
return false;
|
||||||
if (pathName != m_lastPathName)
|
if (pathName != m_lastPathName)
|
||||||
{
|
{
|
||||||
m_lastPathName = pathName;
|
m_lastPathName = pathName;
|
||||||
|
@ -69,15 +70,13 @@ bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
||||||
QString zoneBitmapPath = pathName;
|
QString zoneBitmapPath = pathName;
|
||||||
zoneBitmapPath += "/zonebitmaps/";
|
zoneBitmapPath += "/zonebitmaps/";
|
||||||
m_pixmapDatabase->reset();
|
m_pixmapDatabase->reset();
|
||||||
if (!m_pixmapDatabase->loadPixmaps(zoneBitmapPath, m_zoneBank))
|
if (!m_pixmapDatabase->loadPixmaps(zoneBitmapPath, m_zoneBank, displayProgress))
|
||||||
{
|
{
|
||||||
m_zoneBank.reset();
|
m_zoneBank.reset();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((makeAZone) && (bRet))
|
return true;
|
||||||
createZoneRegion();
|
|
||||||
return bRet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zonePos)
|
void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zonePos)
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
~ZoneBuilder();
|
~ZoneBuilder();
|
||||||
|
|
||||||
/// Init zoneBank and init zone pixmap database
|
/// Init zoneBank and init zone pixmap database
|
||||||
bool init(const QString &pathName, bool bMakeAZone);
|
bool init(const QString &pathName, bool displayProgress = false);
|
||||||
|
|
||||||
void calcMask();
|
void calcMask();
|
||||||
bool getZoneMask (sint32 x, sint32 y);
|
bool getZoneMask (sint32 x, sint32 y);
|
||||||
|
|
|
@ -28,6 +28,8 @@ const char * const LANDSCAPE_EDITOR_PLUGIN = "LandscapeEditor";
|
||||||
const char * const LANDSCAPE_EDITOR_SECTION = "LandscapeEditor";
|
const char * const LANDSCAPE_EDITOR_SECTION = "LandscapeEditor";
|
||||||
const char * const LANDSCAPE_WINDOW_STATE = "LandscapeWindowState";
|
const char * const LANDSCAPE_WINDOW_STATE = "LandscapeWindowState";
|
||||||
const char * const LANDSCAPE_WINDOW_GEOMETRY = "LandscapeWindowGeometry";
|
const char * const LANDSCAPE_WINDOW_GEOMETRY = "LandscapeWindowGeometry";
|
||||||
|
const char * const LANDSCAPE_DATA_DIRECTORY = "LandscapeDataDirectory";
|
||||||
|
const char * const LANDSCAPE_USE_OPENGL = "LandscapeUseOpenGL";
|
||||||
|
|
||||||
//resources
|
//resources
|
||||||
const char * const ICON_LANDSCAPE_ITEM = ":/icons/ic_nel_landscape_item.png";
|
const char * const ICON_LANDSCAPE_ITEM = ":/icons/ic_nel_landscape_item.png";
|
||||||
|
|
|
@ -58,14 +58,11 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
|
||||||
m_landscapeScene = new LandscapeScene(this);
|
m_landscapeScene = new LandscapeScene(this);
|
||||||
|
|
||||||
m_zoneBuilder = new ZoneBuilder(m_landscapeScene, m_ui.zoneListWidget, m_undoStack);
|
m_zoneBuilder = new ZoneBuilder(m_landscapeScene, m_ui.zoneListWidget, m_undoStack);
|
||||||
m_zoneBuilder->init("e:/-nel-/install/continents/newbieland", false);
|
|
||||||
m_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder);
|
m_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder);
|
||||||
m_ui.zoneListWidget->updateUi();
|
m_ui.zoneListWidget->updateUi();
|
||||||
|
|
||||||
m_landscapeScene->setZoneBuilder(m_zoneBuilder);
|
m_landscapeScene->setZoneBuilder(m_zoneBuilder);
|
||||||
m_ui.graphicsView->setScene(m_landscapeScene);
|
m_ui.graphicsView->setScene(m_landscapeScene);
|
||||||
//m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer));
|
|
||||||
//m_ui.graphicsView->setViewport(m_oglWidget);
|
|
||||||
|
|
||||||
m_ui.newLandAction->setIcon(QIcon(Core::Constants::ICON_NEW));
|
m_ui.newLandAction->setIcon(QIcon(Core::Constants::ICON_NEW));
|
||||||
m_ui.saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
|
m_ui.saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
|
||||||
|
@ -95,8 +92,8 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
|
||||||
|
|
||||||
LandscapeEditorWindow::~LandscapeEditorWindow()
|
LandscapeEditorWindow::~LandscapeEditorWindow()
|
||||||
{
|
{
|
||||||
delete m_zoneBuilder;
|
|
||||||
writeSettings();
|
writeSettings();
|
||||||
|
delete m_zoneBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUndoStack *LandscapeEditorWindow::undoStack() const
|
QUndoStack *LandscapeEditorWindow::undoStack() const
|
||||||
|
@ -137,7 +134,7 @@ void LandscapeEditorWindow::openProjectSettings()
|
||||||
int ok = dialog->exec();
|
int ok = dialog->exec();
|
||||||
if (ok == QDialog::Accepted)
|
if (ok == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
m_zoneBuilder->init(dialog->dataPath(), false);
|
m_zoneBuilder->init(dialog->dataPath(), true);
|
||||||
m_ui.zoneListWidget->updateUi();
|
m_ui.zoneListWidget->updateUi();
|
||||||
}
|
}
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
@ -358,6 +355,18 @@ void LandscapeEditorWindow::readSettings()
|
||||||
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
||||||
restoreState(settings->value(Constants::LANDSCAPE_WINDOW_STATE).toByteArray());
|
restoreState(settings->value(Constants::LANDSCAPE_WINDOW_STATE).toByteArray());
|
||||||
restoreGeometry(settings->value(Constants::LANDSCAPE_WINDOW_GEOMETRY).toByteArray());
|
restoreGeometry(settings->value(Constants::LANDSCAPE_WINDOW_GEOMETRY).toByteArray());
|
||||||
|
|
||||||
|
// Read landscape data directory (contains sub-paths: zone logos, zone bitmaps)
|
||||||
|
m_zoneBuilder->init(settings->value(Constants::LANDSCAPE_DATA_DIRECTORY).toString());
|
||||||
|
m_ui.zoneListWidget->updateUi();
|
||||||
|
|
||||||
|
// Use OpenGL graphics system instead raster graphics system
|
||||||
|
if (settings->value(Constants::LANDSCAPE_USE_OPENGL, false).toBool())
|
||||||
|
{
|
||||||
|
m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer));
|
||||||
|
m_ui.graphicsView->setViewport(m_oglWidget);
|
||||||
|
}
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,6 +376,7 @@ void LandscapeEditorWindow::writeSettings()
|
||||||
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
||||||
settings->setValue(Constants::LANDSCAPE_WINDOW_STATE, saveState());
|
settings->setValue(Constants::LANDSCAPE_WINDOW_STATE, saveState());
|
||||||
settings->setValue(Constants::LANDSCAPE_WINDOW_GEOMETRY, saveGeometry());
|
settings->setValue(Constants::LANDSCAPE_WINDOW_GEOMETRY, saveGeometry());
|
||||||
|
settings->setValue(Constants::LANDSCAPE_DATA_DIRECTORY, m_zoneBuilder->dataPath());
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->sync();
|
settings->sync();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue