2019-04-29 01:01:23 +02:00
|
|
|
// Copyright 2019 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
2021-04-15 01:07:40 +02:00
|
|
|
#include "common/settings.h"
|
2021-08-12 21:32:53 +02:00
|
|
|
#include "core/core.h"
|
2021-08-13 02:48:39 +02:00
|
|
|
#include "core/network/network_interface.h"
|
2021-08-12 21:32:53 +02:00
|
|
|
#include "ui_configure_network.h"
|
|
|
|
#include "yuzu/configuration/configure_network.h"
|
2019-04-29 01:01:23 +02:00
|
|
|
|
2021-08-12 21:32:53 +02:00
|
|
|
ConfigureNetwork::ConfigureNetwork(QWidget* parent)
|
|
|
|
: QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()) {
|
2019-04-29 01:01:23 +02:00
|
|
|
ui->setupUi(this);
|
|
|
|
|
2021-08-13 00:34:04 +02:00
|
|
|
ui->network_interface->addItem(tr("None"));
|
2021-08-13 12:39:14 +02:00
|
|
|
for (const auto& iface : Network::GetAvailableNetworkInterfaces()) {
|
|
|
|
ui->network_interface->addItem(QString::fromStdString(iface.name));
|
2021-08-12 21:32:53 +02:00
|
|
|
}
|
|
|
|
|
2019-06-21 02:31:17 +02:00
|
|
|
this->SetConfiguration();
|
2019-04-29 01:01:23 +02:00
|
|
|
}
|
|
|
|
|
2021-08-12 21:32:53 +02:00
|
|
|
ConfigureNetwork::~ConfigureNetwork() = default;
|
2019-04-29 01:01:23 +02:00
|
|
|
|
2021-08-12 21:32:53 +02:00
|
|
|
void ConfigureNetwork::ApplyConfiguration() {
|
|
|
|
Settings::values.network_interface = ui->network_interface->currentText().toStdString();
|
2019-04-29 01:01:23 +02:00
|
|
|
}
|
|
|
|
|
2021-08-12 21:32:53 +02:00
|
|
|
void ConfigureNetwork::RetranslateUi() {
|
2019-04-29 01:01:23 +02:00
|
|
|
ui->retranslateUi(this);
|
|
|
|
}
|
|
|
|
|
2021-08-12 21:32:53 +02:00
|
|
|
void ConfigureNetwork::SetConfiguration() {
|
|
|
|
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
|
|
|
|
|
|
|
const std::string& network_interface = Settings::values.network_interface.GetValue();
|
|
|
|
|
|
|
|
ui->network_interface->setCurrentText(QString::fromStdString(network_interface));
|
|
|
|
ui->network_interface->setEnabled(runtime_lock);
|
2019-04-29 01:01:23 +02:00
|
|
|
}
|