Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 1 | /* -*- 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 Yu | 3b318c1 | 2013-10-15 17:54:00 -0700 | [diff] [blame] | 16 | #include "contact-storage.h" |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 17 | #include "dns-storage.h" |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 18 | #include "contact-manager.h" |
Yingdi Yu | 3b318c1 | 2013-10-15 17:54:00 -0700 | [diff] [blame] | 19 | #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 | |
| 23 | using namespace ndn; |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 24 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame^] | 25 | class NewApp : public QApplication |
| 26 | { |
| 27 | public: |
| 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 | |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 47 | int main(int argc, char *argv[]) |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 48 | { |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame^] | 49 | NewApp app(argc, argv); |
Zhenkai Zhu | 3a008fc | 2012-06-08 17:36:39 -0700 | [diff] [blame] | 50 | |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 51 | |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 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 |
Zhenkai Zhu | 3a008fc | 2012-06-08 17:36:39 -0700 | [diff] [blame] | 56 | |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 57 | 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 Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 60 | |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 61 | ContactPanel contactPanel(contactManager); |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 62 | |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 63 | contactPanel.show (); |
| 64 | contactPanel.activateWindow (); |
| 65 | contactPanel.raise (); |
| 66 | |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 67 | return app.exec(); |
| 68 | } |