History

Improve user messages

David Rowe committed 9 years ago

Commit 8cd7e1b1 parent 37da8001 file · +16 −17Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+16−17
@@ -5642,18 +5642,18 @@ void Application::showAssetServerWidget(QString filePath) { · 5641 unmodified lines
5642}5642}
5643 5643
5644void Application::addAssetToWorldFromURL(QString url) {5644void Application::addAssetToWorldFromURL(QString url) {
5645 qInfo(interfaceapp) << "Download asset and add to world from" << url;5645 qInfo(interfaceapp) << "Download model and add to world from" << url;
5646 5646
5647 QString filename = url.section("filename=", 1, 1); // Filename is in "?filename=" parameter at end of URL.5647 QString filename = url.section("filename=", 1, 1); // Filename is in "?filename=" parameter at end of URL.
5648 5648
5649 if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {5649 if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {
5650 QString errorInfo = "You do not have permissions to write to the Asset Server.";5650 QString errorInfo = "You do not have permissions to write to the Asset Server.";
5651 qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;5651 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
5652 addAssetToWorldError(filename, errorInfo);5652 addAssetToWorldError(filename, errorInfo);
5653 return;5653 return;
5654 }5654 }
5655 5655
5656 addAssetToWorldInfo(filename, "Downloading asset file " + filename + ".");5656 addAssetToWorldInfo(filename, "Downloading model file " + filename + ".");
5657 5657
5658 auto request = ResourceManager::createResourceRequest(nullptr, QUrl(url));5658 auto request = ResourceManager::createResourceRequest(nullptr, QUrl(url));
5659 connect(request, &ResourceRequest::finished, this, &Application::addAssetToWorldFromURLRequestFinished);5659 connect(request, &ResourceRequest::finished, this, &Application::addAssetToWorldFromURLRequestFinished);
@@ -5668,7 +5668,7 @@ void Application::addAssetToWorldFromURLRequestFinished() { · 8 unmodified lines
5668 QString filename = url.section("filename=", 1, 1); // Filename from trailing "?filename=" URL parameter.5668 QString filename = url.section("filename=", 1, 1); // Filename from trailing "?filename=" URL parameter.
5669 5669
5670 if (result == ResourceRequest::Success) {5670 if (result == ResourceRequest::Success) {
5671 qInfo(interfaceapp) << "Downloaded asset from" << url;5671 qInfo(interfaceapp) << "Downloaded model from" << url;
5672 QTemporaryDir temporaryDir;5672 QTemporaryDir temporaryDir;
5673 temporaryDir.setAutoRemove(false);5673 temporaryDir.setAutoRemove(false);
5674 if (temporaryDir.isValid()) {5674 if (temporaryDir.isValid()) {
@@ -5720,7 +5720,7 @@ void Application::addAssetToWorld(QString filePath) { · 45 unmodified lines
5720 // Test repeated because possibly different code paths.5720 // Test repeated because possibly different code paths.
5721 if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {5721 if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {
5722 QString errorInfo = "You do not have permissions to write to the Asset Server.";5722 QString errorInfo = "You do not have permissions to write to the Asset Server.";
5723 qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;5723 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
5724 addAssetToWorldError(filename, errorInfo);5724 addAssetToWorldError(filename, errorInfo);
5725 return;5725 return;
5726 }5726 }
@@ -5741,7 +5741,7 @@ void Application::addAssetToWorldWithNewMapping(QString filePath, QString mappin · 14 unmodified lines
5741 } else if (result != GetMappingRequest::NoError) {5741 } else if (result != GetMappingRequest::NoError) {
5742 QString errorInfo = "Could not map asset name: "5742 QString errorInfo = "Could not map asset name: "
5743 + mapping.left(mapping.length() - QString::number(copy).length() - 1);5743 + mapping.left(mapping.length() - QString::number(copy).length() - 1);
5744 qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;5744 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
5745 addAssetToWorldError(filenameFromPath(filePath), errorInfo);5745 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
5746 } else if (copy < MAX_COPY_COUNT - 1) {5746 } else if (copy < MAX_COPY_COUNT - 1) {
5747 if (copy > 0) {5747 if (copy > 0) {
@@ -5753,7 +5753,7 @@ void Application::addAssetToWorldWithNewMapping(QString filePath, QString mappin · 5 unmodified lines
5753 } else {5753 } else {
5754 QString errorInfo = "Too many copies of asset name: " 5754 QString errorInfo = "Too many copies of asset name: "
5755 + mapping.left(mapping.length() - QString::number(copy).length() - 1);5755 + mapping.left(mapping.length() - QString::number(copy).length() - 1);
5756 qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;5756 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
5757 addAssetToWorldError(filenameFromPath(filePath), errorInfo);5757 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
5758 }5758 }
5759 request->deleteLater();5759 request->deleteLater();
@@ -5767,8 +5767,8 @@ void Application::addAssetToWorldUpload(QString filePath, QString mapping) { · 7 unmodified lines
5767 auto upload = DependencyManager::get<AssetClient>()->createUpload(filePath);5767 auto upload = DependencyManager::get<AssetClient>()->createUpload(filePath);
5768 QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {5768 QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
5769 if (upload->getError() != AssetUpload::NoError) {5769 if (upload->getError() != AssetUpload::NoError) {
5770 QString errorInfo = "Could not upload asset to the Asset Server.";5770 QString errorInfo = "Could not upload model to the Asset Server.";
5771 qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;5771 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
5772 addAssetToWorldError(filenameFromPath(filePath), errorInfo);5772 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
5773 } else {5773 } else {
5774 addAssetToWorldSetMapping(filePath, mapping, hash);5774 addAssetToWorldSetMapping(filePath, mapping, hash);
@@ -5793,7 +5793,7 @@ void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, Q · 18 unmodified lines
5793 connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable {5793 connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable {
5794 if (request->getError() != SetMappingRequest::NoError) {5794 if (request->getError() != SetMappingRequest::NoError) {
5795 QString errorInfo = "Could not set asset mapping.";5795 QString errorInfo = "Could not set asset mapping.";
5796 qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;5796 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
5797 addAssetToWorldError(filenameFromPath(filePath), errorInfo);5797 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
5798 } else {5798 } else {
5799 addAssetToWorldAddEntity(filePath, mapping);5799 addAssetToWorldAddEntity(filePath, mapping);
@@ -5820,8 +5820,8 @@ void Application::addAssetToWorldAddEntity(QString filePath, QString mapping) { · 20 unmodified lines
5820 // on. But FBX dimensions may be in cm, so we monitor for the dimension change and rescale again if warranted.5820 // on. But FBX dimensions may be in cm, so we monitor for the dimension change and rescale again if warranted.
5821 5821
5822 if (entityID == QUuid()) {5822 if (entityID == QUuid()) {
5823 QString errorInfo = "Could not add asset " + mapping + " to world.";5823 QString errorInfo = "Could not add model " + mapping + " to world.";
5824 qWarning(interfaceapp) << "Could not add asset to world: " + errorInfo;5824 qWarning(interfaceapp) << "Could not add model to world: " + errorInfo;
5825 addAssetToWorldError(filenameFromPath(filePath), errorInfo);5825 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
5826 } else {5826 } else {
5827 // Monitor when asset is rendered in world so that can resize if necessary.5827 // Monitor when asset is rendered in world so that can resize if necessary.
@@ -5864,7 +5864,7 @@ void Application::addAssetToWorldCheckModelSize() { · 36 unmodified lines
5864 auto scale = std::min(MAXIMUM_DIMENSION / dimensions.x, std::min(MAXIMUM_DIMENSION / dimensions.y,5864 auto scale = std::min(MAXIMUM_DIMENSION / dimensions.x, std::min(MAXIMUM_DIMENSION / dimensions.y,
5865 MAXIMUM_DIMENSION / dimensions.z));5865 MAXIMUM_DIMENSION / dimensions.z));
5866 dimensions *= scale;5866 dimensions *= scale;
5867 qInfo(interfaceapp) << "Asset" << name << "auto-resized from" << previousDimensions << " to " << dimensions;5867 qInfo(interfaceapp) << "Model" << name << "auto-resized from" << previousDimensions << " to " << dimensions;
5868 doResize = true;5868 doResize = true;
5869 5869
5870 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity; advance to next.5870 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity; advance to next.
@@ -5879,7 +5879,7 @@ void Application::addAssetToWorldCheckModelSize() { · 8 unmodified lines
5879 // Rescale all dimensions.5879 // Rescale all dimensions.
5880 const glm::vec3 UNIT_DIMENSIONS = glm::vec3(1.0f, 1.0f, 1.0f);5880 const glm::vec3 UNIT_DIMENSIONS = glm::vec3(1.0f, 1.0f, 1.0f);
5881 dimensions = UNIT_DIMENSIONS;5881 dimensions = UNIT_DIMENSIONS;
5882 qInfo(interfaceapp) << "Asset" << name << "auto-resize timed out; resized to " << dimensions;5882 qInfo(interfaceapp) << "Model" << name << "auto-resize timed out; resized to " << dimensions;
5883 doResize = true;5883 doResize = true;
5884 5884
5885 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity; advance to next.5885 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity; advance to next.
@@ -5932,7 +5932,7 @@ void Application::addAssetToWorldInfo(QString modelName, QString infoText) { · 46 unmodified lines
5932 if (!_addAssetToWorldErrorTimer.isActive()) {5932 if (!_addAssetToWorldErrorTimer.isActive()) {
5933 if (!_addAssetToWorldMessageBox) {5933 if (!_addAssetToWorldMessageBox) {
5934 _addAssetToWorldMessageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION,5934 _addAssetToWorldMessageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION,
5935 "Downloading Asset", "", QMessageBox::NoButton, QMessageBox::NoButton);5935 "Downloading Model", "", QMessageBox::NoButton, QMessageBox::NoButton);
5936 connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));5936 connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));
5937 }5937 }
5938 5938
@@ -5997,7 +5997,6 @@ void Application::addAssetToWorldInfoTimeout() { · 58 unmodified lines
5997 }5997 }
5998}5998}
5999 5999
6000
6001void Application::addAssetToWorldError(QString modelName, QString errorText) {6000void Application::addAssetToWorldError(QString modelName, QString errorText) {
6002 // Displays the most recent error message for a few seconds.6001 // Displays the most recent error message for a few seconds.
6003 6002
@@ -6016,7 +6015,7 @@ void Application::addAssetToWorldError(QString modelName, QString errorText) { · 12 unmodified lines
6016 6015
6017 if (!_addAssetToWorldMessageBox) {6016 if (!_addAssetToWorldMessageBox) {
6018 _addAssetToWorldMessageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION,6017 _addAssetToWorldMessageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION,
6019 "Downloading Asset", "", QMessageBox::NoButton, QMessageBox::NoButton);6018 "Downloading Model", "", QMessageBox::NoButton, QMessageBox::NoButton);
6020 connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));6019 connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));
6021 }6020 }
6022 6021