2024-07-30 11:42:36 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: GPL-3.0+
|
2022-03-13 17:58:39 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QtWidgets/QWidget>
|
|
|
|
#include <QtGui/QStandardItemModel>
|
|
|
|
|
|
|
|
#include "ui_DEV9SettingsWidget.h"
|
|
|
|
|
2022-05-22 12:49:40 +00:00
|
|
|
#include "DEV9UiCommon.h"
|
|
|
|
#include "DEV9DnsHostDialog.h"
|
2022-03-13 17:58:39 +00:00
|
|
|
#include "DEV9/net.h"
|
|
|
|
|
2023-10-14 08:45:09 +00:00
|
|
|
class SettingsWindow;
|
2022-03-13 17:58:39 +00:00
|
|
|
|
|
|
|
class DEV9SettingsWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
2024-04-12 12:22:58 +00:00
|
|
|
void onEthEnabledChanged(Qt::CheckState state);
|
2022-03-13 17:58:39 +00:00
|
|
|
void onEthDeviceTypeChanged(int index);
|
|
|
|
void onEthDeviceChanged(int index);
|
2024-04-12 12:22:58 +00:00
|
|
|
void onEthDHCPInterceptChanged(Qt::CheckState state);
|
2022-03-13 17:58:39 +00:00
|
|
|
void onEthIPChanged(QLineEdit* sender, const char* section, const char* key);
|
2024-04-12 12:22:58 +00:00
|
|
|
void onEthAutoChanged(QCheckBox* sender, Qt::CheckState state, QLineEdit* input, const char* section, const char* key);
|
2022-03-13 17:58:39 +00:00
|
|
|
void onEthDNSModeChanged(QComboBox* sender, int index, QLineEdit* input, const char* section, const char* key);
|
|
|
|
void onEthHostAdd();
|
|
|
|
void onEthHostDel();
|
2022-05-22 12:49:40 +00:00
|
|
|
void onEthHostExport();
|
|
|
|
void onEthHostImport();
|
2022-06-04 20:30:14 +00:00
|
|
|
void onEthHostPerGame();
|
2022-03-13 17:58:39 +00:00
|
|
|
void onEthHostEdit(QStandardItem* item);
|
|
|
|
|
2024-04-12 12:22:58 +00:00
|
|
|
void onHddEnabledChanged(Qt::CheckState state);
|
2022-03-13 17:58:39 +00:00
|
|
|
void onHddBrowseFileClicked();
|
2023-09-03 19:58:50 +00:00
|
|
|
void onHddFileTextChange();
|
2022-03-13 17:58:39 +00:00
|
|
|
void onHddFileEdit();
|
|
|
|
void onHddSizeSlide(int i);
|
2023-01-30 00:08:21 +00:00
|
|
|
void onHddSizeAccessorSpin();
|
2024-04-12 12:22:58 +00:00
|
|
|
void onHddLBA48Changed(Qt::CheckState state);
|
2022-03-13 17:58:39 +00:00
|
|
|
void onHddCreateClicked();
|
|
|
|
|
|
|
|
public:
|
2023-10-14 08:45:09 +00:00
|
|
|
DEV9SettingsWidget(SettingsWindow* dialog, QWidget* parent);
|
2022-03-13 17:58:39 +00:00
|
|
|
~DEV9SettingsWidget();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent* event);
|
|
|
|
bool eventFilter(QObject* object, QEvent* event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void AddAdapter(const AdapterEntry& adapter);
|
2024-04-16 19:51:35 +00:00
|
|
|
void LoadAdapters();
|
2022-03-13 17:58:39 +00:00
|
|
|
void RefreshHostList();
|
|
|
|
int CountHostsConfig();
|
2022-06-04 20:30:14 +00:00
|
|
|
std::optional<std::vector<HostEntryUi>> ListHostsConfig();
|
|
|
|
std::vector<HostEntryUi> ListBaseHostsConfig();
|
2022-03-13 17:58:39 +00:00
|
|
|
void AddNewHostConfig(const HostEntryUi& host);
|
|
|
|
void DeleteHostConfig(int index);
|
|
|
|
|
2023-09-03 19:58:50 +00:00
|
|
|
void UpdateHddSizeUIEnabled();
|
|
|
|
void UpdateHddSizeUIValues();
|
|
|
|
|
2023-10-14 08:45:09 +00:00
|
|
|
SettingsWindow* m_dialog;
|
2022-03-13 17:58:39 +00:00
|
|
|
|
|
|
|
Ui::DEV9SettingsWidget m_ui;
|
|
|
|
|
2024-04-17 13:39:14 +00:00
|
|
|
bool m_firstShow{true};
|
|
|
|
|
2022-03-13 17:58:39 +00:00
|
|
|
QStandardItemModel* m_ethHost_model;
|
|
|
|
QSortFilterProxyModel* m_ethHosts_proxy;
|
|
|
|
|
2024-04-16 19:51:35 +00:00
|
|
|
bool m_adaptersLoaded{false};
|
2022-03-13 17:58:39 +00:00
|
|
|
std::vector<Pcsx2Config::DEV9Options::NetApi> m_api_list;
|
|
|
|
std::vector<const char*> m_api_namelist;
|
|
|
|
std::vector<const char*> m_api_valuelist;
|
|
|
|
std::vector<std::vector<AdapterEntry>> m_adapter_list;
|
2021-10-25 22:29:18 +00:00
|
|
|
|
|
|
|
AdapterOptions m_adapter_options{AdapterOptions::None};
|
|
|
|
|
|
|
|
//Use by per-game ui only
|
|
|
|
Pcsx2Config::DEV9Options::NetApi m_global_api{Pcsx2Config::DEV9Options::NetApi::Unset};
|
2022-03-13 17:58:39 +00:00
|
|
|
};
|