From 33b6dc7ca95a05c26a78879413395c1588066b77 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 6 Apr 2002 15:32:53 +0000 Subject: [PATCH] added comboboxes for the battle and group in the info view --- bs/bsview.cpp | 16 +++- bs/fleet.cpp | 1 + bs/planet.cpp | 12 +++ bs/planet.h | 13 ++- bs/ui/infoview.ui | 214 ++++++++++++++++++++++++++++++---------------- hbs.kdevprj | 14 ++- hbs.kdevses | 17 ++-- hbs.pro | 4 +- 8 files changed, 201 insertions(+), 90 deletions(-) diff --git a/bs/bsview.cpp b/bs/bsview.cpp index 5158fe4..6f0bf31 100644 --- a/bs/bsview.cpp +++ b/bs/bsview.cpp @@ -119,9 +119,12 @@ void BSView::slotDocumentChanged() const BattleList& battles = m_doc->battles(); + vector battlenames; + for (BattleList::const_iterator i = battles.begin(); i != battles.end(); ++i) { QString b = (*i).first; + battlenames.push_back(i->first); QListViewItem* battle = new QListViewItem(m_NumberView, b); battle->setOpen(m_TreeExpanded[b]["--"]); @@ -140,12 +143,17 @@ void BSView::slotDocumentChanged() unsigned score = k->second->score(); groupShips += ships; groupScore += score; - (void) new QListViewItem(group, (*k).first, QString("%1").arg(ships), QString("%1").arg(k->second->ETA()), QString("%1").arg(score)); + //if(k->first == tr("Home Planet")) + (void) new QListViewItem(group, (*k).first, QString("%1").arg(ships), QString("%1").arg(k->second->ETA()), QString("%1").arg(score)); + /*else + (void) new QCheckListItem(group, (*k).first, QString("%1").arg(ships), QString("%1").arg(k->second->ETA()), QString("%1").arg(score), QCheckListItem::CheckBox);*/ + } group->setText(1, QString("%1").arg(groupShips)); group->setText(3, QString("%1").arg(groupScore)); } } + m_InfoView->setBattles(battlenames); } ////////////////////////////////////////////////////////////////////////////// @@ -182,16 +190,22 @@ void BSView::slotFleetSelection(QListViewItem *lvi) m_sFleet = lvi->text(0); m_sGroup = lvi->parent()->text(0); m_sBattle = lvi->parent()->parent()->text(0); + if ( m_sGroup == tr("Friendly")) { friendly = true; if(m_sFleet == tr("Home Planet")) home=true; } + const Fleet* fl = m_doc->specificFleet(m_sBattle, m_sGroup, m_sFleet); + m_InfoView->setRace(fl->race().c_str()); m_InfoView->setFleetName(m_sFleet); m_InfoView->setEta(fl->ETA()); + m_InfoView->setGroup(m_sGroup); + m_InfoView->setBattle(m_sBattle); + if (fl->race() == tr("Generic").latin1()) { m_GenericFleetView->viewFleet(fl, friendly); diff --git a/bs/fleet.cpp b/bs/fleet.cpp index 1133417..7361fe2 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -29,6 +29,7 @@ Fleet::Fleet() m_iETA = 0; m_sRace = "Cathaar"; } + Fleet::~Fleet(){ } diff --git a/bs/planet.cpp b/bs/planet.cpp index 425861e..e8954e1 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -20,6 +20,18 @@ Planet::Planet() { m_sRace = "Planet"; + m_iScore = 0; } + Planet::~Planet(){ } + +unsigned Planet::score(int tick = 0) +{ + return m_iScore; +} + +void Planet::setScore(unsigned i) +{ + m_iScore = i; +} diff --git a/bs/planet.h b/bs/planet.h index f98d723..ccb2ee4 100644 --- a/bs/planet.h +++ b/bs/planet.h @@ -20,6 +20,8 @@ #include "fleet.h" +typedef std::map RoidList; + /**This class is the implementation of a planet. * * Yes I know.. In real life you wouldn't call a planet a fleet, but this isn't @@ -32,8 +34,15 @@ class Planet : public Fleet { public: Planet(); - ~Planet(); - unsigned score(); + virtual ~Planet(); + + unsigned score(int tick = 0); + void setScore(unsigned i); + +protected: + unsigned m_iScore; + RoidList m_Roids; + }; #endif diff --git a/bs/ui/infoview.ui b/bs/ui/infoview.ui index b435577..b34ef8a 100644 --- a/bs/ui/infoview.ui +++ b/bs/ui/infoview.ui @@ -1,5 +1,7 @@ InfoView +A nice little widget who don't know much about the rest of the world.. ;) +Michael Andree InfoView @@ -8,94 +10,145 @@ 0 0 - 293 - 117 + 267 + 198 + + + 5 + 4 + 0 + 0 + + 32767 - 150 + 200 Form2 - + unnamed - 0 + 3 - 0 + 2 - + - Layout7 + GroupLabel - - - unnamed - - - 0 + + &Group + + + GroupCombo + + + + + BattleLabel + + + &Battle + + + BattleCombo + + + + + + Friendly - - 0 + + + + Hostile - - - RaceLabel - - - &Race - - - RaceCombo - - - - - RaceCombo - - - - - EtaLabel - - - &Eta - - - EtaSpin - - - - - EtaSpin - - - - - NameLine - - - - - NameLabel - - - &Name - - - NameLine - - - + + + GroupCombo + + + + + BattleCombo + + + + + RaceLabel + + + &Race + + + RaceCombo + + + + + NameLine + + + + + NameLabel + + + &Name + + + NameLine + + + + + RaceCombo + + + + + EtaLabel + + + &Eta + + + EtaSpin + - + + + EtaSpin + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + Layout13 @@ -166,15 +219,26 @@ - + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + - - ApplyButton - clicked() - InfoView - ApplyButton_clicked() - CancelButton clicked() @@ -221,10 +285,12 @@ setFleetName( QString name ) setRace( QString name ) InfoView_destroyed( QObject * ) - ApplyButton_clicked() CancelButton_clicked() NewButton_clicked() RemoveButton_clicked() + setGroup( QString s ) + setBattles( std::vector<QString> battles ) + setBattle( QString s ) diff --git a/hbs.kdevprj b/hbs.kdevprj index e85f2dd..235e017 100644 --- a/hbs.kdevprj +++ b/hbs.kdevprj @@ -87,7 +87,7 @@ install_location= type=DATA [bs/Makefile.am] -files=bs/bs.cpp,bs/bs.h,bs/bsdoc.cpp,bs/bsdoc.h,bs/bsview.cpp,bs/bsview.h,bs/main.cpp,bs/battlesum.h,bs/battlesum.cpp,bs/scanview.cpp,bs/scanview.h,bs/tickview.cpp,bs/tickview.h,bs/fleet.cpp,bs/fleet.h,bs/unittype.cpp,bs/unittype.h,bs/bsconf.cpp,bs/bsconf.h,bs/fleetview.cpp,bs/fleetview.h +files=bs/bs.cpp,bs/bs.h,bs/bsdoc.cpp,bs/bsdoc.h,bs/bsview.cpp,bs/bsview.h,bs/main.cpp,bs/battlesum.h,bs/battlesum.cpp,bs/scanview.cpp,bs/scanview.h,bs/tickview.cpp,bs/tickview.h,bs/fleet.cpp,bs/fleet.h,bs/unittype.cpp,bs/unittype.h,bs/bsconf.cpp,bs/bsconf.h,bs/fleetview.cpp,bs/fleetview.h,bs/planet.cpp,bs/planet.h sub_dirs= type=prog_main @@ -189,6 +189,18 @@ install=false install_location= type=SOURCE +[bs/planet.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[bs/planet.h] +dist=true +install=false +install_location= +type=HEADER + [bs/scanview.cpp] dist=true install=false diff --git a/hbs.kdevses b/hbs.kdevses index 637616b..7a0b240 100644 --- a/hbs.kdevses +++ b/hbs.kdevses @@ -1,14 +1,11 @@ - + + + - - - + + + - - - - - - + (Default) diff --git a/hbs.pro b/hbs.pro index e1627a0..8e65288 100644 --- a/hbs.pro +++ b/hbs.pro @@ -1,5 +1,5 @@ -SOURCES += bs/bs.cpp bs/bsdoc.cpp bs/bsview.cpp bs/main.cpp bs/battlesum.cpp bs/scanview.cpp bs/tickview.cpp bs/fleet.cpp bs/unittype.cpp bs/bsconf.cpp bs/fleetview.cpp -HEADERS += bs/bs.h bs/bsdoc.h bs/bsview.h bs/battlesum.h config.h bs/scanview.h bs/tickview.h bs/fleet.h bs/unittype.h bs/bsconf.h bs/fleetview.h +SOURCES += bs/bs.cpp bs/bsdoc.cpp bs/bsview.cpp bs/main.cpp bs/battlesum.cpp bs/scanview.cpp bs/tickview.cpp bs/fleet.cpp bs/unittype.cpp bs/bsconf.cpp bs/fleetview.cpp bs/planet.cpp +HEADERS += bs/bs.h bs/bsdoc.h bs/bsview.h bs/battlesum.h config.h bs/scanview.h bs/tickview.h bs/fleet.h bs/unittype.h bs/bsconf.h bs/fleetview.h bs/planet.h TARGET = bs/bs IMAGEFILE = images.cpp -- 2.39.2