mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Qt: Implement graphics window and controls
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
#include <QDir>
|
||||
#include <QDragEnterEvent>
|
||||
@ -30,6 +31,8 @@
|
||||
|
||||
#include "DolphinQt2/AboutDialog.h"
|
||||
#include "DolphinQt2/Config/ControllersWindow.h"
|
||||
|
||||
#include "DolphinQt2/Config/Graphics/GraphicsWindow.h"
|
||||
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
|
||||
#include "DolphinQt2/Config/SettingsWindow.h"
|
||||
#include "DolphinQt2/Host.h"
|
||||
@ -44,6 +47,11 @@
|
||||
|
||||
#include "UICommon/UICommon.h"
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include "UICommon/X11Utils.h"
|
||||
#endif
|
||||
|
||||
MainWindow::MainWindow() : QMainWindow(nullptr)
|
||||
{
|
||||
setWindowTitle(QString::fromStdString(scm_rev_str));
|
||||
@ -131,9 +139,21 @@ void MainWindow::CreateComponents()
|
||||
connect(this, &MainWindow::EmulationStopped, m_settings_window,
|
||||
&SettingsWindow::EmulationStopped);
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
m_graphics_window = new GraphicsWindow(
|
||||
new X11Utils::XRRConfiguration(
|
||||
static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
|
||||
"display", windowHandle())),
|
||||
winId()),
|
||||
this);
|
||||
#else
|
||||
m_graphics_window = new GraphicsWindow(nullptr, this);
|
||||
#endif
|
||||
|
||||
InstallHotkeyFilter(m_hotkey_window);
|
||||
InstallHotkeyFilter(m_controllers_window);
|
||||
InstallHotkeyFilter(m_settings_window);
|
||||
InstallHotkeyFilter(m_graphics_window);
|
||||
}
|
||||
|
||||
void MainWindow::ConnectMenuBar()
|
||||
@ -212,6 +232,7 @@ void MainWindow::ConnectToolBar()
|
||||
connect(m_tool_bar, &ToolBar::ScreenShotPressed, this, &MainWindow::ScreenShot);
|
||||
connect(m_tool_bar, &ToolBar::SettingsPressed, this, &MainWindow::ShowSettingsWindow);
|
||||
connect(m_tool_bar, &ToolBar::ControllersPressed, this, &MainWindow::ShowControllersWindow);
|
||||
connect(m_tool_bar, &ToolBar::GraphicsPressed, this, &MainWindow::ShowGraphicsWindow);
|
||||
|
||||
connect(this, &MainWindow::EmulationStarted, m_tool_bar, &ToolBar::EmulationStarted);
|
||||
connect(this, &MainWindow::EmulationPaused, m_tool_bar, &ToolBar::EmulationPaused);
|
||||
@ -476,6 +497,13 @@ void MainWindow::ShowHotkeyDialog()
|
||||
m_hotkey_window->activateWindow();
|
||||
}
|
||||
|
||||
void MainWindow::ShowGraphicsWindow()
|
||||
{
|
||||
m_graphics_window->show();
|
||||
m_graphics_window->raise();
|
||||
m_graphics_window->activateWindow();
|
||||
}
|
||||
|
||||
void MainWindow::StateLoad()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(this, tr("Select a File"), QDir::currentPath(),
|
||||
|
Reference in New Issue
Block a user