mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
parent
2d39da5405
commit
c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions
|
@ -49,7 +49,7 @@ static String human_readable_size(size_t size)
|
|||
return number_string_with_one_decimal((float)size / (float)GB, "GB");
|
||||
}
|
||||
|
||||
void DirectoryView::handle_activation(const GModelIndex& index)
|
||||
void DirectoryView::handle_activation(const GUI::ModelIndex& index)
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return;
|
||||
|
@ -118,24 +118,24 @@ void DirectoryView::handle_activation(const GModelIndex& index)
|
|||
}
|
||||
};
|
||||
|
||||
DirectoryView::DirectoryView(GWidget* parent)
|
||||
: GStackWidget(parent)
|
||||
, m_model(GFileSystemModel::create())
|
||||
DirectoryView::DirectoryView(GUI::Widget* parent)
|
||||
: GUI::StackWidget(parent)
|
||||
, m_model(GUI::FileSystemModel::create())
|
||||
{
|
||||
set_active_widget(nullptr);
|
||||
m_item_view = GItemView::construct(this);
|
||||
m_item_view = GUI::ItemView::construct(this);
|
||||
m_item_view->set_model(model());
|
||||
|
||||
m_columns_view = GColumnsView::construct(this);
|
||||
m_columns_view = GUI::ColumnsView::construct(this);
|
||||
m_columns_view->set_model(model());
|
||||
|
||||
m_table_view = GTableView::construct(this);
|
||||
m_table_view->set_model(GSortingProxyModel::create(m_model));
|
||||
m_table_view = GUI::TableView::construct(this);
|
||||
m_table_view->set_model(GUI::SortingProxyModel::create(m_model));
|
||||
|
||||
m_table_view->model()->set_key_column_and_sort_order(GFileSystemModel::Column::Name, GSortOrder::Ascending);
|
||||
m_table_view->model()->set_key_column_and_sort_order(GUI::FileSystemModel::Column::Name, GUI::SortOrder::Ascending);
|
||||
|
||||
m_item_view->set_model_column(GFileSystemModel::Column::Name);
|
||||
m_columns_view->set_model_column(GFileSystemModel::Column::Name);
|
||||
m_item_view->set_model_column(GUI::FileSystemModel::Column::Name);
|
||||
m_columns_view->set_model_column(GUI::FileSystemModel::Column::Name);
|
||||
|
||||
m_model->on_root_path_change = [this] {
|
||||
m_table_view->selection().clear();
|
||||
|
@ -160,14 +160,14 @@ DirectoryView::DirectoryView(GWidget* parent)
|
|||
on_thumbnail_progress(done, total);
|
||||
};
|
||||
|
||||
m_item_view->on_activation = [&](const GModelIndex& index) {
|
||||
m_item_view->on_activation = [&](const GUI::ModelIndex& index) {
|
||||
handle_activation(index);
|
||||
};
|
||||
m_columns_view->on_activation = [&](const GModelIndex& index) {
|
||||
m_columns_view->on_activation = [&](const GUI::ModelIndex& index) {
|
||||
handle_activation(index);
|
||||
};
|
||||
m_table_view->on_activation = [&](auto& index) {
|
||||
auto& filter_model = (GSortingProxyModel&)*m_table_view->model();
|
||||
auto& filter_model = (GUI::SortingProxyModel&)*m_table_view->model();
|
||||
handle_activation(filter_model.map_to_target(index));
|
||||
};
|
||||
|
||||
|
@ -292,7 +292,7 @@ void DirectoryView::update_statusbar()
|
|||
|
||||
current_view().selection().for_each_index([&](auto& index) {
|
||||
auto& model = *current_view().model();
|
||||
auto size_index = model.sibling(index.row(), GFileSystemModel::Column::Size, model.parent_index(index));
|
||||
auto size_index = model.sibling(index.row(), GUI::FileSystemModel::Column::Size, model.parent_index(index));
|
||||
auto file_size = model.data(size_index).to_i32();
|
||||
selected_byte_count += file_size;
|
||||
});
|
||||
|
@ -311,7 +311,7 @@ void DirectoryView::update_statusbar()
|
|||
|
||||
// FIXME: This is disgusting. This code should not even be aware that there is a GSortingProxyModel in the table view.
|
||||
if (m_view_mode == ViewMode::List) {
|
||||
auto& filter_model = (GSortingProxyModel&)*m_table_view->model();
|
||||
auto& filter_model = (GUI::SortingProxyModel&)*m_table_view->model();
|
||||
index = filter_model.map_to_target(index);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <LibGUI/GTableView.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
class DirectoryView final : public GStackWidget {
|
||||
class DirectoryView final : public GUI::StackWidget {
|
||||
C_OBJECT(DirectoryView)
|
||||
public:
|
||||
virtual ~DirectoryView() override;
|
||||
|
@ -50,8 +50,8 @@ public:
|
|||
void refresh();
|
||||
|
||||
Function<void(const StringView&)> on_path_change;
|
||||
Function<void(GAbstractView&)> on_selection_change;
|
||||
Function<void(const GAbstractView&, const GModelIndex&, const GContextMenuEvent&)> on_context_menu_request;
|
||||
Function<void(GUI::AbstractView&)> on_selection_change;
|
||||
Function<void(const GUI::AbstractView&, const GUI::ModelIndex&, const GUI::ContextMenuEvent&)> on_context_menu_request;
|
||||
Function<void(const StringView&)> on_status_message;
|
||||
Function<void(int done, int total)> on_thumbnail_progress;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
void set_view_mode(ViewMode);
|
||||
ViewMode view_mode() const { return m_view_mode; }
|
||||
|
||||
GAbstractView& current_view()
|
||||
GUI::AbstractView& current_view()
|
||||
{
|
||||
switch (m_view_mode) {
|
||||
case ViewMode::List:
|
||||
|
@ -86,25 +86,25 @@ public:
|
|||
callback(*m_columns_view);
|
||||
}
|
||||
|
||||
GFileSystemModel& model() { return *m_model; }
|
||||
GUI::FileSystemModel& model() { return *m_model; }
|
||||
|
||||
private:
|
||||
explicit DirectoryView(GWidget* parent);
|
||||
const GFileSystemModel& model() const { return *m_model; }
|
||||
explicit DirectoryView(GUI::Widget* parent);
|
||||
const GUI::FileSystemModel& model() const { return *m_model; }
|
||||
|
||||
void handle_activation(const GModelIndex&);
|
||||
void handle_activation(const GUI::ModelIndex&);
|
||||
|
||||
void set_status_message(const StringView&);
|
||||
void update_statusbar();
|
||||
|
||||
ViewMode m_view_mode { Invalid };
|
||||
|
||||
NonnullRefPtr<GFileSystemModel> m_model;
|
||||
NonnullRefPtr<GUI::FileSystemModel> m_model;
|
||||
int m_path_history_position { 0 };
|
||||
Vector<String> m_path_history;
|
||||
void add_path_to_history(const StringView& path);
|
||||
|
||||
RefPtr<GTableView> m_table_view;
|
||||
RefPtr<GItemView> m_item_view;
|
||||
RefPtr<GColumnsView> m_columns_view;
|
||||
RefPtr<GUI::TableView> m_table_view;
|
||||
RefPtr<GUI::ItemView> m_item_view;
|
||||
RefPtr<GUI::ColumnsView> m_columns_view;
|
||||
};
|
||||
|
|
|
@ -35,15 +35,15 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
PropertiesDialog::PropertiesDialog(GFileSystemModel& model, String path, bool disable_rename, Core::Object* parent)
|
||||
: GDialog(parent)
|
||||
PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, bool disable_rename, Core::Object* parent)
|
||||
: Dialog(parent)
|
||||
, m_model(model)
|
||||
{
|
||||
auto file_path = FileSystemPath(path);
|
||||
ASSERT(file_path.is_valid());
|
||||
|
||||
auto main_widget = GWidget::construct();
|
||||
main_widget->set_layout(make<GVBoxLayout>());
|
||||
auto main_widget = GUI::Widget::construct();
|
||||
main_widget->set_layout(make<GUI::VBoxLayout>());
|
||||
main_widget->layout()->set_margins({ 4, 4, 4, 4 });
|
||||
main_widget->set_fill_with_background_color(true);
|
||||
|
||||
|
@ -51,30 +51,30 @@ PropertiesDialog::PropertiesDialog(GFileSystemModel& model, String path, bool di
|
|||
set_rect({ 0, 0, 360, 420 });
|
||||
set_resizable(false);
|
||||
|
||||
auto tab_widget = GTabWidget::construct(main_widget);
|
||||
auto tab_widget = GUI::TabWidget::construct(main_widget);
|
||||
|
||||
auto general_tab = GWidget::construct(tab_widget.ptr());
|
||||
general_tab->set_layout(make<GVBoxLayout>());
|
||||
auto general_tab = GUI::Widget::construct(tab_widget.ptr());
|
||||
general_tab->set_layout(make<GUI::VBoxLayout>());
|
||||
general_tab->layout()->set_margins({ 12, 8, 12, 8 });
|
||||
general_tab->layout()->set_spacing(10);
|
||||
tab_widget->add_widget("General", general_tab);
|
||||
|
||||
general_tab->layout()->add_spacer();
|
||||
|
||||
auto file_container = GWidget::construct(general_tab.ptr());
|
||||
file_container->set_layout(make<GHBoxLayout>());
|
||||
file_container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
auto file_container = GUI::Widget::construct(general_tab.ptr());
|
||||
file_container->set_layout(make<GUI::HBoxLayout>());
|
||||
file_container->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
file_container->layout()->set_spacing(20);
|
||||
file_container->set_preferred_size(0, 34);
|
||||
|
||||
m_icon = GLabel::construct(file_container);
|
||||
m_icon->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
m_icon = GUI::Label::construct(file_container);
|
||||
m_icon->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
m_icon->set_preferred_size(32, 32);
|
||||
|
||||
m_name = file_path.basename();
|
||||
|
||||
m_name_box = GTextBox::construct(file_container);
|
||||
m_name_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_name_box = GUI::TextBox::construct(file_container);
|
||||
m_name_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
m_name_box->set_preferred_size({ 0, 22 });
|
||||
m_name_box->set_text(m_name);
|
||||
m_name_box->on_change = [&, disable_rename]() {
|
||||
|
@ -118,8 +118,8 @@ PropertiesDialog::PropertiesDialog(GFileSystemModel& model, String path, bool di
|
|||
properties.append({ "Size:", String::format("%zu bytes", st.st_size) });
|
||||
properties.append({ "Owner:", String::format("%s (%lu)", user_pw->pw_name, static_cast<u32>(user_pw->pw_uid)) });
|
||||
properties.append({ "Group:", String::format("%s (%lu)", group_pw->pw_name, static_cast<u32>(group_pw->pw_uid)) });
|
||||
properties.append({ "Created at:", GFileSystemModel::timestamp_string(st.st_ctime) });
|
||||
properties.append({ "Last modified:", GFileSystemModel::timestamp_string(st.st_mtime) });
|
||||
properties.append({ "Created at:", GUI::FileSystemModel::timestamp_string(st.st_ctime) });
|
||||
properties.append({ "Last modified:", GUI::FileSystemModel::timestamp_string(st.st_mtime) });
|
||||
|
||||
make_property_value_pairs(properties, general_tab);
|
||||
|
||||
|
@ -131,9 +131,9 @@ PropertiesDialog::PropertiesDialog(GFileSystemModel& model, String path, bool di
|
|||
|
||||
general_tab->layout()->add_spacer();
|
||||
|
||||
auto button_widget = GWidget::construct(main_widget.ptr());
|
||||
button_widget->set_layout(make<GHBoxLayout>());
|
||||
button_widget->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
auto button_widget = GUI::Widget::construct(main_widget.ptr());
|
||||
button_widget->set_layout(make<GUI::HBoxLayout>());
|
||||
button_widget->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
button_widget->set_preferred_size(0, 24);
|
||||
button_widget->layout()->set_spacing(5);
|
||||
|
||||
|
@ -180,13 +180,13 @@ bool PropertiesDialog::apply_changes()
|
|||
String new_name = m_name_box->text();
|
||||
String new_file = make_full_path(new_name).characters();
|
||||
|
||||
if (GFilePicker::file_exists(new_file)) {
|
||||
GMessageBox::show(String::format("A file \"%s\" already exists!", new_name.characters()), "Error", GMessageBox::Type::Error);
|
||||
if (GUI::FilePicker::file_exists(new_file)) {
|
||||
GUI::MessageBox::show(String::format("A file \"%s\" already exists!", new_name.characters()), "Error", GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rename(make_full_path(m_name).characters(), new_file.characters())) {
|
||||
GMessageBox::show(String::format("Could not rename file: %s!", strerror(errno)), "Error", GMessageBox::Type::Error);
|
||||
GUI::MessageBox::show(String::format("Could not rename file: %s!", strerror(errno)), "Error", GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ bool PropertiesDialog::apply_changes()
|
|||
|
||||
if (m_permissions_dirty) {
|
||||
if (chmod(make_full_path(m_name).characters(), m_mode)) {
|
||||
GMessageBox::show(String::format("Could not update permissions: %s!", strerror(errno)), "Error", GMessageBox::Type::Error);
|
||||
GUI::MessageBox::show(String::format("Could not update permissions: %s!", strerror(errno)), "Error", GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -209,48 +209,48 @@ bool PropertiesDialog::apply_changes()
|
|||
return true;
|
||||
}
|
||||
|
||||
void PropertiesDialog::make_permission_checkboxes(NonnullRefPtr<GWidget>& parent, PermissionMasks masks, String label_string, mode_t mode)
|
||||
void PropertiesDialog::make_permission_checkboxes(NonnullRefPtr<GUI::Widget>& parent, PermissionMasks masks, String label_string, mode_t mode)
|
||||
{
|
||||
auto widget = GWidget::construct(parent.ptr());
|
||||
widget->set_layout(make<GHBoxLayout>());
|
||||
widget->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
auto widget = GUI::Widget::construct(parent.ptr());
|
||||
widget->set_layout(make<GUI::HBoxLayout>());
|
||||
widget->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
widget->set_preferred_size(0, 16);
|
||||
widget->layout()->set_spacing(10);
|
||||
|
||||
auto label = GLabel::construct(label_string, widget);
|
||||
auto label = GUI::Label::construct(label_string, widget);
|
||||
label->set_text_alignment(TextAlignment::CenterLeft);
|
||||
|
||||
auto box_read = GCheckBox::construct("Read", widget);
|
||||
auto box_read = GUI::CheckBox::construct("Read", widget);
|
||||
box_read->set_checked(mode & masks.read);
|
||||
box_read->on_checked = [&, masks](bool checked) { permission_changed(masks.read, checked); };
|
||||
|
||||
auto box_write = GCheckBox::construct("Write", widget);
|
||||
auto box_write = GUI::CheckBox::construct("Write", widget);
|
||||
box_write->set_checked(mode & masks.write);
|
||||
box_write->on_checked = [&, masks](bool checked) { permission_changed(masks.write, checked); };
|
||||
|
||||
auto box_execute = GCheckBox::construct("Execute", widget);
|
||||
auto box_execute = GUI::CheckBox::construct("Execute", widget);
|
||||
box_execute->set_checked(mode & masks.execute);
|
||||
box_execute->on_checked = [&, masks](bool checked) { permission_changed(masks.execute, checked); };
|
||||
}
|
||||
|
||||
void PropertiesDialog::make_property_value_pairs(const Vector<PropertyValuePair>& pairs, NonnullRefPtr<GWidget>& parent)
|
||||
void PropertiesDialog::make_property_value_pairs(const Vector<PropertyValuePair>& pairs, NonnullRefPtr<GUI::Widget>& parent)
|
||||
{
|
||||
int max_width = 0;
|
||||
Vector<NonnullRefPtr<GLabel>> property_labels;
|
||||
Vector<NonnullRefPtr<GUI::Label>> property_labels;
|
||||
|
||||
property_labels.ensure_capacity(pairs.size());
|
||||
for (auto pair : pairs) {
|
||||
auto label_container = GWidget::construct(parent.ptr());
|
||||
label_container->set_layout(make<GHBoxLayout>());
|
||||
label_container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
auto label_container = GUI::Widget::construct(parent.ptr());
|
||||
label_container->set_layout(make<GUI::HBoxLayout>());
|
||||
label_container->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
label_container->set_preferred_size(0, 14);
|
||||
label_container->layout()->set_spacing(12);
|
||||
|
||||
auto label_property = GLabel::construct(pair.property, label_container);
|
||||
auto label_property = GUI::Label::construct(pair.property, label_container);
|
||||
label_property->set_text_alignment(TextAlignment::CenterLeft);
|
||||
label_property->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
label_property->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
|
||||
|
||||
GLabel::construct(pair.value, label_container)->set_text_alignment(TextAlignment::CenterLeft);
|
||||
GUI::Label::construct(pair.value, label_container)->set_text_alignment(TextAlignment::CenterLeft);
|
||||
|
||||
max_width = max(max_width, label_property->font().width(pair.property));
|
||||
property_labels.append(label_property);
|
||||
|
@ -260,20 +260,20 @@ void PropertiesDialog::make_property_value_pairs(const Vector<PropertyValuePair>
|
|||
label->set_preferred_size({ max_width, 0 });
|
||||
}
|
||||
|
||||
NonnullRefPtr<GButton> PropertiesDialog::make_button(String text, NonnullRefPtr<GWidget>& parent)
|
||||
NonnullRefPtr<GUI::Button> PropertiesDialog::make_button(String text, NonnullRefPtr<GUI::Widget>& parent)
|
||||
{
|
||||
auto button = GButton::construct(text, parent.ptr());
|
||||
button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
auto button = GUI::Button::construct(text, parent.ptr());
|
||||
button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
button->set_preferred_size(70, 22);
|
||||
return button;
|
||||
}
|
||||
|
||||
void PropertiesDialog::make_divider(NonnullRefPtr<GWidget>& parent)
|
||||
void PropertiesDialog::make_divider(NonnullRefPtr<GUI::Widget>& parent)
|
||||
{
|
||||
parent->layout()->add_spacer();
|
||||
|
||||
auto divider = GFrame::construct(parent.ptr());
|
||||
divider->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
auto divider = GUI::Frame::construct(parent.ptr());
|
||||
divider->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
divider->set_preferred_size({ 0, 2 });
|
||||
divider->set_frame_shape(FrameShape::HorizontalLine);
|
||||
divider->set_frame_shadow(FrameShadow::Sunken);
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GTextBox.h>
|
||||
|
||||
class PropertiesDialog final : public GDialog {
|
||||
class PropertiesDialog final : public GUI::Dialog {
|
||||
C_OBJECT(PropertiesDialog)
|
||||
public:
|
||||
virtual ~PropertiesDialog() override;
|
||||
|
||||
private:
|
||||
PropertiesDialog(GFileSystemModel&, String, bool disable_rename, Core::Object* parent = nullptr);
|
||||
PropertiesDialog(GUI::FileSystemModel&, String, bool disable_rename, Core::Object* parent = nullptr);
|
||||
|
||||
struct PropertyValuePair {
|
||||
String property;
|
||||
|
@ -75,19 +75,19 @@ private:
|
|||
return "Unknown";
|
||||
}
|
||||
|
||||
NonnullRefPtr<GButton> make_button(String, NonnullRefPtr<GWidget>&);
|
||||
void make_divider(NonnullRefPtr<GWidget>&);
|
||||
void make_property_value_pairs(const Vector<PropertyValuePair>& pairs, NonnullRefPtr<GWidget>& parent);
|
||||
void make_permission_checkboxes(NonnullRefPtr<GWidget>& parent, PermissionMasks, String label_string, mode_t mode);
|
||||
NonnullRefPtr<GUI::Button> make_button(String, NonnullRefPtr<GUI::Widget>&);
|
||||
void make_divider(NonnullRefPtr<GUI::Widget>&);
|
||||
void make_property_value_pairs(const Vector<PropertyValuePair>& pairs, NonnullRefPtr<GUI::Widget>& parent);
|
||||
void make_permission_checkboxes(NonnullRefPtr<GUI::Widget>& parent, PermissionMasks, String label_string, mode_t mode);
|
||||
void permission_changed(mode_t mask, bool set);
|
||||
bool apply_changes();
|
||||
void update();
|
||||
String make_full_path(String name);
|
||||
|
||||
GFileSystemModel& m_model;
|
||||
RefPtr<GButton> m_apply_button;
|
||||
RefPtr<GTextBox> m_name_box;
|
||||
RefPtr<GLabel> m_icon;
|
||||
GUI::FileSystemModel& m_model;
|
||||
RefPtr<GUI::Button> m_apply_button;
|
||||
RefPtr<GUI::TextBox> m_name_box;
|
||||
RefPtr<GUI::Label> m_icon;
|
||||
String m_name;
|
||||
String m_path;
|
||||
mode_t m_mode;
|
||||
|
|
|
@ -74,14 +74,14 @@ int main(int argc, char** argv)
|
|||
|
||||
RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("FileManager");
|
||||
|
||||
GApplication app(argc, argv);
|
||||
GUI::Application app(argc, argv);
|
||||
|
||||
if (pledge("stdio thread shared_buffer accept cpath rpath wpath fattr proc exec", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto window = GWindow::construct();
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("File Manager");
|
||||
|
||||
auto left = config->read_num_entry("Window", "Left", 150);
|
||||
|
@ -90,41 +90,41 @@ int main(int argc, char** argv)
|
|||
auto heigth = config->read_num_entry("Window", "Heigth", 480);
|
||||
window->set_rect({ left, top, width, heigth });
|
||||
|
||||
auto widget = GWidget::construct();
|
||||
widget->set_layout(make<GVBoxLayout>());
|
||||
auto widget = GUI::Widget::construct();
|
||||
widget->set_layout(make<GUI::VBoxLayout>());
|
||||
widget->layout()->set_spacing(0);
|
||||
|
||||
auto main_toolbar = GToolBar::construct(widget);
|
||||
auto location_toolbar = GToolBar::construct(widget);
|
||||
auto main_toolbar = GUI::ToolBar::construct(widget);
|
||||
auto location_toolbar = GUI::ToolBar::construct(widget);
|
||||
location_toolbar->layout()->set_margins({ 6, 3, 6, 3 });
|
||||
location_toolbar->set_preferred_size(0, 25);
|
||||
|
||||
auto location_label = GLabel::construct("Location: ", location_toolbar);
|
||||
auto location_label = GUI::Label::construct("Location: ", location_toolbar);
|
||||
location_label->size_to_fit();
|
||||
|
||||
auto location_textbox = GTextEditor::construct(GTextEditor::SingleLine, location_toolbar);
|
||||
auto location_textbox = GUI::TextEditor::construct(GUI::TextEditor::SingleLine, location_toolbar);
|
||||
|
||||
auto splitter = GSplitter::construct(Orientation::Horizontal, widget);
|
||||
auto tree_view = GTreeView::construct(splitter);
|
||||
auto directories_model = GFileSystemModel::create("/", GFileSystemModel::Mode::DirectoriesOnly);
|
||||
auto splitter = GUI::Splitter::construct(Orientation::Horizontal, widget);
|
||||
auto tree_view = GUI::TreeView::construct(splitter);
|
||||
auto directories_model = GUI::FileSystemModel::create("/", GUI::FileSystemModel::Mode::DirectoriesOnly);
|
||||
tree_view->set_model(directories_model);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::Icon, true);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::Size, true);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::Owner, true);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::Group, true);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::Permissions, true);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::ModificationTime, true);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::Inode, true);
|
||||
tree_view->set_column_hidden(GFileSystemModel::Column::SymlinkTarget, true);
|
||||
tree_view->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::Icon, true);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::Size, true);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::Owner, true);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::Group, true);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::Permissions, true);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::ModificationTime, true);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::Inode, true);
|
||||
tree_view->set_column_hidden(GUI::FileSystemModel::Column::SymlinkTarget, true);
|
||||
tree_view->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
|
||||
tree_view->set_preferred_size(150, 0);
|
||||
auto directory_view = DirectoryView::construct(splitter);
|
||||
|
||||
auto statusbar = GStatusBar::construct(widget);
|
||||
auto statusbar = GUI::StatusBar::construct(widget);
|
||||
|
||||
auto progressbar = GProgressBar::construct(statusbar);
|
||||
auto progressbar = GUI::ProgressBar::construct(statusbar);
|
||||
progressbar->set_caption("Generating thumbnails: ");
|
||||
progressbar->set_format(GProgressBar::Format::ValueSlashMax);
|
||||
progressbar->set_format(GUI::ProgressBar::Format::ValueSlashMax);
|
||||
progressbar->set_visible(false);
|
||||
progressbar->set_frame_shape(FrameShape::Panel);
|
||||
progressbar->set_frame_shadow(FrameShadow::Sunken);
|
||||
|
@ -150,7 +150,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
// Reselect the existing folder in the tree.
|
||||
auto new_index = directories_model->index(current_path, GFileSystemModel::Column::Name);
|
||||
auto new_index = directories_model->index(current_path, GUI::FileSystemModel::Column::Name);
|
||||
tree_view->selection().set(new_index);
|
||||
tree_view->scroll_into_view(new_index, Orientation::Vertical);
|
||||
tree_view->update();
|
||||
|
@ -158,37 +158,37 @@ int main(int argc, char** argv)
|
|||
directory_view->refresh();
|
||||
};
|
||||
|
||||
auto directory_context_menu = GMenu::construct("Directory View Directory");
|
||||
auto file_context_menu = GMenu::construct("Directory View File");
|
||||
auto directory_view_context_menu = GMenu::construct("Directory View");
|
||||
auto tree_view_directory_context_menu = GMenu::construct("Tree View Directory");
|
||||
auto tree_view_context_menu = GMenu::construct("Tree View");
|
||||
auto directory_context_menu = GUI::Menu::construct("Directory View Directory");
|
||||
auto file_context_menu = GUI::Menu::construct("Directory View File");
|
||||
auto directory_view_context_menu = GUI::Menu::construct("Directory View");
|
||||
auto tree_view_directory_context_menu = GUI::Menu::construct("Tree View Directory");
|
||||
auto tree_view_context_menu = GUI::Menu::construct("Tree View");
|
||||
|
||||
auto open_parent_directory_action = GAction::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](const GAction&) {
|
||||
auto open_parent_directory_action = GUI::Action::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](const GUI::Action&) {
|
||||
directory_view->open_parent_directory();
|
||||
});
|
||||
|
||||
auto mkdir_action = GAction::create("New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GAction&) {
|
||||
auto input_box = GInputBox::construct("Enter name:", "New directory", window);
|
||||
if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) {
|
||||
auto mkdir_action = GUI::Action::create("New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GUI::Action&) {
|
||||
auto input_box = GUI::InputBox::construct("Enter name:", "New directory", window);
|
||||
if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) {
|
||||
auto new_dir_path = canonicalized_path(
|
||||
String::format("%s/%s",
|
||||
directory_view->path().characters(),
|
||||
input_box->text_value().characters()));
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window);
|
||||
GUI::MessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window);
|
||||
} else {
|
||||
refresh_tree_view();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
RefPtr<GAction> view_as_table_action;
|
||||
RefPtr<GAction> view_as_icons_action;
|
||||
RefPtr<GAction> view_as_columns_action;
|
||||
RefPtr<GUI::Action> view_as_table_action;
|
||||
RefPtr<GUI::Action> view_as_icons_action;
|
||||
RefPtr<GUI::Action> view_as_columns_action;
|
||||
|
||||
view_as_table_action = GAction::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GAction&) {
|
||||
view_as_table_action = GUI::Action::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) {
|
||||
directory_view->set_view_mode(DirectoryView::ViewMode::List);
|
||||
view_as_table_action->set_checked(true);
|
||||
|
||||
|
@ -197,7 +197,7 @@ int main(int argc, char** argv)
|
|||
}, window);
|
||||
view_as_table_action->set_checkable(true);
|
||||
|
||||
view_as_icons_action = GAction::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, GraphicsBitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GAction&) {
|
||||
view_as_icons_action = GUI::Action::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, GraphicsBitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
|
||||
directory_view->set_view_mode(DirectoryView::ViewMode::Icon);
|
||||
view_as_icons_action->set_checked(true);
|
||||
|
||||
|
@ -206,7 +206,7 @@ int main(int argc, char** argv)
|
|||
}, window);
|
||||
view_as_icons_action->set_checkable(true);
|
||||
|
||||
view_as_columns_action = GAction::create("Columns view", GraphicsBitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GAction&) {
|
||||
view_as_columns_action = GUI::Action::create("Columns view", GraphicsBitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) {
|
||||
directory_view->set_view_mode(DirectoryView::ViewMode::Columns);
|
||||
view_as_columns_action->set_checked(true);
|
||||
|
||||
|
@ -215,7 +215,7 @@ int main(int argc, char** argv)
|
|||
}, window);
|
||||
view_as_columns_action->set_checkable(true);
|
||||
|
||||
auto view_type_action_group = make<GActionGroup>();
|
||||
auto view_type_action_group = make<GUI::ActionGroup>();
|
||||
view_type_action_group->set_exclusive(true);
|
||||
view_type_action_group->add_action(*view_as_table_action);
|
||||
view_type_action_group->add_action(*view_as_icons_action);
|
||||
|
@ -225,10 +225,10 @@ int main(int argc, char** argv)
|
|||
Vector<String> paths;
|
||||
auto& view = directory_view->current_view();
|
||||
auto& model = *view.model();
|
||||
view.selection().for_each_index([&](const GModelIndex& index) {
|
||||
view.selection().for_each_index([&](const GUI::ModelIndex& index) {
|
||||
auto parent_index = model.parent_index(index);
|
||||
auto name_index = model.index(index.row(), GFileSystemModel::Column::Name, parent_index);
|
||||
auto path = model.data(name_index, GModel::Role::Custom).to_string();
|
||||
auto name_index = model.index(index.row(), GUI::FileSystemModel::Column::Name, parent_index);
|
||||
auto path = model.data(name_index, GUI::Model::Role::Custom).to_string();
|
||||
paths.append(path);
|
||||
});
|
||||
return paths;
|
||||
|
@ -237,17 +237,17 @@ int main(int argc, char** argv)
|
|||
auto tree_view_selected_file_paths = [&] {
|
||||
Vector<String> paths;
|
||||
auto& view = tree_view;
|
||||
view->selection().for_each_index([&](const GModelIndex& index) {
|
||||
view->selection().for_each_index([&](const GUI::ModelIndex& index) {
|
||||
paths.append(directories_model->full_path(index));
|
||||
});
|
||||
return paths;
|
||||
};
|
||||
|
||||
auto select_all_action = GAction::create("Select all", { Mod_Ctrl, KeyCode::Key_A }, [&](const GAction&) {
|
||||
auto select_all_action = GUI::Action::create("Select all", { Mod_Ctrl, KeyCode::Key_A }, [&](const GUI::Action&) {
|
||||
directory_view->current_view().select_all();
|
||||
});
|
||||
|
||||
auto copy_action = GCommonActions::make_copy_action([&](const GAction& action) {
|
||||
auto copy_action = GUI::CommonActions::make_copy_action([&](const GUI::Action& action) {
|
||||
Vector<String> paths;
|
||||
if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) {
|
||||
paths = selected_file_paths();
|
||||
|
@ -260,12 +260,12 @@ int main(int argc, char** argv)
|
|||
for (auto& path : paths) {
|
||||
copy_text.appendf("%s\n", path.characters());
|
||||
}
|
||||
GClipboard::the().set_data(copy_text.build(), "file-list");
|
||||
GUI::Clipboard::the().set_data(copy_text.build(), "file-list");
|
||||
}, window);
|
||||
copy_action->set_enabled(false);
|
||||
|
||||
auto paste_action = GCommonActions::make_paste_action([&](const GAction&) {
|
||||
auto data_and_type = GClipboard::the().data_and_type();
|
||||
auto paste_action = GUI::CommonActions::make_paste_action([&](const GUI::Action&) {
|
||||
auto data_and_type = GUI::Clipboard::the().data_and_type();
|
||||
if (data_and_type.type != "file-list") {
|
||||
dbg() << "Cannot paste clipboard type " << data_and_type.type;
|
||||
return;
|
||||
|
@ -285,20 +285,20 @@ int main(int argc, char** argv)
|
|||
if (!FileUtils::copy_file_or_directory(current_path, new_path)) {
|
||||
auto error_message = String::format("Could not paste %s.",
|
||||
current_path.characters());
|
||||
GMessageBox::show(error_message, "File Manager", GMessageBox::Type::Error);
|
||||
GUI::MessageBox::show(error_message, "File Manager", GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
refresh_tree_view();
|
||||
}
|
||||
}
|
||||
}, window);
|
||||
paste_action->set_enabled(GClipboard::the().type() == "file-list");
|
||||
paste_action->set_enabled(GUI::Clipboard::the().type() == "file-list");
|
||||
|
||||
GClipboard::the().on_content_change = [&](const String& data_type) {
|
||||
GUI::Clipboard::the().on_content_change = [&](const String& data_type) {
|
||||
paste_action->set_enabled(data_type == "file-list");
|
||||
};
|
||||
|
||||
auto properties_action
|
||||
= GAction::create("Properties...", { Mod_Alt, Key_Return }, GraphicsBitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GAction& action) {
|
||||
= GUI::Action::create("Properties...", { Mod_Alt, Key_Return }, GraphicsBitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GUI::Action& action) {
|
||||
auto& model = directory_view->model();
|
||||
String path;
|
||||
Vector<String> selected;
|
||||
|
@ -325,7 +325,7 @@ int main(int argc, char** argv)
|
|||
Yes
|
||||
};
|
||||
|
||||
auto do_delete = [&](ConfirmBeforeDelete confirm, const GAction& action) {
|
||||
auto do_delete = [&](ConfirmBeforeDelete confirm, const GUI::Action& action) {
|
||||
Vector<String> paths;
|
||||
if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) {
|
||||
paths = selected_file_paths();
|
||||
|
@ -343,13 +343,13 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
if (confirm == ConfirmBeforeDelete::Yes) {
|
||||
auto result = GMessageBox::show(
|
||||
auto result = GUI::MessageBox::show(
|
||||
message,
|
||||
"Confirm deletion",
|
||||
GMessageBox::Type::Warning,
|
||||
GMessageBox::InputType::OKCancel,
|
||||
GUI::MessageBox::Type::Warning,
|
||||
GUI::MessageBox::InputType::OKCancel,
|
||||
window);
|
||||
if (result == GMessageBox::ExecCancel)
|
||||
if (result == GUI::MessageBox::ExecCancel)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -357,11 +357,11 @@ int main(int argc, char** argv)
|
|||
for (auto& path : paths) {
|
||||
struct stat st;
|
||||
if (lstat(path.characters(), &st)) {
|
||||
GMessageBox::show(
|
||||
GUI::MessageBox::show(
|
||||
String::format("lstat(%s) failed: %s", path.characters(), strerror(errno)),
|
||||
"Delete failed",
|
||||
GMessageBox::Type::Error,
|
||||
GMessageBox::InputType::OK,
|
||||
GUI::MessageBox::Type::Error,
|
||||
GUI::MessageBox::InputType::OK,
|
||||
window);
|
||||
break;
|
||||
} else {
|
||||
|
@ -373,11 +373,11 @@ int main(int argc, char** argv)
|
|||
int error = FileUtils::delete_directory(path, error_path);
|
||||
|
||||
if (error) {
|
||||
GMessageBox::show(
|
||||
GUI::MessageBox::show(
|
||||
String::format("Failed to delete directory \"%s\": %s", error_path.characters(), strerror(error)),
|
||||
"Delete failed",
|
||||
GMessageBox::Type::Error,
|
||||
GMessageBox::InputType::OK,
|
||||
GUI::MessageBox::Type::Error,
|
||||
GUI::MessageBox::InputType::OK,
|
||||
window);
|
||||
break;
|
||||
} else {
|
||||
|
@ -385,67 +385,67 @@ int main(int argc, char** argv)
|
|||
}
|
||||
} else if (unlink(path.characters()) < 0) {
|
||||
int saved_errno = errno;
|
||||
GMessageBox::show(
|
||||
GUI::MessageBox::show(
|
||||
String::format("unlink(%s) failed: %s", path.characters(), strerror(saved_errno)),
|
||||
"Delete failed",
|
||||
GMessageBox::Type::Error,
|
||||
GMessageBox::InputType::OK,
|
||||
GUI::MessageBox::Type::Error,
|
||||
GUI::MessageBox::InputType::OK,
|
||||
window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
auto force_delete_action = GAction::create("Delete without confirmation", { Mod_Shift, Key_Delete }, [&](const GAction& action) {
|
||||
auto force_delete_action = GUI::Action::create("Delete without confirmation", { Mod_Shift, Key_Delete }, [&](const GUI::Action& action) {
|
||||
do_delete(ConfirmBeforeDelete::No, action);
|
||||
}, window);
|
||||
|
||||
auto delete_action = GCommonActions::make_delete_action([&](const GAction& action) {
|
||||
auto delete_action = GUI::CommonActions::make_delete_action([&](const GUI::Action& action) {
|
||||
do_delete(ConfirmBeforeDelete::Yes, action);
|
||||
}, window);
|
||||
delete_action->set_enabled(false);
|
||||
|
||||
auto go_back_action = GCommonActions::make_go_back_action([&](auto&) {
|
||||
auto go_back_action = GUI::CommonActions::make_go_back_action([&](auto&) {
|
||||
directory_view->open_previous_directory();
|
||||
}, window);
|
||||
|
||||
auto go_forward_action = GCommonActions::make_go_forward_action([&](auto&) {
|
||||
auto go_forward_action = GUI::CommonActions::make_go_forward_action([&](auto&) {
|
||||
directory_view->open_next_directory();
|
||||
}, window);
|
||||
|
||||
auto go_home_action = GCommonActions::make_go_home_action([&](auto&) {
|
||||
auto go_home_action = GUI::CommonActions::make_go_home_action([&](auto&) {
|
||||
directory_view->open(get_current_user_home_path());
|
||||
}, window);
|
||||
|
||||
auto menubar = make<GMenuBar>();
|
||||
auto menubar = make<GUI::MenuBar>();
|
||||
|
||||
auto app_menu = GMenu::construct("File Manager");
|
||||
auto app_menu = GUI::Menu::construct("File Manager");
|
||||
app_menu->add_action(mkdir_action);
|
||||
app_menu->add_action(copy_action);
|
||||
app_menu->add_action(paste_action);
|
||||
app_menu->add_action(delete_action);
|
||||
app_menu->add_separator();
|
||||
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
|
||||
GApplication::the().quit(0);
|
||||
app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||
GUI::Application::the().quit(0);
|
||||
}));
|
||||
menubar->add_menu(move(app_menu));
|
||||
|
||||
auto view_menu = GMenu::construct("View");
|
||||
auto view_menu = GUI::Menu::construct("View");
|
||||
view_menu->add_action(*view_as_icons_action);
|
||||
view_menu->add_action(*view_as_table_action);
|
||||
view_menu->add_action(*view_as_columns_action);
|
||||
menubar->add_menu(move(view_menu));
|
||||
|
||||
auto go_menu = GMenu::construct("Go");
|
||||
auto go_menu = GUI::Menu::construct("Go");
|
||||
go_menu->add_action(go_back_action);
|
||||
go_menu->add_action(go_forward_action);
|
||||
go_menu->add_action(open_parent_directory_action);
|
||||
go_menu->add_action(go_home_action);
|
||||
menubar->add_menu(move(go_menu));
|
||||
|
||||
auto help_menu = GMenu::construct("Help");
|
||||
help_menu->add_action(GAction::create("About", [&](const GAction&) {
|
||||
GAboutDialog::show("File Manager", load_png("/res/icons/32x32/filetype-folder.png"), window);
|
||||
auto help_menu = GUI::Menu::construct("Help");
|
||||
help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("File Manager", load_png("/res/icons/32x32/filetype-folder.png"), window);
|
||||
}));
|
||||
menubar->add_menu(move(help_menu));
|
||||
|
||||
|
@ -470,7 +470,7 @@ int main(int argc, char** argv)
|
|||
directory_view->on_path_change = [&](const String& new_path) {
|
||||
window->set_title(String::format("File Manager: %s", new_path.characters()));
|
||||
location_textbox->set_text(new_path);
|
||||
auto new_index = directories_model->index(new_path, GFileSystemModel::Column::Name);
|
||||
auto new_index = directories_model->index(new_path, GUI::FileSystemModel::Column::Name);
|
||||
if (new_index.is_valid()) {
|
||||
tree_view->selection().set(new_index);
|
||||
tree_view->scroll_into_view(new_index, Orientation::Vertical);
|
||||
|
@ -496,13 +496,13 @@ int main(int argc, char** argv)
|
|||
progressbar->set_visible(true);
|
||||
};
|
||||
|
||||
directory_view->on_selection_change = [&](GAbstractView& view) {
|
||||
directory_view->on_selection_change = [&](GUI::AbstractView& view) {
|
||||
// FIXME: Figure out how we can enable/disable the paste action, based on clipboard contents.
|
||||
copy_action->set_enabled(!view.selection().is_empty());
|
||||
delete_action->set_enabled(!view.selection().is_empty());
|
||||
};
|
||||
|
||||
auto open_in_text_editor_action = GAction::create("Open in TextEditor...", GraphicsBitmap::load_from_file("/res/icons/TextEditor16.png"), [&](auto&) {
|
||||
auto open_in_text_editor_action = GUI::Action::create("Open in TextEditor...", GraphicsBitmap::load_from_file("/res/icons/TextEditor16.png"), [&](auto&) {
|
||||
for (auto& path : selected_file_paths()) {
|
||||
if (!fork()) {
|
||||
int rc = execl("/bin/TextEditor", "TextEditor", path.characters(), nullptr);
|
||||
|
@ -537,7 +537,7 @@ int main(int argc, char** argv)
|
|||
tree_view_directory_context_menu->add_separator();
|
||||
tree_view_directory_context_menu->add_action(mkdir_action);
|
||||
|
||||
directory_view->on_context_menu_request = [&](const GAbstractView&, const GModelIndex& index, const GContextMenuEvent& event) {
|
||||
directory_view->on_context_menu_request = [&](const GUI::AbstractView&, const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
|
||||
if (index.is_valid()) {
|
||||
auto& node = directory_view->model().node(index);
|
||||
|
||||
|
@ -559,7 +559,7 @@ int main(int argc, char** argv)
|
|||
delete_action->set_enabled(!tree_view->selection().is_empty());
|
||||
};
|
||||
|
||||
tree_view->on_context_menu_request = [&](const GModelIndex& index, const GContextMenuEvent& event) {
|
||||
tree_view->on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
|
||||
if (index.is_valid()) {
|
||||
tree_view_directory_context_menu->popup(event.screen_position());
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ int main(int argc, char** argv)
|
|||
config->write_num_entry("Window", "Heigth", window->height());
|
||||
config->sync();
|
||||
|
||||
return GWindow::CloseRequestDecision::Close;
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
};
|
||||
|
||||
return app.exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue