mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-09-22 13:01:05 +03:00
Add a detached Git Commit History tab with a traditional table layout, persistent column widths, commit focusing, and a splitter-based commit details pane. Register the git-show-history command and expose “Show in Git History” from commit details and history context menus. Add History and Git Commit tab icons, localized titles, appropriate tooltips, and ref-aware tab naming. Share the commit-details layout and behavior between standalone commit tabs and detached History views. Move view creation, widget binding, state management, controls, and asynchronous changed-file loading into CommitDetailsState. Display complete commit metadata and messages, GitHub links, copyable commit SHAs, colored changed-file statistics, and multi-file diffs with global expand/collapse and unified/split controls. Improve detached-history lifecycle behavior, selection and focus handling, stale-request protection, tooltip formatting, and column recalculation. Restore “Load older commits” by preserving pagination-node semantics while asynchronous loading is in progress. Fix expandable History rows so merge subjects and metadata render correctly without regressing generic UITreeView cells. Add recursive commit lookup for focusing nested history entries. Add deferred tooltip-created notifications and configure History tooltips only after their widgets exist. Preserve tokenizer-applied UITextView color ranges during layout recalculation when custom styling is enabled, preventing changed-file statistics from losing their colors after splitter resizing. Add the required Codicons and translations, expose UIWidget pseudo-class queries, reuse cached tree-expander drawable sources, and use SmallVector for nested stylesheet property resolution.
355 lines
11 KiB
C++
355 lines
11 KiB
C++
#include <eepp/ui/iconmanager.hpp>
|
|
#include <eepp/ui/uiicontheme.hpp>
|
|
#include <eepp/ui/uiiconthememanager.hpp>
|
|
|
|
namespace EE { namespace UI {
|
|
|
|
using IconPair = std::pair<const char*, Uint32>;
|
|
|
|
ResourcePtr<UIIconTheme> IconManager::init( const std::string& iconThemeName,
|
|
FontTrueType* remixIconFont, FontTrueType* noniconFont,
|
|
FontTrueType* codIconFont ) {
|
|
|
|
auto iconTheme = UIIconTheme::New( iconThemeName );
|
|
|
|
if ( remixIconFont && remixIconFont->loaded() ) {
|
|
remixIconFont->setIsEmojiFont( true );
|
|
|
|
for ( const auto& icon : std::initializer_list<IconPair>{
|
|
|
|
{ "document-new", 0xecc3 },
|
|
{ "document-open", 0xed70 },
|
|
{ "document-save", 0xf0b3 },
|
|
{ "document-save-as", 0xf0b3 },
|
|
{ "document-close", 0xeb99 },
|
|
{ "quit", 0xeb97 },
|
|
{ "undo", 0xea58 },
|
|
{ "redo", 0xea5a },
|
|
{ "cut", 0xf0c1 },
|
|
{ "copy", 0xecd5 },
|
|
{ "paste", 0xeb91 },
|
|
{ "edit", 0xec86 },
|
|
{ "split-horizontal", 0xf17a },
|
|
{ "split-vertical", 0xf17b },
|
|
{ "find-replace", 0xed2b },
|
|
{ "folder-add", 0xed5a },
|
|
{ "file-add", 0xecc9 },
|
|
{ "file-copy", 0xecd3 },
|
|
{ "file-code", 0xecd1 },
|
|
{ "file-edit", 0xecdb },
|
|
{ "font-size", 0xed8d },
|
|
{ "delete-bin", 0xec1e },
|
|
{ "delete-text", 0xec1e },
|
|
{ "zoom-in", 0xf2db },
|
|
{ "zoom-out", 0xf2dd },
|
|
{ "zoom-reset", 0xeb47 },
|
|
{ "fullscreen", 0xed9c },
|
|
{ "keybindings", 0xee75 },
|
|
{ "search", 0xf0d1 },
|
|
{ "go-up", 0xea78 },
|
|
{ "ok", 0xeb7a },
|
|
{ "cancel", 0xeb98 },
|
|
{ "color-picker", 0xf13d },
|
|
{ "pixel-density", 0xed8c },
|
|
{ "go-to-line", 0xf1f8 },
|
|
{ "table-view", 0xf1de },
|
|
{ "list-view", 0xecf1 },
|
|
{ "menu-unfold", 0xef40 },
|
|
{ "menu-fold", 0xef3d },
|
|
{ "download-cloud", 0xec58 },
|
|
{ "layout-left", 0xee94 },
|
|
{ "layout-right", 0xee9b },
|
|
{ "color-scheme", 0xebd4 },
|
|
{ "global-settings", 0xedcf },
|
|
{ "folder-user", 0xed84 },
|
|
{ "help", 0xf045 },
|
|
{ "terminal", 0xf1f6 },
|
|
{ "earth", 0xec7a },
|
|
{ "arrow-down", 0xea4c },
|
|
{ "arrow-up", 0xea76 },
|
|
{ "arrow-down-s", 0xea4e },
|
|
{ "arrow-up-s", 0xea78 },
|
|
{ "arrow-right-s", 0xea6e },
|
|
{ "arrow-left-s", 0xea64 },
|
|
{ "match-case", 0xed8d },
|
|
{ "palette", 0xefc5 },
|
|
{ "file-code", 0xecd1 },
|
|
{ "cursor-pointer", 0xec09 },
|
|
{ "drive", 0xedf8 },
|
|
{ "refresh", 0xf064 },
|
|
{ "hearth-pulse", 0xee10 },
|
|
{ "add", 0xea12 },
|
|
{ "hammer", 0xedee },
|
|
{ "eraser", 0xec9e },
|
|
{ "file-search", 0xed05 },
|
|
{ "window", 0xf2c4 },
|
|
{ "file-lock-fill", 0xecf2 },
|
|
{ "filetype-svg", 0xF3C5 },
|
|
{ "filetype-png", 0xF3C5 },
|
|
{ "filetype-jpg", 0xF3C5 },
|
|
{ "filetype-jpeg", 0xF3C5 },
|
|
{ "filetype-tga", 0xF3C5 },
|
|
{ "filetype-dds", 0xF3C5 },
|
|
{ "filetype-qoi", 0xF3C5 },
|
|
{ "filetype-bmp", 0xF3C5 },
|
|
{ "filetype-gif", 0xF3C5 },
|
|
{ "filetype-psd", 0xF3C5 },
|
|
{ "filetype-hdr", 0xF3C5 },
|
|
{ "filetype-pic", 0xF3C5 },
|
|
{ "filetype-pvr", 0xF3C5 },
|
|
{ "filetype-pkm", 0xF3C5 },
|
|
{ "filetype-webp", 0xF3C5 },
|
|
{ "filetype-mp3", 0xEF83 },
|
|
{ "filetype-ogg", 0xEF83 },
|
|
{ "filetype-wav", 0xEF83 },
|
|
{ "filetype-flac", 0xEF83 },
|
|
{ "settings", 0xF0E3 },
|
|
{ "stop", 0xF1A0 },
|
|
{ "text-wrap", 0xF200 },
|
|
{ "play-filled", 0xF00A },
|
|
{ "code-ai", 0xF56F },
|
|
{ "robot-2", 0xF3D9 },
|
|
{ "chat-history", 0xEB61 },
|
|
{ "chat-private", 0xEB69 },
|
|
{ "loader-2", 0xEEC2 },
|
|
{ "more-fill", 0xEF78 },
|
|
{ "volume-up-fill", 0xF2A1 },
|
|
{ "volume-down-fill", 0xF29B },
|
|
{ "volume-mute-fill", 0xF29D },
|
|
{ "pause-fill", 0xEFD7 },
|
|
{ "spy-line", 0xF17F },
|
|
{ "input-field", 0xF47A },
|
|
{ "sun", 0xF1BC },
|
|
{ "moon", 0xEF72 },
|
|
{ "calendar-2", 0xEB21 },
|
|
} ) {
|
|
iconTheme->add( UIGlyphIcon::New( icon.first, remixIconFont, icon.second ) );
|
|
}
|
|
}
|
|
|
|
if ( noniconFont && noniconFont->loaded() ) {
|
|
noniconFont->setIsEmojiFont( true );
|
|
|
|
for ( const auto& icon : std::initializer_list<IconPair>
|
|
|
|
{ { "filetype-lua", 61826 },
|
|
{ "filetype-c", 61718 },
|
|
{ "filetype-h", 61792 },
|
|
{ "filetype-cs", 61720 },
|
|
{ "filetype-cpp", 61719 },
|
|
{ "filetype-hpp", 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-jsx", 0xf1ab },
|
|
{ "filetype-tsx", 0xf1ab },
|
|
{ "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-scala", 61882 },
|
|
{ "filetype-sc", 61882 },
|
|
{ "filetype-perl", 61853 },
|
|
{ "filetype-vue", 0xf1f4 },
|
|
{ "file", 61766 },
|
|
{ "file-symlink", 61774 },
|
|
{ "folder", 0xF23B },
|
|
{ "folder-open", 0xF23C },
|
|
{ "tree-expanded", 0xF11E },
|
|
{ "tree-contracted", 0xF120 },
|
|
{ "github", 0xF184 },
|
|
{ "package", 61846 },
|
|
{ "tab-close", 61944 } } ) {
|
|
iconTheme->add( UIGlyphIcon::New( icon.first, noniconFont, icon.second ) );
|
|
}
|
|
}
|
|
|
|
if ( codIconFont && codIconFont->loaded() ) {
|
|
codIconFont->setIsEmojiFont( true );
|
|
|
|
for ( const auto& icon : std::initializer_list<IconPair>{
|
|
|
|
{ "symbol-text", 0xea93 },
|
|
{ "symbol-method", 0xea8c },
|
|
{ "symbol-function", 0xea8c },
|
|
{ "symbol-constructor", 0xea8c },
|
|
{ "symbol-field", 0xeb5f },
|
|
{ "symbol-variable", 0xea88 },
|
|
{ "symbol-class", 0xeb5b },
|
|
{ "symbol-interface", 0xeb61 },
|
|
{ "symbol-module", 0xea8b },
|
|
{ "symbol-property", 0xeb65 },
|
|
{ "symbol-unit", 0xea96 },
|
|
{ "symbol-value", 0xea95 },
|
|
{ "symbol-enum", 0xea95 },
|
|
{ "symbol-keyword", 0xeb62 },
|
|
{ "symbol-snippet", 0xeb66 },
|
|
{ "symbol-color", 0xeb5c },
|
|
{ "symbol-file", 0xeb60 },
|
|
{ "symbol-reference", 0xea94 },
|
|
{ "symbol-folder", 0xea83 },
|
|
{ "symbol-enum-member", 0xeb5e },
|
|
{ "symbol-constant", 0xeb5d },
|
|
{ "symbol-struct", 0xea91 },
|
|
{ "symbol-event", 0xea86 },
|
|
{ "symbol-operator", 0xeb64 },
|
|
{ "symbol-type-parameter", 0xea92 },
|
|
{ "expand-all", 0xeb95 },
|
|
{ "symbol-namespace", 0xea8b },
|
|
{ "symbol-package", 0xea8b },
|
|
{ "symbol-string", 0xeb8d },
|
|
{ "symbol-number", 0xea90 },
|
|
{ "symbol-boolean", 0xea8f },
|
|
{ "symbol-array", 0xea8a },
|
|
{ "symbol-object", 0xea8b },
|
|
{ "symbol-key", 0xea93 },
|
|
{ "symbol-null", 0xea8f },
|
|
{ "collapse-all", 0xeac5 },
|
|
{ "split-horizontal", 0xeb56 },
|
|
{ "layout", 0xebeb },
|
|
{ "github", 0xea84 },
|
|
{ "unfold", 0xeb73 },
|
|
{ "chevron-down", 0xeab4 },
|
|
{ "chevron-right", 0xeab6 },
|
|
{ "lightbulb-autofix", 0xeb13 },
|
|
{ "layout-sidebar-left-off", 0xec02 },
|
|
{ "layout-sidebar-left", 0xebf3 },
|
|
{ "warning", 0xea6c },
|
|
{ "error", 0xea87 },
|
|
{ "search-fuzzy", 0xec0d },
|
|
{ "source-control", 0xea68 },
|
|
{ "history", 0xea82 },
|
|
{ "git-commit", 0xeafc },
|
|
{ "repo", 0xea62 },
|
|
{ "repo-pull", 0xeb40 },
|
|
{ "repo-push", 0xeb41 },
|
|
{ "repo-forked", 0xea63 },
|
|
{ "repo-fetch", 0xec1d },
|
|
{ "git-fetch", 0xf101 },
|
|
{ "git-commit", 0xeafc },
|
|
{ "git-stash", 0xec26 },
|
|
{ "git-stash-apply", 0xec27 },
|
|
{ "git-stash-pop", 0xec28 },
|
|
{ "git-merge", 0xeafe },
|
|
{ "git-branch-staged-changes", 0xec6d },
|
|
{ "diff-single", 0xec22 },
|
|
{ "remove", 0xeb3b },
|
|
{ "tag", 0xea66 },
|
|
{ "globe", 0xeb01 },
|
|
{ "circle-filled", 0xea71 },
|
|
{ "circle", 0xeabc },
|
|
{ "diff-multiple", 0xec23 },
|
|
{ "extensions", 0xeae6 },
|
|
{ "window-opt", 0xeb7f },
|
|
{ "tools", 0xeb6d },
|
|
{ "play", 0xeb2c },
|
|
{ "output", 0xeb9d },
|
|
{ "fold", 0xeaf5 },
|
|
{ "bug", 0xeaaf },
|
|
{ "debug", 0xead8 },
|
|
{ "debug-alt", 0xeb91 },
|
|
{ "debug-continue", 0xeacf },
|
|
{ "debug-disconnect", 0xead0 },
|
|
{ "debug-pause", 0xead1 },
|
|
{ "debug-restart", 0xead2 },
|
|
{ "debug-start", 0xead3 },
|
|
{ "debug-step-into", 0xead4 },
|
|
{ "debug-step-out", 0xead5 },
|
|
{ "debug-step-over", 0xead6 },
|
|
{ "debug-stop", 0xead7 },
|
|
{ "chrome-close", 0xeab8 },
|
|
{ "diff-added", 0xeadc },
|
|
{ "diff-removed", 0xeadf },
|
|
{ "eye", 0xea70 },
|
|
{ "eye-closed", 0xeae7 },
|
|
{ "settings-alt", 0xeb52 },
|
|
{ "attach", 0xec34 },
|
|
{ "chat-sparkle", 0xec4f },
|
|
{ "inspect", 0xebd1 },
|
|
{ "link", 0xeb15 },
|
|
{ "agent", 0xec67 },
|
|
{ "diff", 0xeae1 },
|
|
{ "arrow-both", 0xea99 },
|
|
{ "arrow-left", 0xea9b },
|
|
{ "arrow-right", 0xea9c },
|
|
{ "arrow-circle-left", 0xebfd },
|
|
{ "arrow-circle-right", 0xebfe },
|
|
{ "discard", 0xeae2 },
|
|
|
|
} ) {
|
|
iconTheme->add( UIGlyphIcon::New( icon.first, codIconFont, icon.second ) );
|
|
}
|
|
}
|
|
|
|
iconTheme->add( UISVGIcon::New(
|
|
"ecode",
|
|
"<svg width='256' height='256' version='1.1' viewBox='0 0 12.7 12.7' "
|
|
"xmlns='http://www.w3.org/2000/svg'><g transform='matrix(.80588 0 0 .80588 1.3641 "
|
|
"1.2538)' fill='none' stroke='#fff' stroke-linecap='round' stroke-width='.8px'><path "
|
|
"transform='matrix(1 0 0 -1 .19808 11.984)' d='m6.0943 5.9899c0.16457 0.1173 0.0098785 "
|
|
"0.35997-0.11145 0.43612-0.40848 0.25638-0.89022-0.11622-1.039-0.4965-0.32983-0.84299 "
|
|
"0.37932-1.6794 1.1646-1.8967 1.4211-0.39338 2.7295 0.77904 3.0093 2.1158 0.36822 "
|
|
"1.7593-0.79537 3.4576-2.3989 4.1096'/><path transform='matrix(1 0 0 -1 .030284 "
|
|
"12.252)' d='m6.3163 6.3608c-0.14689-0.18552 0.10611-0.40806 0.26737-0.45419 "
|
|
"0.54289-0.15532 0.96335 0.42061 1.0068 0.89674 0.096424 1.0555-0.97349 1.7652-1.9275 "
|
|
"1.7539-1.7263-0.020368-2.8161-1.765-2.6954-3.3595 0.15881-2.0986 2.0205-3.6297 "
|
|
"4.0363-3.8406'/></g></svg>" ) );
|
|
|
|
iconTheme->add( UISVGIcon::New(
|
|
"debug-stackframe",
|
|
"<svg fill='#fff' viewBox='0 0 16 16'><path d='M14.5 7.15l-4.26-4.74L9.31 2H4.25L3 "
|
|
"3.25v9.48l1.25 1.25h5.06l.93-.42 4.26-4.74V7.15zm-5.19 "
|
|
"5.58H4.25V3.25h5.06l4.26 4.73-4.26 4.75z' /></svg>" ) );
|
|
|
|
iconTheme->add( UISVGIcon::New(
|
|
"circle-perfect",
|
|
"<svg fill='#fff' viewBox='0 0 16 16'><circle cx='8' cy='8' r='7' /></svg>" ) );
|
|
|
|
return iconTheme;
|
|
}
|
|
|
|
}} // namespace EE::UI
|