/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013, Regents of the University of California
 *                     Alexander Afanasyev
 *                     Zhenkai Zhu
 *
 * GNU v3.0 license, See the LICENSE file for more information
 *
 * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
 *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
 */

#ifndef CHATDIALOG_H
#define CHATDIALOG_H

#ifndef Q_MOC_RUN
#include <boost/function.hpp>
#include <boost/thread/recursive_mutex.hpp>

#include <vector>
#include "digesttreescene.h"
#include "ui_chatdialog.h"
#include "chatbuf.pb.h"
#include <sync-app-socket.h>
#include <sync-logic.h>
#include <sync-seq-no.h>
#endif

#include <QSystemTrayIcon>
#include <QMainWindow>
#include <QQueue>

#define ORGANIZATION "irl.cs.ucla.edu"
#define APPLICATION "ChronoChat"
#define MAX_HISTORY_ENTRY   20

class QAction;
class QMenu;
class QStringListModel;
class QTextTable;

class ChatDialog : public QDialog, private Ui::ChatDialog
{
	Q_OBJECT

public:
  ChatDialog(QWidget *parent = 0);
  ~ChatDialog();
  void setVisible(bool visible);
  void appendMessage(const SyncDemo::ChatMessage msg, bool isHistory = false);
  void processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>, Sync::SyncAppSocket *);
  void processDataWrapper(std::string, const char *buf, size_t len);
  void processDataNoShowWrapper(std::string, const char *buf, size_t len);
  void processDataHistoryWrapper(std::string, const char *buf, size_t len);
  void processRemoveWrapper(std::string);
  void respondHistoryRequest(std::string interest);

protected:
  void closeEvent(QCloseEvent *e);
  void changeEvent(QEvent *e);

public slots:
  void processTreeUpdate(const std::vector<Sync::MissingDataInfo>);
  void processData(QString name, const char *buf, size_t len, bool show, bool isHistory);
  void processRemove(QString);

private:
  void fetchHistory(std::string name);
  QString getRandomString();
  void formChatMessage(const QString &text, SyncDemo::ChatMessage &msg);
  void formControlMessage(SyncDemo::ChatMessage &msg, SyncDemo::ChatMessage::ChatMessageType type);
  void sendMsg(SyncDemo::ChatMessage &msg);
  bool readSettings();
  void writeSettings();
  void updateLabels();
  void resizeEvent(QResizeEvent *);
  void showEvent(QShowEvent *);
  void fitView();
  void testDraw();
  void createTrayIcon();
  void createActions();
  QString formatTime(time_t);
  void printTimeInCell(QTextTable *, time_t);
  void disableTreeDisplay();
  bool getLocalPrefix();
  void initializeSync();

private slots:
  void returnPressed();
  void buttonPressed();
  void treeButtonPressed();
  void checkSetting();
  void settingUpdated(QString, QString, QString);
  void sendHello();
  void sendJoin();
  void sendLeave();
  void replot();
  void updateRosterList(QStringList);
  void enableTreeDisplay();
  void updateLocalPrefix();
  void reap();
  void summonReaper();

  // icon related
  void iconActivated(QSystemTrayIcon::ActivationReason reason);
  void showMessage(QString, QString);
  void messageClicked();

signals:
  void dataReceived(QString name, const char *buf, size_t len, bool show, bool isHistory);
  void treeUpdated(const std::vector<Sync::MissingDataInfo>);
  void removeReceived(QString prefix);

private:
  User m_user; 
  Sync::SyncAppSocket *m_sock;
  uint32_t m_session;
  DigestTreeScene *m_scene;
  boost::recursive_mutex m_msgMutex;
  boost::recursive_mutex m_sceneMutex;
  time_t m_lastMsgTime;
  int m_randomizedInterval;
  QTimer *m_timer;
  QStringListModel *m_rosterModel;
  bool m_minimaniho;

  QQueue<SyncDemo::ChatMessage> m_history;
  bool m_historyInitialized;
  bool m_joined;

  QList<QString> m_zombieList;
  int m_zombieIndex;

  // icon related
  QAction *minimizeAction;
  QAction *maximizeAction;
  QAction *restoreAction;
  QAction *settingsAction;
  QAction *updateLocalPrefixAction;
  QAction *quitAction;
  QSystemTrayIcon *trayIcon;
  // QMenu *menuBar;
  QMenu *trayIconMenu;
};
#endif
