blob: c81bfdde69630e7d98ca3e96fac0c04a2544e2a9 [file] [log] [blame]
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013, Regents of the University of California
* Yingdi Yu
*
* BSD license, See the LICENSE file for more information
*
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
#include "setting-dialog.h"
#include "ui_setting-dialog.h"
SettingDialog::SettingDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::SettingDialog)
{
ui->setupUi(this);
connect(ui->saveButton, SIGNAL(clicked()),
this, SLOT(onSaveClicked()));
connect(ui->cancelButton, SIGNAL(clicked()),
this, SLOT(onCancelClicked()));
}
SettingDialog::~SettingDialog()
{
delete ui;
}
void
SettingDialog::setNick(const QString& nick)
{
m_nick = nick;
ui->nickLine->setText(m_nick);
}
void
SettingDialog::onIdentityUpdated(const QString& identity)
{
m_identity = identity;
ui->identityLine->setText(m_identity);
}
void
SettingDialog::onSaveClicked()
{
QString identity = ui->identityLine->text();
QString nick = ui->nickLine->text();
if(identity != m_identity)
{
m_identity = identity;
emit identityUpdated(identity);
}
if(nick != m_nick)
{
m_nick = nick;
emit nickUpdated(nick);
}
this->close();
}
void
SettingDialog::onCancelClicked()
{
this->close();
}
#if WAF
#include "setting-dialog.moc"
#include "setting-dialog.cpp.moc"
#endif