diff options
| author | shuffle2 <godisgovernment@gmail.com> | 2017-06-28 12:05:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-28 12:05:00 -0700 |
| commit | c29c1f92af12eed0c90fbf81dfb69dd47510a668 (patch) | |
| tree | afa961e9e3afde6e209e8beec4506b95e5db8057 /Source/Core/DolphinQt2/MainWindow.cpp | |
| parent | e14a82a87ee1b3d32a13736a0224b8247f6195f4 (diff) | |
| parent | 4d37190327366a152951306fadfffa6c24893759 (diff) | |
Merge pull request #5615 from spycrab/qt_graphics
Qt: Implement graphics window
Diffstat (limited to 'Source/Core/DolphinQt2/MainWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt2/MainWindow.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index de38910faa..da38a9dda0 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -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(), |
