blob: a8dca162a378bf59d4fcf4a28b5393d536794a57 [file] [log] [blame]
Yingdi Yuc2ab62c2013-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
Zhenkai Zhu85845d22012-06-01 23:10:43 -070011#include "settingdialog.h"
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070012#include "ui_settingdialog.h"
Zhenkai Zhu85845d22012-06-01 23:10:43 -070013
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070014using namespace std;
15
16SettingDialog::SettingDialog(QWidget *parent) :
17 QDialog(parent),
18 ui(new Ui::SettingDialog)
Zhenkai Zhu85845d22012-06-01 23:10:43 -070019{
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070020 ui->setupUi(this);
Yingdi Yu978b3ae2013-10-23 11:50:51 -070021
22 connect(ui->okButton, SIGNAL(clicked()),
23 this, SLOT(onOkClicked()));
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070024}
Zhenkai Zhu716addc2012-06-05 20:57:41 -070025
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070026SettingDialog::~SettingDialog()
27{
28 delete ui;
Zhenkai Zhu7e9b06d2012-06-02 00:44:42 -070029}
30
31void
Yingdi Yu978b3ae2013-10-23 11:50:51 -070032SettingDialog::setIdentity(const std::string& identity)
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070033{
34 m_identity = identity;
35 ui->identityLine->setText(QString::fromUtf8(m_identity.c_str()));
Zhenkai Zhu85845d22012-06-01 23:10:43 -070036}
Zhenkai Zhu56a60ce2012-06-02 12:55:07 -070037
38void
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070039SettingDialog::onOkClicked()
Zhenkai Zhu56a60ce2012-06-02 12:55:07 -070040{
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070041 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 Yu978b3ae2013-10-23 11:50:51 -070048 this->close();
Zhenkai Zhu56a60ce2012-06-02 12:55:07 -070049}
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070050
Yingdi Yuc2ab62c2013-10-23 10:31:08 -070051
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070052#if WAF
53#include "settingdialog.moc"
54#include "settingdialog.cpp.moc"
55#endif