mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 00:37:35 +00:00
LibGUI+Userland: Switch order of parameters for InputBox::show
Because usage of the input_type parameter is now higher than of the placeholder parameter, this makes for a cleaner API.
This commit is contained in:
parent
8095d9276b
commit
506c26acce
13 changed files with 20 additions and 20 deletions
|
@ -163,7 +163,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
auto mkdir_action = Action::create(
|
||||
"New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
|
||||
DeprecatedString value;
|
||||
if (InputBox::show(this, value, "Enter name:"sv, "New directory"sv, {}, GUI::InputType::NonemptyText) == InputBox::ExecResult::OK) {
|
||||
if (InputBox::show(this, value, "Enter name:"sv, "New directory"sv, GUI::InputType::NonemptyText) == InputBox::ExecResult::OK) {
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_model->root_path(), value));
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
InputBox::InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type)
|
||||
InputBox::InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, InputType input_type, StringView placeholder)
|
||||
: Dialog(parent_window)
|
||||
, m_text_value(move(text_value))
|
||||
, m_prompt(prompt)
|
||||
|
@ -25,9 +25,9 @@ InputBox::InputBox(Window* parent_window, DeprecatedString text_value, StringVie
|
|||
build(input_type);
|
||||
}
|
||||
|
||||
Dialog::ExecResult InputBox::show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type)
|
||||
Dialog::ExecResult InputBox::show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, InputType input_type, StringView placeholder)
|
||||
{
|
||||
auto box = InputBox::construct(parent_window, text_value, prompt, title, placeholder, input_type);
|
||||
auto box = InputBox::construct(parent_window, text_value, prompt, title, input_type, placeholder);
|
||||
box->set_resizable(false);
|
||||
if (parent_window)
|
||||
box->set_icon(parent_window->icon());
|
||||
|
|
|
@ -23,13 +23,13 @@ class InputBox : public Dialog {
|
|||
public:
|
||||
virtual ~InputBox() override = default;
|
||||
|
||||
static ExecResult show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, StringView placeholder = {}, InputType input_type = InputType::Text);
|
||||
static ExecResult show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, InputType input_type = InputType::Text, StringView placeholder = {});
|
||||
|
||||
DeprecatedString const& text_value() const { return m_text_value; }
|
||||
void set_text_value(DeprecatedString text_value);
|
||||
|
||||
private:
|
||||
explicit InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type);
|
||||
explicit InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, InputType input_type, StringView placeholder);
|
||||
|
||||
virtual void on_done(ExecResult) override;
|
||||
void build(InputType input_type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue