changeset 399:80c7dd3c8dce

* 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)
author Chris Cannam
date Fri, 13 Jun 2008 21:09:43 +0000
parents 80e279e4f9fe
children 32acd578fcba
files widgets/ModelDataTableDialog.cpp widgets/ModelDataTableDialog.h
diffstat 2 files changed, 44 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 <QTableView>
 #include <QGridLayout>
@@ -28,6 +29,8 @@
 #include <QHeaderView>
 #include <QApplication>
 #include <QDesktopWidget>
+#include <QAction>
+#include <QToolBar>
 
 #include <iostream>
 
@@ -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;
--- 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;