Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit ff22053

Browse files
authored
Issue #1946 Fixed mangled text issue for FusionUI (#1947)
1 parent 97bbe67 commit ff22053

15 files changed

+65
-41
lines changed

earth_enterprise/src/fusion/fusionui/AssetChooser.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class FolderItem : public QIconViewItem {
5959

6060
FolderItem::FolderItem(QIconView* parent, const gstAssetFolder& f)
6161
: QIconViewItem(parent), folder(f) {
62-
setText(shortAssetName(f.name()));
62+
std::string san = shortAssetName(f.name());
63+
setText(san.c_str());
6364
AssetDisplayHelper a(AssetDefs::Invalid, std::string());
6465
setPixmap(a.GetPixmap());
6566
setKey(QString("0" + text()));
@@ -82,7 +83,7 @@ AssetItem::AssetItem(QIconView* parent, gstAssetHandle handle)
8283
: QIconViewItem(parent), assetHandle(handle) {
8384

8485
auto saname = shortAssetName(handle->getName());
85-
setText(saname);
86+
setText(saname.c_str());
8687

8788
Asset asset = handle->getAsset();
8889
AssetDisplayHelper a(asset->type, asset->subtype);
@@ -308,7 +309,7 @@ void AssetChooser::accept() {
308309
AssetItem* assetItem = dynamic_cast<AssetItem*>(item);
309310
if (assetItem != NULL) {
310311
auto saname = shortAssetName(assetItem->getAssetHandle()->getName());
311-
nameEdit->setText(saname);
312+
nameEdit->setText(saname.c_str());
312313
gstAssetHandle asset_handle = assetItem->getAssetHandle();
313314
Asset asset = asset_handle->getAsset();
314315
type_ = asset->type;
@@ -427,8 +428,9 @@ void AssetChooser::nameChanged(const QString& str) {
427428
if (item != NULL) {
428429
// If name doesn't match with current item, then clear selection.
429430
AssetItem* assetItem = dynamic_cast<AssetItem*>(item);
431+
std::string san = shortAssetName(assetItem->getAssetHandle()->getName().toStdString().c_str());
430432
if (assetItem != NULL &&
431-
getName() != shortAssetName(assetItem->getAssetHandle()->getName().toUtf8().constData())) {
433+
getName() != san.c_str()) {
432434
iconView->clearSelection();
433435
}
434436
}

earth_enterprise/src/fusion/fusionui/AssetIconView.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ AssetIcon::AssetIcon(QIconView* parent, gstAssetHandle handle, int initsz)
4646
if (defaultImage == NULL)
4747
defaultImage = new QImage(uic_load_pixmap("preview_default.png").
4848
convertToImage());
49-
auto name = shortAssetName(handle->getName());
50-
setText(name);
49+
std::string name = shortAssetName(handle->getName());
50+
setText(name.c_str());
5151

5252
QImage img;
5353
AssetVersion ver(handle->getAsset()->CurrVersionRef());

earth_enterprise/src/fusion/fusionui/AssetProperties.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ AssetProperties::AssetProperties( QWidget* parent, const gstAssetHandle &handle
7070
versionsList->setSorting( 0, false );
7171

7272
Asset asset = handle->getAsset();
73-
nameLabel->setText( shortAssetName( handle->getName()) );
73+
std::string san = shortAssetName( handle->getName());
74+
nameLabel->setText( san.c_str() );
7475
typeLabel->setText( ToString( asset->type ).c_str() );
7576
subTypeLabel->setText( asset->PrettySubtype().c_str() );
7677

earth_enterprise/src/fusion/fusionui/AssetTableView.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ AssetTableItem::AssetTableItem(QTable* table, gstAssetHandle handle)
4545
Asset asset = handle->getAsset();
4646
AssetDisplayHelper a(asset->type, asset->PrettySubtype());
4747
setPixmap(a.GetPixmap());
48-
setText(shortAssetName(handle->getName()));
48+
std::string san = shortAssetName(handle->getName());
49+
setText(san.c_str());
4950
}
5051

5152
AssetTableItem::~AssetTableItem() {

earth_enterprise/src/fusion/fusionui/DatabaseWidget.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ void DatabaseWidget::Prefill(const DatabaseEditRequest& request) {
3737

3838
if (request.config.vectorProject.size() != 0) {
3939
projects.push_back(request.config.vectorProject);
40-
vector_project_label->setText(shortAssetName(request.config.vectorProject));
40+
std::string san = shortAssetName(request.config.vectorProject);
41+
vector_project_label->setText(san.c_str());
4142
} else {
4243
vector_project_label->setText(empty_text);
4344
}
@@ -49,14 +50,16 @@ void DatabaseWidget::Prefill(const DatabaseEditRequest& request) {
4950
} else {
5051
if (request.config.imageryProject.size() != 0) {
5152
projects.push_back(request.config.imageryProject);
52-
imagery_project_label->setText(shortAssetName(request.config.imageryProject));
53+
std::string san = shortAssetName(request.config.imageryProject);
54+
imagery_project_label->setText(san.c_str());
5355
} else {
5456
imagery_project_label->setText(empty_text);
5557
}
5658

5759
if (request.config.terrainProject.size() != 0) {
5860
projects.push_back(request.config.terrainProject);
59-
terrain_project_label->setText(shortAssetName(request.config.terrainProject));
61+
std::string san = shortAssetName(request.config.terrainProject);
62+
terrain_project_label->setText(san.c_str());
6063
} else {
6164
terrain_project_label->setText(empty_text);
6265
}
@@ -97,7 +100,8 @@ void DatabaseWidget::ChooseVectorProject() {
97100
if (!chooser.getFullPath(newpath))
98101
return;
99102

100-
vector_project_label->setText(shortAssetName(newpath));
103+
std::string san = shortAssetName(newpath);
104+
vector_project_label->setText(san.c_str());
101105
}
102106

103107
void DatabaseWidget::ChooseImageryProject() {
@@ -110,7 +114,8 @@ void DatabaseWidget::ChooseImageryProject() {
110114
if (!chooser.getFullPath(newpath))
111115
return;
112116

113-
imagery_project_label->setText(shortAssetName(newpath));
117+
std::string san = shortAssetName(newpath);
118+
imagery_project_label->setText(san.c_str());
114119
}
115120

116121
void DatabaseWidget::ChooseTerrainProject() {
@@ -122,8 +127,8 @@ void DatabaseWidget::ChooseTerrainProject() {
122127
QString newpath;
123128
if (!chooser.getFullPath(newpath))
124129
return;
125-
126-
terrain_project_label->setText(shortAssetName(newpath));
130+
std::string san = shortAssetName(newpath);
131+
terrain_project_label->setText(san.c_str());
127132
}
128133

129134
void DatabaseWidget::ClearVectorProject() {

earth_enterprise/src/fusion/fusionui/LayerProperties.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ LayerProperties::LayerProperties(QWidget* parent, const LayerConfig& config,
5454
layer_config_.AssignUuidIfEmpty();
5555

5656
uuidEdit->setText(layer_config_.asset_uuid_.c_str());
57-
assetNameLabel->setText(shortAssetName(layer_config_.assetRef));
57+
std::string san = shortAssetName(layer_config_.assetRef);
58+
assetNameLabel->setText(san.c_str());
5859
preserveTextSpin->setValue(layer_config_.preserveTextLevel);
5960
isVisibleCheck->setChecked(layer_config_.isVisible);
6061

earth_enterprise/src/fusion/fusionui/MapDatabaseWidget.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ MapDatabaseWidget::MapDatabaseWidget(QWidget* parent, AssetBase* base)
3939

4040
void MapDatabaseWidget::Prefill(const MapDatabaseEditRequest& request) {
4141
std::vector<std::string> projects;
42+
std::string san;
4243

4344
if (request.config.mapProject.size() != 0) {
4445
projects.push_back(request.config.mapProject);
45-
map_project_label->setText(shortAssetName(request.config.mapProject));
46+
san = shortAssetName(request.config.mapProject);
47+
map_project_label->setText(san.c_str());
4648
} else {
4749
map_project_label->setText(empty_text);
4850
}
@@ -52,8 +54,8 @@ void MapDatabaseWidget::Prefill(const MapDatabaseEditRequest& request) {
5254
} else {
5355
if (request.config.imageryProject.size() != 0) {
5456
projects.push_back(request.config.imageryProject);
55-
imagery_project_label->setText(
56-
shortAssetName(request.config.imageryProject));
57+
san = shortAssetName(request.config.imageryProject);
58+
imagery_project_label->setText(san.c_str());
5759
} else {
5860
imagery_project_label->setText(empty_text);
5961
}
@@ -107,7 +109,8 @@ void MapDatabaseWidget::ChooseMapProject() {
107109
if (!chooser.getFullPath(newpath))
108110
return;
109111

110-
map_project_label->setText(shortAssetName(newpath));
112+
std::string san = shortAssetName(newpath);
113+
map_project_label->setText(san.c_str());
111114
}
112115

113116
void MapDatabaseWidget::ChooseImageryProject() {
@@ -120,7 +123,8 @@ void MapDatabaseWidget::ChooseImageryProject() {
120123
if (!chooser.getFullPath(newpath))
121124
return;
122125

123-
imagery_project_label->setText(shortAssetName(newpath));
126+
std::string san = shortAssetName(newpath);
127+
imagery_project_label->setText(san.c_str());
124128
}
125129

126130
void MapDatabaseWidget::ClearMapProject() {

earth_enterprise/src/fusion/fusionui/MapProject.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,21 @@ MapLayerItem::MapLayerItem(Q3ListView* parent,
7777

7878
void MapLayerItem::Init() {
7979
MapLayerAsset layer_asset(layer_item_config_.assetRef);
80+
std::string san;
8081
if (layer_asset) {
8182
if (layer_item_config_.legend.UseDefault()) {
8283
setText(0, layer_asset->config.legend.defaultLocale.name + "<DEFAULT>");
8384
} else {
8485
setText(0, layer_item_config_.legend.GetValue().defaultLocale.name);
8586
}
86-
87-
setText(1, shortAssetName(layer_item_config_.assetRef));
87+
san = shortAssetName(layer_item_config_.assetRef);
88+
setText(1, san.c_str());
8889
AssetDisplayHelper a(layer_asset->type, layer_asset->subtype);
8990
setPixmap(1, a.GetPixmap());
9091
} else {
9192
setText(0, "<INVALID>");
92-
setText(1, shortAssetName(layer_item_config_.assetRef));
93+
san = shortAssetName(layer_item_config_.assetRef);
94+
setText(1, san.c_str());
9395
setPixmap(1, AssetDisplayHelper::Pixmap(AssetDisplayHelper::Key_Unknown));
9496
}
9597
}

earth_enterprise/src/fusion/fusionui/MercatorMapDatabaseWidget.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void MercatorMapDatabaseWidget::Prefill(const MapDatabaseEditRequest& request) {
4545

4646
if (request.config.mapProject.size() != 0) {
4747
projects.push_back(request.config.mapProject);
48-
map_project_label->setText(shortAssetName(request.config.mapProject));
48+
std::string san = shortAssetName(request.config.mapProject);
49+
map_project_label->setText(san.c_str());
4950
} else {
5051
map_project_label->setText(empty_text);
5152
}
@@ -112,8 +113,8 @@ void MercatorMapDatabaseWidget::ChooseMapProject() {
112113
QString newpath;
113114
if (!chooser.getFullPath(newpath))
114115
return;
115-
116-
map_project_label->setText(shortAssetName(newpath));
116+
std::string san = shortAssetName(newpath);
117+
map_project_label->setText(san.c_str());
117118
}
118119

119120
void MercatorMapDatabaseWidget::ChooseImageryProject() {
@@ -153,6 +154,7 @@ void MercatorMapDatabaseWidget::SetImageryProject(const QString& path) {
153154
ClearImageryProject();
154155
} else {
155156
imagery_project_path_ = path;
156-
imagery_project_label->setText(shortAssetName(imagery_project_path_));
157+
std::string san = shortAssetName(imagery_project_path_);
158+
imagery_project_label->setText(san.c_str());
157159
}
158160
}

earth_enterprise/src/fusion/fusionui/ProjectManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,8 @@ void ProjectManager::AddAssetLayer(const char* assetname) {
15671567
isasset);
15681568
if (newsource) {
15691569
std::string basename = khBasename(asset->GetRef().toString());
1570-
QString layername = shortAssetName(basename);
1570+
std::string san = shortAssetName(basename);
1571+
QString layername(san.c_str());
15711572
gstLayer* layer = CreateNewLayer(layername,
15721573
newsource, 0 /* src layer num */,
15731574
asset->GetRef());
@@ -2281,8 +2282,9 @@ void ProjectManager::contentsDropEvent(QDropEvent* e) {
22812282
if (ver) {
22822283
AddAssetLayer(it->latin1());
22832284
} else {
2285+
std::string san = shortAssetName(*it);
22842286
nogoodversions += QString(" " )
2285-
+ QString(shortAssetName(*it))
2287+
+ QString(san.c_str())
22862288
+ QString("\n");
22872289
}
22882290
}

0 commit comments

Comments
 (0)