// tell, say, kibitz... void ClientWindow::slot_message(QString txt, QColor c) { //QColor c0 = MultiLineEdit2->color(); MultiLineEdit2->setColor(c); slot_message( txt); MultiLineEdit2->setColor(Qt::black); }
ChatWidget::ChatWidget( QWidget * parent, const char * name ) : QWidget( parent, name ) { QVBoxLayout * layout = new QVBoxLayout( this ); _chat = new QMultiLineEdit( this ); _chat->setReadOnly( true ); layout->addWidget( _chat, 1 ); layout->addSpacing( 1 ); _edit = new QLineEdit( this ); _edit->setMinimumHeight( _edit->sizeHint().height() ); layout->addWidget( _edit ); layout->activate(); connect( _edit, SIGNAL( returnPressed() ), SLOT( slot_message() ) ); setMinimumHeight( 130 ); }
Fight::Fight( QWidget * parent, Game * game, AttalSocket * socket, const char * name ) : QWidget( parent ) { setWindowTitle( QString ( name )); _socket = socket; _game = game; _currentCell = NULL; _isAttack = true; _isActive = false; _isCreature = false; _period = 40; _idTimeFight = -1; _idTimeAnim = startTimer(_period); _activeUnit = NULL; _animatedUnit = NULL; _lostAttack = new QList<GenericFightUnit *>; _lostDefense = new QList<GenericFightUnit *>; _attData = new QList<attalFightData>; for( int i = 0; i < MAX_UNIT; i ++ ) { _unitsAtt[i] = NULL; _unitsDef[i] = NULL; } _map = new FightMap( this ); _pixmap = new QPixmap( IMAGE_PATH + "fight/background_0.png" ); _map->setBackgroundBrush(QBrush ( * _pixmap)); _view = new FightMapView( _map, this ); _control = new FightControl( this ); _layH = new QHBoxLayout(); _map->setSceneRect( 0,0, _pixmap->width(), _pixmap->height() ); _view->setMaximumSize( _pixmap->width(), _pixmap->height() ); _layH->addWidget( _view, 1, Qt::AlignVCenter ); _layout = new QVBoxLayout( this ); _layout->addLayout( _layH, 1 ); _layout->addWidget( _control ); _layout->activate(); //_view->fitInView( _view->frameRect(), Qt::KeepAspectRatioByExpanding); _view->fitInView( QRect(0,0,0,0), Qt::KeepAspectRatioByExpanding); updateDispositionMode(); AttalSettings::FightSettings fsettings = AttalSettings::getInstance()->getFightSettings(); if( fsettings.areCellsVisible ) { _map->showCells(); } else { _map->hideCells(); } connect( _control, SIGNAL( sig_wait( ) ), SLOT( slot_wait( ) ) ); connect( _control, SIGNAL( sig_retreat( ) ), SLOT( slot_flee( ) ) ); connect( _control, SIGNAL( sig_defend() ), SLOT( slot_defend() ) ); connect( _control, SIGNAL( sig_control() ), SLOT( slot_control() ) ); connect( _control, SIGNAL( sig_message( QString ) ), SLOT( slot_message( QString ) ) ); connect( _view, SIGNAL( sig_mouseMoved( FightCell * , bool) ), SLOT( slot_mouseMoved( FightCell * , bool) ) ); connect( _view, SIGNAL( sig_mouseRightPressed( FightCell * ) ), SLOT( slot_mouseRightPressed( FightCell * ) ) ); connect( _view, SIGNAL( sig_mouseLeftPressed( FightCell * , bool) ), SLOT( slot_mouseLeftPressed( FightCell *, bool ) ) ); connect( _view, SIGNAL( sig_mouseReleased() ), SLOT( slot_mouseReleased() ) ); connect( this , SIGNAL( sig_showResults() ) , SLOT ( showFightResults() ) ); }