#include <iostream.h>
#include "formChat.h"

void FormConfig::init()
{
    radioButtonClient->setChecked(FALSE);
    radioButtonServeur->setChecked(FALSE);
    lineEditAdresseServeur->setText(((FormChat*) parent())->AdrServeur);
    bool test_serveur=((FormChat*) parent())->serveur;
    if (test_serveur)
    {
	radioButtonServeur->setChecked(TRUE);
    }
    else
    {
	radioButtonClient->setChecked(TRUE);
    }
}

void FormConfig::click_bouton_serveur_client()
{
    QRadioButton * bt = (QRadioButton *) sender();
    radioButtonClient->setChecked(FALSE);
    radioButtonServeur->setChecked(FALSE);
    bt->setChecked(TRUE);
    QString libelle=bt->text();
    if (libelle=="Client")
    {
	textLabelAdresse->setText("Adresse du serveur :");
    }
    else
    {
	textLabelAdresse->setText("Nom du serveur :");
    }
}


void FormConfig::Valider()
{
    if (radioButtonClient->isChecked())
    {
	((FormChat*) parent())->serveur=FALSE;
    }
    else
    {
	((FormChat*) parent())->serveur=TRUE;
    }
    ((FormChat*) parent())->AdrServeur=lineEditAdresseServeur->text();
    close();
}
