# HG changeset patch # User Chris Cannam # Date 1228238245 0 # Node ID 035d62c4cddf3e78e974d86d075dab017eb41754 # Parent 747a58d45d56a576b8b9a403a960b30d753722cb * Permit viewing (though not editing) colour 3d plot layer data in the spreadsheet data viewer dialog * Add somewhat simplistic RDF export for layers * Fix display of peak frequencies in spectrum layer * Fix (I hope) sizing of plugin parameter dialog diff -r 747a58d45d56 -r 035d62c4cddf layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Mon Dec 01 16:45:17 2008 +0000 +++ b/layer/Colour3DPlotLayer.cpp Tue Dec 02 17:17:25 2008 +0000 @@ -553,12 +553,20 @@ if (symin < 0) symin = 0; if (symax > sh) symax = sh; + float binHeight = float(v->height()) / (symax - symin); + + paint.save(); + + QFont tf = paint.font(); + if (paint.fontMetrics().height() >= binHeight) { + tf.setPixelSize(binHeight > 4 ? binHeight - 2 : 2); + paint.setFont(tf); + } + int count = v->height() / paint.fontMetrics().height(); int step = (symax - symin) / count; if (step == 0) step = 1; - float binHeight = float(v->height()) / (symax - symin); - for (size_t i = symin; i < symax; ++i) { size_t idx = i; @@ -578,6 +586,8 @@ paint.drawText(cw + 5, ty, text); } + + paint.restore(); } void diff -r 747a58d45d56 -r 035d62c4cddf layer/SpectrumLayer.cpp --- a/layer/SpectrumLayer.cpp Mon Dec 01 16:45:17 2008 +0000 +++ b/layer/SpectrumLayer.cpp Tue Dec 02 17:17:25 2008 +0000 @@ -682,6 +682,8 @@ // draw peak lines +// std::cerr << "Showing peaks..." << std::endl; + size_t col = v->getCentreFrame() / fft->getResolution(); paint.save(); @@ -832,9 +834,11 @@ QString indent, QString extraAttributes) const { QString s = QString("windowSize=\"%1\" " - "windowHopLevel=\"%2\"") + "windowHopLevel=\"%2\" " + "showPeaks=\"%3\" ") .arg(m_windowSize) - .arg(m_windowHopLevel); + .arg(m_windowHopLevel) + .arg(m_showPeaks ? "true" : "false"); SliceLayer::toXml(stream, indent, extraAttributes + " " + s); } @@ -851,6 +855,9 @@ size_t windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok); if (ok) setWindowHopLevel(windowHopLevel); + + bool showPeaks = (attributes.value("showPeaks").trimmed() == "true"); + setShowPeaks(showPeaks); } diff -r 747a58d45d56 -r 035d62c4cddf view/Pane.cpp --- a/view/Pane.cpp Mon Dec 01 16:45:17 2008 +0000 +++ b/view/Pane.cpp Tue Dec 02 17:17:25 2008 +0000 @@ -82,6 +82,9 @@ setAcceptDrops(true); updateHeadsUpDisplay(); + + + std::cerr << "Pane::Pane(" << this << ") returning" << std::endl; } void diff -r 747a58d45d56 -r 035d62c4cddf view/View.cpp --- a/view/View.cpp Mon Dec 01 16:45:17 2008 +0000 +++ b/view/View.cpp Tue Dec 02 17:17:25 2008 +0000 @@ -61,11 +61,12 @@ m_manager(0), m_propertyContainer(new ViewPropertyContainer(this)) { + std::cerr << "View::View(" << this << ")" << std::endl; } View::~View() { -// std::cerr << "View::~View(" << this << ")" << std::endl; + std::cerr << "View::~View(" << this << ")" << std::endl; m_deleting = true; delete m_propertyContainer; diff -r 747a58d45d56 -r 035d62c4cddf widgets/FileFinder.cpp --- a/widgets/FileFinder.cpp Mon Dec 01 16:45:17 2008 +0000 +++ b/widgets/FileFinder.cpp Tue Dec 02 17:17:25 2008 +0000 @@ -18,6 +18,7 @@ #include "data/fileio/AudioFileReaderFactory.h" #include "data/fileio/DataFileReaderFactory.h" #include "rdf/RDFImporter.h" +#include "rdf/RDFExporter.h" #include #include @@ -63,7 +64,7 @@ case SessionFile: settingsKey = "sessionpath"; title = tr("Select a session file"); - filter = tr("Sonic Visualiser session files (*.sv)\nAll files (*.*)"); + filter = tr("Sonic Visualiser session files (*.sv)\nRDF files (%1)\nAll files (*.*)").arg(RDFImporter::getKnownExtensions()); break; case AudioFile: @@ -75,17 +76,22 @@ case LayerFile: settingsKey = "layerpath"; - filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%3)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()); + filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%2)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)") + .arg(DataFileReaderFactory::getKnownExtensions()) + .arg(RDFImporter::getKnownExtensions()); break; case LayerFileNoMidi: settingsKey = "layerpath"; - filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%3)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()); + filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%2)\nText files (*.txt)\nAll files (*.*)") + .arg(DataFileReaderFactory::getKnownExtensions()) + .arg(RDFImporter::getKnownExtensions()); break; case SessionOrAudioFile: settingsKey = "lastpath"; - filter = tr("All supported files (*.sv %1)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nAll files (*.*)") + filter = tr("All supported files (*.sv %1)\nSonic Visualiser session files (*.sv)\nRDF files (%1)\nAudio files (%2)\nAll files (*.*)") + .arg(RDFImporter::getKnownExtensions()) .arg(AudioFileReaderFactory::getKnownExtensions()); break; @@ -105,7 +111,7 @@ case AnyFile: settingsKey = "lastpath"; - filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nAll files (*.*)") + filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nRDF files (%3)\nAll files (*.*)") .arg(AudioFileReaderFactory::getKnownExtensions()) .arg(DataFileReaderFactory::getKnownExtensions()) .arg(RDFImporter::getKnownExtensions()); @@ -211,13 +217,13 @@ case LayerFile: settingsKey = "savelayerpath"; title = tr("Select a file to export to"); - filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)"); + filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nRDF/Turtle files (%1)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)").arg(RDFExporter::getSupportedExtensions()); break; case LayerFileNoMidi: settingsKey = "savelayerpath"; title = tr("Select a file to export to"); - filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nText files (*.txt)\nAll files (*.*)"); + filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nRDF/Turtle files (%1)\nText files (*.txt)\nAll files (*.*)").arg(RDFExporter::getSupportedExtensions()); break; case SessionOrAudioFile: @@ -299,6 +305,8 @@ expectedExtension = "csv"; } else if (selectedFilter.contains(".mid")) { expectedExtension = "mid"; + } else if (selectedFilter.contains(".ttl")) { + expectedExtension = "ttl"; } std::cerr << "expected extension = " << expectedExtension.toStdString() << std::endl; if (expectedExtension != "") { diff -r 747a58d45d56 -r 035d62c4cddf widgets/PluginParameterDialog.cpp --- a/widgets/PluginParameterDialog.cpp Mon Dec 01 16:45:17 2008 +0000 +++ b/widgets/PluginParameterDialog.cpp Tue Dec 02 17:17:25 2008 +0000 @@ -239,7 +239,7 @@ m_advancedVisible = settings.value("advancedvisible", false).toBool(); settings.endGroup(); - m_advanced->setVisible(false); + m_advanced->hide(); hbox->addWidget(m_advancedButton); m_advancedButton->hide(); @@ -257,6 +257,14 @@ { } +int +PluginParameterDialog::exec() +{ + show(); + setAdvancedVisible(m_advancedVisible); + return QDialog::exec(); +} + void PluginParameterDialog::setOutputLabel(QString text, @@ -584,28 +592,32 @@ void PluginParameterDialog::setAdvancedVisible(bool visible) { - m_advanced->setVisible(visible); +// m_advanced->setVisible(visible); if (visible) { m_advancedButton->setText(tr("Advanced <<")); m_advancedButton->setChecked(true); + m_advanced->show(); } else { + m_advanced->hide(); m_advancedButton->setText(tr("Advanced >>")); m_advancedButton->setChecked(false); } + std::cerr << "resize to " << sizeHint().width() << " x " << sizeHint().height() << std::endl; + +// setMinimumHeight(sizeHint().height()); + adjustSize(); + +// (sizeHint()); + + m_advancedVisible = visible; + QSettings settings; settings.beginGroup("PluginParameterDialog"); settings.setValue("advancedvisible", visible); settings.endGroup(); -// std::cerr << "resize to " << sizeHint().width() << " x " << sizeHint().height() << std::endl; - - setMinimumHeight(sizeHint().height()); - adjustSize(); - - m_advancedVisible = visible; - // if (visible) setMaximumHeight(sizeHint().height()); // adjustSize(); } diff -r 747a58d45d56 -r 035d62c4cddf widgets/PluginParameterDialog.h --- a/widgets/PluginParameterDialog.h Mon Dec 01 16:45:17 2008 +0000 +++ b/widgets/PluginParameterDialog.h Tue Dec 02 17:17:25 2008 +0000 @@ -74,6 +74,8 @@ void getProcessingParameters(size_t &stepSize, size_t &blockSize, WindowType &windowType) const; + int exec(); + signals: void pluginConfigurationChanged(QString); void inputModelChanged(QString); diff -r 747a58d45d56 -r 035d62c4cddf widgets/PropertyBox.cpp --- a/widgets/PropertyBox.cpp Mon Dec 01 16:45:17 2008 +0000 +++ b/widgets/PropertyBox.cpp Tue Dec 02 17:17:25 2008 +0000 @@ -51,7 +51,7 @@ #include #include -#define DEBUG_PROPERTY_BOX 1 +//#define DEBUG_PROPERTY_BOX 1 PropertyBox::PropertyBox(PropertyContainer *container) : m_container(container), @@ -60,7 +60,7 @@ { #ifdef DEBUG_PROPERTY_BOX std::cerr << "PropertyBox[" << this << "(\"" << - container->getPropertyContainerName().toStdString() << "\")]::PropertyBox" << std::endl; + container->getPropertyContainerName().toStdString() << "\" at " << container << ")]::PropertyBox" << std::endl; #endif m_mainBox = new QVBoxLayout; @@ -561,6 +561,10 @@ std::cerr << "PropertyBox[" << this << "]: unitDatabaseChanged" << std::endl; blockSignals(true); +// std::cerr << "my container is " << m_container << std::endl; +// std::cerr << "my container's name is... " << std::endl; +// std::cerr << m_container->objectName().toStdString() << std::endl; + PropertyContainer::PropertyList properties = m_container->getProperties(); for (size_t i = 0; i < properties.size(); ++i) { if (m_container->getPropertyType(properties[i]) ==