DolphinQt: Remove description box handling from graphics widget and window

This commit is contained in:
iwubcode 2020-10-20 22:14:06 -05:00
parent c754b02aae
commit 613d8b1cba
6 changed files with 5 additions and 90 deletions

View File

@ -97,7 +97,6 @@ add_executable(dolphin-emu
Config/Graphics/GraphicsRadio.h
Config/Graphics/GraphicsSlider.cpp
Config/Graphics/GraphicsSlider.h
Config/Graphics/GraphicsWidget.cpp
Config/Graphics/GraphicsWidget.h
Config/Graphics/GraphicsWindow.cpp
Config/Graphics/GraphicsWindow.h

View File

@ -1,20 +0,0 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinQt/Config/Graphics/GraphicsWidget.h"
#include <QEvent>
#include <QLabel>
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
GraphicsWidget::GraphicsWidget(GraphicsWindow* parent)
{
parent->RegisterWidget(this);
}
void GraphicsWidget::AddDescription(QWidget* widget, const char* description)
{
emit DescriptionAdded(widget, description);
}

View File

@ -6,23 +6,12 @@
#include <QWidget>
class GraphicsWindow;
class QFormLayout;
class QGroupBox;
class QLabel;
class GraphicsWidget : public QWidget
{
Q_OBJECT
public:
explicit GraphicsWidget(GraphicsWindow* parent);
signals:
void DescriptionAdded(QWidget* widget, const char* description);
protected:
void AddDescription(QWidget* widget, const char* description);
virtual void LoadSettings() = 0;
virtual void SaveSettings() = 0;

View File

@ -40,26 +40,12 @@ GraphicsWindow::GraphicsWindow(X11Utils::XRRConfiguration* xrr_config, MainWindo
void GraphicsWindow::CreateMainLayout()
{
auto* main_layout = new QVBoxLayout();
auto* description_box = new QGroupBox(tr("Description"));
auto* description_layout = new QVBoxLayout();
m_description =
new QLabel(tr("Move the mouse pointer over an option to display a detailed description."));
m_tab_widget = new QTabWidget();
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
description_box->setLayout(description_layout);
description_box->setFixedHeight(200);
m_description->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_description->setWordWrap(true);
m_description->setAlignment(Qt::AlignTop | Qt::AlignLeft);
description_layout->addWidget(m_description);
main_layout->addWidget(m_tab_widget);
main_layout->addWidget(description_box);
main_layout->addWidget(m_button_box);
m_general_widget = new GeneralWidget(m_xrr_config, this);
@ -73,11 +59,11 @@ void GraphicsWindow::CreateMainLayout()
connect(m_software_renderer, &SoftwareRendererWidget::BackendChanged, this,
&GraphicsWindow::OnBackendChanged);
m_wrapped_general = GetWrappedWidget(m_general_widget, this, 50, 305);
m_wrapped_enhancements = GetWrappedWidget(m_enhancements_widget, this, 50, 305);
m_wrapped_hacks = GetWrappedWidget(m_hacks_widget, this, 50, 305);
m_wrapped_advanced = GetWrappedWidget(m_advanced_widget, this, 50, 305);
m_wrapped_software = GetWrappedWidget(m_software_renderer, this, 50, 305);
m_wrapped_general = GetWrappedWidget(m_general_widget, this, 50, 100);
m_wrapped_enhancements = GetWrappedWidget(m_enhancements_widget, this, 50, 100);
m_wrapped_hacks = GetWrappedWidget(m_hacks_widget, this, 50, 100);
m_wrapped_advanced = GetWrappedWidget(m_advanced_widget, this, 50, 100);
m_wrapped_software = GetWrappedWidget(m_software_renderer, this, 50, 100);
if (Config::Get(Config::MAIN_GFX_BACKEND) != "Software Renderer")
{
@ -118,34 +104,3 @@ void GraphicsWindow::OnBackendChanged(const QString& backend_name)
emit BackendChanged(backend_name);
}
void GraphicsWindow::RegisterWidget(GraphicsWidget* widget)
{
connect(widget, &GraphicsWidget::DescriptionAdded, this, &GraphicsWindow::OnDescriptionAdded);
}
void GraphicsWindow::OnDescriptionAdded(QWidget* widget, const char* description)
{
m_widget_descriptions[widget] = description;
widget->installEventFilter(this);
}
bool GraphicsWindow::eventFilter(QObject* object, QEvent* event)
{
if (!m_widget_descriptions.contains(object))
return false;
if (event->type() == QEvent::Enter)
{
m_description->setText(tr(m_widget_descriptions[object]));
return false;
}
if (event->type() == QEvent::Leave)
{
m_description->setText(
tr("Move the mouse pointer over an option to display a detailed description."));
}
return false;
}

View File

@ -11,7 +11,6 @@ class AdvancedWidget;
class EnhancementsWidget;
class HacksWidget;
class GeneralWidget;
class GraphicsWidget;
class MainWindow;
class QLabel;
class QTabWidget;
@ -29,18 +28,14 @@ class GraphicsWindow final : public QDialog
public:
explicit GraphicsWindow(X11Utils::XRRConfiguration* xrr_config, MainWindow* parent);
void RegisterWidget(GraphicsWidget* widget);
bool eventFilter(QObject* object, QEvent* event) override;
signals:
void BackendChanged(const QString& backend);
private:
void CreateMainLayout();
void OnBackendChanged(const QString& backend);
void OnDescriptionAdded(QWidget* widget, const char* description);
QTabWidget* m_tab_widget;
QLabel* m_description;
QDialogButtonBox* m_button_box;
AdvancedWidget* m_advanced_widget;
@ -56,6 +51,4 @@ private:
QWidget* m_wrapped_software;
X11Utils::XRRConfiguration* m_xrr_config;
QHash<QObject*, const char*> m_widget_descriptions;
};

View File

@ -68,7 +68,6 @@
<ClCompile Include="Config\Graphics\GraphicsInteger.cpp" />
<ClCompile Include="Config\Graphics\GraphicsRadio.cpp" />
<ClCompile Include="Config\Graphics\GraphicsSlider.cpp" />
<ClCompile Include="Config\Graphics\GraphicsWidget.cpp" />
<ClCompile Include="Config\Graphics\GraphicsWindow.cpp" />
<ClCompile Include="Config\Graphics\HacksWidget.cpp" />
<ClCompile Include="Config\Graphics\PostProcessingConfigWindow.cpp" />