diff --git a/earth_enterprise/src/fusion/fusionui/AssetChooser.cpp b/earth_enterprise/src/fusion/fusionui/AssetChooser.cpp index 411b02473..da72be3bd 100644 --- a/earth_enterprise/src/fusion/fusionui/AssetChooser.cpp +++ b/earth_enterprise/src/fusion/fusionui/AssetChooser.cpp @@ -59,7 +59,8 @@ class FolderItem : public QIconViewItem { FolderItem::FolderItem(QIconView* parent, const gstAssetFolder& f) : QIconViewItem(parent), folder(f) { - setText(shortAssetName(f.name())); + std::string san = shortAssetName(f.name()); + setText(san.c_str()); AssetDisplayHelper a(AssetDefs::Invalid, std::string()); setPixmap(a.GetPixmap()); setKey(QString("0" + text())); @@ -82,7 +83,7 @@ AssetItem::AssetItem(QIconView* parent, gstAssetHandle handle) : QIconViewItem(parent), assetHandle(handle) { auto saname = shortAssetName(handle->getName()); - setText(saname); + setText(saname.c_str()); Asset asset = handle->getAsset(); AssetDisplayHelper a(asset->type, asset->subtype); @@ -308,7 +309,7 @@ void AssetChooser::accept() { AssetItem* assetItem = dynamic_cast(item); if (assetItem != NULL) { auto saname = shortAssetName(assetItem->getAssetHandle()->getName()); - nameEdit->setText(saname); + nameEdit->setText(saname.c_str()); gstAssetHandle asset_handle = assetItem->getAssetHandle(); Asset asset = asset_handle->getAsset(); type_ = asset->type; @@ -427,8 +428,9 @@ void AssetChooser::nameChanged(const QString& str) { if (item != NULL) { // If name doesn't match with current item, then clear selection. AssetItem* assetItem = dynamic_cast(item); + std::string san = shortAssetName(assetItem->getAssetHandle()->getName().toStdString().c_str()); if (assetItem != NULL && - getName() != shortAssetName(assetItem->getAssetHandle()->getName().toUtf8().constData())) { + getName() != san.c_str()) { iconView->clearSelection(); } } diff --git a/earth_enterprise/src/fusion/fusionui/AssetIconView.cpp b/earth_enterprise/src/fusion/fusionui/AssetIconView.cpp index 1ea7c6904..5c62a4f04 100644 --- a/earth_enterprise/src/fusion/fusionui/AssetIconView.cpp +++ b/earth_enterprise/src/fusion/fusionui/AssetIconView.cpp @@ -46,8 +46,8 @@ AssetIcon::AssetIcon(QIconView* parent, gstAssetHandle handle, int initsz) if (defaultImage == NULL) defaultImage = new QImage(uic_load_pixmap("preview_default.png"). convertToImage()); - auto name = shortAssetName(handle->getName()); - setText(name); + std::string name = shortAssetName(handle->getName()); + setText(name.c_str()); QImage img; AssetVersion ver(handle->getAsset()->CurrVersionRef()); diff --git a/earth_enterprise/src/fusion/fusionui/AssetProperties.cpp b/earth_enterprise/src/fusion/fusionui/AssetProperties.cpp index 8651b38e3..f2a4f2933 100644 --- a/earth_enterprise/src/fusion/fusionui/AssetProperties.cpp +++ b/earth_enterprise/src/fusion/fusionui/AssetProperties.cpp @@ -70,7 +70,8 @@ AssetProperties::AssetProperties( QWidget* parent, const gstAssetHandle &handle versionsList->setSorting( 0, false ); Asset asset = handle->getAsset(); - nameLabel->setText( shortAssetName( handle->getName()) ); + std::string san = shortAssetName( handle->getName()); + nameLabel->setText( san.c_str() ); typeLabel->setText( ToString( asset->type ).c_str() ); subTypeLabel->setText( asset->PrettySubtype().c_str() ); diff --git a/earth_enterprise/src/fusion/fusionui/AssetTableView.cpp b/earth_enterprise/src/fusion/fusionui/AssetTableView.cpp index 74483ef32..eadf65633 100644 --- a/earth_enterprise/src/fusion/fusionui/AssetTableView.cpp +++ b/earth_enterprise/src/fusion/fusionui/AssetTableView.cpp @@ -45,7 +45,8 @@ AssetTableItem::AssetTableItem(QTable* table, gstAssetHandle handle) Asset asset = handle->getAsset(); AssetDisplayHelper a(asset->type, asset->PrettySubtype()); setPixmap(a.GetPixmap()); - setText(shortAssetName(handle->getName())); + std::string san = shortAssetName(handle->getName()); + setText(san.c_str()); } AssetTableItem::~AssetTableItem() { diff --git a/earth_enterprise/src/fusion/fusionui/DatabaseWidget.cpp b/earth_enterprise/src/fusion/fusionui/DatabaseWidget.cpp index 5af7e2ef9..6bf86ad94 100644 --- a/earth_enterprise/src/fusion/fusionui/DatabaseWidget.cpp +++ b/earth_enterprise/src/fusion/fusionui/DatabaseWidget.cpp @@ -37,7 +37,8 @@ void DatabaseWidget::Prefill(const DatabaseEditRequest& request) { if (request.config.vectorProject.size() != 0) { projects.push_back(request.config.vectorProject); - vector_project_label->setText(shortAssetName(request.config.vectorProject)); + std::string san = shortAssetName(request.config.vectorProject); + vector_project_label->setText(san.c_str()); } else { vector_project_label->setText(empty_text); } @@ -49,14 +50,16 @@ void DatabaseWidget::Prefill(const DatabaseEditRequest& request) { } else { if (request.config.imageryProject.size() != 0) { projects.push_back(request.config.imageryProject); - imagery_project_label->setText(shortAssetName(request.config.imageryProject)); + std::string san = shortAssetName(request.config.imageryProject); + imagery_project_label->setText(san.c_str()); } else { imagery_project_label->setText(empty_text); } if (request.config.terrainProject.size() != 0) { projects.push_back(request.config.terrainProject); - terrain_project_label->setText(shortAssetName(request.config.terrainProject)); + std::string san = shortAssetName(request.config.terrainProject); + terrain_project_label->setText(san.c_str()); } else { terrain_project_label->setText(empty_text); } @@ -97,7 +100,8 @@ void DatabaseWidget::ChooseVectorProject() { if (!chooser.getFullPath(newpath)) return; - vector_project_label->setText(shortAssetName(newpath)); + std::string san = shortAssetName(newpath); + vector_project_label->setText(san.c_str()); } void DatabaseWidget::ChooseImageryProject() { @@ -110,7 +114,8 @@ void DatabaseWidget::ChooseImageryProject() { if (!chooser.getFullPath(newpath)) return; - imagery_project_label->setText(shortAssetName(newpath)); + std::string san = shortAssetName(newpath); + imagery_project_label->setText(san.c_str()); } void DatabaseWidget::ChooseTerrainProject() { @@ -122,8 +127,8 @@ void DatabaseWidget::ChooseTerrainProject() { QString newpath; if (!chooser.getFullPath(newpath)) return; - - terrain_project_label->setText(shortAssetName(newpath)); + std::string san = shortAssetName(newpath); + terrain_project_label->setText(san.c_str()); } void DatabaseWidget::ClearVectorProject() { diff --git a/earth_enterprise/src/fusion/fusionui/LayerProperties.cpp b/earth_enterprise/src/fusion/fusionui/LayerProperties.cpp index b548e78f2..fe8e62ea3 100644 --- a/earth_enterprise/src/fusion/fusionui/LayerProperties.cpp +++ b/earth_enterprise/src/fusion/fusionui/LayerProperties.cpp @@ -54,7 +54,8 @@ LayerProperties::LayerProperties(QWidget* parent, const LayerConfig& config, layer_config_.AssignUuidIfEmpty(); uuidEdit->setText(layer_config_.asset_uuid_.c_str()); - assetNameLabel->setText(shortAssetName(layer_config_.assetRef)); + std::string san = shortAssetName(layer_config_.assetRef); + assetNameLabel->setText(san.c_str()); preserveTextSpin->setValue(layer_config_.preserveTextLevel); isVisibleCheck->setChecked(layer_config_.isVisible); diff --git a/earth_enterprise/src/fusion/fusionui/MapDatabaseWidget.cpp b/earth_enterprise/src/fusion/fusionui/MapDatabaseWidget.cpp index b2fbdae86..5f7314f3e 100644 --- a/earth_enterprise/src/fusion/fusionui/MapDatabaseWidget.cpp +++ b/earth_enterprise/src/fusion/fusionui/MapDatabaseWidget.cpp @@ -39,10 +39,12 @@ MapDatabaseWidget::MapDatabaseWidget(QWidget* parent, AssetBase* base) void MapDatabaseWidget::Prefill(const MapDatabaseEditRequest& request) { std::vector projects; + std::string san; if (request.config.mapProject.size() != 0) { projects.push_back(request.config.mapProject); - map_project_label->setText(shortAssetName(request.config.mapProject)); + san = shortAssetName(request.config.mapProject); + map_project_label->setText(san.c_str()); } else { map_project_label->setText(empty_text); } @@ -52,8 +54,8 @@ void MapDatabaseWidget::Prefill(const MapDatabaseEditRequest& request) { } else { if (request.config.imageryProject.size() != 0) { projects.push_back(request.config.imageryProject); - imagery_project_label->setText( - shortAssetName(request.config.imageryProject)); + san = shortAssetName(request.config.imageryProject); + imagery_project_label->setText(san.c_str()); } else { imagery_project_label->setText(empty_text); } @@ -107,7 +109,8 @@ void MapDatabaseWidget::ChooseMapProject() { if (!chooser.getFullPath(newpath)) return; - map_project_label->setText(shortAssetName(newpath)); + std::string san = shortAssetName(newpath); + map_project_label->setText(san.c_str()); } void MapDatabaseWidget::ChooseImageryProject() { @@ -120,7 +123,8 @@ void MapDatabaseWidget::ChooseImageryProject() { if (!chooser.getFullPath(newpath)) return; - imagery_project_label->setText(shortAssetName(newpath)); + std::string san = shortAssetName(newpath); + imagery_project_label->setText(san.c_str()); } void MapDatabaseWidget::ClearMapProject() { diff --git a/earth_enterprise/src/fusion/fusionui/MapProject.cpp b/earth_enterprise/src/fusion/fusionui/MapProject.cpp index 0878ac32d..5b1b918b9 100644 --- a/earth_enterprise/src/fusion/fusionui/MapProject.cpp +++ b/earth_enterprise/src/fusion/fusionui/MapProject.cpp @@ -77,19 +77,21 @@ MapLayerItem::MapLayerItem(Q3ListView* parent, void MapLayerItem::Init() { MapLayerAsset layer_asset(layer_item_config_.assetRef); + std::string san; if (layer_asset) { if (layer_item_config_.legend.UseDefault()) { setText(0, layer_asset->config.legend.defaultLocale.name + ""); } else { setText(0, layer_item_config_.legend.GetValue().defaultLocale.name); } - - setText(1, shortAssetName(layer_item_config_.assetRef)); + san = shortAssetName(layer_item_config_.assetRef); + setText(1, san.c_str()); AssetDisplayHelper a(layer_asset->type, layer_asset->subtype); setPixmap(1, a.GetPixmap()); } else { setText(0, ""); - setText(1, shortAssetName(layer_item_config_.assetRef)); + san = shortAssetName(layer_item_config_.assetRef); + setText(1, san.c_str()); setPixmap(1, AssetDisplayHelper::Pixmap(AssetDisplayHelper::Key_Unknown)); } } diff --git a/earth_enterprise/src/fusion/fusionui/MercatorMapDatabaseWidget.cpp b/earth_enterprise/src/fusion/fusionui/MercatorMapDatabaseWidget.cpp index c7c79d65e..e4e847201 100644 --- a/earth_enterprise/src/fusion/fusionui/MercatorMapDatabaseWidget.cpp +++ b/earth_enterprise/src/fusion/fusionui/MercatorMapDatabaseWidget.cpp @@ -45,7 +45,8 @@ void MercatorMapDatabaseWidget::Prefill(const MapDatabaseEditRequest& request) { if (request.config.mapProject.size() != 0) { projects.push_back(request.config.mapProject); - map_project_label->setText(shortAssetName(request.config.mapProject)); + std::string san = shortAssetName(request.config.mapProject); + map_project_label->setText(san.c_str()); } else { map_project_label->setText(empty_text); } @@ -112,8 +113,8 @@ void MercatorMapDatabaseWidget::ChooseMapProject() { QString newpath; if (!chooser.getFullPath(newpath)) return; - - map_project_label->setText(shortAssetName(newpath)); + std::string san = shortAssetName(newpath); + map_project_label->setText(san.c_str()); } void MercatorMapDatabaseWidget::ChooseImageryProject() { @@ -153,6 +154,7 @@ void MercatorMapDatabaseWidget::SetImageryProject(const QString& path) { ClearImageryProject(); } else { imagery_project_path_ = path; - imagery_project_label->setText(shortAssetName(imagery_project_path_)); + std::string san = shortAssetName(imagery_project_path_); + imagery_project_label->setText(san.c_str()); } } diff --git a/earth_enterprise/src/fusion/fusionui/ProjectManager.cpp b/earth_enterprise/src/fusion/fusionui/ProjectManager.cpp index aea911d08..0776e23a7 100644 --- a/earth_enterprise/src/fusion/fusionui/ProjectManager.cpp +++ b/earth_enterprise/src/fusion/fusionui/ProjectManager.cpp @@ -1567,7 +1567,8 @@ void ProjectManager::AddAssetLayer(const char* assetname) { isasset); if (newsource) { std::string basename = khBasename(asset->GetRef().toString()); - QString layername = shortAssetName(basename); + std::string san = shortAssetName(basename); + QString layername(san.c_str()); gstLayer* layer = CreateNewLayer(layername, newsource, 0 /* src layer num */, asset->GetRef()); @@ -2281,8 +2282,9 @@ void ProjectManager::contentsDropEvent(QDropEvent* e) { if (ver) { AddAssetLayer(it->latin1()); } else { + std::string san = shortAssetName(*it); nogoodversions += QString(" " ) - + QString(shortAssetName(*it)) + + QString(san.c_str()) + QString("\n"); } } diff --git a/earth_enterprise/src/fusion/fusionui/RasterProjectWidget.cpp b/earth_enterprise/src/fusion/fusionui/RasterProjectWidget.cpp index 411928d6a..20a65a2d1 100644 --- a/earth_enterprise/src/fusion/fusionui/RasterProjectWidget.cpp +++ b/earth_enterprise/src/fusion/fusionui/RasterProjectWidget.cpp @@ -223,7 +223,8 @@ QString RasterLayerItem::text(int col) const { config_.overridemax)); } - return QString(shortAssetName(config_.dataAsset)) + level; + std::string san = shortAssetName(config_.dataAsset); + return QString(san.c_str()) + level; } else { return QString(); } diff --git a/earth_enterprise/src/fusion/fusionui/VectorLayer.cpp b/earth_enterprise/src/fusion/fusionui/VectorLayer.cpp index 95958f89a..adf1b5165 100644 --- a/earth_enterprise/src/fusion/fusionui/VectorLayer.cpp +++ b/earth_enterprise/src/fusion/fusionui/VectorLayer.cpp @@ -42,7 +42,8 @@ void VectorLayerWidget::Prefill(const VectorLayerXEditRequest& req) { if (req.config.vectorResource.empty()) { vector_resource_label->setText(empty_text); } else { - vector_resource_label->setText(shortAssetName(req.config.vectorResource)); + std::string san = shortAssetName(req.config.vectorResource); + vector_resource_label->setText(san.c_str()); } } @@ -66,7 +67,8 @@ void VectorLayerWidget::chooseVectorResource() { if (!chooser.getFullPath(newpath)) return; - vector_resource_label->setText(shortAssetName(newpath)); + std::string san = shortAssetName(newpath); + vector_resource_label->setText(san.c_str()); } // **************************************************************************** diff --git a/earth_enterprise/src/fusion/fusionui/VectorProject.cpp b/earth_enterprise/src/fusion/fusionui/VectorProject.cpp index 2279a8a9a..ac59667e4 100644 --- a/earth_enterprise/src/fusion/fusionui/VectorProject.cpp +++ b/earth_enterprise/src/fusion/fusionui/VectorProject.cpp @@ -109,7 +109,8 @@ void VectorLayerItem::Init() { setText(0, layer_config_.defaultLocale.name_); - setText(1, shortAssetName(layer_config_.assetRef)); + std::string san = shortAssetName(layer_config_.assetRef); + setText(1, san.c_str()); std::vector< unsigned int> fill_rgba, outline_rgba; for (std::vector::iterator rule = layer_config_.displayRules.begin(); diff --git a/earth_enterprise/src/fusion/gst/gstAssetGroup.cpp b/earth_enterprise/src/fusion/gst/gstAssetGroup.cpp index 251d259af..234c7deba 100644 --- a/earth_enterprise/src/fusion/gst/gstAssetGroup.cpp +++ b/earth_enterprise/src/fusion/gst/gstAssetGroup.cpp @@ -21,7 +21,7 @@ #include "gstAssetGroup.h" -const char* shortAssetName(const char* n) { +std::string shortAssetName(const char* n) { static const std::vector suffixes = { @@ -53,15 +53,15 @@ const char* shortAssetName(const char* n) { } } - return saname.c_str(); + return saname; } -const char* shortAssetName(const std::string& str) +std::string shortAssetName(const std::string& str) { return shortAssetName(str.c_str()); } -const char* shortAssetName(const QString& str) +std::string shortAssetName(const QString& str) { return shortAssetName(str.toStdString().c_str()); } diff --git a/earth_enterprise/src/fusion/gst/gstAssetGroup.h b/earth_enterprise/src/fusion/gst/gstAssetGroup.h index f15e45487..894021ad5 100644 --- a/earth_enterprise/src/fusion/gst/gstAssetGroup.h +++ b/earth_enterprise/src/fusion/gst/gstAssetGroup.h @@ -31,9 +31,9 @@ class gstAssetHandleImpl; typedef khRefGuard gstAssetHandle; -const char* shortAssetName(const char*); -const char* shortAssetName(const std::string&); -const char* shortAssetName(const QString&); +std::string shortAssetName(const char*); +std::string shortAssetName(const std::string&); +std::string shortAssetName(const QString&); bool isAssetPath(const QString&); // -----------------------------------------------------------------------------