Remove getPaths() usage from LastRunCrashDialog

This commit is contained in:
Rasmus Karlsson 2024-01-15 23:41:46 +01:00
parent 3f599ea609
commit a2e91770e8
3 changed files with 7 additions and 7 deletions

View file

@ -98,9 +98,9 @@ namespace {
installCustomPalette(); installCustomPalette();
} }
void showLastCrashDialog(const Args &args) void showLastCrashDialog(const Args &args, const Paths &paths)
{ {
auto *dialog = new LastRunCrashDialog(args); auto *dialog = new LastRunCrashDialog(args, paths);
// Use exec() over open() to block the app from being loaded // Use exec() over open() to block the app from being loaded
// and to be able to set the safe mode. // and to be able to set the safe mode.
dialog->exec(); dialog->exec();
@ -233,7 +233,7 @@ void runGui(QApplication &a, const Paths &paths, Settings &settings,
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (args.crashRecovery) if (args.crashRecovery)
{ {
showLastCrashDialog(args); showLastCrashDialog(args, paths);
} }
#endif #endif

View file

@ -43,7 +43,7 @@ namespace chatterino {
using namespace literals; using namespace literals;
LastRunCrashDialog::LastRunCrashDialog(const Args &args) LastRunCrashDialog::LastRunCrashDialog(const Args &args, const Paths &paths)
{ {
this->setWindowFlag(Qt::WindowContextHelpButtonHint, false); this->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
this->setWindowTitle(u"Chatterino - " % randomMessage()); 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>"; "<i>You can disable automatic restarts in the settings.</i><br><br>";
#ifdef CHATTERINO_WITH_CRASHPAD #ifdef CHATTERINO_WITH_CRASHPAD
auto reportsDir = auto reportsDir = QDir(paths.crashdumpDirectory).filePath(u"reports"_s);
QDir(getPaths()->crashdumpDirectory).filePath(u"reports"_s);
text += u"A <b>crash report</b> has been saved to " text += u"A <b>crash report</b> has been saved to "
"<a href=\"file:///" % "<a href=\"file:///" %
reportsDir % u"\">" % reportsDir % u"</a>.<br>"; reportsDir % u"\">" % reportsDir % u"</a>.<br>";

View file

@ -5,11 +5,12 @@
namespace chatterino { namespace chatterino {
class Args; class Args;
class Paths;
class LastRunCrashDialog : public QDialog class LastRunCrashDialog : public QDialog
{ {
public: public:
explicit LastRunCrashDialog(const Args &args); explicit LastRunCrashDialog(const Args &args, const Paths &paths);
}; };
} // namespace chatterino } // namespace chatterino