blob: df4511b47a8ed0e71f216804b7a88e09d1d11d86 [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
Yingdi Yu847aa862013-10-09 16:35:53 -070014#include "contactpanel.h"
Yingdi Yu3b318c12013-10-15 17:54:00 -070015#include "contact-storage.h"
Yingdi Yu4685b1b2013-10-18 17:05:02 -070016#include "dns-storage.h"
Yingdi Yu9236c432013-10-18 11:29:25 -070017#include "contact-manager.h"
Yingdi Yu46948282013-11-06 18:43:31 -080018#include "logging.h"
Yingdi Yu8e135832013-11-09 20:12:31 -080019#include <ndn.cxx/wrapper/wrapper.h>
Yingdi Yu3b318c12013-10-15 17:54:00 -070020
Yingdi Yu46948282013-11-06 18:43:31 -080021INIT_LOGGER("MAIN");
22
Yingdi Yu3b318c12013-10-15 17:54:00 -070023using namespace ndn;
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070024
Yingdi Yu7989eb22013-10-31 17:38:22 -070025class NewApp : public QApplication
26{
27public:
28 NewApp(int & argc, char ** argv)
29 : QApplication(argc, argv)
Yingdi Yu46948282013-11-06 18:43:31 -080030 { }
Yingdi Yu7989eb22013-10-31 17:38:22 -070031
32 bool notify(QObject * receiver, QEvent * event)
33 {
Yingdi Yu8e135832013-11-09 20:12:31 -080034 try {
Yingdi Yu7989eb22013-10-31 17:38:22 -070035 return QApplication::notify(receiver, event);
Yingdi Yu8e135832013-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 Yu7989eb22013-10-31 17:38:22 -070045
46 }
47};
48
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070049int main(int argc, char *argv[])
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070050{
Yingdi Yu7989eb22013-10-31 17:38:22 -070051 NewApp app(argc, argv);
Zhenkai Zhu3a008fc2012-06-08 17:36:39 -070052
Yingdi Yu8e135832013-11-09 20:12:31 -080053 ContactPanel contactPanel;
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070054
Yingdi Yu847aa862013-10-09 16:35:53 -070055 contactPanel.show ();
56 contactPanel.activateWindow ();
57 contactPanel.raise ();
58
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070059 return app.exec();
60}