1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

PixelPaint: Make images keep track of their path & title

The title is either "Untitled" (default), or the basename of the
image after we've opened or saved it.
This commit is contained in:
Andreas Kling 2021-06-16 12:08:05 +02:00
parent 35456f035c
commit abc40af809
5 changed files with 45 additions and 1 deletions

View file

@ -135,6 +135,7 @@ int main(int argc, char** argv)
GUI::MessageBox::show_error(window, String::formatted("Could not save {}: {}", save_path.value(), result.error()));
return;
}
editor->image().set_path(save_path.value());
});
auto menubar = GUI::Menubar::construct();
@ -506,6 +507,13 @@ int main(int argc, char** argv)
layer_properties_widget.set_layer(layer);
};
image_editor.on_image_title_change = [&](auto const& title) {
tab_widget.set_tab_title(image_editor, title);
};
// NOTE: We invoke the above hook directly here to make sure the tab title is set up.
image_editor.on_image_title_change(image->title());
if (image->layer_count())
image_editor.set_active_layer(&image->layer(0));