mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibGUI: Make some API's take String instead of StringView
This commit is contained in:
parent
36f27094d0
commit
0e4eb62dd8
6 changed files with 20 additions and 20 deletions
|
@ -36,7 +36,6 @@
|
|||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibThread/BackgroundAction.h>
|
||||
#include <dirent.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
|
@ -200,9 +199,9 @@ String FileSystemModel::Node::full_path() const
|
|||
return LexicalPath::canonicalized_path(builder.to_string());
|
||||
}
|
||||
|
||||
ModelIndex FileSystemModel::index(const StringView& path, int column) const
|
||||
ModelIndex FileSystemModel::index(String path, int column) const
|
||||
{
|
||||
LexicalPath lexical_path(path);
|
||||
LexicalPath lexical_path(move(path));
|
||||
const Node* node = m_root->m_parent_of_root ? &m_root->children.first() : m_root;
|
||||
if (lexical_path.string() == "/")
|
||||
return node->index(column);
|
||||
|
@ -232,8 +231,8 @@ String FileSystemModel::full_path(const ModelIndex& index) const
|
|||
return node.full_path();
|
||||
}
|
||||
|
||||
FileSystemModel::FileSystemModel(const StringView& root_path, Mode mode)
|
||||
: m_root_path(LexicalPath::canonicalized_path(root_path))
|
||||
FileSystemModel::FileSystemModel(String root_path, Mode mode)
|
||||
: m_root_path(LexicalPath::canonicalized_path(move(root_path)))
|
||||
, m_mode(mode)
|
||||
{
|
||||
setpwent();
|
||||
|
@ -319,12 +318,12 @@ void FileSystemModel::update_node_on_selection(const ModelIndex& index, const bo
|
|||
node.set_selected(selected);
|
||||
}
|
||||
|
||||
void FileSystemModel::set_root_path(const StringView& root_path)
|
||||
void FileSystemModel::set_root_path(String root_path)
|
||||
{
|
||||
if (root_path.is_null())
|
||||
m_root_path = {};
|
||||
else
|
||||
m_root_path = LexicalPath::canonicalized_path(root_path);
|
||||
m_root_path = LexicalPath::canonicalized_path(move(root_path));
|
||||
update();
|
||||
|
||||
if (m_root->has_error()) {
|
||||
|
|
|
@ -118,16 +118,16 @@ public:
|
|||
bool fetch_data(const String& full_path, bool is_root);
|
||||
};
|
||||
|
||||
static NonnullRefPtr<FileSystemModel> create(const StringView& root_path = "/", Mode mode = Mode::FilesAndDirectories)
|
||||
static NonnullRefPtr<FileSystemModel> create(String root_path = "/", Mode mode = Mode::FilesAndDirectories)
|
||||
{
|
||||
return adopt(*new FileSystemModel(root_path, mode));
|
||||
}
|
||||
virtual ~FileSystemModel() override;
|
||||
|
||||
String root_path() const { return m_root_path; }
|
||||
void set_root_path(const StringView&);
|
||||
void set_root_path(String);
|
||||
String full_path(const ModelIndex&) const;
|
||||
ModelIndex index(const StringView& path, int column) const;
|
||||
ModelIndex index(String path, int column) const;
|
||||
|
||||
void update_node_on_selection(const ModelIndex&, const bool);
|
||||
ModelIndex m_previously_selected_index {};
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
void set_should_show_dotfiles(bool);
|
||||
|
||||
private:
|
||||
FileSystemModel(const StringView& root_path, Mode);
|
||||
FileSystemModel(String root_path, Mode);
|
||||
|
||||
String name_for_uid(uid_t) const;
|
||||
String name_for_gid(gid_t) const;
|
||||
|
|
|
@ -51,8 +51,8 @@ Menu* Menu::from_menu_id(int menu_id)
|
|||
return (*it).value;
|
||||
}
|
||||
|
||||
Menu::Menu(const StringView& name)
|
||||
: m_name(name)
|
||||
Menu::Menu(String name)
|
||||
: m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace GUI {
|
|||
class Menu final : public Core::Object {
|
||||
C_OBJECT(Menu)
|
||||
public:
|
||||
explicit Menu(const StringView& name = "");
|
||||
virtual ~Menu() override;
|
||||
|
||||
void realize_menu_if_needed();
|
||||
|
@ -68,6 +67,8 @@ public:
|
|||
private:
|
||||
friend class Menubar;
|
||||
|
||||
explicit Menu(String name = "");
|
||||
|
||||
int realize_menu(RefPtr<Action> default_action = nullptr);
|
||||
void unrealize_menu();
|
||||
void realize_if_needed(const RefPtr<Action>& default_action);
|
||||
|
|
|
@ -69,9 +69,9 @@ NonnullRefPtr<Label> Statusbar::create_label()
|
|||
return label;
|
||||
}
|
||||
|
||||
void Statusbar::set_text(const StringView& text)
|
||||
void Statusbar::set_text(String text)
|
||||
{
|
||||
m_labels.first().set_text(text);
|
||||
m_labels.first().set_text(move(text));
|
||||
}
|
||||
|
||||
String Statusbar::text() const
|
||||
|
@ -79,9 +79,9 @@ String Statusbar::text() const
|
|||
return m_labels.first().text();
|
||||
}
|
||||
|
||||
void Statusbar::set_text(int index, const StringView& text)
|
||||
void Statusbar::set_text(int index, String text)
|
||||
{
|
||||
m_labels.at(index).set_text(text);
|
||||
m_labels.at(index).set_text(move(text));
|
||||
}
|
||||
|
||||
String Statusbar::text(int index) const
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
|
||||
String text() const;
|
||||
String text(int index) const;
|
||||
void set_text(const StringView&);
|
||||
void set_text(int index, const StringView&);
|
||||
void set_text(String);
|
||||
void set_text(int index, String);
|
||||
|
||||
protected:
|
||||
explicit Statusbar(int label_count = 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue