blob: 4e58e77571380d8a2ac6ee383f1f48248d1e0330 [file] [log] [blame]
Yingdi Yu847aa862013-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>
12#include <QSystemTrayIcon>
13
14#include "chronochat.h"
15#include "contactpanel.h"
Yingdi Yu3b318c12013-10-15 17:54:00 -070016#include "contact-storage.h"
Yingdi Yu4685b1b2013-10-18 17:05:02 -070017#include "dns-storage.h"
Yingdi Yu9236c432013-10-18 11:29:25 -070018#include "contact-manager.h"
Yingdi Yu46948282013-11-06 18:43:31 -080019#include "logging.h"
Yingdi Yu3b318c12013-10-15 17:54:00 -070020#include <ndn.cxx/security/identity/identity-manager.h>
21#include <ndn.cxx/security/identity/osx-privatekey-storage.h>
22#include <ndn.cxx/security/identity/basic-identity-storage.h>
23
Yingdi Yu46948282013-11-06 18:43:31 -080024INIT_LOGGER("MAIN");
25
Yingdi Yu3b318c12013-10-15 17:54:00 -070026using namespace ndn;
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070027
Yingdi Yu7989eb22013-10-31 17:38:22 -070028class NewApp : public QApplication
29{
30public:
31 NewApp(int & argc, char ** argv)
32 : QApplication(argc, argv)
Yingdi Yu46948282013-11-06 18:43:31 -080033 { }
Yingdi Yu7989eb22013-10-31 17:38:22 -070034
35 bool notify(QObject * receiver, QEvent * event)
36 {
37 try
38 {
39 return QApplication::notify(receiver, event);
40 }
41 catch(std::exception& e)
42 {
43 std::cerr << "Exception thrown:" << e.what() << endl;
44 return false;
45 }
46
47 }
48};
49
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070050int main(int argc, char *argv[])
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070051{
Yingdi Yu7989eb22013-10-31 17:38:22 -070052 NewApp app(argc, argv);
Zhenkai Zhu3a008fc2012-06-08 17:36:39 -070053
Yingdi Yu46948282013-11-06 18:43:31 -080054 // app.setWindowIcon(QIcon(":/demo.icns"));
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070055
Yingdi Yu46948282013-11-06 18:43:31 -080056 Ptr<ContactStorage> contactStorage = Ptr<ContactStorage>::Create();
57 Ptr<DnsStorage> dnsStorage = Ptr<DnsStorage>::Create();
Yingdi Yu4685b1b2013-10-18 17:05:02 -070058 Ptr<ContactManager> contactManager = Ptr<ContactManager>(new ContactManager(contactStorage, dnsStorage));
Yingdi Yu9236c432013-10-18 11:29:25 -070059
Yingdi Yu4685b1b2013-10-18 17:05:02 -070060 ContactPanel contactPanel(contactManager);
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070061
Yingdi Yu847aa862013-10-09 16:35:53 -070062 contactPanel.show ();
63 contactPanel.activateWindow ();
64 contactPanel.raise ();
65
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070066 return app.exec();
67}