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"
24 #include "ui/fleetviewbase.h"
27 #include <qlistview.h>
28 #include <qwidgetstack.h>
30 BSView::BSView(QWidget *parent, BSDoc *doc) : QSplitter(parent)
32 /** connect doc with the view*/
33 connect(doc, SIGNAL(documentChanged()), this, SLOT(slotDocumentChanged()));
36 m_LeftSplit = new QSplitter(QSplitter::Vertical, this);
37 m_RightSplit = new QSplitter(QSplitter::Vertical, this);
39 //setting up the listview
40 m_NumberView = new QListView(m_LeftSplit);
41 m_NumberView->addColumn("Name");
42 m_NumberView->addColumn("Number");
43 m_NumberView->addColumn("ETA");
46 m_InfoView = new InfoView(m_LeftSplit);
49 m_TickView = new TickView(m_RightSplit);
50 m_FleetViews = new QWidgetStack(m_RightSplit);
51 m_ScanView = new ScanView(m_RightSplit);
54 m_BattleSum = new BattleSum();
55 m_FleetViews->addWidget(m_BattleSum, 0);
56 m_FleetView = new FleetViewBase();
57 m_FleetViews->addWidget(m_FleetView, 1);
59 //m_FleetViews->raiseWidget(0);
60 connect(m_NumberView, SIGNAL(selectionChanged(QListViewItem *)), SLOT(slotFleetSelection(QListViewItem *)));
67 void BSView::addBattle(QString name)
69 QListViewItem *battle = new QListViewItem(m_NumberView, name);
70 (void) new QListViewItem(battle, "Defenders");
71 (void) new QListViewItem(battle, "Attackers");
74 void BSView::slotDocumentChanged()
76 //TODO update the view
79 /** No descriptions */
80 void BSView::slotFleetSelection(QListViewItem *lvi){
81 if (lvi->parent() == '\0')
83 m_FleetViews->raiseWidget(0);
85 else if (lvi->parent()->parent() == '\0')
87 m_FleetViews->raiseWidget(1);