diff options
author | Robert Jonsson <spamatica@gmail.com> | 2011-05-28 11:40:31 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2011-05-28 11:40:31 +0000 |
commit | c05ce86388943e66db1aa39ace54f040000e49ac (patch) | |
tree | c656d0902d110f05e0a027ed201119640b1219ef /muse2/muse | |
parent | c31d6446978cba5e7db0e5c58d16e07192e4951a (diff) |
fixed track header
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/header.cpp | 56 | ||||
-rw-r--r-- | muse2/muse/widgets/visibletracks.cpp | 2 |
3 files changed, 40 insertions, 22 deletions
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 9e4db5ba..bd58ad88 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -231,13 +231,15 @@ void TList::paint(const QRect& r) switch (section) { case COL_RECORD: - if (track->canRecord()) { + if (track->canRecord() && !header->isSectionHidden(COL_RECORD)) { drawCenteredPixmap(p, track->recordFlag() ? record_on_Icon : record_off_Icon, r); } break; case COL_CLASS: { + if (header->isSectionHidden(COL_CLASS)) + break; const QPixmap* pm = 0; switch(type) { case Track::MIDI: diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index 61ebcc74..c12c8eaf 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -29,21 +29,34 @@ void Header::readStatus(Xml& xml) return; case Xml::Text: { - //QStringList l = QStringList::split(QString(" "), tag); - QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); - int index = count() -1; - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - int logialIdx=abs((*it).toInt()); - bool isHidden = (*it).toInt() < 0 ? true:false; - int section = visualIndex(logialIdx); - setMovable(true); - moveSection(section, index); - if (isHidden) - hideSection(logialIdx); - else - showSection(logialIdx); - --index; - } + QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); + int index = count() -1; + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + int logialIdx=abs((*it).toInt()); + bool isHidden = (*it).toInt() < 0 ? true:false; + int section = visualIndex(logialIdx); + moveSection(section, index); + if (isHidden) + hideSection(logialIdx-1); + else + showSection(logialIdx); + --index; + } + + // loop again looking for missing indexes + for (int i =0; i < count(); i++) { + bool foundIt=false; + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + int id=((*it).toInt()); + if ( id == i || i ==1-id ) + foundIt=true; + } + if (foundIt == false) { + int section = visualIndex(i); + moveSection(section, i); + //printf("Adding missing i %d index %d section %d!\n", i, index, section); + } + } } break; case Xml::TagStart: @@ -66,10 +79,10 @@ void Header::writeStatus(int level, Xml& xml) const { //xml.nput(level, "<%s> ", name()); xml.nput(level, "<%s> ", Xml::xmlString(objectName()).toLatin1().constData()); - int n = count() - 1; + int n = count(); for (int i = n; i >= 0; --i) { if (isSectionHidden(logicalIndex(i))) - xml.nput("%d ", -logicalIndex(i)); // hidden is stored as negative value + xml.nput("%d ", -logicalIndex(i)-1); // hidden is stored as negative value starting from -1 else xml.nput("%d ", logicalIndex(i)); } @@ -88,7 +101,7 @@ Header::Header(QWidget* parent, const char* name) itemModel = new QStandardItemModel; setModel(itemModel); setDefaultSectionSize(30); -// setStretchLastSection(true); + setStretchLastSection(true); } @@ -134,7 +147,7 @@ void Header::mousePressEvent ( QMouseEvent * e ) p->setTitle(tr("Track Info Columns")); QAction* act = 0; - for(int i=1; i < count(); i++) { + for(int i=0; i < count(); i++) { act = p->addAction(itemModel->horizontalHeaderItem(logicalIndex(i))->text() + "\t - "+ itemModel->horizontalHeaderItem(logicalIndex(i))->toolTip()); @@ -147,8 +160,11 @@ void Header::mousePressEvent ( QMouseEvent * e ) p->exec(QCursor::pos()); delete p; - + return; } + + QHeaderView::mousePressEvent(e); + } void Header::changeColumns(QAction *a) { diff --git a/muse2/muse/widgets/visibletracks.cpp b/muse2/muse/widgets/visibletracks.cpp index e261c274..f6acf206 100644 --- a/muse2/muse/widgets/visibletracks.cpp +++ b/muse2/muse/widgets/visibletracks.cpp @@ -87,7 +87,7 @@ void VisibleTracks::updateVisibleTracksButtons() void VisibleTracks::visibilityChanged(QAction* action) { - printf("update visibility\n"); +// printf("update visibility\n"); switch (((Action*)action)->id()) { case 0: WaveTrack::setVisible(action->isChecked()); |