#include "connectdialog.h"
#include "ui_connectdialog.h"
#include <QDebug>

ConnectDialog::ConnectDialog(QWidget *parent) :
   QDialog(parent),
   ui(new Ui::ConnectDialog)
{
   ui->setupUi(this);
   connect( ui->connectButton, SIGNAL(clicked()), this, SLOT(buttonConnectPressed()));
   qDebug() << qPrintable("dialog");
   this->show();


}

ConnectDialog::~ConnectDialog()
{
   delete ui;
}

QString ConnectDialog::getAddress()
{
   return ui->lineEditAddress->text().trimmed();

}

QString ConnectDialog::getPort()
{
   return ui->lineEditPort->text().trimmed();

}

void ConnectDialog::buttonConnectPressed()
{

   this->hide();
   qDebug() << qPrintable("buttonJoinGame");

   if(ui->radioButtonJoinGame->isChecked())
   {
      emit joinServerSignal();
      return;
   }
   emit createNewGame();
}
