# HG changeset patch # User Chris Cannam # Date 1213719890 0 # Node ID 66e01a6c95540824a81d63c127e0afce7c236d07 # Parent 96531861b2f3ddfb93373fb2f6377aa37315faab * start play-tracking toggle in data editor dialog diff -r 96531861b2f3 -r 66e01a6c9554 widgets/ModelDataTableDialog.cpp --- a/widgets/ModelDataTableDialog.cpp Tue Jun 17 16:07:56 2008 +0000 +++ b/widgets/ModelDataTableDialog.cpp Tue Jun 17 16:24:50 2008 +0000 @@ -45,7 +45,15 @@ IconLoader il; - QAction *action = new QAction(il.load("datainsert"), tr("Insert New Item"), this); + QAction *action = new QAction(il.load("playfollow"), tr("Track Playback"), this); + action->setStatusTip(tr("Toggle tracking of playback position")); + action->setCheckable(true); + connect(action, SIGNAL(triggered()), this, SLOT(togglePlayTracking())); + toolbar->addAction(action); + + CommandHistory::getInstance()->registerToolbar(toolbar); + + action = new QAction(il.load("datainsert"), tr("Insert New Item"), this); action->setShortcut(tr("Insert")); action->setStatusTip(tr("Insert a new item")); connect(action, SIGNAL(triggered()), this, SLOT(insertRow())); @@ -63,8 +71,6 @@ connect(action, SIGNAL(triggered()), this, SLOT(editRow())); toolbar->addAction(action); - CommandHistory::getInstance()->registerToolbar(toolbar); - QFrame *mainFrame = new QFrame; setCentralWidget(mainFrame); @@ -157,6 +163,9 @@ int rh = m_tableView->height() / m_tableView->rowHeight(0); int topRow = row - rh/2; if (topRow < 0) topRow = 0; + //!!! should not do any of this if an item in the given row is + //already current; should not scroll if the current row is already + //visible m_tableView->scrollTo (m_table->getModelIndexForRow(topRow)); m_tableView->selectionModel()->setCurrentIndex @@ -216,6 +225,12 @@ } void +ModelDataTableDialog::togglePlayTracking() +{ + m_trackPlayback = !m_trackPlayback; +} + +void ModelDataTableDialog::currentChangedThroughResort(const QModelIndex &index) { std::cerr << "ModelDataTableDialog::currentChangedThroughResort: row = " << index.row() << std::endl; diff -r 96531861b2f3 -r 66e01a6c9554 widgets/ModelDataTableDialog.h --- a/widgets/ModelDataTableDialog.h Tue Jun 17 16:07:56 2008 +0000 +++ b/widgets/ModelDataTableDialog.h Tue Jun 17 16:24:50 2008 +0000 @@ -49,6 +49,7 @@ void insertRow(); void deleteRows(); void editRow(); + void togglePlayTracking(); protected: void makeCurrent(int row);