Better screen layout support

This commit is contained in:
wheremyfoodat
2025-07-06 02:41:44 +03:00
parent 1c0f65c740
commit cf321b1ed8
17 changed files with 328 additions and 186 deletions

View File

@@ -240,6 +240,36 @@ ConfigWindow::ConfigWindow(ConfigCallback configCallback, MainWindowCallback win
connectCheckbox(hashTextures, config.hashTextures);
gpuLayout->addRow(hashTextures);
QComboBox* screenLayout = new QComboBox();
screenLayout->addItem(tr("Default"));
screenLayout->addItem(tr("Default (Flipped)"));
screenLayout->addItem(tr("Side-by-Side"));
screenLayout->addItem(tr("Side-by-Side (Flipped)"));
screenLayout->setCurrentIndex(static_cast<int>(config.screenLayout));
connect(screenLayout, &QComboBox::currentIndexChanged, this, [&](int index) {
config.screenLayout = static_cast<ScreenLayout::Layout>(index);
updateConfig();
});
gpuLayout->addRow(tr("Screen Layout"), screenLayout);
// Screen size slider widgets
QLabel* topScreenSizeLabel = new QLabel(QString::number(int(config.topScreenSize * 100)));
QSlider* topScreenSizeSlider = new QSlider(Qt::Horizontal);
topScreenSizeSlider->setRange(0, 100);
topScreenSizeSlider->setValue(int(config.topScreenSize * 100));
connect(topScreenSizeSlider, &QSlider::valueChanged, this, [this, topScreenSizeLabel](int value) {
config.topScreenSize = float(value) / 100.0f;
topScreenSizeLabel->setText(QString::number(value));
updateConfig();
});
QHBoxLayout* screenSizeLayout = new QHBoxLayout();
screenSizeLayout->setSpacing(4);
screenSizeLayout->addWidget(topScreenSizeSlider);
screenSizeLayout->addWidget(topScreenSizeLabel);
gpuLayout->addRow(tr("Top screen size (%)"), screenSizeLayout);
QCheckBox* forceShadergenForLights = new QCheckBox(tr("Force shadergen when rendering lights"));
connectCheckbox(forceShadergenForLights, config.forceShadergenForLights);
gpuLayout->addRow(forceShadergenForLights);
@@ -302,7 +332,7 @@ ConfigWindow::ConfigWindow(ConfigCallback configCallback, MainWindowCallback win
volumeSlider->setRange(0, 200);
volumeSlider->setValue(int(config.audioDeviceConfig.volumeRaw * 100));
connect(volumeSlider, &QSlider::valueChanged, this, [this, volumeLabel](int value) {
config.audioDeviceConfig.volumeRaw = static_cast<float>(value) / 100.0f;
config.audioDeviceConfig.volumeRaw = float(value) / 100.0f;
volumeLabel->setText(QString::number(value));
updateConfig();
@@ -467,12 +497,14 @@ void ConfigWindow::setTheme(Theme theme) {
p.setColor(QPalette::Highlight, QColor(42, 130, 218));
p.setColor(QPalette::HighlightedText, Qt::black);
qApp->setPalette(p);
qApp->setStyleSheet("QLineEdit {"
qApp->setStyleSheet(
"QLineEdit {"
"background-color: #000000; color: #ffffff; border: 1px solid #a0a0a0; "
"border-radius: 4px; padding: 5px; }"
"QCheckBox::indicator:unchecked {"
"border: 1px solid #808080; border-radius: 4px; }");
"border: 1px solid #808080; border-radius: 4px; }"
);
break;
}