aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Amit Chaudhuri <amit.k.chaudhuri@gmail.com>2013-04-12 08:24:07 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-12 12:54:08 -0700
commit76f71b4ca07dbef1069aec3db1138c199927b1bb (patch)
tree4ef068b3d60dc497c7549019f95425ee4ef7076e /qt-ui/mainwindow.cpp
parent9dbda9f62aca314aa7cb7ef588b1ce5ec43a01b9 (diff)
downloadsubsurface-76f71b4ca07dbef1069aec3db1138c199927b1bb.tar.gz
Add dive list view to main window
Add files for dive list model/view implementation. Replace TableView with the custom list view. Amendments to makefile to match. Note: we don't yet handle trips and may want to add additional columns to describe the dive. A single, dummy dive is added to show how this works (get root; item is child of root). Purely to illustrate - needs proper integration etc. Amend member names for dive list view components Various naming changes to conform to coding style. Required changes to members (remove prefix) and methods (avoid clash with members). Clean up indentation (swap spaces for tabs). Code for model/view was written with a different editor which had different settings :-/ [Dirk Hohndel: minor whitespace cleanup] Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 56c39015b..03f6b6ca6 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -4,9 +4,38 @@
#include <QVBoxLayout>
#include <QtDebug>
+#include "divelistview.h"
+#include "divetripmodel.h"
+
MainWindow::MainWindow() : ui(new Ui::MainWindow())
{
ui->setupUi(this);
+
+ /* may want to change ctor to avoid filename as 1st param.
+ * here we just use an empty string
+ */
+ model = new DiveTripModel("",this);
+ if (model){
+ ui->ListWidget->setModel(model);
+ }
+ /* add in dives here.
+ * we need to root to parent all top level dives
+ * trips need more work as it complicates parent/child stuff.
+ *
+ * We show how to obtain the root and add a demo dive
+ *
+ * Todo: work through integration with current list of dives/trips
+ * Todo: look at alignment/format of e.g. duration in view
+ */
+ DiveItem *dive = 0;
+ DiveItem *root = model->itemForIndex(QModelIndex());
+ if (root){
+ dive = new DiveItem(1,QString("01/03/13"),14.2, 29.0,QString("Wraysbury"),root);
+
+ Q_UNUSED(dive)
+ }
+
+
}
void MainWindow::on_actionNew_triggered()