void JHallWindow::on_list_game_itemClicked(QListWidgetItem* item) { JGameList gl = m_requestGameList->pullInformation(-1,1000); foreach(const QString& name,gl) { if(item->text()==name) { m_currentGameId=gl.key(name); break; } } updateGameInfo(m_currentGameId); }
GameWindow::GameWindow(QWidget *parent) : QWidget(parent), ui(new Ui::GameWindow) { ui->setupUi(this); this->setWindowTitle("Chess"); this->setGeometry(350,50,580,620); this->setFixedSize(580,620); this->setWindowIcon(QIcon(":/Sprites/black_knight.png")); startGameButton = new QPushButton("Start Game", this); startGameButton->setGeometry(50,580,200,25); loadGameButton = new QPushButton("Load Game", this); loadGameButton->setGeometry(330,580,200,25); stopGameButton = new QPushButton("Stop Game", this); stopGameButton->setGeometry(50,580,200,25); stopGameButton->hide(); saveGameButton = new QPushButton("Save Game", this); saveGameButton->setGeometry(330,580,200,25); saveGameButton->hide(); prevMoveButton = new QPushButton("Prev Move", this); prevMoveButton->setGeometry(10,580,120,25); prevMoveButton->hide(); nextMoveButton = new QPushButton("Next Move", this); nextMoveButton->setGeometry(150,580,120,25); nextMoveButton->hide(); newGameButton = new QPushButton("New Game", this); newGameButton->setGeometry(310,580,120,25); newGameButton->hide(); connect(startGameButton, SIGNAL(clicked(bool)), this, SLOT(startGameButtonClicked())); connect(loadGameButton, SIGNAL(clicked(bool)), this, SLOT(loadGameButtonClicked())); connect(stopGameButton,SIGNAL(clicked(bool)), this, SLOT(stopGameButtonClicked())); connect(saveGameButton, SIGNAL(clicked(bool)), this, SLOT(saveGameButtonClicked())); connect(newGameButton, SIGNAL(clicked(bool)), this, SLOT(newGameButtonClicked())); connect(prevMoveButton, SIGNAL(clicked(bool)), this, SLOT(prevMoveButtonClicked())); connect(nextMoveButton, SIGNAL(clicked(bool)), this, SLOT(nextMoveButtonClicked())); connect(handler, SIGNAL(sendGameInfo()), this, SLOT(updateGameInfo())); createChessBoard(); }