From 986edb216fecfc11714f6d0bdc386a2b0208b63f Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 22 Nov 2013 11:25:12 +0100 Subject: [PATCH] Fixed: #85 Compilation with STLport --- .../plugins/landscape_editor/builder_zone.cpp | 14 ++++---- .../landscape_editor/builder_zone_base.cpp | 6 ++-- .../landscape_editor_window.cpp | 2 +- .../landscape_editor/list_zones_model.cpp | 2 +- .../landscape_editor/list_zones_widget.cpp | 36 +++++++++---------- .../landscape_editor/pixmap_database.cpp | 4 +-- .../plugins/world_editor/primitives_view.cpp | 4 +-- .../world_editor/world_editor_actions.cpp | 10 +++--- .../world_editor/world_editor_plugin.cpp | 2 +- .../world_editor/world_editor_window.cpp | 2 +- 10 files changed, 42 insertions(+), 40 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp index a4a42259c..d8e74e564 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp @@ -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; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp index 63f246df3..580068a56 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp @@ -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; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp index 3f0ae5874..bbc996b94 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp @@ -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); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp index d78c7c577..fabd56a40 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp @@ -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; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp index 9d6ff8eb4..42f472a81 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp @@ -191,7 +191,7 @@ void ListZonesWidget::updateFilters_1(const QString &value) { disableSignals(true); std::vector 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 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 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 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 currentSelection; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp index 91de95cce..075624333 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp @@ -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; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp index 33b98eed6..ffa4ae955 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp @@ -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(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 { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp index b8ca7138d..e10e15745 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp @@ -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(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 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp index fe7dc45c1..301939cb6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp @@ -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(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp index 7bdff078b..b23e62063 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp @@ -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;