summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-29 03:27:03 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-29 03:27:03 +0100
commitadd38b39818c3e77f5352a8014efb5b4928a8a74 (patch)
treee1be70553f46116a601c199d312c640ac4daa8ce
parent34118aaacae54f569cb10914c49464da5a576686 (diff)
downloadserenity-add38b39818c3e77f5352a8014efb5b4928a8a74.zip
GModel: Add GModelIndex argument to row_count() and column_count().
This is in preparation for supporting hierarchical models.
-rw-r--r--Applications/FileManager/DirectoryModel.cpp4
-rw-r--r--Applications/FileManager/DirectoryModel.h4
-rw-r--r--Applications/IRCClient/IRCChannelMemberListModel.cpp4
-rw-r--r--Applications/IRCClient/IRCChannelMemberListModel.h4
-rw-r--r--Applications/IRCClient/IRCLogBufferModel.cpp4
-rw-r--r--Applications/IRCClient/IRCLogBufferModel.h4
-rw-r--r--Applications/IRCClient/IRCWindowListModel.cpp4
-rw-r--r--Applications/IRCClient/IRCWindowListModel.h4
-rw-r--r--Applications/ProcessManager/ProcessModel.cpp4
-rw-r--r--Applications/ProcessManager/ProcessModel.h4
-rw-r--r--LibGUI/GModel.h4
-rw-r--r--LibGUI/GSortingProxyModel.cpp8
-rw-r--r--LibGUI/GSortingProxyModel.h4
13 files changed, 28 insertions, 28 deletions
diff --git a/Applications/FileManager/DirectoryModel.cpp b/Applications/FileManager/DirectoryModel.cpp
index a2700d284d..b22b43acfd 100644
--- a/Applications/FileManager/DirectoryModel.cpp
+++ b/Applications/FileManager/DirectoryModel.cpp
@@ -79,12 +79,12 @@ DirectoryModel::~DirectoryModel()
{
}
-int DirectoryModel::row_count() const
+int DirectoryModel::row_count(const GModelIndex&) const
{
return m_directories.size() + m_files.size();
}
-int DirectoryModel::column_count() const
+int DirectoryModel::column_count(const GModelIndex&) const
{
return Column::__Count;
}
diff --git a/Applications/FileManager/DirectoryModel.h b/Applications/FileManager/DirectoryModel.h
index 1e3774a0c0..7a3c3e168c 100644
--- a/Applications/FileManager/DirectoryModel.h
+++ b/Applications/FileManager/DirectoryModel.h
@@ -21,8 +21,8 @@ public:
__Count,
};
- virtual int row_count() const override;
- virtual int column_count() const override;
+ virtual int row_count(const GModelIndex& = GModelIndex()) const override;
+ virtual int column_count(const GModelIndex& = GModelIndex()) const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
diff --git a/Applications/IRCClient/IRCChannelMemberListModel.cpp b/Applications/IRCClient/IRCChannelMemberListModel.cpp
index 8e474d7e7a..057838a046 100644
--- a/Applications/IRCClient/IRCChannelMemberListModel.cpp
+++ b/Applications/IRCClient/IRCChannelMemberListModel.cpp
@@ -13,12 +13,12 @@ IRCChannelMemberListModel::~IRCChannelMemberListModel()
{
}
-int IRCChannelMemberListModel::row_count() const
+int IRCChannelMemberListModel::row_count(const GModelIndex&) const
{
return m_channel.member_count();
}
-int IRCChannelMemberListModel::column_count() const
+int IRCChannelMemberListModel::column_count(const GModelIndex&) const
{
return 1;
}
diff --git a/Applications/IRCClient/IRCChannelMemberListModel.h b/Applications/IRCClient/IRCChannelMemberListModel.h
index e3c48a2755..8b6c479763 100644
--- a/Applications/IRCClient/IRCChannelMemberListModel.h
+++ b/Applications/IRCClient/IRCChannelMemberListModel.h
@@ -11,8 +11,8 @@ public:
static Retained<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); }
virtual ~IRCChannelMemberListModel() override;
- virtual int row_count() const override;
- virtual int column_count() const override;
+ virtual int row_count(const GModelIndex&) const override;
+ virtual int column_count(const GModelIndex&) const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
diff --git a/Applications/IRCClient/IRCLogBufferModel.cpp b/Applications/IRCClient/IRCLogBufferModel.cpp
index 26d7d7b5ad..1e451770f2 100644
--- a/Applications/IRCClient/IRCLogBufferModel.cpp
+++ b/Applications/IRCClient/IRCLogBufferModel.cpp
@@ -13,12 +13,12 @@ IRCLogBufferModel::~IRCLogBufferModel()
{
}
-int IRCLogBufferModel::row_count() const
+int IRCLogBufferModel::row_count(const GModelIndex&) const
{
return m_log_buffer->count();
}
-int IRCLogBufferModel::column_count() const
+int IRCLogBufferModel::column_count(const GModelIndex&) const
{
return Column::__Count;
}
diff --git a/Applications/IRCClient/IRCLogBufferModel.h b/Applications/IRCClient/IRCLogBufferModel.h
index dfceaa21e3..d4f29740b1 100644
--- a/Applications/IRCClient/IRCLogBufferModel.h
+++ b/Applications/IRCClient/IRCLogBufferModel.h
@@ -16,8 +16,8 @@ public:
static Retained<IRCLogBufferModel> create(Retained<IRCLogBuffer>&& log_buffer) { return adopt(*new IRCLogBufferModel(move(log_buffer))); }
virtual ~IRCLogBufferModel() override;
- virtual int row_count() const override;
- virtual int column_count() const override;
+ virtual int row_count(const GModelIndex&) const override;
+ virtual int column_count(const GModelIndex&) const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
diff --git a/Applications/IRCClient/IRCWindowListModel.cpp b/Applications/IRCClient/IRCWindowListModel.cpp
index b2ac45ad8b..2adb2ef360 100644
--- a/Applications/IRCClient/IRCWindowListModel.cpp
+++ b/Applications/IRCClient/IRCWindowListModel.cpp
@@ -15,12 +15,12 @@ IRCWindowListModel::~IRCWindowListModel()
{
}
-int IRCWindowListModel::row_count() const
+int IRCWindowListModel::row_count(const GModelIndex&) const
{
return m_client.window_count();
}
-int IRCWindowListModel::column_count() const
+int IRCWindowListModel::column_count(const GModelIndex&) const
{
return 1;
}
diff --git a/Applications/IRCClient/IRCWindowListModel.h b/Applications/IRCClient/IRCWindowListModel.h
index 192053e82c..607658cd66 100644
--- a/Applications/IRCClient/IRCWindowListModel.h
+++ b/Applications/IRCClient/IRCWindowListModel.h
@@ -15,8 +15,8 @@ public:
static Retained<IRCWindowListModel> create(IRCClient& client) { return adopt(*new IRCWindowListModel(client)); }
virtual ~IRCWindowListModel() override;
- virtual int row_count() const override;
- virtual int column_count() const override;
+ virtual int row_count(const GModelIndex&) const override;
+ virtual int column_count(const GModelIndex&) const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
diff --git a/Applications/ProcessManager/ProcessModel.cpp b/Applications/ProcessManager/ProcessModel.cpp
index 6af2b3d98f..0a0204d05f 100644
--- a/Applications/ProcessManager/ProcessModel.cpp
+++ b/Applications/ProcessManager/ProcessModel.cpp
@@ -21,12 +21,12 @@ ProcessModel::~ProcessModel()
{
}
-int ProcessModel::row_count() const
+int ProcessModel::row_count(const GModelIndex&) const
{
return m_processes.size();
}
-int ProcessModel::column_count() const
+int ProcessModel::column_count(const GModelIndex&) const
{
return Column::__Count;
}
diff --git a/Applications/ProcessManager/ProcessModel.h b/Applications/ProcessManager/ProcessModel.h
index c30a2718d4..849ee8f03b 100644
--- a/Applications/ProcessManager/ProcessModel.h
+++ b/Applications/ProcessManager/ProcessModel.h
@@ -24,8 +24,8 @@ public:
static Retained<ProcessModel> create() { return adopt(*new ProcessModel); }
virtual ~ProcessModel() override;
- virtual int row_count() const override;
- virtual int column_count() const override;
+ virtual int row_count(const GModelIndex&) const override;
+ virtual int column_count(const GModelIndex&) const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
diff --git a/LibGUI/GModel.h b/LibGUI/GModel.h
index a20af686f0..90949a2229 100644
--- a/LibGUI/GModel.h
+++ b/LibGUI/GModel.h
@@ -46,8 +46,8 @@ public:
virtual ~GModel();
- virtual int row_count() const = 0;
- virtual int column_count() const = 0;
+ virtual int row_count(const GModelIndex& = GModelIndex()) const = 0;
+ virtual int column_count(const GModelIndex& = GModelIndex()) const = 0;
virtual String row_name(int) const { return { }; }
virtual String column_name(int) const { return { }; }
virtual ColumnMetadata column_metadata(int) const { return { }; }
diff --git a/LibGUI/GSortingProxyModel.cpp b/LibGUI/GSortingProxyModel.cpp
index 82b9e4fd08..312358a5cf 100644
--- a/LibGUI/GSortingProxyModel.cpp
+++ b/LibGUI/GSortingProxyModel.cpp
@@ -16,14 +16,14 @@ GSortingProxyModel::~GSortingProxyModel()
{
}
-int GSortingProxyModel::row_count() const
+int GSortingProxyModel::row_count(const GModelIndex& index) const
{
- return target().row_count();
+ return target().row_count(index);
}
-int GSortingProxyModel::column_count() const
+int GSortingProxyModel::column_count(const GModelIndex& index) const
{
- return target().column_count();
+ return target().column_count(index);
}
GModelIndex GSortingProxyModel::map_to_target(const GModelIndex& index) const
diff --git a/LibGUI/GSortingProxyModel.h b/LibGUI/GSortingProxyModel.h
index 5352d33946..0288f3a905 100644
--- a/LibGUI/GSortingProxyModel.h
+++ b/LibGUI/GSortingProxyModel.h
@@ -7,8 +7,8 @@ public:
static Retained<GSortingProxyModel> create(Retained<GModel>&& model) { return adopt(*new GSortingProxyModel(move(model))); }
virtual ~GSortingProxyModel() override;
- virtual int row_count() const override;
- virtual int column_count() const override;
+ virtual int row_count(const GModelIndex& = GModelIndex()) const override;
+ virtual int column_count(const GModelIndex& = GModelIndex()) const override;
virtual String row_name(int) const override;
virtual String column_name(int) const override;
virtual ColumnMetadata column_metadata(int) const override;