1 /***************************************************************************
2 bcview.cpp - description
4 begin : Sun Jun 17 19:19:58 CEST 2001
5 copyright : (C) 2001 by Michael Andreen
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
20 #include "battlesum.h"
22 #include "ui/infoview.h"
26 #include <qlistview.h>
27 #include <qwidgetstack.h>
29 BSView::BSView(QWidget *parent, BSDoc *doc) : QSplitter(parent)
31 /** connect doc with the view*/
32 connect(doc, SIGNAL(documentChanged()), this, SLOT(slotDocumentChanged()));
35 m_LeftSplit = new QSplitter(QSplitter::Vertical, this);
36 m_RightSplit = new QSplitter(QSplitter::Vertical, this);
38 //setting up the listview
39 m_NumberView = new QListView(m_LeftSplit);
40 m_NumberView->addColumn("Name");
41 m_NumberView->addColumn("Number");
42 m_NumberView->addColumn("ETA");
45 m_InfoView = new InfoView(m_LeftSplit);
48 m_TickView = new TickView(m_RightSplit);
49 m_FleetViews = new QWidgetStack(m_RightSplit);
50 m_ScanView = new ScanView(m_RightSplit);
53 m_BattleSum = new BattleSum();
54 m_FleetViews->addWidget(m_BattleSum, 0);
56 //m_FleetViews->raiseWidget(0);
57 connect(m_NumberView, SIGNAL(selectionChanged(QListViewItem *)), SLOT(slotFleetSelection(QListViewItem *)));
64 void BSView::addBattle(QString name)
66 QListViewItem *battle = new QListViewItem(m_NumberView, name);
67 (void) new QListViewItem(battle, "Defenders");
68 (void) new QListViewItem(battle, "Attackers");
71 void BSView::slotDocumentChanged()
73 //TODO update the view
76 /** No descriptions */
77 void BSView::slotFleetSelection(QListViewItem *lvi){
78 if (lvi->parent() == '\0')
80 m_FleetViews->raiseWidget(0);
82 else if (lvi->parent()->parent() == '\0')
84 m_FleetViews->raiseWidget(1);