blob: a8dca162a378bf59d4fcf4a28b5393d536794a57 [file] [log] [blame]
Yingdi Yue50bcf92013-10-23 10:31:08 -07001/* -*- 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 "settingdialog.h"
12#include "ui_settingdialog.h"
13
14using namespace std;
15
16SettingDialog::SettingDialog(QWidget *parent) :
17 QDialog(parent),
18 ui(new Ui::SettingDialog)
19{
20 ui->setupUi(this);
Yingdi Yu53eb8a72013-10-23 11:50:51 -070021
22 connect(ui->okButton, SIGNAL(clicked()),
23 this, SLOT(onOkClicked()));
Yingdi Yue50bcf92013-10-23 10:31:08 -070024}
25
26SettingDialog::~SettingDialog()
27{
28 delete ui;
29}
30
31void
Yingdi Yu53eb8a72013-10-23 11:50:51 -070032SettingDialog::setIdentity(const std::string& identity)
Yingdi Yue50bcf92013-10-23 10:31:08 -070033{
34 m_identity = identity;
35 ui->identityLine->setText(QString::fromUtf8(m_identity.c_str()));
36}
37
38void
39SettingDialog::onOkClicked()
40{
41 QString text = ui->identityLine->text();
42 string identity = text.toUtf8().constData();
43 if(identity != m_identity)
44 {
45 m_identity = identity;
46 emit identitySet(text);
47 }
Yingdi Yu53eb8a72013-10-23 11:50:51 -070048 this->close();
Yingdi Yue50bcf92013-10-23 10:31:08 -070049}
50
51
52#if WAF
53#include "settingdialog.moc"
54#include "settingdialog.cpp.moc"
55#endif