#include "create-chat.h"
#include "ui_create-chat.h"
#include <QSystemTrayIcon>

CreateChat::CreateChat(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::CreateChat)
{
    ui->setupUi(this);
}

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

void CreateChat::on_enableWS_toggled(bool checked)
{
    if (!checked && this->ui->enableWebPage->isChecked())
        this->ui->enableWS->setChecked(true);
}


void CreateChat::on_enableWebPage_toggled(bool checked)
{
    if (checked)
        this->ui->enableWS->setChecked(true);
}


void CreateChat::on_setPasswordMode_toggled(bool checked)
{
    this->ui->serverPassword->setEnabled(checked);
    this->ui->showPassword->setEnabled(checked);
}


void CreateChat::on_showPassword_toggled(bool checked)
{
    this->ui->serverPassword->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password);
}


void CreateChat::on_enableEditAddress_toggled(bool checked)
{
    this->ui->address->setEnabled(checked);
}


void CreateChat::on_enableEditPort_toggled(bool checked)
{
    this->ui->port->setEnabled(checked);
}


void CreateChat::on_loadChat_clicked()
{
    QSystemTrayIcon* ic = new QSystemTrayIcon(this);
    ic->setVisible(true);
    ic->showMessage(tr("Notify"), tr("Text"), QSystemTrayIcon::Information, 1000);
}

