Skip to content

Commit 2d06443

Browse files
committed
Implement optional crash reporter + fix singleinstancemonitor
1 parent 44b5726 commit 2d06443

File tree

16 files changed

+1410
-32
lines changed

16 files changed

+1410
-32
lines changed

src/MainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ void MainWindow::launchFirstRunSetup()
12521252
{
12531253
QHBoxLayout *lbLayout = new QHBoxLayout;
12541254
QMessageOverlay *lightBox = new QMessageOverlay(this);
1255-
FirstLaunchWizard *wiz = new FirstLaunchWizard(_audioService, lightBox);
1255+
FirstLaunchWizard *wiz = new FirstLaunchWizard(lightBox);
12561256
QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect(lightBox);
12571257
QPropertyAnimation *a = new QPropertyAnimation(eff, "opacity");
12581258

src/config/AppConfig.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ AppConfig::AppConfig()
3939
DEFINE_KEY(VdcDefaultPath, ENCLOSE_QUOTES(getPath("vdc")));
4040
DEFINE_KEY(LiveprogDefaultPath, ENCLOSE_QUOTES(getPath("liveprog")));
4141

42+
DEFINE_KEY(SendCrashReports, true);
43+
4244
connect(this, &AppConfig::updated, this, &AppConfig::notify);
4345

4446
load();

src/config/AppConfig.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ class AppConfig :
6767

6868
ConvolverDefaultPath,
6969
VdcDefaultPath,
70-
LiveprogDefaultPath
70+
LiveprogDefaultPath,
71+
72+
SendCrashReports
7173
};
7274
Q_ENUM(Key);
7375

src/crash/airbag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static void sigHandler(int sigNum, siginfo_t *si, void *ucontext)
859859
safe_printf(fd, "\n");
860860
printBacktrace(s_fd,s_execname);
861861
char sh[512] = {0};
862-
(void)sprintf(sh,"{ echo '%sSystem:' & cat /proc/version & lsb_release -a; } >> %s", section, STACKTRACE_LOG);
862+
(void)sprintf(sh,"{ echo '%sSystem:'; cat /proc/version; cat /var/lib/dbus/machine-id; lsb_release -a; } >> %s", section, STACKTRACE_LOG);
863863
(void)system(sh);
864864

865865
if (s_cb)

src/crash/stacktrace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static void * OFFSET_FRAMES_BUFFER[STACK_FRAMES_BUFFERSIZE];
2323
static char const * EXECUTION_FILENAME;
2424
static int LOG_FD = 2;
2525
static char const * STACKTRACE_LOG = "/tmp/jamesdsp/crash.dmp";
26+
static char const * STACKTRACE_LOG_OLD = "/tmp/jamesdsp/crash-prev.dmp";
2627
/*-----------------------------------------------------------------------------------*/
2728
/*
2829
* Use add2line on the obtained addresses to get a readable sting

src/interface/fragment/FirstLaunchWizard.cpp

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <IAudioService.h>
2-
31
#include "FirstLaunchWizard.h"
42
#include "ui_FirstLaunchWizard.h"
53

@@ -16,33 +14,43 @@
1614
#include <QTimer>
1715
#include <QUrl>
1816

19-
FirstLaunchWizard::FirstLaunchWizard(IAudioService *audioService, QWidget *parent) :
17+
FirstLaunchWizard::FirstLaunchWizard(QWidget *parent) :
2018
QWidget(parent),
21-
ui(new Ui::FirstLaunchWizard),
22-
audioService(audioService)
19+
ui(new Ui::FirstLaunchWizard)
2320
{
2421
ui->setupUi(this);
2522
ui->stackedWidget->setCurrentIndex(0);
2623

27-
QTimer::singleShot(500, [&] {
24+
QTimer::singleShot(500, this, [=] {
2825
ui->p1_icon->startAnimation();
2926
});
30-
ui->p3_icon->startAnimation();
31-
ui->p4_icon->startAnimation();
27+
ui->p3_icon->startAnimation();
28+
ui->p3b_icon->startAnimation();
29+
ui->p4_icon->startAnimation();
3230

3331
ui->stackedWidget->setAnimation(QEasingCurve::Type::OutCirc);
34-
connect(ui->p1_next, &QPushButton::clicked, [&] {
32+
connect(ui->p1_next, &QPushButton::clicked, this, [&] {
3533
ui->stackedWidget->slideInIdx(1);
3634
});
37-
connect(ui->p3_next, &QPushButton::clicked, [&] {
35+
connect(ui->p3_next, &QPushButton::clicked, this, [&] {
3836
ui->stackedWidget->slideInIdx(2);
3937
});
40-
connect(ui->p4_next, &QPushButton::clicked, [&] {
38+
connect(ui->p3b_next, &QPushButton::clicked, this, [&] {
39+
ui->stackedWidget->slideInIdx(3);
40+
});
41+
connect(ui->p4_next, &QPushButton::clicked, this, [&] {
4142
emit wizardFinished();
4243
});
43-
connect(ui->p4_telegram, &QPushButton::clicked, [&] {
44+
connect(ui->p4_telegram, &QPushButton::clicked, [] {
4445
QDesktopServices::openUrl(QUrl("https://t.me/joinchat/FTKC2A2bolHkFAyO-fuPjw"));
45-
});
46+
});
47+
48+
connect(ui->p3b_viewReports, &QPushButton::clicked, [] {
49+
QDesktopServices::openUrl(QUrl("https://gist.github.com/ThePBone/3c757623c31400e799ab786ad3bf0709"));
50+
});
51+
52+
ui->p3b_rejectReports->setChecked(!AppConfig::instance().get<bool>(AppConfig::SendCrashReports));
53+
ui->p3b_allowReports->setChecked(AppConfig::instance().get<bool>(AppConfig::SendCrashReports));
4654

4755
ui->p3_systray_disable->setChecked(!AppConfig::instance().get<bool>(AppConfig::TrayIconEnabled));
4856
ui->p3_systray_enable->setChecked(AppConfig::instance().get<bool>(AppConfig::TrayIconEnabled));
@@ -54,6 +62,9 @@ FirstLaunchWizard::FirstLaunchWizard(IAudioService *audioService, QWidget *paren
5462
connect(ui->p3_systray_disable, &QRadioButton::clicked, this, &FirstLaunchWizard::onSystrayRadioSelected);
5563
connect(ui->p3_systray_enable, &QRadioButton::clicked, this, &FirstLaunchWizard::onSystrayRadioSelected);
5664
connect(ui->p3_systray_minOnBoot, &QCheckBox::stateChanged, this, &FirstLaunchWizard::onSystrayAutostartToggled);
65+
66+
connect(ui->p3b_rejectReports, &QRadioButton::clicked, this, &FirstLaunchWizard::onCrashReportRadioSelected);
67+
connect(ui->p3b_allowReports, &QRadioButton::clicked, this, &FirstLaunchWizard::onCrashReportRadioSelected);
5768
}
5869

5970
FirstLaunchWizard::~FirstLaunchWizard()
@@ -72,11 +83,6 @@ void FirstLaunchWizard::showEvent(QShowEvent *ev)
7283

7384
void FirstLaunchWizard::onSystrayRadioSelected()
7485
{
75-
if (lockslot)
76-
{
77-
return;
78-
}
79-
8086
AppConfig::instance().set(AppConfig::TrayIconEnabled, ui->p3_systray_enable->isChecked());
8187
ui->p3_systray_minOnBoot->setEnabled(ui->p3_systray_enable->isChecked());
8288
}
@@ -95,3 +101,8 @@ void FirstLaunchWizard::onSystrayAutostartToggled(bool isChecked)
95101
QFile(path).remove();
96102
}
97103
}
104+
105+
void FirstLaunchWizard::onCrashReportRadioSelected()
106+
{
107+
AppConfig::instance().set(AppConfig::SendCrashReports, ui->p3b_allowReports->isChecked());
108+
}

src/interface/fragment/FirstLaunchWizard.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class FirstLaunchWizard :
1717
Q_OBJECT
1818

1919
public:
20-
explicit FirstLaunchWizard(IAudioService *audioService,QWidget *parent = nullptr);
20+
explicit FirstLaunchWizard(QWidget *parent = nullptr);
2121
~FirstLaunchWizard();
2222

2323
protected:
@@ -29,11 +29,10 @@ class FirstLaunchWizard :
2929
private slots:
3030
void onSystrayRadioSelected();
3131
void onSystrayAutostartToggled(bool isChecked);
32+
void onCrashReportRadioSelected();
3233

3334
private:
34-
Ui::FirstLaunchWizard *ui;
35-
bool lockslot = false;
36-
IAudioService* audioService;
35+
Ui::FirstLaunchWizard *ui;
3736

3837
};
3938

0 commit comments

Comments
 (0)