This commit is contained in:
OBattler
2025-08-20 23:56:24 +02:00
2 changed files with 31 additions and 55 deletions

View File

@@ -267,20 +267,20 @@ VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig) {
// Input
inputSection->clear();
inputSection->addSection(tr("Keyboard"), passed_sysconfig->getDisplayValue(Display::Name::Keyboard));
inputSection->addSection(tr("Mouse"), passed_sysconfig->getDisplayValue(Display::Name::Mouse));
inputSection->addSection(tr("Joystick"), passed_sysconfig->getDisplayValue(Display::Name::Joystick));
inputSection->addSection("Keyboard", passed_sysconfig->getDisplayValue(Display::Name::Keyboard));
inputSection->addSection("Mouse", passed_sysconfig->getDisplayValue(Display::Name::Mouse));
inputSection->addSection("Joystick", passed_sysconfig->getDisplayValue(Display::Name::Joystick));
// Ports
portsSection->clear();
portsSection->addSection(tr("Serial ports"), passed_sysconfig->getDisplayValue(Display::Name::Serial));
portsSection->addSection(tr("Parallel ports"), passed_sysconfig->getDisplayValue(Display::Name::Parallel));
portsSection->addSection("Serial ports", passed_sysconfig->getDisplayValue(Display::Name::Serial));
portsSection->addSection("Parallel ports", passed_sysconfig->getDisplayValue(Display::Name::Parallel));
// Other devices
otherSection->clear();
otherSection->addSection(tr("ISA RTC"), passed_sysconfig->getDisplayValue(Display::Name::IsaRtc));
otherSection->addSection(tr("ISA RAM"), passed_sysconfig->getDisplayValue(Display::Name::IsaMem));
otherSection->addSection(tr("ISA ROM"), passed_sysconfig->getDisplayValue(Display::Name::IsaRom));
otherSection->addSection("ISA RTC", passed_sysconfig->getDisplayValue(Display::Name::IsaRtc));
otherSection->addSection("ISA RAM", passed_sysconfig->getDisplayValue(Display::Name::IsaMem));
otherSection->addSection("ISA ROM", passed_sysconfig->getDisplayValue(Display::Name::IsaRom));
systemSection->setSections();
videoSection->setSections();

View File

@@ -157,58 +157,36 @@ VMManagerDetailSection::setSections()
{
int row = 0;
for (const auto& section : sections) {
QStringList sectionsToAdd = section.value.split(sectionSeparator);
QLabel *labelKey = nullptr;
for ( const auto& section : sections) {
// if the string contains the separator (defined elsewhere) then split and
// add each entry on a new line. Otherwise, just add the one.
QStringList sectionsToAdd;
if(section.value.contains(sectionSeparator)) {
sectionsToAdd = section.value.split(sectionSeparator);
} else {
sectionsToAdd.push_back(section.value);
}
bool keyAdded = false;
// Reduce the text size for the label
// First, get the existing font
auto reference_label = new QLabel();
auto smaller_font = reference_label->font();
// Get a smaller size
// Not sure if I like the smaller size, back to regular for now
// auto smaller_size = 0.85 * smaller_font.pointSize();
const auto smaller_size = 1 * smaller_font.pointSize();
// Set the font to the smaller size
smaller_font.setPointSizeF(smaller_size);
delete reference_label;
for(const auto&line : sectionsToAdd) {
if(line.isEmpty()) {
for (const auto& line : sectionsToAdd) {
if (line.isEmpty()) {
// Don't bother adding entries if the values are blank
continue;
}
const auto labelKey = new QLabel();
labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
const auto labelValue = new QLabel();
labelKey->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
labelValue->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
labelValue->setTextInteractionFlags(labelValue->textInteractionFlags() | Qt::TextSelectableByMouse);
labelKey->setTextInteractionFlags(labelValue->textInteractionFlags() | Qt::TextSelectableByMouse);
// Assign that new, smaller font to the label
labelKey->setFont(smaller_font);
labelValue->setFont(smaller_font);
labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data()));
labelValue->setText(line);
if(!keyAdded) {
frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft);
keyAdded = true;
}
frameGridLayout->addWidget(labelValue, row, 1, Qt::AlignLeft);
if (!labelKey) {
labelKey = new QLabel();
labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
labelKey->setTextInteractionFlags(labelValue->textInteractionFlags());
labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data()));
frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft);
}
const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
frameGridLayout->addItem(hSpacer, row, 2);
row++;
}
}
collapseButton->setContent(ui->detailFrame);
if (sections.size())
setVisible(true);
@@ -231,8 +209,6 @@ VMManagerDetailSection::clear()
delete frameGridLayout;
frameGridLayout = new QGridLayout();
qint32 *left = nullptr, *top = nullptr, *right = nullptr, *bottom = nullptr;
frameGridLayout->getContentsMargins(left, top, right, bottom);
frameGridLayout->setContentsMargins(getMargins(MarginSection::DisplayGrid));
ui->detailFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
ui->detailFrame->setLayout(frameGridLayout);
@@ -283,7 +259,7 @@ void CollapseButton::setButtonText(const QString &text) {
void CollapseButton::setContent(QWidget *content) {
assert(content != nullptr);
content_ = content;
/*const auto animation_ = new QPropertyAnimation(content_, "maximumHeight"); // QObject with auto delete
const auto animation_ = new QPropertyAnimation(content_, "maximumHeight"); // QObject with auto delete
animation_->setStartValue(0);
animation_->setEasingCurve(QEasingCurve::InOutQuad);
animation_->setDuration(300);
@@ -293,16 +269,16 @@ void CollapseButton::setContent(QWidget *content) {
animator_.addAnimation(animation_);
if (!isChecked()) {
content->setMaximumHeight(0);
}*/
}
}
void CollapseButton::hideContent() {
/*animator_.setDirection(QAbstractAnimation::Backward);
animator_.start();*/
animator_.setDirection(QAbstractAnimation::Backward);
animator_.start();
}
void CollapseButton::showContent() {
/*animator_.setDirection(QAbstractAnimation::Forward);
animator_.start();*/
animator_.setDirection(QAbstractAnimation::Forward);
animator_.start();
}