MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / DEV9SettingsWidget

Method DEV9SettingsWidget

pcsx2-qt/Settings/DEV9SettingsWidget.cpp:47–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45using PacketReader::IP::IP_Address;
46
47DEV9SettingsWidget::DEV9SettingsWidget(SettingsWindow* settings_dialog, QWidget* parent)
48 : SettingsWidget(settings_dialog, parent)
49{
50 SettingsInterface* sif = dialog()->getSettingsInterface();
51
52 setupTab(m_ui);
53
54 //////////////////////////////////////////////////////////////////////////
55 // Eth Enabled
56 //////////////////////////////////////////////////////////////////////////
57 //Connect needs to be after BindWidgetToBoolSetting to ensure correct order of execution for disabling a per game setting
58 //we then need to manually call onEthAutoChanged to update the UI on fist load (done in show)
59 SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.ethEnabled, "DEV9/Eth", "EthEnable", false);
60 connect(m_ui.ethEnabled, &QCheckBox::checkStateChanged, this, &DEV9SettingsWidget::onEthEnabledChanged);
61
62 //////////////////////////////////////////////////////////////////////////
63 // Eth Device Settings
64 //////////////////////////////////////////////////////////////////////////
65 connect(m_ui.ethDevType, &QComboBox::currentIndexChanged, this, &DEV9SettingsWidget::onEthDeviceTypeChanged);
66 connect(m_ui.ethDev, &QComboBox::currentIndexChanged, this, &DEV9SettingsWidget::onEthDeviceChanged);
67 //Comboboxes populated in show event
68
69 //////////////////////////////////////////////////////////////////////////
70 // DHCP Settings
71 //////////////////////////////////////////////////////////////////////////
72 SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.ethInterceptDHCP, "DEV9/Eth", "InterceptDHCP", false);
73 onEthDHCPInterceptChanged(m_ui.ethInterceptDHCP->checkState());
74 connect(m_ui.ethInterceptDHCP, &QCheckBox::checkStateChanged, this, &DEV9SettingsWidget::onEthDHCPInterceptChanged);
75
76 //IP settings
77 const IPValidator* ipValidator = new IPValidator(this, dialog()->isPerGameSettings());
78
79 // clang-format off
80 m_ui.ethPS2Addr ->setValidator(ipValidator);
81 m_ui.ethNetMask ->setValidator(ipValidator);
82 m_ui.ethGatewayAddr->setValidator(ipValidator);
83 m_ui.ethDNS1Addr ->setValidator(ipValidator);
84 m_ui.ethDNS2Addr ->setValidator(ipValidator);
85
86 if (dialog()->isPerGameSettings())
87 {
88 m_ui.ethPS2Addr ->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "PS2IP", "").value().c_str()));
89 m_ui.ethNetMask ->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "Mask", "").value().c_str()));
90 m_ui.ethGatewayAddr->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "Gateway", "").value().c_str()));
91 m_ui.ethDNS1Addr ->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "DNS1", "").value().c_str()));
92 m_ui.ethDNS2Addr ->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "DNS2", "").value().c_str()));
93
94 m_ui.ethPS2Addr ->setPlaceholderText(QString::fromUtf8(Host::GetBaseStringSettingValue("DEV9/Eth", "PS2IP", "0.0.0.0").c_str()));
95 m_ui.ethNetMask ->setPlaceholderText(QString::fromUtf8(Host::GetBaseStringSettingValue("DEV9/Eth", "Mask", "0.0.0.0").c_str()));
96 m_ui.ethGatewayAddr->setPlaceholderText(QString::fromUtf8(Host::GetBaseStringSettingValue("DEV9/Eth", "Gateway", "0.0.0.0").c_str()));
97 m_ui.ethDNS1Addr ->setPlaceholderText(QString::fromUtf8(Host::GetBaseStringSettingValue("DEV9/Eth", "DNS1", "0.0.0.0").c_str()));
98 m_ui.ethDNS2Addr ->setPlaceholderText(QString::fromUtf8(Host::GetBaseStringSettingValue("DEV9/Eth", "DNS2", "0.0.0.0").c_str()));
99 }
100 else
101 {
102 m_ui.ethPS2Addr ->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "PS2IP", "0.0.0.0").value().c_str()));
103 m_ui.ethNetMask ->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "Mask", "0.0.0.0").value().c_str()));
104 m_ui.ethGatewayAddr->setText(QString::fromUtf8(dialog()->getStringValue("DEV9/Eth", "Gateway", "0.0.0.0").value().c_str()));

Callers

nothing calls this directly

Calls 8

BindWidgetToBoolSettingFunction · 0.85
BindWidgetToEnumSettingFunction · 0.85
getSettingsInterfaceMethod · 0.80
isPerGameSettingsMethod · 0.80
c_strMethod · 0.45
valueMethod · 0.45
getStringValueMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected