mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:37:34 +00:00
FileManager: Port to GTableModel/GTableView.
Replace the custom DirectoryView widget with a GTableView subclass. This was pleasantly straightforward and it's so cool seeing the huge increase in app quality from GTableView. :^)
This commit is contained in:
parent
b5dcad932e
commit
ac8fb5da4c
8 changed files with 308 additions and 236 deletions
25
Applications/FileManager/DirectoryTableView.h
Normal file
25
Applications/FileManager/DirectoryTableView.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GTableView.h>
|
||||
#include <sys/stat.h>
|
||||
#include "DirectoryTableModel.h"
|
||||
|
||||
class DirectoryTableView final : public GTableView {
|
||||
public:
|
||||
explicit DirectoryTableView(GWidget* parent);
|
||||
virtual ~DirectoryTableView() override;
|
||||
|
||||
void open(const String& path);
|
||||
String path() const { return model().path(); }
|
||||
|
||||
Function<void(const String&)> on_path_change;
|
||||
Function<void(String)> on_status_message;
|
||||
|
||||
private:
|
||||
virtual void model_notification(const GModelNotification&) override;
|
||||
|
||||
DirectoryTableModel& model() { return static_cast<DirectoryTableModel&>(*GTableView::model()); }
|
||||
const DirectoryTableModel& model() const { return static_cast<const DirectoryTableModel&>(*GTableView::model()); }
|
||||
|
||||
void set_status_message(const String&);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue