mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 10:28:19 -07:00
Revert "Manager: Improve machine load times by caching details labels"
This reverts commit 9366ddd60d.
This commit is contained in:
@@ -263,8 +263,6 @@ VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig)
|
|||||||
// * First you clear it with VMManagerDetailSection::clear()
|
// * First you clear it with VMManagerDetailSection::clear()
|
||||||
// * Then you add each line with VMManagerDetailSection::addSection()
|
// * Then you add each line with VMManagerDetailSection::addSection()
|
||||||
|
|
||||||
setUpdatesEnabled(false);
|
|
||||||
|
|
||||||
// System
|
// System
|
||||||
systemSection->clear();
|
systemSection->clear();
|
||||||
systemSection->addSection("Machine", passed_sysconfig->getDisplayValue(VMManager::Display::Name::Machine));
|
systemSection->addSection("Machine", passed_sysconfig->getDisplayValue(VMManager::Display::Name::Machine));
|
||||||
@@ -322,8 +320,6 @@ VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig)
|
|||||||
inputSection->setSections();
|
inputSection->setSections();
|
||||||
portsSection->setSections();
|
portsSection->setSections();
|
||||||
otherSection->setSections();
|
otherSection->setSections();
|
||||||
|
|
||||||
setUpdatesEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ VMManagerDetailSection::
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
frameGridLayout = new QGridLayout();
|
frameGridLayout = new QGridLayout();
|
||||||
frameGridLayout->setContentsMargins(getMargins(MarginSection::DisplayGrid));
|
|
||||||
ui->detailFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
|
||||||
ui->detailFrame->setLayout(frameGridLayout);
|
|
||||||
|
|
||||||
// Create the collapse button, set the name and add it to the layout
|
// Create the collapse button, set the name and add it to the layout
|
||||||
collapseButton = new CollapseButton();
|
collapseButton = new CollapseButton();
|
||||||
setSectionName(sectionName);
|
setSectionName(sectionName);
|
||||||
@@ -132,8 +128,6 @@ VMManagerDetailSection::
|
|||||||
innerFrameLayout->addWidget(buttonWidget);
|
innerFrameLayout->addWidget(buttonWidget);
|
||||||
innerFrameLayout->addWidget(frame);
|
innerFrameLayout->addWidget(frame);
|
||||||
setLayout(outerFrameLayout);
|
setLayout(outerFrameLayout);
|
||||||
|
|
||||||
usedRows = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VMManagerDetailSection::~VMManagerDetailSection()
|
VMManagerDetailSection::~VMManagerDetailSection()
|
||||||
@@ -162,7 +156,6 @@ VMManagerDetailSection::setupMainLayout()
|
|||||||
delete mainLayout;
|
delete mainLayout;
|
||||||
mainLayout = new QVBoxLayout;
|
mainLayout = new QVBoxLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VMManagerDetailSection::setSections()
|
VMManagerDetailSection::setSections()
|
||||||
{
|
{
|
||||||
@@ -179,71 +172,52 @@ VMManagerDetailSection::setSections()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto item = frameGridLayout->itemAtPosition(row, 1);
|
const auto labelValue = new QLabel();
|
||||||
auto label = item ? ((QLabel *) item->widget()) : nullptr;
|
labelValue->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
if (label) {
|
labelValue->setTextInteractionFlags(labelValue->textInteractionFlags() | Qt::TextSelectableByMouse);
|
||||||
label->setVisible(true);
|
labelValue->setText(line);
|
||||||
} else {
|
frameGridLayout->addWidget(labelValue, row, 1, Qt::AlignLeft);
|
||||||
label = new QLabel();
|
|
||||||
label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
|
||||||
label->setTextInteractionFlags(label->textInteractionFlags() | Qt::TextSelectableByMouse);
|
|
||||||
frameGridLayout->addWidget(label, row, 1, Qt::AlignLeft);
|
|
||||||
}
|
|
||||||
label->setText(line);
|
|
||||||
|
|
||||||
item = frameGridLayout->itemAtPosition(row, 0);
|
|
||||||
if (!labelKey) {
|
if (!labelKey) {
|
||||||
if (item)
|
labelKey = new QLabel();
|
||||||
labelKey = (QLabel *) item->widget();
|
labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
if (labelKey) {
|
labelKey->setTextInteractionFlags(labelValue->textInteractionFlags());
|
||||||
labelKey->setVisible(true);
|
|
||||||
} else {
|
|
||||||
labelKey = new QLabel();
|
|
||||||
labelKey->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
|
||||||
labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data()));
|
|
||||||
frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft);
|
|
||||||
}
|
|
||||||
labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data()));
|
labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data()));
|
||||||
} else if (item) {
|
frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft);
|
||||||
label = (QLabel *) item->widget();
|
|
||||||
if (label)
|
|
||||||
label->setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
item = frameGridLayout->itemAtPosition(row, 2);
|
|
||||||
if (!item || !item->widget()) {
|
|
||||||
const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
||||||
frameGridLayout->addItem(hSpacer, row, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
frameGridLayout->addItem(hSpacer, row, 2);
|
||||||
empty = false;
|
empty = false;
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int prevUsedRows = usedRows;
|
|
||||||
usedRows = row;
|
|
||||||
for (; row < prevUsedRows; row++) {
|
|
||||||
for (int i = 0; i <= 2; i++) {
|
|
||||||
auto item = frameGridLayout->itemAtPosition(row, i);
|
|
||||||
if (item) {
|
|
||||||
auto widget = item->widget();
|
|
||||||
if (widget)
|
|
||||||
widget->setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
collapseButton->setContent(ui->detailFrame);
|
collapseButton->setContent(ui->detailFrame);
|
||||||
if (!empty)
|
if (!empty)
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VMManagerDetailSection::clear()
|
VMManagerDetailSection::clear()
|
||||||
{
|
{
|
||||||
sections.clear();
|
sections.clear();
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
||||||
|
// Clear everything out
|
||||||
|
if (frameGridLayout) {
|
||||||
|
while (frameGridLayout->count()) {
|
||||||
|
QLayoutItem *cur_item = frameGridLayout->takeAt(0);
|
||||||
|
if (cur_item->widget())
|
||||||
|
delete cur_item->widget();
|
||||||
|
delete cur_item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete frameGridLayout;
|
||||||
|
frameGridLayout = new QGridLayout();
|
||||||
|
frameGridLayout->setContentsMargins(getMargins(MarginSection::DisplayGrid));
|
||||||
|
ui->detailFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
|
ui->detailFrame->setLayout(frameGridLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ private:
|
|||||||
static QMargins getMargins(MarginSection section);
|
static QMargins getMargins(MarginSection section);
|
||||||
|
|
||||||
QString sectionName;
|
QString sectionName;
|
||||||
int usedRows;
|
|
||||||
|
|
||||||
struct DetailSection {
|
struct DetailSection {
|
||||||
QString name;
|
QString name;
|
||||||
|
|||||||
Reference in New Issue
Block a user