summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-06 19:56:47 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-06 19:56:47 +0100
commit7df1121e1c25044578e8dad87b954e5bfbe7e5f9 (patch)
treea5a0a10c7cb5b0c3278d77f0c581133c0affedb1 /Applications
parentdc4e6dd7bcb5b529d7f7ba159d458d153036bb3f (diff)
downloadserenity-7df1121e1c25044578e8dad87b954e5bfbe7e5f9.zip
LibGUI: GTableModel::data() should take a GModelIndex instead of int,int.
Diffstat (limited to 'Applications')
-rw-r--r--Applications/FileManager/DirectoryTableModel.cpp6
-rw-r--r--Applications/FileManager/DirectoryTableModel.h2
-rw-r--r--Applications/ProcessManager/ProcessTableModel.cpp8
-rw-r--r--Applications/ProcessManager/ProcessTableModel.h2
4 files changed, 9 insertions, 9 deletions
diff --git a/Applications/FileManager/DirectoryTableModel.cpp b/Applications/FileManager/DirectoryTableModel.cpp
index 712c7e22da..138f55f99f 100644
--- a/Applications/FileManager/DirectoryTableModel.cpp
+++ b/Applications/FileManager/DirectoryTableModel.cpp
@@ -135,10 +135,10 @@ String DirectoryTableModel::name_for_gid(uid_t gid) const
return (*it).value;
}
-GVariant DirectoryTableModel::data(int row, int column) const
+GVariant DirectoryTableModel::data(const GModelIndex& index) const
{
- auto& entry = this->entry(row);
- switch (column) {
+ auto& entry = this->entry(index.row());
+ switch (index.column()) {
case Column::Icon: return icon_for(entry);
case Column::Name: return entry.name;
case Column::Size: return (int)entry.size;
diff --git a/Applications/FileManager/DirectoryTableModel.h b/Applications/FileManager/DirectoryTableModel.h
index a38e9a1bf0..3926341600 100644
--- a/Applications/FileManager/DirectoryTableModel.h
+++ b/Applications/FileManager/DirectoryTableModel.h
@@ -24,7 +24,7 @@ public:
virtual int column_count() const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
- virtual GVariant data(int row, int column) const override;
+ virtual GVariant data(const GModelIndex&) const override;
virtual void update() override;
virtual void activate(const GModelIndex&) override;
diff --git a/Applications/ProcessManager/ProcessTableModel.cpp b/Applications/ProcessManager/ProcessTableModel.cpp
index f157661625..2bc49400c7 100644
--- a/Applications/ProcessManager/ProcessTableModel.cpp
+++ b/Applications/ProcessManager/ProcessTableModel.cpp
@@ -80,12 +80,12 @@ static String pretty_byte_size(size_t size)
return String::format("%uK", size / 1024);
}
-GVariant ProcessTableModel::data(int row, int column) const
+GVariant ProcessTableModel::data(const GModelIndex& index) const
{
- ASSERT(is_valid({ row, column }));
- auto it = m_processes.find(m_pids[row]);
+ ASSERT(is_valid(index));
+ auto it = m_processes.find(m_pids[index.row()]);
auto& process = *(*it).value;
- switch (column) {
+ switch (index.column()) {
case Column::Icon: return *m_generic_process_icon;
case Column::PID: return process.current_state.pid;
case Column::State: return process.current_state.state;
diff --git a/Applications/ProcessManager/ProcessTableModel.h b/Applications/ProcessManager/ProcessTableModel.h
index 47899b712e..35b1145a37 100644
--- a/Applications/ProcessManager/ProcessTableModel.h
+++ b/Applications/ProcessManager/ProcessTableModel.h
@@ -15,7 +15,7 @@ public:
virtual int column_count() const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
- virtual GVariant data(int row, int column) const override;
+ virtual GVariant data(const GModelIndex&) const override;
virtual void update() override;
pid_t selected_pid() const;