blob: df4511b47a8ed0e71f216804b7a88e09d1d11d86 [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
Yingdi Yu9e0dc292013-10-10 11:39:45 -070014#include "contactpanel.h"
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070015#include "contact-storage.h"
Yingdi Yuaa8d7692013-10-18 17:05:02 -070016#include "dns-storage.h"
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070017#include "contact-manager.h"
Yingdi Yu42372442013-11-06 18:43:31 -080018#include "logging.h"
Yingdi Yub29f78c2013-11-09 20:12:31 -080019#include <ndn.cxx/wrapper/wrapper.h>
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070020
Yingdi Yu42372442013-11-06 18:43:31 -080021INIT_LOGGER("MAIN");
22
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070023using 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)
Yingdi Yu42372442013-11-06 18:43:31 -080030 { }
Yingdi Yu42f66462013-10-31 17:38:22 -070031
32 bool notify(QObject * receiver, QEvent * event)
33 {
Yingdi Yub29f78c2013-11-09 20:12:31 -080034 try {
Yingdi Yu42f66462013-10-31 17:38:22 -070035 return QApplication::notify(receiver, event);
Yingdi Yub29f78c2013-11-09 20:12:31 -080036 }
37 catch(ndn::Error::ndnOperation& e){
38 std::cerr << "Canno connect to ndnd!" << endl;
39 return false;
40 }
41 catch(std::exception& e){
42 std::cerr << "Exception thrown:" << e.what() << endl;
43 return false;
44 }
Yingdi Yu42f66462013-10-31 17:38:22 -070045
46 }
47};
48
Yingdi Yu614db142013-10-09 16:35:53 -070049int main(int argc, char *argv[])
50{
Yingdi Yu42f66462013-10-31 17:38:22 -070051 NewApp app(argc, argv);
Yingdi Yu614db142013-10-09 16:35:53 -070052
Yingdi Yub29f78c2013-11-09 20:12:31 -080053 ContactPanel contactPanel;
Yingdi Yu614db142013-10-09 16:35:53 -070054
Yingdi Yu9e0dc292013-10-10 11:39:45 -070055 contactPanel.show ();
56 contactPanel.activateWindow ();
57 contactPanel.raise ();
Yingdi Yu614db142013-10-09 16:35:53 -070058
59 return app.exec();
60}