Adjust UI
diff --git a/src/addcontactpanel.cpp b/src/addcontactpanel.cpp
index aceac41..8b9d66b 100644
--- a/src/addcontactpanel.cpp
+++ b/src/addcontactpanel.cpp
@@ -1,14 +1,49 @@
+/* -*- 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 "addcontactpanel.h"
#include "ui_addcontactpanel.h"
-AddContactPanel::AddContactPanel(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::AddContactPanel)
+AddContactPanel::AddContactPanel(QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::AddContactPanel)
+ , m_selfEndorseCertificate(NULL)
{
- ui->setupUi(this);
+ ui->setupUi(this);
+
+ connect(ui->cancelButton, SIGNAL(clicked()),
+ this, SLOT(onCancelClicked()));
+ connect(ui->searchButton, SIGNAL(clicked()),
+ this, SLOT(onSearchClicked()));
}
AddContactPanel::~AddContactPanel()
{
delete ui;
}
+
+void
+AddContactPanel::onCancelClicked()
+{ this->close(); }
+
+void
+AddContactPanel::onSearchClicked()
+{
+}
+
+void
+AddContactPanel::onAddClicked()
+{
+}
+
+#if WAF
+#include "addcontactpanel.moc"
+#include "addcontactpanel.cpp.moc"
+#endif
diff --git a/src/addcontactpanel.h b/src/addcontactpanel.h
index c640394..5b35afe 100644
--- a/src/addcontactpanel.h
+++ b/src/addcontactpanel.h
@@ -1,8 +1,22 @@
+/* -*- 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 ADDCONTACTPANEL_H
#define ADDCONTACTPANEL_H
#include <QDialog>
+#ifndef Q_MOC_RUN
+#include "endorse-certificate.h"
+#endif
+
namespace Ui {
class AddContactPanel;
}
@@ -15,8 +29,19 @@
explicit AddContactPanel(QWidget *parent = 0);
~AddContactPanel();
+private slots:
+ void
+ onCancelClicked();
+
+ void
+ onSearchClicked();
+
+ void
+ onAddClicked();
+
private:
- Ui::AddContactPanel *ui;
+ Ui::AddContactPanel *ui;
+ Ptr<EndorseCertificate> m_selfEndorseCertificate;
};
#endif // ADDCONTACTPANEL_H
diff --git a/src/addcontactpanel.ui b/src/addcontactpanel.ui
index d2b0374..3632931 100644
--- a/src/addcontactpanel.ui
+++ b/src/addcontactpanel.ui
@@ -22,14 +22,14 @@
<height>481</height>
</rect>
</property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="1,15,1">
+ <layout class="QVBoxLayout" name="addContactPanelLayout" stretch="1,25,1">
<property name="spacing">
<number>10</number>
</property>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,5,2">
+ <layout class="QHBoxLayout" name="contactSearchLayout" stretch="1,5,2">
<item>
- <widget class="QLabel" name="label">
+ <widget class="QLabel" name="contactLabel">
<property name="font">
<font>
<weight>75</weight>
@@ -45,10 +45,10 @@
</widget>
</item>
<item>
- <widget class="QLineEdit" name="lineEdit"/>
+ <widget class="QLineEdit" name="contactInput"/>
</item>
<item>
- <widget class="QPushButton" name="pushButton">
+ <widget class="QPushButton" name="searchButton">
<property name="text">
<string>Search</string>
</property>
@@ -57,19 +57,19 @@
</layout>
</item>
<item>
- <widget class="QTableView" name="tableView"/>
+ <widget class="QTableWidget" name="infoView"/>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QHBoxLayout" name="buttonLayout">
<item>
- <widget class="QPushButton" name="pushButton_2">
+ <widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="pushButton_3">
+ <widget class="QPushButton" name="addButton">
<property name="text">
<string>Add</string>
</property>
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index 5dea76c..f103100 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -33,7 +33,8 @@
, ui(new Ui::ContactPanel)
, m_contactStorage(contactStorage)
, m_contactListModel(new QStringListModel)
- , m_profileEditor(NULL)
+ , m_profileEditor(new ProfileEditor(m_contactStorage))
+ , m_addContactPanel(new AddContactPanel())
{
ui->setupUi(this);
@@ -51,16 +52,22 @@
ui->ContactList->setModel(m_contactListModel);
QItemSelectionModel* selectionModel = ui->ContactList->selectionModel();
+
connect(selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
connect(ui->EditProfileButton, SIGNAL(clicked()),
this, SLOT(openProfileEditor()));
+
+ connect(ui->AddContactButton, SIGNAL(clicked()),
+ this, SLOT(openAddContactPanel()));
}
ContactPanel::~ContactPanel()
{
delete ui;
delete m_contactListModel;
+ delete m_profileEditor;
+ delete m_addContactPanel;
}
void
@@ -74,12 +81,11 @@
void
ContactPanel::openProfileEditor()
-{
- if(m_profileEditor == NULL)
- m_profileEditor = new ProfileEditor(m_contactStorage);
+{ m_profileEditor->show(); }
- m_profileEditor->show();
-}
+void
+ContactPanel::openAddContactPanel()
+{ m_addContactPanel->show(); }
#if WAF
#include "contactpanel.moc"
diff --git a/src/contactpanel.h b/src/contactpanel.h
index 5ee8ce7..4dd78d3 100644
--- a/src/contactpanel.h
+++ b/src/contactpanel.h
@@ -16,6 +16,7 @@
#include <QtSql/QSqlDatabase>
#include "profileeditor.h"
+#include "addcontactpanel.h"
#ifndef Q_MOC_RUN
#include "contact-storage.h"
@@ -41,11 +42,15 @@
void
openProfileEditor();
+ void
+ openAddContactPanel();
+
private:
Ui::ContactPanel *ui;
ndn::Ptr<ContactStorage> m_contactStorage;
QStringListModel* m_contactListModel;
ProfileEditor* m_profileEditor;
+ AddContactPanel* m_addContactPanel;
};
#endif // CONTACTPANEL_H
diff --git a/src/contactpanel.ui b/src/contactpanel.ui
index f0ee709..d2f156e 100644
--- a/src/contactpanel.ui
+++ b/src/contactpanel.ui
@@ -56,7 +56,7 @@
<item>
<widget class="QTabWidget" name="ContactInfo">
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="General">
<attribute name="title">
@@ -224,7 +224,7 @@
<attribute name="title">
<string>Endorse</string>
</attribute>
- <widget class="QTableView" name="endorseList">
+ <widget class="QTableWidget" name="endorseList">
<property name="geometry">
<rect>
<x>20</x>