Changed: #1301 Fix typos in comments/code.

This commit is contained in:
dnk-88 2011-08-19 00:14:40 +03:00
parent d8d6ed5384
commit 74ca89ab38
20 changed files with 117 additions and 118 deletions

View file

@ -85,7 +85,7 @@ void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zoneP
return; return;
checkBeginMacro(); checkBeginMacro();
nlinfo(QString("%1 %2 %3 (%4 %5)").arg(data.zoneName.c_str()).arg(zonePos.x).arg(zonePos.y).arg(data.posX).arg(data.posY).toStdString().c_str()); // nlinfo(QString("%1 %2 %3 (%4 %5)").arg(data.zoneName.c_str()).arg(zonePos.x).arg(zonePos.y).arg(data.posX).arg(data.posY).toStdString().c_str());
m_zonePositionList.push_back(zonePos); m_zonePositionList.push_back(zonePos);
m_undoStack->push(new LigoTileCommand(data, zonePos, this, m_landscapeScene)); m_undoStack->push(new LigoTileCommand(data, zonePos, this, m_landscapeScene));
} }
@ -96,7 +96,6 @@ void ZoneBuilder::actionLigoMove(uint index, sint32 deltaX, sint32 deltaY)
return; return;
checkBeginMacro(); checkBeginMacro();
nlinfo("ligoMove");
//m_undoStack->push(new LigoMoveCommand(index, deltaX, deltaY, this)); //m_undoStack->push(new LigoMoveCommand(index, deltaX, deltaY, this));
} }
@ -106,7 +105,7 @@ void ZoneBuilder::actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, s
return; return;
checkBeginMacro(); checkBeginMacro();
nlinfo(QString("minX=%1 maxX=%2 minY=%3 maxY=%4").arg(newMinX).arg(newMaxX).arg(newMinY).arg(newMaxY).toStdString().c_str()); // nlinfo(QString("minX=%1 maxX=%2 minY=%3 maxY=%4").arg(newMinX).arg(newMaxX).arg(newMinY).arg(newMaxY).toStdString().c_str());
m_undoStack->push(new LigoResizeCommand(index, newMinX, newMaxX, newMinY, newMaxY, this)); m_undoStack->push(new LigoResizeCommand(index, newMinX, newMaxX, newMinY, newMaxY, this));
} }
@ -274,7 +273,7 @@ int ZoneBuilder::createZoneRegion(const QString &fileName)
landItem.zoneRegionObject = new ZoneRegionObject(); landItem.zoneRegionObject = new ZoneRegionObject();
landItem.zoneRegionObject->load(fileName.toStdString()); landItem.zoneRegionObject->load(fileName.toStdString());
if (!checkOverlaps(landItem.zoneRegionObject->ligoZoneRegion())) if (checkOverlaps(landItem.zoneRegionObject->ligoZoneRegion()))
{ {
delete landItem.zoneRegionObject; delete landItem.zoneRegionObject;
return -1; return -1;
@ -334,7 +333,11 @@ int ZoneBuilder::currentIdZoneRegion() const
ZoneRegionObject *ZoneBuilder::currentZoneRegion() const ZoneRegionObject *ZoneBuilder::currentZoneRegion() const
{ {
return m_landscapeMap.value(m_currentZoneRegion).zoneRegionObject; ZoneRegionObject *result = 0;
if (m_landscapeMap.contains(m_currentZoneRegion))
result = m_landscapeMap.value(m_currentZoneRegion).zoneRegionObject;
return result;
} }
int ZoneBuilder::countZoneRegion() const int ZoneBuilder::countZoneRegion() const
@ -344,17 +347,23 @@ int ZoneBuilder::countZoneRegion() const
ZoneRegionObject *ZoneBuilder::zoneRegion(int id) const ZoneRegionObject *ZoneBuilder::zoneRegion(int id) const
{ {
return m_landscapeMap.value(id).zoneRegionObject; ZoneRegionObject *result = 0;
if (m_landscapeMap.contains(id))
result = m_landscapeMap.value(id).zoneRegionObject;
return result;
} }
void ZoneBuilder::ligoData(LigoData &data, const ZonePosition &zonePos) void ZoneBuilder::ligoData(LigoData &data, const ZonePosition &zonePos)
{ {
m_landscapeMap.value(zonePos.region).zoneRegionObject->ligoData(data, zonePos.x, zonePos.y); if (m_landscapeMap.contains(zonePos.region))
m_landscapeMap.value(zonePos.region).zoneRegionObject->ligoData(data, zonePos.x, zonePos.y);
} }
void ZoneBuilder::setLigoData(LigoData &data, const ZonePosition &zonePos) void ZoneBuilder::setLigoData(LigoData &data, const ZonePosition &zonePos)
{ {
m_landscapeMap.value(zonePos.region).zoneRegionObject->setLigoData(data, zonePos.x, zonePos.y); if (m_landscapeMap.contains(zonePos.region))
m_landscapeMap.value(zonePos.region).zoneRegionObject->setLigoData(data, zonePos.x, zonePos.y);
} }
bool ZoneBuilder::initZoneBank (const QString &pathName) bool ZoneBuilder::initZoneBank (const QString &pathName)
@ -390,14 +399,10 @@ QString ZoneBuilder::dataPath() const
bool ZoneBuilder::getZoneMask(sint32 x, sint32 y) bool ZoneBuilder::getZoneMask(sint32 x, sint32 y)
{ {
if ((x < m_minX) || (x > m_maxX) || if ((x < m_minX) || (x > m_maxX) ||
(y < m_minY) || (y > m_maxY)) (y < m_minY) || (y > m_maxY))
{
return true; return true;
}
else else
{
return m_zoneMask[(x - m_minX) + (y - m_minY) * (1 + m_maxX - m_minX)]; return m_zoneMask[(x - m_minX) + (y - m_minY) * (1 + m_maxX - m_minX)];
}
} }
void ZoneBuilder::calcMask() void ZoneBuilder::calcMask()
@ -485,7 +490,7 @@ void ZoneBuilder::checkBeginMacro()
{ {
m_createdAction = true; m_createdAction = true;
m_undoStack->beginMacro(m_titleAction); m_undoStack->beginMacro(m_titleAction);
m_undoScanRegionCommand = new UndoScanRegionCommand(this, m_landscapeScene); m_undoScanRegionCommand = new UndoScanRegionCommand(true, this, m_landscapeScene);
m_undoStack->push(m_undoScanRegionCommand); m_undoStack->push(m_undoScanRegionCommand);
} }
} }
@ -494,9 +499,13 @@ void ZoneBuilder::checkEndMacro()
{ {
if (m_createdAction) if (m_createdAction)
{ {
RedoScanRegionCommand *redoScanRegionCommand = new RedoScanRegionCommand(this, m_landscapeScene); UndoScanRegionCommand *redoScanRegionCommand = new UndoScanRegionCommand(false, this, m_landscapeScene);
// Sets list positions in which need apply changes
m_undoScanRegionCommand->setScanList(m_zonePositionList); m_undoScanRegionCommand->setScanList(m_zonePositionList);
redoScanRegionCommand->setScanList(m_zonePositionList); redoScanRegionCommand->setScanList(m_zonePositionList);
// Adds command in the stack
m_undoStack->push(redoScanRegionCommand); m_undoStack->push(redoScanRegionCommand);
m_undoStack->endMacro(); m_undoStack->endMacro();
} }
@ -517,11 +526,11 @@ bool ZoneBuilder::checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion)
{ {
const std::string &zoneName = newZoneRegion.getName(x, y); const std::string &zoneName = newZoneRegion.getName(x, y);
if ((zoneName != STRING_UNUSED) && (zoneName != STRING_OUT_OF_BOUND)) if ((zoneName != STRING_UNUSED) && (zoneName != STRING_OUT_OF_BOUND))
return false; return true;
} }
} }
} }
return true; return false;
} }
} /* namespace LandscapeEditor */ } /* namespace LandscapeEditor */

View file

@ -59,17 +59,25 @@ public:
ZoneBuilder(LandscapeScene *landscapeScene, ListZonesWidget *listZonesWidget = 0, QUndoStack *undoStack = 0); ZoneBuilder(LandscapeScene *landscapeScene, ListZonesWidget *listZonesWidget = 0, QUndoStack *undoStack = 0);
~ZoneBuilder(); ~ZoneBuilder();
/// Init zoneBank and init zone pixmap database /// Inits zoneBank and init zone pixmap database
bool init(const QString &pathName, bool displayProgress = false); bool init(const QString &pathName, bool displayProgress = false);
void calcMask(); void calcMask();
/// @return false if in point (x, y) placed zone brick, else true
bool getZoneMask (sint32 x, sint32 y); bool getZoneMask (sint32 x, sint32 y);
bool getZoneAmongRegions(ZonePosition &zonePos, BuilderZoneRegion *builderZoneRegionFrom, sint32 x, sint32 y); bool getZoneAmongRegions(ZonePosition &zonePos, BuilderZoneRegion *builderZoneRegionFrom, sint32 x, sint32 y);
/// Ligo Actions /// Ligo Actions
/// @{ /// @{
/// Adds the LigoTileCommand in undo stack
void actionLigoTile(const LigoData &data, const ZonePosition &zonePos); void actionLigoTile(const LigoData &data, const ZonePosition &zonePos);
void actionLigoMove(uint index, sint32 deltaX, sint32 deltaY); void actionLigoMove(uint index, sint32 deltaX, sint32 deltaY);
/// Adds the LigoResizeCommand in undo stack
void actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY); void actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY);
/// @} /// @}
@ -82,11 +90,24 @@ public:
/// Zone Region /// Zone Region
/// @{ /// @{
/// Creates empty zone region and adds in the workspace
/// @return id zone region
int createZoneRegion(); int createZoneRegion();
/// Loads zone region from file @fileName and adds in the workspace.
/// @return id zone region
int createZoneRegion(const QString &fileName); int createZoneRegion(const QString &fileName);
/// Unloads zone region from the workspace
void deleteZoneRegion(int id); void deleteZoneRegion(int id);
/// Sets the current zone region with @id
void setCurrentZoneRegion(int id); void setCurrentZoneRegion(int id);
/// @return id the current zone region, if workspace is empty then returns (-1)
int currentIdZoneRegion() const; int currentIdZoneRegion() const;
ZoneRegionObject *currentZoneRegion() const; ZoneRegionObject *currentZoneRegion() const;
int countZoneRegion() const; int countZoneRegion() const;
ZoneRegionObject *zoneRegion(int id) const; ZoneRegionObject *zoneRegion(int id) const;
@ -106,12 +127,18 @@ public:
private: private:
/// Scan ./zoneligos dir and add all *.ligozone files to zoneBank /// Scans ./zoneligos dir and add all *.ligozone files to zoneBank
bool initZoneBank (const QString &path); bool initZoneBank (const QString &path);
/// Checks enabled beginMacro mode for undo stack, if false, then enables mode
void checkBeginMacro(); void checkBeginMacro();
/// Checks enabled on beginMacro mode for undo stack, if true, then adds UndoScanRegionCommand
/// in undo stack and disables beginMacro mode
void checkEndMacro(); void checkEndMacro();
/// Checks intersects between them zone regions
/// @return true if newZoneRegion intersects with loaded zone regions, else return false
bool checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion); bool checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion);
struct LandscapeItem struct LandscapeItem

View file

@ -67,8 +67,8 @@ struct ZonePosition
}; };
/** /**
@class ZoneBuilder @class ZoneBuilderBase
@brief ZoneBuilder contains all the shared data between the tools and the engine. @brief ZoneBuilderBase 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. @details ZoneBank contains the macro zones that is composed of several zones plus a mask.
PixmapDatabase contains the graphics for the zones PixmapDatabase contains the graphics for the zones
*/ */

View file

@ -93,8 +93,9 @@ void LigoTileCommand::redo ()
m_zoneBuilder->setLigoData(m_newLigoData, m_zonePos); m_zoneBuilder->setLigoData(m_newLigoData, m_zonePos);
} }
UndoScanRegionCommand::UndoScanRegionCommand(ZoneBuilder *zoneBuilder, LandscapeScene *scene, QUndoCommand *parent) UndoScanRegionCommand::UndoScanRegionCommand(bool direction, ZoneBuilder *zoneBuilder, LandscapeScene *scene, QUndoCommand *parent)
: QUndoCommand(parent), : QUndoCommand(parent),
m_direction(direction),
m_zoneBuilder(zoneBuilder), m_zoneBuilder(zoneBuilder),
m_scene(scene) m_scene(scene)
{ {
@ -112,45 +113,21 @@ void UndoScanRegionCommand::setScanList(const QList<ZonePosition> &zonePositionL
void UndoScanRegionCommand::undo() void UndoScanRegionCommand::undo()
{ {
for (int i = 0; i < m_zonePositionList.size(); ++i) if (m_direction)
m_scene->deleteItemZone(m_zonePositionList.at(i)); applyChanges();
for (int i = 0; i < m_zonePositionList.size(); ++i)
{
LigoData data;
m_zoneBuilder->ligoData(data, m_zonePositionList.at(i));
m_scene->createItemZone(data, m_zonePositionList.at(i));
}
} }
void UndoScanRegionCommand::redo() void UndoScanRegionCommand::redo()
{ {
if (!m_direction)
applyChanges();
} }
RedoScanRegionCommand::RedoScanRegionCommand(ZoneBuilder *zoneBuilder, LandscapeScene *scene, QUndoCommand *parent) void UndoScanRegionCommand::applyChanges()
: QUndoCommand(parent),
m_zoneBuilder(zoneBuilder),
m_scene(scene)
{
}
RedoScanRegionCommand::~RedoScanRegionCommand()
{
m_zonePositionList.clear();
}
void RedoScanRegionCommand::setScanList(const QList<ZonePosition> &zonePositionList)
{
m_zonePositionList = zonePositionList;
}
void RedoScanRegionCommand::undo()
{
}
void RedoScanRegionCommand::redo()
{ {
for (int i = 0; i < m_zonePositionList.size(); ++i) for (int i = 0; i < m_zonePositionList.size(); ++i)
m_scene->deleteItemZone(m_zonePositionList.at(i)); m_scene->deleteItemZone(m_zonePositionList.at(i));
for (int i = 0; i < m_zonePositionList.size(); ++i) for (int i = 0; i < m_zonePositionList.size(); ++i)
{ {
LigoData data; LigoData data;

View file

@ -32,6 +32,11 @@
namespace LandscapeEditor namespace LandscapeEditor
{ {
/**
@class OpenLandscapeCommand
@brief
@details
*/
class OpenLandscapeCommand: public QUndoCommand class OpenLandscapeCommand: public QUndoCommand
{ {
public: public:
@ -45,6 +50,11 @@ private:
QString m_fileName; QString m_fileName;
}; };
/**
@class NewLandscapeCommand
@brief
@details
*/
class NewLandscapeCommand: public QUndoCommand class NewLandscapeCommand: public QUndoCommand
{ {
public: public:
@ -56,7 +66,11 @@ public:
private: private:
}; };
// Modify the landscape /**
@class LigoTileCommand
@brief
@details
*/
class LigoTileCommand: public QUndoCommand class LigoTileCommand: public QUndoCommand
{ {
public: public:
@ -76,10 +90,15 @@ private:
LandscapeScene *m_scene; LandscapeScene *m_scene;
}; };
/**
@class UndoScanRegionCommand
@brief
@details
*/
class UndoScanRegionCommand: public QUndoCommand class UndoScanRegionCommand: public QUndoCommand
{ {
public: public:
UndoScanRegionCommand(ZoneBuilder *zoneBuilder, LandscapeScene *scene, QUndoCommand *parent = 0); UndoScanRegionCommand(bool direction, ZoneBuilder *zoneBuilder, LandscapeScene *scene, QUndoCommand *parent = 0);
virtual ~UndoScanRegionCommand(); virtual ~UndoScanRegionCommand();
void setScanList(const QList<ZonePosition> &zonePositionList); void setScanList(const QList<ZonePosition> &zonePositionList);
@ -87,49 +106,19 @@ public:
virtual void redo(); virtual void redo();
private: private:
void applyChanges();
bool m_direction;
QList<ZonePosition> m_zonePositionList; QList<ZonePosition> m_zonePositionList;
ZoneBuilder *m_zoneBuilder; ZoneBuilder *m_zoneBuilder;
LandscapeScene *m_scene; LandscapeScene *m_scene;
}; };
class RedoScanRegionCommand: public QUndoCommand /**
{ @class LigoResizeCommand
public: @brief
RedoScanRegionCommand(ZoneBuilder *zoneBuilder, LandscapeScene *scene, QUndoCommand *parent = 0); @details
virtual ~RedoScanRegionCommand();
void setScanList(const QList<ZonePosition> &zonePositionList);
virtual void undo();
virtual void redo();
private:
QList<ZonePosition> m_zonePositionList;
ZoneBuilder *m_zoneBuilder;
LandscapeScene *m_scene;
};
/*
// Move the landscape
class LigoMoveCommand: public QUndoCommand
{
public:
LigoMoveCommand(int index, sint32 deltaX, sint32 deltaY, ZoneBuilder *zoneBuilder, QUndoCommand *parent = 0);
virtual ~LigoMoveCommand();
virtual void undo();
virtual void redo();
private:
int m_index;
sint32 m_deltaX;
sint32 m_deltaY;
ZoneBuilder *m_zoneBuilder;
};
*/ */
// Modify the landscape
class LigoResizeCommand: public QUndoCommand class LigoResizeCommand: public QUndoCommand
{ {
public: public:

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -75,7 +74,7 @@ QString LandscapeEditorPlugin::name() const
QString LandscapeEditorPlugin::version() const QString LandscapeEditorPlugin::version() const
{ {
return "0.1"; return "0.8";
} }
QString LandscapeEditorPlugin::vendor() const QString LandscapeEditorPlugin::vendor() const

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

View file

@ -27,6 +27,11 @@
namespace LandscapeEditor namespace LandscapeEditor
{ {
/**
@class LandscapeView
@brief Provides graphics view for viewing zone regions.
@details Also provides zooming, panning and displaying grid
*/
class LANDSCAPE_EDITOR_EXPORT LandscapeView: public QGraphicsView class LANDSCAPE_EDITOR_EXPORT LandscapeView: public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
@ -42,11 +47,16 @@ public:
bool isVisibleGrid() const; bool isVisibleGrid() const;
public Q_SLOTS: public Q_SLOTS:
/// Enable/disable displaying grid.
void setVisibleGrid(bool visible); void setVisibleGrid(bool visible);
/// Enable/disable displaying text(coord.) above each zone bricks.
void setVisibleText(bool visible); void setVisibleText(bool visible);
private Q_SLOTS: private Q_SLOTS:
protected: protected:
//Take over the interaction
virtual void wheelEvent(QWheelEvent *event); virtual void wheelEvent(QWheelEvent *event);
virtual void mousePressEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event); virtual void mouseMoveEvent(QMouseEvent *event);

View file

@ -35,8 +35,8 @@ class PixmapDatabase;
/** /**
@class ListZonesModel @class ListZonesModel
@brief ListZonesModel contains the small images for QListView @brief ListZonesModel is used for managed list bricks by ListZonesWidget
@details @details ListZonesModel contains the small images for QListView
*/ */
class ListZonesModel : public QAbstractListModel class ListZonesModel : public QAbstractListModel
{ {
@ -55,7 +55,7 @@ public:
/// Value should be set before calling rebuildModel /// Value should be set before calling rebuildModel
void setScaleRatio(int scaleRatio); void setScaleRatio(int scaleRatio);
/// Unload all images and reset model /// Delete all small images and reset model
void resetModel(); void resetModel();
/// Set current list zones which will be available in QListView /// Set current list zones which will be available in QListView

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -45,16 +44,16 @@ public:
void updateUi(); void updateUi();
// Set zone builder, call this method before using this class /// Set zone builder, call this method before using this class
void setZoneBuilder(ZoneBuilder *zoneBuilder); void setZoneBuilder(ZoneBuilder *zoneBuilder);
// Get current zone name which user selected from list. /// Get current zone name which user selected from list.
QString currentZoneName(); QString currentZoneName();
// Get current rotation value which user selected (Rot 0-0deg, 1-90deg, 2-180deg, 3-270deg). /// Get current rotation value which user selected (Rot 0-0deg, 1-90deg, 2-180deg, 3-270deg).
int currentRot(); int currentRot();
// Get current flip value which user selected (Flip 0-false, 1-true). /// Get current flip value which user selected (Flip 0-false, 1-true).
int currentFlip(); int currentFlip();
bool isNotPropogate() const; bool isNotPropogate() const;

View file

@ -39,6 +39,7 @@ PixmapDatabase::PixmapDatabase(int textureSize)
: m_textureSize(textureSize), : m_textureSize(textureSize),
m_errorPixmap(0) m_errorPixmap(0)
{ {
// Create pixmap for case if pixmap and LIGO files not found
m_errorPixmap = new QPixmap(QSize(m_textureSize, m_textureSize)); m_errorPixmap = new QPixmap(QSize(m_textureSize, m_textureSize));
QPainter painter(m_errorPixmap); QPainter painter(m_errorPixmap);
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
@ -46,7 +47,7 @@ PixmapDatabase::PixmapDatabase(int textureSize)
painter.setFont(QFont("Helvetica [Cronyx]", 14)); painter.setFont(QFont("Helvetica [Cronyx]", 14));
painter.setPen(QPen(Qt::red, 2, Qt::SolidLine)); painter.setPen(QPen(Qt::red, 2, Qt::SolidLine));
painter.drawText(m_errorPixmap->rect(), Qt::AlignCenter | Qt::TextWordWrap, painter.drawText(m_errorPixmap->rect(), Qt::AlignCenter | Qt::TextWordWrap,
QObject::tr("Pixmap and LIGO files not found. Set the correct data path and reload landscape.")); QObject::tr("Pixmap and LIGO files not found."));
painter.end(); painter.end();
} }
@ -84,7 +85,7 @@ bool PixmapDatabase::loadPixmaps(const QString &zonePath, NLLIGO::CZoneBank &zon
QPixmap *pixmap = new QPixmap(zonePath + zonePixmapName + ".png"); QPixmap *pixmap = new QPixmap(zonePath + zonePixmapName + ".png");
if (pixmap->isNull()) if (pixmap->isNull())
{ {
// Generate filled pixmap // Generate filled pixmap if could not load pixmap
QPixmap *emptyPixmap = new QPixmap(QSize(sizeX * m_textureSize, sizeY * m_textureSize)); QPixmap *emptyPixmap = new QPixmap(QSize(sizeX * m_textureSize, sizeY * m_textureSize));
QPainter painter(emptyPixmap); QPainter painter(emptyPixmap);
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);

View file

@ -52,7 +52,8 @@ public:
QStringList listPixmaps() const; QStringList listPixmaps() const;
/// Get original pixmap /// Get original pixmap
/// @return QPixmap* if the image is in the database ; otherwise returns 0. /// @return QPixmap* if the image is in the database ;
/// otherwise returns pixmap which contains error message.
QPixmap *pixmap(const QString &zoneName) const; QPixmap *pixmap(const QString &zoneName) const;
int textureSize() const; int textureSize() const;

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // 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> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -40,9 +39,6 @@ public:
int widthSnapshot() const; int widthSnapshot() const;
int heightSnapshot() const; int heightSnapshot() const;
private Q_SLOTS:
private: private:
Ui::SnapshotDialog m_ui; Ui::SnapshotDialog m_ui;

View file

@ -28,8 +28,6 @@
// STL includes // STL includes
#include <string> #include <string>
// Qt includes
namespace LandscapeEditor namespace LandscapeEditor
{ {
@ -80,7 +78,7 @@ struct LigoData
/** /**
@class ZoneRegionObject @class ZoneRegionObject
@brief @brief The class contains NLLIGO::CZoneRegion object and provides basic operations above it
@details @details
*/ */
class LANDSCAPE_EDITOR_EXPORT ZoneRegionObject class LANDSCAPE_EDITOR_EXPORT ZoneRegionObject
@ -115,7 +113,7 @@ public:
/// Check position, it belongs to the landscape /// Check position, it belongs to the landscape
bool checkPos(const sint32 x, const sint32 y); bool checkPos(const sint32 x, const sint32 y);
/// Helper flag to know if a ps has been modified /// Helper flag to know if the zone region has been modified
/// @{ /// @{
bool isModified() const; bool isModified() const;