]> ruin.nu Git - hbs.git/commitdiff
added comboboxes for the battle and group in the info view
authorMichael Andreen <harv@ruin.nu>
Sat, 6 Apr 2002 15:32:53 +0000 (15:32 +0000)
committerMichael Andreen <harv@ruin.nu>
Sat, 6 Apr 2002 15:32:53 +0000 (15:32 +0000)
bs/bsview.cpp
bs/fleet.cpp
bs/planet.cpp
bs/planet.h
bs/ui/infoview.ui
hbs.kdevprj
hbs.kdevses
hbs.pro

index 5158fe40a5c44264e71f1af7e96a42147cf49fc7..6f0bf311fd01af1d5b219282107a996d38f1faf8 100644 (file)
@@ -119,9 +119,12 @@ void BSView::slotDocumentChanged()
        
        const BattleList& battles = m_doc->battles();   
 
+       vector<QString> 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);
index 11334172decbda3f477e0c93f2db55320876fb7e..7361fe2122b486a4b32b11f7d69e44a3d27a857e 100644 (file)
@@ -29,6 +29,7 @@ Fleet::Fleet()
        m_iETA = 0;
        m_sRace = "Cathaar";
 }
+
 Fleet::~Fleet(){
 }
 
index 425861efbbf289afee2e6cd5518786bfd293f779..e8954e16e32700fcff56cdcd50c6c168c21bfeb0 100644 (file)
 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;
+}
index f98d7234c74e5bdf30c07ae646f68be5c1beb268..ccb2ee40f4b5bb7a18ff3ac38bd5699be8680a0b 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "fleet.h"
 
+typedef std::map<std::string, int> 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
 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
index b4355774119af2ae82f6697ceaff1cbd57137ef6..b34ef8a5428debf100bce165bbef7a9f41b1db2e 100644 (file)
@@ -1,5 +1,7 @@
 <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
 <class>InfoView</class>
+<comment>A nice little widget who don't know much about the rest of the world.. ;)</comment>
+<author>Michael Andree</author>
 <widget class="QWidget">
     <property name="name">
         <cstring>InfoView</cstring>
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>293</width>
-            <height>117</height>
+            <width>267</width>
+            <height>198</height>
         </rect>
     </property>
+    <property name="sizePolicy">
+        <sizepolicy>
+            <hsizetype>5</hsizetype>
+            <vsizetype>4</vsizetype>
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+        </sizepolicy>
+    </property>
     <property name="maximumSize">
         <size>
             <width>32767</width>
-            <height>150</height>
+            <height>200</height>
         </size>
     </property>
     <property name="caption">
         <string>Form2</string>
     </property>
-    <vbox>
+    <grid>
         <property name="name">
             <cstring>unnamed</cstring>
         </property>
         <property name="margin">
-            <number>0</number>
+            <number>3</number>
         </property>
         <property name="spacing">
-            <number>0</number>
+            <number>2</number>
         </property>
-        <widget class="QLayoutWidget">
+        <widget class="QLabel" row="1" column="0">
             <property name="name">
-                <cstring>Layout7</cstring>
+                <cstring>GroupLabel</cstring>
             </property>
-            <grid>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <property name="margin">
-                    <number>0</number>
+            <property name="text">
+                <string>&amp;Group</string>
+            </property>
+            <property name="buddy" stdset="0">
+                <cstring>GroupCombo</cstring>
+            </property>
+        </widget>
+        <widget class="QLabel" row="0" column="0">
+            <property name="name">
+                <cstring>BattleLabel</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Battle</string>
+            </property>
+            <property name="buddy" stdset="0">
+                <cstring>BattleCombo</cstring>
+            </property>
+        </widget>
+        <widget class="QComboBox" row="1" column="1" rowspan="1" colspan="2">
+            <item>
+                <property name="text">
+                    <string>Friendly</string>
                 </property>
-                <property name="spacing">
-                    <number>0</number>
+            </item>
+            <item>
+                <property name="text">
+                    <string>Hostile</string>
                 </property>
-                <widget class="QLabel" row="2" column="0">
-                    <property name="name">
-                        <cstring>RaceLabel</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Race</string>
-                    </property>
-                    <property name="buddy" stdset="0">
-                        <cstring>RaceCombo</cstring>
-                    </property>
-                </widget>
-                <widget class="QComboBox" row="2" column="1">
-                    <property name="name">
-                        <cstring>RaceCombo</cstring>
-                    </property>
-                </widget>
-                <widget class="QLabel" row="1" column="0">
-                    <property name="name">
-                        <cstring>EtaLabel</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Eta</string>
-                    </property>
-                    <property name="buddy" stdset="0">
-                        <cstring>EtaSpin</cstring>
-                    </property>
-                </widget>
-                <widget class="QSpinBox" row="1" column="1">
-                    <property name="name">
-                        <cstring>EtaSpin</cstring>
-                    </property>
-                </widget>
-                <widget class="QLineEdit" row="0" column="1">
-                    <property name="name">
-                        <cstring>NameLine</cstring>
-                    </property>
-                </widget>
-                <widget class="QLabel" row="0" column="0">
-                    <property name="name">
-                        <cstring>NameLabel</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Name</string>
-                    </property>
-                    <property name="buddy" stdset="0">
-                        <cstring>NameLine</cstring>
-                    </property>
-                </widget>
-            </grid>
+            </item>
+            <property name="name">
+                <cstring>GroupCombo</cstring>
+            </property>
+        </widget>
+        <widget class="QComboBox" row="0" column="1" rowspan="1" colspan="2">
+            <property name="name">
+                <cstring>BattleCombo</cstring>
+            </property>
+        </widget>
+        <widget class="QLabel" row="5" column="0">
+            <property name="name">
+                <cstring>RaceLabel</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Race</string>
+            </property>
+            <property name="buddy" stdset="0">
+                <cstring>RaceCombo</cstring>
+            </property>
+        </widget>
+        <widget class="QLineEdit" row="3" column="1" rowspan="1" colspan="2">
+            <property name="name">
+                <cstring>NameLine</cstring>
+            </property>
+        </widget>
+        <widget class="QLabel" row="3" column="0">
+            <property name="name">
+                <cstring>NameLabel</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Name</string>
+            </property>
+            <property name="buddy" stdset="0">
+                <cstring>NameLine</cstring>
+            </property>
+        </widget>
+        <widget class="QComboBox" row="5" column="1" rowspan="1" colspan="2">
+            <property name="name">
+                <cstring>RaceCombo</cstring>
+            </property>
+        </widget>
+        <widget class="QLabel" row="4" column="0">
+            <property name="name">
+                <cstring>EtaLabel</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Eta</string>
+            </property>
+            <property name="buddy" stdset="0">
+                <cstring>EtaSpin</cstring>
+            </property>
         </widget>
-        <widget class="QLayoutWidget">
+        <widget class="QSpinBox" row="4" column="1" rowspan="1" colspan="2">
+            <property name="name">
+                <cstring>EtaSpin</cstring>
+            </property>
+        </widget>
+        <spacer row="2" column="2">
+            <property name="name" stdset="0">
+                <cstring>Spacer3</cstring>
+            </property>
+            <property name="orientation">
+                <enum>Vertical</enum>
+            </property>
+            <property name="sizeType">
+                <enum>Expanding</enum>
+            </property>
+            <property name="sizeHint">
+                <size>
+                    <width>20</width>
+                    <height>20</height>
+                </size>
+            </property>
+        </spacer>
+        <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="3">
             <property name="name">
                 <cstring>Layout13</cstring>
             </property>
                 </widget>
             </hbox>
         </widget>
-    </vbox>
+        <spacer row="6" column="1">
+            <property name="name" stdset="0">
+                <cstring>Spacer4</cstring>
+            </property>
+            <property name="orientation">
+                <enum>Vertical</enum>
+            </property>
+            <property name="sizeType">
+                <enum>Expanding</enum>
+            </property>
+            <property name="sizeHint">
+                <size>
+                    <width>20</width>
+                    <height>20</height>
+                </size>
+            </property>
+        </spacer>
+    </grid>
 </widget>
 <connections>
-    <connection>
-        <sender>ApplyButton</sender>
-        <signal>clicked()</signal>
-        <receiver>InfoView</receiver>
-        <slot>ApplyButton_clicked()</slot>
-    </connection>
     <connection>
         <sender>CancelButton</sender>
         <signal>clicked()</signal>
     <slot>setFleetName( QString name )</slot>
     <slot>setRace( QString name )</slot>
     <slot>InfoView_destroyed( QObject * )</slot>
-    <slot>ApplyButton_clicked()</slot>
     <slot>CancelButton_clicked()</slot>
     <slot>NewButton_clicked()</slot>
     <slot>RemoveButton_clicked()</slot>
+    <slot>setGroup( QString s )</slot>
+    <slot>setBattles( std::vector&lt;QString&gt; battles )</slot>
+    <slot>setBattle( QString s )</slot>
 </slots>
 <layoutdefaults spacing="0" margin="0"/>
 </UI>
index e85f2dd6a171fd69f45ff2bbc51d0c6d5a4f3e57..235e017ccf6528c1fd91f1abd4d67f1ec5bd3110 100644 (file)
@@ -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
index 637616bb841056398c6d79d657da1158e1fd5786..7a0b240cffea4a8ab2209d44dfc07b5d2ab6652a 100644 (file)
@@ -1,14 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE KDevPrjSession ><KDevPrjSession>
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<!DOCTYPE KDevPrjSession>
+<KDevPrjSession>
  <Mainframe MaximizeMode="0" />
- <DocsAndViews NumberOfDocuments="3" >
-  <Doc0 CursorPosLine="75" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="0" FileName="/home/whale/src/hbs/bs/bsview.h" >
-   <View0 Top="0" Width="644" Attach="0" Height="490" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
+ <DocsAndViews NumberOfDocuments="1" >
+  <Doc0 CursorPosLine="68" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="0" FileName="/home/whale/src/hbs/bs/bsdoc.cpp" >
+   <View0 Top="0" Width="902" Attach="1" Height="583" Left="0" Focus="1" Type="KWriteView" MinMaxMode="0" />
   </Doc0>
-  <Doc1 CursorPosLine="121" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="17" FileName="/home/whale/src/hbs/bs/bsview.cpp" >
-   <View0 Top="0" Width="644" Attach="0" Height="490" Left="0" Focus="1" Type="KWriteView" MinMaxMode="0" />
-  </Doc1>
-  <Doc2 Type="CDocBrowser" NumberOfViews="1" FileName="file:/home/src/qt-3/doc/html/index.html" >
-   <View Top="0" Width="644" Attach="0" Height="490" Left="0" Focus="0" Type="KHTMLView" MinMaxMode="0" />
-  </Doc2>
  </DocsAndViews>
+ <LastCompileConfig>(Default)</LastCompileConfig>
 </KDevPrjSession>
diff --git a/hbs.pro b/hbs.pro
index e1627a010dc8c7058053d4e7ca9f7d9ff52276dd..8e6528892455a4002ce0f2d445619f6113ebf0e9 100644 (file)
--- 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