]> ruin.nu Git - hbs.git/blob - bs/bsview.cpp
7ad7e19b64e661502b4baf0af9d901a21dff51d2
[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 "bcview.h"
19
20 #include "bcmainview.h"
21 #include "scanview.h"
22 #include "ui/infoview.h"
23 #include "tickview.h"
24
25 //QT includes
26 #include <qlistview.h>
27 #include <qwidgetstack.h>
28
29 BcView::BcView(QWidget *parent, BcDoc *doc) : QSplitter(parent)
30 {
31   /** connect doc with the view*/
32   connect(doc, SIGNAL(documentChanged()), this, SLOT(slotDocumentChanged()));
33         
34         
35         m_LeftSplit = new QSplitter(QSplitter::Vertical, this);
36         m_RightSplit = new QSplitter(QSplitter::Vertical, this);
37
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");
43         addBattle("test");
44
45         m_InfoView = new InfoView(m_LeftSplit);
46         
47         //the right side
48         m_TickView = new TickView(m_RightSplit);
49         m_FleetViews = new QWidgetStack(m_RightSplit);
50         m_ScanView = new ScanView(m_RightSplit);
51         
52         //the widget stack
53         m_BcMainView = new BcMainView();
54         m_FleetViews->addWidget(m_BcMainView, 0);
55
56         //m_FleetViews->raiseWidget(0);
57         connect(m_NumberView, SIGNAL(selectionChanged(QListViewItem *)), SLOT(slotFleetSelection(QListViewItem *))); 
58 }
59
60 BcView::~BcView()
61 {
62 }
63
64 void BcView::addBattle(QString name)
65 {
66         QListViewItem *battle = new QListViewItem(m_NumberView, name);
67         (void) new QListViewItem(battle, "Defenders");
68         (void) new QListViewItem(battle, "Attackers");
69 }
70
71 void BcView::slotDocumentChanged()
72 {
73   //TODO update the view
74
75 }
76 /** No descriptions */
77 void BcView::slotFleetSelection(QListViewItem *lvi){
78         if (lvi->parent() == '\0')
79         {
80                 m_FleetViews->raiseWidget(0);
81         }
82         else if (lvi->parent()->parent() == '\0')
83         {
84                 m_FleetViews->raiseWidget(1);
85         }
86         
87 }