Ejemplo n.º 1
0
ClientSession::ClientSession(QTcpSocket *associatedSocket, QObject *parent) :
    AbstractIdentifiable(parent),
    _fragment(NULL),
    _socket(associatedSocket),
    _blockSize(0)
{
    connect(_socket, &QTcpSocket::readyRead, this, &ClientSession::slot_processReadyRead);
    connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slot_disconnect()));
    initializeStateMachine();
}
Ejemplo n.º 2
0
/***************************************************************************
  Creates buttons and layouts for start page.
***************************************************************************/
void fc_client::create_start_page()
{
  pages_layout[PAGE_START] = new QGridLayout;
  QStringList player_widget_list;
  start_players_tree = new QTreeWidget;

  player_widget_list << _("Name") << _("Ready") << _("Leader")
                     << _("Flag") << _("Nation") << _("Team");


  start_players_tree->setColumnCount(player_widget_list.count());
  start_players_tree->setHeaderLabels(player_widget_list);
  start_players_tree->setContextMenuPolicy(Qt::CustomContextMenu);
  start_players_tree->setProperty("selectionBehavior", "SelectRows");
  start_players_tree->setEditTriggers(QAbstractItemView::NoEditTriggers);
  start_players_tree->setRootIsDecorated(false);

  connect(start_players_tree,
          SIGNAL(customContextMenuRequested(const QPoint&)),
          SLOT(start_page_menu(QPoint)));

  QPushButton *but;
  but = new QPushButton;
  but->setText(_("More Game Options"));
  pages_layout[PAGE_START]->addWidget(but, 5, 3);
  QObject::connect(but, SIGNAL(clicked()), this,
                   SLOT(popup_server_options()));
  pages_layout[PAGE_START]->addWidget(start_players_tree, 0, 0, 2, 8);
  but = new QPushButton;
  but->setText(_("Disconnect"));
  QObject::connect(but, SIGNAL(clicked()), this, SLOT(slot_disconnect()));
  pages_layout[PAGE_START]->addWidget(but, 5, 4);
  but = new QPushButton;
  but->setText(_("Pick Nation"));
  pages_layout[PAGE_START]->addWidget(but, 5, 5);
  QObject::connect(but, SIGNAL(clicked()), this,
                   SLOT(slot_pick_nation()));

  obs_button = new QPushButton;
  obs_button->setText(_("Observe"));
  pages_layout[PAGE_START]->addWidget(obs_button, 5, 6);
  QObject::connect(obs_button, SIGNAL(clicked()), this,
                   SLOT(slot_pregame_observe()));
  but = new QPushButton;
  but->setText(_("Start"));
  pages_layout[PAGE_START]->addWidget(but, 5, 7);
  QObject::connect(but, SIGNAL(clicked()), this,
                   SLOT(slot_pregame_start()));

}