blob: 0ae3da1732ea77fcba5a7ac5c2436d5bc342b97a [file] [log] [blame]
Yingdi Yu614db142013-10-09 16:35:53 -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 <QApplication>
Yingdi Yudef90612013-10-09 22:34:42 -070012#include <QSystemTrayIcon>
Yingdi Yu614db142013-10-09 16:35:53 -070013
14#include "chronochat.h"
Yingdi Yu9e0dc292013-10-10 11:39:45 -070015#include "contactpanel.h"
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070016#include "contact-storage.h"
Yingdi Yuaa8d7692013-10-18 17:05:02 -070017#include "dns-storage.h"
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070018#include "contact-manager.h"
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070019#include <ndn.cxx/security/identity/identity-manager.h>
20#include <ndn.cxx/security/identity/osx-privatekey-storage.h>
21#include <ndn.cxx/security/identity/basic-identity-storage.h>
22
23using namespace ndn;
Yingdi Yu614db142013-10-09 16:35:53 -070024
Yingdi Yu42f66462013-10-31 17:38:22 -070025class NewApp : public QApplication
26{
27public:
28 NewApp(int & argc, char ** argv)
29 : QApplication(argc, argv)
30 {}
31
32 bool notify(QObject * receiver, QEvent * event)
33 {
34 try
35 {
36 return QApplication::notify(receiver, event);
37 }
38 catch(std::exception& e)
39 {
40 std::cerr << "Exception thrown:" << e.what() << endl;
41 return false;
42 }
43
44 }
45};
46
Yingdi Yu614db142013-10-09 16:35:53 -070047int main(int argc, char *argv[])
48{
Yingdi Yu42f66462013-10-31 17:38:22 -070049 NewApp app(argc, argv);
Yingdi Yu614db142013-10-09 16:35:53 -070050
Yingdi Yudef90612013-10-09 22:34:42 -070051
52// app.setWindowIcon(QIcon("/Users/yuyingdi/Develop/QT/demo.icns"));
53// // #else
54// // app.setWindowIcon(QIcon("/Users/yuyingdi/Develop/QT/images/icon_large.png"));
55// // #endif
Yingdi Yu614db142013-10-09 16:35:53 -070056
Yingdi Yuaa8d7692013-10-18 17:05:02 -070057 Ptr<ContactStorage> contactStorage = Ptr<ContactStorage>(new ContactStorage());
58 Ptr<DnsStorage> dnsStorage = Ptr<DnsStorage>(new DnsStorage());
59 Ptr<ContactManager> contactManager = Ptr<ContactManager>(new ContactManager(contactStorage, dnsStorage));
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070060
Yingdi Yuaa8d7692013-10-18 17:05:02 -070061 ContactPanel contactPanel(contactManager);
Yingdi Yu614db142013-10-09 16:35:53 -070062
Yingdi Yu9e0dc292013-10-10 11:39:45 -070063 contactPanel.show ();
64 contactPanel.activateWindow ();
65 contactPanel.raise ();
Yingdi Yu614db142013-10-09 16:35:53 -070066
67 return app.exec();
68}