2017-06-16 01:42:12 +02:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-06-16 01:42:12 +02:00
|
|
|
|
2018-07-07 00:40:15 +02:00
|
|
|
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
|
2017-06-16 01:42:12 +02:00
|
|
|
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2020-05-04 01:21:51 +02:00
|
|
|
#include "Common/Config/Config.h"
|
|
|
|
#include "Core/Config/MainSettings.h"
|
2017-06-16 01:42:12 +02:00
|
|
|
#include "Core/ConfigManager.h"
|
2018-05-19 17:44:22 +02:00
|
|
|
|
2018-07-07 00:40:15 +02:00
|
|
|
#include "DolphinQt/Config/Graphics/AdvancedWidget.h"
|
|
|
|
#include "DolphinQt/Config/Graphics/EnhancementsWidget.h"
|
|
|
|
#include "DolphinQt/Config/Graphics/GeneralWidget.h"
|
|
|
|
#include "DolphinQt/Config/Graphics/HacksWidget.h"
|
|
|
|
#include "DolphinQt/MainWindow.h"
|
|
|
|
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
2018-05-19 17:44:22 +02:00
|
|
|
|
|
|
|
#include "VideoCommon/VideoBackendBase.h"
|
2018-05-08 17:20:08 +02:00
|
|
|
#include "VideoCommon/VideoConfig.h"
|
2017-06-16 01:42:12 +02:00
|
|
|
|
2023-03-25 17:16:53 -07:00
|
|
|
GraphicsWindow::GraphicsWindow(MainWindow* parent) : QDialog(parent), m_main_window(parent)
|
2017-06-16 01:42:12 +02:00
|
|
|
{
|
|
|
|
CreateMainLayout();
|
|
|
|
|
|
|
|
setWindowTitle(tr("Graphics"));
|
2017-09-04 19:50:24 +02:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2017-06-16 01:42:12 +02:00
|
|
|
|
2020-05-04 01:21:51 +02:00
|
|
|
OnBackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
2017-06-16 01:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GraphicsWindow::CreateMainLayout()
|
|
|
|
{
|
2023-04-26 16:44:33 -07:00
|
|
|
auto* const main_layout = new QVBoxLayout();
|
|
|
|
auto* const tab_widget = new QTabWidget();
|
|
|
|
auto* const button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
2018-03-20 10:12:11 +01:00
|
|
|
|
2023-04-26 16:44:33 -07:00
|
|
|
connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2017-06-16 01:42:12 +02:00
|
|
|
|
2023-04-26 16:44:33 -07:00
|
|
|
main_layout->addWidget(tab_widget);
|
|
|
|
main_layout->addWidget(button_box);
|
2017-06-16 01:42:12 +02:00
|
|
|
|
2023-04-26 15:35:40 -07:00
|
|
|
auto* const general_widget = new GeneralWidget(this);
|
2023-04-26 16:44:33 -07:00
|
|
|
auto* const enhancements_widget = new EnhancementsWidget(this);
|
|
|
|
auto* const hacks_widget = new HacksWidget(this);
|
|
|
|
auto* const advanced_widget = new AdvancedWidget(this);
|
2017-06-16 01:42:12 +02:00
|
|
|
|
2023-04-26 16:44:33 -07:00
|
|
|
connect(general_widget, &GeneralWidget::BackendChanged, this, &GraphicsWindow::OnBackendChanged);
|
2017-06-16 01:42:12 +02:00
|
|
|
|
2023-04-26 16:44:33 -07:00
|
|
|
QWidget* const wrapped_general = GetWrappedWidget(general_widget, this, 50, 100);
|
|
|
|
QWidget* const wrapped_enhancements = GetWrappedWidget(enhancements_widget, this, 50, 100);
|
|
|
|
QWidget* const wrapped_hacks = GetWrappedWidget(hacks_widget, this, 50, 100);
|
|
|
|
QWidget* const wrapped_advanced = GetWrappedWidget(advanced_widget, this, 50, 100);
|
2022-09-26 15:39:52 -07:00
|
|
|
|
2023-04-26 16:44:33 -07:00
|
|
|
tab_widget->addTab(wrapped_general, tr("General"));
|
|
|
|
tab_widget->addTab(wrapped_enhancements, tr("Enhancements"));
|
|
|
|
tab_widget->addTab(wrapped_hacks, tr("Hacks"));
|
|
|
|
tab_widget->addTab(wrapped_advanced, tr("Advanced"));
|
2017-06-16 01:42:12 +02:00
|
|
|
|
|
|
|
setLayout(main_layout);
|
|
|
|
}
|
|
|
|
|
2018-05-19 17:52:53 +02:00
|
|
|
void GraphicsWindow::OnBackendChanged(const QString& backend_name)
|
2017-06-16 01:42:12 +02:00
|
|
|
{
|
2024-09-26 15:11:26 -07:00
|
|
|
VideoBackendBase::PopulateBackendInfo(m_main_window->GetWindowSystemInfo());
|
2018-05-19 17:52:53 +02:00
|
|
|
|
2018-06-30 04:28:45 -04:00
|
|
|
setWindowTitle(
|
|
|
|
tr("%1 Graphics Configuration").arg(tr(g_video_backend->GetDisplayName().c_str())));
|
2017-06-16 01:43:14 +02:00
|
|
|
|
2018-05-19 17:52:53 +02:00
|
|
|
emit BackendChanged(backend_name);
|
2017-06-16 01:42:12 +02:00
|
|
|
}
|