mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:47:34 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -6,9 +6,9 @@
|
|||
|
||||
#include "NetworkSettingsWidget.h"
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/JsonParser.h>
|
||||
#include <AK/String.h>
|
||||
#include <Applications/NetworkSettings/NetworkSettingsGML.h>
|
||||
#include <LibCore/Command.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -100,8 +100,8 @@ NetworkSettingsWidget::NetworkSettingsWidget()
|
|||
index++;
|
||||
});
|
||||
|
||||
m_adapters_combobox->set_model(GUI::ItemListModel<String>::create(m_adapter_names));
|
||||
m_adapters_combobox->on_change = [this](String const& text, GUI::ModelIndex const&) {
|
||||
m_adapters_combobox->set_model(GUI::ItemListModel<DeprecatedString>::create(m_adapter_names));
|
||||
m_adapters_combobox->on_change = [this](DeprecatedString const& text, GUI::ModelIndex const&) {
|
||||
on_switch_adapter(text);
|
||||
};
|
||||
auto const& selected_adapter = selected_adapter_index;
|
||||
|
@ -110,7 +110,7 @@ NetworkSettingsWidget::NetworkSettingsWidget()
|
|||
on_switch_adapter(m_adapter_names[selected_adapter_index]);
|
||||
}
|
||||
|
||||
void NetworkSettingsWidget::on_switch_adapter(String const& adapter)
|
||||
void NetworkSettingsWidget::on_switch_adapter(DeprecatedString const& adapter)
|
||||
{
|
||||
auto& adapter_data = m_network_adapters.get(adapter).value();
|
||||
m_current_adapter_data = &adapter_data;
|
||||
|
@ -142,11 +142,11 @@ void NetworkSettingsWidget::apply_settings()
|
|||
config_file->write_bool_entry(adapter_data.key, "DHCP", adapter_data.value.dhcp);
|
||||
if (adapter_data.value.enabled && !adapter_data.value.dhcp) {
|
||||
if (!IPv4Address::from_string(adapter_data.value.ip_address).has_value()) {
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Invalid IPv4 address for adapter {}", adapter_data.key));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Invalid IPv4 address for adapter {}", adapter_data.key));
|
||||
return;
|
||||
}
|
||||
if (!IPv4Address::from_string(adapter_data.value.default_gateway).has_value()) {
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Invalid IPv4 gateway for adapter {}", adapter_data.key));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Invalid IPv4 gateway for adapter {}", adapter_data.key));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void NetworkSettingsWidget::apply_settings()
|
|||
GUI::Process::spawn_or_show_error(window(), "/bin/NetworkServer"sv);
|
||||
}
|
||||
|
||||
void NetworkSettingsWidget::switch_adapter(String const& adapter)
|
||||
void NetworkSettingsWidget::switch_adapter(DeprecatedString const& adapter)
|
||||
{
|
||||
m_adapters_combobox->set_text(adapter, GUI::AllowCallback::No);
|
||||
on_switch_adapter(adapter);
|
||||
|
|
|
@ -17,7 +17,7 @@ class NetworkSettingsWidget : public GUI::SettingsWindow::Tab {
|
|||
|
||||
public:
|
||||
virtual void apply_settings() override;
|
||||
void switch_adapter(String const& adapter);
|
||||
void switch_adapter(DeprecatedString const& adapter);
|
||||
|
||||
private:
|
||||
NetworkSettingsWidget();
|
||||
|
@ -25,16 +25,16 @@ private:
|
|||
struct NetworkAdapterData {
|
||||
bool enabled = false;
|
||||
bool dhcp = false;
|
||||
String ip_address;
|
||||
DeprecatedString ip_address;
|
||||
int cidr = 0;
|
||||
String default_gateway;
|
||||
DeprecatedString default_gateway;
|
||||
};
|
||||
|
||||
void on_switch_adapter(String const& adapter);
|
||||
void on_switch_adapter(DeprecatedString const& adapter);
|
||||
void on_switch_enabled_or_dhcp();
|
||||
|
||||
HashMap<String, NetworkAdapterData> m_network_adapters;
|
||||
Vector<String> m_adapter_names;
|
||||
HashMap<DeprecatedString, NetworkAdapterData> m_network_adapters;
|
||||
Vector<DeprecatedString> m_adapter_names;
|
||||
NetworkAdapterData* m_current_adapter_data = nullptr;
|
||||
|
||||
RefPtr<GUI::CheckBox> m_enabled_checkbox;
|
||||
|
|
|
@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
TRY(Core::System::unveil("/tmp/portal/window", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
String adapter;
|
||||
DeprecatedString adapter;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(adapter, "Adapter to display settings for", "adapter", Core::ArgsParser::Required::No);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue