From 2d4995f0d80c704915cbaad0a893f6a8e7f7e705 Mon Sep 17 00:00:00 2001 From: jthedering <51533355+jthedering@users.noreply.github.com> Date: Thu, 26 Nov 2015 19:20:48 +0000 Subject: [PATCH] Version 1.1 --- Editor/AnalysisPlotView.cpp | 8 +++++ Editor/MainWindow.cpp | 48 ++++++++++++++++++++------ Editor/MainWindow.h | 2 +- Editor/guis/BiQuadFilterGUIFactory.cpp | 18 +++++----- Editor/translations/Editor_de.ts | 27 ++++++--------- uncrustify.cfg | 4 +-- version.h | 2 +- 7 files changed, 70 insertions(+), 39 deletions(-) diff --git a/Editor/AnalysisPlotView.cpp b/Editor/AnalysisPlotView.cpp index 62664d0..39f1480 100644 --- a/Editor/AnalysisPlotView.cpp +++ b/Editor/AnalysisPlotView.cpp @@ -46,6 +46,14 @@ void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect) double hz = s->xToHz(x); double db = gainIterator.gainAt(hz); double y = s->dbToY(db); + if (y == -1) + { + if (db < 0) + y = sceneRect().bottom() + 1; + else + y = sceneRect().top() - 1; + } + if (db == lastDb) y = floor(y) + 0.5; lastDb = db; diff --git a/Editor/MainWindow.cpp b/Editor/MainWindow.cpp index f5937bd..17e945d 100644 --- a/Editor/MainWindow.cpp +++ b/Editor/MainWindow.cpp @@ -89,7 +89,7 @@ MainWindow::MainWindow(QDir configDir, QWidget* parent) ui->mainToolBar->addWidget(new QLabel(tr("Device: "))); deviceComboBox = new QComboBox; - connect(deviceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(deviceSelected(int))); + connect(deviceComboBox, SIGNAL(activated(int)), this, SLOT(deviceSelected(int))); ui->mainToolBar->addWidget(deviceComboBox); spacer = new QWidget; @@ -297,9 +297,7 @@ void MainWindow::load(QString path) } QFileInfo fileInfo(path); - FilterTable* filterTable = addTab(fileInfo.fileName(), QDir::toNativeSeparators(fileInfo.absoluteFilePath())); - - filterTable->setLines(path, lines); + FilterTable* filterTable = addTab(fileInfo.fileName(), QDir::toNativeSeparators(fileInfo.absoluteFilePath()), path, lines); connect(filterTable, SIGNAL(linesChanged()), this, SLOT(linesChanged())); @@ -600,8 +598,7 @@ void MainWindow::on_actionSaveAs_triggered() void MainWindow::on_actionNew_triggered() { - FilterTable* filterTable = addTab(tr("Unsaved"), ""); - filterTable->setLines("", QList()); + FilterTable* filterTable = addTab(tr("Unsaved"), "", "", QList()); connect(filterTable, SIGNAL(linesChanged()), this, SLOT(linesChanged())); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); @@ -808,7 +805,7 @@ void MainWindow::on_actionResetAllFileSpecificPreferences_triggered() } } -FilterTable* MainWindow::addTab(QString title, QString tooltip) +FilterTable* MainWindow::addTab(QString title, QString tooltip, QString configPath, QList lines) { QScrollArea* scrollArea = new QScrollArea(ui->tabWidget); scrollArea->setWidgetResizable(true); @@ -817,14 +814,15 @@ FilterTable* MainWindow::addTab(QString title, QString tooltip) filterTable->setAcceptDrops(true); filterTable->setFocusPolicy(Qt::WheelFocus); - int tabIndex = ui->tabWidget->addTab(scrollArea, title); - ui->tabWidget->setTabToolTip(tabIndex, tooltip); - DeviceAPOInfo* selectedDevice; int channelMask; getDeviceAndChannelMask(&selectedDevice, &channelMask); filterTable->updateDeviceAndChannelMask(selectedDevice, channelMask); filterTable->initialize(scrollArea, outputDevices, inputDevices); + filterTable->setLines(configPath, lines); + + int tabIndex = ui->tabWidget->addTab(scrollArea, title); + ui->tabWidget->setTabToolTip(tabIndex, tooltip); return filterTable; } @@ -933,6 +931,32 @@ void MainWindow::loadPreferences() if (stateValue.isValid()) restoreState(stateValue.toByteArray()); instantModeCheckBox->setChecked(settings.value("instantMode", true).toBool()); + QString selectedDeviceGuid = settings.value("selectedDeviceGuid").toString(); + if (!selectedDeviceGuid.isEmpty()) + { + for (int i = 0; i < deviceComboBox->count(); i++) + { + DeviceAPOInfo* apoInfo = deviceComboBox->itemData(i).value(); + if (apoInfo != NULL) + { + if (QString::fromStdWString(apoInfo->deviceGuid).compare(selectedDeviceGuid, Qt::CaseInsensitive) == 0) + { + deviceComboBox->setCurrentIndex(i); + break; + } + } + } + } + deviceSelected(deviceComboBox->currentIndex()); + + int selectedChannelMask = settings.value("selectedChannelMask").toInt(); + if (selectedChannelMask != 0) + { + int index = channelConfigurationComboBox->findData(selectedChannelMask); + if (index != -1) + channelConfigurationComboBox->setCurrentIndex(index); + } + channelConfigurationSelected(channelConfigurationComboBox->currentIndex()); ui->startFromComboBox->setCurrentIndex(settings.value("analysis/startFrom").toInt()); ui->analysisChannelComboBox->setCurrentText(settings.value("analysis/channel").toString()); @@ -981,6 +1005,10 @@ void MainWindow::savePreferences() settings.setValue("geometry", saveGeometry()); settings.setValue("windowState", saveState()); settings.setValue("instantMode", instantModeCheckBox->isChecked()); + DeviceAPOInfo* selectedDevice = deviceComboBox->currentData().value(); + settings.setValue("selectedDeviceGuid", selectedDevice != NULL ? QString::fromStdWString(selectedDevice->deviceGuid) : ""); + int channelMask = channelConfigurationComboBox->currentData().toInt(); + settings.setValue("selectedChannelMask", channelMask); settings.setValue("analysis/startFrom", ui->startFromComboBox->currentIndex()); settings.setValue("analysis/channel", ui->analysisChannelComboBox->currentText()); diff --git a/Editor/MainWindow.h b/Editor/MainWindow.h index 9bfed10..6e95a3c 100644 --- a/Editor/MainWindow.h +++ b/Editor/MainWindow.h @@ -90,7 +90,7 @@ private slots: void on_actionResetAllFileSpecificPreferences_triggered(); private: - FilterTable* addTab(QString title, QString tooltip); + FilterTable* addTab(QString title, QString tooltip, QString configPath, QList lines); void getDeviceAndChannelMask(DeviceAPOInfo** selectedDevice, int* channelMask); bool askForClose(int tabIndex); void startAnalysis(); diff --git a/Editor/guis/BiQuadFilterGUIFactory.cpp b/Editor/guis/BiQuadFilterGUIFactory.cpp index 8589025..7000673 100644 --- a/Editor/guis/BiQuadFilterGUIFactory.cpp +++ b/Editor/guis/BiQuadFilterGUIFactory.cpp @@ -27,15 +27,17 @@ BiQuadFilterGUIFactory::BiQuadFilterGUIFactory() QList BiQuadFilterGUIFactory::createFilterTemplates() { + QStringList path(tr("Parametric filters")); + QList list; - list.append(FilterTemplate(tr("Peaking filter"), "Filter: ON PK Fc 100 Hz Gain 0 dB Q 10.0", QStringList(tr("Parametric filters")))); - list.append(FilterTemplate(tr("Low-pass filter"), "Filter: ON LP Fc 100 Hz", QStringList(tr("Parametric filters")))); - list.append(FilterTemplate(tr("High-pass filter"), "Filter: ON LP Fc 100 Hz", QStringList(tr("Parametric filters")))); - list.append(FilterTemplate(tr("Band-pass filter"), "Filter: ON BP Fc 100 Hz Q 10.0", QStringList(tr("Parametric filters")))); - list.append(FilterTemplate(tr("Low-shelf filter"), "Filter: ON LS Fc 100 Hz Gain 0 dB", QStringList(tr("Parametric filters")))); - list.append(FilterTemplate(tr("High-shelf filter"), "Filter: ON HS Fc 100 Hz Gain 0 dB", QStringList(tr("Parametric filters")))); - list.append(FilterTemplate(tr("Notch filter"), "Filter: ON NO Fc 100 Hz", QStringList(tr("Parametric filters")))); - list.append(FilterTemplate(tr("All-pass filter"), "Filter: ON AP Fc 100 Hz Q 10.0", QStringList(tr("Parametric filters")))); + list.append(FilterTemplate(tr("Peaking filter"), "Filter: ON PK Fc 100 Hz Gain 0 dB Q 10", path)); + list.append(FilterTemplate(tr("Low-pass filter"), "Filter: ON LP Fc 100 Hz", path)); + list.append(FilterTemplate(tr("High-pass filter"), "Filter: ON LP Fc 100 Hz", path)); + list.append(FilterTemplate(tr("Band-pass filter"), "Filter: ON BP Fc 100 Hz Q 10", path)); + list.append(FilterTemplate(tr("Low-shelf filter"), "Filter: ON LS Fc 100 Hz Gain 0 dB", path)); + list.append(FilterTemplate(tr("High-shelf filter"), "Filter: ON HS Fc 100 Hz Gain 0 dB", path)); + list.append(FilterTemplate(tr("Notch filter"), "Filter: ON NO Fc 100 Hz", path)); + list.append(FilterTemplate(tr("All-pass filter"), "Filter: ON AP Fc 100 Hz Q 10", path)); return list; } diff --git a/Editor/translations/Editor_de.ts b/Editor/translations/Editor_de.ts index 034039e..54e09b3 100644 --- a/Editor/translations/Editor_de.ts +++ b/Editor/translations/Editor_de.ts @@ -99,54 +99,47 @@ BiQuadFilterGUIFactory - + Peaking filter Peaking-Filter - - - - - - - - + Parametric filters Parametrische Filter - + Low-pass filter Tiefpassfilter - + High-pass filter Hochpassfilter - + Band-pass filter Bandpassfilter - + Low-shelf filter Low Shelf-Filter - + High-shelf filter High Shelf-Filter - + Notch filter Notchfilter - + All-pass filter Allpassfilter @@ -647,7 +640,7 @@ Wählen Sie eine andere Datei or ändern Sie die Konfiguration des Geräts. FilterTable - + Add filter Filter hinzufügen diff --git a/uncrustify.cfg b/uncrustify.cfg index 6d6d571..39ce205 100644 --- a/uncrustify.cfg +++ b/uncrustify.cfg @@ -96,8 +96,8 @@ ls_for_split_full=false ls_func_split_full=false ls_code_width=false nl_after_multiline_comment=false -eat_blanks_after_open_brace=false -eat_blanks_before_close_brace=false +eat_blanks_after_open_brace=true +eat_blanks_before_close_brace=true nl_before_return=false nl_after_return=false mod_full_brace_if_chain=false diff --git a/version.h b/version.h index 198fa0e..bdb5792 100644 --- a/version.h +++ b/version.h @@ -1,3 +1,3 @@ #define MAJOR 1 -#define MINOR 0 +#define MINOR 1 #define REVISION 0