//**************************************************************************** //Copyright (C) 2005-2006 Beijing BlueDJ Technology Co.,Ltd. All rights reserved. //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. //You should have received a copy of the GNU General Public License //along with this program (in the file LICENSE.GPL); if not, write to the Free Software //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //Please visit http://www.bluedj.com for more infomation about us. //Contact us at ggwizard@gmail.com or darkdong@gmail.com. //****************************************************************************/ #include "LandBattleController.h" #include "DJGameRoom.h" #include "LandBattle.h" #include "4country.h" #include "LandBattleUserItem.h" LandBattleController::LandBattleController( quint16 gameId, const QString& gameName, const DJHallInterface& hallInterface, QObject *parent ) : DJGameController( gameId, gameName, hallInterface, parent ) { } LandBattleController::~LandBattleController() { } QString LandBattleController::translatedGameName() { return tr("LandBattle"); } QColor LandBattleController::nameColor() { return QColor(255,128,0); } QString LandBattleController::roomName( DJGameRoom* normalRoom ) { QString roomName=QString(""); bool bOK=false; PJunqiRoom room = (PJunqiRoom)normalRoom->privateRoom(); if(room->chRule == DJGAME_JUNQI_RULE_RAND) { bOK = true; roomName = tr("Normal BattleChess"); }else if(room->chRule == DJGAME_JUNQI_RULE_LUAN) { bOK = true; roomName = tr("4 Luan"); }else if(room->chRule & (DJGAME_JUNQI_RULE_4TEAM) ) { if(room->chRule == (DJGAME_JUNQI_RULE_4TEAM | DJGAME_JUNQI_RULE_LUAN) ) { bOK = true; roomName = tr("4 HunLuan"); }else if(room->chRule == DJGAME_JUNQI_RULE_4TEAM || room->chRule == (DJGAME_JUNQI_RULE_4TEAM | DJGAME_JUNQI_RULE_RAND)) { bOK = true; roomName = tr("4 Hun"); } } if(!bOK) { if(room->chRule & DJGAME_JUNQI_RULE_LUAN) roomName += tr("[Luan]"); if(room->chRule & DJGAME_JUNQI_RULE_4TEAM) roomName += tr("[Hun]"); } if(room->chRule & DJGAME_JUNQI_RULE_RAND) { roomName += tr("[2-4P]"); }else { QString str= QString("%1").arg(normalRoom->numberOfSeats()); roomName += QString("["); roomName +=str; roomName += tr("P"); roomName += QString("]"); } if(room->chRule & (DJGAME_JUNQI_RULE_FRIENDVISIBLE) ) { roomName += tr("[FriendVisible] "); } if(room->chRule & (DJGAME_JUNQI_RULE_FRIENDROW) ) { roomName += tr("[FriendRow] "); } //roomName += QString(" -- (%1/%2)").arg(normalRoom->curUsers()).arg(normalRoom->maxUsers()); return roomName; } void LandBattleController::headerSections( QList §ionIds, QStringList §ionNames ) { sectionIds.clear(); sectionNames.clear(); sectionIds << UserName << GameStatus << TableSeat << Platform << Speed << Score << Wins << Loses << Draws << WinRate << Money << Chips << BreakRate << OnlineTime << Rank; sectionNames << sectionName(UserName) << sectionName(GameStatus) << sectionName(TableSeat) << sectionName(Platform) << sectionName(Speed) << sectionName(Score) << sectionName(Wins) << sectionName(Loses) << tr("draws")<< sectionName(WinRate) << sectionName(Money) << sectionName(Chips) << sectionName(BreakRate) << sectionName(OnlineTime) << sectionName(Rank) << "-"; } DJGamePanel* LandBattleController::createGamePanel( DJGameController* gameController, DJGameRoom* normalRoom, const QList& userIds, quint8 tableId, quint8 seatId, QWidget * parent, Qt::WFlags f ) { LandBattlePanel* panel = new LandBattlePanel( gameController, normalRoom, userIds, tableId, seatId, parent, f ); return panel; } DJGameUserItem* LandBattleController::createGameUserItem( DJGameUser *user, DJGameController* gameController, QTreeWidget* parent, int type ) { DJGameUserItem* userItem = new LandBattleUserItem( user, gameController, parent, type ); return userItem; }