14 changed files with 334 additions and 8 deletions
-
3src/common/settings.cpp
-
32src/common/settings.h
-
1src/common/settings_common.h
-
2src/common/settings_enums.h
-
47src/core/hle/service/am/library_applet_creator.cpp
-
18src/frontend_common/config.cpp
-
2src/frontend_common/config.h
-
3src/yuzu/CMakeLists.txt
-
86src/yuzu/configuration/configure_applets.cpp
-
48src/yuzu/configuration/configure_applets.h
-
65src/yuzu/configuration/configure_applets.ui
-
7src/yuzu/configuration/configure_dialog.cpp
-
2src/yuzu/configuration/configure_dialog.h
-
22src/yuzu/configuration/shared_translation.cpp
@ -0,0 +1,86 @@ |
|||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|||
|
|||
#include "common/settings.h"
|
|||
#include "core/core.h"
|
|||
#include "ui_configure_applets.h"
|
|||
#include "yuzu/configuration/configuration_shared.h"
|
|||
#include "yuzu/configuration/configure_applets.h"
|
|||
#include "yuzu/configuration/shared_widget.h"
|
|||
|
|||
ConfigureApplets::ConfigureApplets(Core::System& system_, |
|||
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_, |
|||
const ConfigurationShared::Builder& builder, QWidget* parent) |
|||
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureApplets>()}, system{system_} { |
|||
ui->setupUi(this); |
|||
|
|||
Setup(builder); |
|||
|
|||
SetConfiguration(); |
|||
} |
|||
|
|||
ConfigureApplets::~ConfigureApplets() = default; |
|||
|
|||
void ConfigureApplets::changeEvent(QEvent* event) { |
|||
if (event->type() == QEvent::LanguageChange) { |
|||
RetranslateUI(); |
|||
} |
|||
|
|||
QWidget::changeEvent(event); |
|||
} |
|||
|
|||
void ConfigureApplets::RetranslateUI() { |
|||
ui->retranslateUi(this); |
|||
} |
|||
|
|||
void ConfigureApplets::Setup(const ConfigurationShared::Builder& builder) { |
|||
auto& library_applets_layout = *ui->group_library_applet_modes->layout(); |
|||
std::map<u32, QWidget*> applets_hold{}; |
|||
|
|||
std::vector<Settings::BasicSetting*> settings; |
|||
auto push = [&settings](auto& list) { |
|||
for (auto setting : list) { |
|||
settings.push_back(setting); |
|||
} |
|||
}; |
|||
|
|||
push(Settings::values.linkage.by_category[Settings::Category::LibraryApplet]); |
|||
|
|||
for (auto setting : settings) { |
|||
ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs); |
|||
|
|||
if (widget == nullptr) { |
|||
continue; |
|||
} |
|||
if (!widget->Valid()) { |
|||
widget->deleteLater(); |
|||
continue; |
|||
} |
|||
|
|||
// Untested applets
|
|||
if (setting->Id() == Settings::values.data_erase_applet_mode.Id() || |
|||
setting->Id() == Settings::values.error_applet_mode.Id() || |
|||
setting->Id() == Settings::values.net_connect_applet_mode.Id() || |
|||
setting->Id() == Settings::values.web_applet_mode.Id() || |
|||
setting->Id() == Settings::values.shop_applet_mode.Id() || |
|||
setting->Id() == Settings::values.login_share_applet_mode.Id() || |
|||
setting->Id() == Settings::values.wifi_web_auth_applet_mode.Id() || |
|||
setting->Id() == Settings::values.my_page_applet_mode.Id()) { |
|||
widget->setHidden(true); |
|||
} |
|||
|
|||
applets_hold.emplace(setting->Id(), widget); |
|||
} |
|||
for (const auto& [label, widget] : applets_hold) { |
|||
library_applets_layout.addWidget(widget); |
|||
} |
|||
} |
|||
|
|||
void ConfigureApplets::SetConfiguration() {} |
|||
|
|||
void ConfigureApplets::ApplyConfiguration() { |
|||
const bool powered_on = system.IsPoweredOn(); |
|||
for (const auto& func : apply_funcs) { |
|||
func(powered_on); |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#pragma once |
|||
|
|||
#include <QWidget> |
|||
#include "yuzu/configuration/configuration_shared.h" |
|||
|
|||
class QCheckBox; |
|||
class QLineEdit; |
|||
class QComboBox; |
|||
class QDateTimeEdit; |
|||
namespace Core { |
|||
class System; |
|||
} |
|||
|
|||
namespace Ui { |
|||
class ConfigureApplets; |
|||
} |
|||
|
|||
namespace ConfigurationShared { |
|||
class Builder; |
|||
} |
|||
|
|||
class ConfigureApplets : public ConfigurationShared::Tab { |
|||
public: |
|||
explicit ConfigureApplets(Core::System& system_, |
|||
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, |
|||
const ConfigurationShared::Builder& builder, |
|||
QWidget* parent = nullptr); |
|||
~ConfigureApplets() override; |
|||
|
|||
void ApplyConfiguration() override; |
|||
void SetConfiguration() override; |
|||
|
|||
private: |
|||
void changeEvent(QEvent* event) override; |
|||
void RetranslateUI(); |
|||
|
|||
void Setup(const ConfigurationShared::Builder& builder); |
|||
|
|||
std::vector<std::function<void(bool)>> apply_funcs{}; |
|||
|
|||
std::unique_ptr<Ui::ConfigureApplets> ui; |
|||
bool enabled = false; |
|||
|
|||
Core::System& system; |
|||
}; |
|||
@ -0,0 +1,65 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>ConfigureApplets</class> |
|||
<widget class="QWidget" name="ConfigureApplets"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>605</width> |
|||
<height>300</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Form</string> |
|||
</property> |
|||
<property name="accessibleName"> |
|||
<string>Applets</string> |
|||
</property> |
|||
<layout class="QVBoxLayout" name="verticalLayout_1"> |
|||
<item> |
|||
<layout class="QVBoxLayout" name="verticalLayout"> |
|||
<item> |
|||
<widget class="QGroupBox" name="group_library_applet_modes"> |
|||
<property name="title"> |
|||
<string>Applet mode preference</string> |
|||
</property> |
|||
<layout class="QVBoxLayout"> |
|||
<item> |
|||
<widget class="QWidget" name="applets_widget" native="true"> |
|||
<layout class="QVBoxLayout" name="verticalLayout_3"> |
|||
<property name="leftMargin"> |
|||
<number>0</number> |
|||
</property> |
|||
<property name="topMargin"> |
|||
<number>0</number> |
|||
</property> |
|||
<property name="rightMargin"> |
|||
<number>0</number> |
|||
</property> |
|||
</layout> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</item> |
|||
<item> |
|||
<spacer name="verticalSpacer"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Vertical</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>20</width> |
|||
<height>40</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections/> |
|||
</ui> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue