blob: c81bfdde69630e7d98ca3e96fac0c04a2544e2a9 [file] [log] [blame]
Yingdi Yu348f5ea2014-03-01 14:47:25 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
9 */
10
11#include "setting-dialog.h"
12#include "ui_setting-dialog.h"
13
14SettingDialog::SettingDialog(QWidget *parent)
15 : QDialog(parent)
16 , ui(new Ui::SettingDialog)
17{
18 ui->setupUi(this);
Yingdi Yufa0b6a02014-04-30 14:26:42 -070019
Yingdi Yu348f5ea2014-03-01 14:47:25 -080020 connect(ui->saveButton, SIGNAL(clicked()),
21 this, SLOT(onSaveClicked()));
22 connect(ui->cancelButton, SIGNAL(clicked()),
23 this, SLOT(onCancelClicked()));
24}
25
26SettingDialog::~SettingDialog()
27{
28 delete ui;
29}
30
31void
32SettingDialog::setNick(const QString& nick)
33{
34 m_nick = nick;
35 ui->nickLine->setText(m_nick);
36}
37
38void
39SettingDialog::onIdentityUpdated(const QString& identity)
40{
41 m_identity = identity;
42 ui->identityLine->setText(m_identity);
43}
44
45void
46SettingDialog::onSaveClicked()
47{
48 QString identity = ui->identityLine->text();
49 QString nick = ui->nickLine->text();
50
51 if(identity != m_identity)
52 {
53 m_identity = identity;
54 emit identityUpdated(identity);
55 }
56 if(nick != m_nick)
57 {
58 m_nick = nick;
59 emit nickUpdated(nick);
60 }
61
62 this->close();
63}
64
65void
66SettingDialog::onCancelClicked()
67{
68 this->close();
69}
70
71
72#if WAF
73#include "setting-dialog.moc"
74#include "setting-dialog.cpp.moc"
75#endif