mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-09-11 21:06:22 -05:00
Add Fullscreen Monitor Selector
Under graphics settings, the user can now choose which screen the game will launch on
This commit is contained in:
@@ -294,6 +294,7 @@ const Info<std::string> MAIN_WII_NUS_SHOP_URL{{System::Main, "Core", "WiiNusShop
|
||||
const Info<std::string> MAIN_FULLSCREEN_DISPLAY_RES{
|
||||
{System::Main, "Display", "FullscreenDisplayRes"}, "Auto"};
|
||||
const Info<bool> MAIN_FULLSCREEN{{System::Main, "Display", "Fullscreen"}, false};
|
||||
const Info<int> MAIN_FULLSCREEN_MONITOR{{System::Main, "Display", "FullscreenMonitor"}, 0};
|
||||
const Info<bool> MAIN_RENDER_TO_MAIN{{System::Main, "Display", "RenderToMain"}, false};
|
||||
const Info<int> MAIN_RENDER_WINDOW_XPOS{{System::Main, "Display", "RenderWindowXPos"}, -1};
|
||||
const Info<int> MAIN_RENDER_WINDOW_YPOS{{System::Main, "Display", "RenderWindowYPos"}, -1};
|
||||
|
||||
@@ -191,6 +191,7 @@ bool ShouldUseDPL2Decoder();
|
||||
|
||||
extern const Info<std::string> MAIN_FULLSCREEN_DISPLAY_RES;
|
||||
extern const Info<bool> MAIN_FULLSCREEN;
|
||||
extern const Info<int> MAIN_FULLSCREEN_MONITOR;
|
||||
extern const Info<bool> MAIN_RENDER_TO_MAIN;
|
||||
extern const Info<int> MAIN_RENDER_WINDOW_XPOS;
|
||||
extern const Info<int> MAIN_RENDER_WINDOW_YPOS;
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QGuiApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QScreen>
|
||||
#include <QSignalBlocker>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -91,6 +93,18 @@ void GeneralWidget::CreateWidgets()
|
||||
video_layout->addWidget(m_custom_aspect_width, 3, 1);
|
||||
video_layout->addWidget(m_custom_aspect_height, 3, 2);
|
||||
|
||||
m_monitor_combo = new ToolTipComboBox;
|
||||
m_monitor_combo->addItem(tr("Primary Monitor"));
|
||||
const QList<QScreen*> screens = QGuiApplication::screens();
|
||||
for (int i = 0; i < screens.size(); i++)
|
||||
m_monitor_combo->addItem(tr("Monitor %1: %2").arg(i + 1).arg(screens[i]->name()));
|
||||
const int monitor_index = Config::Get(Config::MAIN_FULLSCREEN_MONITOR);
|
||||
if (monitor_index < m_monitor_combo->count())
|
||||
m_monitor_combo->setCurrentIndex(monitor_index);
|
||||
|
||||
video_layout->addWidget(new QLabel(tr("Fullscreen Monitor:")), 4, 0);
|
||||
video_layout->addWidget(m_monitor_combo, 4, 1, 1, -1);
|
||||
|
||||
auto* const basic_grid = new QGridLayout;
|
||||
video_layout->addLayout(basic_grid, video_layout->rowCount(), 0, 1, -1);
|
||||
basic_grid->addWidget(m_enable_vsync, 0, 0);
|
||||
@@ -156,6 +170,9 @@ void GeneralWidget::ConnectWidgets()
|
||||
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
|
||||
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||
});
|
||||
connect(m_monitor_combo, &QComboBox::currentIndexChanged, this, [](int index) {
|
||||
Config::SetBaseOrCurrent(Config::MAIN_FULLSCREEN_MONITOR, index);
|
||||
});
|
||||
connect(m_aspect_combo, &QComboBox::currentIndexChanged, this,
|
||||
&GeneralWidget::ToggleCustomAspectRatio);
|
||||
}
|
||||
@@ -308,6 +325,11 @@ void GeneralWidget::AddDescriptions()
|
||||
|
||||
m_adapter_combo->SetTitle(tr("Adapter"));
|
||||
|
||||
m_monitor_combo->SetTitle(tr("Fullscreen Monitor"));
|
||||
m_monitor_combo->SetDescription(
|
||||
tr("Selects which display to use for fullscreen.<br><br>"
|
||||
"<dolphin_emphasis>If unsure, select Primary Monitor.</dolphin_emphasis>"));
|
||||
|
||||
m_aspect_combo->SetTitle(tr("Aspect Ratio"));
|
||||
m_aspect_combo->SetDescription(tr(TR_ASPECT_RATIO_DESCRIPTION));
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ private:
|
||||
// Video
|
||||
ConfigStringChoice* m_backend_combo;
|
||||
ToolTipComboBox* m_adapter_combo;
|
||||
ToolTipComboBox* m_monitor_combo;
|
||||
ConfigChoice* m_aspect_combo;
|
||||
QLabel* m_custom_aspect_label;
|
||||
ConfigInteger* m_custom_aspect_width;
|
||||
|
||||
@@ -206,6 +206,14 @@ void RenderWidget::HandleCursorTimer()
|
||||
|
||||
void RenderWidget::showFullScreen()
|
||||
{
|
||||
const int monitor_index = Config::Get(Config::MAIN_FULLSCREEN_MONITOR);
|
||||
const QList<QScreen*> screens = QGuiApplication::screens();
|
||||
QScreen* const target_screen = (monitor_index > 0 && monitor_index <= screens.size())
|
||||
? screens[monitor_index - 1]
|
||||
: QGuiApplication::primaryScreen();
|
||||
if (monitor_index > 0)
|
||||
move(target_screen->availableGeometry().topLeft());
|
||||
|
||||
QWidget::showFullScreen();
|
||||
|
||||
QScreen* screen = window()->windowHandle()->screen();
|
||||
|
||||
Reference in New Issue
Block a user