mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
DolphinQt: add warning if graphics mods are not enabled
This commit is contained in:
parent
3eb3e1c83a
commit
8aef0015fd
@ -131,6 +131,8 @@ add_executable(dolphin-emu
|
||||
Config/Graphics/SoftwareRendererWidget.h
|
||||
Config/GraphicsModListWidget.cpp
|
||||
Config/GraphicsModListWidget.h
|
||||
Config/GraphicsModWarningWidget.cpp
|
||||
Config/GraphicsModWarningWidget.h
|
||||
Config/InfoWidget.cpp
|
||||
Config/InfoWidget.h
|
||||
Config/LogConfigWidget.cpp
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "DolphinQt/Config/Graphics/GraphicsInteger.h"
|
||||
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
@ -72,7 +73,7 @@ void AdvancedWidget::CreateWidgets()
|
||||
m_dump_xfb_target = new GraphicsBool(tr("Dump XFB Target"), Config::GFX_DUMP_XFB_TARGET);
|
||||
m_disable_vram_copies =
|
||||
new GraphicsBool(tr("Disable EFB VRAM Copies"), Config::GFX_HACK_DISABLE_COPY_TO_VRAM);
|
||||
m_enable_graphics_mods = new GraphicsBool(tr("Enable Graphics Mods"), Config::GFX_MODS_ENABLE);
|
||||
m_enable_graphics_mods = new ToolTipCheckBox(tr("Enable Graphics Mods"));
|
||||
|
||||
utility_layout->addWidget(m_load_custom_textures, 0, 0);
|
||||
utility_layout->addWidget(m_prefetch_custom_textures, 0, 1);
|
||||
@ -167,6 +168,7 @@ void AdvancedWidget::ConnectWidgets()
|
||||
connect(m_dump_use_ffv1, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
connect(m_dump_textures, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
connect(m_enable_graphics_mods, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
}
|
||||
|
||||
void AdvancedWidget::LoadSettings()
|
||||
@ -177,6 +179,8 @@ void AdvancedWidget::LoadSettings()
|
||||
m_enable_prog_scan->setChecked(Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN));
|
||||
m_dump_mip_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
m_dump_base_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
|
||||
SignalBlocking(m_enable_graphics_mods)->setChecked(Settings::Instance().GetGraphicModsEnabled());
|
||||
}
|
||||
|
||||
void AdvancedWidget::SaveSettings()
|
||||
@ -187,6 +191,7 @@ void AdvancedWidget::SaveSettings()
|
||||
Config::SetBase(Config::SYSCONF_PROGRESSIVE_SCAN, m_enable_prog_scan->isChecked());
|
||||
m_dump_mip_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
m_dump_base_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
Settings::Instance().SetGraphicModsEnabled(m_enable_graphics_mods->isChecked());
|
||||
}
|
||||
|
||||
void AdvancedWidget::OnBackendChanged()
|
||||
|
@ -42,7 +42,7 @@ private:
|
||||
GraphicsBool* m_dump_xfb_target;
|
||||
GraphicsBool* m_disable_vram_copies;
|
||||
GraphicsBool* m_load_custom_textures;
|
||||
GraphicsBool* m_enable_graphics_mods;
|
||||
ToolTipCheckBox* m_enable_graphics_mods;
|
||||
|
||||
// Texture dumping
|
||||
GraphicsBool* m_dump_textures;
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "DolphinQt/Config/GraphicsModWarningWidget.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
#include "UICommon/GameFile.h"
|
||||
#include "VideoCommon/GraphicsModSystem/Config/GraphicsMod.h"
|
||||
@ -45,7 +46,9 @@ GraphicsModListWidget::~GraphicsModListWidget()
|
||||
|
||||
void GraphicsModListWidget::CreateWidgets()
|
||||
{
|
||||
auto* main_layout = new QHBoxLayout(this);
|
||||
auto* main_v_layout = new QVBoxLayout(this);
|
||||
|
||||
auto* main_layout = new QHBoxLayout;
|
||||
|
||||
auto* left_v_layout = new QVBoxLayout;
|
||||
|
||||
@ -71,15 +74,23 @@ void GraphicsModListWidget::CreateWidgets()
|
||||
|
||||
m_mod_meta_layout = new QVBoxLayout;
|
||||
right_v_layout->addLayout(m_mod_meta_layout);
|
||||
right_v_layout->addStretch();
|
||||
|
||||
main_layout->addLayout(left_v_layout);
|
||||
main_layout->addLayout(right_v_layout, 1);
|
||||
|
||||
setLayout(main_layout);
|
||||
m_warning = new GraphicsModWarningWidget(this);
|
||||
main_v_layout->addWidget(m_warning);
|
||||
main_v_layout->addLayout(main_layout);
|
||||
|
||||
setLayout(main_v_layout);
|
||||
}
|
||||
|
||||
void GraphicsModListWidget::ConnectWidgets()
|
||||
{
|
||||
connect(m_warning, &GraphicsModWarningWidget::GraphicsModEnableSettings, this,
|
||||
&GraphicsModListWidget::OpenGraphicsSettings);
|
||||
|
||||
connect(m_mod_list, &QListWidget::itemSelectionChanged, this,
|
||||
&GraphicsModListWidget::ModSelectionChanged);
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.h"
|
||||
|
||||
class GraphicsModWarningWidget;
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QListWidget;
|
||||
@ -31,6 +32,7 @@ class GameFile;
|
||||
|
||||
class GraphicsModListWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GraphicsModListWidget(const UICommon::GameFile& game);
|
||||
~GraphicsModListWidget();
|
||||
@ -39,6 +41,9 @@ public:
|
||||
|
||||
const GraphicsModGroupConfig& GetGraphicsModConfig() const;
|
||||
|
||||
signals:
|
||||
void OpenGraphicsSettings();
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
@ -63,6 +68,7 @@ private:
|
||||
QVBoxLayout* m_mod_meta_layout;
|
||||
|
||||
QPushButton* m_refresh;
|
||||
GraphicsModWarningWidget* m_warning;
|
||||
|
||||
std::string m_game_id;
|
||||
GraphicsModGroupConfig m_mod_group;
|
||||
|
70
Source/Core/DolphinQt/Config/GraphicsModWarningWidget.cpp
Normal file
70
Source/Core/DolphinQt/Config/GraphicsModWarningWidget.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/GraphicsModWarningWidget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
#include <QStyle>
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
GraphicsModWarningWidget::GraphicsModWarningWidget(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
|
||||
connect(&Settings::Instance(), &Settings::EnableGfxModsChanged, this,
|
||||
&GraphicsModWarningWidget::Update);
|
||||
Update();
|
||||
}
|
||||
|
||||
void GraphicsModWarningWidget::CreateWidgets()
|
||||
{
|
||||
auto* icon = new QLabel;
|
||||
|
||||
const auto size = 1.5 * QFontMetrics(font()).height();
|
||||
|
||||
QPixmap warning_icon = style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(size, size);
|
||||
|
||||
icon->setPixmap(warning_icon);
|
||||
|
||||
m_text = new QLabel();
|
||||
m_config_button = new QPushButton(tr("Configure Dolphin"));
|
||||
|
||||
m_config_button->setHidden(true);
|
||||
|
||||
auto* layout = new QHBoxLayout;
|
||||
|
||||
layout->addWidget(icon);
|
||||
layout->addWidget(m_text, 1);
|
||||
layout->addWidget(m_config_button);
|
||||
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void GraphicsModWarningWidget::Update()
|
||||
{
|
||||
bool hide_widget = true;
|
||||
bool hide_config_button = true;
|
||||
|
||||
if (!Settings::Instance().GetGraphicModsEnabled())
|
||||
{
|
||||
hide_widget = false;
|
||||
hide_config_button = false;
|
||||
m_text->setText(tr("Graphics mods are currently disabled."));
|
||||
}
|
||||
|
||||
setHidden(hide_widget);
|
||||
m_config_button->setHidden(hide_config_button);
|
||||
}
|
||||
|
||||
void GraphicsModWarningWidget::ConnectWidgets()
|
||||
{
|
||||
connect(m_config_button, &QPushButton::clicked, this,
|
||||
&GraphicsModWarningWidget::GraphicsModEnableSettings);
|
||||
}
|
28
Source/Core/DolphinQt/Config/GraphicsModWarningWidget.h
Normal file
28
Source/Core/DolphinQt/Config/GraphicsModWarningWidget.h
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
|
||||
class GraphicsModWarningWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GraphicsModWarningWidget(QWidget* parent);
|
||||
|
||||
signals:
|
||||
void GraphicsModEnableSettings();
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
|
||||
void Update();
|
||||
|
||||
QLabel* m_text;
|
||||
QPushButton* m_config_button;
|
||||
};
|
@ -52,6 +52,9 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
|
||||
|
||||
connect(ar, &ARCodeWidget::OpenGeneralSettings, this, &PropertiesDialog::OpenGeneralSettings);
|
||||
|
||||
connect(graphics_mod_list, &GraphicsModListWidget::OpenGraphicsSettings, this,
|
||||
&PropertiesDialog::OpenGraphicsSettings);
|
||||
|
||||
const int padding_width = 120;
|
||||
const int padding_height = 100;
|
||||
tab_widget->addTab(GetWrappedWidget(game_config, this, padding_width, padding_height),
|
||||
|
@ -18,4 +18,5 @@ public:
|
||||
|
||||
signals:
|
||||
void OpenGeneralSettings();
|
||||
void OpenGraphicsSettings();
|
||||
};
|
||||
|
@ -77,6 +77,7 @@
|
||||
<ClCompile Include="Config\Graphics\PostProcessingConfigWindow.cpp" />
|
||||
<ClCompile Include="Config\Graphics\SoftwareRendererWidget.cpp" />
|
||||
<ClCompile Include="Config\GraphicsModListWidget.cpp" />
|
||||
<ClCompile Include="Config\GraphicsModWarningWidget.cpp" />
|
||||
<ClCompile Include="Config\InfoWidget.cpp" />
|
||||
<ClCompile Include="Config\LogConfigWidget.cpp" />
|
||||
<ClCompile Include="Config\LogWidget.cpp" />
|
||||
@ -272,6 +273,7 @@
|
||||
<QtMoc Include="Config\Graphics\PostProcessingConfigWindow.h" />
|
||||
<QtMoc Include="Config\Graphics\SoftwareRendererWidget.h" />
|
||||
<QtMoc Include="Config\GraphicsModListWidget.h" />
|
||||
<QtMoc Include="Config\GraphicsModWarningWidget.h" />
|
||||
<QtMoc Include="Config\InfoWidget.h" />
|
||||
<QtMoc Include="Config\LogConfigWidget.h" />
|
||||
<QtMoc Include="Config\LogWidget.h" />
|
||||
|
@ -540,6 +540,8 @@ void GameList::OpenProperties()
|
||||
properties->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
connect(properties, &PropertiesDialog::OpenGeneralSettings, this, &GameList::OpenGeneralSettings);
|
||||
connect(properties, &PropertiesDialog::OpenGraphicsSettings, this,
|
||||
&GameList::OpenGraphicsSettings);
|
||||
|
||||
properties->show();
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ signals:
|
||||
void NetPlayHost(const UICommon::GameFile& game);
|
||||
void SelectionChanged(std::shared_ptr<const UICommon::GameFile> game_file);
|
||||
void OpenGeneralSettings();
|
||||
void OpenGraphicsSettings();
|
||||
|
||||
private:
|
||||
void ShowHeaderContextMenu(const QPoint& pos);
|
||||
|
@ -672,6 +672,7 @@ void MainWindow::ConnectGameList()
|
||||
&MainWindow::ShowRiivolutionBootWidget);
|
||||
|
||||
connect(m_game_list, &GameList::OpenGeneralSettings, this, &MainWindow::ShowGeneralWindow);
|
||||
connect(m_game_list, &GameList::OpenGraphicsSettings, this, &MainWindow::ShowGraphicsWindow);
|
||||
}
|
||||
|
||||
void MainWindow::ConnectRenderWidget()
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
@ -351,6 +352,22 @@ bool Settings::IsKeepWindowOnTopEnabled() const
|
||||
return Config::Get(Config::MAIN_KEEP_WINDOW_ON_TOP);
|
||||
}
|
||||
|
||||
bool Settings::GetGraphicModsEnabled() const
|
||||
{
|
||||
return Config::Get(Config::GFX_MODS_ENABLE);
|
||||
}
|
||||
|
||||
void Settings::SetGraphicModsEnabled(bool enabled)
|
||||
{
|
||||
if (GetGraphicModsEnabled() == enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Config::SetBaseOrCurrent(Config::GFX_MODS_ENABLE, enabled);
|
||||
emit EnableGfxModsChanged(enabled);
|
||||
}
|
||||
|
||||
int Settings::GetVolume() const
|
||||
{
|
||||
return Config::Get(Config::MAIN_AUDIO_VOLUME);
|
||||
|
@ -108,6 +108,8 @@ public:
|
||||
bool GetLockCursor() const;
|
||||
void SetKeepWindowOnTop(bool top);
|
||||
bool IsKeepWindowOnTopEnabled() const;
|
||||
bool GetGraphicModsEnabled() const;
|
||||
void SetGraphicModsEnabled(bool enabled);
|
||||
|
||||
// Audio
|
||||
int GetVolume() const;
|
||||
@ -200,6 +202,7 @@ signals:
|
||||
void DevicesChanged();
|
||||
void SDCardInsertionChanged(bool inserted);
|
||||
void USBKeyboardConnectionChanged(bool connected);
|
||||
void EnableGfxModsChanged(bool enabled);
|
||||
|
||||
private:
|
||||
Settings();
|
||||
|
Loading…
x
Reference in New Issue
Block a user