mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:27:44 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "NetworkSettingsWidget.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonParser.h>
|
||||
|
@ -78,7 +78,7 @@ ErrorOr<void> NetworkSettingsWidget::setup()
|
|||
size_t index = 0;
|
||||
proc_net_adapters_json.as_array().for_each([&](auto& value) {
|
||||
auto& if_object = value.as_object();
|
||||
auto adapter_name = if_object.get_deprecated_string("name"sv).value();
|
||||
auto adapter_name = if_object.get_byte_string("name"sv).value();
|
||||
if (adapter_name == "loop")
|
||||
return;
|
||||
|
||||
|
@ -106,8 +106,8 @@ ErrorOr<void> NetworkSettingsWidget::setup()
|
|||
::exit(1);
|
||||
}
|
||||
|
||||
m_adapters_combobox->set_model(GUI::ItemListModel<DeprecatedString>::create(m_adapter_names));
|
||||
m_adapters_combobox->on_change = [this](DeprecatedString const& text, GUI::ModelIndex const&) {
|
||||
m_adapters_combobox->set_model(GUI::ItemListModel<ByteString>::create(m_adapter_names));
|
||||
m_adapters_combobox->on_change = [this](ByteString const& text, GUI::ModelIndex const&) {
|
||||
on_switch_adapter(text);
|
||||
};
|
||||
auto const& selected_adapter = selected_adapter_index;
|
||||
|
@ -117,7 +117,7 @@ ErrorOr<void> NetworkSettingsWidget::setup()
|
|||
return {};
|
||||
}
|
||||
|
||||
void NetworkSettingsWidget::on_switch_adapter(DeprecatedString const& adapter)
|
||||
void NetworkSettingsWidget::on_switch_adapter(ByteString const& adapter)
|
||||
{
|
||||
auto& adapter_data = m_network_adapters.get(adapter).value();
|
||||
m_current_adapter_data = &adapter_data;
|
||||
|
@ -198,7 +198,7 @@ ErrorOr<Optional<JsonObject>> NetworkSettingsWidget::create_settings_object()
|
|||
adapter.set("Enabled", adapter_data.value.enabled);
|
||||
adapter.set("DHCP", adapter_data.value.dhcp);
|
||||
adapter.set("IPv4Address", adapter_data.value.ip_address);
|
||||
adapter.set("IPv4Netmask", netmask.to_deprecated_string());
|
||||
adapter.set("IPv4Netmask", netmask.to_byte_string());
|
||||
adapter.set("IPv4Gateway", adapter_data.value.default_gateway);
|
||||
json.set(adapter_data.key, move(adapter));
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ ErrorOr<Optional<JsonObject>> NetworkSettingsWidget::create_settings_object()
|
|||
return json;
|
||||
}
|
||||
|
||||
void NetworkSettingsWidget::switch_adapter(DeprecatedString const& adapter)
|
||||
void NetworkSettingsWidget::switch_adapter(ByteString const& adapter)
|
||||
{
|
||||
m_adapters_combobox->set_text(adapter, GUI::AllowCallback::No);
|
||||
on_switch_adapter(adapter);
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
static ErrorOr<NonnullRefPtr<NetworkSettingsWidget>> create();
|
||||
|
||||
virtual void apply_settings() override;
|
||||
void switch_adapter(DeprecatedString const& adapter);
|
||||
void switch_adapter(ByteString const& adapter);
|
||||
|
||||
protected:
|
||||
static ErrorOr<NonnullRefPtr<NetworkSettingsWidget>> try_create();
|
||||
|
@ -31,18 +31,18 @@ private:
|
|||
struct NetworkAdapterData {
|
||||
bool enabled = false;
|
||||
bool dhcp = false;
|
||||
DeprecatedString ip_address;
|
||||
ByteString ip_address;
|
||||
int cidr = 0;
|
||||
DeprecatedString default_gateway;
|
||||
ByteString default_gateway;
|
||||
};
|
||||
|
||||
void on_switch_adapter(DeprecatedString const& adapter);
|
||||
void on_switch_adapter(ByteString const& adapter);
|
||||
void on_switch_enabled_or_dhcp();
|
||||
ErrorOr<void> apply_settings_impl();
|
||||
ErrorOr<Optional<JsonObject>> create_settings_object();
|
||||
|
||||
HashMap<DeprecatedString, NetworkAdapterData> m_network_adapters;
|
||||
Vector<DeprecatedString> m_adapter_names;
|
||||
HashMap<ByteString, NetworkAdapterData> m_network_adapters;
|
||||
Vector<ByteString> m_adapter_names;
|
||||
NetworkAdapterData* m_current_adapter_data = nullptr;
|
||||
|
||||
RefPtr<GUI::CheckBox> m_enabled_checkbox;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue