diff -Nru qspeakers-1.6.1/bandpassdialog.cpp qspeakers-1.6.2/bandpassdialog.cpp --- qspeakers-1.6.1/bandpassdialog.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/bandpassdialog.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -7,8 +7,8 @@ { ui->setupUi(this); - connect(this, SIGNAL(accepted()), this, SLOT(onAccepted())); - connect(this, SIGNAL(rejected()), this, SLOT(onRejected())); + connect(this, &BandpassDialog::accepted, this, &BandpassDialog::onAccepted); + connect(this, &BandpassDialog::rejected, this, &BandpassDialog::onRejected); } BandpassDialog::~BandpassDialog() diff -Nru qspeakers-1.6.1/debian/changelog qspeakers-1.6.2/debian/changelog --- qspeakers-1.6.1/debian/changelog 2021-05-05 13:57:02.000000000 +0000 +++ qspeakers-1.6.2/debian/changelog 2022-01-12 08:01:32.000000000 +0000 @@ -1,3 +1,9 @@ +qspeakers (1.6.2-1) unstable; urgency=medium + + * New upstream release. + + -- Benoît Rouits Wed, 12 Jan 2022 09:01:32 +0100 + qspeakers (1.6.1-1) unstable; urgency=medium * New upstream release (1.6.1) fixes UI glitches. diff -Nru qspeakers-1.6.1/fr.free.brouits.qspeakers.metainfo.xml qspeakers-1.6.2/fr.free.brouits.qspeakers.metainfo.xml --- qspeakers-1.6.1/fr.free.brouits.qspeakers.metainfo.xml 1970-01-01 00:00:00.000000000 +0000 +++ qspeakers-1.6.2/fr.free.brouits.qspeakers.metainfo.xml 2022-01-12 07:50:08.000000000 +0000 @@ -0,0 +1,32 @@ + + + fr.free.brouits.qspeakers + + QSpeakers + Loudspeaker design software + + FSFAP + GPL-3.0-or-later + + +

+ QSpeakers is a simple graphical program that simulates common acoustical enclosures behaviour to help designing loudspeaker systems, based on the loudspeaker driver's Thiele / Small parameters and the chosen enclosure type. +

+

+ This software is mostly useful for do-it-yourself loudspeaker enthusiasts, acoustics teaching, and to a lesser extent, for loudspeaker engineering. +

+
+ + qspeakers.desktop + + + http://brouits.free.fr/qspeakers/qspeakers.png + + + http://brouits.free.fr/qspeakers/ + Benoît Rouits + brouits_AT_free.fr + + qspeakers + +
diff -Nru qspeakers-1.6.1/.gitignore qspeakers-1.6.2/.gitignore --- qspeakers-1.6.1/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ qspeakers-1.6.2/.gitignore 2022-01-12 07:50:08.000000000 +0000 @@ -0,0 +1,52 @@ +# C++ objects and libs +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.so.* +*.dll +*.dylib + +# Qt-es +object_script.*.Release +object_script.*.Debug +*_plugin_import.cpp +/.qmake.cache +/.qmake.stash +*.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +moc_*.h +qrc_*.cpp +ui_*.h +*.qmlc +*.jsc +Makefile* +*build-* +*.qm +*.prl + +# Qt unit tests +target_wrapper.* + +# QtCreator +*.autosave + +# QtCreator Qml +*.qmlproject.user +*.qmlproject.user.* + +# QtCreator CMake +CMakeLists.txt.user* + +# QtCreator 4.8< compilation database +compile_commands.json + +# QtCreator local machine specific files for imported projects +*creator.user* diff -Nru qspeakers-1.6.1/importexport.cpp qspeakers-1.6.2/importexport.cpp --- qspeakers-1.6.1/importexport.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/importexport.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -16,7 +16,9 @@ return ImportExport::savePath; } -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + QString prefix = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); +#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0) QString prefix = QStandardPaths::writableLocation(QStandardPaths::DataLocation); #else QString prefix = QDesktopServices::storageLocation(QDesktopServices::DataLocation); diff -Nru qspeakers-1.6.1/listdialog.cpp qspeakers-1.6.2/listdialog.cpp --- qspeakers-1.6.1/listdialog.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/listdialog.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -52,8 +52,8 @@ ui->setupUi(this); setSpeakerItems(speakers); - connect(this, SIGNAL(accepted()), this, SLOT(onAccepted())); - connect(this, SIGNAL(rejected()), this, SLOT(onRejected())); + connect(this, &ListDialog::accepted, this, &ListDialog::onAccepted); + connect(this, &ListDialog::rejected, this, &ListDialog::onRejected); } ListDialog::~ListDialog() diff -Nru qspeakers-1.6.1/main.cpp qspeakers-1.6.2/main.cpp --- qspeakers-1.6.1/main.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/main.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -16,18 +16,25 @@ QString locale = QLocale::system().name(); QTranslator qtTranslator; +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + if (qtTranslator.load(QLocale::system(), u"qtbase"_qs, u"_"_qs, + QLibraryInfo::path(QLibraryInfo::TranslationsPath))) + a.installTranslator(&qtTranslator); +#else qtTranslator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); a.installTranslator(&qtTranslator); +#endif QTranslator qspeakersTranslator; - if (!qspeakersTranslator.load(TARGET "_" + locale, "locale")) + if (qspeakersTranslator.load(TARGET "_" + locale, "locale")) + a.installTranslator(&qspeakersTranslator); #ifdef __mswin - qspeakersTranslator.load(TARGET "_" + locale, QCoreApplication::applicationDirPath() + QDir::separator() + "locale"); + else if (qspeakersTranslator.load(TARGET "_" + locale, QCoreApplication::applicationDirPath() + QDir::separator() + "locale")) #else - qspeakersTranslator.load(TARGET "_" + locale, DATADIR "/" TARGET "/locale"); + else if (qspeakersTranslator.load(TARGET "_" + locale, DATADIR "/" TARGET "/locale")) #endif - a.installTranslator(&qspeakersTranslator); + a.installTranslator(&qspeakersTranslator); QCommandLineParser parser; @@ -46,7 +53,7 @@ #ifdef __mswin QString iconpath = QCoreApplication::applicationDirPath() + QDir::separator() + TARGET + ".png"; #else - QString iconpath = QString(DATADIR "/pixmaps/" TARGET ".png"); + QString iconpath = QString(DATADIR "/icons/hicolor/scalable/apps/" TARGET ".svg"); #endif #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) if (QFileInfo::exists(iconpath)) diff -Nru qspeakers-1.6.1/mainwindow.cpp qspeakers-1.6.2/mainwindow.cpp --- qspeakers-1.6.1/mainwindow.cpp 2021-04-30 19:47:56.000000000 +0000 +++ qspeakers-1.6.2/mainwindow.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -139,6 +139,10 @@ QString home = MainWindow::getHome(); QString fileName = QFileDialog::getSaveFileName(this, tr("Export File"), home + tr("/untitled.qsp"), tr("QSpeakers project (*.qsp)")); + /* user cancelled */ + if (fileName.isEmpty()) + return; + QFile file(fileName); ImportExport::exportProject(file, currentSpeaker, currentSealedBox, currentPortedBox, currentBandPassBox, currentSpeakerNumber, currentTabIndex); } @@ -295,11 +299,14 @@ ui->portedResonancedoubleSpinBox->setValue(box.getResFreq()); ui->portedPortsNumberSpinBox->setValue(box.getPortNum()); ui->portedPortDiameterDoubleSpinBox->setValue(box.getPortDiam()); - ui->portedPortSlotWidthButton->setChecked(box.getSlotPortActivated()); - ui->portedPortSlotWidthButton->clicked(box.getSlotPortActivated()); + bool slotPortActivated = box.getSlotPortActivated(); + ui->portedPortSlotWidthButton->setChecked(slotPortActivated); + ui->portedPortSlotWidthButton->clicked(slotPortActivated); + ui->portedPortSlotWidthDoubleSpinBox->setEnabled(slotPortActivated); + ui->portedPortSlotHeightLineEdit->setEnabled(slotPortActivated); ui->portedPortSlotWidthDoubleSpinBox->setValue(box.getSlotWidth()); - ui->portedPortSlotHeightLineEdit->setText(QString::number(box.getSlotHeight(), 'f', 2)); - ui->portedPortLengthLineEdit->setText(QString::number(box.getPortLen(), 'f', 2)); + ui->portedPortSlotHeightLineEdit->setText(QString::number(box.getSlotHeight(), 'f', 1)); + ui->portedPortLengthLineEdit->setText(QString::number(box.getPortLen(), 'f', 1)); System s(currentSpeaker, &box, currentSpeakerNumber); portedPlot->clear(); @@ -319,7 +326,7 @@ ui->bandPassPortedResonanceDoubleSpinBox->setValue(box.getPortedBoxResFreq()); ui->bandPassPortsNumberSpinBox->setValue(box.getPortedBoxPortNum()); ui->bandPassPortDiameterDoubleSpinBox->setValue(box.getPortedBoxPortDiam()); - ui->bandPassPortLengthLineEdit->setText(QString::number(box.getPortedBoxPortLen(), 'f', 2)); + ui->bandPassPortLengthLineEdit->setText(QString::number(box.getPortedBoxPortLen(), 'f', 1)); System s(currentSpeaker, &box, currentSpeakerNumber); bandpassPlot->clear(); @@ -389,8 +396,8 @@ void MainWindow::onBandpassAlignment() { bandpassDialog = new BandpassDialog(this); - connect(bandpassDialog, SIGNAL(optimizeRequested(double, double)), this, SLOT(onBandpassOptimizeRequested(double, double))); - connect(bandpassDialog, SIGNAL(optimizeCancelled()), this, SLOT(onBandpassOptimizeCancelled())); + connect(bandpassDialog, &BandpassDialog::optimizeRequested, this, &MainWindow::onBandpassOptimizeRequested); + connect(bandpassDialog, &BandpassDialog::optimizeCancelled, this, &MainWindow::onBandpassOptimizeCancelled); bandpassDialog->show(); } @@ -402,8 +409,8 @@ emit currentBandPassBoxChanged(currentBandPassBox); } - disconnect(bandpassDialog, SIGNAL(optimizeRequested(double,double)), this, SLOT(onBandpassOptimizeRequested(double,double))); - disconnect(bandpassDialog, SIGNAL(optimizeCancelled()), this, SLOT(onBandpassOptimizeCancelled())); + disconnect(bandpassDialog, &BandpassDialog::optimizeRequested, this, &MainWindow::onBandpassOptimizeRequested); + disconnect(bandpassDialog, &BandpassDialog::optimizeCancelled, this, &MainWindow::onBandpassOptimizeCancelled); bandpassDialog->close(); bandpassDialog->deleteLater(); bandpassDialog = nullptr; @@ -411,8 +418,8 @@ void MainWindow::onBandpassOptimizeCancelled() { - disconnect(bandpassDialog, SIGNAL(optimizeRequested(double,double)), this, SLOT(onBandpassOptimizeRequested(double,double))); - disconnect(bandpassDialog, SIGNAL(optimizeCancelled()), this, SLOT(onBandpassOptimizeCancelled())); + disconnect(bandpassDialog, &BandpassDialog::optimizeRequested, this, &MainWindow::onBandpassOptimizeRequested); + disconnect(bandpassDialog, &BandpassDialog::optimizeCancelled, this, &MainWindow::onBandpassOptimizeCancelled); bandpassDialog->close(); bandpassDialog->deleteLater(); bandpassDialog = nullptr; @@ -425,6 +432,11 @@ QString f = QString("QSpeakers %1 %2").arg(currentSpeaker.getModel()).arg(box); f.replace(' ', '_'); QString fileName = QFileDialog::getSaveFileName(this, tr("Export for Gnuplot"), home + QDir::separator() + f + ".dat", tr("Gnuplot data (*.dat)")); + + /* user cancelled */ + if (fileName.isEmpty()) + return; + exportPlot(fileName, currentTabIndex); } @@ -435,6 +447,11 @@ QString f = QString("QSpeakers %1 %2 3D").arg(currentSpeaker.getModel()).arg(box); f.replace(' ', '_'); QString fileName = QFileDialog::getSaveFileName(this, tr("Export for 3D OpenSCAD"), home + QDir::separator() + f + ".scad", tr("OpenSCAD script (*.scad)")); + + /* user cancelled */ + if (fileName.isEmpty()) + return; + exportScad3D(fileName, currentTabIndex); } @@ -445,6 +462,11 @@ QString f = QString("QSpeakers %1 %2 2D").arg(currentSpeaker.getModel()).arg(box); f.replace(' ', '_'); QString fileName = QFileDialog::getSaveFileName(this, tr("Export for 2D OpenSCAD"), home + QDir::separator() + f + ".scad", tr("OpenSCAD script (*.scad)")); + + /* user cancelled */ + if (fileName.isEmpty()) + return; + exportScad2D(fileName, currentTabIndex); } @@ -470,7 +492,7 @@ return; } - QVector points = series->pointsVector(); + QList points = series->points(); int len = points.length(); QString line; @@ -631,139 +653,139 @@ void MainWindow::linkMenus() { - connect(ui->actionProjectSave, SIGNAL(triggered()), this, SLOT(onProjectSave())); - connect(ui->actionProjectQuit, SIGNAL(triggered()), this, SLOT(onProjectQuit())); - connect(ui->actionSpeakerNew, SIGNAL(triggered()), this, SLOT(onSpeakerNew())); - connect(ui->actionSpeakerModify, SIGNAL(triggered()), this, SLOT(onSpeakerModify())); - connect(ui->actionSpeakerRemove, SIGNAL(triggered()), this, SLOT(onSpeakerRemove())); - connect(ui->actionProjectExport, SIGNAL(triggered()), this, SLOT(onProjectExport())); - connect(ui->actionProjectImport, SIGNAL(triggered()), this, SLOT(onProjectImport())); - connect(ui->actionEditOptimize, SIGNAL(triggered()), this, SLOT(onEditOptimize())); - connect(ui->actionSpeakerSearch, SIGNAL(triggered()), this, SLOT(onSpeakerSearch())); - connect(ui->actionProjectPrint, SIGNAL(triggered()), this, SLOT(onProjectPrint())); - connect(ui->actionUndo, SIGNAL(triggered()), this, SLOT(onUndo())); - connect(ui->actionRedo, SIGNAL(triggered()), this, SLOT(onRedo())); - connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAboutAbout())); + connect(ui->actionProjectSave, &QAction::triggered, this, &MainWindow::onProjectSave); + connect(ui->actionProjectQuit, &QAction::triggered, this, &MainWindow::onProjectQuit); + connect(ui->actionSpeakerNew, &QAction::triggered, this, &MainWindow::onSpeakerNew); + connect(ui->actionSpeakerModify, &QAction::triggered, this, &MainWindow::onSpeakerModify); + connect(ui->actionSpeakerRemove, &QAction::triggered, this, &MainWindow::onSpeakerRemove); + connect(ui->actionProjectExport, &QAction::triggered, this, &MainWindow::onProjectExport); + connect(ui->actionProjectImport, &QAction::triggered, this, &MainWindow::onProjectImport); + connect(ui->actionEditOptimize, &QAction::triggered, this, &MainWindow::onEditOptimize); + connect(ui->actionSpeakerSearch, &QAction::triggered, this, &MainWindow::onSpeakerSearch); + connect(ui->actionProjectPrint, &QAction::triggered, this, &MainWindow::onProjectPrint); + connect(ui->actionUndo, &QAction::triggered, this, &MainWindow::onUndo); + connect(ui->actionRedo, &QAction::triggered, this, &MainWindow::onRedo); + connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::onAboutAbout); /* ported alignments sub-menu */ - connect(ui->actionModerate_Inf, SIGNAL(triggered()), this, SLOT(onAlignModerate_Inf())); - connect(ui->actionLegendre, SIGNAL(triggered()), this, SLOT(onAlignLegendre())); - connect(ui->actionBessel, SIGNAL(triggered()), this, SLOT(onAlignBessel())); - connect(ui->actionBullock, SIGNAL(triggered()), this, SLOT(onAlignBullock())); - connect(ui->actionKeele_Hoge, SIGNAL(triggered()), this, SLOT(onAlignKeele_Hoge())); + connect(ui->actionModerate_Inf, &QAction::triggered, this, &MainWindow::onAlignModerate_Inf); + connect(ui->actionLegendre, &QAction::triggered, this, &MainWindow::onAlignLegendre); + connect(ui->actionBessel, &QAction::triggered, this, &MainWindow::onAlignBessel); + connect(ui->actionBullock, &QAction::triggered, this, &MainWindow::onAlignBullock); + connect(ui->actionKeele_Hoge, &QAction::triggered, this, &MainWindow::onAlignKeele_Hoge); /* bandpass alignment */ - connect(ui->actionBandpass_alignment, SIGNAL(triggered()), this, SLOT(onBandpassAlignment())); + connect(ui->actionBandpass_alignment, &QAction::triggered, this, &MainWindow::onBandpassAlignment); /* exports menu */ - connect(ui->actionCurve_Plot, SIGNAL(triggered()), this, SLOT(onCurvePlot())); - connect(ui->action3D_OpenScad, SIGNAL(triggered()), this, SLOT(on3DScadExport())); - connect(ui->action2D_OpenScad, SIGNAL(triggered()), this, SLOT(on2DScadExport())); + connect(ui->actionCurve_Plot, &QAction::triggered, this, &MainWindow::onCurvePlot); + connect(ui->action3D_OpenScad, &QAction::triggered, this, &MainWindow::on3DScadExport); + connect(ui->action2D_OpenScad, &QAction::triggered, this, &MainWindow::on2DScadExport); } void MainWindow::linkTabs() { - connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onCurrentTabChanged(int))); + connect(ui->tabWidget, &QTabWidget::currentChanged, this, &MainWindow::onCurrentTabChanged); /* spk combos action */ - connect(ui->vendorComboBox, SIGNAL(activated(QString)), this, SLOT(onVendorChanged(QString))); - connect(ui->modelComboBox, SIGNAL(activated(QString)), this, SLOT(onModelChanged(QString))); + connect(ui->vendorComboBox, &QComboBox::textActivated, this, &MainWindow::onVendorChanged); + connect(ui->modelComboBox, &QComboBox::textActivated, this, &MainWindow::onModelChanged); /* drivers number spin action */ - connect(ui->numberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onNumberSpinChanged(int))); + connect(ui->numberSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &MainWindow::onNumberSpinChanged); - connect(ui->sealedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onSealedVolumeDoubleSpinChanged(double))); + connect(ui->sealedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onSealedVolumeDoubleSpinChanged); - connect(ui->portedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedVolumeDoubleSpinChanged(double))); - connect(ui->portedResonancedoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedResonanceDoubleSpinChanged(double))); - connect(ui->portedPortsNumberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onPortedPortsNumberSpinChanged(int))); - connect(ui->portedPortDiameterDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedPortDiameterDoubleSpinChanged(double))); - connect(ui->portedPortSlotWidthButton, SIGNAL(clicked(bool)), this, SLOT(onPortedSlotPortActivated(bool))); - connect(ui->portedPortSlotWidthDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedSlotWidthDoubleSpinChanged(double))); - - connect(ui->bandPassSealedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassSealedVolumeDoubleSpinChanged(double))); - connect(ui->bandPassPortedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortedVolumeDoubleSpinChanged(double))); - connect(ui->bandPassPortedResonanceDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortedResonanceDoubleSpinChanged(double))); - connect(ui->bandPassPortsNumberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onBandPassPortNumSpinChanged(int))); - connect(ui->bandPassPortDiameterDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortDiameterDoubleSpinChanged(double))); + connect(ui->portedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedVolumeDoubleSpinChanged); + connect(ui->portedResonancedoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedResonanceDoubleSpinChanged); + connect(ui->portedPortsNumberSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &MainWindow::onPortedPortsNumberSpinChanged); + connect(ui->portedPortDiameterDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedPortDiameterDoubleSpinChanged); + connect(ui->portedPortSlotWidthButton, &QPushButton::clicked, this, &MainWindow::onPortedSlotPortActivated); + connect(ui->portedPortSlotWidthDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedSlotWidthDoubleSpinChanged); + + connect(ui->bandPassSealedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassSealedVolumeDoubleSpinChanged); + connect(ui->bandPassPortedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassPortedVolumeDoubleSpinChanged); + connect(ui->bandPassPortedResonanceDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassPortedResonanceDoubleSpinChanged); + connect(ui->bandPassPortsNumberSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &MainWindow::onBandPassPortNumSpinChanged); + connect(ui->bandPassPortDiameterDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassPortDiameterDoubleSpinChanged); } void MainWindow::linkInternals() { - connect(this, SIGNAL(currentSpeakerChanged(Speaker)), this, SLOT(onCurrentSpeakerChanged(const Speaker&))); - connect(this, SIGNAL(currentSealedBoxChanged(SealedBox)), this, SLOT(onCurrentSealedBoxChanged(const SealedBox&))); - connect(this, SIGNAL(currentPortedBoxChanged(PortedBox)), this, SLOT(onCurrentPortedBoxChanged(const PortedBox&))); - connect(this, SIGNAL(currentBandPassBoxChanged(BandPassBox)), this, SLOT(onCurrentBandPassBoxChanged(const BandPassBox&))); + connect(this, &MainWindow::currentSpeakerChanged, this, &MainWindow::onCurrentSpeakerChanged); + connect(this, &MainWindow::currentSealedBoxChanged, this, &MainWindow::onCurrentSealedBoxChanged); + connect(this, &MainWindow::currentPortedBoxChanged, this, &MainWindow::onCurrentPortedBoxChanged); + connect(this, &MainWindow::currentBandPassBoxChanged, this, &MainWindow::onCurrentBandPassBoxChanged); - connect(this->commandStack, SIGNAL(canUndoChanged(bool)), ui->actionUndo, SLOT(setEnabled(bool))); - connect(this->commandStack, SIGNAL(canRedoChanged(bool)), ui->actionRedo, SLOT(setEnabled(bool))); + connect(this->commandStack, &QUndoStack::canUndoChanged, ui->actionUndo, &QAction::setEnabled); + connect(this->commandStack, &QUndoStack::canRedoChanged, ui->actionRedo, &QAction::setEnabled); } void MainWindow::unlinkMenus() { - disconnect(ui->actionProjectSave, SIGNAL(triggered()), this, SLOT(onProjectSave())); - disconnect(ui->actionProjectQuit, SIGNAL(triggered()), this, SLOT(onProjectQuit())); - disconnect(ui->actionSpeakerNew, SIGNAL(triggered()), this, SLOT(onSpeakerNew())); - disconnect(ui->actionSpeakerModify, SIGNAL(triggered()), this, SLOT(onSpeakerModify())); - disconnect(ui->actionSpeakerRemove, SIGNAL(triggered()), this, SLOT(onSpeakerRemove())); - disconnect(ui->actionProjectExport, SIGNAL(triggered()), this, SLOT(onProjectExport())); - disconnect(ui->actionProjectImport, SIGNAL(triggered()), this, SLOT(onProjectImport())); - disconnect(ui->actionEditOptimize, SIGNAL(triggered()), this, SLOT(onEditOptimize())); - disconnect(ui->actionSpeakerSearch, SIGNAL(triggered()), this, SLOT(onSpeakerSearch())); - disconnect(ui->actionProjectPrint, SIGNAL(triggered()), this, SLOT(onProjectPrint())); - disconnect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAboutAbout())); + disconnect(ui->actionProjectSave, &QAction::triggered, this, &MainWindow::onProjectSave); + disconnect(ui->actionProjectQuit, &QAction::triggered, this, &MainWindow::onProjectQuit); + disconnect(ui->actionSpeakerNew, &QAction::triggered, this, &MainWindow::onSpeakerNew); + disconnect(ui->actionSpeakerModify, &QAction::triggered, this, &MainWindow::onSpeakerModify); + disconnect(ui->actionSpeakerRemove, &QAction::triggered, this, &MainWindow::onSpeakerRemove); + disconnect(ui->actionProjectExport, &QAction::triggered, this, &MainWindow::onProjectExport); + disconnect(ui->actionProjectImport, &QAction::triggered, this, &MainWindow::onProjectImport); + disconnect(ui->actionEditOptimize, &QAction::triggered, this, &MainWindow::onEditOptimize); + disconnect(ui->actionSpeakerSearch, &QAction::triggered, this, &MainWindow::onSpeakerSearch); + disconnect(ui->actionProjectPrint, &QAction::triggered, this, &MainWindow::onProjectPrint); + disconnect(ui->actionAbout, &QAction::triggered, this, &MainWindow::onAboutAbout); /* ported alignments sub-menu */ - disconnect(ui->actionModerate_Inf, SIGNAL(triggered()), this, SLOT(onAlignModerate_Inf())); - disconnect(ui->actionLegendre, SIGNAL(triggered()), this, SLOT(onAlignLegendre())); - disconnect(ui->actionBessel, SIGNAL(triggered()), this, SLOT(onAlignBessel())); - disconnect(ui->actionBullock, SIGNAL(triggered()), this, SLOT(onAlignBullock())); - disconnect(ui->actionKeele_Hoge, SIGNAL(triggered()), this, SLOT(onAlignKeele_Hoge())); + disconnect(ui->actionModerate_Inf, &QAction::triggered, this, &MainWindow::onAlignModerate_Inf); + disconnect(ui->actionLegendre, &QAction::triggered, this, &MainWindow::onAlignLegendre); + disconnect(ui->actionBessel, &QAction::triggered, this, &MainWindow::onAlignBessel); + disconnect(ui->actionBullock, &QAction::triggered, this, &MainWindow::onAlignBullock); + disconnect(ui->actionKeele_Hoge, &QAction::triggered, this, &MainWindow::onAlignKeele_Hoge); /* bandpass alignment */ - disconnect(ui->actionBandpass_alignment, SIGNAL(triggered(bool)), this, SLOT(onBandpassAlignment())); + disconnect(ui->actionBandpass_alignment, &QAction::triggered, this, &MainWindow::onBandpassAlignment); } void MainWindow::unlinkTabs() { - disconnect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onCurrentTabChanged(int))); + disconnect(ui->tabWidget, &QTabWidget::currentChanged, this, &MainWindow::onCurrentTabChanged); /* spk combos action */ - disconnect(ui->vendorComboBox, SIGNAL(activated(QString)), this, SLOT(onVendorChanged(QString))); - disconnect(ui->modelComboBox, SIGNAL(activated(QString)), this, SLOT(onModelChanged(QString))); + disconnect(ui->vendorComboBox, &QComboBox::textActivated, this, &MainWindow::onVendorChanged); + disconnect(ui->modelComboBox, &QComboBox::textActivated, this, &MainWindow::onModelChanged); - disconnect(ui->numberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onNumberSpinChanged(int))); + disconnect(ui->numberSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &MainWindow::onNumberSpinChanged); - disconnect(ui->sealedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onSealedVolumeDoubleSpinChanged(double))); + disconnect(ui->sealedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onSealedVolumeDoubleSpinChanged); - disconnect(ui->portedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedVolumeDoubleSpinChanged(double))); - disconnect(ui->portedResonancedoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedResonanceDoubleSpinChanged(double))); - disconnect(ui->portedPortsNumberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onPortedPortsNumberSpinChanged(int))); - disconnect(ui->portedPortDiameterDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedPortDiameterDoubleSpinChanged(double))); - disconnect(ui->portedPortSlotWidthButton, SIGNAL(clicked(bool)), this, SLOT(onPortedSlotPortActivated(bool))); - disconnect(ui->portedPortSlotWidthDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedSlotWidthDoubleSpinChanged(double))); - - disconnect(ui->bandPassSealedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassSealedVolumeDoubleSpinChanged(double))); - disconnect(ui->bandPassPortedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortedVolumeDoubleSpinChanged(double))); - disconnect(ui->bandPassPortedResonanceDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortedResonanceDoubleSpinChanged(double))); - disconnect(ui->bandPassPortsNumberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onBandPassPortNumSpinChanged(int))); - disconnect(ui->bandPassPortDiameterDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortDiameterDoubleSpinChanged(double))); + disconnect(ui->portedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedVolumeDoubleSpinChanged); + disconnect(ui->portedResonancedoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedResonanceDoubleSpinChanged); + disconnect(ui->portedPortsNumberSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &MainWindow::onPortedPortsNumberSpinChanged); + disconnect(ui->portedPortDiameterDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedPortDiameterDoubleSpinChanged); + disconnect(ui->portedPortSlotWidthButton, &QPushButton::clicked, this, &MainWindow::onPortedSlotPortActivated); + disconnect(ui->portedPortSlotWidthDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onPortedSlotWidthDoubleSpinChanged); + + disconnect(ui->bandPassSealedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassSealedVolumeDoubleSpinChanged); + disconnect(ui->bandPassPortedVolumeDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassPortedVolumeDoubleSpinChanged); + disconnect(ui->bandPassPortedResonanceDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassPortedResonanceDoubleSpinChanged); + disconnect(ui->bandPassPortsNumberSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &MainWindow::onBandPassPortNumSpinChanged); + disconnect(ui->bandPassPortDiameterDoubleSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &MainWindow::onBandPassPortDiameterDoubleSpinChanged); } void MainWindow::unlinkInternals() { - disconnect(this, SIGNAL(currentSpeakerChanged(Speaker)), this, SLOT(onCurrentSpeakerChanged(const Speaker&))); - disconnect(this, SIGNAL(currentSealedBoxChanged(SealedBox)), this, SLOT(onCurrentSealedBoxChanged(const SealedBox&))); - disconnect(this, SIGNAL(currentPortedBoxChanged(PortedBox)), this, SLOT(onCurrentPortedBoxChanged(const PortedBox&))); - disconnect(this, SIGNAL(currentBandPassBoxChanged(BandPassBox)), this, SLOT(onCurrentBandPassBoxChanged(const BandPassBox&))); + disconnect(this, &MainWindow::currentSpeakerChanged, this, &MainWindow::onCurrentSpeakerChanged); + disconnect(this, &MainWindow::currentSealedBoxChanged, this, &MainWindow::onCurrentSealedBoxChanged); + disconnect(this, &MainWindow::currentPortedBoxChanged, this, &MainWindow::onCurrentPortedBoxChanged); + disconnect(this, &MainWindow::currentBandPassBoxChanged, this, &MainWindow::onCurrentBandPassBoxChanged); } void MainWindow::onSpeakerNew() { isModifying = false; spkDialog = new SpeakerDialog(this); - connect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); - connect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); + connect(spkDialog, &SpeakerDialog::speakerInserted, this, &MainWindow::onSpeakerInserted); + connect(spkDialog, &SpeakerDialog::speakerCancelled, this, &MainWindow::onSpeakerCancelled); spkDialog->show(); } @@ -804,8 +826,8 @@ { isModifying = true; spkDialog = new SpeakerDialog(currentSpeaker, this); - connect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); - connect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); + connect(spkDialog, &SpeakerDialog::speakerInserted, this, &MainWindow::onSpeakerInserted); + connect(spkDialog, &SpeakerDialog::speakerCancelled, this,&MainWindow:: onSpeakerCancelled); spkDialog->show(); } @@ -831,8 +853,8 @@ /* spk has been inserted or modified: remove anyway notInDbSpeaker */ notInDbSpeaker = nullptr; - disconnect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); - disconnect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); + disconnect(spkDialog, &SpeakerDialog::speakerInserted, this, &MainWindow::onSpeakerInserted); + disconnect(spkDialog, &SpeakerDialog::speakerCancelled, this, &MainWindow::onSpeakerCancelled); spkDialog->close(); spkDialog->deleteLater(); spkDialog = nullptr; @@ -840,8 +862,8 @@ void MainWindow::onSpeakerCancelled() { - disconnect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); - disconnect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); + disconnect(spkDialog, &SpeakerDialog::speakerInserted, this, &MainWindow::onSpeakerInserted); + disconnect(spkDialog, &SpeakerDialog::speakerCancelled, this, &MainWindow::onSpeakerCancelled); spkDialog->close(); spkDialog->deleteLater(); spkDialog = nullptr; @@ -914,8 +936,8 @@ void MainWindow::onSpeakerSearch() { searchDialog = new SearchDialog(this); - connect(searchDialog, SIGNAL(searchRequested(const QString&, double, double)), this, SLOT(onSearchRequested(const QString&, double, double))); - connect(searchDialog, SIGNAL(searchCancelled()), this, SLOT(onSearchCancelled())); + connect(searchDialog, &SearchDialog::searchRequested, this, &MainWindow::onSearchRequested); + connect(searchDialog,&SearchDialog::searchCancelled, this, &MainWindow::onSearchCancelled); searchDialog->show(); } @@ -962,23 +984,23 @@ void MainWindow::onSearchRequested(const QString& param, double min, double max) { - disconnect(searchDialog, SIGNAL(searchRequested(const QString&, double, double)), this, SLOT(onSearchRequested(const QString&, double, double))); - disconnect(searchDialog, SIGNAL(searchCancelled()), this, SLOT(onSearchCancelled())); + disconnect(searchDialog, &SearchDialog::searchRequested, this, &MainWindow::onSearchRequested); + disconnect(searchDialog, &SearchDialog::searchCancelled, this, &MainWindow::onSearchCancelled); searchDialog->close(); searchDialog->deleteLater(); searchDialog = nullptr; QList speakers = SpeakerDb::getByValue(param, min, max); listDialog = new ListDialog(speakers, this); - connect(listDialog, SIGNAL(speakerItemSelected(QString, const Speaker&)), this, SLOT(onSpeakerItemSelected(QString, const Speaker&))); - connect(listDialog, SIGNAL(speakerItemCancelled()), this, SLOT(onSpeakerItemCancelled())); + connect(listDialog, &ListDialog::speakerItemSelected, this, &MainWindow::onSpeakerItemSelected); + connect(listDialog, &ListDialog::speakerItemCancelled, this, &MainWindow::onSpeakerItemCancelled); listDialog->show(); } void MainWindow::onSearchCancelled() { - disconnect(searchDialog, SIGNAL(searchRequested(const QString&, double, double)), this, SLOT(onSearchRequested(const QString&, double, double))); - disconnect(searchDialog, SIGNAL(searchCancelled()), this, SLOT(onSearchCancelled())); + disconnect(searchDialog, &SearchDialog::searchRequested, this, &MainWindow::onSearchRequested); + disconnect(searchDialog, &SearchDialog::searchCancelled, this, &MainWindow::onSearchCancelled); searchDialog->close(); searchDialog->deleteLater(); searchDialog = nullptr; @@ -992,8 +1014,8 @@ syncUiFromCurrentSpeaker(speaker); } - disconnect(listDialog, SIGNAL(speakerItemSelected(QString, const Speaker&)), this, SLOT(onSpeakerItemSelected(QString, const Speaker&))); - disconnect(listDialog, SIGNAL(speakerItemCancelled()), this, SLOT(onSpeakerItemCancelled())); + disconnect(listDialog, &ListDialog::speakerItemSelected, this, &MainWindow::onSpeakerItemSelected); + disconnect(listDialog, &ListDialog::speakerItemCancelled, this, &MainWindow::onSpeakerItemCancelled); listDialog->close(); listDialog->deleteLater(); listDialog = nullptr; @@ -1001,8 +1023,8 @@ void MainWindow::onSpeakerItemCancelled() { - disconnect(listDialog, SIGNAL(speakerItemSelected(QString,const Speaker&)), this, SLOT(onSpeakerItemSelected(QString,const Speaker&))); - disconnect(listDialog, SIGNAL(speakerItemCancelled()), this, SLOT(onSpeakerItemCancelled())); + disconnect(listDialog, &ListDialog::speakerItemSelected, this, &MainWindow::onSpeakerItemSelected); + disconnect(listDialog, &ListDialog::speakerItemCancelled, this, &MainWindow::onSpeakerItemCancelled); listDialog->close(); listDialog->deleteLater(); listDialog = nullptr; diff -Nru qspeakers-1.6.1/mainwindow.ui qspeakers-1.6.2/mainwindow.ui --- qspeakers-1.6.1/mainwindow.ui 2021-04-26 04:04:08.000000000 +0000 +++ qspeakers-1.6.2/mainwindow.ui 2022-01-12 07:50:08.000000000 +0000 @@ -608,6 +608,9 @@ + + 1 + 0.500000000000000 @@ -648,6 +651,9 @@ false + + 1 + @@ -928,6 +934,9 @@ + + 1 + 0.500000000000000 diff -Nru qspeakers-1.6.1/plot.cpp qspeakers-1.6.2/plot.cpp --- qspeakers-1.6.1/plot.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/plot.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -1,16 +1,19 @@ #include "plot.h" #include +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) using namespace QtCharts; +#endif Plot::Plot(QWidget *parent) : QChartView(parent), xmin(10.0), xmax(1000.0), - pointerLabel(nullptr), vLine(nullptr), - vLabel(nullptr) + vLine3db(nullptr), + vLabel3db(nullptr) { + setCursor(Qt::CrossCursor); initializeChart(); initializeCurve(); initializeScales(); @@ -20,10 +23,11 @@ QChartView(parent), xmin(10.0), xmax(1000.0), - pointerLabel(nullptr), vLine(nullptr), - vLabel(nullptr) + vLine3db(nullptr), + vLabel3db(nullptr) { + setCursor(Qt::CrossCursor); initializeChart(title); initializeCurve(); initializeScales(); @@ -35,8 +39,8 @@ delete curve; delete chart; delete vLine; - delete vLabel; - delete pointerLabel; + delete vLine3db; + delete vLabel3db; } void Plot::appendPointF(const QPointF &pointf) @@ -80,22 +84,20 @@ QPointF value2 = QPoint(x, y2); QPointF point2 = chart->mapToPosition(value2); QLineF line (point1, point2); - if (vLine) { - this->scene()->removeItem(vLine); - delete vLine; - vLine = nullptr; - } - vLine = this->scene()->addLine(line, QPen(Qt::DashLine)); - - if (vLabel) { - this->scene()->removeItem(vLabel); - delete vLabel; - vLabel = nullptr; + if (vLine3db) { + this->scene()->removeItem(vLine3db); + delete vLine3db; + } + vLine3db = this->scene()->addLine(line, QPen(Qt::DashLine)); + + if (vLabel3db) { + this->scene()->removeItem(vLabel3db); + delete vLabel3db; } QString label = QString(tr("%1 dB at %2 Hz")).arg(-3.0).arg(round(x)); - vLabel = this->scene()->addSimpleText(label); + vLabel3db = this->scene()->addSimpleText(label); QPointF pos = chart->mapToPosition(value1); - vLabel->setPos(pos); + vLabel3db->setPos(pos); } void Plot::resizeEvent(QResizeEvent *event) @@ -104,41 +106,65 @@ draw3dbVLine(); } -void Plot::mousePressEvent(QMouseEvent *event) +bool Plot::viewportEvent(QEvent *event) { - if (!pointerLabel) { - QPoint pos = event->pos(); - QPointF val = chart->mapToValue(pos); - double y = curveYfromX(val.x()); - QString label = QString(tr("%1 dB at %2 Hz")).arg(round(y)).arg(round(val.x())); - pointerLabel = this->scene()->addSimpleText(label); - pointerLabel->setPos(pos.x() - pointerLabel->boundingRect().width(), pos.y() - pointerLabel->boundingRect().height()); - event->accept(); + switch (event->type()) { + case QEvent::ToolTip: + return false; + default: + break; } + + return QChartView::viewportEvent(event); } void Plot::mouseMoveEvent(QMouseEvent *event) { - if (pointerLabel) { - QPoint pos = event->pos(); - QPointF val = chart->mapToValue(pos); - double y = curveYfromX(val.x()); - QString label = QString(tr("%1 dB at %2 Hz")).arg(round(y)).arg(round(val.x())); - pointerLabel->setText(label); - pointerLabel->setPos(pos.x() - pointerLabel->boundingRect().width(), pos.y() - pointerLabel->boundingRect().height()); - event->accept(); - } + if (event->buttons() != Qt::LeftButton) + return; + + QPoint pos = event->pos(); + QPointF val = chart->mapToValue(pos); + double y = curveYfromX(val.x()); + QString label = QString(tr("%1 dB at %2 Hz")).arg(round(y)).arg(round(val.x())); + + QToolTip::showText(event->globalPos(), label, this, QRect(), 10000); + + drawVLine(pos); + + event->accept(); +} + +void Plot::mousePressEvent(QMouseEvent *event) +{ + + if (event->buttons() != Qt::LeftButton) + return; + + QPoint pos = event->pos(); + + QPointF val = chart->mapToValue(pos); + double y = curveYfromX(val.x()); + QString label = QString(tr("%1 dB at %2 Hz")).arg(round(y)).arg(round(val.x())); + + QToolTip::showText(event->globalPos(), label, this, QRect(), 10000); + + drawVLine(pos); + + event->accept(); } void Plot::mouseReleaseEvent(QMouseEvent *event) { - if (pointerLabel) { - this->scene()->removeItem(pointerLabel); - delete pointerLabel; - pointerLabel = nullptr; - event->accept(); + if (vLine) { + this->scene()->removeItem(vLine); + delete vLine; + vLine = nullptr; } + + event->accept(); } + double Plot::curveXfromY(double y) { double x = 1.0; @@ -172,6 +198,27 @@ return y; } +void Plot::drawVLine(QPoint pos) +{ + QPointF val = chart->mapToValue(pos); + + /* redraw dashed vertical line */ + double x = val.x(); + QValueAxis* yaxis0 = qobject_cast(chart->axes(Qt::Vertical, curve).at(0)); + double ymin = yaxis0->min(); + double ymax = yaxis0->max(); + QPointF value1(x, ymin); + QPointF point1 = chart->mapToPosition(value1); + QPointF value2(x, ymax); + QPointF point2 = chart->mapToPosition(value2); + QLineF line (point1, point2); + if (vLine) { + this->scene()->removeItem(vLine); + delete vLine; + } + vLine = this->scene()->addLine(line, QPen(Qt::DashLine)); +} + double Plot::getXmax() const { return xmax; diff -Nru qspeakers-1.6.1/plot.h qspeakers-1.6.2/plot.h --- qspeakers-1.6.1/plot.h 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/plot.h 2022-01-12 07:50:08.000000000 +0000 @@ -26,11 +26,13 @@ void initializeChart(const QString& title = nullptr); void initializeCurve(); void resizeEvent(QResizeEvent *event); - void mousePressEvent(QMouseEvent *event); + bool viewportEvent(QEvent *event); void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent* event); + void mouseReleaseEvent(QMouseEvent* event); double curveXfromY(double y); double curveYfromX(double x); + void drawVLine(QPoint pos); private: QLineSeries *curve; QChart *chart; @@ -38,7 +40,8 @@ double xmax; QGraphicsSimpleTextItem *pointerLabel; QGraphicsLineItem *vLine; - QGraphicsSimpleTextItem *vLabel; + QGraphicsLineItem *vLine3db; + QGraphicsSimpleTextItem *vLabel3db; }; #endif // PLOT_H Binary files /tmp/tmp5pk0l295/9jSPKTLPf2/qspeakers-1.6.1/qspeakers-128x128.png and /tmp/tmp5pk0l295/w4HcvPIJng/qspeakers-1.6.2/qspeakers-128x128.png differ Binary files /tmp/tmp5pk0l295/9jSPKTLPf2/qspeakers-1.6.1/qspeakers-64x64.png and /tmp/tmp5pk0l295/w4HcvPIJng/qspeakers-1.6.2/qspeakers-64x64.png differ diff -Nru qspeakers-1.6.1/qspeakers.desktop qspeakers-1.6.2/qspeakers.desktop --- qspeakers-1.6.1/qspeakers.desktop 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/qspeakers.desktop 2022-01-12 07:50:08.000000000 +0000 @@ -1,5 +1,4 @@ [Desktop Entry] -Encoding=UTF-8 Name=QSpeakers Name[fr]=QSpeakers GenericName=Loudspeaker Enclosure Design Tool @@ -8,6 +7,7 @@ Comment[fr]=Simule et optimise des enceintes acoustiques classiques Keywords=do it yourself;diy;box;speaker;woofer;audio;simulation;acoustics Keywords[fr]=bricolage;diy;boîte;haut-parleur;boomer;audio;simulation;acoustique +TryExec=qspeakers Exec=qspeakers %f Icon=qspeakers Terminal=false Binary files /tmp/tmp5pk0l295/9jSPKTLPf2/qspeakers-1.6.1/qspeakers.png and /tmp/tmp5pk0l295/w4HcvPIJng/qspeakers-1.6.2/qspeakers.png differ diff -Nru qspeakers-1.6.1/qspeakers.pro qspeakers-1.6.2/qspeakers.pro --- qspeakers-1.6.1/qspeakers.pro 2021-05-05 08:18:28.000000000 +0000 +++ qspeakers-1.6.2/qspeakers.pro 2022-01-12 07:50:08.000000000 +0000 @@ -6,7 +6,7 @@ QT += core gui xml widgets printsupport charts CONFIG += c++11 -VERSION = 1.6.1 +VERSION = 1.6.2 REVISION = $$system(git describe --long --tags 2>/dev/null || echo "stable") TARGET = qspeakers TEMPLATE = app @@ -116,9 +116,11 @@ mime.files = application-x-$${TARGET}.xml desktop.path = $$DATADIR/applications desktop.files = $${TARGET}.desktop - icon.path = $$DATADIR/pixmaps - icon.files = qspeakers.png + icon.path = $$DATADIR/icons/hicolor/scalable/apps + icon.files = qspeakers.svg scad.path = $$DATADIR/$${TARGET} + metainfo.path = $$DATADIR/metainfo + metainfo.files = fr.free.brouits.qspeakers.metainfo.xml INSTALLS += target \ icon \ manual \ @@ -126,7 +128,8 @@ translations \ mime \ desktop \ - scad + scad \ + metainfo } win32-g++ { @@ -138,5 +141,5 @@ INSTALLS += target \ database \ translations \ - scad + scad } diff -Nru qspeakers-1.6.1/searchdialog.cpp qspeakers-1.6.2/searchdialog.cpp --- qspeakers-1.6.1/searchdialog.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/searchdialog.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -13,8 +13,8 @@ ui->searchComboBox->addItems(params); - connect(this, SIGNAL(accepted()), this, SLOT(onAccepted())); - connect(this, SIGNAL(rejected()), this, SLOT(onRejected())); + connect(this, &SearchDialog::accepted, this, &SearchDialog::onAccepted); + connect(this, &SearchDialog::rejected, this, &SearchDialog::onRejected); } SearchDialog::~SearchDialog() diff -Nru qspeakers-1.6.1/speaker.cpp qspeakers-1.6.2/speaker.cpp --- qspeakers-1.6.1/speaker.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/speaker.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -1,5 +1,8 @@ #include "speaker.h" #include +#include +#include +#include Speaker::Speaker() : fs(0.0), @@ -71,28 +74,43 @@ return *this; } -bool Speaker::operator!=(const Speaker& r) const +/* https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ */ +static bool almostEqualRelative(double a, double b, double maxRelDiff = DBL_EPSILON) { - return this->fs != r.getFs() || - this->vas != r.getVas() || - this->re != r.getRe() || - this->qts != r.getQts() || - this->sd != r.getSd() || - this->xmax != r.getXmax() || - this->z != r.getZ() || - this->dia != r.getDia() || - this->le != r.getLe() || - this->qms != r.getQms() || - this->qes != r.getQes() || - this->pe != r.getPe() || - this->bl != r.getBL() || - this->spl != r.getSpl() || - this->vc != r.getVc(); + double diff = fabs(a - b); + a = fabs(a); + b = fabs(b); + + double largest = (b > a) ? b : a; + + if (diff <= largest * maxRelDiff) + return true; + return false; } bool Speaker::operator==(const Speaker& r) const { - return !(*this != r); + + return almostEqualRelative(fs, r.getFs()) && + almostEqualRelative(vas, r.getVas()) && + almostEqualRelative(re, r.getRe()) && + almostEqualRelative(qts, r.getQts()) && + almostEqualRelative(sd, r.getSd()) && + almostEqualRelative(xmax, r.getXmax()) && + almostEqualRelative(z, r.getZ()) && + almostEqualRelative(dia, r.getDia()) && + almostEqualRelative(le, r.getLe()) && + almostEqualRelative(qms, r.getQms()) && + almostEqualRelative(qes, r.getQes()) && + almostEqualRelative(pe, r.getPe()) && + almostEqualRelative(bl, r.getBL()) && + almostEqualRelative(spl, r.getSpl()) && + vc == r.getVc(); +} + +bool Speaker::operator!=(const Speaker& r) const +{ + return !(*this == r); } bool Speaker::isValid() const diff -Nru qspeakers-1.6.1/speakerdb.cpp qspeakers-1.6.2/speakerdb.cpp --- qspeakers-1.6.1/speakerdb.cpp 2020-12-07 05:27:42.000000000 +0000 +++ qspeakers-1.6.2/speakerdb.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -20,7 +20,9 @@ QString SpeakerDb::getPath(void) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + QString prefix = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); +#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0) QString prefix = QStandardPaths::writableLocation(QStandardPaths::DataLocation); #else QString prefix = QDesktopServices::storageLocation(QDesktopServices::DataLocation); diff -Nru qspeakers-1.6.1/speakerdialog.cpp qspeakers-1.6.2/speakerdialog.cpp --- qspeakers-1.6.1/speakerdialog.cpp 2020-12-05 06:04:43.000000000 +0000 +++ qspeakers-1.6.2/speakerdialog.cpp 2022-01-12 07:50:08.000000000 +0000 @@ -14,10 +14,10 @@ /* do not enable 'ok' since model and vendor are empty */ ui->speakerButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - connect(this, SIGNAL(accepted()), this, SLOT(onSpeakerAccepted())); - connect(this, SIGNAL(rejected()), this, SLOT(onSpeakerRejected())); - connect(ui->vendorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onVendorTextChanged(QString))); - connect(ui->modelLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onModelTextChanged(QString))); + connect(this, &SpeakerDialog::accepted, this, &SpeakerDialog::onSpeakerAccepted); + connect(this, &SpeakerDialog::rejected, this, &SpeakerDialog::onSpeakerRejected); + connect(ui->vendorLineEdit, &QLineEdit::textChanged, this, &SpeakerDialog::onVendorTextChanged); + connect(ui->modelLineEdit, &QLineEdit::textChanged, this, &SpeakerDialog::onModelTextChanged); } SpeakerDialog::SpeakerDialog(const Speaker &edit, QWidget *parent) : @@ -48,10 +48,10 @@ ui->vendorLineEdit->setText(oldVendor); ui->modelLineEdit->setText(oldModel); - connect(this, SIGNAL(accepted()), this, SLOT(onSpeakerAccepted())); - connect(this, SIGNAL(rejected()), this, SLOT(onSpeakerRejected())); - connect(ui->vendorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onVendorTextChanged(QString))); - connect(ui->modelLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onModelTextChanged(QString))); + connect(this, &SpeakerDialog::accepted, this, &SpeakerDialog::onSpeakerAccepted); + connect(this, &SpeakerDialog::rejected, this, &SpeakerDialog::onSpeakerRejected); + connect(ui->vendorLineEdit, &QLineEdit::textChanged, this, &SpeakerDialog::onVendorTextChanged); + connect(ui->modelLineEdit, &QLineEdit::textChanged, this, &SpeakerDialog::onModelTextChanged); } SpeakerDialog::~SpeakerDialog()