GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes. - Return U32String from TransMan getTranslation() - Change tooltips to be U32Strings - Remove temporary code of convertToU32String - U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc) - U32 for music plugins - U32 for OSD messages - Add some helper functions to ustr.cpp - Change default tooltips from nullptr & 0 -> "" - Some runtime exceptions may occur when changing languages due to incorrect String::Format
This commit is contained in:
parent
aa33fc2354
commit
f800ca4ada
91 changed files with 836 additions and 714 deletions
|
@ -40,40 +40,40 @@ void DownloadFileHandler::handle(Client &client) {
|
|||
|
||||
// check that <path> is not an absolute root
|
||||
if (path == "" || path == "/") {
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, HandlerUtils::toUtf8(_("Invalid path!")));
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, Common::convertFromU32String(_("Invalid path!")));
|
||||
return;
|
||||
}
|
||||
|
||||
// check that <path> contains no '../'
|
||||
if (HandlerUtils::hasForbiddenCombinations(path)) {
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, HandlerUtils::toUtf8(_("Invalid path!")));
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, Common::convertFromU32String(_("Invalid path!")));
|
||||
return;
|
||||
}
|
||||
|
||||
// transform virtual path to actual file system one
|
||||
Common::String prefixToRemove = "", prefixToAdd = "";
|
||||
if (!transformPath(path, prefixToRemove, prefixToAdd, false) || path.empty()) {
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, HandlerUtils::toUtf8(_("Invalid path!")));
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, Common::convertFromU32String(_("Invalid path!")));
|
||||
return;
|
||||
}
|
||||
|
||||
// check that <path> exists, is directory and isn't forbidden
|
||||
AbstractFSNode *node = g_system->getFilesystemFactory()->makeFileNodePath(path);
|
||||
if (!HandlerUtils::permittedPath(node->getPath())) {
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, HandlerUtils::toUtf8(_("Invalid path!")));
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, Common::convertFromU32String(_("Invalid path!")));
|
||||
return;
|
||||
}
|
||||
if (!node->exists()) {
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, HandlerUtils::toUtf8(_("The file doesn't exist!")));
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, Common::convertFromU32String(_("The file doesn't exist!")));
|
||||
return;
|
||||
}
|
||||
if (node->isDirectory()) {
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, HandlerUtils::toUtf8(_("Can't download a directory!")));
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, Common::convertFromU32String(_("Can't download a directory!")));
|
||||
return;
|
||||
}
|
||||
Common::SeekableReadStream *stream = node->createReadStream();
|
||||
if (stream == nullptr) {
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, HandlerUtils::toUtf8(_("Failed to read the file!")));
|
||||
HandlerUtils::setFilesManagerErrorMessageHandler(client, Common::convertFromU32String(_("Failed to read the file!")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue