Skip to content

Commit 4556a14

Browse files
committed
Add setting entries for crash reports + autoeq db
1 parent 4399423 commit 4556a14

File tree

5 files changed

+100
-4
lines changed

5 files changed

+100
-4
lines changed

src/interface/fragment/SettingsFragment.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include "MainWindow.h"
1313
#include "utils/AutoStartManager.h"
1414

15+
#include <AeqSelector.h>
16+
17+
#include <AeqPackageManager.h>
1518
#include <QCloseEvent>
1619
#include <QDebug>
1720
#include <QDesktopServices>
@@ -98,6 +101,12 @@ SettingsFragment::SettingsFragment(TrayIcon *trayIcon,
98101
connect(ui->liveprog_extractNow, &QPushButton::clicked, this, &SettingsFragment::onExtractAssetsClicked);
99102
connect(ui->savePaths, &QPushButton::clicked, this, &SettingsFragment::onSavePathsClicked);
100103

104+
/*
105+
* Network signals
106+
*/
107+
connect(ui->crashShareAllow, &QCheckBox::toggled, this, &SettingsFragment::onCrashShareToggled);
108+
connect(ui->aeqManage, &QPushButton::clicked, this, &SettingsFragment::onAeqDatabaseManageClicked);
109+
101110
/*
102111
* Devices signals
103112
*/
@@ -238,6 +247,10 @@ void SettingsFragment::refreshAll()
238247

239248
ui->blocklistInvert->setChecked(AppConfig::instance().get<bool>(AppConfig::AudioAppBlocklistInvert));
240249

250+
ui->crashShareAllow->setChecked(AppConfig::instance().get<bool>(AppConfig::SendCrashReports));
251+
252+
ui->aeqStatus->setText(AeqPackageManager().isPackageInstalled() ? "installed" : "not installed");
253+
241254
refreshDevices();
242255

243256
_lockslot = false;
@@ -295,7 +308,7 @@ void SettingsFragment::onTreeItemSelected(QTreeWidgetItem *cur, QTreeWidgetItem
295308
case -1:
296309
if (cur->text(0) == "Context menu")
297310
{
298-
ui->stackedWidget->setCurrentIndex(4);
311+
ui->stackedWidget->setCurrentIndex(5);
299312
}
300313
break;
301314
default:
@@ -418,6 +431,19 @@ void SettingsFragment::onGithubLinkClicked()
418431
QDesktopServices::openUrl(QUrl("https://github.com/Audio4Linux/JDSP4Linux"));
419432
}
420433

434+
void SettingsFragment::onAeqDatabaseManageClicked()
435+
{
436+
auto* aeqSel = new AeqSelector(this);
437+
aeqSel->forceManageMode();
438+
aeqSel->exec();
439+
refreshAll();
440+
}
441+
442+
void SettingsFragment::onCrashShareToggled(bool state)
443+
{
444+
AppConfig::instance().set(AppConfig::SendCrashReports, state);
445+
}
446+
421447
void SettingsFragment::setVisible(bool visible)
422448
{
423449
refreshDevices();

src/interface/fragment/SettingsFragment.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ private slots:
6666
void onEqualizerHandlesToggled();
6767
void onLiveprogAutoExtractToggled();
6868
void onGithubLinkClicked();
69+
void onAeqDatabaseManageClicked();
70+
void onCrashShareToggled(bool state);
6971

7072
signals:
7173
void launchSetupWizard();

src/interface/fragment/SettingsFragment.ui

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,68 @@
584584
</property>
585585
<layout class="QVBoxLayout" name="verticalLayout_10">
586586
<item>
587-
<widget class="QCheckBox" name="checkBox">
587+
<widget class="QCheckBox" name="crashShareAllow">
588588
<property name="text">
589-
<string>Allow crash reports to b</string>
589+
<string>Allow to share crash reports anonymously</string>
590590
</property>
591591
</widget>
592592
</item>
593593
</layout>
594594
</widget>
595595
</item>
596+
<item>
597+
<widget class="QGroupBox" name="groupBox_3">
598+
<property name="title">
599+
<string>AutoEQ database</string>
600+
</property>
601+
<layout class="QVBoxLayout" name="verticalLayout_11">
602+
<item>
603+
<layout class="QHBoxLayout" name="horizontalLayout_12">
604+
<property name="topMargin">
605+
<number>0</number>
606+
</property>
607+
<item>
608+
<widget class="QLabel" name="label_5">
609+
<property name="text">
610+
<string>Status:</string>
611+
</property>
612+
</widget>
613+
</item>
614+
<item>
615+
<widget class="QLabel" name="aeqStatus">
616+
<property name="enabled">
617+
<bool>false</bool>
618+
</property>
619+
<property name="text">
620+
<string>unknown</string>
621+
</property>
622+
</widget>
623+
</item>
624+
<item>
625+
<spacer name="horizontalSpacer_8">
626+
<property name="orientation">
627+
<enum>Qt::Horizontal</enum>
628+
</property>
629+
<property name="sizeHint" stdset="0">
630+
<size>
631+
<width>40</width>
632+
<height>20</height>
633+
</size>
634+
</property>
635+
</spacer>
636+
</item>
637+
<item>
638+
<widget class="QPushButton" name="aeqManage">
639+
<property name="text">
640+
<string> Manage local database </string>
641+
</property>
642+
</widget>
643+
</item>
644+
</layout>
645+
</item>
646+
</layout>
647+
</widget>
648+
</item>
596649
<item>
597650
<spacer name="verticalSpacer_3">
598651
<property name="orientation">

src/subprojects/AutoEqIntegration/AeqSelector.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ AeqSelector::~AeqSelector()
5959
delete ui;
6060
}
6161

62+
void AeqSelector::forceManageMode()
63+
{
64+
ui->manageDatabase->setVisible(false);
65+
ui->stackedWidget->setCurrentIndex(1);
66+
ui->buttonBox->clear();
67+
ui->buttonBox->addButton(QDialogButtonBox::Close);
68+
ui->frame->setVisible(false);
69+
70+
auto geo = this->geometry();
71+
geo.setWidth(geo.width() / 2);
72+
this->setGeometry(geo);
73+
}
74+
6275
void AeqSelector::showEvent(QShowEvent *ev)
6376
{
6477
if(!pkgManager->isPackageInstalled())
@@ -169,7 +182,8 @@ void AeqSelector::onSelectionChanged(const QItemSelection &selected, const QItem
169182
{
170183
Q_UNUSED(deselected)
171184
ui->previewStack->setCurrentIndex(!selected.isEmpty());
172-
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(!selected.isEmpty());
185+
if(ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok) != nullptr)
186+
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(!selected.isEmpty());
173187

174188
if(selected.isEmpty())
175189
{

src/subprojects/AutoEqIntegration/AeqSelector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class AeqSelector :
2727
explicit AeqSelector(QWidget *parent = nullptr);
2828
~AeqSelector();
2929

30+
void forceManageMode();
3031
QString selection(DataFormat format, bool silent = false);
3132

3233
protected:

0 commit comments

Comments
 (0)