mirror of
https://github.com/86Box/86Box.git
synced 2026-02-21 17:15:32 -07:00
Manager: Reset the details area to initial state manually
instead of re-creating the widget when no machines are present
This commit is contained in:
@@ -122,6 +122,13 @@ VMManagerDetails::VMManagerDetails(QWidget *parent)
|
||||
}
|
||||
ui->ssNavTBHolder->setStyleSheet(toolButtonStyleSheet);
|
||||
|
||||
// Margins are a little different on macos
|
||||
#ifdef Q_OS_MACOS
|
||||
ui->systemLabel->setMargin(15);
|
||||
#else
|
||||
ui->systemLabel->setMargin(10);
|
||||
#endif
|
||||
|
||||
pauseIcon = QIcon(":/menuicons/qt/icons/pause.ico");
|
||||
runIcon = QIcon(":/menuicons/qt/icons/run.ico");
|
||||
|
||||
@@ -178,6 +185,61 @@ VMManagerDetails::~VMManagerDetails()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerDetails::reset()
|
||||
{
|
||||
systemSection->clear();
|
||||
videoSection->clear();
|
||||
storageSection->clear();
|
||||
audioSection->clear();
|
||||
networkSection->clear();
|
||||
inputSection->clear();
|
||||
portsSection->clear();
|
||||
otherSection->clear();
|
||||
systemSection->setSections();
|
||||
videoSection->setSections();
|
||||
storageSection->setSections();
|
||||
audioSection->setSections();
|
||||
networkSection->setSections();
|
||||
inputSection->setSections();
|
||||
portsSection->setSections();
|
||||
otherSection->setSections();
|
||||
|
||||
ui->screenshotNext->setEnabled(false);
|
||||
ui->screenshotPrevious->setEnabled(false);
|
||||
ui->screenshotNextTB->setEnabled(false);
|
||||
ui->screenshotPreviousTB->setEnabled(false);
|
||||
ui->screenshot->setPixmap(QString());
|
||||
ui->screenshot->setFixedSize(240, 160);
|
||||
ui->screenshot->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
||||
ui->screenshot->setText(tr("No screenshot"));
|
||||
ui->screenshot->setEnabled(false);
|
||||
ui->screenshot->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
#ifdef Q_OS_WINDOWS
|
||||
if (!util::isWindowsLightTheme()) {
|
||||
ui->screenshot->setStyleSheet(SCREENSHOTBORDER_STYLESHEET_DARK);
|
||||
} else {
|
||||
ui->screenshot->setStyleSheet("");
|
||||
}
|
||||
#endif
|
||||
|
||||
startPauseButton->setEnabled(false);
|
||||
resetButton->setEnabled(false);
|
||||
stopButton->setEnabled(false);
|
||||
configureButton->setEnabled(false);
|
||||
cadButton->setEnabled(false);
|
||||
|
||||
ui->systemLabel->setText(tr("No Machines Found!"));
|
||||
ui->systemLabel->setStyleSheet("");
|
||||
ui->statusLabel->setText("");
|
||||
ui->scrollArea->setStyleSheet("");
|
||||
|
||||
ui->notesTextEdit->setPlainText("");
|
||||
ui->notesTextEdit->setEnabled(false);
|
||||
|
||||
sysconfig = new VMManagerSystem();
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig)
|
||||
{
|
||||
@@ -191,12 +253,6 @@ VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig)
|
||||
ui->scrollArea->setStyleSheet(SCROLLAREA_STYLESHEET_LIGHT);
|
||||
ui->systemLabel->setStyleSheet(SYSTEMLABEL_STYLESHEET_LIGHT);
|
||||
}
|
||||
// Margins are a little different on macos
|
||||
#ifdef Q_OS_MACOS
|
||||
ui->systemLabel->setMargin(15);
|
||||
#else
|
||||
ui->systemLabel->setMargin(10);
|
||||
#endif
|
||||
|
||||
// disconnect old signals before assigning the passed systemconfig object
|
||||
disconnect(startPauseButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::startButtonPressed);
|
||||
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
|
||||
~VMManagerDetails() override;
|
||||
|
||||
void reset();
|
||||
|
||||
void updateData(VMManagerSystem *passed_sysconfig);
|
||||
|
||||
void updateProcessStatus();
|
||||
|
||||
@@ -734,12 +734,9 @@ VMManagerMain::deleteSystem(VMManagerSystem *sysconfig)
|
||||
delete sysconfig;
|
||||
|
||||
if (vm_model->rowCount(QModelIndex()) <= 0) {
|
||||
selected_sysconfig = new VMManagerSystem();
|
||||
/* no machines left - get rid of the last machine's leftovers */
|
||||
ui->detailsArea->layout()->removeWidget(vm_details);
|
||||
delete vm_details;
|
||||
vm_details = new VMManagerDetails();
|
||||
ui->detailsArea->layout()->addWidget(vm_details);
|
||||
selected_sysconfig = new VMManagerSystem();
|
||||
vm_details->reset();
|
||||
/* tell the mainwindow to disable the toolbar buttons */
|
||||
emit selectionOrStateChanged(nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user