Mercurial > hg > svcore
changeset 618:b1dc68507e46 sv-v1.7.1
* Layer data editor window: fix sorting for columns in region model,
add Find feature
* RDF import: assign names to layers based on event types, if no suitable
labels are found in the RDF
* Add label to status bar showing the last text that was passed in current
layer (so e.g. counting 1, 2, 3, 4 if that's what beats are labelled)
* Better layout of text labels for region layers in segmentation mode when
they are close together
* Give text layer the same method for finding "nearest point" as region and
note layers, should improve its editability
author | Chris Cannam |
---|---|
date | Thu, 22 Oct 2009 15:54:21 +0000 |
parents | 24f06d34ac99 |
children | 268c5431936d |
files | data/model/IntervalModel.h data/model/ModelDataTableModel.cpp data/model/ModelDataTableModel.h data/model/RegionModel.h rdf/RDFImporter.cpp |
diffstat | 5 files changed, 42 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/data/model/IntervalModel.h Thu Oct 15 11:32:21 2009 +0000 +++ b/data/model/IntervalModel.h Thu Oct 22 15:54:21 2009 +0000 @@ -117,7 +117,9 @@ virtual bool isColumnTimeValue(int column) const { - return (column < 2 || column == 3); + // NB duration is not a "time value" -- that's for columns + // whose sort ordering is exactly that of the frame time + return (column < 2); } };
--- a/data/model/ModelDataTableModel.cpp Thu Oct 15 11:32:21 2009 +0000 +++ b/data/model/ModelDataTableModel.cpp Thu Oct 22 15:54:21 2009 +0000 @@ -169,6 +169,29 @@ return m_model->getFrameForRow(getUnsorted(index.row())); } +QModelIndex +ModelDataTableModel::findText(QString text) const +{ + if (text == "") return QModelIndex(); + int rows = rowCount(); + int cols = columnCount(); + int current = getCurrentRow(); + for (int row = 1; row <= rows; ++row) { + int wrapped = (row + current) % rows; + for (int col = 0; col < cols; ++col) { + if (m_model->getSortType(col) != TabularModel::SortAlphabetical) { + continue; + } + QString cell = m_model->getData(getUnsorted(wrapped), col, + Qt::DisplayRole).toString(); + if (cell.contains(text, Qt::CaseInsensitive)) { + return createIndex(wrapped, col); + } + } + } + return QModelIndex(); +} + void ModelDataTableModel::sort(int column, Qt::SortOrder sortOrder) { @@ -274,6 +297,8 @@ bool numeric = (m_model->getSortType(m_sortColumn) == TabularModel::SortNumeric); +// std::cerr << "resort: numeric == " << numeric << std::endl; + m_sort.clear(); m_rsort.clear(); @@ -313,6 +338,7 @@ } for (MapType::iterator i = rowMap.begin(); i != rowMap.end(); ++i) { +// std::cerr << "resortNumeric: " << i->second << ": " << i->first << std::endl; m_rsort.push_back(i->second); } @@ -336,6 +362,7 @@ } for (MapType::iterator i = rowMap.begin(); i != rowMap.end(); ++i) { +// std::cerr << "resortAlphabetical: " << i->second << ": " << i->first.toStdString() << std::endl; m_rsort.push_back(i->second); } @@ -343,7 +370,7 @@ } int -ModelDataTableModel::getCurrentRow() +ModelDataTableModel::getCurrentRow() const { return getSorted(m_currentRow); }
--- a/data/model/ModelDataTableModel.h Thu Oct 15 11:32:21 2009 +0000 +++ b/data/model/ModelDataTableModel.h Thu Oct 22 15:54:21 2009 +0000 @@ -56,8 +56,10 @@ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + QModelIndex findText(QString text) const; + void setCurrentRow(int row); - int getCurrentRow(); + int getCurrentRow() const; signals: void frameSelected(size_t);
--- a/data/model/RegionModel.h Thu Oct 15 11:32:21 2009 +0000 +++ b/data/model/RegionModel.h Thu Oct 22 15:54:21 2009 +0000 @@ -142,7 +142,7 @@ virtual int getColumnCount() const { - return 6; + return 5; } virtual QString getHeading(int column) const @@ -197,7 +197,7 @@ virtual SortType getSortType(int column) const { - if (column == 5) return SortAlphabetical; + if (column == 4) return SortAlphabetical; return SortNumeric; }
--- a/rdf/RDFImporter.cpp Thu Oct 15 11:32:21 2009 +0000 +++ b/rdf/RDFImporter.cpp Thu Oct 22 15:54:21 2009 +0000 @@ -855,7 +855,12 @@ ).arg(m_uristring).arg(type); QString title = SimpleSPARQLQuery::singleResultQuery (s, titleQuery, "title").value; - if (title != "") model->setObjectName(title); + if (title == "") { + // take it from the end of the event type + title = type; + title.replace(QRegExp("^.*[/#]"), ""); + } + model->setObjectName(title); modelMap[timeline][type][dimensions][haveDuration] = model; models.push_back(model);