qt: Fix status bar icons ignoring update activity setting.

Disabling status bar icons activity was left unimplemented on qt.
Prevent refreshing the icons and clear their activity status on setting
change.
This commit is contained in:
ts-korhonen
2022-12-09 22:13:15 +02:00
parent d6ceb23fee
commit 975426e3fc
3 changed files with 25 additions and 0 deletions

View File

@@ -366,6 +366,10 @@ hdd_count(int bus)
void
MachineStatus::refreshIcons()
{
/* Check if icons should show activity. */
if (!update_icons)
return;
for (size_t i = 0; i < FDD_NUM; ++i) {
d->fdd[i].setActive(machine_status.fdd[i].active);
d->fdd[i].setEmpty(machine_status.fdd[i].empty);
@@ -399,6 +403,23 @@ MachineStatus::refreshIcons()
}
}
void
MachineStatus::clearActivity()
{
for (auto &fdd : d->fdd)
fdd.setActive(false);
for (auto &cdrom : d->cdrom)
cdrom.setActive(false);
for (auto &zip : d->zip)
zip.setActive(false);
for (auto &mo : d->mo)
mo.setActive(false);
for (auto &hdd : d->hdds)
hdd.setActive(false);
for (auto &net : d->net)
net.setActive(false);
}
void
MachineStatus::refresh(QStatusBar *sbar)
{

View File

@@ -70,6 +70,7 @@ public:
static void iterateNIC(const std::function<void(int i)> &cb);
QString getMessage();
void clearActivity();
public slots:
void refresh(QStatusBar *sbar);
void message(const QString &msg);

View File

@@ -2231,6 +2231,9 @@ MainWindow::on_actionUpdate_status_bar_icons_triggered()
{
update_icons ^= 1;
ui->actionUpdate_status_bar_icons->setChecked(update_icons);
/* Prevent icons staying when disabled during activity. */
status->clearActivity();
}
void