X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=blobdiff_plain;f=bs%2Fbsview.cpp;h=c6fcc46efe831d4f2975572ff26626a0589be94c;hp=9212fb166c4295cad4be300ebe67186993f4a51b;hb=cb2fabf93c2f6ba8b57833309038adb972f58925;hpb=e0be1e6e8f7a246acf49e1f315c8d5bc5a65bfa3 diff --git a/bs/bsview.cpp b/bs/bsview.cpp index 9212fb1..c6fcc46 100644 --- a/bs/bsview.cpp +++ b/bs/bsview.cpp @@ -28,6 +28,8 @@ using namespace std; //QT includes #include #include +#include +#include #include "battlesum.h" #include "scanview.h" @@ -51,7 +53,16 @@ BSView::BSView(QWidget *parent, BSDoc *doc) : QSplitter(parent) m_doc = doc; m_LeftSplit = new QSplitter(QSplitter::Vertical, this); - m_RightSplit = new QSplitter(QSplitter::Vertical, this); + + m_Pages = new QTabWidget(this); + + m_RightSplit = new QSplitter(QSplitter::Vertical); + m_Pages->addTab(m_RightSplit, tr("Units")); + + m_Report = new QTextEdit(); + m_Report->setReadOnly(true); + m_Pages->addTab(m_Report, tr("Report")); + //setting up the listview m_NumberView = new QListView(m_LeftSplit); @@ -203,7 +214,13 @@ void BSView::slotFleetSelection(QListViewItem *lvi) { m_sFleet = lvi->text(0); m_sGroup = lvi->parent()->text(0); - m_sBattle = lvi->parent()->parent()->text(0); + QString temp = lvi->parent()->parent()->text(0); + + if (temp != m_sBattle) + { + m_sBattle = temp; + slotGenerateReport(); + } updateInfoView(); updateFleetView(); @@ -449,3 +466,54 @@ void BSView::slotUseScan(int action, QString text, int fleets) cerr << "Text: " << text.latin1() << endl; cerr << "Fleets: " << fleets << endl; } + + +////////////////////////////////////////////////////////////////////////// +// +void BSView::slotGenerateReport() +{ + const Fleet *fl = m_doc->specificFleet(m_sBattle, "Friendly", "Home Planet"); + + const Planet* pl = dynamic_cast(fl); + if (pl) + { + ReportList report = pl->report(); + QString t; + + t.append("\n"); + + + for (ReportList::iterator i = report.begin(); i != report.end(); ++i) + { + t.append(QString("Tick number: %0\n").arg(i->first)); + t.append("
    \n"); + for(map > > >::iterator j = i->second.begin(); j != i->second.end(); ++j) + { + t.append(QString("
  • Now handling initiative: %0\n").arg(j->first)); + t.append("
      \n"); + for(map > >::iterator k = j->second.begin(); k != j->second.end(); ++k) + { + for(map >::iterator l = k->second.begin(); l != k->second.end(); ++l) + { + t.append(QString("
    • %0 %1 %2 killing/blocking at: \n").arg(l->second["000"]).arg(k->first.c_str()).arg(l->first.c_str())); + t.append("
        \n"); + + t.append("
      \n"); + t.append("
    • \n"); + } + } + t.append("
    \n"); + t.append("
  • \n"); + } + t.append("
\n"); + + t.append("
\n"); + } + t.append("
\n"); + //cerr << t.latin1(); + m_Report->clear(); + m_Report->setText(t); + + } + //m_Report->append("test\n"); +}