refactor: Un-singletonize Paths & Updates (#5092)
This commit is contained in:
@@ -43,7 +43,7 @@ namespace chatterino {
|
||||
|
||||
using namespace literals;
|
||||
|
||||
LastRunCrashDialog::LastRunCrashDialog(const Args &args)
|
||||
LastRunCrashDialog::LastRunCrashDialog(const Args &args, const Paths &paths)
|
||||
{
|
||||
this->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
this->setWindowTitle(u"Chatterino - " % randomMessage());
|
||||
@@ -56,8 +56,7 @@ LastRunCrashDialog::LastRunCrashDialog(const Args &args)
|
||||
"<i>You can disable automatic restarts in the settings.</i><br><br>";
|
||||
|
||||
#ifdef CHATTERINO_WITH_CRASHPAD
|
||||
auto reportsDir =
|
||||
QDir(getPaths()->crashdumpDirectory).filePath(u"reports"_s);
|
||||
auto reportsDir = QDir(paths.crashdumpDirectory).filePath(u"reports"_s);
|
||||
text += u"A <b>crash report</b> has been saved to "
|
||||
"<a href=\"file:///" %
|
||||
reportsDir % u"\">" % reportsDir % u"</a>.<br>";
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
namespace chatterino {
|
||||
|
||||
class Args;
|
||||
class Paths;
|
||||
|
||||
class LastRunCrashDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
explicit LastRunCrashDialog(const Args &args);
|
||||
explicit LastRunCrashDialog(const Args &args, const Paths &paths);
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "UpdateDialog.hpp"
|
||||
#include "widgets/dialogs/UpdateDialog.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "singletons/Updates.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
#include "widgets/Label.hpp"
|
||||
@@ -26,7 +27,7 @@ UpdateDialog::UpdateDialog()
|
||||
auto *dismiss = buttons->addButton("Dismiss", QDialogButtonBox::RejectRole);
|
||||
|
||||
QObject::connect(install, &QPushButton::clicked, this, [this] {
|
||||
Updates::instance().installUpdates();
|
||||
getIApp()->getUpdates().installUpdates();
|
||||
this->close();
|
||||
});
|
||||
QObject::connect(dismiss, &QPushButton::clicked, this, [this] {
|
||||
@@ -34,8 +35,8 @@ UpdateDialog::UpdateDialog()
|
||||
this->close();
|
||||
});
|
||||
|
||||
this->updateStatusChanged(Updates::instance().getStatus());
|
||||
this->connections_.managedConnect(Updates::instance().statusUpdated,
|
||||
this->updateStatusChanged(getIApp()->getUpdates().getStatus());
|
||||
this->connections_.managedConnect(getIApp()->getUpdates().statusUpdated,
|
||||
[this](auto status) {
|
||||
this->updateStatusChanged(status);
|
||||
});
|
||||
@@ -52,17 +53,17 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
|
||||
{
|
||||
case Updates::UpdateAvailable: {
|
||||
this->ui_.label->setText((
|
||||
Updates::instance().isDowngrade()
|
||||
getIApp()->getUpdates().isDowngrade()
|
||||
? QString(
|
||||
"The version online (%1) seems to be\nlower than the "
|
||||
"current (%2).\nEither a version was reverted or "
|
||||
"you are\nrunning a newer build.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(Updates::instance().getOnlineVersion(),
|
||||
Updates::instance().getCurrentVersion())
|
||||
.arg(getIApp()->getUpdates().getOnlineVersion(),
|
||||
getIApp()->getUpdates().getCurrentVersion())
|
||||
: QString("An update (%1) is available.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(Updates::instance().getOnlineVersion())));
|
||||
.arg(getIApp()->getUpdates().getOnlineVersion())));
|
||||
this->updateGeometry();
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user