blob: 4e58e77571380d8a2ac6ee383f1f48248d1e0330 [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 Yu42372442013-11-06 18:43:31 -080019#include "logging.h"
Yingdi Yu0a6b6c52013-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 Yu42372442013-11-06 18:43:31 -080024INIT_LOGGER("MAIN");
25
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070026using namespace ndn;
Yingdi Yu614db142013-10-09 16:35:53 -070027
Yingdi Yu42f66462013-10-31 17:38:22 -070028class NewApp : public QApplication
29{
30public:
31 NewApp(int & argc, char ** argv)
32 : QApplication(argc, argv)
Yingdi Yu42372442013-11-06 18:43:31 -080033 { }
Yingdi Yu42f66462013-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
Yingdi Yu614db142013-10-09 16:35:53 -070050int main(int argc, char *argv[])
51{
Yingdi Yu42f66462013-10-31 17:38:22 -070052 NewApp app(argc, argv);
Yingdi Yu614db142013-10-09 16:35:53 -070053
Yingdi Yu42372442013-11-06 18:43:31 -080054 // app.setWindowIcon(QIcon(":/demo.icns"));
Yingdi Yudef90612013-10-09 22:34:42 -070055
Yingdi Yu42372442013-11-06 18:43:31 -080056 Ptr<ContactStorage> contactStorage = Ptr<ContactStorage>::Create();
57 Ptr<DnsStorage> dnsStorage = Ptr<DnsStorage>::Create();
Yingdi Yuaa8d7692013-10-18 17:05:02 -070058 Ptr<ContactManager> contactManager = Ptr<ContactManager>(new ContactManager(contactStorage, dnsStorage));
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070059
Yingdi Yuaa8d7692013-10-18 17:05:02 -070060 ContactPanel contactPanel(contactManager);
Yingdi Yu614db142013-10-09 16:35:53 -070061
Yingdi Yu9e0dc292013-10-10 11:39:45 -070062 contactPanel.show ();
63 contactPanel.activateWindow ();
64 contactPanel.raise ();
Yingdi Yu614db142013-10-09 16:35:53 -070065
66 return app.exec();
67}