/* VierGewinnt - A simple 4-in-a-row network game * * Copyright (c) 2008 by Sebastian Lohff, seba@seba-geek.de * http://www.seba-geek.de * * This file is part of VierGewinnt. * * VierGewinnt 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. * * VierGewinnt 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 VierGewinnt. If not, see . */ #include "creategame.h" CreateGameDialog::CreateGameDialog(QTcpSocket *_mysock, QWidget *parent) : QDialog(parent) { mysock = _mysock; setWindowTitle(tr("Neues Spiel")); // stat = new QLabel(""); gname = new QLabel(tr("Spielname")); editgname = new QLineEdit; ok = new QPushButton(tr("Ok")); connect(ok, SIGNAL(clicked()), this, SLOT(startListen())); cancel = new QPushButton(tr("Abbrechen")); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); layout = new QGridLayout; // layout->addWidget(stat, 0, 0, 1, 2); layout->addWidget(gname, 1, 0); layout->addWidget(editgname, 1, 1); layout->addWidget(ok, 2, 0); layout->addWidget(cancel, 2, 1); setLayout(layout); setModal(Qt::WindowModal); } // void CreateGameDialog::reset() { // stat->setText(""); // ok->show(); // } void CreateGameDialog::startListen() { QTextStream sockstream(mysock); if(editgname->text()=="") editgname->insert(tr("Unbenanntes Spiel")); sockstream << "CREATE " << editgname->text() << "\n"; accept(); }