[kde-doc-english] [konquest] /: Show source planet in fleet overview.
Alexander Schuch
aschuch247 at gmail.com
Mon Nov 25 00:21:47 UTC 2013
Git commit 83eac1d0ebe04e9c3fb7782183660692878cada0 by Alexander Schuch.
Committed on 24/11/2013 at 22:52.
Pushed by aschuch into branch 'master'.
Show source planet in fleet overview.
The fleet overview dialogue now shows the source planet for each fleet. The
dialogue itself behaves more like the standings widget now, by scrolling by
pixel rather than by column or row.
GUI:
M +27 -11 dialogs/fleetdlg.cc
M +3 -3 view/standingswidget.cpp
http://commits.kde.org/konquest/83eac1d0ebe04e9c3fb7782183660692878cada0
diff --git a/dialogs/fleetdlg.cc b/dialogs/fleetdlg.cc
index d930e33..d5e6212 100644
--- a/dialogs/fleetdlg.cc
+++ b/dialogs/fleetdlg.cc
@@ -19,6 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
#include "fleetdlg.h"
#include <QTableWidget>
@@ -44,15 +45,25 @@ FleetDlg::FleetDlg( QWidget *parent,
setCaption( i18n("Fleet Overview") );
setButtons( KDialog::Ok );
- m_fleetTable = new QTableWidget( this );
- m_fleetTable->setColumnCount( 6 );
- QStringList labels;
- labels << QString() << i18n("Fleet No.") << i18n("Destination") << i18n("Ships")
- << i18n("Kill Percentage") << i18n("Arrival Turn");
- m_fleetTable->setHorizontalHeaderLabels( labels );
+ m_fleetTable = new QTableWidget(this);
+ m_fleetTable->setColumnCount(7);
+ m_fleetTable->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
+ m_fleetTable->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
+ m_fleetTable->setSelectionMode(QAbstractItemView::NoSelection);
+
+ QStringList headerLabels;
+ headerLabels
+ << QString()
+ << i18n("Fleet No.")
+ << i18n("Source")
+ << i18n("Destination")
+ << i18n("Ships")
+ << i18n("Kill Percentage")
+ << i18n("Arrival Turn");
+ m_fleetTable->setHorizontalHeaderLabels(headerLabels);
m_fleetTable->verticalHeader()->hide();
+
m_fleetTable->setMinimumSize( m_fleetTable->sizeHint() );
- m_fleetTable->setSelectionMode( QAbstractItemView::NoSelection );
setMainWidget( m_fleetTable );
connect( this, SIGNAL(okClicked()), this, SLOT(accept()) );
@@ -65,6 +76,7 @@ FleetDlg::FleetDlg( QWidget *parent,
m_fleetTable->sortItems( 1, Qt::AscendingOrder );
}
+
void
FleetDlg::init()
{
@@ -94,21 +106,25 @@ FleetDlg::init()
item->setFlags(Qt::ItemIsEnabled);
m_fleetTable->setItem( f, 1, item );
- item = new QTableWidgetItem(curFleet->destination->name());
+ item = new QTableWidgetItem(curFleet->source->name());
item->setFlags(Qt::ItemIsEnabled);
m_fleetTable->setItem( f, 2, item );
- item = new QTableWidgetItem(QString::number(curFleet->shipCount()));
+ item = new QTableWidgetItem(curFleet->destination->name());
item->setFlags(Qt::ItemIsEnabled);
m_fleetTable->setItem( f, 3, item );
- item = new QTableWidgetItem(QString("%1") .arg(KGlobal::locale()->formatNumber(curFleet->source->killPercentage(), 3)));
+ item = new QTableWidgetItem(QString::number(curFleet->shipCount()));
item->setFlags(Qt::ItemIsEnabled);
m_fleetTable->setItem( f, 4, item );
- item = new QTableWidgetItem(QString::number(curFleet->arrivalTurn));
+ item = new QTableWidgetItem(QString("%1") .arg(KGlobal::locale()->formatNumber(curFleet->source->killPercentage(), 3)));
item->setFlags(Qt::ItemIsEnabled);
m_fleetTable->setItem( f, 5, item );
+
+ item = new QTableWidgetItem(QString::number(curFleet->arrivalTurn));
+ item->setFlags(Qt::ItemIsEnabled);
+ m_fleetTable->setItem( f, 6, item );
}
}
diff --git a/view/standingswidget.cpp b/view/standingswidget.cpp
index 0063292..a72e06c 100644
--- a/view/standingswidget.cpp
+++ b/view/standingswidget.cpp
@@ -145,15 +145,15 @@ StandingsWidget::setupTable()
m_scoreTable->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
m_scoreTable->setSelectionMode(QAbstractItemView::NoSelection);
- QStringList headers;
- headers
+ QStringList headerLabels;
+ headerLabels
<< i18nc("The player name", "Player")
<< i18n("Ships\nBuilt")
<< i18n("Planets\nConquered")
<< i18n("Fleets\nLaunched")
<< i18n("Fleets\nDestroyed")
<< i18n("Ships\nDestroyed");
- m_scoreTable->setHorizontalHeaderLabels(headers);
+ m_scoreTable->setHorizontalHeaderLabels(headerLabels);
m_scoreTable->verticalHeader()->hide();
main->addWidget(m_scoreTable);
More information about the kde-doc-english
mailing list