blob: 9674146d0607cf324e0f55b30fa94a8aecdccc45 [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>
Qiuhan Ding8734b6b2015-03-10 12:35:01 -070012#include <QTextCodec>
Yingdi Yu348f5ea2014-03-01 14:47:25 -080013// #include <QSystemTrayIcon>
Yingdi Yu847aa862013-10-09 16:35:53 -070014
Yingdi Yu0b0a7362014-08-05 16:31:30 -070015#include "controller.hpp"
Yingdi Yu46948282013-11-06 18:43:31 -080016#include "logging.h"
Yingdi Yufa0b6a02014-04-30 14:26:42 -070017#include <ndn-cxx/face.hpp>
Yingdi Yufa4ce792014-02-06 18:09:22 -080018#include <boost/thread/thread.hpp>
Yingdi Yu3b318c12013-10-15 17:54:00 -070019
Yingdi Yu7989eb22013-10-31 17:38:22 -070020class NewApp : public QApplication
21{
22public:
Yingdi Yu0b0a7362014-08-05 16:31:30 -070023 NewApp(int& argc, char** argv)
Yingdi Yu7989eb22013-10-31 17:38:22 -070024 : QApplication(argc, argv)
Yingdi Yu0b0a7362014-08-05 16:31:30 -070025 {
26 }
Yingdi Yu7989eb22013-10-31 17:38:22 -070027
Yingdi Yu0b0a7362014-08-05 16:31:30 -070028 bool
29 notify(QObject* receiver, QEvent* event)
Yingdi Yu7989eb22013-10-31 17:38:22 -070030 {
Yingdi Yu8e135832013-11-09 20:12:31 -080031 try {
Yingdi Yu7989eb22013-10-31 17:38:22 -070032 return QApplication::notify(receiver, event);
Yingdi Yufa0b6a02014-04-30 14:26:42 -070033 }
Yingdi Yu0b0a7362014-08-05 16:31:30 -070034 catch (std::exception& e) {
Yingdi Yu76dd8002013-12-24 11:16:32 +080035 std::cerr << "Exception thrown:" << e.what() << std::endl;
Yingdi Yu8e135832013-11-09 20:12:31 -080036 return false;
37 }
Yingdi Yufa0b6a02014-04-30 14:26:42 -070038
Yingdi Yu7989eb22013-10-31 17:38:22 -070039 }
40};
41
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070042int main(int argc, char *argv[])
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070043{
Yingdi Yu7989eb22013-10-31 17:38:22 -070044 NewApp app(argc, argv);
Yingdi Yufa0b6a02014-04-30 14:26:42 -070045
Qiuhan Ding8734b6b2015-03-10 12:35:01 -070046 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
47 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
48
Yingdi Yueb692ac2015-02-10 18:46:18 -080049 chronochat::Controller controller;
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070050
Yingdi Yu348f5ea2014-03-01 14:47:25 -080051 app.setQuitOnLastWindowClosed(false);
Yingdi Yufa4ce792014-02-06 18:09:22 -080052
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070053 return app.exec();
54}