Fixed: #85 Compilation with STLport

This commit is contained in:
kervala 2013-11-22 11:25:12 +01:00
parent e2109e7971
commit 9ebbc84059
10 changed files with 42 additions and 40 deletions

View file

@ -85,7 +85,7 @@ void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zoneP
return;
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).toUtf8().constData());
m_zonePositionList.push_back(zonePos);
m_undoStack->push(new LigoTileCommand(data, zonePos, this, m_landscapeScene));
}
@ -105,7 +105,7 @@ void ZoneBuilder::actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, s
return;
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).toUtf8().constData());
m_undoStack->push(new LigoResizeCommand(index, newMinX, newMaxX, newMinY, newMaxY, this));
}
@ -119,7 +119,7 @@ void ZoneBuilder::addZone(sint32 posX, sint32 posY)
return;
// Check zone name
std::string zoneName = m_listZonesWidget->currentZoneName().toStdString();
std::string zoneName = m_listZonesWidget->currentZoneName().toUtf8().constData();
if (zoneName.empty())
return;
@ -161,7 +161,7 @@ void ZoneBuilder::addTransition(const sint32 posX, const sint32 posY)
m_createdAction = false;
m_zonePositionList.clear();
nlinfo(QString("trans %1,%2").arg(posX).arg(posY).toStdString().c_str());
nlinfo(QString("trans %1,%2").arg(posX).arg(posY).toUtf8().constData());
sint32 x = (sint32)floor(float(posX) / m_landscapeScene->cellSize());
sint32 y = (sint32)floor(float(posY) / m_landscapeScene->cellSize());
@ -271,7 +271,7 @@ int ZoneBuilder::createZoneRegion(const QString &fileName)
{
LandscapeItem landItem;
landItem.zoneRegionObject = new ZoneRegionObject();
landItem.zoneRegionObject->load(fileName.toStdString());
landItem.zoneRegionObject->load(fileName.toUtf8().constData());
if (checkOverlaps(landItem.zoneRegionObject->ligoZoneRegion()))
{
@ -382,8 +382,8 @@ bool ZoneBuilder::initZoneBank (const QString &pathName)
std::string error;
Q_FOREACH(QString file, listFiles)
{
//nlinfo(file.toStdString().c_str());
if (!m_zoneBank.addElement((pathName + file).toStdString(), error))
//nlinfo(file.toUtf8().constData());
if (!m_zoneBank.addElement((pathName + file).toUtf8().constData(), error))
QMessageBox::critical(0, QObject::tr("Landscape editor"), QString(error.c_str()), QMessageBox::Ok);
}
delete dir;

View file

@ -81,7 +81,7 @@ int ZoneBuilderBase::loadZoneRegion(const QString &fileName, int defaultId)
{
LandscapeItem landItem;
landItem.zoneRegionObject = new ZoneRegionObject();
landItem.zoneRegionObject->load(fileName.toStdString());
landItem.zoneRegionObject->load(fileName.toUtf8().constData());
if (!checkOverlaps(landItem.zoneRegionObject->ligoZoneRegion()))
{
@ -138,8 +138,8 @@ bool ZoneBuilderBase::initZoneBank (const QString &pathName)
std::string error;
Q_FOREACH(QString file, listFiles)
{
//nlinfo(file.toStdString().c_str());
if (!m_zoneBank.addElement((pathName + file).toStdString(), error))
//nlinfo(file.toUtf8().constData());
if (!m_zoneBank.addElement((pathName + file).toUtf8().constData(), error))
QMessageBox::critical(0, QObject::tr("Landscape editor"), QString(error.c_str()), QMessageBox::Ok);
}
delete dir;

View file

@ -311,7 +311,7 @@ void LandscapeEditorWindow::saveLandscape(int row, bool force)
tr("NeL Ligo land file (*.land)"));
if (!fileName.isEmpty())
{
regionObject->setFileName(fileName.toStdString());
regionObject->setFileName(fileName.toUtf8().constData());
regionObject->save();
regionObject->setModified(false);
item->setText(fileName);

View file

@ -128,7 +128,7 @@ QPixmap *ListZonesModel::getPixmap(const QString &zoneName) const
{
QPixmap *result = 0;
if (!m_pixmapMap.contains(zoneName))
nlwarning("QPixmap %s not found", zoneName.toStdString().c_str());
nlwarning("QPixmap %s not found", zoneName.toUtf8().constData());
else
result = m_pixmapMap.value(zoneName);
return result;

View file

@ -191,7 +191,7 @@ void ListZonesWidget::updateFilters_1(const QString &value)
{
disableSignals(true);
std::vector<std::string> allCategoryValues;
m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues);
m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues);
m_ui.categoryValueComboBox_1->clear();
for(size_t i = 0; i < allCategoryValues.size(); ++i)
m_ui.categoryValueComboBox_1->addItem(QString(allCategoryValues[i].c_str()));
@ -204,7 +204,7 @@ void ListZonesWidget::updateFilters_2(const QString &value)
{
disableSignals(true);
std::vector<std::string> allCategoryValues;
m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues);
m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues);
m_ui.categoryValueComboBox_2->clear();
for(size_t i = 0; i < allCategoryValues.size(); ++i)
@ -218,7 +218,7 @@ void ListZonesWidget::updateFilters_3(const QString &value)
{
disableSignals(true);
std::vector<std::string> allCategoryValues;
m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues);
m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues);
m_ui.categoryValueComboBox_3->clear();
for(size_t i = 0; i < allCategoryValues.size(); ++i)
@ -232,7 +232,7 @@ void ListZonesWidget::updateFilters_4(const QString &value)
{
disableSignals(true);
std::vector<std::string> allCategoryValues;
m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues);
m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues);
m_ui.categoryValueComboBox_4->clear();
for(size_t i = 0; i < allCategoryValues.size(); ++i)
@ -249,37 +249,37 @@ void ListZonesWidget::updateListZones()
zoneBank.resetSelection ();
if(m_ui.categoryTypeComboBox_1->currentIndex() > 0 )
zoneBank.addOrSwitch (m_ui.categoryTypeComboBox_1->currentText().toStdString()
, m_ui.categoryValueComboBox_1->currentText().toStdString());
zoneBank.addOrSwitch (m_ui.categoryTypeComboBox_1->currentText().toUtf8().constData()
, m_ui.categoryValueComboBox_1->currentText().toUtf8().constData());
if(m_ui.categoryTypeComboBox_2->currentIndex() > 0 )
{
if (m_ui.logicComboBox_2->currentIndex() == 0) // AND switch wanted
zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_2->currentText().toStdString()
,m_ui.categoryValueComboBox_2->currentText().toStdString());
zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_2->currentText().toUtf8().constData()
,m_ui.categoryValueComboBox_2->currentText().toUtf8().constData());
else // OR switch wanted
zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_2->currentText().toStdString()
,m_ui.categoryValueComboBox_2->currentText().toStdString());
zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_2->currentText().toUtf8().constData()
,m_ui.categoryValueComboBox_2->currentText().toUtf8().constData());
}
if(m_ui.categoryTypeComboBox_3->currentIndex() > 0 )
{
if (m_ui.logicComboBox_3->currentIndex() == 0) // AND switch wanted
zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_3->currentText().toStdString()
,m_ui.categoryValueComboBox_3->currentText().toStdString());
zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_3->currentText().toUtf8().constData()
,m_ui.categoryValueComboBox_3->currentText().toUtf8().constData());
else // OR switch wanted
zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_3->currentText().toStdString()
,m_ui.categoryValueComboBox_3->currentText().toStdString());
zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_3->currentText().toUtf8().constData()
,m_ui.categoryValueComboBox_3->currentText().toUtf8().constData());
}
if(m_ui.categoryTypeComboBox_4->currentIndex() > 0 )
{
if (m_ui.logicComboBox_4->currentIndex() == 0) // AND switch wanted
zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_4->currentText().toStdString()
,m_ui.categoryValueComboBox_4->currentText().toStdString());
zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_4->currentText().toUtf8().constData()
,m_ui.categoryValueComboBox_4->currentText().toUtf8().constData());
else // OR switch wanted
zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_4->currentText().toStdString()
,m_ui.categoryValueComboBox_4->currentText().toStdString());
zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_4->currentText().toUtf8().constData()
,m_ui.categoryValueComboBox_4->currentText().toUtf8().constData());
}
std::vector<NLLIGO::CZoneBankElement *> currentSelection;

View file

@ -96,7 +96,7 @@ bool PixmapDatabase::loadPixmaps(const QString &zonePath, NLLIGO::CZoneBank &zon
painter.end();
delete pixmap;
m_pixmapMap.insert(zonePixmapName, emptyPixmap);
nlwarning(QString("not found " + zonePath + zonePixmapName + ".png").toStdString().c_str());
nlwarning(QString("not found " + zonePath + zonePixmapName + ".png").toUtf8().constData());
}
// All pixmaps must be have same size
else if (pixmap->width() != sizeX * m_textureSize)
@ -140,7 +140,7 @@ QPixmap *PixmapDatabase::pixmap(const QString &zoneName) const
{
QPixmap *result = m_errorPixmap;
if (!m_pixmapMap.contains(zoneName))
nlwarning("QPixmap %s not found", zoneName.toStdString().c_str());
nlwarning("QPixmap %s not found", zoneName.toUtf8().constData());
else
result = m_pixmapMap.value(zoneName);
return result;

View file

@ -205,7 +205,7 @@ void PrimitivesView::save()
if (node->data(Constants::PRIMITIVE_FILE_IS_CREATED).toBool())
{
if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), node->fileName().toStdString()))
if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), node->fileName().toUtf8().constData()))
QMessageBox::warning(this, "World Editor Qt", tr("Error writing output file: %1").arg(node->fileName()));
else
node->setData(Constants::PRIMITIVE_IS_MODIFIED, false);
@ -230,7 +230,7 @@ void PrimitivesView::saveAs()
RootPrimitiveNode *node = static_cast<RootPrimitiveNode *>(index.internalPointer());
if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), fileName.toStdString()))
if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), fileName.toUtf8().constData()))
QMessageBox::warning(this, "World Editor Qt", tr("Error writing output file: %1").arg(fileName));
else
{

View file

@ -346,7 +346,7 @@ void LoadRootPrimitiveCommand::redo()
// set the primitive context
NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = primitives;
NLLIGO::loadXmlPrimitiveFile(*primitives, m_fileName.toStdString(), *Utils::ligoConfig());
NLLIGO::loadXmlPrimitiveFile(*primitives, m_fileName.toUtf8().constData(), *Utils::ligoConfig());
// unset the context
NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL;
@ -358,7 +358,7 @@ void LoadRootPrimitiveCommand::redo()
// Check property types
if (Utils::recursiveUpdateDefaultValues(primitives->RootNode))
{
nlwarning("In file (%s) : Some primitives have been modified to initialise their default values\nor to change their properties type.", m_fileName.toStdString().c_str());
nlwarning("In file (%s) : Some primitives have been modified to initialise their default values\nor to change their properties type.", m_fileName.toUtf8().constData());
}
m_rootPrimIndex = m_model->createRootPrimitiveNode(m_fileName, primitives);
@ -460,15 +460,17 @@ void AddPrimitiveByClassCommand::redo()
PrimitiveNode *parentNode = static_cast<PrimitiveNode *>(parentIndex.internalPointer());
const NLLIGO::CPrimitiveClass *primClass = parentNode->primitiveClass();
std::string className = m_className.toUtf8().constData();
int id = 0;
while (primClass->DynamicChildren[id].ClassName != m_className.toStdString())
while (primClass->DynamicChildren[id].ClassName != className)
++id;
// set the primitive context
NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = parentNode->rootPrimitiveNode()->primitives();
QString namePrimititve = QString("%1_%2").arg(m_className).arg(parentNode->childCount());
NLLIGO::IPrimitive *newPrimitive = Utils::createPrimitive(m_className.toStdString().c_str(), namePrimititve.toStdString().c_str(),
NLLIGO::IPrimitive *newPrimitive = Utils::createPrimitive(m_className.toUtf8().constData(), namePrimititve.toUtf8().constData(),
NLMISC::CVector(m_initPos.x(), -m_initPos.y(), 0.0), m_delta, primClass->DynamicChildren[id].Parameters, parentNode->primitive());
// unset the context

View file

@ -62,7 +62,7 @@ bool WorldEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManage
try
{
// Search path of file world_editor_classes.xml
std::string ligoPath = NLMISC::CPath::lookup(fileName.toStdString());
std::string ligoPath = NLMISC::CPath::lookup(fileName.toUtf8().constData());
// Init LIGO
m_ligoConfig.readPrimitiveClass(ligoPath.c_str(), true);
NLLIGO::Register();

View file

@ -168,7 +168,7 @@ void WorldEditorWindow::loadWorldEditFile(const QString &fileName)
return;
Utils::WorldEditList worldEditList;
if (!Utils::loadWorldEditFile(fileName.toStdString(), worldEditList))
if (!Utils::loadWorldEditFile(fileName.toUtf8().constData(), worldEditList))
{
// TODO: add the message box
return;