mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-11 23:18:57 +01:00
![Pierre Bourdon](/assets/img/avatar_default.png)
Initializing GraphicsWindow layout & children requires cooperation from the graphics stack: on my system, for example, it causes a Vulkan context to get created in order to get driver info. This is a slow operation, and right now it is taking about 60-70% of the Dolphin startup time on my system. Move instead to a lazy-initialization model where the constructor does nothing, instead offloading work to a separate Initialize() method called before the window is shown. I would expect this should be done for other larger parts of the UI, especially the ones where creating widgets ends up triggering large IO subsystems (I suspect controller configuration might be doing that). (I'm not super happy with how this is implemented, but right now it's a one-off, and it's a major complaint users have with the new UI. I prioritized getting something working quickly...)
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <QDialog>
|
|
#include <QHash>
|
|
|
|
class AdvancedWidget;
|
|
class EnhancementsWidget;
|
|
class HacksWidget;
|
|
class GeneralWidget;
|
|
class GraphicsWidget;
|
|
class MainWindow;
|
|
class QLabel;
|
|
class QTabWidget;
|
|
class QDialogButtonBox;
|
|
class SoftwareRendererWidget;
|
|
|
|
namespace X11Utils
|
|
{
|
|
class XRRConfiguration;
|
|
}
|
|
|
|
class GraphicsWindow final : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit GraphicsWindow(X11Utils::XRRConfiguration* xrr_config, MainWindow* parent);
|
|
|
|
void Initialize();
|
|
|
|
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);
|
|
|
|
bool m_lazy_initialized = false;
|
|
|
|
QTabWidget* m_tab_widget;
|
|
QLabel* m_description;
|
|
QDialogButtonBox* m_button_box;
|
|
|
|
AdvancedWidget* m_advanced_widget;
|
|
EnhancementsWidget* m_enhancements_widget;
|
|
HacksWidget* m_hacks_widget;
|
|
GeneralWidget* m_general_widget;
|
|
SoftwareRendererWidget* m_software_renderer;
|
|
|
|
QWidget* m_wrapped_advanced;
|
|
QWidget* m_wrapped_enhancements;
|
|
QWidget* m_wrapped_hacks;
|
|
QWidget* m_wrapped_general;
|
|
QWidget* m_wrapped_software;
|
|
|
|
X11Utils::XRRConfiguration* m_xrr_config;
|
|
|
|
QHash<QObject*, const char*> m_widget_descriptions;
|
|
};
|