mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:57:42 +00:00
LibGUI+HackStudio: Associate new icons with their extensions
This commit is contained in:
parent
b227d54843
commit
45901d4141
4 changed files with 23 additions and 1 deletions
|
@ -37,6 +37,8 @@ namespace HackStudio {
|
|||
static RefPtr<Gfx::Bitmap> s_file_icon;
|
||||
static RefPtr<Gfx::Bitmap> s_cplusplus_icon;
|
||||
static RefPtr<Gfx::Bitmap> s_header_icon;
|
||||
static RefPtr<Gfx::Bitmap> s_form_icon;
|
||||
static RefPtr<Gfx::Bitmap> s_hackstudio_icon;
|
||||
|
||||
class LocatorSuggestionModel final : public GUI::Model {
|
||||
public:
|
||||
|
@ -61,8 +63,12 @@ public:
|
|||
if (index.column() == Column::Icon) {
|
||||
if (suggestion.ends_with(".cpp"))
|
||||
return *s_cplusplus_icon;
|
||||
if (suggestion.ends_with(".frm"))
|
||||
return *s_form_icon;
|
||||
if (suggestion.ends_with(".h"))
|
||||
return *s_header_icon;
|
||||
if (suggestion.ends_with(".hsp"))
|
||||
return *s_hackstudio_icon;
|
||||
return *s_file_icon;
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +86,8 @@ Locator::Locator()
|
|||
s_file_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png");
|
||||
s_cplusplus_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png");
|
||||
s_header_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-header.png");
|
||||
s_form_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-form.png");
|
||||
s_hackstudio_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-hackstudio.png");
|
||||
}
|
||||
|
||||
set_layout<GUI::VerticalBoxLayout>();
|
||||
|
|
|
@ -115,8 +115,14 @@ public:
|
|||
return m_project.m_directory_icon;
|
||||
if (node->name.ends_with(".cpp"))
|
||||
return m_project.m_cplusplus_icon;
|
||||
if (node->name.ends_with(".frm"))
|
||||
return m_project.m_form_icon;
|
||||
if (node->name.ends_with(".h"))
|
||||
return m_project.m_header_icon;
|
||||
if (node->name.ends_with(".hsp"))
|
||||
return m_project.m_hackstudio_icon;
|
||||
if (node->name.ends_with(".js"))
|
||||
return m_project.m_javascript_icon;
|
||||
return m_project.m_file_icon;
|
||||
}
|
||||
if (role == GUI::ModelRole::Font) {
|
||||
|
@ -177,7 +183,10 @@ Project::Project(const String& path, Vector<String>&& filenames)
|
|||
m_cplusplus_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"));
|
||||
m_header_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-header.png"));
|
||||
m_directory_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-folder.png"));
|
||||
m_project_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"));
|
||||
m_project_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/hackstudio-project.png"));
|
||||
m_javascript_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-javascript.png"));
|
||||
m_hackstudio_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-hackstudio.png"));
|
||||
m_form_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-form.png"));
|
||||
|
||||
for (auto& filename : filenames) {
|
||||
m_files.append(ProjectFile::construct_with_name(filename));
|
||||
|
|
|
@ -89,6 +89,9 @@ private:
|
|||
GUI::Icon m_cplusplus_icon;
|
||||
GUI::Icon m_header_icon;
|
||||
GUI::Icon m_project_icon;
|
||||
GUI::Icon m_javascript_icon;
|
||||
GUI::Icon m_hackstudio_icon;
|
||||
GUI::Icon m_form_icon;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace GUI {
|
|||
|
||||
#define ENUMERATE_FILETYPES(F) \
|
||||
F(cplusplus, ".cpp") \
|
||||
F(form, ".frm") \
|
||||
F(hackstudio, ".hsp") \
|
||||
F(header, ".h") \
|
||||
F(html, ".html") \
|
||||
F(image, ".png") \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue