diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-28 19:05:56 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-28 19:08:48 +0100 |
commit | d24164ac6a07afadd5efacafbcbc6aea2c5eb3e7 (patch) | |
tree | 3d38fd97e31c682fd027b171871f65675055facb /DevTools | |
parent | 272c59e6d872a372651b04affaac58270c36658d (diff) | |
download | serenity-d24164ac6a07afadd5efacafbcbc6aea2c5eb3e7.zip |
HackStudio: Add little icons for ".cpp" and ".h" files
This makes it easier to tell them apart in locator suggestions. :^)
Diffstat (limited to 'DevTools')
-rw-r--r-- | DevTools/HackStudio/Locator.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/DevTools/HackStudio/Locator.cpp b/DevTools/HackStudio/Locator.cpp index e3ea657c7a..4a692d0a83 100644 --- a/DevTools/HackStudio/Locator.cpp +++ b/DevTools/HackStudio/Locator.cpp @@ -8,6 +8,8 @@ extern RefPtr<Project> g_project; extern void open_file(const String&); static RefPtr<GraphicsBitmap> s_file_icon; +static RefPtr<GraphicsBitmap> s_cplusplus_icon; +static RefPtr<GraphicsBitmap> s_header_icon; class LocatorSuggestionModel final : public GModel { public: @@ -30,9 +32,10 @@ public: if (index.column() == Column::Name) return suggestion; if (index.column() == Column::Icon) { - if (!s_file_icon) { - s_file_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"); - } + if (suggestion.ends_with(".cpp")) + return *s_cplusplus_icon; + if (suggestion.ends_with(".h")) + return *s_header_icon; return *s_file_icon; } } @@ -72,6 +75,12 @@ private: Locator::Locator(GWidget* parent) : GWidget(parent) { + if (!s_cplusplus_icon) { + s_file_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"); + s_cplusplus_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"); + s_header_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-header.png"); + } + set_layout(make<GBoxLayout>(Orientation::Vertical)); set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); set_preferred_size(0, 20); @@ -124,7 +133,6 @@ Locator::Locator(GWidget* parent) m_suggestion_view->set_headers_visible(false); m_popup_window->set_main_widget(m_suggestion_view); - m_suggestion_view->on_activation = [this](auto& index) { open_suggestion(index); }; |