# HG changeset patch # User smaxx # Date 1284482594 -7200 # Node ID 5c432e64f5ae37edff506a81dd6956a616bbb4a4 # Parent 0b1c426b035f196929833581c902b15223146b11# Parent 561275a3f33b2670229c98a26db61b2be22d4ee9 Merge diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/hedgewars.qrc --- a/QTfrontend/hedgewars.qrc Tue Sep 14 12:17:39 2010 -0400 +++ b/QTfrontend/hedgewars.qrc Tue Sep 14 18:43:14 2010 +0200 @@ -109,5 +109,10 @@ res/StatsMostSelfDamage.png res/StatsSelfKilled.png res/StatsSkipped.png + res/mapRandom.png + res/mapMaze.png + res/mapMissing.png + res/mapCustom.png + res/mapMission.png diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/hwconsts.cpp.in --- a/QTfrontend/hwconsts.cpp.in Tue Sep 14 12:17:39 2010 -0400 +++ b/QTfrontend/hwconsts.cpp.in Tue Sep 14 18:43:14 2010 +0200 @@ -30,6 +30,8 @@ QStringList * Themes; QStringList * mapList; +int cMaxTeams = 6; + QString * cDefaultAmmoStore = new QString( "939192942219912103223511100120100000021111010101" "040504054160065554655446477657666666615551010111" diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/hwconsts.h --- a/QTfrontend/hwconsts.h Tue Sep 14 12:17:39 2010 -0400 +++ b/QTfrontend/hwconsts.h Tue Sep 14 18:43:14 2010 +0200 @@ -31,6 +31,8 @@ extern QDir * cfgdir; extern QDir * datadir; +extern int cMaxTeams; + extern QStringList * Themes; extern QStringList * mapList; diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/main.cpp --- a/QTfrontend/main.cpp Tue Sep 14 12:17:39 2010 -0400 +++ b/QTfrontend/main.cpp Tue Sep 14 18:43:14 2010 +0200 @@ -180,6 +180,7 @@ "}" "QTableView {" "alternate-background-color: #2f213a;" + "gridline-color: transparent;" "}" "QTabBar::tab {" diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/mapContainer.cpp --- a/QTfrontend/mapContainer.cpp Tue Sep 14 12:17:39 2010 -0400 +++ b/QTfrontend/mapContainer.cpp Tue Sep 14 18:43:14 2010 +0200 @@ -61,8 +61,8 @@ chooseMap = new QComboBox(this); chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - chooseMap->addItem(QComboBox::tr("generated map...")); - chooseMap->addItem(QComboBox::tr("generated maze...")); + chooseMap->addItem(QIcon(":/res/mapRandom.png"), QComboBox::tr("generated map...")); + chooseMap->addItem(QIcon(":/res/mapMaze.png"), QComboBox::tr("generated maze...")); chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions int missionindex = chooseMap->count(); @@ -92,9 +92,9 @@ mapInfo.push_back(18); mapInfo.push_back(mapLuaFile.exists()); if(mapLuaFile.exists()) - chooseMap->insertItem(missionindex++, QComboBox::tr("Mission") + ": " + map, mapInfo); + chooseMap->insertItem(missionindex++, QIcon(":/res/mapMission.png"), QComboBox::tr("Mission") + ": " + map, mapInfo); else - chooseMap->addItem(map, mapInfo); + chooseMap->addItem(QIcon(":/res/mapCustom.png"), map, mapInfo); mapCfgFile.close(); } } diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Tue Sep 14 12:17:39 2010 -0400 +++ b/QTfrontend/pages.cpp Tue Sep 14 18:43:14 2010 +0200 @@ -1088,6 +1088,8 @@ roomsList->verticalHeader()->setVisible(false); roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); roomsList->setAlternatingRowColors(true); + roomsList->setShowGrid(false); + roomsList->setSelectionMode(QAbstractItemView::SingleSelection); pageLayout->addWidget(roomsList, 1, 0, 3, 1); pageLayout->setRowStretch(2, 100); @@ -1174,6 +1176,11 @@ void PageRoomsList::setRoomsList(const QStringList & list) { + QBrush red(QColor(255, 0, 0)); + QBrush orange(QColor(127, 127, 0)); + QBrush yellow(QColor(255, 255, 0)); + QBrush green(QColor(0, 255, 0)); + listFromServer = list; QString selection = ""; @@ -1215,6 +1222,7 @@ for(int i = 0, r = 0; i < list.size(); i += 8, r++) { // if we are joining a game + // TODO: Should NOT be done here if (gameInLobby) { if (gameInLobbyName == list[i + 1]) { gameCanBeJoined = list[i].compare("True"); @@ -1273,6 +1281,9 @@ item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); item->setTextAlignment(Qt::AlignCenter); item->setToolTip(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3])); + //Should we highlight "full" games? Might get misinterpreted + //if(list[i + 3].toInt() >= cMaxTeams) + // item->setForeground(red); roomsList->setItem(r, 2, item); item = new QTableWidgetItem(list[i + 4].left(15)); // name of host @@ -1281,9 +1292,15 @@ roomsList->setItem(r, 3, item); if(list[i + 5] == "+rnd+") + { item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized) + item->setIcon(QIcon(":/res/mapRandom.png")); + } else if (list[i+5] == "+maze+") + { item = new QTableWidgetItem(tr("Random Maze")); + item->setIcon(QIcon(":/res/mapMaze.png")); + } else { item = new QTableWidgetItem(list[i + 5]); // selected map @@ -1291,7 +1308,15 @@ // check to see if we've got this map // not perfect but a start if(!mapList->contains(list[i + 5])) - item->setForeground(QBrush(QColor(255, 0, 0))); + { + item->setForeground(red); + item->setIcon(QIcon(":/res/mapMissing.png")); + } + else + { + // todo: mission icon? + item->setIcon(QIcon(":/res/mapCustom.png")); + } } item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); @@ -1309,16 +1334,18 @@ roomsList->setItem(r, 6, item); if(!list[i + 1].compare(selection) && !selection.isEmpty()) - roomsList->selectionModel()->setCurrentIndex(roomsList->model()->index(r,0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + roomsList->selectionModel()->setCurrentIndex(roomsList->model()->index(r, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); } - roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); - roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); + roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); + + // TODO: Should NOT be done here if (gameInLobby) { gameInLobby = false; if (gameCanBeJoined) { diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/res/mapCustom.png Binary file QTfrontend/res/mapCustom.png has changed diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/res/mapMaze.png Binary file QTfrontend/res/mapMaze.png has changed diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/res/mapMissing.png Binary file QTfrontend/res/mapMissing.png has changed diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/res/mapMission.png Binary file QTfrontend/res/mapMission.png has changed diff -r 561275a3f33b -r 5c432e64f5ae QTfrontend/res/mapRandom.png Binary file QTfrontend/res/mapRandom.png has changed