Minor Terminal Emulator improvements.

Minor fix in FunctionString.
This commit is contained in:
Martín Lucas Golini
2022-08-13 04:30:24 -03:00
parent cefb0e0a7c
commit 335b472002
11 changed files with 167 additions and 119 deletions

View File

@@ -443,7 +443,8 @@ void App::onFileDropped( String file ) {
if ( node && node->isType( UI_TYPE_CODEEDITOR ) ) {
codeEditor = node->asType<UICodeEditor>();
if ( ( codeEditor->getDocument().isLoading() || !codeEditor->getDocument().isEmpty() ) &&
!Image::isImageExtension( file ) ) {
!Image::isImageExtension( file ) &&
FileSystem::fileExtension( file.toUtf8() ) != "svg" ) {
auto d = mSplitter->createCodeEditorInTabWidget(
mSplitter->tabWidgetFromEditor( codeEditor ) );
codeEditor = d.second;
@@ -2091,7 +2092,8 @@ void App::createDocAlert( UICodeEditor* editor ) {
void App::loadFileFromPath(
const std::string& path, bool inNewTab, UICodeEditor* codeEditor,
std::function<void( UICodeEditor* codeEditor, const std::string& path )> onLoaded ) {
if ( Image::isImageExtension( path ) && Image::isImage( path ) ) {
if ( Image::isImageExtension( path ) && Image::isImage( path ) &&
FileSystem::fileExtension( path ) != "svg" ) {
UIImage* imageView = mImageLayout->findByType<UIImage>( UI_TYPE_IMAGE );
UILoader* loaderView = mImageLayout->findByType<UILoader>( UI_TYPE_LOADER );
if ( imageView ) {
@@ -3629,75 +3631,73 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
iconTheme->add( UIGlyphIcon::New( icon.first, iconFont, icon.second ) );
if ( mimeIconFont && mimeIconFont->loaded() ) {
std::unordered_map<std::string, Uint32> mimeIcons = {
{ "filetype-lua", 61826 },
{ "filetype-c", 61718 },
{ "filetype-h", 61792 },
{ "filetype-cs", 61720 },
{ "filetype-cpp", 61719 },
{ "filetype-css", 61743 },
{ "filetype-conf", 61781 },
{ "filetype-cfg", 61781 },
{ "filetype-desktop", 61781 },
{ "filetype-service", 61781 },
{ "filetype-env", 61781 },
{ "filetype-properties", 61781 },
{ "filetype-ini", 61781 },
{ "filetype-dart", 61744 },
{ "filetype-diff", 61752 },
{ "filetype-zip", 61775 },
{ "filetype-go", 61789 },
{ "filetype-htm", 61799 },
{ "filetype-html", 61799 },
{ "filetype-java", 61809 },
{ "filetype-js", 61810 },
{ "filetype-json", 61811 },
{ "filetype-kt", 61814 },
{ "filetype-md", 61829 },
{ "filetype-perl", 61853 },
{ "filetype-php", 61855 },
{ "filetype-py", 61863 },
{ "filetype-pyc", 61863 },
{ "filetype-pyd", 61863 },
{ "filetype-swift", 61906 },
{ "filetype-rb", 61880 },
{ "filetype-rs", 61881 },
{ "filetype-ts", 61923 },
{ "filetype-yaml", 61945 },
{ "filetype-yml", 61945 },
{ "filetype-jpg", 61801 },
{ "filetype-png", 61801 },
{ "filetype-jpeg", 61801 },
{ "filetype-bmp", 61801 },
{ "filetype-tga", 61801 },
{ "filetype-sh", 61911 },
{ "filetype-bash", 61911 },
{ "filetype-fish", 61911 },
{ "filetype-scala", 61882 },
{ "filetype-r", 61866 },
{ "filetype-rake", 61880 },
{ "filetype-rss", 61879 },
{ "filetype-sql", 61746 },
{ "filetype-elm", 61763 },
{ "filetype-ex", 61971 },
{ "filetype-exs", 61971 },
{ "filetype-awk", 61971 },
{ "filetype-nim", 61734 },
{ "filetype-xml", 61769 },
{ "filetype-dockerfile", 61758 },
{ "filetype-ruby", 61880 },
{ "filetype-scala", 61882 },
{ "filetype-perl", 61853 },
{ "file", 61766 },
{ "file-symlink", 61774 },
{ "folder", 0xF23B },
{ "folder-open", 0xF23C },
{ "tree-expanded", 0xF11E },
{ "tree-contracted", 0xF120 },
{ "github", 0xF184 },
{ "package", 61846 },
{ "tab-close", 61944 }
};
std::unordered_map<std::string, Uint32> mimeIcons = { { "filetype-lua", 61826 },
{ "filetype-c", 61718 },
{ "filetype-h", 61792 },
{ "filetype-cs", 61720 },
{ "filetype-cpp", 61719 },
{ "filetype-css", 61743 },
{ "filetype-conf", 61781 },
{ "filetype-cfg", 61781 },
{ "filetype-desktop", 61781 },
{ "filetype-service", 61781 },
{ "filetype-env", 61781 },
{ "filetype-properties", 61781 },
{ "filetype-ini", 61781 },
{ "filetype-dart", 61744 },
{ "filetype-diff", 61752 },
{ "filetype-zip", 61775 },
{ "filetype-go", 61789 },
{ "filetype-htm", 61799 },
{ "filetype-html", 61799 },
{ "filetype-java", 61809 },
{ "filetype-js", 61810 },
{ "filetype-json", 61811 },
{ "filetype-kt", 61814 },
{ "filetype-md", 61829 },
{ "filetype-perl", 61853 },
{ "filetype-php", 61855 },
{ "filetype-py", 61863 },
{ "filetype-pyc", 61863 },
{ "filetype-pyd", 61863 },
{ "filetype-swift", 61906 },
{ "filetype-rb", 61880 },
{ "filetype-rs", 61881 },
{ "filetype-ts", 61923 },
{ "filetype-yaml", 61945 },
{ "filetype-yml", 61945 },
{ "filetype-jpg", 61801 },
{ "filetype-png", 61801 },
{ "filetype-jpeg", 61801 },
{ "filetype-bmp", 61801 },
{ "filetype-tga", 61801 },
{ "filetype-sh", 61911 },
{ "filetype-bash", 61911 },
{ "filetype-fish", 61911 },
{ "filetype-scala", 61882 },
{ "filetype-r", 61866 },
{ "filetype-rake", 61880 },
{ "filetype-rss", 61879 },
{ "filetype-sql", 61746 },
{ "filetype-elm", 61763 },
{ "filetype-ex", 61971 },
{ "filetype-exs", 61971 },
{ "filetype-awk", 61971 },
{ "filetype-nim", 61734 },
{ "filetype-xml", 61769 },
{ "filetype-dockerfile", 61758 },
{ "filetype-ruby", 61880 },
{ "filetype-scala", 61882 },
{ "filetype-perl", 61853 },
{ "file", 61766 },
{ "file-symlink", 61774 },
{ "folder", 0xF23B },
{ "folder-open", 0xF23C },
{ "tree-expanded", 0xF11E },
{ "tree-contracted", 0xF120 },
{ "github", 0xF184 },
{ "package", 61846 },
{ "tab-close", 61944 } };
for ( const auto& icon : mimeIcons )
iconTheme->add( UIGlyphIcon::New( icon.first, mimeIconFont, icon.second ) );
}