summaryrefslogtreecommitdiff
path: root/Applications/FileManager
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-23 01:42:49 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-23 01:42:49 +0100
commit994cf10b3e78b96861a37b8338e3833680d1788e (patch)
tree2fb7f041edf80bc5cbda0242fd6a9fbc6eaacaed /Applications/FileManager
parent9d4b4c2689578b2c059bdcecd33c5eea8b5771e4 (diff)
downloadserenity-994cf10b3e78b96861a37b8338e3833680d1788e.zip
LibGUI: Rename GTableModel => GModel.
Diffstat (limited to 'Applications/FileManager')
-rw-r--r--Applications/FileManager/DirectoryModel.cpp (renamed from Applications/FileManager/DirectoryTableModel.cpp)28
-rw-r--r--Applications/FileManager/DirectoryModel.h (renamed from Applications/FileManager/DirectoryTableModel.h)10
-rw-r--r--Applications/FileManager/DirectoryTableView.cpp8
-rw-r--r--Applications/FileManager/DirectoryTableView.h8
-rw-r--r--Applications/FileManager/Makefile2
5 files changed, 28 insertions, 28 deletions
diff --git a/Applications/FileManager/DirectoryTableModel.cpp b/Applications/FileManager/DirectoryModel.cpp
index 6b093a6181..77cd8dfec7 100644
--- a/Applications/FileManager/DirectoryTableModel.cpp
+++ b/Applications/FileManager/DirectoryModel.cpp
@@ -1,4 +1,4 @@
-#include "DirectoryTableModel.h"
+#include "DirectoryModel.h"
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
@@ -7,7 +7,7 @@
#include <AK/FileSystemPath.h>
#include <AK/StringBuilder.h>
-DirectoryTableModel::DirectoryTableModel()
+DirectoryModel::DirectoryModel()
{
m_directory_icon = GraphicsBitmap::load_from_file("/res/icons/folder16.png");
m_file_icon = GraphicsBitmap::load_from_file("/res/icons/file16.png");
@@ -27,21 +27,21 @@ DirectoryTableModel::DirectoryTableModel()
endgrent();
}
-DirectoryTableModel::~DirectoryTableModel()
+DirectoryModel::~DirectoryModel()
{
}
-int DirectoryTableModel::row_count() const
+int DirectoryModel::row_count() const
{
return m_directories.size() + m_files.size();
}
-int DirectoryTableModel::column_count() const
+int DirectoryModel::column_count() const
{
return Column::__Count;
}
-String DirectoryTableModel::column_name(int column) const
+String DirectoryModel::column_name(int column) const
{
switch (column) {
case Column::Icon: return "";
@@ -55,7 +55,7 @@ String DirectoryTableModel::column_name(int column) const
ASSERT_NOT_REACHED();
}
-GTableModel::ColumnMetadata DirectoryTableModel::column_metadata(int column) const
+GModel::ColumnMetadata DirectoryModel::column_metadata(int column) const
{
switch (column) {
case Column::Icon: return { 16, TextAlignment::Center };
@@ -69,7 +69,7 @@ GTableModel::ColumnMetadata DirectoryTableModel::column_metadata(int column) con
ASSERT_NOT_REACHED();
}
-const GraphicsBitmap& DirectoryTableModel::icon_for(const Entry& entry) const
+const GraphicsBitmap& DirectoryModel::icon_for(const Entry& entry) const
{
if (S_ISDIR(entry.mode))
return *m_directory_icon;
@@ -122,7 +122,7 @@ static String permission_string(mode_t mode)
return builder.to_string();
}
-String DirectoryTableModel::name_for_uid(uid_t uid) const
+String DirectoryModel::name_for_uid(uid_t uid) const
{
auto it = m_user_names.find(uid);
if (it == m_user_names.end())
@@ -130,7 +130,7 @@ String DirectoryTableModel::name_for_uid(uid_t uid) const
return (*it).value;
}
-String DirectoryTableModel::name_for_gid(uid_t gid) const
+String DirectoryModel::name_for_gid(uid_t gid) const
{
auto it = m_user_names.find(gid);
if (it == m_user_names.end())
@@ -138,7 +138,7 @@ String DirectoryTableModel::name_for_gid(uid_t gid) const
return (*it).value;
}
-GVariant DirectoryTableModel::data(const GModelIndex& index, Role role) const
+GVariant DirectoryModel::data(const GModelIndex& index, Role role) const
{
ASSERT(is_valid(index));
auto& entry = this->entry(index.row());
@@ -168,7 +168,7 @@ GVariant DirectoryTableModel::data(const GModelIndex& index, Role role) const
return { };
}
-void DirectoryTableModel::update()
+void DirectoryModel::update()
{
DIR* dirp = opendir(m_path.characters());
if (!dirp) {
@@ -204,7 +204,7 @@ void DirectoryTableModel::update()
did_update();
}
-void DirectoryTableModel::open(const String& a_path)
+void DirectoryModel::open(const String& a_path)
{
FileSystemPath canonical_path(a_path);
auto path = canonical_path.string();
@@ -219,7 +219,7 @@ void DirectoryTableModel::open(const String& a_path)
set_selected_index({ 0, 0 });
}
-void DirectoryTableModel::activate(const GModelIndex& index)
+void DirectoryModel::activate(const GModelIndex& index)
{
if (!index.is_valid())
return;
diff --git a/Applications/FileManager/DirectoryTableModel.h b/Applications/FileManager/DirectoryModel.h
index 44fd01e524..592eac9887 100644
--- a/Applications/FileManager/DirectoryTableModel.h
+++ b/Applications/FileManager/DirectoryModel.h
@@ -1,13 +1,13 @@
#pragma once
-#include <LibGUI/GTableModel.h>
+#include <LibGUI/GModel.h>
#include <AK/HashMap.h>
#include <sys/stat.h>
-class DirectoryTableModel final : public GTableModel {
+class DirectoryModel final : public GModel {
public:
- static Retained<DirectoryTableModel> create() { return adopt(*new DirectoryTableModel); }
- virtual ~DirectoryTableModel() override;
+ static Retained<DirectoryModel> create() { return adopt(*new DirectoryModel); }
+ virtual ~DirectoryModel() override;
enum Column {
Icon = 0,
@@ -33,7 +33,7 @@ public:
size_t bytes_in_files() const { return m_bytes_in_files; }
private:
- DirectoryTableModel();
+ DirectoryModel();
String name_for_uid(uid_t) const;
String name_for_gid(gid_t) const;
diff --git a/Applications/FileManager/DirectoryTableView.cpp b/Applications/FileManager/DirectoryTableView.cpp
index bd43d47988..a445f22216 100644
--- a/Applications/FileManager/DirectoryTableView.cpp
+++ b/Applications/FileManager/DirectoryTableView.cpp
@@ -1,12 +1,12 @@
#include "DirectoryTableView.h"
-#include <LibGUI/GSortingProxyTableModel.h>
+#include <LibGUI/GSortingProxyModel.h>
DirectoryTableView::DirectoryTableView(GWidget* parent)
: GTableView(parent)
- , m_model(DirectoryTableModel::create())
+ , m_model(DirectoryModel::create())
{
- set_model(GSortingProxyTableModel::create(m_model.copy_ref()));
- GTableView::model()->set_key_column_and_sort_order(DirectoryTableModel::Column::Name, GSortOrder::Ascending);
+ set_model(GSortingProxyModel::create(m_model.copy_ref()));
+ GTableView::model()->set_key_column_and_sort_order(DirectoryModel::Column::Name, GSortOrder::Ascending);
}
DirectoryTableView::~DirectoryTableView()
diff --git a/Applications/FileManager/DirectoryTableView.h b/Applications/FileManager/DirectoryTableView.h
index dac693e799..5725ff7d58 100644
--- a/Applications/FileManager/DirectoryTableView.h
+++ b/Applications/FileManager/DirectoryTableView.h
@@ -2,7 +2,7 @@
#include <LibGUI/GTableView.h>
#include <sys/stat.h>
-#include "DirectoryTableModel.h"
+#include "DirectoryModel.h"
class DirectoryTableView final : public GTableView {
public:
@@ -21,10 +21,10 @@ public:
private:
virtual void model_notification(const GModelNotification&) override;
- DirectoryTableModel& model() { return *m_model; }
- const DirectoryTableModel& model() const { return *m_model; }
+ DirectoryModel& model() { return *m_model; }
+ const DirectoryModel& model() const { return *m_model; }
void set_status_message(const String&);
- Retained<DirectoryTableModel> m_model;
+ Retained<DirectoryModel> m_model;
};
diff --git a/Applications/FileManager/Makefile b/Applications/FileManager/Makefile
index 305da08c0e..4d435c5903 100644
--- a/Applications/FileManager/Makefile
+++ b/Applications/FileManager/Makefile
@@ -1,5 +1,5 @@
OBJS = \
- DirectoryTableModel.o \
+ DirectoryModel.o \
DirectoryTableView.o \
main.o