]> ruin.nu Git - hbs.git/blob - bs/bsview.cpp
The last commit before backup
[hbs.git] / bs / bsview.cpp
1 /***************************************************************************
2                           bcview.cpp  -  description
3                              -------------------
4     begin                : Sun Jun 17 19:19:58 CEST 2001
5     copyright            : (C) 2001 by Michael Andreen
6     email                : whale@linux.nu
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
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.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #include "bsview.h"
19
20 #include "battlesum.h"
21 #include "scanview.h"
22 #include "ui/infoview.h"
23 #include "tickview.h"
24 #include "ui/fleetviewbase.h"
25
26 //QT includes
27 #include <qlistview.h>
28 #include <qwidgetstack.h>
29
30 BSView::BSView(QWidget *parent, BSDoc *doc) : QSplitter(parent)
31 {
32   /** connect doc with the view*/
33   connect(doc, SIGNAL(documentChanged()), this, SLOT(slotDocumentChanged()));
34         
35         
36         m_LeftSplit = new QSplitter(QSplitter::Vertical, this);
37         m_RightSplit = new QSplitter(QSplitter::Vertical, this);
38
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");
44         addBattle("test");
45
46         m_InfoView = new InfoView(m_LeftSplit);
47         
48         //the right side
49         m_TickView = new TickView(m_RightSplit);
50         m_FleetViews = new QWidgetStack(m_RightSplit);
51         m_ScanView = new ScanView(m_RightSplit);
52         
53         //the widget stack
54         m_BattleSum = new BattleSum();
55         m_FleetViews->addWidget(m_BattleSum, 0);
56         m_FleetView = new FleetViewBase();
57         m_FleetViews->addWidget(m_FleetView, 1);
58
59         //m_FleetViews->raiseWidget(0);
60         connect(m_NumberView, SIGNAL(selectionChanged(QListViewItem *)), SLOT(slotFleetSelection(QListViewItem *))); 
61 }
62
63 BSView::~BSView()
64 {
65 }
66
67 void BSView::addBattle(QString name)
68 {
69         QListViewItem *battle = new QListViewItem(m_NumberView, name);
70         (void) new QListViewItem(battle, "Defenders");
71         (void) new QListViewItem(battle, "Attackers");
72 }
73
74 void BSView::slotDocumentChanged()
75 {
76   //TODO update the view
77
78 }
79 /** No descriptions */
80 void BSView::slotFleetSelection(QListViewItem *lvi){
81         if (lvi->parent() == '\0')
82         {
83                 m_FleetViews->raiseWidget(0);
84         }
85         else if (lvi->parent()->parent() == '\0')
86         {
87                 m_FleetViews->raiseWidget(1);
88         }
89         
90 }