Fix EDID UI

This commit is contained in:
Cacodemon345
2025-08-26 14:44:17 +06:00
parent da7a14b977
commit 918b33fdc4
2 changed files with 155 additions and 112 deletions

View File

@@ -17,8 +17,11 @@
#include "qt_settingsdisplay.hpp"
#include "ui_qt_settingsdisplay.h"
#include "qt_util.hpp"
#include <QDebug>
#include <QFileDialog>
#include <QStringBuilder>
extern "C" {
#include <86box/86box.h>
@@ -42,6 +45,9 @@ SettingsDisplay::SettingsDisplay(QWidget *parent)
for (uint8_t i = 0; i < GFXCARD_MAX; i ++)
videoCard[i] = gfxcard[i];
ui->lineEdit->setFilter(tr("EDID") % util::DlgFilter({ "bin", "dat", "edid" }) % tr("All files") % util::DlgFilter({ "*" }, true));
onCurrentMachineChanged(machine);
}
@@ -333,10 +339,10 @@ void SettingsDisplay::on_radioButtonCustom_clicked()
void SettingsDisplay::on_pushButtonExportDefault_clicked()
{
auto str = QFileDialog::getSaveFileName(this, tr("Export"));
auto str = QFileDialog::getSaveFileName(this, tr("Export EDID..."));
if (!str.isEmpty()) {
QFile file(str);
if (file.open(QFile::ReadOnly)) {
if (file.open(QFile::WriteOnly)) {
ssize_t size = 0;
auto bytes = ddc_create_default_edid(&size);
file.write((char*)bytes, size);

View File

@@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>399</height>
<height>466</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="2,1,1">
<layout class="QGridLayout" name="gridLayout" columnstretch="2,0,0">
<property name="leftMargin">
<number>0</number>
</property>
@@ -26,45 +26,10 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonConfigure8514">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxVoodoo">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonConfigureVoodoo">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureVideoSecondary">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox8514">
<property name="text">
<string>IBM 8514/A Graphics</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="checkBoxDa2">
<property name="text">
<string>IBM PS/55 Display Adapter Graphics</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxXga">
<property name="text">
<string>XGA Graphics</string>
<string>Voodoo 1 or 2 Graphics</string>
</property>
</widget>
</item>
@@ -75,16 +40,10 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox8514">
<property name="text">
<string>IBM 8514/A Graphics</string>
</property>
</widget>
</item>
@@ -101,10 +60,10 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxVoodoo">
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonConfigure8514">
<property name="text">
<string>Voodoo 1 or 2 Graphics</string>
<string>Configure</string>
</property>
</widget>
</item>
@@ -115,6 +74,102 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Monitor EDID</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButtonDefault">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonExportDefault">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Export...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SizeConstraint::SetNoConstraint</enum>
</property>
<item>
<widget class="QRadioButton" name="radioButtonCustom">
<property name="text">
<string>Custom</string>
</property>
</widget>
</item>
<item>
<widget class="FileField" name="lineEdit" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonConfigureVoodoo">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureVideo">
<property name="sizePolicy">
@@ -128,19 +183,6 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelVideo">
<property name="sizePolicy">
@@ -154,53 +196,48 @@
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureVideoSecondary">
<property name="text">
<string>Configure</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Monitor EDID</string>
<item row="1" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxXga">
<property name="text">
<string>XGA Graphics</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="checkBoxDa2">
<property name="text">
<string>IBM PS/55 Display Adapter Graphics</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SizeConstraint::SetFixedSize</enum>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="radioButtonDefault">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonExportDefault">
<property name="text">
<string>Export...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radioButtonCustom">
<property name="text">
<string>Custom</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="FileField" name="lineEdit" native="true"/>
</item>
</layout>
</widget>
</item>
</layout>