Add SettingDialog
diff --git a/src/settingdialog.cpp b/src/settingdialog.cpp
new file mode 100644
index 0000000..291d7e6
--- /dev/null
+++ b/src/settingdialog.cpp
@@ -0,0 +1,51 @@
+/* -*- 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 "settingdialog.h"
+#include "ui_settingdialog.h"
+
+using namespace std;
+
+SettingDialog::SettingDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::SettingDialog)
+{
+ ui->setupUi(this);
+}
+
+SettingDialog::~SettingDialog()
+{
+ delete ui;
+}
+
+void
+setIdentity(const std::string& identity)
+{
+ m_identity = identity;
+ ui->identityLine->setText(QString::fromUtf8(m_identity.c_str()));
+}
+
+void
+SettingDialog::onOkClicked()
+{
+ QString text = ui->identityLine->text();
+ string identity = text.toUtf8().constData();
+ if(identity != m_identity)
+ {
+ m_identity = identity;
+ emit identitySet(text);
+ }
+}
+
+
+#if WAF
+#include "settingdialog.moc"
+#include "settingdialog.cpp.moc"
+#endif
diff --git a/src/settingdialog.h b/src/settingdialog.h
new file mode 100644
index 0000000..a06046d
--- /dev/null
+++ b/src/settingdialog.h
@@ -0,0 +1,44 @@
+/* -*- 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>
+ */
+
+#ifndef SETTINGDIALOG_H
+#define SETTINGDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class SettingDialog;
+}
+
+class SettingDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit SettingDialog(QWidget *parent = 0);
+ ~SettingDialog();
+
+ void
+ setIdentity(const std::string& identity);
+
+signals:
+ void
+ identitySet(const QString& identity);
+
+private slots:
+ void
+ onOkClicked();
+
+private:
+ Ui::SettingDialog *ui;
+ std::string m_identity;
+};
+
+#endif // SETTINGDIALOG_H
diff --git a/src/settingdialog.ui b/src/settingdialog.ui
new file mode 100644
index 0000000..5d3c04d
--- /dev/null
+++ b/src/settingdialog.ui
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SettingDialog</class>
+ <widget class="QDialog" name="SettingDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>300</width>
+ <height>140</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <widget class="QPushButton" name="okButton">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>90</y>
+ <width>100</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="msgLabel">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>150</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Current Identity:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="identityLine">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>50</y>
+ <width>260</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>