# HG changeset patch # User Chris Cannam # Date 1213391383 0 # Node ID 80c7dd3c8dce0c24e51bc7d80238fccfb6b995e1 # Parent 80e279e4f9febf71d7e24dd8b3520c204f71e342 * Add audio device selection to preferences * Add (not yet functional) insert, delete, edit buttons to data edit window * Add proper set methods for time fields in data edit window (using general sparse model base class) diff -r 80e279e4f9fe -r 80c7dd3c8dce widgets/ModelDataTableDialog.cpp --- a/widgets/ModelDataTableDialog.cpp Thu Jun 12 14:33:45 2008 +0000 +++ b/widgets/ModelDataTableDialog.cpp Fri Jun 13 21:09:43 2008 +0000 @@ -20,6 +20,7 @@ #include "data/model/Model.h" #include "CommandHistory.h" +#include "IconLoader.h" #include #include @@ -28,6 +29,8 @@ #include #include #include +#include +#include #include @@ -37,6 +40,27 @@ setWindowTitle(tr("Data Editor")); QToolBar *toolbar = addToolBar(tr("Toolbar")); + + IconLoader il; + + QAction *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())); + toolbar->addAction(action); + + action = new QAction(il.load("datadelete"), tr("Delete Selected Items"), this); + action->setShortcut(tr("Delete")); + action->setStatusTip(tr("Delete the selected item or items")); + connect(action, SIGNAL(triggered()), this, SLOT(deleteRow())); + toolbar->addAction(action); + + action = new QAction(il.load("dataedit"), tr("Edit Selected Item"), this); + action->setShortcut(tr("Edit")); + action->setStatusTip(tr("Edit the selected item")); + connect(action, SIGNAL(triggered()), this, SLOT(editRow())); + toolbar->addAction(action); + CommandHistory::getInstance()->registerToolbar(toolbar); QFrame *mainFrame = new QFrame; @@ -63,7 +87,7 @@ m_tableView = new QTableView; subgrid->addWidget(m_tableView); - m_tableView->verticalHeader()->hide(); +// m_tableView->verticalHeader()->hide(); // m_tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); m_tableView->setSortingEnabled(true); m_tableView->sortByColumn(0, Qt::AscendingOrder); @@ -123,6 +147,21 @@ } void +ModelDataTableDialog::insertRow() +{ +} + +void +ModelDataTableDialog::deleteRow() +{ +} + +void +ModelDataTableDialog::editRow() +{ +} + +void ModelDataTableDialog::executeCommand(Command *command) { std::cerr << "ModelDataTableDialog::executeCommand(" << command << ")" << std::endl; diff -r 80e279e4f9fe -r 80c7dd3c8dce widgets/ModelDataTableDialog.h --- a/widgets/ModelDataTableDialog.h Thu Jun 12 14:33:45 2008 +0000 +++ b/widgets/ModelDataTableDialog.h Fri Jun 13 21:09:43 2008 +0000 @@ -42,6 +42,10 @@ protected slots: void viewClicked(const QModelIndex &); void viewPressed(const QModelIndex &); + + void insertRow(); + void deleteRow(); + void editRow(); protected: ModelDataTableModel *m_table;