Skip to content

Commit fba7341

Browse files
committed
Update default paths
1 parent 3fccab3 commit fba7341

File tree

4 files changed

+43
-37
lines changed

4 files changed

+43
-37
lines changed

src/MainWindow.cpp

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ void MainWindow::applyConfig()
915915
// Predefined presets
916916
void MainWindow::onEqPresetUpdated()
917917
{
918-
if (ui->eqpreset->currentText() == "Custom" || _blockApply)
918+
if (ui->eqpreset->currentText() == "Custom")
919919
{
920920
return;
921921
}
@@ -934,14 +934,13 @@ void MainWindow::onEqPresetUpdated()
934934

935935
void MainWindow::onBs2bPresetUpdated()
936936
{
937-
if (ui->crossfeed_mode->currentText() == "..." || _blockApply)
937+
if (ui->crossfeed_mode->currentText() == "...")
938938
{
939939
return;
940940
}
941941

942942
const auto index = PresetProvider::BS2B::lookupPreset(ui->crossfeed_mode->currentText());
943943

944-
_blockApply = true;
945944
switch (index)
946945
{
947946
case 0: // BS2B weak
@@ -955,20 +954,18 @@ void MainWindow::onBs2bPresetUpdated()
955954
}
956955

957956
ui->bs2b_custom_box->setEnabled(index == 99);
958-
_blockApply = false;
959957

960958
applyConfig();
961959
}
962960

963961
void MainWindow::onReverbPresetUpdated()
964962
{
965-
if (ui->roompresets->currentText() == "..." || _blockApply)
963+
if (ui->roompresets->currentText() == "...")
966964
{
967965
return;
968966
}
969967

970968
const auto data = PresetProvider::Reverb::lookupPreset(ui->roompresets->currentIndex());
971-
_blockApply = true;
972969
ui->rev_osf->setValueA(data.osf);
973970
ui->rev_era->setValueA((int) (data.p1 * 100));
974971
ui->rev_finalwet->setValueA((int) (data.p2 * 10));
@@ -986,7 +983,6 @@ void MainWindow::onReverbPresetUpdated()
986983
ui->rev_lco->setValueA((int) data.p14);
987984
ui->rev_decay->setValueA((int) (data.p15 * 100));
988985
ui->rev_delay->setValueA((int) (data.p16 * 10));
989-
_blockApply = false;
990986

991987
applyConfig();
992988
}
@@ -1069,7 +1065,6 @@ void MainWindow::determineVdcSelection()
10691065

10701066
void MainWindow::onVdcDatabaseSelected(const QItemSelection &, const QItemSelection &) {
10711067
QItemSelectionModel *select = ui->ddcTable->selectionModel();
1072-
QString ddc_coeffs;
10731068

10741069
if (select->hasSelection())
10751070
{
@@ -1078,15 +1073,10 @@ void MainWindow::onVdcDatabaseSelected(const QItemSelection &, const QItemSelect
10781073
int index = select->selectedRows().first().row();
10791074
auto* model = static_cast<VdcDatabaseModel*>(ui->ddcTable->model());
10801075

1081-
ddc_coeffs += "SR_44100:";
1082-
ddc_coeffs += model->coefficients(index, 44100);
1083-
ddc_coeffs += "\nSR_48000:";
1084-
ddc_coeffs += model->coefficients(index, 48000);
1085-
10861076
QFile file(AppConfig::instance().getPath("temp.vdc"));
10871077
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
10881078
{
1089-
file.write(ddc_coeffs.toUtf8().constData());
1079+
file.write(model->composeVdcFile(index).toUtf8().constData());
10901080
}
10911081
file.close();
10921082

@@ -1215,16 +1205,16 @@ int MainWindow::extractDefaultEelScripts(bool allowOverride,
12151205
// EQ
12161206
void MainWindow::setEq(const QVector<double> &data)
12171207
{
1218-
_blockApply = true;
12191208
ui->eq_widget->setBands(QVector<double>(data));
1220-
_blockApply = false;
12211209
applyConfig();
12221210
}
12231211

12241212
void MainWindow::resetEQ()
12251213
{
12261214
ui->eqpreset->setCurrentIndex(0);
1215+
_blockApply = true; // TODO: get rid of _blockApply guards
12271216
ui->eq_dyn_widget->load(DEFAULT_GRAPHICEQ);
1217+
_blockApply = false;
12281218
setEq(PresetProvider::EQ::defaultPreset());
12291219
applyConfig();
12301220
}
@@ -1320,32 +1310,32 @@ void MainWindow::connectActions()
13201310
foreach(QAnimatedSlider* w, sliders)
13211311
{
13221312
connect(w, &QAnimatedSlider::stringChanged, ui->info, qOverload<const QString&>(&FadingLabel::setAnimatedText));
1323-
connect(w, SIGNAL(valueChangedA(int)), this, SLOT(applyConfig()));
1313+
connect(w, &QAnimatedSlider::valueChangedA, this, &MainWindow::applyConfig);
13241314
}
13251315

13261316
foreach(QWidget* w, registerClick)
1327-
connect(w, SIGNAL(clicked()), this, SLOT(applyConfig()));
1317+
connect(w, SIGNAL(clicked()), this, SLOT(applyConfig()));
13281318

1329-
connect(ui->disableFX, SIGNAL(clicked()), this, SLOT(onPassthroughToggled()));
1330-
connect(ui->reseteq, SIGNAL(clicked()), this, SLOT(resetEQ()));
1331-
connect(ui->cpreset, SIGNAL(clicked()), this, SLOT(onFragmentRequested()));
1332-
connect(ui->set, SIGNAL(clicked()), this, SLOT(onFragmentRequested()));
1319+
connect(ui->disableFX, &QAbstractButton::clicked, this, &MainWindow::onPassthroughToggled);
1320+
connect(ui->reseteq, &QAbstractButton::clicked, this, &MainWindow::resetEQ);
1321+
connect(ui->cpreset, &QAbstractButton::clicked, this, &MainWindow::onFragmentRequested);
1322+
connect(ui->set, &QAbstractButton::clicked, this, &MainWindow::onFragmentRequested);
13331323

1334-
connect(ui->eq_r_fixed, SIGNAL(clicked()), this, SLOT(applyConfig()));
1335-
connect(ui->eq_r_flex, SIGNAL(clicked()), this, SLOT(applyConfig()));
1324+
connect(ui->eq_r_fixed, &QAbstractButton::clicked, this, &MainWindow::applyConfig);
1325+
connect(ui->eq_r_flex, &QAbstractButton::clicked, this, &MainWindow::applyConfig);
13361326

1337-
connect(ui->eqfiltertype, SIGNAL(currentIndexChanged(int)), this, SLOT(applyConfig()));
1338-
connect(ui->eqinterpolator, SIGNAL(currentIndexChanged(int)), this, SLOT(applyConfig()));
1339-
connect(ui->conv_ir_opt, SIGNAL(currentIndexChanged(int)), this, SLOT(applyConfig()));
1327+
connect(ui->eqfiltertype, qOverload<int>(&QComboBox::currentIndexChanged), this, &MainWindow::applyConfig);
1328+
connect(ui->eqinterpolator, qOverload<int>(&QComboBox::currentIndexChanged), this, &MainWindow::applyConfig);
1329+
connect(ui->conv_ir_opt, qOverload<int>(&QComboBox::currentIndexChanged), this, &MainWindow::applyConfig);
1330+
1331+
connect(ui->crossfeed_mode, qOverload<int>(&QComboBox::currentIndexChanged), this, &MainWindow::onBs2bPresetUpdated);
1332+
connect(ui->eqpreset, qOverload<int>(&QComboBox::currentIndexChanged), this, &MainWindow::onEqPresetUpdated);
1333+
connect(ui->roompresets, qOverload<int>(&QComboBox::currentIndexChanged), this, &MainWindow::onReverbPresetUpdated);
13401334

13411335
connect(ui->eq_widget, SIGNAL(bandsUpdated()), this, SLOT(applyConfig()));
13421336
connect(ui->eq_widget, SIGNAL(mouseReleased()), this, SLOT(determineEqPresetName()));
1343-
connect(ui->eqpreset, SIGNAL(currentIndexChanged(int)), this, SLOT(onEqPresetUpdated()));
1344-
connect(ui->roompresets, SIGNAL(currentIndexChanged(int)), this, SLOT(onReverbPresetUpdated()));
1345-
1346-
connect(ui->conv_adv_wave_edit, SIGNAL(clicked()), this, SLOT(onConvolverWaveformEdit()));
13471337

1348-
connect(ui->crossfeed_mode, SIGNAL(currentIndexChanged(int)), this, SLOT(onBs2bPresetUpdated()));
1338+
connect(ui->conv_adv_wave_edit, &QAbstractButton::clicked, this, &MainWindow::onConvolverWaveformEdit);
13491339

13501340
connect(ui->graphicEq, &GraphicEQFilterGUI::mouseUp, this, &MainWindow::applyConfig);
13511341
connect(ui->eq_dyn_widget, &GraphicEQFilterGUI::mouseUp, this, &MainWindow::applyConfig);

src/config/AppConfig.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ QString AppConfig::getIrsPath()
9797

9898
if (irs_path.length() < 2)
9999
{
100-
return QString("%1/IRS").arg(QDir::homePath());
100+
QString path = getPath("irs");
101+
QDir().mkpath(path);
102+
setIrsPath(path);
103+
return path;
101104
}
102105

103106
return irs_path;
@@ -111,14 +114,17 @@ void AppConfig::setDDCPath(const QString &npath)
111114

112115
QString AppConfig::getDDCPath()
113116
{
114-
QString irs_path = chopFirstLastChar(_appconf->getString("VdcDefaultPath", false));
117+
QString ddc_path = chopFirstLastChar(_appconf->getString("VdcDefaultPath", false));
115118

116-
if (irs_path.length() < 2)
119+
if (ddc_path.length() < 2)
117120
{
118-
return QString("%1/DDC").arg(QDir::homePath());
121+
QString path = getPath("vdc");
122+
QDir().mkpath(path);
123+
setDDCPath(path);
124+
return path;
119125
}
120126

121-
return irs_path;
127+
return ddc_path;
122128
}
123129

124130
void AppConfig::setLiveprogPath(const QString &npath)

src/data/model/VdcDatabaseModel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ VdcDatabaseModel::VdcDatabaseModel(QObject *parent)
3737
this->setHeaderData(1, Qt::Horizontal, tr("Model"));
3838
}
3939

40+
QString VdcDatabaseModel::composeVdcFile(int row) const
41+
{
42+
QString vdc;
43+
vdc += "SR_44100:";
44+
vdc += coefficients(row, 44100);
45+
vdc += "\nSR_48000:";
46+
vdc += coefficients(row, 48000);
47+
return vdc;
48+
}
4049

4150
QString VdcDatabaseModel::coefficients(int row, uint srate) const
4251
{

src/data/model/VdcDatabaseModel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class VdcDatabaseModel : public QJsonTableModel
1010
public:
1111
explicit VdcDatabaseModel(QObject *parent = nullptr);
1212

13+
QString composeVdcFile(int row) const;
1314
QString coefficients(int row, uint srate) const;
1415
QString id(int row) const;
1516
QModelIndex findFirstById(const QString &id) const;

0 commit comments

Comments
 (0)