mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2025-01-23 01:46:48 +00:00
4be00def5c
Looks like it was just missed when it was added, as currently the Network Tab only has one item RetranslateUI is used more commonly throughout the project
49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
#include "common/settings.h"
|
|
#include "core/core.h"
|
|
#include "core/network/network_interface.h"
|
|
#include "ui_configure_network.h"
|
|
#include "yuzu/configuration/configure_network.h"
|
|
|
|
ConfigureNetwork::ConfigureNetwork(const Core::System& system_, QWidget* parent)
|
|
: QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()), system{system_} {
|
|
ui->setupUi(this);
|
|
|
|
ui->network_interface->addItem(tr("None"));
|
|
for (const auto& iface : Network::GetAvailableNetworkInterfaces()) {
|
|
ui->network_interface->addItem(QString::fromStdString(iface.name));
|
|
}
|
|
|
|
this->SetConfiguration();
|
|
}
|
|
|
|
ConfigureNetwork::~ConfigureNetwork() = default;
|
|
|
|
void ConfigureNetwork::ApplyConfiguration() {
|
|
Settings::values.network_interface = ui->network_interface->currentText().toStdString();
|
|
}
|
|
|
|
void ConfigureNetwork::changeEvent(QEvent* event) {
|
|
if (event->type() == QEvent::LanguageChange) {
|
|
RetranslateUI();
|
|
}
|
|
|
|
QWidget::changeEvent(event);
|
|
}
|
|
|
|
void ConfigureNetwork::RetranslateUI() {
|
|
ui->retranslateUi(this);
|
|
}
|
|
|
|
void ConfigureNetwork::SetConfiguration() {
|
|
const bool runtime_lock = !system.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);
|
|
}
|