Showing the changes to interface/src/Application.cpp (1 of 98 files). Show all
Unified · Split
| @@ -981,6 +981,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 980 unmodified lines | |||
| 981 | qInstallMessageHandler(messageHandler); | 981 | qInstallMessageHandler(messageHandler); |
| 982 | 982 | ||
| 983 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf"); | 983 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf"); |
| 984 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/fontawesome-webfont.ttf"); | ||
| 985 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/hifi-glyphs.ttf"); | ||
| 986 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/AnonymousPro-Regular.ttf"); | ||
| 987 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/FiraSans-Regular.ttf"); | ||
| 988 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/FiraSans-SemiBold.ttf"); | ||
| 989 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Light.ttf"); | ||
| 990 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Regular.ttf"); | ||
| 991 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Bold.ttf"); | ||
| 992 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-SemiBold.ttf"); | ||
| 984 | _window->setWindowTitle("High Fidelity Interface"); | 993 | _window->setWindowTitle("High Fidelity Interface"); |
| 985 | 994 | ||
| 986 | Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us | 995 | Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us |
| @@ -6637,17 +6646,17 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo · 5650 unmodified lines | |||
| 6637 | 6646 | ||
| 6638 | addAssetToWorldInfo(filename, "Adding " + mapping.mid(1) + " to the Asset Server."); | 6647 | addAssetToWorldInfo(filename, "Adding " + mapping.mid(1) + " to the Asset Server."); |
| 6639 | 6648 | ||
| 6640 | addAssetToWorldWithNewMapping(path, mapping, 0); | 6649 | addAssetToWorldWithNewMapping(path, mapping, 0, isZip, isBlocks); |
| 6641 | } | 6650 | } |
| 6642 | 6651 | ||
| 6643 | void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) { | 6652 | void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy, bool isZip, bool isBlocks) { |
| 6644 | auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping); | 6653 | auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping); |
| 6645 | 6654 | ||
| 6646 | QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable { | 6655 | QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable { |
| 6647 | const int MAX_COPY_COUNT = 100; // Limit number of duplicate assets; recursion guard. | 6656 | const int MAX_COPY_COUNT = 100; // Limit number of duplicate assets; recursion guard. |
| 6648 | auto result = request->getError(); | 6657 | auto result = request->getError(); |
| 6649 | if (result == GetMappingRequest::NotFound) { | 6658 | if (result == GetMappingRequest::NotFound) { |
| 6650 | addAssetToWorldUpload(filePath, mapping); | 6659 | addAssetToWorldUpload(filePath, mapping, isZip, isBlocks); |
| 6651 | } else if (result != GetMappingRequest::NoError) { | 6660 | } else if (result != GetMappingRequest::NoError) { |
| 6652 | QString errorInfo = "Could not map asset name: " | 6661 | QString errorInfo = "Could not map asset name: " |
| 6653 | + mapping.left(mapping.length() - QString::number(copy).length() - 1); | 6662 | + mapping.left(mapping.length() - QString::number(copy).length() - 1); |
| @@ -6659,7 +6668,7 @@ void Application::addAssetToWorldWithNewMapping(QString filePath, QString mappin · 5 unmodified lines | |||
| 6659 | } | 6668 | } |
| 6660 | copy++; | 6669 | copy++; |
| 6661 | mapping = mapping.insert(mapping.lastIndexOf("."), "-" + QString::number(copy)); | 6670 | mapping = mapping.insert(mapping.lastIndexOf("."), "-" + QString::number(copy)); |
| 6662 | addAssetToWorldWithNewMapping(filePath, mapping, copy); | 6671 | addAssetToWorldWithNewMapping(filePath, mapping, copy, isZip, isBlocks); |
| 6663 | } else { | 6672 | } else { |
| 6664 | QString errorInfo = "Too many copies of asset name: " | 6673 | QString errorInfo = "Too many copies of asset name: " |
| 6665 | + mapping.left(mapping.length() - QString::number(copy).length() - 1); | 6674 | + mapping.left(mapping.length() - QString::number(copy).length() - 1); |
| @@ -6672,7 +6681,7 @@ void Application::addAssetToWorldWithNewMapping(QString filePath, QString mappin · 6 unmodified lines | |||
| 6672 | request->start(); | 6681 | request->start(); |
| 6673 | } | 6682 | } |
| 6674 | 6683 | ||
| 6675 | void Application::addAssetToWorldUpload(QString filePath, QString mapping) { | 6684 | void Application::addAssetToWorldUpload(QString filePath, QString mapping, bool isZip, bool isBlocks) { |
| 6676 | qInfo(interfaceapp) << "Uploading" << filePath << "to Asset Server as" << mapping; | 6685 | qInfo(interfaceapp) << "Uploading" << filePath << "to Asset Server as" << mapping; |
| 6677 | auto upload = DependencyManager::get<AssetClient>()->createUpload(filePath); | 6686 | auto upload = DependencyManager::get<AssetClient>()->createUpload(filePath); |
| 6678 | QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { | 6687 | QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { |
| @@ -6681,7 +6690,7 @@ void Application::addAssetToWorldUpload(QString filePath, QString mapping) { · 2 unmodified lines | |||
| 6681 | qWarning(interfaceapp) << "Error downloading model: " + errorInfo; | 6690 | qWarning(interfaceapp) << "Error downloading model: " + errorInfo; |
| 6682 | addAssetToWorldError(filenameFromPath(filePath), errorInfo); | 6691 | addAssetToWorldError(filenameFromPath(filePath), errorInfo); |
| 6683 | } else { | 6692 | } else { |
| 6684 | addAssetToWorldSetMapping(filePath, mapping, hash); | 6693 | addAssetToWorldSetMapping(filePath, mapping, hash, isZip, isBlocks); |
| 6685 | } | 6694 | } |
| 6686 | 6695 | ||
| 6687 | // Remove temporary directory created by Clara.io market place download. | 6696 | // Remove temporary directory created by Clara.io market place download. |
| @@ -6698,7 +6707,7 @@ void Application::addAssetToWorldUpload(QString filePath, QString mapping) { · 10 unmodified lines | |||
| 6698 | upload->start(); | 6707 | upload->start(); |
| 6699 | } | 6708 | } |
| 6700 | 6709 | ||
| 6701 | void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash) { | 6710 | void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash, bool isZip, bool isBlocks) { |
| 6702 | auto request = DependencyManager::get<AssetClient>()->createSetMappingRequest(mapping, hash); | 6711 | auto request = DependencyManager::get<AssetClient>()->createSetMappingRequest(mapping, hash); |
| 6703 | connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable { | 6712 | connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable { |
| 6704 | if (request->getError() != SetMappingRequest::NoError) { | 6713 | if (request->getError() != SetMappingRequest::NoError) { |
| @@ -6706,9 +6715,10 @@ void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, Q · 1 unmodified line | |||
| 6706 | qWarning(interfaceapp) << "Error downloading model: " + errorInfo; | 6715 | qWarning(interfaceapp) << "Error downloading model: " + errorInfo; |
| 6707 | addAssetToWorldError(filenameFromPath(filePath), errorInfo); | 6716 | addAssetToWorldError(filenameFromPath(filePath), errorInfo); |
| 6708 | } else { | 6717 | } else { |
| 6709 | // to prevent files that aren't models from being loaded into world automatically | 6718 | // to prevent files that aren't models or texture files from being loaded into world automatically |
| 6710 | if (filePath.toLower().endsWith(OBJ_EXTENSION) || filePath.toLower().endsWith(FBX_EXTENSION) || | 6719 | if ((filePath.toLower().endsWith(OBJ_EXTENSION) || filePath.toLower().endsWith(FBX_EXTENSION)) || |
| 6711 | filePath.toLower().endsWith(JPG_EXTENSION) || filePath.toLower().endsWith(PNG_EXTENSION)) { | 6720 | ((filePath.toLower().endsWith(JPG_EXTENSION) || filePath.toLower().endsWith(PNG_EXTENSION)) && |
| 6721 | ((!isBlocks) && (!isZip)))) { | ||
| 6712 | addAssetToWorldAddEntity(filePath, mapping); | 6722 | addAssetToWorldAddEntity(filePath, mapping); |
| 6713 | } else { | 6723 | } else { |
| 6714 | qCDebug(interfaceapp) << "Zipped contents are not supported entity files"; | 6724 | qCDebug(interfaceapp) << "Zipped contents are not supported entity files"; |