blob: 98434ef0ed59d8f8c4576b22f631a4741da5d57c [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
Yingdi Yu0b0a7362014-08-05 16:31:30 -070011#include "setting-dialog.hpp"
Yingdi Yu348f5ea2014-03-01 14:47:25 -080012#include "ui_setting-dialog.h"
13
Yingdi Yu0b0a7362014-08-05 16:31:30 -070014namespace chronos {
15
16SettingDialog::SettingDialog(QWidget* parent)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080017 : QDialog(parent)
18 , ui(new Ui::SettingDialog)
19{
20 ui->setupUi(this);
Yingdi Yufa0b6a02014-04-30 14:26:42 -070021
Yingdi Yu348f5ea2014-03-01 14:47:25 -080022 connect(ui->saveButton, SIGNAL(clicked()),
23 this, SLOT(onSaveClicked()));
24 connect(ui->cancelButton, SIGNAL(clicked()),
25 this, SLOT(onCancelClicked()));
26}
27
28SettingDialog::~SettingDialog()
29{
30 delete ui;
31}
32
33void
34SettingDialog::setNick(const QString& nick)
35{
36 m_nick = nick;
37 ui->nickLine->setText(m_nick);
38}
39
40void
41SettingDialog::onIdentityUpdated(const QString& identity)
42{
43 m_identity = identity;
44 ui->identityLine->setText(m_identity);
45}
46
47void
48SettingDialog::onSaveClicked()
49{
50 QString identity = ui->identityLine->text();
51 QString nick = ui->nickLine->text();
52
53 if(identity != m_identity)
54 {
55 m_identity = identity;
56 emit identityUpdated(identity);
57 }
58 if(nick != m_nick)
59 {
60 m_nick = nick;
61 emit nickUpdated(nick);
62 }
63
64 this->close();
65}
66
67void
68SettingDialog::onCancelClicked()
69{
70 this->close();
71}
72
Yingdi Yu0b0a7362014-08-05 16:31:30 -070073} // namespace chronos
Yingdi Yu348f5ea2014-03-01 14:47:25 -080074
75#if WAF
76#include "setting-dialog.moc"
Yingdi Yu42125862014-08-07 17:04:28 -070077// #include "setting-dialog.cpp.moc"
Yingdi Yu348f5ea2014-03-01 14:47:25 -080078#endif