refactor: Un-singletonize Paths & Updates (#5092)

This commit is contained in:
pajlada
2024-01-16 21:56:43 +01:00
committed by GitHub
parent 7f935665f9
commit 718696db53
60 changed files with 237 additions and 165 deletions
+6 -5
View File
@@ -1,5 +1,6 @@
#include "util/InitUpdateButton.hpp"
#include "Application.hpp"
#include "widgets/dialogs/UpdateDialog.hpp"
#include "widgets/helper/Button.hpp"
@@ -40,7 +41,7 @@ void initUpdateButton(Button &button,
}
break;
case UpdateDialog::Install: {
Updates::instance().installUpdates();
getIApp()->getUpdates().installUpdates();
}
break;
}
@@ -52,17 +53,17 @@ void initUpdateButton(Button &button,
// update image when state changes
auto updateChange = [&button](auto) {
button.setVisible(Updates::instance().shouldShowUpdateButton());
button.setVisible(getIApp()->getUpdates().shouldShowUpdateButton());
const auto *imageUrl = Updates::instance().isError()
const auto *imageUrl = getIApp()->getUpdates().isError()
? ":/buttons/updateError.png"
: ":/buttons/update.png";
button.setPixmap(QPixmap(imageUrl));
};
updateChange(Updates::instance().getStatus());
updateChange(getIApp()->getUpdates().getStatus());
signalHolder.managedConnect(Updates::instance().statusUpdated,
signalHolder.managedConnect(getIApp()->getUpdates().statusUpdated,
[updateChange](auto status) {
updateChange(status);
});